diff mbox series

mmc: export sd3_bus_mode to user space

Message ID 20201102071715.18057-1-yangbo.lu@nxp.com (mailing list archive)
State New, archived
Headers show
Series mmc: export sd3_bus_mode to user space | expand

Commit Message

Yangbo Lu Nov. 2, 2020, 7:17 a.m. UTC
There was no way for user to know what UHS-I modes the SD card
supporting. We might not know, even the highest speed mode
failed to use and fell back to a lower speed mode.

This patch is to export sd3_bus_mode to user space to check.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 drivers/mmc/core/sd.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Ulf Hansson Nov. 16, 2020, 11:26 a.m. UTC | #1
On Mon, 2 Nov 2020 at 08:26, Yangbo Lu <yangbo.lu@nxp.com> wrote:
>
> There was no way for user to know what UHS-I modes the SD card
> supporting. We might not know, even the highest speed mode
> failed to use and fell back to a lower speed mode.
>
> This patch is to export sd3_bus_mode to user space to check.

Well, even if the user would know, what can it do about it?

Sound like you are looking for some debugging feature instead?

Kind regards
Uffe

>
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> ---
>  drivers/mmc/core/sd.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> index 6f054c4..13409c2 100644
> --- a/drivers/mmc/core/sd.c
> +++ b/drivers/mmc/core/sd.c
> @@ -689,6 +689,7 @@ MMC_DEV_ATTR(oemid, "0x%04x\n", card->cid.oemid);
>  MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial);
>  MMC_DEV_ATTR(ocr, "0x%08x\n", card->ocr);
>  MMC_DEV_ATTR(rca, "0x%04x\n", card->rca);
> +MMC_DEV_ATTR(sd3_bus_mode, "0x%08x\n", card->sw_caps.sd3_bus_mode);
>
>
>  static ssize_t mmc_dsr_show(struct device *dev,
> @@ -753,6 +754,7 @@ static struct attribute *sd_std_attrs[] = {
>         &dev_attr_ocr.attr,
>         &dev_attr_rca.attr,
>         &dev_attr_dsr.attr,
> +       &dev_attr_sd3_bus_mode.attr,
>         NULL,
>  };
>
> --
> 2.7.4
>
Yangbo Lu Nov. 17, 2020, 2:44 a.m. UTC | #2
Hi Uffe,

> -----Original Message-----
> From: Ulf Hansson <ulf.hansson@linaro.org>
> Sent: Monday, November 16, 2020 7:27 PM
> To: Y.b. Lu <yangbo.lu@nxp.com>
> Cc: linux-mmc@vger.kernel.org; Adrian Hunter <adrian.hunter@intel.com>
> Subject: Re: [PATCH] mmc: export sd3_bus_mode to user space
> 
> On Mon, 2 Nov 2020 at 08:26, Yangbo Lu <yangbo.lu@nxp.com> wrote:
> >
> > There was no way for user to know what UHS-I modes the SD card
> > supporting. We might not know, even the highest speed mode
> > failed to use and fell back to a lower speed mode.
> >
> > This patch is to export sd3_bus_mode to user space to check.
> 
> Well, even if the user would know, what can it do about it?

For user, they can check the card speed modes capability, if they want to know.
For developer, they can know whether card is working on highest speed mode as expect. If not, they know there is issue needed checking.

> 
> Sound like you are looking for some debugging feature instead?

Yes. I think we may need a way to know whether SD card is working on the highest speed mode as expect.
Otherwise, we are not able to realize issue if card just fall back to a lower speed mode to work.
Any suggestion on this?

Thanks a lot.

> 
> Kind regards
> Uffe
> 
> >
> > Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> > ---
> >  drivers/mmc/core/sd.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
> > index 6f054c4..13409c2 100644
> > --- a/drivers/mmc/core/sd.c
> > +++ b/drivers/mmc/core/sd.c
> > @@ -689,6 +689,7 @@ MMC_DEV_ATTR(oemid, "0x%04x\n",
> card->cid.oemid);
> >  MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial);
> >  MMC_DEV_ATTR(ocr, "0x%08x\n", card->ocr);
> >  MMC_DEV_ATTR(rca, "0x%04x\n", card->rca);
> > +MMC_DEV_ATTR(sd3_bus_mode, "0x%08x\n",
> card->sw_caps.sd3_bus_mode);
> >
> >
> >  static ssize_t mmc_dsr_show(struct device *dev,
> > @@ -753,6 +754,7 @@ static struct attribute *sd_std_attrs[] = {
> >         &dev_attr_ocr.attr,
> >         &dev_attr_rca.attr,
> >         &dev_attr_dsr.attr,
> > +       &dev_attr_sd3_bus_mode.attr,
> >         NULL,
> >  };
> >
> > --
> > 2.7.4
> >
Ulf Hansson Nov. 17, 2020, 11:19 a.m. UTC | #3
On Tue, 17 Nov 2020 at 03:44, Y.b. Lu <yangbo.lu@nxp.com> wrote:
>
> Hi Uffe,
>
> > -----Original Message-----
> > From: Ulf Hansson <ulf.hansson@linaro.org>
> > Sent: Monday, November 16, 2020 7:27 PM
> > To: Y.b. Lu <yangbo.lu@nxp.com>
> > Cc: linux-mmc@vger.kernel.org; Adrian Hunter <adrian.hunter@intel.com>
> > Subject: Re: [PATCH] mmc: export sd3_bus_mode to user space
> >
> > On Mon, 2 Nov 2020 at 08:26, Yangbo Lu <yangbo.lu@nxp.com> wrote:
> > >
> > > There was no way for user to know what UHS-I modes the SD card
> > > supporting. We might not know, even the highest speed mode
> > > failed to use and fell back to a lower speed mode.
> > >
> > > This patch is to export sd3_bus_mode to user space to check.
> >
> > Well, even if the user would know, what can it do about it?
>
> For user, they can check the card speed modes capability, if they want to know.
> For developer, they can know whether card is working on highest speed mode as expect. If not, they know there is issue needed checking.
>
> >
> > Sound like you are looking for some debugging feature instead?
>
> Yes. I think we may need a way to know whether SD card is working on the highest speed mode as expect.
> Otherwise, we are not able to realize issue if card just fall back to a lower speed mode to work.
> Any suggestion on this?
>
> Thanks a lot.

Well, perhaps we should look into extending the debugfs node for the
card. See mmc_add_card_debugfs().

[...]

Kind regards
Uffe
diff mbox series

Patch

diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 6f054c4..13409c2 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -689,6 +689,7 @@  MMC_DEV_ATTR(oemid, "0x%04x\n", card->cid.oemid);
 MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial);
 MMC_DEV_ATTR(ocr, "0x%08x\n", card->ocr);
 MMC_DEV_ATTR(rca, "0x%04x\n", card->rca);
+MMC_DEV_ATTR(sd3_bus_mode, "0x%08x\n", card->sw_caps.sd3_bus_mode);
 
 
 static ssize_t mmc_dsr_show(struct device *dev,
@@ -753,6 +754,7 @@  static struct attribute *sd_std_attrs[] = {
 	&dev_attr_ocr.attr,
 	&dev_attr_rca.attr,
 	&dev_attr_dsr.attr,
+	&dev_attr_sd3_bus_mode.attr,
 	NULL,
 };