* [PATCHv2 1/1] ANDROID: mmc: core: export emmc revision
@ 2017-10-11 20:51 Jin Qian
2017-10-12 2:35 ` Jisheng Zhang
2017-10-12 7:32 ` Linus Walleij
0 siblings, 2 replies; 5+ messages in thread
From: Jin Qian @ 2017-10-11 20:51 UTC (permalink / raw)
To: Ulf Hansson, Jin Qian, Shawn Lin, Adrian Hunter, Linus Walleij,
Jaehoon Chung, Uri Yanai, Chanho Min, Jungseung Lee, linux-kernel,
linux-mmc
Cc: Jin Qian
From: Jin Qian <jinqian@google.com>
Expose emmc revision as part of device attributes.
Signed-off-by: Jin Qian <jinqian@android.com>
---
Documentation/ABI/testing/sysfs-bus-mmc | 4 ++++
drivers/mmc/core/mmc.c | 2 ++
2 files changed, 6 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-bus-mmc
diff --git a/Documentation/ABI/testing/sysfs-bus-mmc b/Documentation/ABI/testing/sysfs-bus-mmc
new file mode 100644
index 000000000000..519f028d19cc
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-bus-mmc
@@ -0,0 +1,4 @@
+What: /sys/bus/mmc/devices/.../rev
+Date: October 2017
+Contact: Jin Qian <jinqian@android.com>
+Description: Extended CSD revision number
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 36217ad5e9b1..4aa4cfb2c9e1 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -780,6 +780,7 @@ MMC_DEV_ATTR(manfid, "0x%06x\n", card->cid.manfid);
MMC_DEV_ATTR(name, "%s\n", card->cid.prod_name);
MMC_DEV_ATTR(oemid, "0x%04x\n", card->cid.oemid);
MMC_DEV_ATTR(prv, "0x%x\n", card->cid.prv);
+MMC_DEV_ATTR(rev, "0x%x\n", card->ext_csd.rev);
MMC_DEV_ATTR(pre_eol_info, "%02x\n", card->ext_csd.pre_eol_info);
MMC_DEV_ATTR(life_time, "0x%02x 0x%02x\n",
card->ext_csd.device_life_time_est_typ_a,
@@ -838,6 +839,7 @@ static struct attribute *mmc_std_attrs[] = {
&dev_attr_name.attr,
&dev_attr_oemid.attr,
&dev_attr_prv.attr,
+ &dev_attr_rev.attr,
&dev_attr_pre_eol_info.attr,
&dev_attr_life_time.attr,
&dev_attr_serial.attr,
--
2.15.0.rc0.271.g36b669edcc-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCHv2 1/1] ANDROID: mmc: core: export emmc revision
2017-10-11 20:51 [PATCHv2 1/1] ANDROID: mmc: core: export emmc revision Jin Qian
@ 2017-10-12 2:35 ` Jisheng Zhang
2017-10-12 7:32 ` Linus Walleij
1 sibling, 0 replies; 5+ messages in thread
From: Jisheng Zhang @ 2017-10-12 2:35 UTC (permalink / raw)
To: Jin Qian
Cc: Ulf Hansson, Jin Qian, Shawn Lin, Adrian Hunter, Linus Walleij,
Jaehoon Chung, Uri Yanai, Chanho Min, Jungseung Lee, linux-kernel,
linux-mmc
On Wed, 11 Oct 2017 13:51:26 -0700
Jin Qian <jinqian@android.com> wrote:
> From: Jin Qian <jinqian@google.com>
>
> Expose emmc revision as part of device attributes.
>> ANDROID: mmc: core: export emmc revision
This commit probably back port from android linux kernel repo. Could we
remove the ANDROID prefix
>
> Signed-off-by: Jin Qian <jinqian@android.com>
> ---
> Documentation/ABI/testing/sysfs-bus-mmc | 4 ++++
> drivers/mmc/core/mmc.c | 2 ++
> 2 files changed, 6 insertions(+)
> create mode 100644 Documentation/ABI/testing/sysfs-bus-mmc
>
> diff --git a/Documentation/ABI/testing/sysfs-bus-mmc b/Documentation/ABI/testing/sysfs-bus-mmc
> new file mode 100644
> index 000000000000..519f028d19cc
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-bus-mmc
> @@ -0,0 +1,4 @@
> +What: /sys/bus/mmc/devices/.../rev
> +Date: October 2017
> +Contact: Jin Qian <jinqian@android.com>
> +Description: Extended CSD revision number
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 36217ad5e9b1..4aa4cfb2c9e1 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -780,6 +780,7 @@ MMC_DEV_ATTR(manfid, "0x%06x\n", card->cid.manfid);
> MMC_DEV_ATTR(name, "%s\n", card->cid.prod_name);
> MMC_DEV_ATTR(oemid, "0x%04x\n", card->cid.oemid);
> MMC_DEV_ATTR(prv, "0x%x\n", card->cid.prv);
> +MMC_DEV_ATTR(rev, "0x%x\n", card->ext_csd.rev);
> MMC_DEV_ATTR(pre_eol_info, "%02x\n", card->ext_csd.pre_eol_info);
> MMC_DEV_ATTR(life_time, "0x%02x 0x%02x\n",
> card->ext_csd.device_life_time_est_typ_a,
> @@ -838,6 +839,7 @@ static struct attribute *mmc_std_attrs[] = {
> &dev_attr_name.attr,
> &dev_attr_oemid.attr,
> &dev_attr_prv.attr,
> + &dev_attr_rev.attr,
> &dev_attr_pre_eol_info.attr,
> &dev_attr_life_time.attr,
> &dev_attr_serial.attr,
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCHv2 1/1] ANDROID: mmc: core: export emmc revision
2017-10-11 20:51 [PATCHv2 1/1] ANDROID: mmc: core: export emmc revision Jin Qian
2017-10-12 2:35 ` Jisheng Zhang
@ 2017-10-12 7:32 ` Linus Walleij
2017-10-12 7:49 ` Linus Walleij
1 sibling, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2017-10-12 7:32 UTC (permalink / raw)
To: Jin Qian
Cc: Ulf Hansson, Jin Qian, Shawn Lin, Adrian Hunter, Jaehoon Chung,
Uri Yanai, Chanho Min, Jungseung Lee,
linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org
On Wed, Oct 11, 2017 at 10:51 PM, Jin Qian <jinqian@android.com> wrote:
> From: Jin Qian <jinqian@google.com>
>
> Expose emmc revision as part of device attributes.
>
> Signed-off-by: Jin Qian <jinqian@android.com>
So have you tried and seen what happens with an MMC that
is not an eMMC, i.e. a good old MMC card from back in the days?
Does it display all zeroes or something?
I think it is by far a better idea that Android start to read out these
things using the ioctl() operation and cut this sysfs business.
Example, see:
https://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git/tree/mmc_cmds.c
there is int read_extcsd() immediately in the top of the file.
The ioctl()s are a much better way to do this.
The ioctl() will read the extcsd
on the fly from the card, and what you see in sysfs is just read
when the card is initialized and then kept static.
Since the extcsd is not static but can change at runtime, I think
what you want to to is ioctl()s.
If we start to support reading extcsd from sysfs, the implementation
cannot just use the static copy of ext_csd like this, it needs to
ask the card for it using MMC_DRV_OP_GET_EXT_CSD
see
commit 627c3ccfb46ada2583eac434127ad5d75e1ac33c
"mmc: debugfs: Move block debugfs into block module"
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCHv2 1/1] ANDROID: mmc: core: export emmc revision
2017-10-12 7:32 ` Linus Walleij
@ 2017-10-12 7:49 ` Linus Walleij
0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2017-10-12 7:49 UTC (permalink / raw)
To: Jin Qian, Chris Ball
Cc: Ulf Hansson, Jin Qian, Shawn Lin, Adrian Hunter, Jaehoon Chung,
Uri Yanai, Chanho Min, Jungseung Lee,
linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org
On Thu, Oct 12, 2017 at 9:32 AM, Linus Walleij <linus.walleij@linaro.org> wrote:
> I think it is by far a better idea that Android start to read out these
> things using the ioctl() operation and cut this sysfs business.
But hey, too early in the morning. It's just the revision of the extcsd
that is being exposed. That's not too bad.
I shouldn't mail before I had my coffee.
I let Ulf and Chris look at this, paging Chris Ball.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCHv2 1/1] ANDROID: mmc: core: export emmc revision
@ 2017-10-12 17:43 Jin Qian
0 siblings, 0 replies; 5+ messages in thread
From: Jin Qian @ 2017-10-12 17:43 UTC (permalink / raw)
To: Ulf Hansson, Jin Qian, Shawn Lin, Adrian Hunter, Linus Walleij,
Jaehoon Chung, Uri Yanai, Chanho Min, Jungseung Lee, linux-kernel,
linux-mmc
Cc: Jin Qian
From: Jin Qian <jinqian@google.com>
Expose emmc revision as part of device attributes.
Signed-off-by: Jin Qian <jinqian@android.com>
---
Documentation/ABI/testing/sysfs-bus-mmc | 4 ++++
drivers/mmc/core/mmc.c | 2 ++
2 files changed, 6 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-bus-mmc
diff --git a/Documentation/ABI/testing/sysfs-bus-mmc b/Documentation/ABI/testing/sysfs-bus-mmc
new file mode 100644
index 000000000000..519f028d19cc
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-bus-mmc
@@ -0,0 +1,4 @@
+What: /sys/bus/mmc/devices/.../rev
+Date: October 2017
+Contact: Jin Qian <jinqian@android.com>
+Description: Extended CSD revision number
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 36217ad5e9b1..4aa4cfb2c9e1 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -780,6 +780,7 @@ MMC_DEV_ATTR(manfid, "0x%06x\n", card->cid.manfid);
MMC_DEV_ATTR(name, "%s\n", card->cid.prod_name);
MMC_DEV_ATTR(oemid, "0x%04x\n", card->cid.oemid);
MMC_DEV_ATTR(prv, "0x%x\n", card->cid.prv);
+MMC_DEV_ATTR(rev, "0x%x\n", card->ext_csd.rev);
MMC_DEV_ATTR(pre_eol_info, "%02x\n", card->ext_csd.pre_eol_info);
MMC_DEV_ATTR(life_time, "0x%02x 0x%02x\n",
card->ext_csd.device_life_time_est_typ_a,
@@ -838,6 +839,7 @@ static struct attribute *mmc_std_attrs[] = {
&dev_attr_name.attr,
&dev_attr_oemid.attr,
&dev_attr_prv.attr,
+ &dev_attr_rev.attr,
&dev_attr_pre_eol_info.attr,
&dev_attr_life_time.attr,
&dev_attr_serial.attr,
--
2.15.0.rc0.271.g36b669edcc-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-10-12 17:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-11 20:51 [PATCHv2 1/1] ANDROID: mmc: core: export emmc revision Jin Qian
2017-10-12 2:35 ` Jisheng Zhang
2017-10-12 7:32 ` Linus Walleij
2017-10-12 7:49 ` Linus Walleij
-- strict thread matches above, loose matches on Subject: below --
2017-10-12 17:43 Jin Qian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox