|
@@ -133,7 +133,7 @@ void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq)
|
|
if (mrq->done)
|
|
if (mrq->done)
|
|
mrq->done(mrq);
|
|
mrq->done(mrq);
|
|
|
|
|
|
- mmc_host_clk_gate(host);
|
|
|
|
|
|
+ mmc_host_clk_release(host);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -192,7 +192,7 @@ mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
|
|
mrq->stop->mrq = mrq;
|
|
mrq->stop->mrq = mrq;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- mmc_host_clk_ungate(host);
|
|
|
|
|
|
+ mmc_host_clk_hold(host);
|
|
led_trigger_event(host->led, LED_FULL);
|
|
led_trigger_event(host->led, LED_FULL);
|
|
host->ops->request(host, mrq);
|
|
host->ops->request(host, mrq);
|
|
}
|
|
}
|
|
@@ -728,15 +728,17 @@ static inline void mmc_set_ios(struct mmc_host *host)
|
|
*/
|
|
*/
|
|
void mmc_set_chip_select(struct mmc_host *host, int mode)
|
|
void mmc_set_chip_select(struct mmc_host *host, int mode)
|
|
{
|
|
{
|
|
|
|
+ mmc_host_clk_hold(host);
|
|
host->ios.chip_select = mode;
|
|
host->ios.chip_select = mode;
|
|
mmc_set_ios(host);
|
|
mmc_set_ios(host);
|
|
|
|
+ mmc_host_clk_release(host);
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
* Sets the host clock to the highest possible frequency that
|
|
* Sets the host clock to the highest possible frequency that
|
|
* is below "hz".
|
|
* is below "hz".
|
|
*/
|
|
*/
|
|
-void mmc_set_clock(struct mmc_host *host, unsigned int hz)
|
|
|
|
|
|
+static void __mmc_set_clock(struct mmc_host *host, unsigned int hz)
|
|
{
|
|
{
|
|
WARN_ON(hz < host->f_min);
|
|
WARN_ON(hz < host->f_min);
|
|
|
|
|
|
@@ -747,6 +749,13 @@ void mmc_set_clock(struct mmc_host *host, unsigned int hz)
|
|
mmc_set_ios(host);
|
|
mmc_set_ios(host);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void mmc_set_clock(struct mmc_host *host, unsigned int hz)
|
|
|
|
+{
|
|
|
|
+ mmc_host_clk_hold(host);
|
|
|
|
+ __mmc_set_clock(host, hz);
|
|
|
|
+ mmc_host_clk_release(host);
|
|
|
|
+}
|
|
|
|
+
|
|
#ifdef CONFIG_MMC_CLKGATE
|
|
#ifdef CONFIG_MMC_CLKGATE
|
|
/*
|
|
/*
|
|
* This gates the clock by setting it to 0 Hz.
|
|
* This gates the clock by setting it to 0 Hz.
|
|
@@ -779,7 +788,7 @@ void mmc_ungate_clock(struct mmc_host *host)
|
|
if (host->clk_old) {
|
|
if (host->clk_old) {
|
|
BUG_ON(host->ios.clock);
|
|
BUG_ON(host->ios.clock);
|
|
/* This call will also set host->clk_gated to false */
|
|
/* This call will also set host->clk_gated to false */
|
|
- mmc_set_clock(host, host->clk_old);
|
|
|
|
|
|
+ __mmc_set_clock(host, host->clk_old);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -807,8 +816,10 @@ void mmc_set_ungated(struct mmc_host *host)
|
|
*/
|
|
*/
|
|
void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode)
|
|
void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode)
|
|
{
|
|
{
|
|
|
|
+ mmc_host_clk_hold(host);
|
|
host->ios.bus_mode = mode;
|
|
host->ios.bus_mode = mode;
|
|
mmc_set_ios(host);
|
|
mmc_set_ios(host);
|
|
|
|
+ mmc_host_clk_release(host);
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -816,8 +827,10 @@ void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode)
|
|
*/
|
|
*/
|
|
void mmc_set_bus_width(struct mmc_host *host, unsigned int width)
|
|
void mmc_set_bus_width(struct mmc_host *host, unsigned int width)
|
|
{
|
|
{
|
|
|
|
+ mmc_host_clk_hold(host);
|
|
host->ios.bus_width = width;
|
|
host->ios.bus_width = width;
|
|
mmc_set_ios(host);
|
|
mmc_set_ios(host);
|
|
|
|
+ mmc_host_clk_release(host);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1015,8 +1028,10 @@ u32 mmc_select_voltage(struct mmc_host *host, u32 ocr)
|
|
|
|
|
|
ocr &= 3 << bit;
|
|
ocr &= 3 << bit;
|
|
|
|
|
|
|
|
+ mmc_host_clk_hold(host);
|
|
host->ios.vdd = bit;
|
|
host->ios.vdd = bit;
|
|
mmc_set_ios(host);
|
|
mmc_set_ios(host);
|
|
|
|
+ mmc_host_clk_release(host);
|
|
} else {
|
|
} else {
|
|
pr_warning("%s: host doesn't support card's voltages\n",
|
|
pr_warning("%s: host doesn't support card's voltages\n",
|
|
mmc_hostname(host));
|
|
mmc_hostname(host));
|
|
@@ -1063,8 +1078,10 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage, bool cmd11
|
|
*/
|
|
*/
|
|
void mmc_set_timing(struct mmc_host *host, unsigned int timing)
|
|
void mmc_set_timing(struct mmc_host *host, unsigned int timing)
|
|
{
|
|
{
|
|
|
|
+ mmc_host_clk_hold(host);
|
|
host->ios.timing = timing;
|
|
host->ios.timing = timing;
|
|
mmc_set_ios(host);
|
|
mmc_set_ios(host);
|
|
|
|
+ mmc_host_clk_release(host);
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -1072,8 +1089,10 @@ void mmc_set_timing(struct mmc_host *host, unsigned int timing)
|
|
*/
|
|
*/
|
|
void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type)
|
|
void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type)
|
|
{
|
|
{
|
|
|
|
+ mmc_host_clk_hold(host);
|
|
host->ios.drv_type = drv_type;
|
|
host->ios.drv_type = drv_type;
|
|
mmc_set_ios(host);
|
|
mmc_set_ios(host);
|
|
|
|
+ mmc_host_clk_release(host);
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -1091,6 +1110,8 @@ static void mmc_power_up(struct mmc_host *host)
|
|
{
|
|
{
|
|
int bit;
|
|
int bit;
|
|
|
|
|
|
|
|
+ mmc_host_clk_hold(host);
|
|
|
|
+
|
|
/* If ocr is set, we use it */
|
|
/* If ocr is set, we use it */
|
|
if (host->ocr)
|
|
if (host->ocr)
|
|
bit = ffs(host->ocr) - 1;
|
|
bit = ffs(host->ocr) - 1;
|
|
@@ -1126,10 +1147,14 @@ static void mmc_power_up(struct mmc_host *host)
|
|
* time required to reach a stable voltage.
|
|
* time required to reach a stable voltage.
|
|
*/
|
|
*/
|
|
mmc_delay(10);
|
|
mmc_delay(10);
|
|
|
|
+
|
|
|
|
+ mmc_host_clk_release(host);
|
|
}
|
|
}
|
|
|
|
|
|
static void mmc_power_off(struct mmc_host *host)
|
|
static void mmc_power_off(struct mmc_host *host)
|
|
{
|
|
{
|
|
|
|
+ mmc_host_clk_hold(host);
|
|
|
|
+
|
|
host->ios.clock = 0;
|
|
host->ios.clock = 0;
|
|
host->ios.vdd = 0;
|
|
host->ios.vdd = 0;
|
|
|
|
|
|
@@ -1147,6 +1172,8 @@ static void mmc_power_off(struct mmc_host *host)
|
|
host->ios.bus_width = MMC_BUS_WIDTH_1;
|
|
host->ios.bus_width = MMC_BUS_WIDTH_1;
|
|
host->ios.timing = MMC_TIMING_LEGACY;
|
|
host->ios.timing = MMC_TIMING_LEGACY;
|
|
mmc_set_ios(host);
|
|
mmc_set_ios(host);
|
|
|
|
+
|
|
|
|
+ mmc_host_clk_release(host);
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|