[PATCH 0/3] mmc: core: hs400 fix probe errors

From: Chris Ruehl
Date: Thu Dec 03 2020 - 04:35:17 EST


Fix the probe if hs400-1_8v / hs400-1_2v is used in the
dts and mmc-hs400-enhanced-strobe isn't set.

Kernel errors report when on boot and reboot and eMMC device
not detect randomly. With log output below.

[ 1.802342] mmc1: SDHCI controller on fe330000.sdhci [fe330000.sdhci] using ADMA
[ 2.007581] mmc1: mmc_select_hs200 failed, error -110
[ 2.007589] mmc1: error -110 whilst initialising MMC card
[ 2.413559] mmc1: mmc_select_hs200 failed, error -110
[ 2.413562] mmc1: error -110 whilst initialising MMC card
[ 3.183343] mmc1: Command Queue Engine enabled
[ 3.183355] mmc1: new HS400 MMC card at address 0001
[ 3.197163] mmcblk1: mmc1:0001 DG4008 7.28 GiB

Current implementation called the mmc_select_hs200 first, and after init
upgrade to hs400. Somehow the eMMC chip randomly crashed here.

Patch has been tested with customized Rockchip rk3399.

Patch 1/3 preparation
move mmc_select_hs400() in between hs400es and hs200, to be able to use
static functions defined previously below the mmc_select_hs400().

Patch 2/3 functionally change
mmc_select_timing()
call mmc_select_hs400 if EXT_CSD_CARD_TYPE_HS400 is set the
mmc_avail_type
mmc_select_hs400()
fixup bus-width check
fixup set power 1.8v or 1.2v; only one because of host-cap2
is checked in mmc_select_card().
Add drop-down to hs-mode.
Call hs400 prepare tuning (if ops callback)
and mmc_execute_tuning()

Patch 3/3 cleanup
Remove MMC_CAP2_HS200_1_8V_SDR / MMC_CAP2_HS200_1_2V_SDR from
host->caps2 when mmc-hs400-1_8v or mmc-hs400-1_2v is used in the dts.


Signed-off-by: Chris Ruehl <chris.ruehl@xxxxxxxxxxxx>
---