aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2009-03-16 17:13:57 -0400
committerPierre Ossman <drzeus@drzeus.cx>2009-03-24 16:30:09 -0400
commit4240ff0a02cb52f7d10dc1df6d82ba9c27dba07b (patch)
tree99d88747457b500fe975832d6e721f76ec4e70c0 /drivers/mmc/host
parentc5075a1089e808d8f471ce21b02810cc98ab2692 (diff)
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: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/host')
-rw-r--r--drivers/mmc/host/sdhci.c22
-rw-r--r--drivers/mmc/host/sdhci.h2
2 files changed, 17 insertions, 7 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index c814220d214e..34ab77bd12ae 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1674,19 +1674,27 @@ int sdhci_add_host(struct sdhci_host *host)
1674 1674
1675 host->max_clk = 1675 host->max_clk =
1676 (caps & SDHCI_CLOCK_BASE_MASK) >> SDHCI_CLOCK_BASE_SHIFT; 1676 (caps & SDHCI_CLOCK_BASE_MASK) >> SDHCI_CLOCK_BASE_SHIFT;
1677 host->max_clk *= 1000000;
1677 if (host->max_clk == 0) { 1678 if (host->max_clk == 0) {
1678 printk(KERN_ERR "%s: Hardware doesn't specify base clock " 1679 if (!host->ops->get_max_clock) {
1679 "frequency.\n", mmc_hostname(mmc)); 1680 printk(KERN_ERR
1680 return -ENODEV; 1681 "%s: Hardware doesn't specify base clock "
1682 "frequency.\n", mmc_hostname(mmc));
1683 return -ENODEV;
1684 }
1685 host->max_clk = host->ops->get_max_clock(host);
1681 } 1686 }
1682 host->max_clk *= 1000000;
1683 1687
1684 host->timeout_clk = 1688 host->timeout_clk =
1685 (caps & SDHCI_TIMEOUT_CLK_MASK) >> SDHCI_TIMEOUT_CLK_SHIFT; 1689 (caps & SDHCI_TIMEOUT_CLK_MASK) >> SDHCI_TIMEOUT_CLK_SHIFT;
1686 if (host->timeout_clk == 0) { 1690 if (host->timeout_clk == 0) {
1687 printk(KERN_ERR "%s: Hardware doesn't specify timeout clock " 1691 if (!host->ops->get_timeout_clock) {
1688 "frequency.\n", mmc_hostname(mmc)); 1692 printk(KERN_ERR
1689 return -ENODEV; 1693 "%s: Hardware doesn't specify timeout clock "
1694 "frequency.\n", mmc_hostname(mmc));
1695 return -ENODEV;
1696 }
1697 host->timeout_clk = host->ops->get_timeout_clock(host);
1690 } 1698 }
1691 if (caps & SDHCI_TIMEOUT_CLK_UNIT) 1699 if (caps & SDHCI_TIMEOUT_CLK_UNIT)
1692 host->timeout_clk *= 1000; 1700 host->timeout_clk *= 1000;
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 6980f2725b85..aab0652a4585 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -285,6 +285,8 @@ struct sdhci_ops {
285#endif 285#endif
286 286
287 int (*enable_dma)(struct sdhci_host *host); 287 int (*enable_dma)(struct sdhci_host *host);
288 unsigned int (*get_max_clock)(struct sdhci_host *host);
289 unsigned int (*get_timeout_clock)(struct sdhci_host *host);
288}; 290};
289 291
290#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS 292#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS