From 6825a606584cec455b003afec7c10a07e563c994 Mon Sep 17 00:00:00 2001 From: Bojan Prtvar Date: Tue, 19 Jul 2016 11:16:38 +0200 Subject: 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 Signed-off-by: Ulf Hansson --- drivers/mmc/core/sd.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'drivers/mmc/core/sd.c') 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); MMC_DEV_ATTR(ocr, "%08x\n", card->ocr); +static ssize_t mmc_dsr_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct mmc_card *card = mmc_dev_to_card(dev); + struct mmc_host *host = card->host; + + if (card->csd.dsr_imp && host->dsr_req) + return sprintf(buf, "0x%x\n", host->dsr); + else + /* return default DSR value */ + return sprintf(buf, "0x%x\n", 0x404); +} + +static DEVICE_ATTR(dsr, S_IRUGO, mmc_dsr_show, NULL); + static struct attribute *sd_std_attrs[] = { &dev_attr_cid.attr, &dev_attr_csd.attr, @@ -692,6 +708,7 @@ static struct attribute *sd_std_attrs[] = { &dev_attr_oemid.attr, &dev_attr_serial.attr, &dev_attr_ocr.attr, + &dev_attr_dsr.attr, NULL, }; ATTRIBUTE_GROUPS(sd_std); -- cgit v1.2.3