From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org, str@pengutronix.de, mtr@pengutronix.de
Subject: Re: [PATCH master 1/3] mci: core: fix fallback when eMMC DDR52 is not possible
Date: Tue, 23 Apr 2024 08:44:42 +0200 [thread overview]
Message-ID: <ZidY2gPIldO_pfIk@pengutronix.de> (raw)
In-Reply-To: <20240423062206.1518464-1-a.fatoum@pengutronix.de>
On Tue, Apr 23, 2024 at 08:22:04AM +0200, Ahmad Fatoum wrote:
> mci_mmc_select_hs_ddr() will try DDR52 and if that fails, revert to
> SDR operation. In that case, it returns the bus width, which would
> be forwarded as if it were an error code:
>
> WARNING: mmc2: Card's startup fails with 3
>
> Fix this by translating successful return values to 0 in
> mci_startup_mmc().
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> drivers/mci/mci-core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index 1d383e6449e9..57b4c5b99c9c 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -1566,7 +1566,7 @@ static int mci_startup_mmc(struct mci *mci)
> }
> }
>
> - return ret;
> + return ret >= MMC_BUS_WIDTH_1 ? 0 : ret;
> }
Can we do it like below instead? It makes clear where a MMC_BUS_WIDTH_x
return value is expected.
Sascha
----------------------------------8<---------------------------
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 083d2f4ed1..da892a5f84 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1558,8 +1558,12 @@ static int mci_startup_mmc(struct mci *mci)
/* find out maximum bus width and then try DDR if supported */
ret = mci_mmc_select_bus_width(mci);
- if (ret > MMC_BUS_WIDTH_1 && mci->tran_speed == 52000000)
- ret = mci_mmc_select_hs_ddr(mci);
+ if (ret > MMC_BUS_WIDTH_1) {
+ ret = 0;
+
+ if (mci->tran_speed == 52000000)
+ ret = mci_mmc_select_hs_ddr(mci);
+ }
if (ret < 0) {
dev_warn(&mci->dev, "Changing MMC bus width failed: %d\n", ret);
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2024-04-23 6:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 6:22 Ahmad Fatoum
2024-04-23 6:22 ` [PATCH master 2/3] mci: core: fix fallback when host doesn't support HS200 Ahmad Fatoum
2024-04-23 6:22 ` [PATCH master 3/3] mci: core: make execute_tuning mandatory for HS200 Ahmad Fatoum
2024-04-23 6:44 ` Sascha Hauer [this message]
2024-04-23 6:52 ` [PATCH master 1/3] mci: core: fix fallback when eMMC DDR52 is not possible Ahmad Fatoum
2024-04-30 5:44 ` 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=ZidY2gPIldO_pfIk@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=mtr@pengutronix.de \
--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