mx6sxsabresd: Load the correct dtb for revA board
authorFabio Estevam <fabio.estevam@nxp.com>
Mon, 27 Nov 2017 12:25:10 +0000 (10:25 -0200)
committerStefano Babic <sbabic@denx.de>
Fri, 29 Dec 2017 10:18:59 +0000 (11:18 +0100)
Currently only imx6sx-sdb.dtb is loaded, but if revA board is used the
correct dtb is imx6sx-sdb-reva.dtb, so make this possible.

While at it, remove an extra 'mmc dev'.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
arch/arm/mach-imx/mx6/Kconfig
board/freescale/mx6sxsabresd/mx6sxsabresd.c
configs/mx6sxsabresd_defconfig
configs/mx6sxsabresd_spl_defconfig
include/configs/mx6sxsabresd.h

index bee7eabe02667833280fb29963a759ae5c515f7d..44d2db4f2823646b1f262a36f1dd0e5e7fa07ded 100644 (file)
@@ -255,6 +255,7 @@ config TARGET_MX6SLLEVK
 
 config TARGET_MX6SXSABRESD
        bool "mx6sxsabresd"
+       select BOARD_LATE_INIT
        select MX6SX
        select SUPPORT_SPL
        select DM
index 2aeef61ffdef8785185188b7b2e877706eadffdb..3ad2140314fd1a4b5ffd9840530d8371574436d0 100644 (file)
@@ -540,9 +540,23 @@ int board_init(void)
        return 0;
 }
 
+static bool is_reva(void)
+{
+       return (nxp_board_rev() == 1);
+}
+
+int board_late_init(void)
+{
+#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+       if (is_reva())
+               env_set("board_rev", "REVA");
+#endif
+       return 0;
+}
+
 int checkboard(void)
 {
-       puts("Board: MX6SX SABRE SDB\n");
+       printf("Board: MX6SX SABRE SDB rev%c\n", nxp_board_rev_string());
 
        return 0;
 }
index a411032b86b2cdaf1f606f5bce44f0535cafd008..b7073227147d051770a8aa415c8a386545a1687b 100644 (file)
@@ -2,6 +2,7 @@ CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_TARGET_MX6SXSABRESD=y
 # CONFIG_CMD_BMODE is not set
+CONFIG_NXP_BOARD_REVISION=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6sxsabresd/imximage.cfg"
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
index a0483c3472faa75ab1061ac794be63cd715f9222..9ab4b2f0060d5c1d4cb809433c9a328a053438ca 100644 (file)
@@ -9,6 +9,7 @@ CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_SPL_WATCHDOG_SUPPORT=y
 # CONFIG_CMD_BMODE is not set
+CONFIG_NXP_BOARD_REVISION=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
index f4c9c283979b28cec2fcd3675bfea693c48b986b..906e677cd14f5f23f87e301f542b6e5c4cf1a9ac 100644 (file)
@@ -43,6 +43,7 @@
 #define UPDATE_M4_ENV ""
 #endif
 
+#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 #define CONFIG_EXTRA_ENV_SETTINGS \
        UPDATE_M4_ENV \
        "script=boot.scr\0" \
                        "fi; " \
                "else " \
                        "bootz; " \
-               "fi;\0"
+               "fi;\0" \
+       "findfdt="\
+               "if test test $board_rev = REVA ; then " \
+                       "setenv fdt_file imx6sx-sdb-reva.dtb; fi; " \
 
 #define CONFIG_BOOTCOMMAND \
-          "mmc dev ${mmcdev};" \
+          "run findfdt; " \
           "mmc dev ${mmcdev}; if mmc rescan; then " \
                   "if run loadbootscript; then " \
                           "run bootscript; " \