[U-Boot] [PATCH] omap3: evm: Fixes for CONFIG_NAND, SPL_OS_BOOT, USB, and environment

Derald D. Woods woods.technical at gmail.com
Tue Aug 29 02:39:31 UTC 2017


- Pass MTDPARTS kernel arguments to kernel
- Use Kconfig CONFIG_NAND instead of CONFIG_SYS_EXTRA_OPTIONS="NAND"
- Call 'usb_stop' on kernel start
- Update Falcon mode setup to match other OMAP3 boards
- Use "uEnv.txt" as boot script instead of "boot.scr"
---
 board/ti/evm/evm.c          | 20 +++++++++++++++++++-
 configs/omap3_evm_defconfig |  2 +-
 include/configs/omap3_evm.h | 30 ++++++++++++++++++++----------
 3 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
index 6bf57f9269..1f0433dcc0 100644
--- a/board/ti/evm/evm.c
+++ b/board/ti/evm/evm.c
@@ -122,6 +122,17 @@ int board_init(void)
 	return 0;
 }
 
+#if defined(CONFIG_SPL_OS_BOOT)
+int spl_start_uboot(void)
+{
+	/* break into full u-boot on 'c' */
+	if (serial_tstc() && serial_getc() == 'c')
+		return 1;
+
+	return 0;
+}
+#endif /* CONFIG_SPL_OS_BOOT */
+
 #if defined(CONFIG_SPL_BUILD)
 /*
  * Routine: get_board_mem_timings
@@ -323,7 +334,14 @@ void board_mmc_power_init(void)
 }
 #endif /* CONFIG_MMC */
 
-#if defined(CONFIG_USB_EHCI_HCD)
+#if defined(CONFIG_USB_EHCI_HCD) && !defined(CONFIG_SPL_BUILD)
+/* Call usb_stop() before starting the kernel */
+void show_boot_progress(int val)
+{
+	if (val == BOOTSTAGE_ID_RUN_OS)
+		usb_stop();
+}
+
 static struct omap_usbhs_board_data usbhs_bdata = {
 	.port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
 	.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
diff --git a/configs/omap3_evm_defconfig b/configs/omap3_evm_defconfig
index a07ea0fd55..6316b797fd 100644
--- a/configs/omap3_evm_defconfig
+++ b/configs/omap3_evm_defconfig
@@ -7,7 +7,6 @@ CONFIG_SYS_MPUCLK=720
 CONFIG_TARGET_OMAP3_EVM=y
 CONFIG_SPL_STACK_R_ADDR=0x82000000
 CONFIG_DISTRO_DEFAULTS=y
-CONFIG_SYS_EXTRA_OPTIONS="NAND"
 CONFIG_ENV_IS_IN_NAND=y
 CONFIG_BOOTDELAY=3
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
@@ -44,6 +43,7 @@ CONFIG_DM=y
 CONFIG_SPL_DM=y
 CONFIG_DM_GPIO=y
 CONFIG_MMC_OMAP_HS=y
+CONFIG_NAND=y
 CONFIG_MTD=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
diff --git a/include/configs/omap3_evm.h b/include/configs/omap3_evm.h
index 9930483406..8972e96366 100644
--- a/include/configs/omap3_evm.h
+++ b/include/configs/omap3_evm.h
@@ -36,7 +36,6 @@
 #define CONFIG_INITRD_TAG
 #define CONFIG_REVISION_TAG
 
-
 /* Override OMAP3 serial console configuration */
 #undef CONFIG_CONS_INDEX
 #define CONFIG_CONS_INDEX               1
@@ -76,11 +75,14 @@
 #define CONFIG_SPL_OMAP3_ID_NAND
 #define CONFIG_MTD_DEVICE               /* needed for mtdparts commands */
 #define CONFIG_MTD_PARTITIONS           /* required for UBI partition support */
+/* NAND: SPL falcon mode configs */
+#if defined(CONFIG_SPL_OS_BOOT)
+#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x280000
+#endif /* CONFIG_SPL_OS_BOOT */
 #endif /* CONFIG_NAND */
 
-#define CONFIG_USB_OMAP3
-
 /* MUSB */
+#define CONFIG_USB_OMAP3
 #define CONFIG_USB_MUSB_OMAP2PLUS
 #define CONFIG_USB_MUSB_PIO_ONLY
 #define CONFIG_USB_ETHER
@@ -101,28 +103,32 @@
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	DEFAULT_LINUX_BOOT_ENV \
-	"mtdids=" CONFIG_MTDIDS_DEFAULT "\0"	\
+	"mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
 	"mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
-	"loadaddr=0x82000000\0" \
-	"usbtty=cdc_acm\0" \
+	"bootenv=uEnv.txt\0" \
+	"optargs=\0" \
 	"mmcdev=0\0" \
 	"console=ttyO0,115200n8\0" \
 	"mmcargs=setenv bootargs console=${console} " \
+		"${mtdparts} " \
 		"${optargs} " \
 		"root=/dev/mmcblk0p2 rw " \
 		"rootfstype=ext4 rootwait\0" \
 	"nandargs=setenv bootargs console=${console} " \
+		"${mtdparts} " \
 		"${optargs} " \
 		"root=ubi0:rootfs rw ubi.mtd=rootfs noinitrd " \
 		"rootfstype=ubifs rootwait\0" \
-	"loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr\0" \
+	"loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
+	"importbootenv=echo Importing environment from mmc ...; " \
+		"env import -t ${loadaddr} ${filesize}\0" \
 	"bootscript=echo Running bootscript from mmc ...; " \
 		"source ${loadaddr}\0" \
 	"loaduimage=setenv bootfile uImage; " \
 		"fatload mmc ${mmcdev} ${loadaddr} uImage\0" \
 	"loadzimage=setenv bootfile zImage; " \
 		"fatload mmc ${mmcdev} ${loadaddr} zImage\0" \
-	"loaddtb=fatload mmc ${mmcdev} ${fdtaddr} omap3-evm.dtb\0" \
+	"loaddtb=fatload mmc ${mmcdev} ${fdtaddr} " CONFIG_DEFAULT_FDT_FILE "\0" \
 	"mmcboot=echo Booting ${bootfile} from mmc ...; " \
 		"run mmcargs; " \
 		"bootm ${loadaddr} - ${fdtaddr}\0" \
@@ -137,8 +143,12 @@
 
 #define CONFIG_BOOTCOMMAND \
 	"mmc dev ${mmcdev}; if mmc rescan; then " \
-		"if run loadbootscript; then " \
-			"run bootscript; " \
+		"if run loadbootenv; then " \
+			"run importbootenv; " \
+			"if test -n $uenvcmd; then " \
+				"echo Running uenvcmd ...; " \
+				"run uenvcmd; " \
+			"fi; " \
 		"else " \
 			"if run loadzimage && run loaddtb; then " \
 				"run mmcbootz; fi; " \
-- 
2.14.1



More information about the U-Boot mailing list