]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/freescale/mx53loco/mx53loco.c
Merge branch 'master' of git://git.denx.de/u-boot-video
[karo-tx-uboot.git] / board / freescale / mx53loco / mx53loco.c
index dec966ddd6aa3caeaa377645101d13b9e35a3e64..81c511cdc187fd22cd4887dd2e0a0e79a88d819d 100644 (file)
 #include <asm/arch/iomux.h>
 #include <asm/arch/clock.h>
 #include <asm/errno.h>
+#include <asm/imx-common/mx5_video.h>
 #include <netdev.h>
 #include <i2c.h>
 #include <mmc.h>
 #include <fsl_esdhc.h>
 #include <asm/gpio.h>
-#include <pmic.h>
+#include <power/pmic.h>
 #include <dialog_pmic.h>
 #include <fsl_pmic.h>
+#include <linux/fb.h>
+#include <ipu_pixfmt.h>
+
+#define MX53LOCO_LCD_POWER             IMX_GPIO_NR(3, 24)
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -71,6 +76,9 @@ u32 get_board_rev(void)
 
        int rev = readl(&fuse->gp[6]);
 
+       if (!i2c_probe(CONFIG_SYS_DIALOG_PMIC_I2C_ADDR))
+               rev = 0;
+
        return (get_cpu_rev() & ~(0xF << 8)) | (rev & 0xF) << 8;
 }
 
@@ -158,8 +166,8 @@ static void setup_iomux_fec(void)
 
 #ifdef CONFIG_FSL_ESDHC
 struct fsl_esdhc_cfg esdhc_cfg[2] = {
-       {MMC_SDHC1_BASE_ADDR, 1},
-       {MMC_SDHC3_BASE_ADDR, 1},
+       {MMC_SDHC1_BASE_ADDR},
+       {MMC_SDHC3_BASE_ADDR},
 };
 
 int board_mmc_getcd(struct mmc *mmc)
@@ -168,14 +176,14 @@ int board_mmc_getcd(struct mmc *mmc)
        int ret;
 
        mxc_request_iomux(MX53_PIN_EIM_DA11, IOMUX_CONFIG_ALT1);
-       gpio_direction_input(75);
+       gpio_direction_input(IMX_GPIO_NR(3, 11));
        mxc_request_iomux(MX53_PIN_EIM_DA13, IOMUX_CONFIG_ALT1);
-       gpio_direction_input(77);
+       gpio_direction_input(IMX_GPIO_NR(3, 13));
 
        if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR)
-               ret = !gpio_get_value(77); /* GPIO3_13 */
+               ret = !gpio_get_value(IMX_GPIO_NR(3, 13));
        else
-               ret = !gpio_get_value(75); /* GPIO3_11 */
+               ret = !gpio_get_value(IMX_GPIO_NR(3, 11));
 
        return ret;
 }
@@ -185,6 +193,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_ESDHC3_CLK);
+
        for (index = 0; index < CONFIG_SYS_FSL_ESDHC_NUM; index++) {
                switch (index) {
                case 0:
@@ -334,10 +345,16 @@ static int power_init(void)
        unsigned int val;
        int ret = -1;
        struct pmic *p;
+       int retval;
 
        if (!i2c_probe(CONFIG_SYS_DIALOG_PMIC_I2C_ADDR)) {
-               pmic_dialog_init();
-               p = get_pmic();
+               retval = pmic_dialog_init(I2C_PMIC);
+               if (retval)
+                       return retval;
+
+               p = pmic_get("DIALOG_PMIC");
+               if (!p)
+                       return -ENODEV;
 
                /* Set VDDA to 1.25V */
                val = DA9052_BUCKCORE_BCOREEN | DA_BUCKCORE_VBCORE_1_250V;
@@ -353,8 +370,13 @@ static int power_init(void)
        }
 
        if (!i2c_probe(CONFIG_SYS_FSL_PMIC_I2C_ADDR)) {
-               pmic_init();
-               p = get_pmic();
+               retval = pmic_init(I2C_PMIC);
+               if (retval)
+                       return retval;
+
+               p = pmic_get("DIALOG_PMIC");
+               if (!p)
+                       return -ENODEV;
 
                /* Set VDDGP to 1.25V for 1GHz on SW1 */
                pmic_reg_read(p, REG_SW_0, &val);
@@ -387,7 +409,7 @@ static int power_init(void)
 static void clock_1GHz(void)
 {
        int ret;
-       u32 ref_clk = CONFIG_SYS_MX5_HCLK;
+       u32 ref_clk = MXC_HCLK;
        /*
         * After increasing voltage to 1.25V, we can switch
         * CPU clock to 1GHz and DDR to 400MHz safely
@@ -406,6 +428,7 @@ int board_early_init_f(void)
 {
        setup_iomux_uart();
        setup_iomux_fec();
+       setup_iomux_lcd();
 
        return 0;
 }
@@ -424,23 +447,26 @@ int print_cpuinfo(void)
        return 0;
 }
 
-#ifdef CONFIG_BOARD_LATE_INIT
-int board_late_init(void)
+/*
+ * Do not overwrite the console
+ * Use always serial for U-Boot console
+ */
+int overwrite_console(void)
 {
-       setup_iomux_i2c();
-       if (!power_init())
-               clock_1GHz();
-       print_cpuinfo();
-
-       return 0;
+       return 1;
 }
-#endif
 
 int board_init(void)
 {
        gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
 
        mxc_set_sata_internal_clock();
+       setup_iomux_i2c();
+       if (!power_init())
+               clock_1GHz();
+       print_cpuinfo();
+
+       lcd_enable();
 
        return 0;
 }