[U-Boot] [PATCH 5/5] mx6cuboxi: Load the correct 'fdt_file' variable

Fabio Estevam festevam at gmail.com
Thu Apr 23 05:57:06 CEST 2015


From: Fabio Estevam <fabio.estevam at freescale.com>

Instead of hardcoding the 'fdt_file' variable, let's introduce a new
function - build_dts_name(), that can build the dtb filename on the fly.

Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
---
 board/solidrun/mx6cuboxi/mx6cuboxi.c | 24 ++++++++++++++++++++++++
 include/configs/mx6cuboxi.h          |  3 +--
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
index 83410b2..1c24a55 100644
--- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
+++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
@@ -212,6 +212,30 @@ int checkboard(void)
 	return 0;
 }
 
+static const char *build_dts_name(void)
+{
+	char *dt_prefix = "unknown";
+	char *dt_suffix = "unknown";
+
+	if (is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D))
+		dt_prefix = "imx6q";
+	else if (is_cpu_type(MXC_CPU_MX6SOLO) || is_cpu_type(MXC_CPU_MX6DL))
+		dt_prefix = "imx6dl";
+
+	if (is_hummingboard())
+		dt_suffix = "-hummingboard.dtb";
+	else
+		dt_suffix = "-cubox-i.dtb";
+
+	return strcat(dt_prefix, dt_suffix);
+}
+
+int misc_init_r(void)
+{
+	setenv("fdt_file", build_dts_name());
+	return 0;
+}
+
 #ifdef CONFIG_SPL_BUILD
 #include <asm/arch/mx6-ddr.h>
 static const struct mx6dq_iomux_ddr_regs mx6q_ddr_ioregs = {
diff --git a/include/configs/mx6cuboxi.h b/include/configs/mx6cuboxi.h
index 5d58b16..504a81c 100644
--- a/include/configs/mx6cuboxi.h
+++ b/include/configs/mx6cuboxi.h
@@ -29,6 +29,7 @@
 
 #define CONFIG_SYS_MALLOC_LEN		(2 * SZ_1M)
 #define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_MISC_INIT_R
 #define CONFIG_MXC_GPIO
 #define CONFIG_MXC_UART
 #define CONFIG_CMD_FUSE
@@ -81,14 +82,12 @@
 #define CONFIG_MXC_UART_BASE	UART1_BASE
 #define CONFIG_CONSOLE_DEV	"ttymxc0"
 #define CONFIG_MMCROOT		"/dev/mmcblk0p2"
-#define CONFIG_DEFAULT_FDT_FILE	"imx6q-hummingboard.dtb"
 #define CONFIG_SYS_FSL_USDHC_NUM	1
 #define CONFIG_SYS_MMC_ENV_DEV		0	/* SDHC2 */
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"script=boot.scr\0" \
 	"image=zImage\0" \
-	"fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
 	"fdt_addr=0x18000000\0" \
 	"boot_fdt=try\0" \
 	"ip_dyn=yes\0" \
-- 
1.9.1



More information about the U-Boot mailing list