Commit 04a2ea248f58b3b6216d0cd0a6b8698df8b14355
Committed by
Jaehoon Chung
1 parent
c10b85d6c2
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
mmc: disable UHS modes if Vcc cannot be switched on and off
If a power cycle cannot be done on Vcc, it is safer not to try the UHS modes because we wouldn't be able to recover from an error occurring during the UHS initialization. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Showing 2 changed files with 17 additions and 3 deletions Side-by-side Diff
drivers/mmc/mmc.c
... | ... | @@ -1451,7 +1451,7 @@ |
1451 | 1451 | if (err) |
1452 | 1452 | return err; |
1453 | 1453 | /* Restrict card's capabilities by what the host can do */ |
1454 | - caps = mmc->card_caps & (mmc->cfg->host_caps | MMC_MODE_1BIT); | |
1454 | + caps = mmc->card_caps & (mmc->host_caps | MMC_MODE_1BIT); | |
1455 | 1455 | |
1456 | 1456 | if (!uhs_en) |
1457 | 1457 | caps &= ~UHS_CAPS; |
... | ... | @@ -1599,7 +1599,7 @@ |
1599 | 1599 | return err; |
1600 | 1600 | |
1601 | 1601 | /* Restrict card's capabilities by what the host can do */ |
1602 | - mmc->card_caps &= (mmc->cfg->host_caps | MMC_MODE_1BIT); | |
1602 | + mmc->card_caps &= (mmc->host_caps | MMC_MODE_1BIT); | |
1603 | 1603 | |
1604 | 1604 | /* Only version 4 of MMC supports wider bus widths */ |
1605 | 1605 | if (mmc->version < MMC_VERSION_4) |
... | ... | @@ -2182,6 +2182,8 @@ |
2182 | 2182 | bool uhs_en = supports_uhs(mmc->cfg->host_caps); |
2183 | 2183 | int err; |
2184 | 2184 | |
2185 | + mmc->host_caps = mmc->cfg->host_caps; | |
2186 | + | |
2185 | 2187 | /* we pretend there's no card when init is NULL */ |
2186 | 2188 | no_card = mmc_getcd(mmc) == 0; |
2187 | 2189 | #if !CONFIG_IS_ENABLED(DM_MMC) |
... | ... | @@ -2205,7 +2207,18 @@ |
2205 | 2207 | if (err) |
2206 | 2208 | return err; |
2207 | 2209 | |
2208 | - err = mmc_power_on(mmc); | |
2210 | + err = mmc_power_cycle(mmc); | |
2211 | + if (err) { | |
2212 | + /* | |
2213 | + * if power cycling is not supported, we should not try | |
2214 | + * to use the UHS modes, because we wouldn't be able to | |
2215 | + * recover from an error during the UHS initialization. | |
2216 | + */ | |
2217 | + debug("Unable to do a full power cycle. Disabling the UHS modes for safety\n"); | |
2218 | + uhs_en = false; | |
2219 | + mmc->host_caps &= ~UHS_CAPS; | |
2220 | + err = mmc_power_on(mmc); | |
2221 | + } | |
2209 | 2222 | if (err) |
2210 | 2223 | return err; |
2211 | 2224 |
-
mentioned in commit 94f69f