Commit a9e58f25 authored by Anton Vorontsov's avatar Anton Vorontsov Committed by Linus Torvalds

sdhci: get rid of "frequency too high" flood when using eSDHC

Since commit 8dfd0374 ("MMC core: limit
minimum initialization frequency to 400kHz") MMC core checks for minimum
frequency, and that causes following messages flood when using eSDHC
controllers:

  ...
  mmc0: Minimum clock frequency too high for identification mode
  mmc0: Minimum clock frequency too high for identification mode
  ...

The warnings are legitimate, since if we'd use 133 MHz clocks for standard
SDHCI controllers, we'd not able to scale frequency down to 400 kHz.

But eSDHC controllers have a non-standard SD clock management, so we can
divide clock by 256 * 16, not just 256.

This patch introduces get_min_clock() callback for sdhci core and
implements it for sdhci-of driver, and thus fixes the issue.
Signed-off-by: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
Cc: Matt Fleming <matt@console-pimps.org>
Cc: Ian Molton <ian@mnementh.co.uk>
Cc: "Roberto A. Foglietta" <roberto.foglietta@gmail.com>
Cc: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent cab8bd34
...@@ -158,6 +158,13 @@ static unsigned int esdhc_get_max_clock(struct sdhci_host *host) ...@@ -158,6 +158,13 @@ static unsigned int esdhc_get_max_clock(struct sdhci_host *host)
return of_host->clock; return of_host->clock;
} }
static unsigned int esdhc_get_min_clock(struct sdhci_host *host)
{
struct sdhci_of_host *of_host = sdhci_priv(host);
return of_host->clock / 256 / 16;
}
static unsigned int esdhc_get_timeout_clock(struct sdhci_host *host) static unsigned int esdhc_get_timeout_clock(struct sdhci_host *host)
{ {
struct sdhci_of_host *of_host = sdhci_priv(host); struct sdhci_of_host *of_host = sdhci_priv(host);
...@@ -184,6 +191,7 @@ static struct sdhci_of_data sdhci_esdhc = { ...@@ -184,6 +191,7 @@ static struct sdhci_of_data sdhci_esdhc = {
.set_clock = esdhc_set_clock, .set_clock = esdhc_set_clock,
.enable_dma = esdhc_enable_dma, .enable_dma = esdhc_enable_dma,
.get_max_clock = esdhc_get_max_clock, .get_max_clock = esdhc_get_max_clock,
.get_min_clock = esdhc_get_min_clock,
.get_timeout_clock = esdhc_get_timeout_clock, .get_timeout_clock = esdhc_get_timeout_clock,
}, },
}; };
......
...@@ -1766,7 +1766,10 @@ int sdhci_add_host(struct sdhci_host *host) ...@@ -1766,7 +1766,10 @@ int sdhci_add_host(struct sdhci_host *host)
* Set host parameters. * Set host parameters.
*/ */
mmc->ops = &sdhci_ops; mmc->ops = &sdhci_ops;
mmc->f_min = host->max_clk / 256; if (host->ops->get_min_clock)
mmc->f_min = host->ops->get_min_clock(host);
else
mmc->f_min = host->max_clk / 256;
mmc->f_max = host->max_clk; mmc->f_max = host->max_clk;
mmc->caps = MMC_CAP_SDIO_IRQ; mmc->caps = MMC_CAP_SDIO_IRQ;
......
...@@ -302,6 +302,7 @@ struct sdhci_ops { ...@@ -302,6 +302,7 @@ struct sdhci_ops {
int (*enable_dma)(struct sdhci_host *host); int (*enable_dma)(struct sdhci_host *host);
unsigned int (*get_max_clock)(struct sdhci_host *host); 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_timeout_clock)(struct sdhci_host *host);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment