From patchwork Thu Nov 21 15:07:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 3219181 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 4BF319F3A0 for ; Thu, 21 Nov 2013 15:08:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 96CA820334 for ; Thu, 21 Nov 2013 15:08:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6837D20127 for ; Thu, 21 Nov 2013 15:08:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753041Ab3KUPIR (ORCPT ); Thu, 21 Nov 2013 10:08:17 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:37441 "EHLO relay1.mentorg.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750913Ab3KUPIR (ORCPT ); Thu, 21 Nov 2013 10:08:17 -0500 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1VjVrb-0004au-4n from Vladimir_Zapolskiy@mentor.com ; Thu, 21 Nov 2013 07:08:15 -0800 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 21 Nov 2013 07:08:14 -0800 Received: from meadow.mgc.mentorg.com (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server (TLS) id 14.2.247.3; Thu, 21 Nov 2013 15:08:12 +0000 From: Vladimir Zapolskiy To: CC: Ed Sutter , Chris Ball , Adrian Hunter Subject: [PATCH] mmc: sdhci: don't limit discard timeout by data line timeout Date: Thu, 21 Nov 2013 16:07:25 +0100 Message-ID: <1385046445-29711-1-git-send-email-vladimir_zapolskiy@mentor.com> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 X-Originating-IP: [137.202.0.76] X-OriginalArrivalTime: 21 Nov 2013 15:08:14.0823 (UTC) FILETIME=[80751770:01CEE6CB] 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.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 JEDEC specification defines quite high erase timeout value for 300ms multiplied by erase group number, and SD Host Controller specification data line timeout may be much less, e.g. 2^13 / 52MHz ~ 160us. From block layer and MMC perfromance perspective it is desirable that millions of erase groups are discarded at once, so there is no much sense to limit maximum erase timeout by data line timeout, if a controller handles correctly erase operation without indication of data line timeout. Potentially the change may break some of the SDHCs on discard of mmc, and for backward compatibility a new quirk is introduced, which is NOT set by default. Signed-off-by: Vladimir Zapolskiy Reported-by: Ed Sutter Cc: Chris Ball Cc: Adrian Hunter --- drivers/mmc/host/sdhci.c | 5 ++++- include/linux/mmc/sdhci.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index bd8a098..b1fdddb 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2930,7 +2930,10 @@ int sdhci_add_host(struct sdhci_host *host) if (host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK) host->timeout_clk = mmc->f_max / 1000; - mmc->max_discard_to = (1 << 27) / host->timeout_clk; + if (host->quirks2 & SDHCI_QUIRK2_DATA_TIMEOUT_ON_DISCARD) + mmc->max_discard_to = (1 << 27) / host->timeout_clk; + else + mmc->max_discard_to = 0; mmc->caps |= MMC_CAP_SDIO_IRQ | MMC_CAP_ERASE | MMC_CAP_CMD23; diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h index 3e781b8..e7f6bd2 100644 --- a/include/linux/mmc/sdhci.h +++ b/include/linux/mmc/sdhci.h @@ -98,6 +98,7 @@ struct sdhci_host { #define SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON (1<<4) /* Controller has a non-standard host control register */ #define SDHCI_QUIRK2_BROKEN_HOST_CONTROL (1<<5) +#define SDHCI_QUIRK2_DATA_TIMEOUT_ON_DISCARD (1<<6) int irq; /* Device IRQ */ void __iomem *ioaddr; /* Mapped address */