Skip to content

Commit 51e7e8b

Browse files
Bernie Thompsoncjb
authored andcommitted
mmc: core: 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. Signed-off-by: Bernie Thompson <bhthompson@chromium.org> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
1 parent e3e020f commit 51e7e8b

3 files changed

Lines changed: 5 additions & 0 deletions

File tree

‎Documentation/mmc/mmc-dev-attrs.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ All attributes are read-only.
2222
manfid Manufacturer ID (from CID Register)
2323
name Product Name (from CID Register)
2424
oemid OEM/Application ID (from CID Register)
25+
prv Product Revision (from CID Register) (SD and MMCv4 only)
2526
serial Product Serial Number (from CID Register)
2627
erase_size Erase group size
2728
preferred_erase_size Preferred erase size

‎drivers/mmc/core/mmc.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ static int mmc_decode_cid(struct mmc_card *card)
9696
card->cid.prod_name[3] = UNSTUFF_BITS(resp, 72, 8);
9797
card->cid.prod_name[4] = UNSTUFF_BITS(resp, 64, 8);
9898
card->cid.prod_name[5] = UNSTUFF_BITS(resp, 56, 8);
99+
card->cid.prv = UNSTUFF_BITS(resp, 48, 8);
99100
card->cid.serial = UNSTUFF_BITS(resp, 16, 32);
100101
card->cid.month = UNSTUFF_BITS(resp, 12, 4);
101102
card->cid.year = UNSTUFF_BITS(resp, 8, 4) + 1997;
@@ -627,6 +628,7 @@ MMC_DEV_ATTR(hwrev, "0x%x\n", card->cid.hwrev);
627628
MMC_DEV_ATTR(manfid, "0x%06x\n", card->cid.manfid);
628629
MMC_DEV_ATTR(name, "%s\n", card->cid.prod_name);
629630
MMC_DEV_ATTR(oemid, "0x%04x\n", card->cid.oemid);
631+
MMC_DEV_ATTR(prv, "0x%x\n", card->cid.prv);
630632
MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial);
631633
MMC_DEV_ATTR(enhanced_area_offset, "%llu\n",
632634
card->ext_csd.enhanced_area_offset);
@@ -645,6 +647,7 @@ static struct attribute *mmc_std_attrs[] = {
645647
&dev_attr_manfid.attr,
646648
&dev_attr_name.attr,
647649
&dev_attr_oemid.attr,
650+
&dev_attr_prv.attr,
648651
&dev_attr_serial.attr,
649652
&dev_attr_enhanced_area_offset.attr,
650653
&dev_attr_enhanced_area_size.attr,

‎include/linux/mmc/card.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
struct mmc_cid {
1818
unsigned int manfid;
1919
char prod_name[8];
20+
unsigned char prv;
2021
unsigned int serial;
2122
unsigned short oemid;
2223
unsigned short year;

0 commit comments

Comments
 (0)