Skip to contentSkip to conversation

TI: configs: Commonize the boot of different devices

U-Boot Dan Murphy 3 participants 5 messages Nov 20, 2013 – Dec 4, 2013

lore
Share & tools
lore

Dan Murphy

author
#0 lore raw

Commonize in the ti_armv7_common.h the boot scripts for USB, MMC and NAND.

Each board file can then select which BOOT_TARGETS are applicable for the target board.
And any parameters based on that.

Finally removed the findfdt from the common file and made this more board specific as omap4_common should not reference panda.

This implemenation was adopted from the tegra-common-post.h file.

---
 include/configs/am335x_evm.h      |   77 ++++++++++++++++++++++---------------
 include/configs/dra7xx_evm.h      |   25 ++++++++++++
 include/configs/omap4_common.h    |   36 ++---------------
 include/configs/omap4_panda.h     |   29 ++++++++++++++
 include/configs/omap4_sdp4430.h   |   26 +++++++++++++
 include/configs/omap5_common.h    |   22 +++--------
 include/configs/omap5_uevm.h      |   25 ++++++++++++
 include/configs/ti_armv7_common.h |   72 ++++++++++++++++++++++++++++++++++
 8 files changed, 233 insertions(+), 79 deletions(-)
include/configs/am335x_evm.h +47 -30
index c2ba7e3..40ecb66 100644
@@ -31,27 +31,6 @@
 /* Always 128 KiB env size */
 #define CONFIG_ENV_SIZE			(128 << 10)
 
-#ifdef CONFIG_NAND
-#define NANDARGS \
-	"mtdids=" MTDIDS_DEFAULT "\0" \
-	"mtdparts=" MTDPARTS_DEFAULT "\0" \
-	"nandargs=setenv bootargs console=${console} " \
-		"${optargs} " \
-		"root=${nandroot} " \
-		"rootfstype=${nandrootfstype}\0" \
-	"dfu_alt_info_nand=" DFU_ALT_INFO_NAND "\0" \
-	"nandroot=ubi0:rootfs rw ubi.mtd=7,2048\0" \
-	"nandrootfstype=ubifs rootwait=1\0" \
-	"nandsrcaddr=0x280000\0" \
-		"nandboot=echo Booting from nand ...; " \
-		"run nandargs; " \
-		"nand read ${loadaddr} ${nandsrcaddr} ${nandimgsize}; " \
-		"bootz ${loadaddr}\0" \
-	"nandimgsize=0x500000\0"
-#else
-#define NANDARGS ""
-#endif
-
 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 
 #ifndef CONFIG_SPL_BUILD
@@ -163,17 +142,11 @@
 			"setenv fdtfile am335x-evmsk.dtb; fi; " \
 		"if test $fdtfile = undefined; then " \
 			"echo WARNING: Could not determine device tree to use; fi; \0" \
-	NANDARGS
+	BOOTCMD_COMMON \
+	BOOTCMD_MMC \
+	BOOTCMD_NAND
 #endif
 
-#define CONFIG_BOOTCOMMAND \
-	"run findfdt; " \
-	"run mmcboot;" \
-	"setenv mmcdev 1; " \
-	"setenv bootpart 1:2; " \
-	"run mmcboot;" \
-	"run nandboot;"
-
 /* NS16550 Configuration */
 #define CONFIG_SYS_NS16550_COM1		0x44e09000	/* Base EVM has UART0 */
 #define CONFIG_SYS_NS16550_COM2		0x48022000	/* UART1 */
@@ -317,6 +290,10 @@
 	"uEnv.txt fat 0 1"
 #ifdef CONFIG_NAND
 #define CONFIG_DFU_NAND
+
+#ifdef DFU_ALT_INFO_NAND
+#undef DFU_ALT_INFO_NAND
+#endif
 #define DFU_ALT_INFO_NAND \
 	"SPL part 0 1;" \
 	"SPL.backup1 part 0 2;" \
@@ -349,7 +326,15 @@
 #define CONFIG_ENV_SECT_SIZE		(4 << 10) /* 4 KB sectors */
 #define CONFIG_ENV_OFFSET		(768 << 10) /* 768 KiB in */
 #define CONFIG_ENV_OFFSET_REDUND	(896 << 10) /* 896 KiB in */
+
+#ifdef MTDIDS_DEFAULT
+#undef MTDIDS_DEFAULT
+#endif
 #define MTDIDS_DEFAULT			"nor0=m25p80-flash.0"
+
+#ifdef MTDPARTS_DEFAULT
+#undef MTDPARTS_DEFAULT
+#endif
 #define MTDPARTS_DEFAULT		"mtdparts=m25p80-flash.0:128k(SPL)," \
 					"512k(u-boot),128k(u-boot-env1)," \
 					"128k(u-boot-env2),3464k(kernel)," \
@@ -381,7 +366,14 @@
 #define CONFIG_CMD_NAND
 #define GPMC_NAND_ECC_LP_x16_LAYOUT	1
 #if !defined(CONFIG_SPI_BOOT) && !defined(CONFIG_NOR_BOOT)
+#ifdef MTDIDS_DEFAULT
+#undef MTDIDS_DEFAULT
+#endif
 #define MTDIDS_DEFAULT			"nand0=omap2-nand.0"
+
+#ifdef MTDPARTS_DEFAULT
+#undef MTDPARTS_DEFAULT
+#endif
 #define MTDPARTS_DEFAULT		"mtdparts=omap2-nand.0:128k(SPL)," \
 					"128k(SPL.backup1)," \
 					"128k(SPL.backup2)," \
@@ -424,7 +416,14 @@
 #define CONFIG_ENV_SECT_SIZE		(128 << 10)	/* 128 KiB */
 #define CONFIG_ENV_OFFSET		(512 << 10)	/* 512 KiB */
 #define CONFIG_ENV_OFFSET_REDUND	(768 << 10)	/* 768 KiB */
+#ifdef MTDIDS_DEFAULT
+#undef MTDIDS_DEFAULT
+#endif
 #define MTDIDS_DEFAULT			"nor0=physmap-flash.0"
+
+#ifdef MTDPARTS_DEFAULT
+#undef MTDPARTS_DEFAULT
+#endif
 #define MTDPARTS_DEFAULT		"mtdparts=physmap-flash.0:" \
 					"512k(u-boot)," \
 					"128k(u-boot-env1)," \
@@ -433,4 +432,22 @@
 #endif
 #endif  /* NOR support */
 
+#ifdef CONFIG_MMC
+#define BOOT_TARGETS_MMC "mmc0"
+#else
+#define BOOT_TARGETS_MMC ""
+#endif
+
+#ifdef CONFIG_USB_HOST
+#define BOOT_TARGETS_USB "usb"
+#else
+#define BOOT_TARGETS_USB ""
+#endif
+
+#ifdef CONFIG_NAND
+#define BOOT_TARGETS_NAND "nand"
+#else
+#define BOOT_TARGETS_NAND ""
+#endif
+
 #endif	/* ! __CONFIG_AM335X_EVM_H */
include/configs/dra7xx_evm.h +25 -0
index 8a69c7d..31cf7b6 100644
@@ -83,4 +83,29 @@
 #define CONFIG_OMAP_USB_PHY
 #define CONFIG_OMAP_USB2PHY2_HOST
 
+#define FIND_FDT_FILE \
+	"findfdt="\
+		"if test $board_name = dra7xx; then " \
+			"setenv fdtfile dra7-evm.dtb; fi;" \
+		"if test $fdtfile = undefined; then " \
+			"echo WARNING: Could not determine device tree to use; fi; \0" \
+
+#ifdef CONFIG_MMC
+#define BOOT_TARGETS_MMC "mmc0"
+#else
+#define BOOT_TARGETS_MMC ""
+#endif
+
+#ifdef CONFIG_USB_HOST
+#define BOOT_TARGETS_USB "usb"
+#else
+#define BOOT_TARGETS_USB ""
+#endif
+
+#ifdef CONFIG_NAND
+#define BOOT_TARGETS_NAND "nand"
+#else
+#define BOOT_TARGETS_NAND ""
+#endif
+
 #endif /* __CONFIG_DRA7XX_EVM_H */
include/configs/omap4_common.h +4 -32
index ea56eeb..e0524a3 100644
@@ -114,39 +114,11 @@
 	"mmcboot=echo Booting from mmc${mmcdev} ...; " \
 		"run mmcargs; " \
 		"bootz ${loadaddr} - ${fdtaddr}\0" \
-	"findfdt="\
-		"if test $board_name = sdp4430; then " \
-			"setenv fdtfile omap4-sdp.dtb; fi; " \
-		"if test $board_name = panda; then " \
-			"setenv fdtfile omap4-panda.dtb; fi;" \
-		"if test $board_name = panda-a4; then " \
-			"setenv fdtfile omap4-panda-a4.dtb; fi;" \
-		"if test $board_name = panda-es; then " \
-			"setenv fdtfile omap4-panda-es.dtb; fi;" \
-		"if test $fdtfile = undefined; then " \
-			"echo WARNING: Could not determine device tree to use; fi; \0" \
 	"loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
-
-#define CONFIG_BOOTCOMMAND \
-	"run findfdt; " \
-	"mmc dev ${mmcdev}; if mmc rescan; then " \
-		"echo SD/MMC found on device ${mmcdev};" \
-		"if run loadbootscript; then " \
-			"run bootscript; " \
-		"else " \
-			"if run loadbootenv; then " \
-				"run importbootenv; " \
-			"fi;" \
-			"if test -n ${uenvcmd}; then " \
-				"echo Running uenvcmd ...;" \
-				"run uenvcmd;" \
-			"fi;" \
-		"fi;" \
-		"if run loadimage; then " \
-			"run loadfdt;" \
-			"run mmcboot; " \
-		"fi; " \
-	"fi"
+	FIND_FDT_FILE \
+	BOOTCMD_COMMON \
+	BOOTCMD_MMC \
+	BOOTCMD_USB
 
 /* Defines for SPL */
 #define CONFIG_SPL_TEXT_BASE		0x40304350
include/configs/omap4_panda.h +29 -0
index 6820e42..8c480c0 100644
@@ -42,6 +42,24 @@
 #include <configs/omap4_common.h>
 #define CONFIG_CMD_NET
 
+#ifdef CONFIG_MMC
+#define BOOT_TARGETS_MMC "mmc0"
+#else
+#define BOOT_TARGETS_MMC ""
+#endif
+
+#ifdef CONFIG_USB_HOST
+#define BOOT_TARGETS_USB "usb"
+#else
+#define BOOT_TARGETS_USB ""
+#endif
+
+#ifdef CONFIG_NAND
+#define BOOT_TARGETS_NAND "nand"
+#else
+#define BOOT_TARGETS_NAND ""
+#endif
+
 /* GPIO */
 #define CONFIG_CMD_GPIO
 
@@ -50,4 +68,15 @@
 
 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 
+#define FIND_FDT_FILE \
+	"findfdt="\
+		"if test $board_name = panda; then " \
+			"setenv fdtfile omap4-panda.dtb; fi;" \
+		"if test $board_name = panda-a4; then " \
+			"setenv fdtfile omap4-panda-a4.dtb; fi;" \
+		"if test $board_name = panda-es; then " \
+			"setenv fdtfile omap4-panda-es.dtb; fi;" \
+		"if test $fdtfile = undefined; then " \
+			"echo WARNING: Could not determine device tree to use; fi; \0" \
+
 #endif /* __CONFIG_PANDA_H */
include/configs/omap4_sdp4430.h +26 -0
index b352511..f4f086f 100644
@@ -32,4 +32,30 @@
 #define CONFIG_ENV_OFFSET		0xE0000
 #define CONFIG_CMD_SAVEENV
 
+#ifdef CONFIG_MMC
+#define BOOT_TARGETS_MMC "mmc0"
+#else
+#define BOOT_TARGETS_MMC ""
+#endif
+
+#ifdef CONFIG_USB_HOST
+#define BOOT_TARGETS_USB "usb"
+#else
+#define BOOT_TARGETS_USB ""
+#endif
+
+#ifdef CONFIG_NAND
+#define BOOT_TARGETS_NAND "nand"
+#else
+#define BOOT_TARGETS_NAND ""
+#endif
+
+#define FIND_FDT_FILE \
+	"findfdt="\
+		"if test $board_name = sdp4430; then " \
+			"setenv fdtfile omap4-sdp.dtb; fi; " \
+		"if test $fdtfile = undefined; then " \
+			"echo WARNING: Could not determine device tree to use; fi; \0" \
+
+
 #endif /* __CONFIG_SDP4430_H */
include/configs/omap5_common.h +5 -17
index c7fa37e..4d5e5f4 100644
@@ -116,23 +116,11 @@
 				"bootz ${loadaddr} - ${fdtaddr}; " \
 			"fi;" \
 		"fi;\0" \
-	"findfdt="\
-		"if test $board_name = omap5_uevm; then " \
-			"setenv fdtfile omap5-uevm.dtb; fi; " \
-		"if test $board_name = dra7xx; then " \
-			"setenv fdtfile dra7-evm.dtb; fi;" \
-		"if test $fdtfile = undefined; then " \
-			"echo WARNING: Could not determine device tree to use; fi; \0" \
-	"loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile};\0" \
-
-#define CONFIG_BOOTCOMMAND \
-	"run findfdt; " \
-	"run mmcboot;" \
-	"setenv mmcdev 1; " \
-	"setenv bootpart 1:2; " \
-	"setenv mmcroot /dev/mmcblk0p2 rw; " \
-	"run mmcboot;" \
-
+	"loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile};\0" \
+	FIND_FDT_FILE \
+	BOOTCMD_COMMON \
+	BOOTCMD_MMC \
+	BOOTCMD_USB
 
 /*
  * SPL related defines.  The Public RAM memory map the ROM defines the
include/configs/omap5_uevm.h +25 -0
index 4d3a800..a432a23 100644
@@ -66,6 +66,31 @@
 
 #define CONSOLEDEV		"ttyO2"
 
+#ifdef CONFIG_MMC
+#define BOOT_TARGETS_MMC "mmc0"
+#else
+#define BOOT_TARGETS_MMC ""
+#endif
+
+#ifdef CONFIG_USB_HOST
+#define BOOT_TARGETS_USB "usb"
+#else
+#define BOOT_TARGETS_USB ""
+#endif
+
+#ifdef CONFIG_NAND
+#define BOOT_TARGETS_NAND "nand"
+#else
+#define BOOT_TARGETS_NAND ""
+#endif
+
+#define FIND_FDT_FILE \
+	"findfdt="\
+		"if test $board_name = omap5_uevm; then " \
+			"setenv fdtfile omap5-uevm.dtb; fi; " \
+		"if test $fdtfile = undefined; then " \
+			"echo WARNING: Could not determine device tree to use; fi; \0" \
+
 /* Max time to hold reset on this board, see doc/README.omap-reset-time */
 #define CONFIG_OMAP_PLATFORM_RESET_TIME_MAX_USEC	16296
 
include/configs/ti_armv7_common.h +72 -0

76 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 11 lines · Dan Murphy

Commonize in the ti_armv7_common.h the boot scripts for USB, MMC and NAND.

Each board file can then select which BOOT_TARGETS are applicable for the target board.
And any parameters based on that.

Finally removed the findfdt from the common file and made this more board specific as omap4_common should not reference panda.

This implemenation was adopted from the tegra-common-post.h file.

OK, implementation wise, I think we might need to adapt the -post concept here too. That will let us remove from the config files themselves a number of:
#ifdef FOO
#undef FOO
#endif
#define FOO

And it will also let new boards like cm_t335 opt in to ti_am335x_common.h but not have to pick our bootcmd if they don't want to (tegra-common-post.h allows for that). While not a big deal, possibly, for cm_t335 it's probably a bigger deal for getting the siemens boards adapted too.

I think this also shows that we need to handle the DFU env settings parts strictly inside of am335x_evm.h. I'm toying with a patch to cover this, now.

Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131204/75958d02/attachment.pgp>
#2 lore raw

Hi Tom,

2013/12/4 Tom Rini <[email protected]>:

Quoted 28 lines · Dan Murphy
Quoted 4 lines

Commonize in the ti_armv7_common.h the boot scripts for USB, MMC and NAND.

Quoted 8 lines

Each board file can then select which BOOT_TARGETS are applicable for the target board.
And any parameters based on that.

Finally removed the findfdt from the common file and made this more board specific as omap4_common should not reference panda.

This implemenation was adopted from the tegra-common-post.h file.

OK, implementation wise, I think we might need to adapt the -post concept here too. That will let us remove from the config files themselves a number of:
#ifdef FOO
#undef FOO
#endif
#define FOO

And it will also let new boards like cm_t335 opt in to ti_am335x_common.h but not have to pick our bootcmd if they don't want to (tegra-common-post.h allows for that). While not a big deal, possibly, for cm_t335 it's probably a bigger deal for getting the siemens boards adapted too.

Quoted 9 lines

I think this also shows that we need to handle the DFU env settings parts strictly inside of am335x_evm.h. I'm toying with a patch to cover this, now.

Thanks!

--
Tom

Just a small question that is related with this. There is any plan to commonize the configuration code for OMAP3 platforms (ti_omap3_common.h) like AM335x ?

Best regards,
Enric

Quoted 5 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#3 lore raw
Quoted 35 lines · Enric Balletbo Serra

Hi Tom,

2013/12/4 Tom Rini <[email protected]>:

Quoted 32 lines · Dan Murphy
Quoted 4 lines

Commonize in the ti_armv7_common.h the boot scripts for USB, MMC and NAND.

Quoted 8 lines

Each board file can then select which BOOT_TARGETS are applicable for the target board.
And any parameters based on that.

Finally removed the findfdt from the common file and made this more board specific as omap4_common should not reference panda.

This implemenation was adopted from the tegra-common-post.h file.

OK, implementation wise, I think we might need to adapt the -post concept here too. That will let us remove from the config files themselves a number of:
#ifdef FOO
#undef FOO
#endif
#define FOO

And it will also let new boards like cm_t335 opt in to ti_am335x_common.h but not have to pick our bootcmd if they don't want to (tegra-common-post.h allows for that). While not a big deal, possibly, for cm_t335 it's probably a bigger deal for getting the siemens boards adapted too.

I think this also shows that we need to handle the DFU env settings parts strictly inside of am335x_evm.h. I'm toying with a patch to cover this, now.

Quoted 5 lines
Quoted 1 line

Thanks!

Just a small question that is related with this. There is any plan to commonize the configuration code for OMAP3 platforms (ti_omap3_common.h) like AM335x ?

I would love to see it happen, yes. It's not high up on my priority list right now (along with doing omap3_evm* stuff cleaner) so I'd also love to see the patch come from someone else.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131204/5ddadb82/attachment.pgp>
#4 lore raw

2013/12/4 Tom Rini <[email protected]>:

Quoted 38 lines · Enric Balletbo Serra
Quoted 37 lines

Hi Tom,

2013/12/4 Tom Rini <[email protected]>:

Quoted 33 lines · Dan Murphy
Quoted 4 lines

Commonize in the ti_armv7_common.h the boot scripts for USB, MMC and NAND.

Quoted 8 lines

Each board file can then select which BOOT_TARGETS are applicable for the target board.
And any parameters based on that.

Finally removed the findfdt from the common file and made this more board specific as omap4_common should not reference panda.

This implemenation was adopted from the tegra-common-post.h file.

OK, implementation wise, I think we might need to adapt the -post concept here too. That will let us remove from the config files themselves a number of:
#ifdef FOO
#undef FOO
#endif
#define FOO

And it will also let new boards like cm_t335 opt in to ti_am335x_common.h but not have to pick our bootcmd if they don't want to (tegra-common-post.h allows for that). While not a big deal, possibly, for cm_t335 it's probably a bigger deal for getting the siemens boards adapted too.

I think this also shows that we need to handle the DFU env settings parts strictly inside of am335x_evm.h. I'm toying with a patch to cover this, now.

Thanks!

Quoted 8 lines
Quoted 3 lines

Just a small question that is related with this. There is any plan to commonize the configuration code for OMAP3 platforms (ti_omap3_common.h) like AM335x ?

I would love to see it happen, yes. It's not high up on my priority list right now (along with doing omap3_evm* stuff cleaner) so I'd also love to see the patch come from someone else.

Ok, maybe I've time to do this, I'll try to send a RFC with this during this week.

Best regards,
Enric

Quoted 2 lines

--
Tom