[U-Boot] [PATCH v3 02/18] mmc: extend mmcinfo to show enhanced partition attribute

Diego Santa Cruz Diego.SantaCruz at spinetix.com
Mon Dec 15 10:27:05 CET 2014


This extends the mmcinfo command's output to show which eMMC partitions
have the enhanced attribute set. Note that the eMMC spec says that
if the enhanced attribute is supported then the boot and RPMB
partitions are of the enhanced type.

The output of mmcinfo becomes:
Device: OMAP SD/MMC
Manufacturer ID: fe
OEM: 14e
Name: MMC16
Tran Speed: 52000000
Rd Block Len: 512
MMC version 4.41
High Capacity: Yes
Capacity: 13.8 GiB
Bus Width: 4-bit
User Capacity: 13.8 GiB ENH
Boot Capacity: 16 MiB ENH
RPMB Capacity: 128 KiB ENH
GP1 Capacity: 64 MiB ENH
GP2 Capacity: 64 MiB ENH

Signed-off-by: Diego Santa Cruz <Diego.SantaCruz at spinetix.com>
---
 common/cmd_mmc.c  |   14 ++++++++++----
 drivers/mmc/mmc.c |    3 +++
 include/mmc.h     |    6 ++++++
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index 1a23b28..56c8680 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -95,16 +95,22 @@ static void print_mmcinfo(struct mmc *mmc)
 	printf("Bus Width: %d-bit\n", mmc->bus_width);
 
 	if (!IS_SD(mmc) && (mmc->version >= MMC_VERSION_4)) {
+		bool has_enh = (mmc->part_support & ENHNCD_SUPPORT) != 0;
 		puts("User Capacity: ");
-		print_size(mmc->capacity_user, "\n");
+		print_size(mmc->capacity_user,
+			   has_enh && (mmc->part_attr & EXT_CSD_ENH_USR) ?
+			   " ENH\n" : "\n");
 		puts("Boot Capacity: ");
-		print_size(mmc->capacity_boot, "\n");
+		print_size(mmc->capacity_boot, has_enh ? " ENH\n" : "\n");
 		puts("RPMB Capacity: ");
-		print_size(mmc->capacity_rpmb, "\n");
+		print_size(mmc->capacity_rpmb, has_enh ? " ENH\n" : "\n");
 		for (i = 0; i < ARRAY_SIZE(mmc->capacity_gp); i++) {
+			bool is_enh = has_enh &&
+				(mmc->part_attr & EXT_CSD_ENH_GP(i));
 			if (mmc->capacity_gp[i]) {
 				printf("GP%i Capacity: ", i);
-				print_size(mmc->capacity_gp[i], "\n");
+				print_size(mmc->capacity_gp[i],
+					   is_enh ? " ENH\n" : "\n");
 			}
 		}
 	}
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 8436bc7..f1ec799 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1032,9 +1032,12 @@ static int mmc_startup(struct mmc *mmc)
 		}
 
 		/* store the partition info of emmc */
+		mmc->part_support = ext_csd[EXT_CSD_PARTITIONING_SUPPORT];
 		if ((ext_csd[EXT_CSD_PARTITIONING_SUPPORT] & PART_SUPPORT) ||
 		    ext_csd[EXT_CSD_BOOT_MULT])
 			mmc->part_config = ext_csd[EXT_CSD_PART_CONF];
+		if (ext_csd[EXT_CSD_PARTITIONING_SUPPORT] & ENHNCD_SUPPORT)
+			mmc->part_attr = ext_csd[EXT_CSD_PARTITIONS_ATTRIBUTE];
 
 		mmc->capacity_boot = ext_csd[EXT_CSD_BOOT_MULT] << 17;
 
diff --git a/include/mmc.h b/include/mmc.h
index adffc35..7b4aebf 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -197,6 +197,9 @@
 #define EXT_CSD_BOOT_BUS_WIDTH_RESET(x)	(x << 2)
 #define EXT_CSD_BOOT_BUS_WIDTH_WIDTH(x)	(x)
 
+#define EXT_CSD_ENH_USR		(1 << 0)	/* user data area is enhanced */
+#define EXT_CSD_ENH_GP(x)	(1 << ((x)+1))	/* GP part (x+1) is enhanced */
+
 #define R1_ILLEGAL_COMMAND		(1 << 22)
 #define R1_APP_CMD			(1 << 5)
 
@@ -220,6 +223,7 @@
 #define MMCPART_NOAVAILABLE	(0xff)
 #define PART_ACCESS_MASK	(0x7)
 #define PART_SUPPORT		(0x1)
+#define ENHNCD_SUPPORT		(0x2)
 #define PART_ENH_ATTRIB		(0x1f)
 
 /* Maximum block size for MMC */
@@ -298,6 +302,8 @@ struct mmc {
 	uint csd[4];
 	uint cid[4];
 	ushort rca;
+	u8 part_support;
+	u8 part_attr;
 	char part_config;
 	char part_num;
 	uint tran_speed;
-- 
1.7.1



More information about the U-Boot mailing list