diff mbox

mmc: core: optimize mmc device power up ramp up time

Message ID 1408342625-23720-1-git-send-email-yunpeng.gao@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gao, Yunpeng Aug. 18, 2014, 6:17 a.m. UTC
In current kernel mmc driver, it uses two 'msleep(10)'
for eMMC/SD card power up ramp up time delay.

According to Spec, the ramp up time should be max of 74
eMMC/SD bus clock or 1ms.
Take the worst eMMC/SD card I can image as the example -
assume it has to work on 32KHz or 16KHz during the card initialzation,
then 74 clock should be 2.312ms or 4.625ms.
So, 5ms delay should be enough.

Also, msleep(10) will invlove sechdule and may consume
more time than what we expected.
Measured on Merrifield platform showed it consumed almost
2*20 = 40ms. This is much more than what we expected.

Submit this patch to reduce the time of mmc boot up and
the time of mmc D3 resume.

Signed-off-by: Yunpeng Gao <yunpeng.gao@intel.com>
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
---
 drivers/mmc/core/core.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 7dc0c85..7bcb797 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1556,7 +1556,7 @@  void mmc_power_up(struct mmc_host *host, u32 ocr)
 	 * This delay should be sufficient to allow the power supply
 	 * to reach the minimum voltage.
 	 */
-	mmc_delay(10);
+	usleep_range(10000, 12000);
 
 	host->ios.clock = host->f_init;
 
@@ -1567,7 +1567,7 @@  void mmc_power_up(struct mmc_host *host, u32 ocr)
 	 * This delay must be at least 74 clock sizes, or 1 ms, or the
 	 * time required to reach a stable voltage.
 	 */
-	mmc_delay(10);
+	usleep_range(5000, 6000);
 
 	mmc_host_clk_release(host);
 }