FSL eSDHC hosts don't provide clocks bits in the capabilities register,
instead we're getting clocks values from the device tree.

There is somewhat similar change[1] from Ben Dooks, the change adds
callbacks for getting the clocks. But for eSDHC the callbacks are
superfluous, since the clocks are static.

[1] http://lkml.org/lkml/2008/12/2/157

Signed-off-by: Anton Vorontsov <avoront...@ru.mvista.com>
---
 drivers/mmc/host/sdhci.c |   31 +++++++++++++++----------------
 1 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 57b8ffe..9ac088a 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1693,24 +1693,23 @@ int sdhci_add_host(struct sdhci_host *host)
                mmc_dev(host->mmc)->dma_mask = &host->dma_mask;
        }
 
-       host->max_clk =
-               (caps & SDHCI_CLOCK_BASE_MASK) >> SDHCI_CLOCK_BASE_SHIFT;
-       if (host->max_clk == 0) {
-               printk(KERN_ERR "%s: Hardware doesn't specify base clock "
-                       "frequency.\n", mmc_hostname(mmc));
-               return -ENODEV;
+       if (!host->max_clk) {
+               host->max_clk = (caps & SDHCI_CLOCK_BASE_MASK) >>
+                                               SDHCI_CLOCK_BASE_SHIFT;
+               if (host->max_clk == 0) {
+                       printk(KERN_ERR "%s: Hardware doesn't specify base "
+                               "clock frequency.\n", mmc_hostname(mmc));
+                       return -ENODEV;
+               }
+               host->max_clk *= 1000000;
        }
-       host->max_clk *= 1000000;
 
-       host->timeout_clk =
-               (caps & SDHCI_TIMEOUT_CLK_MASK) >> SDHCI_TIMEOUT_CLK_SHIFT;
-       if (host->timeout_clk == 0) {
-               printk(KERN_ERR "%s: Hardware doesn't specify timeout clock "
-                       "frequency.\n", mmc_hostname(mmc));
-               return -ENODEV;
+       if (!host->timeout_clk) {
+               host->timeout_clk = (caps & SDHCI_TIMEOUT_CLK_MASK) >>
+                                               SDHCI_TIMEOUT_CLK_SHIFT;
+               if (caps & SDHCI_TIMEOUT_CLK_UNIT)
+                       host->timeout_clk *= 1000;
        }
-       if (caps & SDHCI_TIMEOUT_CLK_UNIT)
-               host->timeout_clk *= 1000;
 
        /*
         * Set host parameters.
-- 
1.5.6.5

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Reply via email to