Merge branch 'agust@denx.de' of git://git.denx.de/u-boot-staging
[oweals/u-boot.git] / board / gateworks / gw_ventana / gw_ventana.c
index 8163d388e1a4cb8d57daff92b7bd666eb1a925e1..3b7c82b1dc125fe9c88f7f3921724562a7b1e9bd 100644 (file)
@@ -157,20 +157,18 @@ static iomux_v3_cfg_t const usb_pads[] = {
 
 int board_ehci_hcd_init(int port)
 {
-       struct ventana_board_info *info = &ventana_info;
        int gpio;
 
        SETUP_IOMUX_PADS(usb_pads);
 
-       /* Reset USB HUB (present on GW54xx/GW53xx) */
-       switch (info->model[3]) {
-       case '3': /* GW53xx */
-       case '5': /* GW552x */
-               SETUP_IOMUX_PAD(PAD_GPIO_9__GPIO1_IO09 | DIO_PAD_CFG);
+       /* Reset USB HUB */
+       switch (board_type) {
+       case GW53xx:
+       case GW552x:
                gpio = (IMX_GPIO_NR(1, 9));
                break;
-       case '4': /* GW54xx */
-               SETUP_IOMUX_PAD(PAD_SD1_DAT0__GPIO1_IO16 | DIO_PAD_CFG);
+       case GW54proto:
+       case GW54xx:
                gpio = (IMX_GPIO_NR(1, 16));
                break;
        default:
@@ -468,7 +466,7 @@ static void setup_display(void)
 /* setup board specific PMIC */
 int power_init_board(void)
 {
-       setup_pmic(board_type);
+       setup_pmic();
        return 0;
 }
 
@@ -659,7 +657,6 @@ static const struct boot_mode board_boot_modes[] = {
 int misc_init_r(void)
 {
        struct ventana_board_info *info = &ventana_info;
-       unsigned char reg;
 
        /* set env vars based on EEPROM data */
        if (ventana_info.model[0]) {
@@ -688,8 +685,7 @@ int misc_init_r(void)
                memset(str, 0, sizeof(str));
                for (i = 0; i < (sizeof(str)-1) && info->model[i]; i++)
                        str[i] = tolower(info->model[i]);
-               if (!getenv("model"))
-                       setenv("model", str);
+               setenv("model", str);
                if (!getenv("fdt_file")) {
                        sprintf(fdt, "%s-%s.dtb", cputype, str);
                        setenv("fdt_file", fdt);
@@ -699,18 +695,14 @@ int misc_init_r(void)
                        *p++ = 0;
 
                        setenv("model_base", str);
-                       if (!getenv("fdt_file1")) {
-                               sprintf(fdt, "%s-%s.dtb", cputype, str);
-                               setenv("fdt_file1", fdt);
-                       }
+                       sprintf(fdt, "%s-%s.dtb", cputype, str);
+                       setenv("fdt_file1", fdt);
                        if (board_type != GW551x && board_type != GW552x)
                                str[4] = 'x';
                        str[5] = 'x';
                        str[6] = 0;
-                       if (!getenv("fdt_file2")) {
-                               sprintf(fdt, "%s-%s.dtb", cputype, str);
-                               setenv("fdt_file2", fdt);
-                       }
+                       sprintf(fdt, "%s-%s.dtb", cputype, str);
+                       setenv("fdt_file2", fdt);
                }
 
                /* initialize env from EEPROM */
@@ -740,27 +732,8 @@ int misc_init_r(void)
        add_board_boot_modes(board_boot_modes);
 #endif
 
-       /*
-        *  The Gateworks System Controller implements a boot
-        *  watchdog (always enabled) as a workaround for IMX6 boot related
-        *  errata such as:
-        *    ERR005768 - no fix scheduled
-        *    ERR006282 - fixed in silicon r1.2
-        *    ERR007117 - fixed in silicon r1.3
-        *    ERR007220 - fixed in silicon r1.3
-        *    ERR007926 - no fix scheduled
-        *  see http://cache.freescale.com/files/32bit/doc/errata/IMX6DQCE.pdf
-        *
-        * Disable the boot watchdog and display/clear the timeout flag if set
-        */
-       i2c_set_bus_num(CONFIG_I2C_GSC);
-       if (!gsc_i2c_read(GSC_SC_ADDR, GSC_SC_CTRL1, 1, &reg, 1)) {
-               reg |= (1 << GSC_SC_CTRL1_WDDIS);
-               if (gsc_i2c_write(GSC_SC_ADDR, GSC_SC_CTRL1, 1, &reg, 1))
-                       puts("Error: could not disable GSC Watchdog\n");
-       } else {
-               puts("Error: could not disable GSC Watchdog\n");
-       }
+       /* disable boot watchdog */
+       gsc_boot_wd_disable();
 
        return 0;
 }
@@ -838,9 +811,11 @@ int ft_board_setup(void *blob, bd_t *bd)
                return 0;
        }
 
-       /* Update partition nodes using info from mtdparts env var */
-       puts("   Updating MTD partitions...\n");
-       fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
+       if (test_bit(EECONFIG_NAND, info->config)) {
+               /* Update partition nodes using info from mtdparts env var */
+               puts("   Updating MTD partitions...\n");
+               fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
+       }
 
        /* Update display timings from display env var */
        if (display) {
@@ -849,10 +824,6 @@ int ft_board_setup(void *blob, bd_t *bd)
                        printf("   Set display timings for %s...\n", display);
        }
 
-       if (!model) {
-               puts("invalid board info: Leaving FDT fully enabled\n");
-               return 0;
-       }
        printf("   Adjusting FDT per EEPROM for %s...\n", model);
 
        /* board serial number */