mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <ahmad@a3f.at>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v2 1/6] mci: stm32_sdmmc2: parse generic MCI oftree properties
Date: Mon, 28 Oct 2019 22:39:38 +0100	[thread overview]
Message-ID: <20191028213943.32071-2-ahmad@a3f.at> (raw)
In-Reply-To: <20191028213943.32071-1-ahmad@a3f.at>

From: Ahmad Fatoum <a.fatoum@pengutronix.de>

mci_of_parse takes care of the generic oftree bits, like removable flag,
aliases and max-frequency. Insert it, so we can start to refer to the
controller's block devices by a fixed name.

Sticking in the mci_of_parse shows that the SD/MMC2 driver in barebox
doesn't play nicely with the device tree specification of the SD/MMC2
for the dk2 board, however:

Specifying the bus-width = <4> property in the device tree now made mmc
usage fail when reading the environment:

  ERROR: error SDMMC_STA_DCRCFAIL (0x81042) for cmd 18
  ERROR: stm32_sdmmc2_end_cmd: error SDMMC_STA_CTIMEOUT (0x4) for cmd 12
  WARNING: stm32_sdmmc2_send_cmd: cmd 12 failed, retrying ...
  ERROR: stm32_sdmmc2_end_cmd: error SDMMC_STA_CTIMEOUT (0x4) for cmd 12
  WARNING: stm32_sdmmc2_send_cmd: cmd 12 failed, retrying ...
  ERROR: stm32_sdmmc2_end_cmd: error SDMMC_STA_CTIMEOUT (0x4) for cmd 12
  WARNING: stm32_sdmmc2_send_cmd: cmd 12 failed, retrying ...
  ERROR: stm32_sdmmc2_end_cmd: error SDMMC_STA_CTIMEOUT (0x4) for cmd 12

We'll want to fix this eventually, but for now force the bus width to 1.
So we don't forget about this, print a notice to the console that we've
done so.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/mci/stm32_sdmmc2.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/mci/stm32_sdmmc2.c b/drivers/mci/stm32_sdmmc2.c
index 7346c8a3f5d6..1a41c34d24e2 100644
--- a/drivers/mci/stm32_sdmmc2.c
+++ b/drivers/mci/stm32_sdmmc2.c
@@ -632,6 +632,13 @@ static int stm32_sdmmc2_probe(struct amba_device *adev,
 	mci->f_max = 208000000;
 	mci->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
 
+	mci_of_parse(&priv->mci);
+
+	if (mci->host_caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
+		dev_notice(dev, "Fixing bus-width to 1 due to driver limitation\n");
+		mci->host_caps &= ~(MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA);
+	}
+
 	return mci_register(&priv->mci);
 
 priv_free:
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2019-10-28 21:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 21:39 [PATCH v2 0/6] ARM: stm32mp: finalize second stage support Ahmad Fatoum
2019-10-28 21:39 ` Ahmad Fatoum [this message]
2019-10-28 21:39 ` [PATCH v2 2/6] ARM: stm32mp: dk2: add barebox SD-Card update handler Ahmad Fatoum
2019-10-28 21:39 ` [PATCH v2 3/6] net: add Designware Ethernet QoS for STM32MP Ahmad Fatoum
2019-10-28 21:39 ` [PATCH v2 4/6] net: eqos: extend Designware Ethernet QoS for Tegra 186 support Ahmad Fatoum
2019-10-28 21:39 ` [PATCH v2 5/6] ARM: stm32mp: include new drivers in defconfig Ahmad Fatoum
2019-10-28 21:39 ` [PATCH v2 6/6] Documentation: boards: stm32mp: remove done TODOs Ahmad Fatoum
2019-11-04  8:04 ` [PATCH v2 0/6] ARM: stm32mp: finalize second stage support 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=20191028213943.32071-2-ahmad@a3f.at \
    --to=ahmad@a3f.at \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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