提交 4240ff0a 编写于 作者: B Ben Dooks 提交者: Pierre Ossman

sdhci: Add get_{max,timeout}_clock callbacks

Some controllers do not provide clock information in their capabilities
(in the Samsung case, it is because there are multiple clock sources
available to the controller). Add hooks to allow the system to supply
clock information.

p.s.
In the original Ben's patch there was a bug that makes sdhci_add_host()
return -ENODEV even if callbacks were specified. This is fixed now.
Signed-off-by: NBen Dooks <ben-linux@fluff.org>
Signed-off-by: NAnton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: NPierre Ossman <drzeus@drzeus.cx>
上级 c5075a10
...@@ -1674,19 +1674,27 @@ int sdhci_add_host(struct sdhci_host *host) ...@@ -1674,19 +1674,27 @@ int sdhci_add_host(struct sdhci_host *host)
host->max_clk = host->max_clk =
(caps & SDHCI_CLOCK_BASE_MASK) >> SDHCI_CLOCK_BASE_SHIFT; (caps & SDHCI_CLOCK_BASE_MASK) >> SDHCI_CLOCK_BASE_SHIFT;
host->max_clk *= 1000000;
if (host->max_clk == 0) { if (host->max_clk == 0) {
printk(KERN_ERR "%s: Hardware doesn't specify base clock " if (!host->ops->get_max_clock) {
"frequency.\n", mmc_hostname(mmc)); printk(KERN_ERR
return -ENODEV; "%s: Hardware doesn't specify base clock "
"frequency.\n", mmc_hostname(mmc));
return -ENODEV;
}
host->max_clk = host->ops->get_max_clock(host);
} }
host->max_clk *= 1000000;
host->timeout_clk = host->timeout_clk =
(caps & SDHCI_TIMEOUT_CLK_MASK) >> SDHCI_TIMEOUT_CLK_SHIFT; (caps & SDHCI_TIMEOUT_CLK_MASK) >> SDHCI_TIMEOUT_CLK_SHIFT;
if (host->timeout_clk == 0) { if (host->timeout_clk == 0) {
printk(KERN_ERR "%s: Hardware doesn't specify timeout clock " if (!host->ops->get_timeout_clock) {
"frequency.\n", mmc_hostname(mmc)); printk(KERN_ERR
return -ENODEV; "%s: Hardware doesn't specify timeout clock "
"frequency.\n", mmc_hostname(mmc));
return -ENODEV;
}
host->timeout_clk = host->ops->get_timeout_clock(host);
} }
if (caps & SDHCI_TIMEOUT_CLK_UNIT) if (caps & SDHCI_TIMEOUT_CLK_UNIT)
host->timeout_clk *= 1000; host->timeout_clk *= 1000;
......
...@@ -285,6 +285,8 @@ struct sdhci_ops { ...@@ -285,6 +285,8 @@ struct sdhci_ops {
#endif #endif
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_timeout_clock)(struct sdhci_host *host);
}; };
#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册