X-Git-Url: https://git.kernelconcepts.de/?p=karo-tx-uboot.git;a=blobdiff_plain;f=board%2Fkaro%2Ftx28%2Ftx28.c;h=25d61c2abc52f2b14f852c7a790d70e7e32ed813;hp=b6ea8fbf78535b653bb4747f4b723e76d2b78322;hb=74999ac6506460c72d982cff261575729c4f725a;hpb=ffb54e6372daca45cd91612b003798cee957b781 diff --git a/board/karo/tx28/tx28.c b/board/karo/tx28/tx28.c index b6ea8fbf78..25d61c2abc 100644 --- a/board/karo/tx28/tx28.c +++ b/board/karo/tx28/tx28.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -167,10 +168,8 @@ rtc_err: int board_init(void) { - if (ctrlc()) { + if (ctrlc()) printf("CTRL-C detected; safeboot enabled\n"); - return 1; - } /* Address of boot parameters */ #ifdef CONFIG_OF_LIBFDT @@ -200,7 +199,7 @@ int board_mmc_init(bd_t *bis) #ifdef CONFIG_FEC_MXC #ifdef CONFIG_GET_FEC_MAC_ADDR_FROM_IIM -#ifdef CONFIG_FEC_MXC_MULTI +#ifndef CONFIG_TX28_S #define FEC_MAX_IDX 1 #else #define FEC_MAX_IDX 0 @@ -241,7 +240,7 @@ static int fec_get_mac_addr(int index) val = readl(&cust[index * 8 + i]); mac[i] = val >> shift; } - if (!is_valid_ether_addr(mac)) { + if (!is_valid_ethaddr(mac)) { if (index == 0) printf("No valid MAC address programmed\n"); return 0; @@ -256,6 +255,46 @@ static int fec_get_mac_addr(int index) eth_setenv_enetaddr(env_name, mac); return 0; } + +static inline int tx28_fec1_enabled(void) +{ + const char *status; + int off; + + if (!gd->fdt_blob) + return 0; + + off = fdt_path_offset(gd->fdt_blob, "ethernet1"); + if (off < 0) + return 0; + + status = fdt_getprop(gd->fdt_blob, off, "status", NULL); + return status && (strcmp(status, "okay") == 0); +} + +static void tx28_init_mac(void) +{ + int ret; + + ret = fec_get_mac_addr(0); + if (ret < 0) { + printf("Failed to read FEC0 MAC address from OCOTP\n"); + return; + } +#ifdef CONFIG_TX28_S + if (tx28_fec1_enabled()) { + ret = fec_get_mac_addr(1); + if (ret < 0) { + printf("Failed to read FEC1 MAC address from OCOTP\n"); + return; + } + } +#endif +} +#else +static inline void tx28_init_mac(void) +{ +} #endif /* CONFIG_GET_FEC_MAC_ADDR_FROM_IIM */ static const iomux_cfg_t tx28_fec_pads[] = { @@ -292,7 +331,7 @@ int board_eth_init(bd_t *bis) return ret; } -#ifdef CONFIG_FEC_MXC_MULTI +#ifndef CONFIG_TX28_S if (getenv("ethaddr")) { ret = fecmxc_initialize_multi(bis, 0, 0, MXS_ENET0_BASE); if (ret) { @@ -319,6 +358,10 @@ int board_eth_init(bd_t *bis) #endif return 0; } +#else +static inline void tx28_init_mac(void) +{ +} #endif /* CONFIG_FEC_MXC */ enum { @@ -583,8 +626,6 @@ static const struct gpio stk5_lcd_gpios[] = { { TX28_LCD_BACKLIGHT_GPIO, GPIOFLAG_OUTPUT_INIT_HIGH, "LCD BACKLIGHT", }, }; -extern void video_hw_init(void *lcdbase); - void lcd_ctrl_init(void *lcdbase) { int color_depth = 24; @@ -768,7 +809,7 @@ void lcd_ctrl_init(void *lcdbase) setenv("videomode", vmode); debug("Initializing LCD controller\n"); - video_hw_init(lcdbase); + video_hw_init(); setenv("videomode", NULL); } else { debug("Skipping initialization of LCD controller\n"); @@ -796,43 +837,7 @@ static void stk5v5_board_init(void) /* init flexcan transceiver enable GPIO */ gpio_request_one(STK5_CAN_XCVR_GPIO, GPIOFLAG_OUTPUT_INIT_HIGH, "Flexcan Transceiver"); - SETUP_IOMUX_PAD(STK5_CAN_XCVR_GPIO); -} - -int tx28_fec1_enabled(void) -{ - const char *status; - int off; - - if (!gd->fdt_blob) - return 0; - - off = fdt_path_offset(gd->fdt_blob, "ethernet1"); - if (off < 0) - return 0; - - status = fdt_getprop(gd->fdt_blob, off, "status", NULL); - return status && (strcmp(status, "okay") == 0); -} - -static void tx28_init_mac(void) -{ - int ret; - - ret = fec_get_mac_addr(0); - if (ret < 0) { - printf("Failed to read FEC0 MAC address from OCOTP\n"); - return; - } -#ifdef CONFIG_FEC_MXC_MULTI - if (tx28_fec1_enabled()) { - ret = fec_get_mac_addr(1); - if (ret < 0) { - printf("Failed to read FEC1 MAC address from OCOTP\n"); - return; - } - } -#endif + mxs_iomux_setup_pad(STK5_CAN_XCVR_GPIO); } int board_late_init(void) @@ -873,7 +878,8 @@ int board_late_init(void) } else { printf("WARNING: Unsupported baseboard: '%s'\n", baseboard); - ret = -EINVAL; + if (!had_ctrlc()) + ret = -EINVAL; } exit: @@ -908,7 +914,7 @@ int checkboard(void) const char *dlm = ""; printf("Board: Ka-Ro TX28-4%sx%d\n", TX28_MOD_SUFFIX, - CONFIG_SDRAM_SIZE / SZ_128M + + CONFIG_SYS_SDRAM_SIZE / SZ_128M + CONFIG_SYS_NAND_BLOCKS / 2048 * 2); printf("POWERUP Source: "); @@ -1005,7 +1011,6 @@ int ft_board_setup(void *blob, bd_t *bd) karo_fdt_enable_node(blob, "stk5led", 0); fdt_fixup_mtdparts(blob, tx28_nand_nodes, ARRAY_SIZE(tx28_nand_nodes)); - fdt_fixup_ethernet(blob); karo_fdt_fixup_touchpanel(blob, tx28_touchpanels, ARRAY_SIZE(tx28_touchpanels));