mmc: sdhci-msm: add quirk for max_discard calculation

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.

Instead add quirk so that any SDHCi hosts that would like to use
the default value can do so.

Change-Id: Ifa1343c3e7f14b031da30b06203a8831ba544889
Signed-off-by: Krishna Konda <kkonda@codeaurora.org>
[venkatg@codeaurora.org: change max_discard_to was renamed to
max_busy_timeout in 3.14 kernel]
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
[subhashj@codeaurora.org: fixed compilation error]
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
This commit is contained in:
Krishna Konda 2013-04-01 21:01:59 -07:00 committed by Subhash Jadavani
parent a93eca74ce
commit 84756b990e
3 changed files with 7 additions and 0 deletions

View file

@ -2132,6 +2132,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
host->quirks |= SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN;
host->quirks2 |= SDHCI_QUIRK2_ALWAYS_USE_BASE_CLOCK;
host->quirks2 |= SDHCI_QUIRK2_IGNORE_CMDCRC_FOR_TUNING;
host->quirks2 |= SDHCI_QUIRK2_USE_MAX_DISCARD_SIZE;
host_version = readl_relaxed((host->ioaddr + SDHCI_HOST_VERSION));
dev_dbg(&pdev->dev, "Host Version: 0x%x Vendor Version 0x%x\n",

View file

@ -3235,6 +3235,10 @@ int sdhci_add_host(struct sdhci_host *host)
if (override_timeout_clk)
host->timeout_clk = override_timeout_clk;
if (!(host->quirks2 & SDHCI_QUIRK2_USE_MAX_DISCARD_SIZE))
mmc->max_busy_timeout = (1 << 27) / host->timeout_clk;
mmc->caps |= MMC_CAP_SDIO_IRQ | MMC_CAP_ERASE | MMC_CAP_CMD23;
mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD;

View file

@ -436,6 +436,8 @@ struct sdhci_host {
#define SDHCI_QUIRK2_ALWAYS_USE_BASE_CLOCK (1<<19)
#define SDHCI_QUIRK2_USE_MAX_DISCARD_SIZE (1<<20)
int irq; /* Device IRQ */
void __iomem *ioaddr; /* Mapped address */