From patchwork Mon Aug 18 06:17:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gao, Yunpeng" X-Patchwork-Id: 4732481 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 34D0C9F37E for ; Mon, 18 Aug 2014 06:15:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6DF9A2011E for ; Mon, 18 Aug 2014 06:15:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 88FE02011D for ; Mon, 18 Aug 2014 06:15:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751872AbaHRGPT (ORCPT ); Mon, 18 Aug 2014 02:15:19 -0400 Received: from mga02.intel.com ([134.134.136.20]:65075 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750870AbaHRGPT (ORCPT ); Mon, 18 Aug 2014 02:15:19 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 17 Aug 2014 23:15:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,884,1400050800"; d="scan'208";a="589509247" Received: from spark-hp-compaq-8000-elite-cmt-pc.bj.intel.com ([172.16.181.71]) by orsmga002.jf.intel.com with ESMTP; 17 Aug 2014 23:15:17 -0700 From: Yunpeng Gao To: linux-mmc@vger.kernel.org Cc: Yunpeng Gao , Chuanxiao Dong Subject: [PATCH] mmc: core: optimize mmc device power up ramp up time Date: Mon, 18 Aug 2014 14:17:05 +0800 Message-Id: <1408342625-23720-1-git-send-email-yunpeng.gao@intel.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Chuanxiao Dong --- drivers/mmc/core/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); }