From: Heiner Kallweit <hkallweit1@gmail.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Subject: [PATCH] mmc: core: improve fallback in mmc_select_timing()
Date: Fri, 18 Feb 2022 08:00:45 +0100 [thread overview]
Message-ID: <fae9ee4b-6b93-95ac-abf3-f97c62e07b9d@gmail.com> (raw)
I have a system (cheap Amlogic S905W based TV box) where the eMMC chip
refuses to switch to HS200 timing. That's not nice, but my bigger
problem is that the system then falls back to the very slow default
mode, even though DDR52 is supported and works well.
Therefore, if setting a mode fails with EBADMSG (switch error), try the
next (in descending performance order) mode instead of immediately
falling back to the slowest mode.
With the patch it looks like this on my system:
mmc1: mmc_select_hs200 failed, error -74
mmc1: new DDR MMC card at address 0001
mmcblk1: mmc1:0001 DG4008 7.28 GiB
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/mmc/core/mmc.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index bbbbcaf70..c0272192d 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1523,11 +1523,23 @@ static int mmc_select_timing(struct mmc_card *card)
if (!mmc_can_ext_csd(card))
goto bus_speed;
- if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES)
+ if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES) {
err = mmc_select_hs400es(card);
- else if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200)
+ if (!err)
+ goto bus_speed;
+ if (err != -EBADMSG)
+ return err;
+ }
+
+ if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200) {
err = mmc_select_hs200(card);
- else if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS)
+ if (!err)
+ goto bus_speed;
+ if (err != -EBADMSG)
+ return err;
+ }
+
+ if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS)
err = mmc_select_hs(card);
if (err && err != -EBADMSG)
--
2.35.1
next reply other threads:[~2022-02-18 7:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-18 7:00 Heiner Kallweit [this message]
2022-03-01 13:50 ` [PATCH] mmc: core: improve fallback in mmc_select_timing() Ulf Hansson
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=fae9ee4b-6b93-95ac-abf3-f97c62e07b9d@gmail.com \
--to=hkallweit1@gmail.com \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.