aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@nokia.com>2009-03-12 11:08:26 -0400
committerPierre Ossman <drzeus@drzeus.cx>2009-03-24 16:30:07 -0400
commite13bb3003a33df8f82cd027f8abfa5cd73f2eec0 (patch)
tree4b4b47777c8a8a4243b00131f29f0a3bcf964d6e
parentf3e2f1dd3bbe9352654eec8223495d35e1f52af2 (diff)
omap_hsmmc: Wait for SDBP
It is necessary to wait for bus power before sending any commands. Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
-rw-r--r--drivers/mmc/host/omap_hsmmc.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 61883093e25b..488f222054f8 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -498,6 +498,19 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
498 return IRQ_HANDLED; 498 return IRQ_HANDLED;
499} 499}
500 500
501static void set_sd_bus_power(struct mmc_omap_host *host)
502{
503 unsigned long i;
504
505 OMAP_HSMMC_WRITE(host->base, HCTL,
506 OMAP_HSMMC_READ(host->base, HCTL) | SDBP);
507 for (i = 0; i < loops_per_jiffy; i++) {
508 if (OMAP_HSMMC_READ(host->base, HCTL) & SDBP)
509 break;
510 cpu_relax();
511 }
512}
513
501/* 514/*
502 * Switch MMC interface voltage ... only relevant for MMC1. 515 * Switch MMC interface voltage ... only relevant for MMC1.
503 * 516 *
@@ -554,9 +567,7 @@ static int omap_mmc_switch_opcond(struct mmc_omap_host *host, int vdd)
554 reg_val |= SDVS30; 567 reg_val |= SDVS30;
555 568
556 OMAP_HSMMC_WRITE(host->base, HCTL, reg_val); 569 OMAP_HSMMC_WRITE(host->base, HCTL, reg_val);
557 570 set_sd_bus_power(host);
558 OMAP_HSMMC_WRITE(host->base, HCTL,
559 OMAP_HSMMC_READ(host->base, HCTL) | SDBP);
560 571
561 return 0; 572 return 0;
562err: 573err:
@@ -942,8 +953,7 @@ static void omap_hsmmc_init(struct mmc_omap_host *host)
942 OMAP_HSMMC_WRITE(host->base, SYSCONFIG, value | AUTOIDLE); 953 OMAP_HSMMC_WRITE(host->base, SYSCONFIG, value | AUTOIDLE);
943 954
944 /* Set SD bus power bit */ 955 /* Set SD bus power bit */
945 value = OMAP_HSMMC_READ(host->base, HCTL); 956 set_sd_bus_power(host);
946 OMAP_HSMMC_WRITE(host->base, HCTL, value | SDBP);
947} 957}
948 958
949static struct mmc_host_ops mmc_omap_ops = { 959static struct mmc_host_ops mmc_omap_ops = {