aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/omap.c
diff options
context:
space:
mode:
authorJarkko Lavinen <jarkko.lavinen@nokia.com>2008-03-26 16:10:02 -0400
committerPierre Ossman <drzeus@drzeus.cx>2008-04-18 14:05:31 -0400
commit9d7c6eee523c78b6ea4b56bd3927860d850616e5 (patch)
tree12e88c776370fc88956b08b8c204835324bc2686 /drivers/mmc/host/omap.c
parent0f602ec79ac4fd2a42075c5a170086ded439f36d (diff)
MMC: OMAP: Do not busy wait for end of command for ever
The limit was a fixed 100k limit in the busy loop, which is not accurate. It would better to have time limit for the worst case which occurs when sending 80 cycles at 400 kHz and takes about 200 microseconds, so limit the max time spend in the busy loop for some 250 microseconds. Signed-off-by: Jarkko Lavinen <jarkko.lavinen@nokia.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/host/omap.c')
-rw-r--r--drivers/mmc/host/omap.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index ab0974d261e5..14759e9f42ad 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1276,11 +1276,17 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
1276 OMAP_MMC_WRITE(host, CON, dsor); 1276 OMAP_MMC_WRITE(host, CON, dsor);
1277 slot->saved_con = dsor; 1277 slot->saved_con = dsor;
1278 if (ios->power_mode == MMC_POWER_ON) { 1278 if (ios->power_mode == MMC_POWER_ON) {
1279 /* worst case at 400kHz, 80 cycles makes 200 microsecs */
1280 int usecs = 250;
1281
1279 /* Send clock cycles, poll completion */ 1282 /* Send clock cycles, poll completion */
1280 OMAP_MMC_WRITE(host, IE, 0); 1283 OMAP_MMC_WRITE(host, IE, 0);
1281 OMAP_MMC_WRITE(host, STAT, 0xffff); 1284 OMAP_MMC_WRITE(host, STAT, 0xffff);
1282 OMAP_MMC_WRITE(host, CMD, 1 << 7); 1285 OMAP_MMC_WRITE(host, CMD, 1 << 7);
1283 while ((OMAP_MMC_READ(host, STAT) & 1) == 0); 1286 while (usecs > 0 && (OMAP_MMC_READ(host, STAT) & 1) == 0) {
1287 udelay(1);
1288 usecs--;
1289 }
1284 OMAP_MMC_WRITE(host, STAT, 1); 1290 OMAP_MMC_WRITE(host, STAT, 1);
1285 } 1291 }
1286 1292