Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Bernie Thompson and committed by
Chris Ball
51e7e8b6 e3e020f8

+5
+1
Documentation/mmc/mmc-dev-attrs.txt
··· 22 22 manfid Manufacturer ID (from CID Register) 23 23 name Product Name (from CID Register) 24 24 oemid OEM/Application ID (from CID Register) 25 + prv Product Revision (from CID Register) (SD and MMCv4 only) 25 26 serial Product Serial Number (from CID Register) 26 27 erase_size Erase group size 27 28 preferred_erase_size Preferred erase size
+3
drivers/mmc/core/mmc.c
··· 96 96 card->cid.prod_name[3] = UNSTUFF_BITS(resp, 72, 8); 97 97 card->cid.prod_name[4] = UNSTUFF_BITS(resp, 64, 8); 98 98 card->cid.prod_name[5] = UNSTUFF_BITS(resp, 56, 8); 99 + card->cid.prv = UNSTUFF_BITS(resp, 48, 8); 99 100 card->cid.serial = UNSTUFF_BITS(resp, 16, 32); 100 101 card->cid.month = UNSTUFF_BITS(resp, 12, 4); 101 102 card->cid.year = UNSTUFF_BITS(resp, 8, 4) + 1997; ··· 628 627 MMC_DEV_ATTR(manfid, "0x%06x\n", card->cid.manfid); 629 628 MMC_DEV_ATTR(name, "%s\n", card->cid.prod_name); 630 629 MMC_DEV_ATTR(oemid, "0x%04x\n", card->cid.oemid); 630 + MMC_DEV_ATTR(prv, "0x%x\n", card->cid.prv); 631 631 MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial); 632 632 MMC_DEV_ATTR(enhanced_area_offset, "%llu\n", 633 633 card->ext_csd.enhanced_area_offset); ··· 647 645 &dev_attr_manfid.attr, 648 646 &dev_attr_name.attr, 649 647 &dev_attr_oemid.attr, 648 + &dev_attr_prv.attr, 650 649 &dev_attr_serial.attr, 651 650 &dev_attr_enhanced_area_offset.attr, 652 651 &dev_attr_enhanced_area_size.attr,
+1
include/linux/mmc/card.h
··· 17 17 struct mmc_cid { 18 18 unsigned int manfid; 19 19 char prod_name[8]; 20 + unsigned char prv; 20 21 unsigned int serial; 21 22 unsigned short oemid; 22 23 unsigned short year;