mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: str@pengutronix.de, Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master] mci: core: don't fail MMC probe if HS200 isn't supported in HW
Date: Mon, 15 Apr 2024 07:27:34 +0200	[thread overview]
Message-ID: <20240415052734.366242-1-a.fatoum@pengutronix.de> (raw)

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




             reply	other threads:[~2024-04-15  5:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15  5:27 Ahmad Fatoum [this message]
2024-04-16 11:10 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240415052734.366242-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=str@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox