Skip to contentSkip to conversation

ARM: imx: cm_fx6: env: try to determine dtb to use

PATCH New christopher.spinrath at rwth-aachen.de 2 participants 2 messages Jan 9, 2018 – Jan 12, 2018 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 2/2 ARM: imx: cm_fx6: env: try to determine dtb to use

From: Christopher Spinrath <[email protected]>

Some distributions like Fedora expect U-Boot to select a proper devicetree. Since there are several variants of the cm-fx6 module featuring different SoC variants and the module can be paired with several baseboards, it is not viable to hardcode a filename.

Instead, follow the lead of other i.MX6 based devices and try to determine the devicetree to use with the help of the board name and the SoC variant exported by the board code, before calling the distro bootcommand.

For now, only for the Utilite Pro a proper devicetree filename is known but further variants of the Utilite Computer or other devices based on the cm-fx6 module may be added in the future.

---
 configs/cm_fx6_defconfig | 2 +-
 include/configs/cm_fx6.h | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
configs/cm_fx6_defconfig +1 -1
index 33e610ccb4..6b1c0a823c 100644
@@ -16,7 +16,7 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
 CONFIG_BOOTDELAY=3
-CONFIG_BOOTCOMMAND="run distro_bootcmd; run legacy_bootcmd"
+CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd; run legacy_bootcmd"
 CONFIG_SPL=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x80
 CONFIG_SPL_I2C_SUPPORT=y
include/configs/cm_fx6.h +6 -0
index cb71ea8811..da870b9baa 100644
@@ -76,6 +76,7 @@
 	"kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
 	"pxefile_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
 	"scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \
+	"fdtfile=undefined\0" \
 	"stdin=serial,usbkbd\0" \
 	"stdout=serial,vga\0" \
 	"stderr=serial,vga\0" \
@@ -153,6 +154,11 @@
 		"fi;" \
 		"run setupnandboot;" \
 		"run nandboot;\0" \
+	"findfdt="\
+		"if test $board_name = Utilite && test $board_rev = MX6Q ; then " \
+			"setenv fdtfile imx6q-utilite-pro.dtb; fi; " \
+		"if test $fdtfile = undefined; then " \
+			"echo WARNING: Could not determine dtb to use; fi; \0" \
 	BOOTENV
 
 #define CONFIG_PREBOOT		"usb start;sf probe"
Signature · 1 line
2.15.1
#2 lore raw

PATCH 2/2 ARM: imx: cm_fx6: env: try to determine dtb to use

Quoted 50 lines · christopher.spinrath at rwth-aachen.de

From: Christopher Spinrath <[email protected]>

Some distributions like Fedora expect U-Boot to select a proper devicetree. Since there are several variants of the cm-fx6 module featuring different SoC variants and the module can be paired with several baseboards, it is not viable to hardcode a filename.

Instead, follow the lead of other i.MX6 based devices and try to determine the devicetree to use with the help of the board name and the SoC variant exported by the board code, before calling the distro bootcommand.

For now, only for the Utilite Pro a proper devicetree filename is known but further variants of the Utilite Computer or other devices based on the cm-fx6 module may be added in the future.

---
 configs/cm_fx6_defconfig | 2 +-
 include/configs/cm_fx6.h | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
configs/cm_fx6_defconfig +1 -1
index 33e610ccb4..6b1c0a823c 100644
@@ -16,7 +16,7 @@ CONFIG_DISTRO_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
 CONFIG_BOOTDELAY=3
-CONFIG_BOOTCOMMAND="run distro_bootcmd; run legacy_bootcmd"
+CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd; run legacy_bootcmd"
 CONFIG_SPL=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x80
 CONFIG_SPL_I2C_SUPPORT=y
include/configs/cm_fx6.h +1 -0
index cb71ea8811..da870b9baa 100644
@@ -76,6 +76,7 @@
 	"kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
 	"pxefile_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
 	"scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \
+	"fdtfile=undefined\0" \
 	"stdin=serial,usbkbd\0" \
 	"stdout=serial,vga\0" \
 	"stderr=serial,vga\0" \
@@ -153,6 +154,11 @@
 		"fi;" \

include/configs/cm_fx6.h line 164

Quoted 10 lines
include/configs/cm_fx6.h +5 -0
 		"run setupnandboot;" \
 		"run nandboot;\0" \
+	"findfdt="\
+		"if test $board_name = Utilite && test $board_rev = MX6Q ; then " \
+			"setenv fdtfile imx6q-utilite-pro.dtb; fi; " \
+		"if test $fdtfile = undefined; then " \
+			"echo WARNING: Could not determine dtb to use; fi; \0" \
 	BOOTENV
 
 #define CONFIG_PREBOOT		"usb start;sf probe"

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================