Commit e0c7f99b authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Chris Ball

mmc: omap_hsmmc: introduce start_clock and re-use stop_clock

There is similar code in two functions which enable the clock.  Refactor
this code to omap_hsmmc_start_clock(). Re-use omap_hsmmc_stop_clock() in
omap_hsmmc_context_restore() as well.
Signed-off-by: default avatarAndy Shevchenko <ext-andriy.shevchenko@nokia.com>
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent ac330f44
...@@ -552,6 +552,15 @@ static void omap_hsmmc_gpio_free(struct omap_mmc_platform_data *pdata) ...@@ -552,6 +552,15 @@ static void omap_hsmmc_gpio_free(struct omap_mmc_platform_data *pdata)
gpio_free(pdata->slots[0].switch_pin); gpio_free(pdata->slots[0].switch_pin);
} }
/*
* Start clock to the card
*/
static void omap_hsmmc_start_clock(struct omap_hsmmc_host *host)
{
OMAP_HSMMC_WRITE(host->base, SYSCTL,
OMAP_HSMMC_READ(host->base, SYSCTL) | CEN);
}
/* /*
* Stop clock to the card * Stop clock to the card
*/ */
...@@ -693,8 +702,8 @@ static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host) ...@@ -693,8 +702,8 @@ static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)
break; break;
} }
OMAP_HSMMC_WRITE(host->base, SYSCTL, omap_hsmmc_stop_clock(host);
OMAP_HSMMC_READ(host->base, SYSCTL) & ~CEN);
OMAP_HSMMC_WRITE(host->base, SYSCTL, OMAP_HSMMC_WRITE(host->base, SYSCTL,
(calc_divisor(ios) << 6) | (DTO << 16)); (calc_divisor(ios) << 6) | (DTO << 16));
OMAP_HSMMC_WRITE(host->base, SYSCTL, OMAP_HSMMC_WRITE(host->base, SYSCTL,
...@@ -705,8 +714,7 @@ static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host) ...@@ -705,8 +714,7 @@ static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)
&& time_before(jiffies, timeout)) && time_before(jiffies, timeout))
; ;
OMAP_HSMMC_WRITE(host->base, SYSCTL, omap_hsmmc_start_clock(host);
OMAP_HSMMC_READ(host->base, SYSCTL) | CEN);
con = OMAP_HSMMC_READ(host->base, CON); con = OMAP_HSMMC_READ(host->base, CON);
if (ios->bus_mode == MMC_BUSMODE_OPENDRAIN) if (ios->bus_mode == MMC_BUSMODE_OPENDRAIN)
...@@ -1684,8 +1692,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ...@@ -1684,8 +1692,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
&& time_before(jiffies, timeout)) && time_before(jiffies, timeout))
msleep(1); msleep(1);
OMAP_HSMMC_WRITE(host->base, SYSCTL, omap_hsmmc_start_clock(host);
OMAP_HSMMC_READ(host->base, SYSCTL) | CEN);
if (do_send_init_stream) if (do_send_init_stream)
send_init_stream(host); send_init_stream(host);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment