aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2013-09-04 04:01:15 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2013-09-19 15:12:24 -0400
commitf829c04204de83aa0d13307d2a2dc07c0d9a94e3 (patch)
tree01e7b3ee30568491cc461c1c36ac6adef591388a
parente36bd9c6c99f47902d6fd6804730aa587ae275a0 (diff)
ARM: 7833/1: mmc: mmci: Adapt to register write restrictions
After a write to the MMCICLOCK register data cannot be written to this register for three feedback clock cycles. Writes to the MMCIPOWER register must be separated by three MCLK cycles. Previously no issues has been observered, but using higher ARM clock frequencies on STE- platforms has triggered this problem. The MMCICLOCK register is written to in .set_ios and for some data transmissions for SDIO. We do not need a delay at the data transmission path, because sending and receiving data will require more than three clock cycles. Then we use a simple logic to only delay in .set_ios and thus we don't affect throughput performance. Signed-off-by: Johan Rudholm <jrudholm@gmail.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Rickard Andersson <rickard.andersson@stericsson.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--drivers/mmc/host/mmci.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index c550b3ebb635..604e41db00db 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -189,6 +189,21 @@ static int mmci_validate_data(struct mmci_host *host,
189 return 0; 189 return 0;
190} 190}
191 191
192static void mmci_reg_delay(struct mmci_host *host)
193{
194 /*
195 * According to the spec, at least three feedback clock cycles
196 * of max 52 MHz must pass between two writes to the MMCICLOCK reg.
197 * Three MCLK clock cycles must pass between two MMCIPOWER reg writes.
198 * Worst delay time during card init is at 100 kHz => 30 us.
199 * Worst delay time when up and running is at 25 MHz => 120 ns.
200 */
201 if (host->cclk < 25000000)
202 udelay(30);
203 else
204 ndelay(120);
205}
206
192/* 207/*
193 * This must be called with host->lock held 208 * This must be called with host->lock held
194 */ 209 */
@@ -1264,6 +1279,7 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
1264 1279
1265 mmci_set_clkreg(host, ios->clock); 1280 mmci_set_clkreg(host, ios->clock);
1266 mmci_write_pwrreg(host, pwr); 1281 mmci_write_pwrreg(host, pwr);
1282 mmci_reg_delay(host);
1267 1283
1268 spin_unlock_irqrestore(&host->lock, flags); 1284 spin_unlock_irqrestore(&host->lock, flags);
1269 1285