diff mbox series

[v2,3/3] mmc: core: add support for disabling HS400 mode via DT

Message ID 20210510190400.105162-3-l.stach@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series [v2,1/3] dt-bindings: mmc: add no-mmc-hs400 flag | expand

Commit Message

Lucas Stach May 10, 2021, 7:04 p.m. UTC
From: Lucas Stach <dev@lynxeye.de>

On some boards the data strobe line isn't wired up, rendering HS400
support broken, even if both the controller and the eMMC claim to
support it. Allow to disable HS400 mode via DT.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
v2:
- move to core
- actually disable all HS400 modes
---
 drivers/mmc/core/host.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Ulf Hansson May 11, 2021, 11:14 a.m. UTC | #1
+ Chris Ruehl

On Mon, 10 May 2021 at 21:04, Lucas Stach <l.stach@pengutronix.de> wrote:
>
> From: Lucas Stach <dev@lynxeye.de>
>
> On some boards the data strobe line isn't wired up, rendering HS400
> support broken, even if both the controller and the eMMC claim to
> support it. Allow to disable HS400 mode via DT.

Before I review the series, I just wanted to highlight that quite
recently we got a related series posted from Chris [1]. I made some
comments, but he hasn't replied yet.

In any case, if I understood it correctly, it looks like some
controllers may support HS400 ES, but not HS200. Could that be the
case here as well? Or is this a different problem?

Kind regards
Uffe

[1]
https://patchwork.kernel.org/project/linux-mmc/patch/20201208061839.21163-7-chris.ruehl@gtsys.com.hk/

>
> Signed-off-by: Lucas Stach <dev@lynxeye.de>
> ---
> v2:
> - move to core
> - actually disable all HS400 modes
> ---
>  drivers/mmc/core/host.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index 9b89a91b6b47..0e066c5f5243 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -351,6 +351,9 @@ int mmc_of_parse(struct mmc_host *host)
>                 host->caps2 |= MMC_CAP2_NO_SD;
>         if (device_property_read_bool(dev, "no-mmc"))
>                 host->caps2 |= MMC_CAP2_NO_MMC;
> +       if (device_property_read_bool(dev, "no-mmc-hs400"))
> +               host->caps2 &= ~(MMC_CAP2_HS400_1_8V | MMC_CAP2_HS400_1_2V |
> +                                MMC_CAP2_HS400_ES);
>
>         /* Must be after "non-removable" check */
>         if (device_property_read_u32(dev, "fixed-emmc-driver-type", &drv_type) == 0) {
> --
> 2.31.1
>
Lucas Stach May 11, 2021, 11:54 a.m. UTC | #2
Hi Ulf,

Am Dienstag, dem 11.05.2021 um 13:14 +0200 schrieb Ulf Hansson:
> + Chris Ruehl
> 
> On Mon, 10 May 2021 at 21:04, Lucas Stach <l.stach@pengutronix.de> wrote:
> > 
> > From: Lucas Stach <dev@lynxeye.de>
> > 
> > On some boards the data strobe line isn't wired up, rendering HS400
> > support broken, even if both the controller and the eMMC claim to
> > support it. Allow to disable HS400 mode via DT.
> 
> Before I review the series, I just wanted to highlight that quite
> recently we got a related series posted from Chris [1]. I made some
> comments, but he hasn't replied yet.
> 
> In any case, if I understood it correctly, it looks like some
> controllers may support HS400 ES, but not HS200. Could that be the
> case here as well? Or is this a different problem?
> 
> 
That's not the issue I'm trying to solve here. HS400 modes, whether ES
nor not, require the data strobe line to work. ES mode just defines how
this line is used. I know for a fact that the board I'm dealing with
here, just hasn't wired up this line between the SoC and the eMMC. Thus
HS400 modes fail to work, even though both controller and eMMC support
this mode.

When HS400 is disabled, like in this series, communication falls back
to HS200 mode and works fine this way.

Regards,
Lucas

> Kind regards
> Uffe
> 
> [1]
> https://patchwork.kernel.org/project/linux-mmc/patch/20201208061839.21163-7-chris.ruehl@gtsys.com.hk/
> 
> > 
> > Signed-off-by: Lucas Stach <dev@lynxeye.de>
> > ---
> > v2:
> > - move to core
> > - actually disable all HS400 modes
> > ---
> >  drivers/mmc/core/host.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> > index 9b89a91b6b47..0e066c5f5243 100644
> > --- a/drivers/mmc/core/host.c
> > +++ b/drivers/mmc/core/host.c
> > @@ -351,6 +351,9 @@ int mmc_of_parse(struct mmc_host *host)
> >                 host->caps2 |= MMC_CAP2_NO_SD;
> >         if (device_property_read_bool(dev, "no-mmc"))
> >                 host->caps2 |= MMC_CAP2_NO_MMC;
> > +       if (device_property_read_bool(dev, "no-mmc-hs400"))
> > +               host->caps2 &= ~(MMC_CAP2_HS400_1_8V | MMC_CAP2_HS400_1_2V |
> > +                                MMC_CAP2_HS400_ES);
> > 
> >         /* Must be after "non-removable" check */
> >         if (device_property_read_u32(dev, "fixed-emmc-driver-type", &drv_type) == 0) {
> > --
> > 2.31.1
> >
Ulf Hansson May 11, 2021, 12:19 p.m. UTC | #3
On Tue, 11 May 2021 at 13:54, Lucas Stach <l.stach@pengutronix.de> wrote:
>
> Hi Ulf,
>
> Am Dienstag, dem 11.05.2021 um 13:14 +0200 schrieb Ulf Hansson:
> > + Chris Ruehl
> >
> > On Mon, 10 May 2021 at 21:04, Lucas Stach <l.stach@pengutronix.de> wrote:
> > >
> > > From: Lucas Stach <dev@lynxeye.de>
> > >
> > > On some boards the data strobe line isn't wired up, rendering HS400
> > > support broken, even if both the controller and the eMMC claim to
> > > support it. Allow to disable HS400 mode via DT.
> >
> > Before I review the series, I just wanted to highlight that quite
> > recently we got a related series posted from Chris [1]. I made some
> > comments, but he hasn't replied yet.
> >
> > In any case, if I understood it correctly, it looks like some
> > controllers may support HS400 ES, but not HS200. Could that be the
> > case here as well? Or is this a different problem?
> >
> >
> That's not the issue I'm trying to solve here. HS400 modes, whether ES
> nor not, require the data strobe line to work. ES mode just defines how
> this line is used. I know for a fact that the board I'm dealing with
> here, just hasn't wired up this line between the SoC and the eMMC. Thus
> HS400 modes fail to work, even though both controller and eMMC support
> this mode.
>
> When HS400 is disabled, like in this series, communication falls back
> to HS200 mode and works fine this way.

Alright, thanks for clarifying. I will look into the series soon.

Kind regards
Uffe

>
> Regards,
> Lucas
>
> > Kind regards
> > Uffe
> >
> > [1]
> > https://patchwork.kernel.org/project/linux-mmc/patch/20201208061839.21163-7-chris.ruehl@gtsys.com.hk/
> >
> > >
> > > Signed-off-by: Lucas Stach <dev@lynxeye.de>
> > > ---
> > > v2:
> > > - move to core
> > > - actually disable all HS400 modes
> > > ---
> > >  drivers/mmc/core/host.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> > > index 9b89a91b6b47..0e066c5f5243 100644
> > > --- a/drivers/mmc/core/host.c
> > > +++ b/drivers/mmc/core/host.c
> > > @@ -351,6 +351,9 @@ int mmc_of_parse(struct mmc_host *host)
> > >                 host->caps2 |= MMC_CAP2_NO_SD;
> > >         if (device_property_read_bool(dev, "no-mmc"))
> > >                 host->caps2 |= MMC_CAP2_NO_MMC;
> > > +       if (device_property_read_bool(dev, "no-mmc-hs400"))
> > > +               host->caps2 &= ~(MMC_CAP2_HS400_1_8V | MMC_CAP2_HS400_1_2V |
> > > +                                MMC_CAP2_HS400_ES);
> > >
> > >         /* Must be after "non-removable" check */
> > >         if (device_property_read_u32(dev, "fixed-emmc-driver-type", &drv_type) == 0) {
> > > --
> > > 2.31.1
> > >
>
>
Ulf Hansson May 24, 2021, 2:10 p.m. UTC | #4
On Mon, 10 May 2021 at 21:04, Lucas Stach <l.stach@pengutronix.de> wrote:
>
> From: Lucas Stach <dev@lynxeye.de>
>
> On some boards the data strobe line isn't wired up, rendering HS400
> support broken, even if both the controller and the eMMC claim to
> support it. Allow to disable HS400 mode via DT.
>
> Signed-off-by: Lucas Stach <dev@lynxeye.de>

Applied for next, thanks!

Kind regards
Uffe


> ---
> v2:
> - move to core
> - actually disable all HS400 modes
> ---
>  drivers/mmc/core/host.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index 9b89a91b6b47..0e066c5f5243 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -351,6 +351,9 @@ int mmc_of_parse(struct mmc_host *host)
>                 host->caps2 |= MMC_CAP2_NO_SD;
>         if (device_property_read_bool(dev, "no-mmc"))
>                 host->caps2 |= MMC_CAP2_NO_MMC;
> +       if (device_property_read_bool(dev, "no-mmc-hs400"))
> +               host->caps2 &= ~(MMC_CAP2_HS400_1_8V | MMC_CAP2_HS400_1_2V |
> +                                MMC_CAP2_HS400_ES);
>
>         /* Must be after "non-removable" check */
>         if (device_property_read_u32(dev, "fixed-emmc-driver-type", &drv_type) == 0) {
> --
> 2.31.1
>
diff mbox series

Patch

diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 9b89a91b6b47..0e066c5f5243 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -351,6 +351,9 @@  int mmc_of_parse(struct mmc_host *host)
 		host->caps2 |= MMC_CAP2_NO_SD;
 	if (device_property_read_bool(dev, "no-mmc"))
 		host->caps2 |= MMC_CAP2_NO_MMC;
+	if (device_property_read_bool(dev, "no-mmc-hs400"))
+		host->caps2 &= ~(MMC_CAP2_HS400_1_8V | MMC_CAP2_HS400_1_2V |
+				 MMC_CAP2_HS400_ES);
 
 	/* Must be after "non-removable" check */
 	if (device_property_read_u32(dev, "fixed-emmc-driver-type", &drv_type) == 0) {