]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/karo/tx48/tx48.c
net: cosmetic: Name ethaddr variables consistently
[karo-tx-uboot.git] / board / karo / tx48 / tx48.c
index 0bc8d9111a44f5a0ef7b22429c0be7324bee68f8..95a98a92362a7528805bcc14fc752a29705b2065 100644 (file)
@@ -337,9 +337,9 @@ 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", },
+       { AM33XX_GPIO_NR(3, 5), GPIOFLAG_INPUT, "I2C1_SDA", },
+       { AM33XX_GPIO_NR(3, 6), GPIOFLAG_INPUT, "I2C1_SCL", },
+       { AM33XX_GPIO_NR(3, 8), GPIOFLAG_OUTPUT_INIT_LOW, "ETH_PHY_RESET", },
 };
 
 static const struct pin_mux stk5_pads[] = {
@@ -356,8 +356,8 @@ static const struct pin_mux stk5_pads[] = {
 };
 
 static const struct gpio stk5_gpios[] = {
-       { TX48_LED_GPIO, GPIOF_OUTPUT_INIT_LOW, "HEARTBEAT LED", },
-       { TX48_MMC_CD_GPIO, GPIOF_INPUT, "MMC0 CD", },
+       { TX48_LED_GPIO, GPIOFLAG_OUTPUT_INIT_LOW, "HEARTBEAT LED", },
+       { TX48_MMC_CD_GPIO, GPIOFLAG_INPUT, "MMC0 CD", },
 };
 
 static const struct pin_mux stk5_lcd_pads[] = {
@@ -386,9 +386,9 @@ static const struct pin_mux stk5_lcd_pads[] = {
 };
 
 static const struct gpio stk5_lcd_gpios[] = {
-       { AM33XX_GPIO_NR(1, 19), GPIOF_OUTPUT_INIT_LOW, "LCD RESET", },
-       { AM33XX_GPIO_NR(1, 22), GPIOF_OUTPUT_INIT_LOW, "LCD POWER", },
-       { AM33XX_GPIO_NR(3, 14), GPIOF_OUTPUT_INIT_HIGH, "LCD BACKLIGHT", },
+       { AM33XX_GPIO_NR(1, 19), GPIOFLAG_OUTPUT_INIT_LOW, "LCD RESET", },
+       { AM33XX_GPIO_NR(1, 22), GPIOFLAG_OUTPUT_INIT_LOW, "LCD POWER", },
+       { AM33XX_GPIO_NR(3, 14), GPIOFLAG_OUTPUT_INIT_HIGH, "LCD BACKLIGHT", },
 };
 
 static const struct pin_mux stk5v5_pads[] = {
@@ -397,7 +397,7 @@ static const struct pin_mux stk5v5_pads[] = {
 };
 
 static const struct gpio stk5v5_gpios[] = {
-       { AM33XX_GPIO_NR(0, 22), GPIOF_OUTPUT_INIT_HIGH, "CAN XCVR", },
+       { AM33XX_GPIO_NR(0, 22), GPIOFLAG_OUTPUT_INIT_HIGH, "CAN XCVR", },
 };
 
 #ifdef CONFIG_LCD
@@ -407,7 +407,7 @@ vidinfo_t panel_info = {
        .vl_col = 1366,
        .vl_row = 768,
 
-       .vl_bpix = LCD_COLOR24,    /* Bits per pixel, 0: 1bpp, 1: 2bpp, 2: 4bpp, 3: 8bpp ... */
+       .vl_bpix = LCD_COLOR32,    /* Bits per pixel, 0: 1bpp, 1: 2bpp, 2: 4bpp, 3: 8bpp ... */
        .cmap = tx48_cmap,
 };
 
@@ -773,7 +773,7 @@ void lcd_ctrl_init(void *lcdbase)
                panel_info.vl_bpix = LCD_COLOR16;
                break;
        default:
-               panel_info.vl_bpix = LCD_COLOR24;
+               panel_info.vl_bpix = LCD_COLOR32;
        }
 
        p->pixclock = KHZ2PICOS(refresh *
@@ -846,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));
@@ -915,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;
        }
 
@@ -952,7 +954,7 @@ static void tx48_init_mac(void)
        mac_addr[4] = mac_lo & 0xFF;
        mac_addr[5] = (mac_lo & 0xFF00) >> 8;
 
-       if (!is_valid_ether_addr(mac_addr)) {
+       if (!is_valid_ethaddr(mac_addr)) {
                printf("No valid MAC address programmed\n");
                return;
        }
@@ -966,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)
@@ -1126,7 +1136,7 @@ static const char *tx48_touchpanels[] = {
        "ti,am3359-tscadc",
 };
 
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
 {
        const char *baseboard = getenv("baseboard");
        int stk5_v5 = baseboard != NULL && (strcmp(baseboard, "stk5-v5") == 0);
@@ -1134,9 +1144,10 @@ void ft_board_setup(void *blob, bd_t *bd)
        int ret;
 
        ret = fdt_increase_size(blob, 4096);
-       if (ret)
+       if (ret) {
                printf("Failed to increase FDT size: %s\n", fdt_strerror(ret));
-
+               return ret;
+       }
        fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
        fdt_fixup_ethernet(blob);
 
@@ -1154,5 +1165,7 @@ void ft_board_setup(void *blob, bd_t *bd)
                karo_fdt_del_prop(blob, "lltc,ltc3589-2", 0x34,
                                "interrupt-parent");
        }
+
+       return 0;
 }
 #endif /* CONFIG_OF_BOARD_SETUP */