aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorSebastian Hesselbarth <sebastian.hesselbarth@googlemail.com>2012-07-05 06:14:01 -0400
committerChris Ball <cjb@laptop.org>2012-07-22 16:42:48 -0400
commit30b87c60e9cbfcdfce22aa652fc1e5d061fcb733 (patch)
treecfecead12bf49e8db4718a969a143320d773ee4d /drivers/mmc
parenta9ca1d5477a89c1833214a01463190f7bd77d8a9 (diff)
mmc: sdhci-dove: Prepare for common clock framework
As mach-dove is moving towards common clock framework prepare the sdhci driver to grab its clock. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@googlemail.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/sdhci-dove.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c
index 9c8536881796..a6e53a1ebb08 100644
--- a/drivers/mmc/host/sdhci-dove.c
+++ b/drivers/mmc/host/sdhci-dove.c
@@ -20,11 +20,17 @@
20 */ 20 */
21 21
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/clk.h>
24#include <linux/err.h>
23#include <linux/module.h> 25#include <linux/module.h>
24#include <linux/mmc/host.h> 26#include <linux/mmc/host.h>
25 27
26#include "sdhci-pltfm.h" 28#include "sdhci-pltfm.h"
27 29
30struct sdhci_dove_priv {
31 struct clk *clk;
32};
33
28static u16 sdhci_dove_readw(struct sdhci_host *host, int reg) 34static u16 sdhci_dove_readw(struct sdhci_host *host, int reg)
29{ 35{
30 u16 ret; 36 u16 ret;
@@ -72,11 +78,51 @@ static struct sdhci_pltfm_data sdhci_dove_pdata = {
72 78
73static int __devinit sdhci_dove_probe(struct platform_device *pdev) 79static int __devinit sdhci_dove_probe(struct platform_device *pdev)
74{ 80{
75 return sdhci_pltfm_register(pdev, &sdhci_dove_pdata); 81 struct sdhci_host *host;
82 struct sdhci_pltfm_host *pltfm_host;
83 struct sdhci_dove_priv *priv;
84 int ret;
85
86 ret = sdhci_pltfm_register(pdev, &sdhci_dove_pdata);
87 if (ret)
88 goto sdhci_dove_register_fail;
89
90 priv = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_dove_priv),
91 GFP_KERNEL);
92 if (!priv) {
93 dev_err(&pdev->dev, "unable to allocate private data");
94 ret = -ENOMEM;
95 goto sdhci_dove_allocate_fail;
96 }
97
98 host = platform_get_drvdata(pdev);
99 pltfm_host = sdhci_priv(host);
100 pltfm_host->priv = priv;
101
102 priv->clk = clk_get(&pdev->dev, NULL);
103 if (!IS_ERR(priv->clk))
104 clk_prepare_enable(priv->clk);
105 return 0;
106
107sdhci_dove_allocate_fail:
108 sdhci_pltfm_unregister(pdev);
109sdhci_dove_register_fail:
110 return ret;
76} 111}
77 112
78static int __devexit sdhci_dove_remove(struct platform_device *pdev) 113static int __devexit sdhci_dove_remove(struct platform_device *pdev)
79{ 114{
115 struct sdhci_host *host = platform_get_drvdata(pdev);
116 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
117 struct sdhci_dove_priv *priv = pltfm_host->priv;
118
119 if (priv->clk) {
120 if (!IS_ERR(priv->clk)) {
121 clk_disable_unprepare(priv->clk);
122 clk_put(priv->clk);
123 }
124 devm_kfree(&pdev->dev, priv->clk);
125 }
80 return sdhci_pltfm_unregister(pdev); 126 return sdhci_pltfm_unregister(pdev);
81} 127}
82 128