diff options
author | Dong Aisheng <b29396@freescale.com> | 2013-11-22 20:34:38 +0800 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2015-01-15 21:18:00 -0600 |
commit | b8258ae3d0b8b708539232ba0a69d12f0842c8e8 (patch) | |
tree | e26827fb60d3568b61d63d914a29d1233c96a8bb /drivers/mmc | |
parent | 1fc2158934dc8e99c017dc0b9b00954ab6f31357 (diff) |
ENGR00289406-1 mmc: sdhci: add quirk for get max timeout counter
The max timeout counter of some SoCs like i.MX6 uSDHC may not be standard,
add SDHCI_QUIRK2_NOSTD_TIMEOUT_COUNTER quirk to get the correct max timeout
counter from platform specific code.
Then we can calculate the correct max_discard_to value.
Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit 0469c7c4c683547f7923fb54882f681ad6d23ca8)
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/sdhci.c | 14 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci.h | 1 |
2 files changed, 14 insertions, 1 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 6f1f6acd2aee..9e24250849ab 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2947,7 +2947,19 @@ 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_NOSTD_TIMEOUT_COUNTER) { + if (host->ops->get_max_timeout_counter) { + mmc->max_discard_to = + host->ops->get_max_timeout_counter(host) + / host->timeout_clk; + } else { + pr_err("%s: Hardware doesn't specify max timeout " + "counter\n", mmc_hostname(mmc)); + return -ENODEV; + } + } else { + mmc->max_discard_to = (1 << 27) / host->timeout_clk; + } mmc->caps |= MMC_CAP_SDIO_IRQ | MMC_CAP_ERASE | MMC_CAP_CMD23; diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 0a3ed01887db..51bd04abddc9 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -281,6 +281,7 @@ struct sdhci_ops { unsigned int (*get_max_clock)(struct sdhci_host *host); unsigned int (*get_min_clock)(struct sdhci_host *host); unsigned int (*get_timeout_clock)(struct sdhci_host *host); + unsigned int (*get_max_timeout_counter)(struct sdhci_host *host); int (*platform_bus_width)(struct sdhci_host *host, int width); void (*platform_send_init_74_clocks)(struct sdhci_host *host, |