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: Joacim Zetterling <joacim.zetterling@westermo.com>,
	Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master] mci: sdhci: atmel: fix truncation when reading out caps
Date: Mon, 12 Feb 2024 16:45:51 +0100	[thread overview]
Message-ID: <20240212154551.2259925-1-a.fatoum@pengutronix.de> (raw)

The capability read out was changed a few years ago to use 32-bit
accessors, but the variable that it was stored in remained at 16-bit
leading to truncation of the upper bits and breaking detection of the
SD-Card on my SAMA5D27-SOM1-EK:

  ERROR: barebox-environment chosen:environment-sd.of: probe failed: No such file or directory

Fix this by using the appropriate type. The commit introducing the
regression touched multiple drivers, but the Atmel SDHCI one is the only
one which still used a 16-bit type.

Fixes: 1570f8d8d87e ("mci: sdhci: straighten capabilities register")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/mci/atmel-sdhci-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mci/atmel-sdhci-common.c b/drivers/mci/atmel-sdhci-common.c
index 171737ab01d4..a69d6b67b551 100644
--- a/drivers/mci/atmel-sdhci-common.c
+++ b/drivers/mci/atmel-sdhci-common.c
@@ -39,7 +39,7 @@ static inline struct at91_sdhci *to_priv(struct sdhci *sdhci)
 void at91_sdhci_host_capability(struct at91_sdhci *host,
 				unsigned *voltages)
 {
-	u16 caps;
+	u32 caps;
 
 	caps = sdhci_read32(&host->sdhci, SDHCI_CAPABILITIES);
 
-- 
2.39.2




             reply	other threads:[~2024-02-12 15:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12 15:45 Ahmad Fatoum [this message]
2024-02-13  9:19 ` 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=20240212154551.2259925-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=joacim.zetterling@westermo.com \
    /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