mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] mci: core: don't fail MMC probe if HS200 isn't supported in HW
@ 2024-04-15  5:27 Ahmad Fatoum
  2024-04-16 11:10 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2024-04-15  5:27 UTC (permalink / raw)
  To: barebox; +Cc: str, Ahmad Fatoum

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH master] mci: core: don't fail MMC probe if HS200 isn't supported in HW
  2024-04-15  5:27 [PATCH master] mci: core: don't fail MMC probe if HS200 isn't supported in HW Ahmad Fatoum
@ 2024-04-16 11:10 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-04-16 11:10 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum; +Cc: str


On Mon, 15 Apr 2024 07:27:34 +0200, Ahmad Fatoum wrote:
> 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
> 
> [...]

Applied, thanks!

[1/1] mci: core: don't fail MMC probe if HS200 isn't supported in HW
      https://git.pengutronix.de/cgit/barebox/commit/?id=75d6a1ce692d (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-16 11:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-15  5:27 [PATCH master] mci: core: don't fail MMC probe if HS200 isn't supported in HW Ahmad Fatoum
2024-04-16 11:10 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox