Skip to contentSkip to conversation

mmc: Add in support to expose PRV for v4 MMCs

PATCH In review Bernie Thompson 3 participants 3 messages Feb 27, 2013 – Mar 22, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: Add in support to expose PRV for v4 MMCs

The JEDEC MMC v4 spec defines a new PRV value in place of the original fwrev and hwrev specified in v1. We can expose this in the kernel to enable user space to more easily determine the product revision of a given MMC.

---
 Documentation/mmc/mmc-dev-attrs.txt | 1 +
 drivers/mmc/core/mmc.c              | 3 +++
 include/linux/mmc/card.h            | 1 +
 3 files changed, 5 insertions(+)
Documentation/mmc/mmc-dev-attrs.txt +1 -0
index 0d98fac..189bab0 100644
@@ -22,6 +22,7 @@ All attributes are read-only.
 	manfid			Manufacturer ID (from CID Register)
 	name			Product Name (from CID Register)
 	oemid			OEM/Application ID (from CID Register)
+	prv			Product Revision (from CID Register) (SD and MMCv4 only)
 	serial			Product Serial Number (from CID Register)
 	erase_size		Erase group size
 	preferred_erase_size	Preferred erase size
drivers/mmc/core/mmc.c +3 -0
index c8f3d6e..d584f7c 100644
@@ -96,6 +96,7 @@ static int mmc_decode_cid(struct mmc_card *card)
 		card->cid.prod_name[3]	= UNSTUFF_BITS(resp, 72, 8);
 		card->cid.prod_name[4]	= UNSTUFF_BITS(resp, 64, 8);
 		card->cid.prod_name[5]	= UNSTUFF_BITS(resp, 56, 8);
+		card->cid.prv		= UNSTUFF_BITS(resp, 48, 8);
 		card->cid.serial	= UNSTUFF_BITS(resp, 16, 32);
 		card->cid.month		= UNSTUFF_BITS(resp, 12, 4);
 		card->cid.year		= UNSTUFF_BITS(resp, 8, 4) + 1997;
@@ -627,6 +628,7 @@ MMC_DEV_ATTR(hwrev, "0x%x\n", card->cid.hwrev);
 MMC_DEV_ATTR(manfid, "0x%06x\n", card->cid.manfid);
 MMC_DEV_ATTR(name, "%s\n", card->cid.prod_name);
 MMC_DEV_ATTR(oemid, "0x%04x\n", card->cid.oemid);
+MMC_DEV_ATTR(prv, "0x%x\n", card->cid.prv);
 MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial);
 MMC_DEV_ATTR(enhanced_area_offset, "%llu\n",
 		card->ext_csd.enhanced_area_offset);
@@ -645,6 +647,7 @@ static struct attribute *mmc_std_attrs[] = {
 	&dev_attr_manfid.attr,
 	&dev_attr_name.attr,
 	&dev_attr_oemid.attr,
+	&dev_attr_prv.attr,
 	&dev_attr_serial.attr,
 	&dev_attr_enhanced_area_offset.attr,
 	&dev_attr_enhanced_area_size.attr,
include/linux/mmc/card.h +1 -0
index 61b2c30..f31725b 100644
@@ -17,6 +17,7 @@
 struct mmc_cid {
 	unsigned int		manfid;
 	char			prod_name[8];
+	unsigned char		prv;
 	unsigned int		serial;
 	unsigned short		oemid;
 	unsigned short		year;
Signature · 1 line
1.8.1.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 66 lines · Bernie Thompson

The JEDEC MMC v4 spec defines a new PRV value in place of the original fwrev and hwrev specified in v1. We can expose this in the kernel to enable user space to more easily determine the product revision of a given MMC.

---
 Documentation/mmc/mmc-dev-attrs.txt | 1 +
 drivers/mmc/core/mmc.c              | 3 +++
 include/linux/mmc/card.h            | 1 +
 3 files changed, 5 insertions(+)
Documentation/mmc/mmc-dev-attrs.txt +1 -0
index 0d98fac..189bab0 100644
@@ -22,6 +22,7 @@ All attributes are read-only.
        manfid                  Manufacturer ID (from CID Register)
        name                    Product Name (from CID Register)
        oemid                   OEM/Application ID (from CID Register)
+       prv                     Product Revision (from CID Register) (SD and MMCv4 only)
        serial                  Product Serial Number (from CID Register)
        erase_size              Erase group size
        preferred_erase_size    Preferred erase size
drivers/mmc/core/mmc.c +3 -0
index c8f3d6e..d584f7c 100644
@@ -96,6 +96,7 @@ static int mmc_decode_cid(struct mmc_card *card)
                card->cid.prod_name[3]  = UNSTUFF_BITS(resp, 72, 8);
                card->cid.prod_name[4]  = UNSTUFF_BITS(resp, 64, 8);
                card->cid.prod_name[5]  = UNSTUFF_BITS(resp, 56, 8);
+               card->cid.prv           = UNSTUFF_BITS(resp, 48, 8);
                card->cid.serial        = UNSTUFF_BITS(resp, 16, 32);
                card->cid.month         = UNSTUFF_BITS(resp, 12, 4);
                card->cid.year          = UNSTUFF_BITS(resp, 8, 4) + 1997;
@@ -627,6 +628,7 @@ MMC_DEV_ATTR(hwrev, "0x%x\n", card->cid.hwrev);
 MMC_DEV_ATTR(manfid, "0x%06x\n", card->cid.manfid);
 MMC_DEV_ATTR(name, "%s\n", card->cid.prod_name);
 MMC_DEV_ATTR(oemid, "0x%04x\n", card->cid.oemid);
+MMC_DEV_ATTR(prv, "0x%x\n", card->cid.prv);
 MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial);
 MMC_DEV_ATTR(enhanced_area_offset, "%llu\n",
                card->ext_csd.enhanced_area_offset);
@@ -645,6 +647,7 @@ static struct attribute *mmc_std_attrs[] = {
        &dev_attr_manfid.attr,
        &dev_attr_name.attr,
        &dev_attr_oemid.attr,
+       &dev_attr_prv.attr,
        &dev_attr_serial.attr,
        &dev_attr_enhanced_area_offset.attr,
        &dev_attr_enhanced_area_size.attr,
include/linux/mmc/card.h +1 -1
index 61b2c30..f31725b 100644
@@ -17,6 +17,7 @@
 struct mmc_cid {
        unsigned int            manfid;
        char                    prod_name[8];
+       unsigned char           prv;
        unsigned int            serial;
        unsigned short          oemid;
        unsigned short          year;
--

1.8.1.3

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to Bernie Thompson

Hi,

Quoted 5 lines · Bernie Thompson

The JEDEC MMC v4 spec defines a new PRV value in place of the original fwrev and hwrev specified in v1. We can expose this in the kernel to enable user space to more easily determine the product revision of a given MMC.

Thanks, pushed to mmc-next for 3.10.

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child