[PATCH] mmc: core: Allow fallback to mmc_select_hs()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux