]> git.sur5r.net Git - u-boot/blobdiff - board/freescale/mx51evk/mx51evk.c
Merge branch 'master' of git://git.denx.de/u-boot-arm
[u-boot] / board / freescale / mx51evk / mx51evk.c
index bc7f05796c2edfda58d127f31f8a85ac65cb7736..421d8c224444e4ba935f71e6cf9fde39307e385a 100644 (file)
@@ -29,6 +29,7 @@
 #include <asm/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/crm_regs.h>
+#include <asm/arch/clock.h>
 #include <i2c.h>
 #include <mmc.h>
 #include <fsl_esdhc.h>
 #include <linux/fb.h>
 #include <ipu_pixfmt.h>
 
-#define MX51EVK_LCD_3V3                (3 * 32 + 9)    /* GPIO4_9 */
-#define MX51EVK_LCD_5V         (3 * 32 + 10)   /* GPIO4_10 */
-#define MX51EVK_LCD_BACKLIGHT  (2 * 32 + 4)    /* GPIO3_4 */
+#define MX51EVK_LCD_3V3                IMX_GPIO_NR(4, 9)
+#define MX51EVK_LCD_5V         IMX_GPIO_NR(4, 10)
+#define MX51EVK_LCD_BACKLIGHT  IMX_GPIO_NR(3, 4)
 
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_FSL_ESDHC
 struct fsl_esdhc_cfg esdhc_cfg[2] = {
-       {MMC_SDHC1_BASE_ADDR, 1},
-       {MMC_SDHC2_BASE_ADDR, 1},
+       {MMC_SDHC1_BASE_ADDR},
+       {MMC_SDHC2_BASE_ADDR},
 };
 #endif
 
@@ -60,6 +61,14 @@ int dram_init(void)
        return 0;
 }
 
+u32 get_board_rev(void)
+{
+       u32 rev = get_cpu_rev();
+       if (!gpio_get_value(IMX_GPIO_NR(1, 22)))
+               rev |= BOARD_REV_2_0 << BOARD_VER_OFFSET;
+       return rev;
+}
+
 static void setup_iomux_uart(void)
 {
        unsigned int pad = PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE |
@@ -319,11 +328,11 @@ static void power_init(void)
        pmic_reg_write(p, REG_MODE_1, val);
 
        mxc_request_iomux(MX51_PIN_EIM_A20, IOMUX_CONFIG_ALT1);
-       gpio_direction_output(46, 0);
+       gpio_direction_output(IMX_GPIO_NR(2, 14), 0);
 
        udelay(500);
 
-       gpio_set_value(46, 1);
+       gpio_set_value(IMX_GPIO_NR(2, 14), 1);
 }
 
 #ifdef CONFIG_FSL_ESDHC
@@ -333,14 +342,14 @@ int board_mmc_getcd(struct mmc *mmc)
        int ret;
 
        mxc_request_iomux(MX51_PIN_GPIO1_0, IOMUX_CONFIG_ALT1);
-       gpio_direction_input(0);
+       gpio_direction_input(IMX_GPIO_NR(1, 0));
        mxc_request_iomux(MX51_PIN_GPIO1_6, IOMUX_CONFIG_ALT0);
-       gpio_direction_input(6);
+       gpio_direction_input(IMX_GPIO_NR(1, 6));
 
        if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
-               ret = !gpio_get_value(0);
+               ret = !gpio_get_value(IMX_GPIO_NR(1, 0));
        else
-               ret = !gpio_get_value(6);
+               ret = !gpio_get_value(IMX_GPIO_NR(1, 6));
 
        return ret;
 }
@@ -350,6 +359,9 @@ int board_mmc_init(bd_t *bis)
        u32 index;
        s32 status = 0;
 
+       esdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
+       esdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
+
        for (index = 0; index < CONFIG_SYS_FSL_ESDHC_NUM;
                        index++) {
                switch (index) {
@@ -459,7 +471,7 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
-static struct fb_videomode claa_wvga = {
+static struct fb_videomode const claa_wvga = {
        .name           = "CLAA07LC0ACW",
        .refresh        = 57,
        .xres           = 800,
@@ -502,7 +514,7 @@ void lcd_iomux(void)
 
 void lcd_enable(void)
 {
-       int ret = mx51_fb_init(&claa_wvga, 1, IPU_PIX_FMT_RGB565);
+       int ret = ipuv3_fb_init(&claa_wvga, 1, IPU_PIX_FMT_RGB565);
        if (ret)
                printf("LCD cannot be configured: %d\n", ret);
 }
@@ -536,12 +548,20 @@ int board_late_init(void)
        setup_iomux_spi();
        power_init();
 #endif
-       setenv("stdout", "serial");
 
        return 0;
 }
 #endif
 
+/*
+ * Do not overwrite the console
+ * Use always serial for U-Boot console
+ */
+int overwrite_console(void)
+{
+       return 1;
+}
+
 int checkboard(void)
 {
        puts("Board: MX51EVK\n");