linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode
@ 2021-06-24 16:30 Al Cooper
  2021-06-30 12:52 ` Adrian Hunter
  2021-06-30 14:20 ` Ulf Hansson
  0 siblings, 2 replies; 5+ messages in thread
From: Al Cooper @ 2021-06-24 16:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Al Cooper, Adrian Hunter, linux-mmc, Ulf Hansson

When an eMMC device is being run in HS400 mode, any access to the
RPMB device will cause the error message "mmc1: Invalid UHS-I mode
selected". This happens as a result of tuning being disabled before
RPMB access and then re-enabled after the RPMB access is complete.
When tuning is re-enabled, the system has to switch from HS400
to HS200 to do the tuning and then back to HS400. As part of
sequence to switch from HS400 to HS200 the system is temporarily
put into HS mode. When switching to HS mode, sdhci_get_preset_value()
is called and does not have support for HS mode and prints the warning
message and returns the preset for SDR12. The fix is to add support
for MMC and SD HS modes to sdhci_get_preset_value().

This can be reproduced on any system running eMMC in HS400 mode
(not HS400ES) by using the "mmc" utility to run the following
command: "mmc rpmb read-counter /dev/mmcblk0rpmb".

Signed-off-by: Al Cooper <alcooperx@gmail.com>
---
 drivers/mmc/host/sdhci.c | 4 ++++
 drivers/mmc/host/sdhci.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index bf238ade1602..6b39126fbf06 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1812,6 +1812,10 @@ static u16 sdhci_get_preset_value(struct sdhci_host *host)
 	u16 preset = 0;
 
 	switch (host->timing) {
+	case MMC_TIMING_MMC_HS:
+	case MMC_TIMING_SD_HS:
+		preset = sdhci_readw(host, SDHCI_PRESET_FOR_HIGH_SPEED);
+		break;
 	case MMC_TIMING_UHS_SDR12:
 		preset = sdhci_readw(host, SDHCI_PRESET_FOR_SDR12);
 		break;
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 0770c036e2ff..960fed78529e 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -253,6 +253,7 @@
 
 /* 60-FB reserved */
 
+#define SDHCI_PRESET_FOR_HIGH_SPEED	0x64
 #define SDHCI_PRESET_FOR_SDR12 0x66
 #define SDHCI_PRESET_FOR_SDR25 0x68
 #define SDHCI_PRESET_FOR_SDR50 0x6A

base-commit: 7426cedc7dad67bf3c71ea6cc29ab7822e1a453f
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode
  2021-06-24 16:30 [PATCH] mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode Al Cooper
@ 2021-06-30 12:52 ` Adrian Hunter
  2021-06-30 14:20 ` Ulf Hansson
  1 sibling, 0 replies; 5+ messages in thread
From: Adrian Hunter @ 2021-06-30 12:52 UTC (permalink / raw)
  To: Al Cooper, linux-kernel; +Cc: linux-mmc, Ulf Hansson

On 24/06/21 7:30 pm, Al Cooper wrote:
> When an eMMC device is being run in HS400 mode, any access to the
> RPMB device will cause the error message "mmc1: Invalid UHS-I mode
> selected". This happens as a result of tuning being disabled before
> RPMB access and then re-enabled after the RPMB access is complete.
> When tuning is re-enabled, the system has to switch from HS400
> to HS200 to do the tuning and then back to HS400. As part of
> sequence to switch from HS400 to HS200 the system is temporarily
> put into HS mode. When switching to HS mode, sdhci_get_preset_value()
> is called and does not have support for HS mode and prints the warning
> message and returns the preset for SDR12. The fix is to add support
> for MMC and SD HS modes to sdhci_get_preset_value().
> 
> This can be reproduced on any system running eMMC in HS400 mode
> (not HS400ES) by using the "mmc" utility to run the following
> command: "mmc rpmb read-counter /dev/mmcblk0rpmb".
> 
> Signed-off-by: Al Cooper <alcooperx@gmail.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci.c | 4 ++++
>  drivers/mmc/host/sdhci.h | 1 +
>  2 files changed, 5 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index bf238ade1602..6b39126fbf06 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1812,6 +1812,10 @@ static u16 sdhci_get_preset_value(struct sdhci_host *host)
>  	u16 preset = 0;
>  
>  	switch (host->timing) {
> +	case MMC_TIMING_MMC_HS:
> +	case MMC_TIMING_SD_HS:
> +		preset = sdhci_readw(host, SDHCI_PRESET_FOR_HIGH_SPEED);
> +		break;
>  	case MMC_TIMING_UHS_SDR12:
>  		preset = sdhci_readw(host, SDHCI_PRESET_FOR_SDR12);
>  		break;
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index 0770c036e2ff..960fed78529e 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -253,6 +253,7 @@
>  
>  /* 60-FB reserved */
>  
> +#define SDHCI_PRESET_FOR_HIGH_SPEED	0x64
>  #define SDHCI_PRESET_FOR_SDR12 0x66
>  #define SDHCI_PRESET_FOR_SDR25 0x68
>  #define SDHCI_PRESET_FOR_SDR50 0x6A
> 
> base-commit: 7426cedc7dad67bf3c71ea6cc29ab7822e1a453f
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode
  2021-06-24 16:30 [PATCH] mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode Al Cooper
  2021-06-30 12:52 ` Adrian Hunter
@ 2021-06-30 14:20 ` Ulf Hansson
  2021-07-02 12:33   ` Alan Cooper
  1 sibling, 1 reply; 5+ messages in thread
From: Ulf Hansson @ 2021-06-30 14:20 UTC (permalink / raw)
  To: Al Cooper; +Cc: Linux Kernel Mailing List, Adrian Hunter, linux-mmc

On Thu, 24 Jun 2021 at 18:31, Al Cooper <alcooperx@gmail.com> wrote:
>
> When an eMMC device is being run in HS400 mode, any access to the
> RPMB device will cause the error message "mmc1: Invalid UHS-I mode
> selected". This happens as a result of tuning being disabled before
> RPMB access and then re-enabled after the RPMB access is complete.
> When tuning is re-enabled, the system has to switch from HS400
> to HS200 to do the tuning and then back to HS400. As part of
> sequence to switch from HS400 to HS200 the system is temporarily
> put into HS mode. When switching to HS mode, sdhci_get_preset_value()
> is called and does not have support for HS mode and prints the warning
> message and returns the preset for SDR12. The fix is to add support
> for MMC and SD HS modes to sdhci_get_preset_value().
>
> This can be reproduced on any system running eMMC in HS400 mode
> (not HS400ES) by using the "mmc" utility to run the following
> command: "mmc rpmb read-counter /dev/mmcblk0rpmb".
>
> Signed-off-by: Al Cooper <alcooperx@gmail.com>

I assume we want this for stable kernels, but it would be nice to add
a fixes tag as well.

Do you know if there is a specific commit that this fixes?

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci.c | 4 ++++
>  drivers/mmc/host/sdhci.h | 1 +
>  2 files changed, 5 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index bf238ade1602..6b39126fbf06 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1812,6 +1812,10 @@ static u16 sdhci_get_preset_value(struct sdhci_host *host)
>         u16 preset = 0;
>
>         switch (host->timing) {
> +       case MMC_TIMING_MMC_HS:
> +       case MMC_TIMING_SD_HS:
> +               preset = sdhci_readw(host, SDHCI_PRESET_FOR_HIGH_SPEED);
> +               break;
>         case MMC_TIMING_UHS_SDR12:
>                 preset = sdhci_readw(host, SDHCI_PRESET_FOR_SDR12);
>                 break;
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index 0770c036e2ff..960fed78529e 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -253,6 +253,7 @@
>
>  /* 60-FB reserved */
>
> +#define SDHCI_PRESET_FOR_HIGH_SPEED    0x64
>  #define SDHCI_PRESET_FOR_SDR12 0x66
>  #define SDHCI_PRESET_FOR_SDR25 0x68
>  #define SDHCI_PRESET_FOR_SDR50 0x6A
>
> base-commit: 7426cedc7dad67bf3c71ea6cc29ab7822e1a453f
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode
  2021-06-30 14:20 ` Ulf Hansson
@ 2021-07-02 12:33   ` Alan Cooper
  2021-07-02 13:22     ` Ulf Hansson
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Cooper @ 2021-07-02 12:33 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Linux Kernel Mailing List, Adrian Hunter, linux-mmc

On Wed, Jun 30, 2021 at 10:21 AM Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> On Thu, 24 Jun 2021 at 18:31, Al Cooper <alcooperx@gmail.com> wrote:
> >
> > When an eMMC device is being run in HS400 mode, any access to the
> > RPMB device will cause the error message "mmc1: Invalid UHS-I mode
> > selected". This happens as a result of tuning being disabled before
> > RPMB access and then re-enabled after the RPMB access is complete.
> > When tuning is re-enabled, the system has to switch from HS400
> > to HS200 to do the tuning and then back to HS400. As part of
> > sequence to switch from HS400 to HS200 the system is temporarily
> > put into HS mode. When switching to HS mode, sdhci_get_preset_value()
> > is called and does not have support for HS mode and prints the warning
> > message and returns the preset for SDR12. The fix is to add support
> > for MMC and SD HS modes to sdhci_get_preset_value().
> >
> > This can be reproduced on any system running eMMC in HS400 mode
> > (not HS400ES) by using the "mmc" utility to run the following
> > command: "mmc rpmb read-counter /dev/mmcblk0rpmb".
> >
> > Signed-off-by: Al Cooper <alcooperx@gmail.com>
>
> I assume we want this for stable kernels, but it would be nice to add
> a fixes tag as well.
>
> Do you know if there is a specific commit that this fixes?

The function sdhci_get_preset_value(), which is missing the HS modes,
was added in 52983382c74f5 for v3.9. Should I add a fixes tag for that
commit?

Thanks
Al

>
> Kind regards
> Uffe
>
> > ---
> >  drivers/mmc/host/sdhci.c | 4 ++++
> >  drivers/mmc/host/sdhci.h | 1 +
> >  2 files changed, 5 insertions(+)
> >
> > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> > index bf238ade1602..6b39126fbf06 100644
> > --- a/drivers/mmc/host/sdhci.c
> > +++ b/drivers/mmc/host/sdhci.c
> > @@ -1812,6 +1812,10 @@ static u16 sdhci_get_preset_value(struct sdhci_host *host)
> >         u16 preset = 0;
> >
> >         switch (host->timing) {
> > +       case MMC_TIMING_MMC_HS:
> > +       case MMC_TIMING_SD_HS:
> > +               preset = sdhci_readw(host, SDHCI_PRESET_FOR_HIGH_SPEED);
> > +               break;
> >         case MMC_TIMING_UHS_SDR12:
> >                 preset = sdhci_readw(host, SDHCI_PRESET_FOR_SDR12);
> >                 break;
> > diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> > index 0770c036e2ff..960fed78529e 100644
> > --- a/drivers/mmc/host/sdhci.h
> > +++ b/drivers/mmc/host/sdhci.h
> > @@ -253,6 +253,7 @@
> >
> >  /* 60-FB reserved */
> >
> > +#define SDHCI_PRESET_FOR_HIGH_SPEED    0x64
> >  #define SDHCI_PRESET_FOR_SDR12 0x66
> >  #define SDHCI_PRESET_FOR_SDR25 0x68
> >  #define SDHCI_PRESET_FOR_SDR50 0x6A
> >
> > base-commit: 7426cedc7dad67bf3c71ea6cc29ab7822e1a453f
> > --
> > 2.17.1
> >

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode
  2021-07-02 12:33   ` Alan Cooper
@ 2021-07-02 13:22     ` Ulf Hansson
  0 siblings, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2021-07-02 13:22 UTC (permalink / raw)
  To: Alan Cooper; +Cc: Linux Kernel Mailing List, Adrian Hunter, linux-mmc

On Fri, 2 Jul 2021 at 14:34, Alan Cooper <alcooperx@gmail.com> wrote:
>
> On Wed, Jun 30, 2021 at 10:21 AM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> >
> > On Thu, 24 Jun 2021 at 18:31, Al Cooper <alcooperx@gmail.com> wrote:
> > >
> > > When an eMMC device is being run in HS400 mode, any access to the
> > > RPMB device will cause the error message "mmc1: Invalid UHS-I mode
> > > selected". This happens as a result of tuning being disabled before
> > > RPMB access and then re-enabled after the RPMB access is complete.
> > > When tuning is re-enabled, the system has to switch from HS400
> > > to HS200 to do the tuning and then back to HS400. As part of
> > > sequence to switch from HS400 to HS200 the system is temporarily
> > > put into HS mode. When switching to HS mode, sdhci_get_preset_value()
> > > is called and does not have support for HS mode and prints the warning
> > > message and returns the preset for SDR12. The fix is to add support
> > > for MMC and SD HS modes to sdhci_get_preset_value().
> > >
> > > This can be reproduced on any system running eMMC in HS400 mode
> > > (not HS400ES) by using the "mmc" utility to run the following
> > > command: "mmc rpmb read-counter /dev/mmcblk0rpmb".
> > >
> > > Signed-off-by: Al Cooper <alcooperx@gmail.com>
> >
> > I assume we want this for stable kernels, but it would be nice to add
> > a fixes tag as well.
> >
> > Do you know if there is a specific commit that this fixes?
>
> The function sdhci_get_preset_value(), which is missing the HS modes,
> was added in 52983382c74f5 for v3.9. Should I add a fixes tag for that
> commit?

Thanks for checking this! I have amended the patch to add a
fixes/stable tag and applied it for fixes.

Kind regards
Uffe

>
> Thanks
> Al
>
> >
> > Kind regards
> > Uffe
> >
> > > ---
> > >  drivers/mmc/host/sdhci.c | 4 ++++
> > >  drivers/mmc/host/sdhci.h | 1 +
> > >  2 files changed, 5 insertions(+)
> > >
> > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> > > index bf238ade1602..6b39126fbf06 100644
> > > --- a/drivers/mmc/host/sdhci.c
> > > +++ b/drivers/mmc/host/sdhci.c
> > > @@ -1812,6 +1812,10 @@ static u16 sdhci_get_preset_value(struct sdhci_host *host)
> > >         u16 preset = 0;
> > >
> > >         switch (host->timing) {
> > > +       case MMC_TIMING_MMC_HS:
> > > +       case MMC_TIMING_SD_HS:
> > > +               preset = sdhci_readw(host, SDHCI_PRESET_FOR_HIGH_SPEED);
> > > +               break;
> > >         case MMC_TIMING_UHS_SDR12:
> > >                 preset = sdhci_readw(host, SDHCI_PRESET_FOR_SDR12);
> > >                 break;
> > > diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> > > index 0770c036e2ff..960fed78529e 100644
> > > --- a/drivers/mmc/host/sdhci.h
> > > +++ b/drivers/mmc/host/sdhci.h
> > > @@ -253,6 +253,7 @@
> > >
> > >  /* 60-FB reserved */
> > >
> > > +#define SDHCI_PRESET_FOR_HIGH_SPEED    0x64
> > >  #define SDHCI_PRESET_FOR_SDR12 0x66
> > >  #define SDHCI_PRESET_FOR_SDR25 0x68
> > >  #define SDHCI_PRESET_FOR_SDR50 0x6A
> > >
> > > base-commit: 7426cedc7dad67bf3c71ea6cc29ab7822e1a453f
> > > --
> > > 2.17.1
> > >

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-02 13:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24 16:30 [PATCH] mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode Al Cooper
2021-06-30 12:52 ` Adrian Hunter
2021-06-30 14:20 ` Ulf Hansson
2021-07-02 12:33   ` Alan Cooper
2021-07-02 13:22     ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).