From patchwork Thu Feb 24 11:19:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chuanxiao.Dong" X-Patchwork-Id: 587281 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1OBQBKJ021522 for ; Thu, 24 Feb 2011 11:26:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756167Ab1BXL0j (ORCPT ); Thu, 24 Feb 2011 06:26:39 -0500 Received: from mga09.intel.com ([134.134.136.24]:39663 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756073Ab1BXL0i (ORCPT ); Thu, 24 Feb 2011 06:26:38 -0500 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 24 Feb 2011 03:26:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.62,216,1297065600"; d="scan'208";a="606074906" Received: from cdong3-fc.bj.intel.com (HELO intel.com) ([172.16.120.198]) by orsmga002.jf.intel.com with ESMTP; 24 Feb 2011 03:26:36 -0800 Date: Thu, 24 Feb 2011 19:19:35 +0800 From: Chuanxiao Dong To: linux-mmc@vger.kernel.org, cjb@laptop.org Cc: linux-kernel@vger.kernel.org, arnd@arndb.de Subject: [PATCH 1/1]mmc: set timeout for SDHCI host before sending busy cmd Message-ID: <20110224111935.GB7169@intel.com> Reply-To: Chuanxiao Dong MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 24 Feb 2011 11:26:40 +0000 (UTC) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 9e15f41..32b7475 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -40,7 +40,6 @@ static unsigned int debug_quirks = 0; -static void sdhci_prepare_data(struct sdhci_host *, struct mmc_data *); static void sdhci_finish_data(struct sdhci_host *); static void sdhci_send_command(struct sdhci_host *, struct mmc_command *); @@ -651,16 +650,23 @@ static void sdhci_set_transfer_irqs(struct sdhci_host *host) sdhci_clear_set_irqs(host, dma_irqs, pio_irqs); } -static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data) +static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_command *cmd) { u8 count; u8 ctrl; + struct mmc_data *data = cmd->data; int ret; WARN_ON(host->data); - if (data == NULL) + if (data == NULL) { + /* + * set timeout to be maximum value for command with busy signal. + */ + if (cmd->flags & MMC_RSP_BUSY) + sdhci_writeb(host, 0xE, SDHCI_TIMEOUT_CONTROL); return; + } /* Sanity checks */ BUG_ON(data->blksz * data->blocks > 524288); @@ -920,7 +926,7 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) host->cmd = cmd; - sdhci_prepare_data(host, cmd->data); + sdhci_prepare_data(host, cmd); sdhci_writel(host, cmd->arg, SDHCI_ARGUMENT);