diff options
author | Dong Aisheng <b29396@freescale.com> | 2013-11-22 07:34:38 -0500 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:47:23 -0400 |
commit | 52d366ba1dea624be8eb5d5cc4dbc65cbfde61e9 (patch) | |
tree | 65269e400108338f379a871e43669d0fd071e5de /drivers/mmc | |
parent | e1c0677e2a04c7f88e64b55afeb42b687d376627 (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>
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 fc63c23a1d6b..7b008675d7fc 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -2953,7 +2953,19 @@ int sdhci_add_host(struct sdhci_host *host) | |||
2953 | if (host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK) | 2953 | if (host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK) |
2954 | host->timeout_clk = mmc->f_max / 1000; | 2954 | host->timeout_clk = mmc->f_max / 1000; |
2955 | 2955 | ||
2956 | mmc->max_discard_to = (1 << 27) / host->timeout_clk; | 2956 | if (host->quirks2 & SDHCI_QUIRK2_NOSTD_TIMEOUT_COUNTER) { |
2957 | if (host->ops->get_max_timeout_counter) { | ||
2958 | mmc->max_discard_to = | ||
2959 | host->ops->get_max_timeout_counter(host) | ||
2960 | / host->timeout_clk; | ||
2961 | } else { | ||
2962 | pr_err("%s: Hardware doesn't specify max timeout " | ||
2963 | "counter\n", mmc_hostname(mmc)); | ||
2964 | return -ENODEV; | ||
2965 | } | ||
2966 | } else { | ||
2967 | mmc->max_discard_to = (1 << 27) / host->timeout_clk; | ||
2968 | } | ||
2957 | 2969 | ||
2958 | mmc->caps |= MMC_CAP_SDIO_IRQ | MMC_CAP_ERASE | MMC_CAP_CMD23; | 2970 | mmc->caps |= MMC_CAP_SDIO_IRQ | MMC_CAP_ERASE | MMC_CAP_CMD23; |
2959 | 2971 | ||
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 4236ba134941..0c0ca619ddef 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h | |||
@@ -281,6 +281,7 @@ struct sdhci_ops { | |||
281 | unsigned int (*get_max_clock)(struct sdhci_host *host); | 281 | unsigned int (*get_max_clock)(struct sdhci_host *host); |
282 | unsigned int (*get_min_clock)(struct sdhci_host *host); | 282 | unsigned int (*get_min_clock)(struct sdhci_host *host); |
283 | unsigned int (*get_timeout_clock)(struct sdhci_host *host); | 283 | unsigned int (*get_timeout_clock)(struct sdhci_host *host); |
284 | unsigned int (*get_max_timeout_counter)(struct sdhci_host *host); | ||
284 | int (*platform_bus_width)(struct sdhci_host *host, | 285 | int (*platform_bus_width)(struct sdhci_host *host, |
285 | int width); | 286 | int width); |
286 | void (*platform_send_init_74_clocks)(struct sdhci_host *host, | 287 | void (*platform_send_init_74_clocks)(struct sdhci_host *host, |