Skip to contentSkip to conversation

mmc: core: Extend sysfs with OCR register

PATCH Applied Bojan Prtvar 3 participants 7 messages Jul 4, 2016 – Jul 12, 2016

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

PATCH 1/1 mmc: core: Extend sysfs with OCR register

Make operation conditions register (OCR) easily accessible from user space.

---
 Documentation/mmc/mmc-dev-attrs.txt | 1 +
 drivers/mmc/core/mmc.c              | 2 ++
 2 files changed, 3 insertions(+)
Documentation/mmc/mmc-dev-attrs.txt +1 -0
index caa5557..8163eca 100644
@@ -28,6 +28,7 @@ All attributes are read-only.
 	preferred_erase_size	Preferred erase size
 	raw_rpmb_size_mult	RPMB partition size
 	rel_sectors		Reliable write sector count
+	ocr 			Operation Conditions Register
 
 Note on Erase Size and Preferred Erase Size:
 
drivers/mmc/core/mmc.c +2 -0
index 5d438ad..1848334 100644
@@ -727,6 +727,7 @@ MMC_DEV_ATTR(enhanced_area_offset, "%llu\n",
 MMC_DEV_ATTR(enhanced_area_size, "%u\n", card->ext_csd.enhanced_area_size);
 MMC_DEV_ATTR(raw_rpmb_size_mult, "%#x\n", card->ext_csd.raw_rpmb_size_mult);
 MMC_DEV_ATTR(rel_sectors, "%#x\n", card->ext_csd.rel_sectors);
+MMC_DEV_ATTR(ocr, "%08x\n", card->ocr);
 
 static ssize_t mmc_fwrev_show(struct device *dev,
 			      struct device_attribute *attr,
@@ -762,6 +763,7 @@ static struct attribute *mmc_std_attrs[] = {
 	&dev_attr_enhanced_area_size.attr,
 	&dev_attr_raw_rpmb_size_mult.attr,
 	&dev_attr_rel_sectors.attr,
+	&dev_attr_ocr.attr,
 	NULL,
 };
 ATTRIBUTE_GROUPS(mmc_std);
Signature · 1 line
2.8.0.GIT
#1 lore raw

Bojan,

Quoted 3 lines · Bojan Prtvar

Make operation conditions register (OCR) easily accessible from user space.

You described "what" above. Can you add the "why", too?

Regards,

Wolfram

#2 lore raw

Hi,

Quoted 4 lines · Wolfram Sang
Quoted 2 lines

Make operation conditions register (OCR) easily accessible from user space.

You described "what" above. Can you add the "why", too?

According to JEDEC v5.0 chapter 7 the OCR, CID and CSD registers carry the Device/content specific information.
Registers CID and CSD are already exported through sysfs so let's make this interface complete by adding missing OCR register.

Do I need to send v2 with updated change log?

Regards,
Bojan

#3 lore raw
Quoted 3 lines

Registers CID and CSD are already exported through sysfs so let's make this interface complete by adding missing OCR register.

This sentence was missing for me, thanks.

Quoted 1 line

Do I need to send v2 with updated change log?

Ulf will tell us.

Applied
#4 lore raw
In reply to Bojan Prtvar
Quoted 3 lines · Bojan Prtvar

Make operation conditions register (OCR) easily accessible from user space.

Thanks, applied for next! Amended the changelog with the explanation why this change is wanted.

Kind regards
Uffe

Quoted 40 lines
---
 Documentation/mmc/mmc-dev-attrs.txt | 1 +
 drivers/mmc/core/mmc.c              | 2 ++
 2 files changed, 3 insertions(+)
Documentation/mmc/mmc-dev-attrs.txt +1 -0
index caa5557..8163eca 100644
@@ -28,6 +28,7 @@ All attributes are read-only.
        preferred_erase_size    Preferred erase size
        raw_rpmb_size_mult      RPMB partition size
        rel_sectors             Reliable write sector count
+       ocr                     Operation Conditions Register
 
 Note on Erase Size and Preferred Erase Size:
 
drivers/mmc/core/mmc.c +2 -1
index 5d438ad..1848334 100644
@@ -727,6 +727,7 @@ MMC_DEV_ATTR(enhanced_area_offset, "%llu\n",
 MMC_DEV_ATTR(enhanced_area_size, "%u\n", card->ext_csd.enhanced_area_size);
 MMC_DEV_ATTR(raw_rpmb_size_mult, "%#x\n", card->ext_csd.raw_rpmb_size_mult);
 MMC_DEV_ATTR(rel_sectors, "%#x\n", card->ext_csd.rel_sectors);
+MMC_DEV_ATTR(ocr, "%08x\n", card->ocr);
 
 static ssize_t mmc_fwrev_show(struct device *dev,
                              struct device_attribute *attr,
@@ -762,6 +763,7 @@ static struct attribute *mmc_std_attrs[] = {
        &dev_attr_enhanced_area_size.attr,
        &dev_attr_raw_rpmb_size_mult.attr,
        &dev_attr_rel_sectors.attr,
+       &dev_attr_ocr.attr,
        NULL,
 };
 ATTRIBUTE_GROUPS(mmc_std);
--

2.8.0.GIT

#5 lore raw
Quoted 7 lines · Ulf Hansson
Quoted 3 lines · Bojan Prtvar

Make operation conditions register (OCR) easily accessible from user space.

Thanks, applied for next! Amended the changelog with the explanation why this change is wanted.

I just realized that the OCR register is also available for SD cards.

Could you perhaps cook a patch which adds this to sysfs for SD cards as well!?

Kind regards
Uffe

Quoted 44 lines

Kind regards
Uffe

Quoted 40 lines
---
 Documentation/mmc/mmc-dev-attrs.txt | 1 +
 drivers/mmc/core/mmc.c              | 2 ++
 2 files changed, 3 insertions(+)
Documentation/mmc/mmc-dev-attrs.txt +1 -0
index caa5557..8163eca 100644
@@ -28,6 +28,7 @@ All attributes are read-only.
        preferred_erase_size    Preferred erase size
        raw_rpmb_size_mult      RPMB partition size
        rel_sectors             Reliable write sector count
+       ocr                     Operation Conditions Register
 
 Note on Erase Size and Preferred Erase Size:
 
drivers/mmc/core/mmc.c +2 -1
index 5d438ad..1848334 100644
@@ -727,6 +727,7 @@ MMC_DEV_ATTR(enhanced_area_offset, "%llu\n",
 MMC_DEV_ATTR(enhanced_area_size, "%u\n", card->ext_csd.enhanced_area_size);
 MMC_DEV_ATTR(raw_rpmb_size_mult, "%#x\n", card->ext_csd.raw_rpmb_size_mult);
 MMC_DEV_ATTR(rel_sectors, "%#x\n", card->ext_csd.rel_sectors);
+MMC_DEV_ATTR(ocr, "%08x\n", card->ocr);
 
 static ssize_t mmc_fwrev_show(struct device *dev,
                              struct device_attribute *attr,
@@ -762,6 +763,7 @@ static struct attribute *mmc_std_attrs[] = {
        &dev_attr_enhanced_area_size.attr,
        &dev_attr_raw_rpmb_size_mult.attr,
        &dev_attr_rel_sectors.attr,
+       &dev_attr_ocr.attr,
        NULL,
 };
 ATTRIBUTE_GROUPS(mmc_std);
--

2.8.0.GIT

#6 lore raw

Hi Ulf,

Quoted 4 lines · Ulf Hansson

I just realized that the OCR register is also available for SD cards.

Could you perhaps cook a patch which adds this to sysfs for SD cards as well!?

Sure. I'll do it tomorrow.

Regards,
Bojan