* [PATCH] mmc: core: Allow fallback to mmc_select_hs()
@ 2017-05-16 18:00 Fabio Estevam
2017-05-17 18:43 ` Fabio Estevam
0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2017-05-16 18:00 UTC (permalink / raw)
To: ulf.hansson
Cc: adrian.hunter, stefan, marcel.ziswiler, aisheng.dong, linux-mmc,
festevam, Fabio Estevam
If mmc_select_hs200() fails there is still a chance that the
card could operate in high speed mode, so change the logic in
mmc_select_timing() to allow a fallback to mmc_select_hs().
Tested on a imx7s-warp board.
Before this patch:
mmc1: mmc_select_hs200 failed, error -74
mmc1: new MMC card at address 0001
mmcblk1: mmc1:0001 V10008 7.05 GiB
mmcblk1boot0: mmc1:0001 V10008 partition 1 4.00 MiB
mmcblk1boot1: mmc1:0001 V10008 partition 2 4.00 MiB
mmcblk1rpmb: mmc1:0001 V10008 partition 3 4.00 MiB
# cat /sys/kernel/debug/mmc1/ios
clock: 25000000 Hz
actual clock: 24545454 Hz
vdd: 21 (3.3 ~ 3.4 V)
bus mode: 2 (push-pull)
chip select: 0 (don't care)
power mode: 2 (on)
bus width: 3 (8 bits)
timing spec: 0 (legacy)
signal voltage: 0 (3.30 V)
driver type: 0 (driver type B)
After this patch:
mmc1: mmc_select_hs200 failed, error -74
mmc1: new DDR MMC card at address 0001
mmcblk1: mmc1:0001 V10008 7.05 GiB
mmcblk1boot0: mmc1:0001 V10008 partition 1 4.00 MiB
mmcblk1boot1: mmc1:0001 V10008 partition 2 4.00 MiB
mmcblk1rpmb: mmc1:0001 V10008 partition 3 4.00 MiB
# cat /sys/kernel/debug/mmc1/ios
clock: 52000000 Hz
actual clock: 49090909 Hz
vdd: 21 (3.3 ~ 3.4 V)
bus mode: 2 (push-pull)
chip select: 0 (don't care)
power mode: 2 (on)
bus width: 3 (8 bits)
timing spec: 8 (mmc DDR52)
signal voltage: 1 (1.80 V)
driver type: 0 (driver type B)
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
Hi,
There was a previous attempt from Dong to fix this issue:
https://patchwork.kernel.org/patch/8893121/
,but it was dropped as it caused regression.
drivers/mmc/core/mmc.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index e3b6bea..2c3be9a 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1467,15 +1467,22 @@ static int mmc_select_hs200(struct mmc_card *card)
static int mmc_select_timing(struct mmc_card *card)
{
int err = 0;
+ bool hs400_200 = false;
if (!mmc_can_ext_csd(card))
goto bus_speed;
- if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES)
+ if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES) {
err = mmc_select_hs400es(card);
- else if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200)
+ if (!err)
+ hs400_200 = true;
+ } else if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200) {
err = mmc_select_hs200(card);
- else if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS)
+ if (!err)
+ hs400_200 = true;
+ }
+
+ if (!hs400_200 && (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS))
err = mmc_select_hs(card);
if (err && err != -EBADMSG)
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mmc: core: Allow fallback to mmc_select_hs()
2017-05-16 18:00 [PATCH] mmc: core: Allow fallback to mmc_select_hs() Fabio Estevam
@ 2017-05-17 18:43 ` Fabio Estevam
0 siblings, 0 replies; 2+ messages in thread
From: Fabio Estevam @ 2017-05-17 18:43 UTC (permalink / raw)
To: Fabio Estevam
Cc: Ulf Hansson, Adrian Hunter, Stefan Agner, Marcel Ziswiler,
Dong Aisheng, linux-mmc
On Tue, May 16, 2017 at 3:00 PM, Fabio Estevam <fabio.estevam@nxp.com> wrote:
> If mmc_select_hs200() fails there is still a chance that the
> card could operate in high speed mode, so change the logic in
> mmc_select_timing() to allow a fallback to mmc_select_hs().
>
> Tested on a imx7s-warp board.
>
> Before this patch:
>
> mmc1: mmc_select_hs200 failed, error -74
> mmc1: new MMC card at address 0001
> mmcblk1: mmc1:0001 V10008 7.05 GiB
> mmcblk1boot0: mmc1:0001 V10008 partition 1 4.00 MiB
> mmcblk1boot1: mmc1:0001 V10008 partition 2 4.00 MiB
> mmcblk1rpmb: mmc1:0001 V10008 partition 3 4.00 MiB
>
> # cat /sys/kernel/debug/mmc1/ios
> clock: 25000000 Hz
> actual clock: 24545454 Hz
> vdd: 21 (3.3 ~ 3.4 V)
> bus mode: 2 (push-pull)
> chip select: 0 (don't care)
> power mode: 2 (on)
> bus width: 3 (8 bits)
> timing spec: 0 (legacy)
> signal voltage: 0 (3.30 V)
> driver type: 0 (driver type B)
>
> After this patch:
>
> mmc1: mmc_select_hs200 failed, error -74
> mmc1: new DDR MMC card at address 0001
> mmcblk1: mmc1:0001 V10008 7.05 GiB
> mmcblk1boot0: mmc1:0001 V10008 partition 1 4.00 MiB
> mmcblk1boot1: mmc1:0001 V10008 partition 2 4.00 MiB
> mmcblk1rpmb: mmc1:0001 V10008 partition 3 4.00 MiB
>
> # cat /sys/kernel/debug/mmc1/ios
> clock: 52000000 Hz
> actual clock: 49090909 Hz
> vdd: 21 (3.3 ~ 3.4 V)
> bus mode: 2 (push-pull)
> chip select: 0 (don't care)
> power mode: 2 (on)
> bus width: 3 (8 bits)
> timing spec: 8 (mmc DDR52)
> signal voltage: 1 (1.80 V)
> driver type: 0 (driver type B)
>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Please ignore this patch.
As suggested by Stefan, passing 'no-1-8-v' in the device tree fixes the problem.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-17 18:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-16 18:00 [PATCH] mmc: core: Allow fallback to mmc_select_hs() Fabio Estevam
2017-05-17 18:43 ` Fabio Estevam
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.