Skip to contentSkip to conversation

common: Pass the boot device into spl_boot_mode()

PATCH In review Marek Vasut 3 participants 4 messages May 14, 2016 – Jun 26, 2016

Subsystems (11)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common: Pass the boot device into spl_boot_mode()

The SPL code already knows which boot device it calls the spl_boot_mode() on, so pass that information into the function. This allows the code of spl_boot_mode() avoid invokind spl_boot_device() again, but it also lets board_boot_order() correctly alter the behavior of the boot process.

The later one is important, since in certain cases, it is desired that spl_boot_device() return value be overriden using board_boot_order().

Cc Andreas Bie?mann <[email protected]>
Cc Albert Aribaud <[email protected]>
Cc Tom Rini <[email protected]>
---
 arch/arm/cpu/arm1136/mx35/generic.c          | 2 +-
 arch/arm/cpu/armv7/ls102xa/spl.c             | 2 +-
 arch/arm/cpu/armv7/omap-common/boot-common.c | 2 +-
 arch/arm/cpu/armv8/fsl-layerscape/spl.c      | 2 +-
 arch/arm/imx-common/spl.c                    | 2 +-
 arch/arm/mach-at91/spl.c                     | 2 +-
 arch/arm/mach-davinci/spl.c                  | 2 +-
 arch/arm/mach-mvebu/spl.c                    | 2 +-
 arch/arm/mach-rockchip/rk3288-board-spl.c    | 2 +-
 arch/arm/mach-socfpga/spl.c                  | 2 +-
 arch/arm/mach-sunxi/board.c                  | 2 +-
 arch/arm/mach-uniphier/boot-mode/boot-mode.c | 2 +-
 arch/arm/mach-zynq/spl.c                     | 2 +-
 common/spl/spl_mmc.c                         | 2 +-
 include/spl.h                                | 2 +-
 15 files changed, 15 insertions(+), 15 deletions(-)
arch/arm/cpu/arm1136/mx35/generic.c +1 -1
index bc98edd..068d93e 100644
@@ -526,7 +526,7 @@ u32 spl_boot_device(void)
 }
 
 #ifdef CONFIG_SPL_BUILD
-u32 spl_boot_mode(void)
+u32 spl_boot_mode(const u32 boot_device)
 {
 	switch (spl_boot_device()) {
 	case BOOT_DEVICE_MMC1:
arch/arm/cpu/armv7/ls102xa/spl.c +1 -1
index 1dfbf548..be5b6b8 100644
@@ -15,7 +15,7 @@ u32 spl_boot_device(void)
 	return BOOT_DEVICE_NAND;
 }
 
-u32 spl_boot_mode(void)
+u32 spl_boot_mode(const u32 boot_device)
 {
 	switch (spl_boot_device()) {
 	case BOOT_DEVICE_MMC1:
arch/arm/cpu/armv7/omap-common/boot-common.c +1 -1
index 0456263..5479204 100644
@@ -166,7 +166,7 @@ u32 spl_boot_device(void)
 	return gd->arch.omap_boot_device;
 }
 
-u32 spl_boot_mode(void)
+u32 spl_boot_mode(const u32 boot_device)
 {
 	return gd->arch.omap_boot_mode;
 }
arch/arm/cpu/armv8/fsl-layerscape/spl.c +1 -1
index c1229c8..c1b9aef 100644
@@ -24,7 +24,7 @@ u32 spl_boot_device(void)
 	return 0;
 }
 
-u32 spl_boot_mode(void)
+u32 spl_boot_mode(const u32 boot_device)
 {
 	switch (spl_boot_device()) {
 	case BOOT_DEVICE_MMC1:
arch/arm/imx-common/spl.c +1 -1
index caa45cf..bdcda7d 100644
@@ -70,7 +70,7 @@ u32 spl_boot_device(void)
 
 #if defined(CONFIG_SPL_MMC_SUPPORT)
 /* called from spl_mmc to see type of boot mode for storage (RAW or FAT) */
-u32 spl_boot_mode(void)
+u32 spl_boot_mode(const u32 boot_device)
 {
 	switch (spl_boot_device()) {
 	/* for MMC return either RAW or FAT mode */
arch/arm/mach-at91/spl.c +1 -1
index c4ed224..561cf5f 100644
@@ -70,7 +70,7 @@ u32 spl_boot_device(void)
 }
 #endif
 
-u32 spl_boot_mode(void)
+u32 spl_boot_mode(const u32 boot_device)
 {
 	switch (spl_boot_device()) {
 #ifdef CONFIG_SYS_USE_MMC
arch/arm/mach-davinci/spl.c +1 -1
index 49349da..0aeaa7d 100644
@@ -45,7 +45,7 @@ void spl_board_init(void)
 	preloader_console_init();
 }
 
-u32 spl_boot_mode(void)
+u32 spl_boot_mode(const u32 boot_device)
 {
 	return MMCSD_MODE_RAW;
 }
arch/arm/mach-mvebu/spl.c +1 -1
index ac5bb2c..e1c9cdb 100644
@@ -57,7 +57,7 @@ u32 spl_boot_device(void)
 }
 
 #ifdef CONFIG_SPL_MMC_SUPPORT
-u32 spl_boot_mode(void)
+u32 spl_boot_mode(const u32 boot_device)
 {
 	return MMCSD_MODE_RAW;
 }
arch/arm/mach-rockchip/rk3288-board-spl.c +1 -1
index e133cca..15f1266 100644
@@ -66,7 +66,7 @@ fallback:
 	return BOOT_DEVICE_MMC1;
 }
 
-u32 spl_boot_mode(void)
+u32 spl_boot_mode(const u32 boot_device)
 {
 	return MMCSD_MODE_RAW;
 }
arch/arm/mach-socfpga/spl.c +1 -1
index 98c16a0..fec4c7a 100644
@@ -58,7 +58,7 @@ u32 spl_boot_device(void)
 }
 
 #ifdef CONFIG_SPL_MMC_SUPPORT
-u32 spl_boot_mode(void)
+u32 spl_boot_mode(const u32 boot_device)
 {
 #if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
 	return MMCSD_MODE_FS;
arch/arm/mach-sunxi/board.c +1 -1
index 20149da..28016ba 100644
@@ -248,7 +248,7 @@ u32 spl_boot_device(void)
 }
 
 /* No confirmation data available in SPL yet. Hardcode bootmode */
-u32 spl_boot_mode(void)
+u32 spl_boot_mode(const u32 boot_device)
 {
 	return MMCSD_MODE_RAW;
 }
arch/arm/mach-uniphier/boot-mode/boot-mode.c +1 -1
index b180f44..3cdc360 100644
@@ -57,7 +57,7 @@ u32 spl_boot_device(void)
 	return ret == BOOT_DEVICE_USB ? BOOT_DEVICE_NOR : ret;
 }
 
-u32 spl_boot_mode(void)
+u32 spl_boot_mode(const u32 boot_device)
 {
 	struct mmc *mmc;
 
arch/arm/mach-zynq/spl.c +1 -1
index 723019d..6c3be14 100644
@@ -69,7 +69,7 @@ u32 spl_boot_device(void)
 }
 
 #ifdef CONFIG_SPL_MMC_SUPPORT
-u32 spl_boot_mode(void)
+u32 spl_boot_mode(const u32 boot_device)
 {
 	return MMCSD_MODE_FS;
 }
common/spl/spl_mmc.c +1 -1
index 360c754..4811435 100644
@@ -286,7 +286,7 @@ int spl_mmc_load_image(u32 boot_device)
 		return err;
 	}
 
-	boot_mode = spl_boot_mode();
+	boot_mode = spl_boot_mode(boot_device);
 	err = -EINVAL;
 	switch (boot_mode) {
 	case MMCSD_MODE_EMMCBOOT:
include/spl.h +1 -1
index 7edfab4..af85706 100644
@@ -54,7 +54,7 @@ extern struct spl_image_info spl_image;
 /* SPL common functions */
 void preloader_console_init(void);
 u32 spl_boot_device(void);
-u32 spl_boot_mode(void);
+u32 spl_boot_mode(const u32 boot_device);
 void spl_set_header_raw_uboot(void);
 int spl_parse_image_header(const struct image_header *header);
 void spl_board_prepare_for_linux(void);
Signature · 1 line
2.7.0
#1 lore raw

PATCH 1/1 common: Pass the boot device into spl_boot_mode()

Quoted 5 lines · Marek Vasut

The SPL code already knows which boot device it calls the spl_boot_mode() on, so pass that information into the function. This allows the code of spl_boot_mode() avoid invokind spl_boot_device() again, but it also lets board_boot_order() correctly alter the behavior of the boot process.

Quoted 7 lines

The later one is important, since in certain cases, it is desired that spl_boot_device() return value be overriden using board_boot_order().

Cc Andreas Bie?mann <[email protected]>
Cc Albert Aribaud <[email protected]>
Cc Tom Rini <[email protected]>

There is now another user of spl_boot_device (zynqmp), should be easy to adopt.

Tom, do you have any objections that I take this one for 2016.07. This one is delegated to you but is required by another one delegated to me.

Andreas

#2 lore raw

PATCH 1/1 common: Pass the boot device into spl_boot_mode()

Quoted 14 lines · Andreas Bie?mann
Quoted 5 lines · Marek Vasut

The SPL code already knows which boot device it calls the spl_boot_mode() on, so pass that information into the function. This allows the code of spl_boot_mode() avoid invokind spl_boot_device() again, but it also lets board_boot_order() correctly alter the behavior of the boot process.

Quoted 7 lines

The later one is important, since in certain cases, it is desired that spl_boot_device() return value be overriden using board_boot_order().

Cc Andreas Bie?mann <[email protected]>
Cc Albert Aribaud <[email protected]>
Cc Tom Rini <[email protected]>
Quoted 7 lines

There is now another user of spl_boot_device (zynqmp), should be easy to adopt.

Tom, do you have any objections that I take this one for 2016.07. This one is delegated to you but is required by another one delegated to me.

Go ahead and pick it up, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160621/682052a4/attachment.sig>
#3 lore raw
In reply to Marek Vasut

Dear Marek Vasut,

Quoted 16 lines · Marek Vasut

The SPL code already knows which boot device it calls the spl_boot_mode() on, so pass that information into the function. This allows the code of spl_boot_mode() avoid invoking spl_boot_device() again, but it also lets board_boot_order() correctly alter the behavior of the boot process.

The later one is important, since in certain cases, it is desired that spl_boot_device() return value be overriden using board_boot_order().

Cc Andreas Bie?mann <[email protected]>
Cc Albert Aribaud <[email protected]>
Cc Tom Rini <[email protected]>
[add newly introduced zynq variant]

---

Quoted 16 lines
arch/arm/cpu/arm1136/mx35/generic.c          | 2 +-
arch/arm/cpu/armv7/ls102xa/spl.c             | 2 +-
arch/arm/cpu/armv7/omap-common/boot-common.c | 2 +-
arch/arm/cpu/armv8/fsl-layerscape/spl.c      | 2 +-
arch/arm/imx-common/spl.c                    | 2 +-
arch/arm/mach-at91/spl.c                     | 2 +-
arch/arm/mach-davinci/spl.c                  | 2 +-
arch/arm/mach-mvebu/spl.c                    | 2 +-
arch/arm/mach-rockchip/rk3288-board-spl.c    | 2 +-
arch/arm/mach-socfpga/spl.c                  | 2 +-
arch/arm/mach-sunxi/board.c                  | 2 +-
arch/arm/mach-uniphier/boot-mode/boot-mode.c | 2 +-
arch/arm/mach-zynq/spl.c                     | 2 +-
common/spl/spl_mmc.c                         | 2 +-
include/spl.h                                | 2 +-
15 files changed, 15 insertions(+), 15 deletions(-)

applied to u-boot-atmel/master, thanks!

Also adopted newly introduced zynq variant of
spl_boot_mode().

Best regards,
Andreas Bie?mann