Re: [RESEND PATCH v2 1/3] spl: mmc: extend spl_mmc_boot_mode() to take mmc argument

2021-07-20 Thread Simon Glass
Hi Andre,

On Mon, 12 Jul 2021 at 04:07, Andre Przywara  wrote:
>
> Platforms can overwrite the weak definition of spl_mmc_boot_mode() to
> determine where to load U-Boot proper from.
> For most of them this is a trivial decision based on Kconfig variables,
> but it might be desirable the probe the actual device to answer this
> question.
>
> Pass the pointer to the mmc struct to that function, so implementations
> can make use of that.
>
> Compile-tested for all users changed.
>
> Signed-off-by: Andre Przywara 
> Reviewed-by: Stefano Babic 
> Reviewed-by: Ley Foon Tan  (for SoCFPGA)
> Acked-by: Lokesh Vutla  (for OMAP and K3)
> ---
> (resent to also include forgotten U-Boot list)
>
>  arch/arm/mach-imx/spl.c| 2 +-
>  arch/arm/mach-k3/am6_init.c| 2 +-
>  arch/arm/mach-k3/j721e_init.c  | 2 +-
>  arch/arm/mach-omap2/boot-common.c  | 2 +-
>  arch/arm/mach-rockchip/spl.c   | 2 +-
>  arch/arm/mach-socfpga/spl_a10.c| 2 +-
>  arch/arm/mach-socfpga/spl_gen5.c   | 2 +-
>  arch/arm/mach-stm32mp/spl.c| 2 +-
>  arch/arm/mach-uniphier/mmc-boot-mode.c | 5 +
>  common/spl/spl_mmc.c   | 4 ++--
>  include/spl.h  | 3 ++-
>  11 files changed, 13 insertions(+), 15 deletions(-)

Reviewed-by: Simon Glass 

But I think this should come from a sysinfo driver.

Regards,
Simon


[RESEND PATCH v2 1/3] spl: mmc: extend spl_mmc_boot_mode() to take mmc argument

2021-07-12 Thread Andre Przywara
Platforms can overwrite the weak definition of spl_mmc_boot_mode() to
determine where to load U-Boot proper from.
For most of them this is a trivial decision based on Kconfig variables,
but it might be desirable the probe the actual device to answer this
question.

Pass the pointer to the mmc struct to that function, so implementations
can make use of that.

Compile-tested for all users changed.

Signed-off-by: Andre Przywara 
Reviewed-by: Stefano Babic 
Reviewed-by: Ley Foon Tan  (for SoCFPGA)
Acked-by: Lokesh Vutla  (for OMAP and K3)
---
(resent to also include forgotten U-Boot list)

 arch/arm/mach-imx/spl.c| 2 +-
 arch/arm/mach-k3/am6_init.c| 2 +-
 arch/arm/mach-k3/j721e_init.c  | 2 +-
 arch/arm/mach-omap2/boot-common.c  | 2 +-
 arch/arm/mach-rockchip/spl.c   | 2 +-
 arch/arm/mach-socfpga/spl_a10.c| 2 +-
 arch/arm/mach-socfpga/spl_gen5.c   | 2 +-
 arch/arm/mach-stm32mp/spl.c| 2 +-
 arch/arm/mach-uniphier/mmc-boot-mode.c | 5 +
 common/spl/spl_mmc.c   | 4 ++--
 include/spl.h  | 3 ++-
 11 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index 36033d611c9..797097b9c79 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -201,7 +201,7 @@ int g_dnl_get_board_bcd_device_number(int gcnum)
 
 #if defined(CONFIG_SPL_MMC_SUPPORT)
 /* called from spl_mmc to see type of boot mode for storage (RAW or FAT) */
-u32 spl_mmc_boot_mode(const u32 boot_device)
+u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
 {
 #if defined(CONFIG_MX7) || defined(CONFIG_IMX8M) || defined(CONFIG_IMX8)
switch (get_boot_device()) {
diff --git a/arch/arm/mach-k3/am6_init.c b/arch/arm/mach-k3/am6_init.c
index 425b3f93c86..f4b039e8a6a 100644
--- a/arch/arm/mach-k3/am6_init.c
+++ b/arch/arm/mach-k3/am6_init.c
@@ -253,7 +253,7 @@ void board_init_f(ulong dummy)
spl_enable_dcache();
 }
 
-u32 spl_mmc_boot_mode(const u32 boot_device)
+u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
 {
 #if defined(CONFIG_SUPPORT_EMMC_BOOT)
u32 devstat = readl(CTRLMMR_MAIN_DEVSTAT);
diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
index e9e076c9e72..fc0db2a4001 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -232,7 +232,7 @@ void board_init_f(ulong dummy)
spl_enable_dcache();
 }
 
-u32 spl_mmc_boot_mode(const u32 boot_device)
+u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
 {
switch (boot_device) {
case BOOT_DEVICE_MMC1:
diff --git a/arch/arm/mach-omap2/boot-common.c 
b/arch/arm/mach-omap2/boot-common.c
index 1268a325038..f71fe65a0b1 100644
--- a/arch/arm/mach-omap2/boot-common.c
+++ b/arch/arm/mach-omap2/boot-common.c
@@ -189,7 +189,7 @@ u32 spl_boot_device(void)
return gd->arch.omap_boot_device;
 }
 
-u32 spl_mmc_boot_mode(const u32 boot_device)
+u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
 {
return gd->arch.omap_boot_mode;
 }
diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c
index 02c40fb37ed..082a5bfb20a 100644
--- a/arch/arm/mach-rockchip/spl.c
+++ b/arch/arm/mach-rockchip/spl.c
@@ -65,7 +65,7 @@ u32 spl_boot_device(void)
return boot_device;
 }
 
-u32 spl_mmc_boot_mode(const u32 boot_device)
+u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
 {
return MMCSD_MODE_RAW;
 }
diff --git a/arch/arm/mach-socfpga/spl_a10.c b/arch/arm/mach-socfpga/spl_a10.c
index b5f43f09d19..c6dcd309bfc 100644
--- a/arch/arm/mach-socfpga/spl_a10.c
+++ b/arch/arm/mach-socfpga/spl_a10.c
@@ -94,7 +94,7 @@ u32 spl_boot_device(void)
 }
 
 #ifdef CONFIG_SPL_MMC_SUPPORT
-u32 spl_mmc_boot_mode(const u32 boot_device)
+u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
 {
 #if defined(CONFIG_SPL_FS_FAT) || defined(CONFIG_SPL_FS_EXT4)
return MMCSD_MODE_FS;
diff --git a/arch/arm/mach-socfpga/spl_gen5.c b/arch/arm/mach-socfpga/spl_gen5.c
index 7c716117685..e5d1e64c449 100644
--- a/arch/arm/mach-socfpga/spl_gen5.c
+++ b/arch/arm/mach-socfpga/spl_gen5.c
@@ -53,7 +53,7 @@ u32 spl_boot_device(void)
 }
 
 #ifdef CONFIG_SPL_MMC_SUPPORT
-u32 spl_mmc_boot_mode(const u32 boot_device)
+u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
 {
 #if defined(CONFIG_SPL_FS_FAT) || defined(CONFIG_SPL_FS_EXT4)
return MMCSD_MODE_FS;
diff --git a/arch/arm/mach-stm32mp/spl.c b/arch/arm/mach-stm32mp/spl.c
index b53659a698a..4c8085b8305 100644
--- a/arch/arm/mach-stm32mp/spl.c
+++ b/arch/arm/mach-stm32mp/spl.c
@@ -53,7 +53,7 @@ u32 spl_boot_device(void)
return BOOT_DEVICE_MMC1;
 }
 
-u32 spl_mmc_boot_mode(const u32 boot_device)
+u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
 {
return MMCSD_MODE_RAW;
 }
diff --git a/arch/arm/mach-uniphier/mmc-boot-mode.c 
b/arch/arm/mach-uniphier/mmc-boot-mode.c
index e47e5df6480..09cad743c55 100644