aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Hao <haokexin@gmail.com>2015-02-27 02:47:28 -0500
committerUlf Hansson <ulf.hansson@linaro.org>2015-03-23 09:13:34 -0400
commite46af2987b9228d213d2399e69a8741ad805c293 (patch)
tree66dc88a07ceef6280a37f607965114a59b085bda
parente4f79d9ca21810a606ecce9067b8b037a5511413 (diff)
mmc: sdhci-sirf: kill the "clk" member in driver private struct
Actually we can use the "clk" in the struct sdhci_pltfm_host. With this change we can also kill the private function for get max clock in this driver. Signed-off-by: Kevin Hao <haokexin@gmail.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r--drivers/mmc/host/sdhci-sirf.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/drivers/mmc/host/sdhci-sirf.c b/drivers/mmc/host/sdhci-sirf.c
index 43314094699f..0f75aa98c550 100644
--- a/drivers/mmc/host/sdhci-sirf.c
+++ b/drivers/mmc/host/sdhci-sirf.c
@@ -20,17 +20,9 @@
20#define SIRF_TUNING_COUNT 128 20#define SIRF_TUNING_COUNT 128
21 21
22struct sdhci_sirf_priv { 22struct sdhci_sirf_priv {
23 struct clk *clk;
24 int gpio_cd; 23 int gpio_cd;
25}; 24};
26 25
27static unsigned int sdhci_sirf_get_max_clk(struct sdhci_host *host)
28{
29 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
30 struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host);
31 return clk_get_rate(priv->clk);
32}
33
34static void sdhci_sirf_set_bus_width(struct sdhci_host *host, int width) 26static void sdhci_sirf_set_bus_width(struct sdhci_host *host, int width)
35{ 27{
36 u8 ctrl; 28 u8 ctrl;
@@ -122,7 +114,7 @@ retry:
122static struct sdhci_ops sdhci_sirf_ops = { 114static struct sdhci_ops sdhci_sirf_ops = {
123 .platform_execute_tuning = sdhci_sirf_execute_tuning, 115 .platform_execute_tuning = sdhci_sirf_execute_tuning,
124 .set_clock = sdhci_set_clock, 116 .set_clock = sdhci_set_clock,
125 .get_max_clock = sdhci_sirf_get_max_clk, 117 .get_max_clock = sdhci_pltfm_clk_get_max_clock,
126 .set_bus_width = sdhci_sirf_set_bus_width, 118 .set_bus_width = sdhci_sirf_set_bus_width,
127 .reset = sdhci_reset, 119 .reset = sdhci_reset,
128 .set_uhs_signaling = sdhci_set_uhs_signaling, 120 .set_uhs_signaling = sdhci_set_uhs_signaling,
@@ -162,13 +154,13 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
162 return PTR_ERR(host); 154 return PTR_ERR(host);
163 155
164 pltfm_host = sdhci_priv(host); 156 pltfm_host = sdhci_priv(host);
157 pltfm_host->clk = clk;
165 priv = sdhci_pltfm_priv(pltfm_host); 158 priv = sdhci_pltfm_priv(pltfm_host);
166 priv->clk = clk;
167 priv->gpio_cd = gpio_cd; 159 priv->gpio_cd = gpio_cd;
168 160
169 sdhci_get_of_property(pdev); 161 sdhci_get_of_property(pdev);
170 162
171 ret = clk_prepare_enable(priv->clk); 163 ret = clk_prepare_enable(pltfm_host->clk);
172 if (ret) 164 if (ret)
173 goto err_clk_prepare; 165 goto err_clk_prepare;
174 166
@@ -195,7 +187,7 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
195err_request_cd: 187err_request_cd:
196 sdhci_remove_host(host, 0); 188 sdhci_remove_host(host, 0);
197err_sdhci_add: 189err_sdhci_add:
198 clk_disable_unprepare(priv->clk); 190 clk_disable_unprepare(pltfm_host->clk);
199err_clk_prepare: 191err_clk_prepare:
200 sdhci_pltfm_free(pdev); 192 sdhci_pltfm_free(pdev);
201 return ret; 193 return ret;
@@ -205,11 +197,9 @@ static int sdhci_sirf_remove(struct platform_device *pdev)
205{ 197{
206 struct sdhci_host *host = platform_get_drvdata(pdev); 198 struct sdhci_host *host = platform_get_drvdata(pdev);
207 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 199 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
208 struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host);
209 200
201 clk_disable_unprepare(pltfm_host->clk);
210 sdhci_pltfm_unregister(pdev); 202 sdhci_pltfm_unregister(pdev);
211
212 clk_disable_unprepare(priv->clk);
213 return 0; 203 return 0;
214} 204}
215 205
@@ -218,14 +208,13 @@ static int sdhci_sirf_suspend(struct device *dev)
218{ 208{
219 struct sdhci_host *host = dev_get_drvdata(dev); 209 struct sdhci_host *host = dev_get_drvdata(dev);
220 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 210 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
221 struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host);
222 int ret; 211 int ret;
223 212
224 ret = sdhci_suspend_host(host); 213 ret = sdhci_suspend_host(host);
225 if (ret) 214 if (ret)
226 return ret; 215 return ret;
227 216
228 clk_disable(priv->clk); 217 clk_disable(pltfm_host->clk);
229 218
230 return 0; 219 return 0;
231} 220}
@@ -234,10 +223,9 @@ static int sdhci_sirf_resume(struct device *dev)
234{ 223{
235 struct sdhci_host *host = dev_get_drvdata(dev); 224 struct sdhci_host *host = dev_get_drvdata(dev);
236 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 225 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
237 struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host);
238 int ret; 226 int ret;
239 227
240 ret = clk_enable(priv->clk); 228 ret = clk_enable(pltfm_host->clk);
241 if (ret) { 229 if (ret) {
242 dev_dbg(dev, "Resume: Error enabling clock\n"); 230 dev_dbg(dev, "Resume: Error enabling clock\n");
243 return ret; 231 return ret;