diff options
author | Zhangfei Gao <zhangfei.gao@marvell.com> | 2010-09-20 15:15:18 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2010-10-23 21:11:14 +0800 |
commit | 0397526d6ae2518b6c53efd1ff1e81b7d24c91da (patch) | |
tree | a57c3a2a2d69badff447bd76dfad7447d1986643 /drivers/mmc | |
parent | c4687d5f601be3f928b815b46964f7426c31aec7 (diff) | |
download | kernel_samsung_smdk4412-0397526d6ae2518b6c53efd1ff1e81b7d24c91da.zip kernel_samsung_smdk4412-0397526d6ae2518b6c53efd1ff1e81b7d24c91da.tar.gz kernel_samsung_smdk4412-0397526d6ae2518b6c53efd1ff1e81b7d24c91da.tar.bz2 |
mmc: SDHC 3.0: correct f_min calculation for SD 3.0 spec
While we're at it, add symbols for SDHCI_MAX_DIV_SPEC_{200,300}.
Signed-off-by: Zhangfei Gao <zhangfei.gao@marvell.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/sdhci.c | 8 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci.h | 7 |
2 files changed, 12 insertions, 3 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index ac8b12b..e3c9153 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1006,14 +1006,14 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock) if (host->max_clk <= clock) div = 1; else { - for (div = 2; div < 2046; div += 2) { + for (div = 2; div < SDHCI_MAX_DIV_SPEC_300; div += 2) { if ((host->max_clk / div) <= clock) break; } } } else { /* Version 2.00 divisors must be a power of 2. */ - for (div = 1; div < 256; div *= 2) { + for (div = 1; div < SDHCI_MAX_DIV_SPEC_200; div *= 2) { if ((host->max_clk / div) <= clock) break; } @@ -1835,8 +1835,10 @@ int sdhci_add_host(struct sdhci_host *host) mmc->ops = &sdhci_ops; if (host->ops->get_min_clock) mmc->f_min = host->ops->get_min_clock(host); + else if (host->version >= SDHCI_SPEC_300) + mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300; else - mmc->f_min = host->max_clk / 256; + mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_200; mmc->f_max = host->max_clk; mmc->caps |= MMC_CAP_SDIO_IRQ; diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index ae28a31..112543a 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -185,6 +185,13 @@ #define SDHCI_SPEC_200 1 #define SDHCI_SPEC_300 2 +/* + * End of controller registers. + */ + +#define SDHCI_MAX_DIV_SPEC_200 256 +#define SDHCI_MAX_DIV_SPEC_300 2046 + struct sdhci_ops; struct sdhci_host { |