mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Pierre-Olivier Huard <pierre-olivier.huard@rtone.fr>
To: barebox@lists.infradead.org
Cc: sebastien.bourdelin@rtone.fr, a.fatoum@pengutronix.de,
	oss-contrib@rtone.fr,
	Pierre-Olivier Huard <pierre-olivier.huard@rtone.fr>
Subject: [PATCH 1/1] mci: bcm2835: support 8bit bus width
Date: Thu, 15 Feb 2024 13:01:39 +0100	[thread overview]
Message-ID: <20240215120139.23881-1-pierre-olivier.huard@rtone.fr> (raw)

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




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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15 12:01 Pierre-Olivier Huard [this message]
2024-02-16 12:01 ` 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=20240215120139.23881-1-pierre-olivier.huard@rtone.fr \
    --to=pierre-olivier.huard@rtone.fr \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=oss-contrib@rtone.fr \
    --cc=sebastien.bourdelin@rtone.fr \
    /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