mmc: core: Add mmc_power_cycle
authorJohan Rudholm <johan.rudholm@stericsson.com>
Mon, 28 Jan 2013 14:08:25 +0000 (15:08 +0100)
committerChris Ball <cjb@laptop.org>
Sun, 24 Feb 2013 19:37:06 +0000 (14:37 -0500)
Add mmc_power_cycle which can be used to power cycle for instance
SD-cards.

Signed-off-by: Johan Rudholm <johan.rudholm@stericsson.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Wei WANG <wei_wang@realsil.com.cn>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/core/core.c
drivers/mmc/core/core.h

index 39f28af34cb653475d8f9621d4b4606113a1c423..789056fbfc9333a692dd72d917a065f45bbf9e00 100644 (file)
@@ -1470,6 +1470,14 @@ void mmc_power_off(struct mmc_host *host)
        mmc_host_clk_release(host);
 }
 
+void mmc_power_cycle(struct mmc_host *host)
+{
+       mmc_power_off(host);
+       /* Wait at least 1 ms according to SD spec */
+       mmc_delay(1);
+       mmc_power_up(host);
+}
+
 /*
  * Cleanup when the last reference to the bus operator is dropped.
  */
index 0272b3284b5efcb4d659e90d32ec1d41fb2ce78a..9007de74d8a9cab7c62b4a98c8bc92a80d113719 100644 (file)
@@ -45,6 +45,7 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage,
 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_power_off(struct mmc_host *host);
+void mmc_power_cycle(struct mmc_host *host);
 
 static inline void mmc_delay(unsigned int ms)
 {