Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 255233
b: refs/heads/master
c: 5934df2
h: refs/heads/master
i:
  255231: 76aa864
v: v3
  • Loading branch information
Andy Shevchenko authored and Chris Ball committed Jul 21, 2011
1 parent b4f22db commit 0a4f317
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 32 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e0c7f99b863b485ad0cde371ea1f62ec8ff70c5d
refs/heads/master: 5934df2f10a48d048fafe0d3c8b242a7c9106e69
59 changes: 28 additions & 31 deletions trunk/drivers/mmc/host/omap_hsmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,32 @@ static u16 calc_divisor(struct mmc_ios *ios)
return dsor;
}

static void omap_hsmmc_set_clock(struct omap_hsmmc_host *host)
{
struct mmc_ios *ios = &host->mmc->ios;
unsigned long regval;
unsigned long timeout;

dev_dbg(mmc_dev(host->mmc), "Set clock to %uHz\n", ios->clock);

omap_hsmmc_stop_clock(host);

regval = OMAP_HSMMC_READ(host->base, SYSCTL);
regval = regval & ~(CLKD_MASK | DTO_MASK);
regval = regval | (calc_divisor(ios) << 6) | (DTO << 16);
OMAP_HSMMC_WRITE(host->base, SYSCTL, regval);
OMAP_HSMMC_WRITE(host->base, SYSCTL,
OMAP_HSMMC_READ(host->base, SYSCTL) | ICE);

/* Wait till the ICS bit is set */
timeout = jiffies + msecs_to_jiffies(MMC_TIMEOUT_MS);
while ((OMAP_HSMMC_READ(host->base, SYSCTL) & ICS) != ICS
&& time_before(jiffies, timeout))
cpu_relax();

omap_hsmmc_start_clock(host);
}

#ifdef CONFIG_PM

/*
Expand Down Expand Up @@ -702,19 +728,7 @@ static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)
break;
}

omap_hsmmc_stop_clock(host);

OMAP_HSMMC_WRITE(host->base, SYSCTL,
(calc_divisor(ios) << 6) | (DTO << 16));
OMAP_HSMMC_WRITE(host->base, SYSCTL,
OMAP_HSMMC_READ(host->base, SYSCTL) | ICE);

timeout = jiffies + msecs_to_jiffies(MMC_TIMEOUT_MS);
while ((OMAP_HSMMC_READ(host->base, SYSCTL) & ICS) != ICS
&& time_before(jiffies, timeout))
;

omap_hsmmc_start_clock(host);
omap_hsmmc_set_clock(host);

con = OMAP_HSMMC_READ(host->base, CON);
if (ios->bus_mode == MMC_BUSMODE_OPENDRAIN)
Expand Down Expand Up @@ -1614,8 +1628,6 @@ static void omap_hsmmc_request(struct mmc_host *mmc, struct mmc_request *req)
static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
{
struct omap_hsmmc_host *host = mmc_priv(mmc);
unsigned long regval;
unsigned long timeout;
u32 con;
int do_send_init_stream = 0;

Expand Down Expand Up @@ -1677,22 +1689,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
}
}

omap_hsmmc_stop_clock(host);

regval = OMAP_HSMMC_READ(host->base, SYSCTL);
regval = regval & ~(CLKD_MASK);
regval = regval | (calc_divisor(ios) << 6) | (DTO << 16);
OMAP_HSMMC_WRITE(host->base, SYSCTL, regval);
OMAP_HSMMC_WRITE(host->base, SYSCTL,
OMAP_HSMMC_READ(host->base, SYSCTL) | ICE);

/* Wait till the ICS bit is set */
timeout = jiffies + msecs_to_jiffies(MMC_TIMEOUT_MS);
while ((OMAP_HSMMC_READ(host->base, SYSCTL) & ICS) != ICS
&& time_before(jiffies, timeout))
msleep(1);

omap_hsmmc_start_clock(host);
omap_hsmmc_set_clock(host);

if (do_send_init_stream)
send_init_stream(host);
Expand Down

0 comments on commit 0a4f317

Please sign in to comment.