From patchwork Tue Jun 28 14:16:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 924842 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5SEMlGh022056 for ; Tue, 28 Jun 2011 14:23:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758181Ab1F1OSI (ORCPT ); Tue, 28 Jun 2011 10:18:08 -0400 Received: from mga02.intel.com ([134.134.136.20]:20936 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758133Ab1F1OQY (ORCPT ); Tue, 28 Jun 2011 10:16:24 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 28 Jun 2011 07:16:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.65,437,1304319600"; d="scan'208";a="19255897" Received: from unknown (HELO ahunter-desktop.localhost.com) ([10.255.17.80]) by orsmga002.jf.intel.com with ESMTP; 28 Jun 2011 07:16:22 -0700 From: Adrian Hunter To: Chris Ball Cc: linux-mmc , Philip Rakity , Adrian Hunter Subject: [PATCH 2/2] mmc: sdhci: specify maximum discard timeout Date: Tue, 28 Jun 2011 17:16:03 +0300 Message-Id: <1309270563-28817-3-git-send-email-adrian.hunter@intel.com> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1309270563-28817-1-git-send-email-adrian.hunter@intel.com> References: <1309270563-28817-1-git-send-email-adrian.hunter@intel.com> Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki 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 (demeter2.kernel.org [140.211.167.43]); Tue, 28 Jun 2011 14:23:35 +0000 (UTC) In general, SDHC hardware timeout cannot be avoided. Accordingly, the maximum timeout is specified to limit the maximum discard size. Signed-off-by: Adrian Hunter --- drivers/mmc/host/sdhci.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 91d9892..f7e0434 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2488,6 +2488,11 @@ int sdhci_add_host(struct sdhci_host *host) } else mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_200; + if (host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK) + mmc->max_discard_to = (1 << 27) / (mmc->f_max / 1000); + else + mmc->max_discard_to = (1 << 27) / host->timeout_clk; + mmc->caps |= MMC_CAP_SDIO_IRQ | MMC_CAP_ERASE | MMC_CAP_CMD23; if (host->quirks & SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12)