2017-03-01 23:11:41

by Guenter Roeck

[permalink] [raw]
Subject: [PATCH] mmc: core: Fix access to HS400-ES devices

HS400-ES devices fail to initialize with the following error messages.

mmc1: power class selection to bus width 8 ddr 0 failed
mmc1: error -110 whilst initialising MMC card

This was seen on Samsung Chromebook Plus. Code analysis points to
commit 3d4ef329757c ("mmc: core: fix multi-bit bus width without
high-speed mode"), which attempts to set the bus width for all but
HS200 devices unconditionally. However, for HS400-ES, the bus width
is already selected.

Cc: Anssi Hannula <[email protected]>
Cc: Douglas Anderson <[email protected]>
Cc: Brian Norris <[email protected]>
Fixes: 3d4ef329757c ("mmc: core: fix multi-bit bus width ...")
Signed-off-by: Guenter Roeck <[email protected]>
---
drivers/mmc/core/mmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 7fd722868875..b502601df228 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1730,7 +1730,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
err = mmc_select_hs400(card);
if (err)
goto free_card;
- } else {
+ } else if (!mmc_card_hs400es(card)) {
/* Select the desired bus width optionally */
err = mmc_select_bus_width(card);
if (err > 0 && mmc_card_hs(card)) {
--
2.7.4


2017-03-01 23:34:54

by Doug Anderson

[permalink] [raw]
Subject: Re: [PATCH] mmc: core: Fix access to HS400-ES devices

Hi,

On Wed, Mar 1, 2017 at 2:11 PM, Guenter Roeck <[email protected]> wrote:
> HS400-ES devices fail to initialize with the following error messages.
>
> mmc1: power class selection to bus width 8 ddr 0 failed
> mmc1: error -110 whilst initialising MMC card
>
> This was seen on Samsung Chromebook Plus. Code analysis points to
> commit 3d4ef329757c ("mmc: core: fix multi-bit bus width without
> high-speed mode"), which attempts to set the bus width for all but
> HS200 devices unconditionally. However, for HS400-ES, the bus width
> is already selected.
>
> Cc: Anssi Hannula <[email protected]>
> Cc: Douglas Anderson <[email protected]>
> Cc: Brian Norris <[email protected]>
> Fixes: 3d4ef329757c ("mmc: core: fix multi-bit bus width ...")
> Signed-off-by: Guenter Roeck <[email protected]>
> ---
> drivers/mmc/core/mmc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 7fd722868875..b502601df228 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1730,7 +1730,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
> err = mmc_select_hs400(card);
> if (err)
> goto free_card;
> - } else {
> + } else if (!mmc_card_hs400es(card)) {
> /* Select the desired bus width optionally */
> err = mmc_select_bus_width(card);
> if (err > 0 && mmc_card_hs(card)) {

Right, so the key point here is that for normal hs400 we hit the
"mmc_card_hs200()" check above because hs400 transitions through
hs200. ...but for hs400es we don't do that transition (we jump
straight to hs400-es), so we need an extra case to avoid this
problematic mmc_select_bus_width().


Reviewed-by: Douglas Anderson <[email protected]>


-Doug

2017-03-02 01:18:33

by Shawn Lin

[permalink] [raw]
Subject: Re: [PATCH] mmc: core: Fix access to HS400-ES devices

On 2017/3/2 6:11, Guenter Roeck wrote:
> HS400-ES devices fail to initialize with the following error messages.
>
> mmc1: power class selection to bus width 8 ddr 0 failed
> mmc1: error -110 whilst initialising MMC card
>
> This was seen on Samsung Chromebook Plus. Code analysis points to
> commit 3d4ef329757c ("mmc: core: fix multi-bit bus width without
> high-speed mode"), which attempts to set the bus width for all but
> HS200 devices unconditionally. However, for HS400-ES, the bus width
> is already selected.
>

Thanks Guenter for catching this early!

Well, I wasn't cc'ed for that patch and it was queued for just one day
without fully reviewed. And Doug pointed out the key point here, so,

Reviewed-by: Shawn Lin <[email protected]>

btw, I think kernelci need some rk3399 platforms with hs400es
and CQ engine support for future test. I will try to find a way
to help kernelci to get some boards if possible..


> Cc: Anssi Hannula <[email protected]>
> Cc: Douglas Anderson <[email protected]>
> Cc: Brian Norris <[email protected]>
> Fixes: 3d4ef329757c ("mmc: core: fix multi-bit bus width ...")
> Signed-off-by: Guenter Roeck <[email protected]>
> ---
> drivers/mmc/core/mmc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 7fd722868875..b502601df228 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1730,7 +1730,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
> err = mmc_select_hs400(card);
> if (err)
> goto free_card;
> - } else {
> + } else if (!mmc_card_hs400es(card)) {
> /* Select the desired bus width optionally */
> err = mmc_select_bus_width(card);
> if (err > 0 && mmc_card_hs(card)) {
>


--
Best Regards
Shawn Lin

2017-03-07 03:45:31

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH] mmc: core: Fix access to HS400-ES devices

ping ...

Ulf,

I know it is early for a ping. However, the patch causing all HS400-ES
devices to fail already made it into various stable releases, and I think
it would be very desirable to get those back to working.

Thanks,
Guenter


On Wed, Mar 01, 2017 at 02:11:47PM -0800, Guenter Roeck wrote:
> HS400-ES devices fail to initialize with the following error messages.
>
> mmc1: power class selection to bus width 8 ddr 0 failed
> mmc1: error -110 whilst initialising MMC card
>
> This was seen on Samsung Chromebook Plus. Code analysis points to
> commit 3d4ef329757c ("mmc: core: fix multi-bit bus width without
> high-speed mode"), which attempts to set the bus width for all but
> HS200 devices unconditionally. However, for HS400-ES, the bus width
> is already selected.
>
> Cc: Anssi Hannula <[email protected]>
> Cc: Douglas Anderson <[email protected]>
> Cc: Brian Norris <[email protected]>
> Fixes: 3d4ef329757c ("mmc: core: fix multi-bit bus width ...")
> Signed-off-by: Guenter Roeck <[email protected]>
> ---
> drivers/mmc/core/mmc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 7fd722868875..b502601df228 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1730,7 +1730,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
> err = mmc_select_hs400(card);
> if (err)
> goto free_card;
> - } else {
> + } else if (!mmc_card_hs400es(card)) {
> /* Select the desired bus width optionally */
> err = mmc_select_bus_width(card);
> if (err > 0 && mmc_card_hs(card)) {
> --
> 2.7.4
>

2017-03-10 08:46:14

by Heiko Stuebner

[permalink] [raw]
Subject: Re: mmc: core: Fix access to HS400-ES devices

Am Mittwoch, 1. M?rz 2017, 14:11:47 CET schrieb Guenter Roeck:
> HS400-ES devices fail to initialize with the following error messages.
>
> mmc1: power class selection to bus width 8 ddr 0 failed
> mmc1: error -110 whilst initialising MMC card
>
> This was seen on Samsung Chromebook Plus. Code analysis points to
> commit 3d4ef329757c ("mmc: core: fix multi-bit bus width without
> high-speed mode"), which attempts to set the bus width for all but
> HS200 devices unconditionally. However, for HS400-ES, the bus width
> is already selected.
>
> Cc: Anssi Hannula <[email protected]>
> Cc: Douglas Anderson <[email protected]>
> Cc: Brian Norris <[email protected]>
> Fixes: 3d4ef329757c ("mmc: core: fix multi-bit bus width ...")
> Signed-off-by: Guenter Roeck <[email protected]>
> Reviewed-by: Douglas Anderson <[email protected]>
> Reviewed-by: Shawn Lin <[email protected]>

On a rk3399-kevin and the current mainline kernel from 20170309 it makes the
issue go away and the emmc work again, so

Tested-by: Heiko Stuebner <[email protected]>

2017-03-14 16:22:13

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH] mmc: core: Fix access to HS400-ES devices

On 1 March 2017 at 23:11, Guenter Roeck <[email protected]> wrote:
> HS400-ES devices fail to initialize with the following error messages.
>
> mmc1: power class selection to bus width 8 ddr 0 failed
> mmc1: error -110 whilst initialising MMC card
>
> This was seen on Samsung Chromebook Plus. Code analysis points to
> commit 3d4ef329757c ("mmc: core: fix multi-bit bus width without
> high-speed mode"), which attempts to set the bus width for all but
> HS200 devices unconditionally. However, for HS400-ES, the bus width
> is already selected.
>
> Cc: Anssi Hannula <[email protected]>
> Cc: Douglas Anderson <[email protected]>
> Cc: Brian Norris <[email protected]>
> Fixes: 3d4ef329757c ("mmc: core: fix multi-bit bus width ...")
> Signed-off-by: Guenter Roeck <[email protected]>

Sorry for the delay. Been traveling.

Applied for fixes, thanks!

Kind regards
Uffe

> ---
> drivers/mmc/core/mmc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 7fd722868875..b502601df228 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1730,7 +1730,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
> err = mmc_select_hs400(card);
> if (err)
> goto free_card;
> - } else {
> + } else if (!mmc_card_hs400es(card)) {
> /* Select the desired bus width optionally */
> err = mmc_select_bus_width(card);
> if (err > 0 && mmc_card_hs(card)) {
> --
> 2.7.4
>

2017-07-19 18:12:53

by Doug Anderson

[permalink] [raw]
Subject: Re: [PATCH] mmc: core: Fix access to HS400-ES devices

Hi,

On Tue, Mar 14, 2017 at 9:22 AM, Ulf Hansson <[email protected]> wrote:
> On 1 March 2017 at 23:11, Guenter Roeck <[email protected]> wrote:
>> HS400-ES devices fail to initialize with the following error messages.
>>
>> mmc1: power class selection to bus width 8 ddr 0 failed
>> mmc1: error -110 whilst initialising MMC card
>>
>> This was seen on Samsung Chromebook Plus. Code analysis points to
>> commit 3d4ef329757c ("mmc: core: fix multi-bit bus width without
>> high-speed mode"), which attempts to set the bus width for all but
>> HS200 devices unconditionally. However, for HS400-ES, the bus width
>> is already selected.
>>
>> Cc: Anssi Hannula <[email protected]>
>> Cc: Douglas Anderson <[email protected]>
>> Cc: Brian Norris <[email protected]>
>> Fixes: 3d4ef329757c ("mmc: core: fix multi-bit bus width ...")
>> Signed-off-by: Guenter Roeck <[email protected]>
>
> Sorry for the delay. Been traveling.
>
> Applied for fixes, thanks!

+stable

The commit 3d4ef329757c ("mmc: core: fix multi-bit bus width without
high-speed mode") got backported to many stable branches, so probably
this commit 773dc118756b ("mmc: core: Fix access to HS400-ES devices")
also needs to get picked to the same stable branches.

In the very least v4.9 and v4.4 stable includes the broken patch but
not this fix.

-Doug

2017-07-19 19:32:38

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] mmc: core: Fix access to HS400-ES devices

On Wed, Jul 19, 2017 at 11:12:45AM -0700, Doug Anderson wrote:
> Hi,
>
> On Tue, Mar 14, 2017 at 9:22 AM, Ulf Hansson <[email protected]> wrote:
> > On 1 March 2017 at 23:11, Guenter Roeck <[email protected]> wrote:
> >> HS400-ES devices fail to initialize with the following error messages.
> >>
> >> mmc1: power class selection to bus width 8 ddr 0 failed
> >> mmc1: error -110 whilst initialising MMC card
> >>
> >> This was seen on Samsung Chromebook Plus. Code analysis points to
> >> commit 3d4ef329757c ("mmc: core: fix multi-bit bus width without
> >> high-speed mode"), which attempts to set the bus width for all but
> >> HS200 devices unconditionally. However, for HS400-ES, the bus width
> >> is already selected.
> >>
> >> Cc: Anssi Hannula <[email protected]>
> >> Cc: Douglas Anderson <[email protected]>
> >> Cc: Brian Norris <[email protected]>
> >> Fixes: 3d4ef329757c ("mmc: core: fix multi-bit bus width ...")
> >> Signed-off-by: Guenter Roeck <[email protected]>
> >
> > Sorry for the delay. Been traveling.
> >
> > Applied for fixes, thanks!
>
> +stable
>
> The commit 3d4ef329757c ("mmc: core: fix multi-bit bus width without
> high-speed mode") got backported to many stable branches, so probably
> this commit 773dc118756b ("mmc: core: Fix access to HS400-ES devices")
> also needs to get picked to the same stable branches.
>
> In the very least v4.9 and v4.4 stable includes the broken patch but
> not this fix.

Ah, thanks, I missed that somehow, I think I saw the fixes: field and
didn't realize that that commit was already backported.

I'll queue it up after these next kernels are released in a few days.

thanks,

greg k-h