summaryrefslogtreecommitdiffstats
path: root/drivers/mci
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2018-07-25 11:57:28 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-08-09 08:19:50 +0200
commit77f3378135f15c1c5c7e091731b6375d6d8ff423 (patch)
treee43094dc5d9a4366f6456239567eb05bdb0acd97 /drivers/mci
parent107ac101928f6b28ec69b02dd76861a175501865 (diff)
downloadbarebox-77f3378135f15c1c5c7e091731b6375d6d8ff423.tar.gz
barebox-77f3378135f15c1c5c7e091731b6375d6d8ff423.tar.xz
mci: imx-esdhc: send required clock pulses to card on init
MMC cards need at least 74 clock pulses before any bus communication can occur. The i.MX SDHC controller auto-gates the clock when inactive, so if the SD enumeration is skipped for slots where we know that only a MMC card can be present (which is possible since b5289b742a89 "mmc: allow skipping SD card initialization") those inititialization clock pulses won't be sent out, resulting in command timeouts when trying to enumerate the card. Luckily the eSDHC controller has a hardware feature to send out 80 clock pulses. This has been validated to be available by checking the reference manual back to i.MX25. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mci')
-rw-r--r--drivers/mci/imx-esdhc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
index c4daa9d121..db96a81397 100644
--- a/drivers/mci/imx-esdhc.c
+++ b/drivers/mci/imx-esdhc.c
@@ -455,10 +455,13 @@ static void set_sysctl(struct mci_host *mci, u32 clock)
wait_on_timeout(10 * MSECOND,
esdhc_read32(regs + SDHCI_PRESENT_STATE) & PRSSTAT_SDSTB);
- clk = SYSCTL_PEREN | SYSCTL_CKEN;
+ clk = SYSCTL_PEREN | SYSCTL_CKEN | SYSCTL_INITA;
esdhc_setbits32(regs + SDHCI_CLOCK_CONTROL__TIMEOUT_CONTROL__SOFTWARE_RESET,
clk);
+
+ wait_on_timeout(1 * MSECOND,
+ !(esdhc_read32(regs + SDHCI_CLOCK_CONTROL) & SYSCTL_INITA));
}
static void esdhc_set_ios(struct mci_host *mci, struct mci_ios *ios)