[PATCH 1/1] mci: bcm2835: support 8bit bus width
Pierre-Olivier Huard
pierre-olivier.huard at rtone.fr
Thu Feb 15 04:01:39 PST 2024
Using Raspberry Pi CM4s target generate a warning:
WARNING: bcm2835_mci fe340000.mmc at 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 at 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
More information about the barebox
mailing list