[PATCH u-boot 3/4] sunxi: eMMC: Add comments explaining mapping between bootpart and mmc_switch_part()

Andre Przywara andre.przywara at arm.com
Fri Apr 14 12:48:54 CEST 2023


On Thu, 13 Apr 2023 23:10:56 +0200
Pali Rohár <pali at kernel.org> wrote:

> Mapping between bootpart taken from EXT_CSD_EXTRACT_BOOT_PART() and
> Partition Access bits used by the mmc_switch_part() function may be quite
> misleading. So add extended comment describing why in sunxi case is this
> mapping just a simple identity. Because in generic case this mapping
> requires non-trivial mapping table.

Ah, indeed, many thanks for clearing this up! I missed the subtleties
of bootpart meaning slightly different things between
EXT_CSD_EXTRACT_BOOT_PART and mmc_switch_part(). It looks like we were
quite lucky as we only care about 1 and 2 here!

> Signed-off-by: Pali Rohár <pali at kernel.org>

Acked-by: Andre Przywara <andre.przywara at arm.com>

Queued for sunxi/master.

Cheers,
Andre

> ---
>  arch/arm/mach-sunxi/board.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
> index 391a65a5495f..73519f6262ec 100644
> --- a/arch/arm/mach-sunxi/board.c
> +++ b/arch/arm/mach-sunxi/board.c
> @@ -381,7 +381,17 @@ static bool sunxi_valid_emmc_boot(struct mmc *mmc)
>  	    (mmc->ext_csd[EXT_CSD_BOOT_BUS_WIDTH] & 0x1b) != 0x09)
>  		return false;
>  
> -	/* Partition 0 is the user data partition, bootpart must be 1 or 2. */
> +	/*
> +	 * bootpart == 0 means that eMMC booting is disabled.
> +	 * bootpart == 1 or 2 means to boot from Boot Partition 1 or 2.
> +	 * bootpart == 7 means to boot from User Area.
> +	 * Other bootpart values are reserved.
> +	 * mmc_switch_part() takes partition access value which is:
> +	 * 0 for User Area; 1-2 for Boot Partition 1-2; 3 for RPMB; 4-7 for GP 1-4.
> +	 * We allow booting only from Boot Partition 1 or 2 so
> +	 * bootpart mapping between EXT_CSD_EXTRACT_BOOT_PART()
> +	 * and mmc_switch_part() is straightforward identity.
> +	 */
>  	if (bootpart != 1 && bootpart != 2)
>  		return false;
>  



More information about the U-Boot mailing list