summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-imx/image-container.c10
-rw-r--r--arch/arm/mach-sunxi/board.c2
-rw-r--r--board/gateworks/venice/spl.c4
-rw-r--r--board/gateworks/venice/venice.c22
-rw-r--r--board/purism/librem5/librem5.c4
-rw-r--r--board/storopack/smegw01/smegw01.c4
-rw-r--r--cmd/mvebu/bubt.c4
-rw-r--r--common/spl/spl_mmc.c4
-rw-r--r--include/mmc.h20
9 files changed, 47 insertions, 27 deletions
diff --git a/arch/arm/mach-imx/image-container.c b/arch/arm/mach-imx/image-container.c
index 35da0ae0425..bcd40889f0f 100644
--- a/arch/arm/mach-imx/image-container.c
+++ b/arch/arm/mach-imx/image-container.c
@@ -205,7 +205,7 @@ static unsigned long get_boot_device_offset(void *dev, int dev_type)
} else {
u8 part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
- if (part == 1 || part == 2) {
+ if (part == EMMC_BOOT_PART_BOOT1 || part == EMMC_BOOT_PART_BOOT2) {
if (is_imx8qxp() && is_soc_rev(CHIP_REV_B))
offset = CONTAINER_HDR_MMCSD_OFFSET;
else
@@ -294,15 +294,15 @@ int spl_mmc_emmc_boot_partition(struct mmc *mmc)
int part;
part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
- if (part == 1 || part == 2) {
+ if (part == EMMC_BOOT_PART_BOOT1 || part == EMMC_BOOT_PART_BOOT2) {
unsigned long sec_set_off = 0;
bool sec_boot = false;
sec_boot = check_secondary_cnt_set(&sec_set_off);
if (sec_boot)
- part = (part == 1) ? 2 : 1;
- } else if (part == 7) {
- part = 0;
+ part = (part == EMMC_BOOT_PART_BOOT1) ? EMMC_HWPART_BOOT2 : EMMC_HWPART_BOOT1;
+ } else if (part == EMMC_BOOT_PART_USER) {
+ part = EMMC_HWPART_DEFAULT;
}
return part;
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index 0140b07d32a..860e7058b69 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -396,7 +396,7 @@ static bool sunxi_valid_emmc_boot(struct mmc *mmc)
return false;
/* Partition 0 is the user data partition, bootpart must be 1 or 2. */
- if (bootpart != 1 && bootpart != 2)
+ if (bootpart != EMMC_BOOT_PART_BOOT1 && bootpart != EMMC_BOOT_PART_BOOT2)
return false;
/* Failure to switch to the boot partition is fatal. */
diff --git a/board/gateworks/venice/spl.c b/board/gateworks/venice/spl.c
index b0a315ba953..05911ce9dd9 100644
--- a/board/gateworks/venice/spl.c
+++ b/board/gateworks/venice/spl.c
@@ -350,8 +350,8 @@ unsigned long board_spl_mmc_get_uboot_raw_sector(struct mmc *mmc, unsigned long
{
if (!IS_SD(mmc)) {
switch (EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config)) {
- case 1:
- case 2:
+ case EMMC_BOOT_PART_BOOT1:
+ case EMMC_BOOT_PART_BOOT2:
if (IS_ENABLED(CONFIG_IMX8MN) || IS_ENABLED(CONFIG_IMX8MP))
raw_sect -= 32 * 2;
break;
diff --git a/board/gateworks/venice/venice.c b/board/gateworks/venice/venice.c
index 5b105d7659e..44ed4e4598e 100644
--- a/board/gateworks/venice/venice.c
+++ b/board/gateworks/venice/venice.c
@@ -173,20 +173,20 @@ int board_late_init(void)
int bootpart;
switch (EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config)) {
- case 1: /* boot0 */
- bootpart = 1;
+ case EMMC_BOOT_PART_BOOT1:
+ bootpart = EMMC_HWPART_BOOT1;
break;
- case 2: /* boot1 */
- bootpart = 2;
+ case EMMC_BOOT_PART_BOOT2:
+ bootpart = EMMC_HWPART_BOOT2;
break;
- case 7: /* user */
+ case EMMC_BOOT_PART_USER:
default:
- bootpart = 0;
+ bootpart = EMMC_HWPART_DEFAULT;
break;
}
/* IMX8MP/IMX8MN BOOTROM v2 uses offset=0 for boot parts */
if ((IS_ENABLED(CONFIG_IMX8MN) || IS_ENABLED(CONFIG_IMX8MP)) &&
- (bootpart == 1 || bootpart == 2))
+ (bootpart == EMMC_BOOT_PART_BOOT1 || bootpart == EMMC_BOOT_PART_BOOT2))
bootblk = 0;
env_set_hex("bootpart", bootpart);
env_set_hex("bootblk", bootblk);
@@ -217,10 +217,10 @@ uint mmc_get_env_part(struct mmc *mmc)
{
if (!IS_SD(mmc)) {
switch (EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config)) {
- case 1:
- return 1;
- case 2:
- return 2;
+ case EMMC_BOOT_PART_BOOT1:
+ return EMMC_HWPART_BOOT1;
+ case EMMC_BOOT_PART_BOOT2:
+ return EMMC_HWPART_BOOT2;
}
}
diff --git a/board/purism/librem5/librem5.c b/board/purism/librem5/librem5.c
index d0249e71f09..3f1a8e385d7 100644
--- a/board/purism/librem5/librem5.c
+++ b/board/purism/librem5/librem5.c
@@ -43,8 +43,8 @@ uint board_mmc_get_env_part(struct mmc *mmc)
{
uint part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
- if (part == 7)
- part = 0;
+ if (part == EMMC_BOOT_PART_USER)
+ part = EMMC_HWPART_DEFAULT;
return part;
}
#endif
diff --git a/board/storopack/smegw01/smegw01.c b/board/storopack/smegw01/smegw01.c
index 345191b31c2..d1f474bc7a1 100644
--- a/board/storopack/smegw01/smegw01.c
+++ b/board/storopack/smegw01/smegw01.c
@@ -106,8 +106,8 @@ uint mmc_get_env_part(struct mmc *mmc)
{
uint part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
- if (part == 7)
- part = 0;
+ if (part == EMMC_BOOT_PART_USER)
+ part = EMMC_HWPART_DEFAULT;
return part;
}
diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
index 744b1c20aa8..1e3f5bf7add 100644
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
@@ -224,8 +224,8 @@ static int mmc_burn_image(size_t image_size)
#endif
part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
- if (part == 7)
- part = 0;
+ if (part == EMMC_BOOT_PART_USER)
+ part = EMMC_HWPART_DEFAULT;
#ifdef CONFIG_BLK
err = blk_dselect_hwpart(blk_desc, part);
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 3d032bb27ce..fd5154dad7c 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -320,8 +320,8 @@ int default_spl_mmc_emmc_boot_partition(struct mmc *mmc)
* which is the first physical partition (0).
*/
part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
- if (part == 7)
- part = 0;
+ if (part == EMMC_BOOT_PART_USER)
+ part = EMMC_HWPART_DEFAULT;
#endif
return part;
}
diff --git a/include/mmc.h b/include/mmc.h
index 4b8327f1f93..0f3f1ed6aaa 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -381,6 +381,26 @@ enum mmc_voltage {
#define MMC_TIMING_MMC_HS200 9
#define MMC_TIMING_MMC_HS400 10
+/* emmc PARTITION_CONFIG BOOT_PARTITION_ENABLE values */
+enum emmc_boot_part {
+ EMMC_BOOT_PART_DEFAULT = 0,
+ EMMC_BOOT_PART_BOOT1 = 1,
+ EMMC_BOOT_PART_BOOT2 = 2,
+ EMMC_BOOT_PART_USER = 7,
+};
+
+/* emmc PARTITION_CONFIG ACCESS_ENABLE values */
+enum emmc_hwpart {
+ EMMC_HWPART_DEFAULT = 0, /* user */
+ EMMC_HWPART_BOOT1 = 1,
+ EMMC_HWPART_BOOT2 = 2,
+ EMMC_HWPART_RPMB = 3,
+ EMMC_HWPART_GP1 = 4,
+ EMMC_HWPART_GP2 = 5,
+ EMMC_HWPART_GP3 = 6,
+ EMMC_HWPART_GP4 = 7,
+};
+
/* Driver model support */
/**