[PATCH master] mci: core: don't fail MMC probe if HS200 isn't supported in HW

Ahmad Fatoum a.fatoum at pengutronix.de
Sun Apr 14 22:27:34 PDT 2024


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 at pengutronix.de>
---
 drivers/mci/mci-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 6b4acebaecd0..6d4abe321bfa 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;
 
-- 
2.39.2




More information about the barebox mailing list