]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/karo/tx48/tx48.c
Merge tag 'KARO-TX6-2015-03-24' into uboot-merge
[karo-tx-uboot.git] / board / karo / tx48 / tx48.c
index 302a8b6190c687aa437eddd0d47f20e13455f659..8bc8bc51a6df9e489a11a42e42130293533c07be 100644 (file)
@@ -339,6 +339,7 @@ static const struct pin_mux tx48_i2c_pads[] = {
 static const struct gpio tx48_gpios[] = {
        { AM33XX_GPIO_NR(3, 5), GPIOF_INPUT, "I2C1_SDA", },
        { AM33XX_GPIO_NR(3, 6), GPIOF_INPUT, "I2C1_SCL", },
+       { AM33XX_GPIO_NR(3, 8), GPIOF_OUTPUT_INIT_LOW, "ETH_PHY_RESET", },
 };
 
 static const struct pin_mux stk5_pads[] = {
@@ -653,13 +654,14 @@ void lcd_ctrl_init(void *lcdbase)
        }
 
        karo_fdt_move_fdt();
-       lcd_bl_polarity = karo_fdt_get_backlight_polarity(working_fdt);
 
        if (video_mode == NULL) {
                debug("Disabling LCD\n");
                lcd_enabled = 0;
                return;
        }
+
+       lcd_bl_polarity = karo_fdt_get_backlight_polarity(working_fdt);
        vm = video_mode;
        if (karo_fdt_get_fb_mode(working_fdt, video_mode, &fb_mode) == 0) {
                p = &fb_mode;
@@ -844,8 +846,12 @@ int board_init(void)
        /* address of boot parameters */
        gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
 
-       if (ctrlc())
-               printf("CTRL-C detected\n");
+       if (ctrlc() || (prm_rstst & PRM_RSTST_WDT1_RST)) {
+               if (prm_rstst & PRM_RSTST_WDT1_RST)
+                       printf("WDOG RESET detected\n");
+               else
+                       printf("<CTRL-C> detected; safeboot enabled\n");
+       }
 
        gpio_request_array(tx48_gpios, ARRAY_SIZE(tx48_gpios));
        tx48_set_pin_mux(tx48_pads, ARRAY_SIZE(tx48_pads));
@@ -913,11 +919,9 @@ static void tx48_set_cpu_clock(void)
                return;
 
        if (had_ctrlc() || (prm_rstst & PRM_RSTST_WDT1_RST)) {
-               if (prm_rstst & PRM_RSTST_WDT1_RST) {
-                       printf("Watchdog reset detected; skipping cpu clock change\n");
-               } else {
-                       printf("<CTRL-C> detected; skipping cpu clock change\n");
-               }
+               printf("%s detected; skipping cpu clock change\n",
+                       (prm_rstst & PRM_RSTST_WDT1_RST) ?
+                       "WDOG RESET" : "<CTRL-C>");
                return;
        }
 
@@ -964,8 +968,16 @@ int board_late_init(void)
        int ret = 0;
        const char *baseboard;
 
+       env_cleanup();
+
        tx48_set_cpu_clock();
-       karo_fdt_move_fdt();
+
+       if (had_ctrlc())
+               setenv_ulong("safeboot", 1);
+       else if (prm_rstst & PRM_RSTST_WDT1_RST)
+               setenv_ulong("wdreset", 1);
+       else
+               karo_fdt_move_fdt();
 
        baseboard = getenv("baseboard");
        if (!baseboard)