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

Pali Rohár pali at kernel.org
Thu Apr 13 23:10:56 CEST 2023


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.

Signed-off-by: Pali Rohár <pali at kernel.org>
---
 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;
 
-- 
2.20.1



More information about the U-Boot mailing list