[PATCH master] mci: sdhci: atmel: fix truncation when reading out caps

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Feb 12 07:45:51 PST 2024


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




More information about the barebox mailing list