mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Georgi Djakov <gdjakov@mm-sol.com>
To: cjb@laptop.org
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Georgi Djakov <gdjakov@mm-sol.com>,
	Krishna Konda <kkonda@codeaurora.org>
Subject: [PATCH 4/5] mmc: sdhci: add quirk for max_discard calculation
Date: Thu, 15 Aug 2013 17:32:19 +0300	[thread overview]
Message-ID: <1376577140-2652-5-git-send-email-gdjakov@mm-sol.com> (raw)
In-Reply-To: <1376577140-2652-1-git-send-email-gdjakov@mm-sol.com>

The SDHCI driver by default specifies a parameter that causes the core
layer to calculate a max discard value which will be set on the mmc queue.
Unfortunately the value calculated because of this would be very small
compared to what comes in by default. As a result of this, any secure
discard kind of operations are very slow.

Add quirk so that the SDHCI host can use the default max_discard value.

CC: Krishna Konda <kkonda@codeaurora.org>
Signed-off-by: Georgi Djakov <gdjakov@mm-sol.com>
---
 drivers/mmc/host/sdhci.c  |    3 ++-
 include/linux/mmc/sdhci.h |    4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 39544b4..e21bb6f 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2957,7 +2957,8 @@ 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_USE_MAX_DISCARD_SIZE))
+		mmc->max_discard_to = (1 << 27) / host->timeout_clk;
 
 	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 603ef9d..f42f6dd 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -104,6 +104,10 @@ struct sdhci_host {
 #define SDHCI_QUIRK2_SLOW_INT_CLR			(1<<7)
 /* Ignore CMD CRC errors for tuning commands */
 #define SDHCI_QUIRK2_IGNORE_CMDCRC_FOR_TUNING		(1<<8)
+/* Dont use the max_discard_to so that the maximum discard unit gets picked by
+ * the mmc queue. Otherwise, it takes a long time for secure discard kind of
+ * operations to complete. */
+#define SDHCI_QUIRK2_USE_MAX_DISCARD_SIZE		(1<<9)
 
 	int irq;		/* Device IRQ */
 	void __iomem *ioaddr;	/* Mapped address */
-- 
1.7.9.5


  parent reply	other threads:[~2013-08-15 14:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-15 14:32 [PATCH 0/5] mmc: sdhci: Add quirks for Qualcomm MSM SDHCI controller Georgi Djakov
2013-08-15 14:32 ` [PATCH 1/5] mmc: sdhci: add quirk for R/W Transfer Active EOT Georgi Djakov
2013-08-15 14:32 ` [PATCH 2/5] mmc: sdhci: add quirk for slow interrupt clearance Georgi Djakov
2013-08-15 14:32 ` [PATCH 3/5] mmc: sdhci: add quirk to ignore CMD CRC err for tuning commands Georgi Djakov
2013-08-15 14:32 ` Georgi Djakov [this message]
2013-08-15 14:32 ` [PATCH 5/5] mmc: sdhci: add quirk to ignore timeout err for R1B Georgi Djakov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1376577140-2652-5-git-send-email-gdjakov@mm-sol.com \
    --to=gdjakov@mm-sol.com \
    --cc=cjb@laptop.org \
    --cc=kkonda@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®