mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/1] mci: bcm2835: support 8bit bus width
@ 2024-02-15 12:01 Pierre-Olivier Huard
  2024-02-16 12:01 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Pierre-Olivier Huard @ 2024-02-15 12:01 UTC (permalink / raw)
  To: barebox; +Cc: sebastien.bourdelin, a.fatoum, oss-contrib, Pierre-Olivier Huard

Using Raspberry Pi CM4s target generate a warning:

WARNING: bcm2835_mci fe340000.mmc@7e340000.of: Unsupported width received: 3
mmc0: mci_send_ext_csd failed with -5

Adding the support of 8 bits bus width resolve the issue.

Signed-off-by: Pierre-Olivier Huard <pierre-olivier.huard@rtone.fr>
---
 drivers/mci/mci-bcm2835.c | 7 +++++++
 drivers/mci/mci-bcm2835.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/drivers/mci/mci-bcm2835.c b/drivers/mci/mci-bcm2835.c
index 2b541e4c05..35cf0c4241 100644
--- a/drivers/mci/mci-bcm2835.c
+++ b/drivers/mci/mci-bcm2835.c
@@ -225,6 +225,13 @@ static void bcm2835_mci_set_ios(struct mci_host *mci, struct mci_ios *ios)
 			SDHCI_HOST_CONTROL__POWER_CONTROL__BLOCK_GAP_CONTROL);
 
 	switch (ios->bus_width) {
+	case MMC_BUS_WIDTH_8:
+		sdhci_write32(&host->sdhci,
+				SDHCI_HOST_CONTROL__POWER_CONTROL__BLOCK_GAP_CONTROL,
+				(current_val & ~CONTROL0_4DATA) | CONTROL0_8DATA);
+		host->bus_width = 2;
+		dev_dbg(host->hw_dev, "Changing bus width to 8\n");
+		break;
 	case MMC_BUS_WIDTH_4:
 		sdhci_write32(&host->sdhci,
 				SDHCI_HOST_CONTROL__POWER_CONTROL__BLOCK_GAP_CONTROL,
diff --git a/drivers/mci/mci-bcm2835.h b/drivers/mci/mci-bcm2835.h
index 608764c23d..71448642ad 100644
--- a/drivers/mci/mci-bcm2835.h
+++ b/drivers/mci/mci-bcm2835.h
@@ -10,6 +10,7 @@
 
 #define CONTROL0_HISPEED	(1 << 2)
 #define CONTROL0_4DATA		(1 << 1)
+#define CONTROL0_8DATA		(1 << 5)
 
 #define CONTROL1_DATARST	(1 << 26)
 #define CONTROL1_CMDRST		(1 << 25)
-- 
2.43.0




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-16 12:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-15 12:01 [PATCH 1/1] mci: bcm2835: support 8bit bus width Pierre-Olivier Huard
2024-02-16 12:01 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox