mmc: tmio: always start clock after frequency calculation
Starting the clock is always done after frequency change anyhow, so we can do it directly after the clock calculation and remove the specific calls. This is the first part of doing proper clock de-/activation at calculation time. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
committed by
Ulf Hansson
parent
452e5eef6d
commit
7fbc030da8
@ -154,6 +154,18 @@ static void tmio_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
|
||||
}
|
||||
}
|
||||
|
||||
static void tmio_mmc_clk_start(struct tmio_mmc_host *host)
|
||||
{
|
||||
sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, CLK_CTL_SCLKEN |
|
||||
sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
|
||||
msleep(host->pdata->flags & TMIO_MMC_FAST_CLK_CHG ? 1 : 10);
|
||||
|
||||
if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG) {
|
||||
sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0100);
|
||||
msleep(10);
|
||||
}
|
||||
}
|
||||
|
||||
static void tmio_mmc_set_clock(struct tmio_mmc_host *host,
|
||||
unsigned int new_clock)
|
||||
{
|
||||
@ -182,6 +194,8 @@ static void tmio_mmc_set_clock(struct tmio_mmc_host *host,
|
||||
sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, clk & CLK_CTL_DIV_MASK);
|
||||
if (!(host->pdata->flags & TMIO_MMC_FAST_CLK_CHG))
|
||||
msleep(10);
|
||||
|
||||
tmio_mmc_clk_start(host);
|
||||
}
|
||||
|
||||
static void tmio_mmc_clk_stop(struct tmio_mmc_host *host)
|
||||
@ -196,18 +210,6 @@ static void tmio_mmc_clk_stop(struct tmio_mmc_host *host)
|
||||
msleep(host->pdata->flags & TMIO_MMC_FAST_CLK_CHG ? 5 : 10);
|
||||
}
|
||||
|
||||
static void tmio_mmc_clk_start(struct tmio_mmc_host *host)
|
||||
{
|
||||
sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, CLK_CTL_SCLKEN |
|
||||
sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL));
|
||||
msleep(host->pdata->flags & TMIO_MMC_FAST_CLK_CHG ? 1 : 10);
|
||||
|
||||
if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG) {
|
||||
sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0100);
|
||||
msleep(10);
|
||||
}
|
||||
}
|
||||
|
||||
static void tmio_mmc_reset(struct tmio_mmc_host *host)
|
||||
{
|
||||
/* FIXME - should we set stop clock reg here */
|
||||
@ -955,14 +957,12 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
|
||||
tmio_mmc_clk_stop(host);
|
||||
break;
|
||||
case MMC_POWER_UP:
|
||||
tmio_mmc_set_clock(host, ios->clock);
|
||||
tmio_mmc_power_on(host, ios->vdd);
|
||||
tmio_mmc_clk_start(host);
|
||||
tmio_mmc_set_clock(host, ios->clock);
|
||||
tmio_mmc_set_bus_width(host, ios->bus_width);
|
||||
break;
|
||||
case MMC_POWER_ON:
|
||||
tmio_mmc_set_clock(host, ios->clock);
|
||||
tmio_mmc_clk_start(host);
|
||||
tmio_mmc_set_bus_width(host, ios->bus_width);
|
||||
break;
|
||||
}
|
||||
@ -1271,10 +1271,8 @@ int tmio_mmc_host_runtime_resume(struct device *dev)
|
||||
tmio_mmc_reset(host);
|
||||
tmio_mmc_clk_enable(host);
|
||||
|
||||
if (host->clk_cache) {
|
||||
if (host->clk_cache)
|
||||
tmio_mmc_set_clock(host, host->clk_cache);
|
||||
tmio_mmc_clk_start(host);
|
||||
}
|
||||
|
||||
tmio_mmc_enable_dma(host, true);
|
||||
|
||||
|
Reference in New Issue
Block a user