[U-Boot] [PATCHv1 0/7] Merge B850v3, B650v3 and B450v3 targets

Hi,
This merges B{468}50v3 into a BX50V3 target, that works for all three machines. The different boards are detected at runtime.
-- Sebastian
Ian Ray (5): board: ge: bx50v3: rename detect_baseboard function board: ge: bx50v3: fix display support for b{46}50v3 board: ge: bx50v3: use VPD instead of compile-time checks board: ge: bx50v3: configure video arguments using VPD board: ge: bx50v3: remove redundant targets
Nandor Han (2): board: ge: bx50v3: unify two switch statements board: ge: bx50v3: detect the monitor type by reading VPD earlier
arch/arm/mach-imx/mx6/Kconfig | 14 +--- board/ge/bx50v3/Kconfig | 2 +- board/ge/bx50v3/bx50v3.c | 71 ++++++++++++------- configs/ge_b650v3_defconfig | 43 ----------- configs/ge_b850v3_defconfig | 43 ----------- ...e_b450v3_defconfig => ge_bx50v3_defconfig} | 3 +- include/configs/ge_bx50v3.h | 16 +---- 7 files changed, 52 insertions(+), 140 deletions(-) delete mode 100644 configs/ge_b650v3_defconfig delete mode 100644 configs/ge_b850v3_defconfig rename configs/{ge_b450v3_defconfig => ge_bx50v3_defconfig} (93%)

From: Ian Ray ian.ray@ge.com
The detect_baseboard() function actually determines whether there is an internal LCD panel or not. Rename for clarity.
Signed-off-by: Ian Ray ian.ray@ge.com Signed-off-by: Nandor Han nandor.han@ge.com Signed-off-by: Sebastian Reichel sebastian.reichel@collabora.co.uk --- board/ge/bx50v3/bx50v3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c index 46321ae666f1..72a2e3304bac 100644 --- a/board/ge/bx50v3/bx50v3.c +++ b/board/ge/bx50v3/bx50v3.c @@ -362,7 +362,7 @@ int board_cfb_skip(void) return 0; }
-static int detect_baseboard(struct display_info_t const *dev) +static int detect_lcd(struct display_info_t const *dev) { if (IS_ENABLED(CONFIG_TARGET_GE_B450V3) || IS_ENABLED(CONFIG_TARGET_GE_B650V3)) @@ -375,7 +375,7 @@ struct display_info_t const displays[] = {{ .bus = -1, .addr = -1, .pixfmt = IPU_PIX_FMT_RGB24, - .detect = detect_baseboard, + .detect = detect_lcd, .enable = NULL, .mode = { .name = "G121X1-L03",

From: Nandor Han nandor.han@ge.com
Simplify process_vpd() by unifying the switch statements handling product specific configurations.
Signed-off-by: Nandor Han nandor.han@ge.com Signed-off-by: Sebastian Reichel sebastian.reichel@collabora.co.uk --- board/ge/bx50v3/bx50v3.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c index 72a2e3304bac..5e84f2e630e3 100644 --- a/board/ge/bx50v3/bx50v3.c +++ b/board/ge/bx50v3/bx50v3.c @@ -594,23 +594,16 @@ static void process_vpd(struct vpd_cache *vpd) switch (vpd->product_id) { case VPD_PRODUCT_B450: env_set("confidx", "1"); + i210_index = 0; + fec_index = 1; break; case VPD_PRODUCT_B650: env_set("confidx", "2"); - break; - case VPD_PRODUCT_B850: - env_set("confidx", "3"); - break; - } - - switch (vpd->product_id) { - case VPD_PRODUCT_B450: - /* fall thru */ - case VPD_PRODUCT_B650: i210_index = 0; fec_index = 1; break; case VPD_PRODUCT_B850: + env_set("confidx", "3"); i210_index = 1; fec_index = 2; break;

From: Ian Ray ian.ray@ge.com
Enable Video PLL to fix non-working display support for Bx50v3 internal displays.
Signed-off-by: Ian Ray ian.ray@ge.com Signed-off-by: Nandor Han nandor.han@ge.com Signed-off-by: Sebastian Reichel sebastian.reichel@collabora.co.uk --- board/ge/bx50v3/bx50v3.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c index 5e84f2e630e3..3c8689682141 100644 --- a/board/ge/bx50v3/bx50v3.c +++ b/board/ge/bx50v3/bx50v3.c @@ -493,6 +493,8 @@ static void setup_display_bx50v3(void) struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
+ enable_videopll(); + /* When a reset/reboot is performed the display power needs to be turned * off for atleast 500ms. The boot time is ~300ms, we need to wait for * an additional 200ms here. Unfortunately we use external PMIC for

From: Nandor Han nandor.han@ge.com
Move the VPD reading earlier in order to establish the monitor type as soon as possible.
The configuration of the specific environment variables needs to be done later after the environment is configured.
Signed-off-by: Nandor Han nandor.han@ge.com Signed-off-by: Sebastian Reichel sebastian.reichel@collabora.co.uk --- board/ge/bx50v3/bx50v3.c | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-)
diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c index 3c8689682141..c988043a137f 100644 --- a/board/ge/bx50v3/bx50v3.c +++ b/board/ge/bx50v3/bx50v3.c @@ -34,6 +34,11 @@ #include "../../../drivers/net/e1000.h" DECLARE_GLOBAL_DATA_PTR;
+struct vpd_cache; + +static int confidx = 3; /* Default to b850v3. */ +static struct vpd_cache vpd; + #ifndef CONFIG_SYS_I2C_EEPROM_ADDR # define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 # define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 @@ -620,7 +625,6 @@ static void process_vpd(struct vpd_cache *vpd)
static int read_vpd(uint eeprom_bus) { - struct vpd_cache vpd; int res; int size = 1024; uint8_t *data; @@ -640,7 +644,6 @@ static int read_vpd(uint eeprom_bus) if (res == 0) { memset(&vpd, 0, sizeof(vpd)); vpd_reader(size, data, &vpd, vpd_callback); - process_vpd(&vpd); }
free(data); @@ -690,8 +693,31 @@ int board_early_init_f(void) return 0; }
+static void set_confidx(const struct vpd_cache* vpd) +{ + switch (vpd->product_id) { + case VPD_PRODUCT_B450: + confidx = 1; + break; + case VPD_PRODUCT_B650: + confidx = 2; + break; + case VPD_PRODUCT_B850: + confidx = 3; + break; + } +} + int board_init(void) { + setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1); + setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2); + setup_i2c(3, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info3); + + read_vpd(CONFIG_SYS_I2C_EEPROM_BUS); + + set_confidx(&vpd); + gpio_direction_output(SUS_S3_OUT, 1); gpio_direction_output(WIFI_EN, 1); #if defined(CONFIG_VIDEO_IPUV3) @@ -706,10 +732,6 @@ int board_init(void) #ifdef CONFIG_MXC_SPI setup_spi(); #endif - setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1); - setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2); - setup_i2c(3, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info3); - return 0; }
@@ -775,7 +797,7 @@ void pmic_init(void)
int board_late_init(void) { - read_vpd(CONFIG_SYS_I2C_EEPROM_BUS); + process_vpd(&vpd);
#ifdef CONFIG_CMD_BMODE add_board_boot_modes(board_boot_modes);

From: Ian Ray ian.ray@ge.com
B{46}50v3s have an internal LCD that needs to be configured, in comparison with B850v3 which has only external displays.
Use VPD instead of `CONFIG_TARGET_GE_B{4,6,8}50V3' compile-time checks to correct initialize video based on the monitor type.
Signed-off-by: Ian Ray ian.ray@ge.com Signed-off-by: Nandor Han nandor.han@ge.com Signed-off-by: Sebastian Reichel sebastian.reichel@collabora.co.uk --- board/ge/bx50v3/bx50v3.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c index c988043a137f..b969d6255808 100644 --- a/board/ge/bx50v3/bx50v3.c +++ b/board/ge/bx50v3/bx50v3.c @@ -367,13 +367,14 @@ int board_cfb_skip(void) return 0; }
-static int detect_lcd(struct display_info_t const *dev) +static int is_b850v3(void) { - if (IS_ENABLED(CONFIG_TARGET_GE_B450V3) || - IS_ENABLED(CONFIG_TARGET_GE_B650V3)) - return 1; + return confidx == 3; +}
- return 0; +static int detect_lcd(struct display_info_t const *dev) +{ + return !is_b850v3(); }
struct display_info_t const displays[] = {{ @@ -683,7 +684,7 @@ int board_early_init_f(void) setup_iomux_uart();
#if defined(CONFIG_VIDEO_IPUV3) - if (IS_ENABLED(CONFIG_TARGET_GE_B850V3)) + if (is_b850v3()) /* Set LDB clock to Video PLL */ select_ldb_di_clock_source(MXC_PLL5_CLK); else @@ -721,7 +722,7 @@ int board_init(void) gpio_direction_output(SUS_S3_OUT, 1); gpio_direction_output(WIFI_EN, 1); #if defined(CONFIG_VIDEO_IPUV3) - if (IS_ENABLED(CONFIG_TARGET_GE_B850V3)) + if (is_b850v3()) setup_display_b850v3(); else setup_display_bx50v3();

From: Ian Ray ian.ray@ge.com
Configure video arguments at run-time instead of at compile-time.
Signed-off-by: Ian Ray ian.ray@ge.com Signed-off-by: Nandor Han nandor.han@ge.com Signed-off-by: Sebastian Reichel sebastian.reichel@collabora.co.uk --- board/ge/bx50v3/bx50v3.c | 3 +++ include/configs/ge_bx50v3.h | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c index b969d6255808..33f7ee6e3be5 100644 --- a/board/ge/bx50v3/bx50v3.c +++ b/board/ge/bx50v3/bx50v3.c @@ -804,6 +804,9 @@ int board_late_init(void) add_board_boot_modes(board_boot_modes); #endif
+ if (is_b850v3()) + env_set("videoargs", "video=DP-1:1024x768@60 video=HDMI-A-1:1024x768@60"); + /* board specific pmic init */ pmic_init();
diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h index 44c92f9d480b..ac54485080ef 100644 --- a/include/configs/ge_bx50v3.h +++ b/include/configs/ge_bx50v3.h @@ -15,7 +15,6 @@ #include <asm/arch/imx-regs.h> #include <asm/mach-imx/gpio.h>
-#define BX50V3_BOOTARGS_EXTRA #if defined(CONFIG_TARGET_GE_B450V3) #define CONFIG_BOARD_NAME "General Electric B450v3" #elif defined(CONFIG_TARGET_GE_B650V3) @@ -23,8 +22,6 @@ #elif defined(CONFIG_TARGET_GE_B850V3) #define CONFIG_BOARD_NAME "General Electric B850v3" #undef BX50V3_BOOTARGS_EXTRA -#define BX50V3_BOOTARGS_EXTRA "video=DP-1:1024x768@60 " \ - "video=HDMI-A-1:1024x768@60 " #else #define CONFIG_BOARD_NAME "General Electric BA16 Generic" #endif @@ -114,7 +111,7 @@ "ro rootwait cma=128M " \ "bootcause=${bootcause} " \ "${quiet} console=${console} ${rtc_status} " \ - BX50V3_BOOTARGS_EXTRA "\0" \ + "${videoargs}" "\0" \ "doquiet=" \ "if ext2load ${dev} ${devnum}:5 0x7000A000 /boot/console; " \ "then setenv quiet; fi\0" \

From: Ian Ray ian.ray@ge.com
This replaces TARGET_GE_B{4,6,8}50V3 with common TARGET_GE_BX50V3. The boards are identified automatically at runtime.
Signed-off-by: Ian Ray ian.ray@ge.com Signed-off-by: Nandor Han nandor.han@ge.com Signed-off-by: Sebastian Reichel sebastian.reichel@collabora.co.uk --- arch/arm/mach-imx/mx6/Kconfig | 14 +----- board/ge/bx50v3/Kconfig | 2 +- configs/ge_b650v3_defconfig | 43 ------------------- configs/ge_b850v3_defconfig | 43 ------------------- ...e_b450v3_defconfig => ge_bx50v3_defconfig} | 3 +- include/configs/ge_bx50v3.h | 11 +---- 6 files changed, 5 insertions(+), 111 deletions(-) delete mode 100644 configs/ge_b650v3_defconfig delete mode 100644 configs/ge_b850v3_defconfig rename configs/{ge_b450v3_defconfig => ge_bx50v3_defconfig} (93%)
diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig index aa6f5facbf8b..aeab9fe7fc5f 100644 --- a/arch/arm/mach-imx/mx6/Kconfig +++ b/arch/arm/mach-imx/mx6/Kconfig @@ -163,18 +163,8 @@ config TARGET_EMBESTMX6BOARDS bool "embestmx6boards" select BOARD_LATE_INIT
-config TARGET_GE_B450V3 - bool "General Electric B450v3" - select BOARD_LATE_INIT - select MX6Q - -config TARGET_GE_B650V3 - bool "General Electric B650v3" - select BOARD_LATE_INIT - select MX6Q - -config TARGET_GE_B850V3 - bool "General Electric B850v3" +config TARGET_GE_BX50V3 + bool "General Electric Bx50v3" select BOARD_LATE_INIT select MX6Q
diff --git a/board/ge/bx50v3/Kconfig b/board/ge/bx50v3/Kconfig index d50dece18ee8..993b0559302b 100644 --- a/board/ge/bx50v3/Kconfig +++ b/board/ge/bx50v3/Kconfig @@ -1,4 +1,4 @@ -if TARGET_GE_B450V3 || TARGET_GE_B650V3 || TARGET_GE_B850V3 +if TARGET_GE_BX50V3
config IMX_CONFIG default "board/ge/bx50v3/bx50v3.cfg" diff --git a/configs/ge_b650v3_defconfig b/configs/ge_b650v3_defconfig deleted file mode 100644 index e40364a14c56..000000000000 --- a/configs/ge_b650v3_defconfig +++ /dev/null @@ -1,43 +0,0 @@ -CONFIG_ARM=y -CONFIG_ARCH_MX6=y -CONFIG_SYS_TEXT_BASE=0x17800000 -CONFIG_TARGET_GE_B650V3=y -# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set -CONFIG_FIT=y -CONFIG_BOOTDELAY=1 -CONFIG_SYS_CONSOLE_IS_IN_ENV=y -CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y -CONFIG_SUPPORT_RAW_INITRD=y -CONFIG_DEFAULT_FDT_FILE="imx6q-b650v3.dtb" -CONFIG_BOARD_EARLY_INIT_F=y -CONFIG_LAST_STAGE_INIT=y -CONFIG_HUSH_PARSER=y -CONFIG_CMD_BOOTZ=y -# CONFIG_CMD_FLASH is not set -CONFIG_CMD_GPIO=y -CONFIG_CMD_I2C=y -CONFIG_CMD_MMC=y -CONFIG_CMD_PCI=y -CONFIG_CMD_SF=y -# CONFIG_CMD_NFS is not set -CONFIG_CMD_CACHE=y -CONFIG_CMD_EXT2=y -CONFIG_CMD_EXT4=y -CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_FS_GENERIC=y -CONFIG_DOS_PARTITION=y -CONFIG_ENV_IS_IN_SPI_FLASH=y -CONFIG_BOOTCOUNT_LIMIT=y -CONFIG_BOOTCOUNT_EXT=y -CONFIG_SYS_BOOTCOUNT_EXT_DEVPART="1:5" -CONFIG_SYS_BOOTCOUNT_ADDR=0x7000A000 -CONFIG_FSL_ESDHC=y -CONFIG_SPI_FLASH=y -CONFIG_SPI_FLASH_STMICRO=y -CONFIG_NETDEVICES=y -CONFIG_E1000=y -CONFIG_CMD_E1000=y -CONFIG_MXC_SPI=y -CONFIG_OF_LIBFDT=y -# CONFIG_EFI_LOADER is not set -CONFIG_SPI_FLASH_WINBOND=y diff --git a/configs/ge_b850v3_defconfig b/configs/ge_b850v3_defconfig deleted file mode 100644 index f1e2f7ce388e..000000000000 --- a/configs/ge_b850v3_defconfig +++ /dev/null @@ -1,43 +0,0 @@ -CONFIG_ARM=y -CONFIG_ARCH_MX6=y -CONFIG_SYS_TEXT_BASE=0x17800000 -CONFIG_TARGET_GE_B850V3=y -# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set -CONFIG_FIT=y -CONFIG_BOOTDELAY=1 -CONFIG_SYS_CONSOLE_IS_IN_ENV=y -CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y -CONFIG_SUPPORT_RAW_INITRD=y -CONFIG_DEFAULT_FDT_FILE="imx6q-b850v3.dtb" -CONFIG_BOARD_EARLY_INIT_F=y -CONFIG_LAST_STAGE_INIT=y -CONFIG_HUSH_PARSER=y -CONFIG_CMD_BOOTZ=y -# CONFIG_CMD_FLASH is not set -CONFIG_CMD_GPIO=y -CONFIG_CMD_I2C=y -CONFIG_CMD_MMC=y -CONFIG_CMD_PCI=y -CONFIG_CMD_SF=y -# CONFIG_CMD_NFS is not set -CONFIG_CMD_CACHE=y -CONFIG_CMD_EXT2=y -CONFIG_CMD_EXT4=y -CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_FS_GENERIC=y -CONFIG_DOS_PARTITION=y -CONFIG_ENV_IS_IN_SPI_FLASH=y -CONFIG_BOOTCOUNT_LIMIT=y -CONFIG_BOOTCOUNT_EXT=y -CONFIG_SYS_BOOTCOUNT_EXT_DEVPART="1:5" -CONFIG_SYS_BOOTCOUNT_ADDR=0x7000A000 -CONFIG_FSL_ESDHC=y -CONFIG_SPI_FLASH=y -CONFIG_SPI_FLASH_STMICRO=y -CONFIG_NETDEVICES=y -CONFIG_E1000=y -CONFIG_CMD_E1000=y -CONFIG_MXC_SPI=y -CONFIG_OF_LIBFDT=y -# CONFIG_EFI_LOADER is not set -CONFIG_SPI_FLASH_WINBOND=y diff --git a/configs/ge_b450v3_defconfig b/configs/ge_bx50v3_defconfig similarity index 93% rename from configs/ge_b450v3_defconfig rename to configs/ge_bx50v3_defconfig index 22c096acebe5..eebcddb4b76d 100644 --- a/configs/ge_b450v3_defconfig +++ b/configs/ge_bx50v3_defconfig @@ -1,14 +1,13 @@ CONFIG_ARM=y CONFIG_ARCH_MX6=y CONFIG_SYS_TEXT_BASE=0x17800000 -CONFIG_TARGET_GE_B450V3=y +CONFIG_TARGET_GE_BX50V3=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_FIT=y CONFIG_BOOTDELAY=1 CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y CONFIG_SUPPORT_RAW_INITRD=y -CONFIG_DEFAULT_FDT_FILE="imx6q-b450v3.dtb" CONFIG_BOARD_EARLY_INIT_F=y CONFIG_LAST_STAGE_INIT=y CONFIG_HUSH_PARSER=y diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h index ac54485080ef..307ec0101c0a 100644 --- a/include/configs/ge_bx50v3.h +++ b/include/configs/ge_bx50v3.h @@ -15,16 +15,7 @@ #include <asm/arch/imx-regs.h> #include <asm/mach-imx/gpio.h>
-#if defined(CONFIG_TARGET_GE_B450V3) -#define CONFIG_BOARD_NAME "General Electric B450v3" -#elif defined(CONFIG_TARGET_GE_B650V3) -#define CONFIG_BOARD_NAME "General Electric B650v3" -#elif defined(CONFIG_TARGET_GE_B850V3) -#define CONFIG_BOARD_NAME "General Electric B850v3" -#undef BX50V3_BOOTARGS_EXTRA -#else -#define CONFIG_BOARD_NAME "General Electric BA16 Generic" -#endif +#define CONFIG_BOARD_NAME "General Electric Bx50v3"
#define CONFIG_MXC_UART_BASE UART3_BASE #define CONSOLE_DEV "ttymxc2"
participants (1)
-
Sebastian Reichel