Skip to contentSkip to conversation

stm32mp1: spl: support loading U-Boot proper from eMMC hardware partitions

PATCH In review Sean Nyekjaer 2 participants 5 messages Jun 18 – Sep 1 2 messages not in the archive

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

PATCH 1/1 stm32mp1: spl: support loading U-Boot proper from eMMC hardware partitions

When CONFIG_SUPPORT_EMMC_BOOT is enabled, make spl_mmc_boot_mode() return MMCSD_MODE_EMMCBOOT instead of MMCSD_MODE_RAW.

This allows the SPL MMC loader to honor the standard configuration options CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION and CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR when locating U-Boot proper, whether it is stored in a GPT partition or in an eMMC hardware boot partition.

As a result, both U-Boot SPL and U-Boot proper can be placed in the eMMC hardware boot partitions.

---
 arch/arm/mach-stm32mp/stm32mp1/spl.c | 5 -----
 1 file changed, 5 deletions(-)
arch/arm/mach-stm32mp/stm32mp1/spl.c +0 -5
index d2e41b8e65f..d2af705a5d1 100644
@@ -56,11 +56,6 @@ u32 spl_boot_device(void)
 	return BOOT_DEVICE_MMC1;
 }
 
-u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
-{
-	return MMCSD_MODE_RAW;
-}
-
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
 int spl_mmc_boot_partition(const u32 boot_device)
 {
Signature · 1 line
2.52.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 23 lines · Sean Nyekjaer

When CONFIG_SUPPORT_EMMC_BOOT is enabled, make spl_mmc_boot_mode() return MMCSD_MODE_EMMCBOOT instead of MMCSD_MODE_RAW.

This allows the SPL MMC loader to honor the standard configuration options CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION and CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR when locating U-Boot proper, whether it is stored in a GPT partition or in an eMMC hardware boot partition.

As a result, both U-Boot SPL and U-Boot proper can be placed in the eMMC hardware boot partitions.

---
 arch/arm/mach-stm32mp/stm32mp1/spl.c | 5 -----
 1 file changed, 5 deletions(-)
arch/arm/mach-stm32mp/stm32mp1/spl.c +0 -0
index d2e41b8e65f..d2af705a5d1 100644
@@ -56,11 +56,6 @@ u32 spl_boot_device(void)
 	return BOOT_DEVICE_MMC1;

arch/arm/mach-stm32mp/stm32mp1/spl.c u32 spl_boot_device(void) · line 61

Quoted 10 lines
arch/arm/mach-stm32mp/stm32mp1/spl.c +0 -5
 }
 
-u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
-{
-	return MMCSD_MODE_RAW;
-}
-
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
 int spl_mmc_boot_partition(const u32 boot_device)
 {

Hi Sean

Thanks
Patrice

#2 lore raw
Quoted 39 lines · Patrice CHOTARD
Quoted 23 lines · Sean Nyekjaer

When CONFIG_SUPPORT_EMMC_BOOT is enabled, make spl_mmc_boot_mode() return MMCSD_MODE_EMMCBOOT instead of MMCSD_MODE_RAW.

This allows the SPL MMC loader to honor the standard configuration options CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION and CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR when locating U-Boot proper, whether it is stored in a GPT partition or in an eMMC hardware boot partition.

As a result, both U-Boot SPL and U-Boot proper can be placed in the eMMC hardware boot partitions.

---
 arch/arm/mach-stm32mp/stm32mp1/spl.c | 5 -----
 1 file changed, 5 deletions(-)
arch/arm/mach-stm32mp/stm32mp1/spl.c +0 -0
index d2e41b8e65f..d2af705a5d1 100644
@@ -56,11 +56,6 @@ u32 spl_boot_device(void)
 	return BOOT_DEVICE_MMC1;

arch/arm/mach-stm32mp/stm32mp1/spl.c u32 spl_boot_device(void) · line 61

Quoted 10 lines
arch/arm/mach-stm32mp/stm32mp1/spl.c +0 -5
 }
 
-u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
-{
-	return MMCSD_MODE_RAW;
-}
-
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
 int spl_mmc_boot_partition(const u32 boot_device)
 {

Hi Sean

Quoted 4 lines

Thanks
Patrice

Hi Sean

After a discussion with Patrick, it should be safer to keep spl_mmc_boot_mode() implemented as following:

u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)

{
	return IS_SD(mmc) ? MMCSD_MODE_RAW : MMCSD_MODE_EMMCBOOT;
}

Thanks
Patrice

A message that is not in the archive (sent off-list or not yet received): AVOkeKKkQAoWpdG0kyASXbfyu96CsaHLok9_DQCEG5xW6hVGSaAk3tb6g4UZXdDa_uByOjgb2qA8Wq6cIy63baubWNMpGb8i_pZahNST4jw=@geanix.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

Oh, I accidentality dropped the CC to the list :/

Quoted 71 lines · Patrice CHOTARD
Quoted 4 lines · Sean Nyekjaer

Hi Patrice,

Quoted 59 lines
Quoted 56 lines · Patrice CHOTARD
Quoted 39 lines · Patrice CHOTARD
Quoted 23 lines · Sean Nyekjaer

When CONFIG_SUPPORT_EMMC_BOOT is enabled, make spl_mmc_boot_mode() return MMCSD_MODE_EMMCBOOT instead of MMCSD_MODE_RAW.

This allows the SPL MMC loader to honor the standard configuration options CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION and CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR when locating U-Boot proper, whether it is stored in a GPT partition or in an eMMC hardware boot partition.

As a result, both U-Boot SPL and U-Boot proper can be placed in the eMMC hardware boot partitions.

---
 arch/arm/mach-stm32mp/stm32mp1/spl.c | 5 -----
 1 file changed, 5 deletions(-)
arch/arm/mach-stm32mp/stm32mp1/spl.c +0 -0
index d2e41b8e65f..d2af705a5d1 100644
@@ -56,11 +56,6 @@ u32 spl_boot_device(void)
 	return BOOT_DEVICE_MMC1;

arch/arm/mach-stm32mp/stm32mp1/spl.c u32 spl_boot_device(void) · line 61

Quoted 10 lines
arch/arm/mach-stm32mp/stm32mp1/spl.c +0 -5
 }
 
-u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
-{
-	return MMCSD_MODE_RAW;
-}
-
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
 int spl_mmc_boot_partition(const u32 boot_device)
 {

Hi Sean

Quoted 4 lines

Thanks
Patrice

Hi Sean

After a discussion with Patrick, it should be safer to keep spl_mmc_boot_mode() implemented as following:

u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)

{
	return IS_SD(mmc) ? MMCSD_MODE_RAW : MMCSD_MODE_EMMCBOOT;
}

Hi Sean

Quoted 1 line

So like the arch/arm/mach-mvebu/spl.c ?

Quoted 8 lines

Yes

Quoted 2 lines

But it's still a compile time option to choose where the U-boot proper is located.
When just removing the ST special here, we also gain support for loading U-boot proper from a filesystem.

In our defconfig, we always got MMCSD_MODE_EMMCBOOT enabled, but we support boot from eMMC or SD-card. It allows to distinguish the boot device at runtime.

You will still need to have:
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
or
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR

So still a compile time option.

/Sean

#6 lore raw
Quoted 92 lines · Sean Nyekjaer

Oh, I accidentality dropped the CC to the list :/

Quoted 71 lines · Patrice CHOTARD
Quoted 4 lines · Sean Nyekjaer

Hi Patrice,

Quoted 59 lines
Quoted 56 lines · Patrice CHOTARD
Quoted 39 lines · Patrice CHOTARD
Quoted 23 lines · Sean Nyekjaer

When CONFIG_SUPPORT_EMMC_BOOT is enabled, make spl_mmc_boot_mode() return MMCSD_MODE_EMMCBOOT instead of MMCSD_MODE_RAW.

This allows the SPL MMC loader to honor the standard configuration options CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION and CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR when locating U-Boot proper, whether it is stored in a GPT partition or in an eMMC hardware boot partition.

As a result, both U-Boot SPL and U-Boot proper can be placed in the eMMC hardware boot partitions.

---
 arch/arm/mach-stm32mp/stm32mp1/spl.c | 5 -----
 1 file changed, 5 deletions(-)
arch/arm/mach-stm32mp/stm32mp1/spl.c +0 -0
index d2e41b8e65f..d2af705a5d1 100644
@@ -56,11 +56,6 @@ u32 spl_boot_device(void)
 	return BOOT_DEVICE_MMC1;

arch/arm/mach-stm32mp/stm32mp1/spl.c u32 spl_boot_device(void) · line 61

Quoted 10 lines
arch/arm/mach-stm32mp/stm32mp1/spl.c +0 -5
 }
 
-u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)
-{
-	return MMCSD_MODE_RAW;
-}
-
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
 int spl_mmc_boot_partition(const u32 boot_device)
 {

Hi Sean

Quoted 4 lines

Thanks
Patrice

Hi Sean

After a discussion with Patrick, it should be safer to keep spl_mmc_boot_mode() implemented as following:

u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)

{
	return IS_SD(mmc) ? MMCSD_MODE_RAW : MMCSD_MODE_EMMCBOOT;
}

Hi Sean

Quoted 1 line

So like the arch/arm/mach-mvebu/spl.c ?

Quoted 8 lines

Yes

Quoted 2 lines

But it's still a compile time option to choose where the U-boot proper is located.
When just removing the ST special here, we also gain support for loading U-boot proper from a filesystem.

In our defconfig, we always got MMCSD_MODE_EMMCBOOT enabled, but we support boot from eMMC or SD-card. It allows to distinguish the boot device at runtime.

You will still need to have:
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
or
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR

Quoted 3 lines

So still a compile time option.

/Sean

Applied to u-boot-stm32/next

Thanks
Patrice