From patchwork Tue Aug 12 08:19:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gao, Yunpeng" X-Patchwork-Id: 4711861 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 2BD239F38D for ; Tue, 12 Aug 2014 08:17:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6078E2011D for ; Tue, 12 Aug 2014 08:17:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 770852011B for ; Tue, 12 Aug 2014 08:17:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752162AbaHLIRs (ORCPT ); Tue, 12 Aug 2014 04:17:48 -0400 Received: from mga14.intel.com ([192.55.52.115]:11680 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751807AbaHLIRr (ORCPT ); Tue, 12 Aug 2014 04:17:47 -0400 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 12 Aug 2014 01:10:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="371254141" Received: from spark-hp-compaq-8000-elite-cmt-pc.bj.intel.com ([172.16.181.71]) by FMSMGA003.fm.intel.com with ESMTP; 12 Aug 2014 01:14:30 -0700 From: Yunpeng Gao To: linux-mmc@vger.kernel.org Cc: Chuanxiao Dong , Yunpeng Gao Subject: [PATCH] mmc: sdhci: use udelay instead of mdelay Date: Tue, 12 Aug 2014 16:19:28 +0800 Message-Id: <1407831568-23862-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 From: Chuanxiao Dong This patch uses udelay instead of mdelay when waiting for SDHC hardware to be stable. udelay can help to reduce the waiting time when is in critical region which is protected by spinlock. Signed-off-by: Yunpeng Gao Signed-off-by: Chuanxiao Dong --- drivers/mmc/host/sdhci.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 47055f3..74d8c42 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -179,7 +179,7 @@ void sdhci_reset(struct sdhci_host *host, u8 mask) } /* Wait max 100 ms */ - timeout = 100; + timeout = 10000; /* hw clears the bit when it's done */ while (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & mask) { @@ -190,7 +190,7 @@ void sdhci_reset(struct sdhci_host *host, u8 mask) return; } timeout--; - mdelay(1); + udelay(10); } } EXPORT_SYMBOL_GPL(sdhci_reset); @@ -975,7 +975,7 @@ void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) WARN_ON(host->cmd); /* Wait max 10 ms */ - timeout = 10; + timeout = 1000; mask = SDHCI_CMD_INHIBIT; if ((cmd->data != NULL) || (cmd->flags & MMC_RSP_BUSY)) @@ -996,7 +996,7 @@ void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) return; } timeout--; - mdelay(1); + udelay(10); } timeout = jiffies; @@ -1202,7 +1202,7 @@ clock_set: sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); /* Wait max 20 ms */ - timeout = 20; + timeout = 2000; while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL)) & SDHCI_CLOCK_INT_STABLE)) { if (timeout == 0) { @@ -1212,7 +1212,7 @@ clock_set: return; } timeout--; - mdelay(1); + udelay(10); } clk |= SDHCI_CLOCK_CARD_EN;