summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2024-04-15 07:27:34 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2024-04-16 13:10:34 +0200
commit75d6a1ce692d6c0645802e3e96f6c648f29d0c99 (patch)
tree386129b35249d8527539f68f8db2fb19963f0cd9
parent7358ef660dc4a7c5e390ddb56811f09a0696d3e4 (diff)
downloadbarebox-75d6a1ce692d6c0645802e3e96f6c648f29d0c99.tar.gz
barebox-75d6a1ce692d6c0645802e3e96f6c648f29d0c99.tar.xz
mci: core: don't fail MMC probe if HS200 isn't supported in HW
A MMC may support HS200 in theory, but it's unusable due to I/O voltage. Unlike Linux, barebox doesn't check the I/O voltage, so it will attempt enabling HS200 and get told no by the card. This no currently triggered a failure of the probe: mmc1: detected MMC card version 5.0 ERROR: mmc1: mmc_select_hs200 failed, error -5 WARNING: mmc1: Card's startup fails with -5 Cannot set parameter mmc1.probe: I/O error But the correct behavior should be attempting the next speed mode. -EBADMSG is the error code used to indicate this, so return that instead when switching to EXT_CSD_TIMING_HS200 fails, because the card couldn't. This is returned directly as to skip the error message in the err case, which would just be confusing. Fixes: ffa59e16bb96 ("mci: mci-core: add HS200 support") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240415052734.366242-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/mci/mci-core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 78c65c8614..a3b25ea01a 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1434,6 +1434,8 @@ static int mmc_select_hs200(struct mci *mci)
/* TODO actually set drive strength instead of 0. Currently unsupported. */
val = EXT_CSD_TIMING_HS200 | 0 << EXT_CSD_DRV_STR_SHIFT;
err = mci_switch(mci, EXT_CSD_HS_TIMING, val);
+ if (err == -EIO)
+ return -EBADMSG;
if (err)
goto err;