diff mbox series

[2/2] spl: mmc: Pass eMMC HW partition 7 through

Message ID 20230105142831.163381-2-marex@denx.de
State Superseded
Delegated to: Jaehoon Chung
Headers show
Series [1/2] spl: mmc: Pass eMMC HW partition and SW partition to spl_mmc_get_uboot_raw_sector() | expand

Commit Message

Marek Vasut Jan. 5, 2023, 2:28 p.m. UTC
The eMMC HW partition 0 and 7 both mean USER HW partition. Use this as
a mean of propagating A/B copy selection within USER HW partition. The
spl_mmc_get_uboot_raw_sector() can detect that a USER HW partition is
in use and based on whether it is 0 or 7, select appropriate sector to
load from.

Signed-off-by: Fedor Ross <fedor.ross@ifm.com>
Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Peng Fan <peng.fan@nxp.com>
---
 common/spl/spl_mmc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Jaehoon Chung March 10, 2023, 2:30 a.m. UTC | #1
On 1/5/23 23:28, Marek Vasut wrote:
> The eMMC HW partition 0 and 7 both mean USER HW partition. Use this as
> a mean of propagating A/B copy selection within USER HW partition. The
> spl_mmc_get_uboot_raw_sector() can detect that a USER HW partition is
> in use and based on whether it is 0 or 7, select appropriate sector to
> load from.
> 
> Signed-off-by: Fedor Ross <fedor.ross@ifm.com>
> Signed-off-by: Marek Vasut <marex@denx.de>


Applied to u-boot-mmc/master.

Best Regards,
Jaehoon Chung


> ---
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Peng Fan <peng.fan@nxp.com>
> ---
>  common/spl/spl_mmc.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
> index 8a0c7331267..d634ccb0b9a 100644
> --- a/common/spl/spl_mmc.c
> +++ b/common/spl/spl_mmc.c
> @@ -420,7 +420,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
>  	static struct mmc *mmc;
>  	u32 boot_mode;
>  	int err = 0;
> -	__maybe_unused int hw_part = 0;
> +	__maybe_unused int part, hw_part = 0;
>  	int mmc_dev;
>  
>  	/* Perform peripheral init only once for an mmc device */
> @@ -445,11 +445,12 @@ int spl_mmc_load(struct spl_image_info *spl_image,
>  	switch (boot_mode) {
>  	case MMCSD_MODE_EMMCBOOT:
>  		hw_part = spl_mmc_emmc_boot_partition(mmc);
> +		part = hw_part == 7 ? 0 : hw_part;
>  
>  		if (CONFIG_IS_ENABLED(MMC_TINY))
> -			err = mmc_switch_part(mmc, hw_part);
> +			err = mmc_switch_part(mmc, part);
>  		else
> -			err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), hw_part);
> +			err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part);
>  
>  		if (err) {
>  #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
> @@ -479,7 +480,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
>  #endif
>  #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
>  		err = mmc_load_image_raw_sector(spl_image, bootdev, mmc,
> -				raw_sect + spl_mmc_raw_uboot_offset(hw_part));
> +				raw_sect + spl_mmc_raw_uboot_offset(part));
>  		if (!err)
>  			return err;
>  #endif
diff mbox series

Patch

diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 8a0c7331267..d634ccb0b9a 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -420,7 +420,7 @@  int spl_mmc_load(struct spl_image_info *spl_image,
 	static struct mmc *mmc;
 	u32 boot_mode;
 	int err = 0;
-	__maybe_unused int hw_part = 0;
+	__maybe_unused int part, hw_part = 0;
 	int mmc_dev;
 
 	/* Perform peripheral init only once for an mmc device */
@@ -445,11 +445,12 @@  int spl_mmc_load(struct spl_image_info *spl_image,
 	switch (boot_mode) {
 	case MMCSD_MODE_EMMCBOOT:
 		hw_part = spl_mmc_emmc_boot_partition(mmc);
+		part = hw_part == 7 ? 0 : hw_part;
 
 		if (CONFIG_IS_ENABLED(MMC_TINY))
-			err = mmc_switch_part(mmc, hw_part);
+			err = mmc_switch_part(mmc, part);
 		else
-			err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), hw_part);
+			err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part);
 
 		if (err) {
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
@@ -479,7 +480,7 @@  int spl_mmc_load(struct spl_image_info *spl_image,
 #endif
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
 		err = mmc_load_image_raw_sector(spl_image, bootdev, mmc,
-				raw_sect + spl_mmc_raw_uboot_offset(hw_part));
+				raw_sect + spl_mmc_raw_uboot_offset(part));
 		if (!err)
 			return err;
 #endif