summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBojan Prtvar <prtvar.b@gmail.com>2016-07-19 05:16:38 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2016-07-25 04:34:51 -0400
commit6825a606584cec455b003afec7c10a07e563c994 (patch)
tree7357da2ff81f38eac46daefc8f877b58fbc20137
parent2c4c7146c7f6cffcbd71f1df95e6bc6727324e05 (diff)
mmc: core: Extend sysfs with DSR register
Export DSR register through sysfs same as we did for the CID, CSD and OCR registers. Signed-off-by: Bojan Prtvar <prtvar.b@gmail.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r--Documentation/mmc/mmc-dev-attrs.txt1
-rw-r--r--drivers/mmc/core/mmc.c17
-rw-r--r--drivers/mmc/core/sd.c17
3 files changed, 35 insertions, 0 deletions
diff --git a/Documentation/mmc/mmc-dev-attrs.txt b/Documentation/mmc/mmc-dev-attrs.txt
index 8163eca8522b..404a0e9e92b0 100644
--- a/Documentation/mmc/mmc-dev-attrs.txt
+++ b/Documentation/mmc/mmc-dev-attrs.txt
@@ -29,6 +29,7 @@ All attributes are read-only.
29 raw_rpmb_size_mult RPMB partition size 29 raw_rpmb_size_mult RPMB partition size
30 rel_sectors Reliable write sector count 30 rel_sectors Reliable write sector count
31 ocr Operation Conditions Register 31 ocr Operation Conditions Register
32 dsr Driver Stage Register
32 33
33Note on Erase Size and Preferred Erase Size: 34Note on Erase Size and Preferred Erase Size:
34 35
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 403b97b00bd5..f2d185cf8a8b 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -767,6 +767,22 @@ static ssize_t mmc_fwrev_show(struct device *dev,
767 767
768static DEVICE_ATTR(fwrev, S_IRUGO, mmc_fwrev_show, NULL); 768static DEVICE_ATTR(fwrev, S_IRUGO, mmc_fwrev_show, NULL);
769 769
770static ssize_t mmc_dsr_show(struct device *dev,
771 struct device_attribute *attr,
772 char *buf)
773{
774 struct mmc_card *card = mmc_dev_to_card(dev);
775 struct mmc_host *host = card->host;
776
777 if (card->csd.dsr_imp && host->dsr_req)
778 return sprintf(buf, "0x%x\n", host->dsr);
779 else
780 /* return default DSR value */
781 return sprintf(buf, "0x%x\n", 0x404);
782}
783
784static DEVICE_ATTR(dsr, S_IRUGO, mmc_dsr_show, NULL);
785
770static struct attribute *mmc_std_attrs[] = { 786static struct attribute *mmc_std_attrs[] = {
771 &dev_attr_cid.attr, 787 &dev_attr_cid.attr,
772 &dev_attr_csd.attr, 788 &dev_attr_csd.attr,
@@ -786,6 +802,7 @@ static struct attribute *mmc_std_attrs[] = {
786 &dev_attr_raw_rpmb_size_mult.attr, 802 &dev_attr_raw_rpmb_size_mult.attr,
787 &dev_attr_rel_sectors.attr, 803 &dev_attr_rel_sectors.attr,
788 &dev_attr_ocr.attr, 804 &dev_attr_ocr.attr,
805 &dev_attr_dsr.attr,
789 NULL, 806 NULL,
790}; 807};
791ATTRIBUTE_GROUPS(mmc_std); 808ATTRIBUTE_GROUPS(mmc_std);
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 3dd0861f4557..0123936241b0 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -678,6 +678,22 @@ MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial);
678MMC_DEV_ATTR(ocr, "%08x\n", card->ocr); 678MMC_DEV_ATTR(ocr, "%08x\n", card->ocr);
679 679
680 680
681static ssize_t mmc_dsr_show(struct device *dev,
682 struct device_attribute *attr,
683 char *buf)
684{
685 struct mmc_card *card = mmc_dev_to_card(dev);
686 struct mmc_host *host = card->host;
687
688 if (card->csd.dsr_imp && host->dsr_req)
689 return sprintf(buf, "0x%x\n", host->dsr);
690 else
691 /* return default DSR value */
692 return sprintf(buf, "0x%x\n", 0x404);
693}
694
695static DEVICE_ATTR(dsr, S_IRUGO, mmc_dsr_show, NULL);
696
681static struct attribute *sd_std_attrs[] = { 697static struct attribute *sd_std_attrs[] = {
682 &dev_attr_cid.attr, 698 &dev_attr_cid.attr,
683 &dev_attr_csd.attr, 699 &dev_attr_csd.attr,
@@ -692,6 +708,7 @@ static struct attribute *sd_std_attrs[] = {
692 &dev_attr_oemid.attr, 708 &dev_attr_oemid.attr,
693 &dev_attr_serial.attr, 709 &dev_attr_serial.attr,
694 &dev_attr_ocr.attr, 710 &dev_attr_ocr.attr,
711 &dev_attr_dsr.attr,
695 NULL, 712 NULL,
696}; 713};
697ATTRIBUTE_GROUPS(sd_std); 714ATTRIBUTE_GROUPS(sd_std);