Skip to contentSkip to conversation

mmc: Use EXT_CSD_EXTRACT_BOOT_PART() macro for extracting boot part

PATCH In review Pali Rohár 2 participants 3 messages Mar 11, 2023 – Mar 30, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: Use EXT_CSD_EXTRACT_BOOT_PART() macro for extracting boot part

Mask macro PART_ACCESS_MASK filter out access bits of emmc register and macro EXT_CSD_EXTRACT_BOOT_PART() extracts boot part bits of emmc register. So use EXT_CSD_EXTRACT_BOOT_PART() when extracting boot partition.

---
 board/purism/librem5/librem5.c | 2 +-
 cmd/mvebu/bubt.c               | 3 +--
 common/spl/spl_mmc.c           | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)
board/purism/librem5/librem5.c +1 -1
index caa02655fc49..386ed1b4fb22 100644
@@ -41,7 +41,7 @@ int board_early_init_f(void)
 #if IS_ENABLED(CONFIG_LOAD_ENV_FROM_MMC_BOOT_PARTITION)
 uint board_mmc_get_env_part(struct mmc *mmc)
 {
-	uint part = (mmc->part_config >> 3) & PART_ACCESS_MASK;
+	uint part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
 
 	if (part == 7)
 		part = 0;
cmd/mvebu/bubt.c +1 -2
index 49797b23144b..37ff9c455228 100644
@@ -223,8 +223,7 @@ static int mmc_burn_image(size_t image_size)
 	orig_part = mmc->block_dev.hwpart;
 #endif
 
-	part = (mmc->part_config >> 3) & PART_ACCESS_MASK;
-
+	part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
 	if (part == 7)
 		part = 0;
 
common/spl/spl_mmc.c +1 -1
index bd5e6adf1ea6..a0722167044f 100644
@@ -378,7 +378,7 @@ int default_spl_mmc_emmc_boot_partition(struct mmc *mmc)
 	 * 1 and 2 match up to boot0 / boot1 and 7 is user data
 	 * which is the first physical partition (0).
 	 */
-	part = (mmc->part_config >> 3) & PART_ACCESS_MASK;
+	part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
 	if (part == 7)
 		part = 0;
 #endif
Signature · 1 line
2.20.1
#1 lore raw

PING?

Quoted 54 lines · On Saturday 11 March 2023 11:44:27 Pali Rohár wrote:

Mask macro PART_ACCESS_MASK filter out access bits of emmc register and macro EXT_CSD_EXTRACT_BOOT_PART() extracts boot part bits of emmc register. So use EXT_CSD_EXTRACT_BOOT_PART() when extracting boot partition.

---
 board/purism/librem5/librem5.c | 2 +-
 cmd/mvebu/bubt.c               | 3 +--
 common/spl/spl_mmc.c           | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)
board/purism/librem5/librem5.c +1 -1
index caa02655fc49..386ed1b4fb22 100644
@@ -41,7 +41,7 @@ int board_early_init_f(void)
 #if IS_ENABLED(CONFIG_LOAD_ENV_FROM_MMC_BOOT_PARTITION)
 uint board_mmc_get_env_part(struct mmc *mmc)
 {
-	uint part = (mmc->part_config >> 3) & PART_ACCESS_MASK;
+	uint part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
 
 	if (part == 7)
 		part = 0;
cmd/mvebu/bubt.c +1 -2
index 49797b23144b..37ff9c455228 100644
@@ -223,8 +223,7 @@ static int mmc_burn_image(size_t image_size)
 	orig_part = mmc->block_dev.hwpart;
 #endif
 
-	part = (mmc->part_config >> 3) & PART_ACCESS_MASK;
-
+	part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
 	if (part == 7)
 		part = 0;
 
common/spl/spl_mmc.c +1 -1
index bd5e6adf1ea6..a0722167044f 100644
@@ -378,7 +378,7 @@ int default_spl_mmc_emmc_boot_partition(struct mmc *mmc)
 	 * 1 and 2 match up to boot0 / boot1 and 7 is user data
 	 * which is the first physical partition (0).
 	 */
-	part = (mmc->part_config >> 3) & PART_ACCESS_MASK;
+	part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
 	if (part == 7)
 		part = 0;
 #endif
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#2 lore raw
In reply to Pali Rohár
Quoted 5 lines · Pali Rohár

Mask macro PART_ACCESS_MASK filter out access bits of emmc register and macro EXT_CSD_EXTRACT_BOOT_PART() extracts boot part bits of emmc register. So use EXT_CSD_EXTRACT_BOOT_PART() when extracting boot partition.

Quoted 7 lines
---
 board/purism/librem5/librem5.c | 2 +-
 cmd/mvebu/bubt.c               | 3 +--
 common/spl/spl_mmc.c           | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)