[U-Boot] [PATCH] ARM AM43XX: make boot-params available to U-Boot, save to env

Holleis, Edgar Edgar.Holleis at zuehlke.com
Wed Jul 22 19:01:03 CEST 2015


This patch makes the Boot Parameter Structure of AM43XX available to U-Boot. The feature is already available for OMAP3 and OMAP4, but not AM43XX. It also adds the value of the boot device to the U-Boot environment. 

Signed-off-by: Edgar Holleis <edgar.holleis at zuehlke.com>
---
 arch/arm/cpu/armv7/am33xx/board.c            | 11 +++++++++++
 arch/arm/cpu/armv7/omap-common/boot-common.c | 10 +++++++---
 board/ti/am43xx/board.c                      |  5 +++++
 3 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c
index 67bef23..7149990 100644
--- a/arch/arm/cpu/armv7/am33xx/board.c
+++ b/arch/arm/cpu/armv7/am33xx/board.c
@@ -203,6 +203,17 @@ int arch_misc_init(void)
 	return 0;
 }
 
+#ifdef CONFIG_ARCH_CPU_INIT
+/*
+ * SOC specific cpu init
+ */
+int arch_cpu_init(void)
+{
+	save_omap_boot_params();
+	return 0;
+}
+#endif /* CONFIG_ARCH_CPU_INIT */
+
 #ifndef CONFIG_SKIP_LOWLEVEL_INIT
 /*
  * In the case of non-SPL based booting we'll want to call these
diff --git a/arch/arm/cpu/armv7/omap-common/boot-common.c b/arch/arm/cpu/armv7/omap-common/boot-common.c
index bbc6bed..d1053eb 100644
--- a/arch/arm/cpu/armv7/omap-common/boot-common.c
+++ b/arch/arm/cpu/armv7/omap-common/boot-common.c
@@ -64,9 +64,13 @@ void save_omap_boot_params(void)
 #endif
 		{
 			dev_desc = *((u32 *)(rom_params + DEV_DESC_PTR_OFFSET));
-			dev_data = *((u32 *)(dev_desc + DEV_DATA_PTR_OFFSET));
-			gd->arch.omap_boot_params.omap_bootmode =
-					*((u32 *)(dev_data + BOOT_MODE_OFFSET));
+			if (dev_desc != 0) {
+				dev_data = *((u32 *)(dev_desc + DEV_DATA_PTR_OFFSET));
+				gd->arch.omap_boot_params.omap_bootmode =
+						*((u32 *)(dev_data + BOOT_MODE_OFFSET));
+			} else {
+				gd->arch.omap_boot_params.omap_bootmode = MMCSD_MODE_UNDEFINED;
+			}
 		}
 	}
 
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index d7b9e5a..ecd6c56 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -670,6 +670,11 @@ int board_late_init(void)
 	safe_string[sizeof(header.version)] = 0;
 	setenv("board_rev", safe_string);
 #endif
+
+	char tmpstr[5];
+	sprintf(tmpstr, "0x%02x", gd->arch.omap_boot_params.omap_bootdevice);
+	setenv("omap_bootdevice", tmpstr);
+
 	return 0;
 }
 #endif
-- 
1.9.1


More information about the U-Boot mailing list