aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mmc/host/sh_mobile_sdhi.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 1e7c5c46201d..a842939e4655 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -21,6 +21,7 @@
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/mod_devicetable.h>
24#include <linux/module.h> 25#include <linux/module.h>
25#include <linux/platform_device.h> 26#include <linux/platform_device.h>
26#include <linux/mmc/host.h> 27#include <linux/mmc/host.h>
@@ -133,12 +134,14 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev)
133 } 134 }
134 135
135 mmc_data = &priv->mmc_data; 136 mmc_data = &priv->mmc_data;
136 p->pdata = mmc_data;
137 137
138 if (p->init) { 138 if (p) {
139 ret = p->init(pdev, &sdhi_ops); 139 p->pdata = mmc_data;
140 if (ret) 140 if (p->init) {
141 goto einit; 141 ret = p->init(pdev, &sdhi_ops);
142 if (ret)
143 goto einit;
144 }
142 } 145 }
143 146
144 snprintf(clk_name, sizeof(clk_name), "sdhi%d", pdev->id); 147 snprintf(clk_name, sizeof(clk_name), "sdhi%d", pdev->id);
@@ -149,10 +152,6 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev)
149 goto eclkget; 152 goto eclkget;
150 } 153 }
151 154
152 if (p->set_pwr)
153 mmc_data->set_pwr = sh_mobile_sdhi_set_pwr;
154 if (p->get_cd)
155 mmc_data->get_cd = sh_mobile_sdhi_get_cd;
156 mmc_data->clk_enable = sh_mobile_sdhi_clk_enable; 155 mmc_data->clk_enable = sh_mobile_sdhi_clk_enable;
157 mmc_data->clk_disable = sh_mobile_sdhi_clk_disable; 156 mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
158 mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED; 157 mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
@@ -164,6 +163,10 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev)
164 mmc_data->capabilities |= p->tmio_caps; 163 mmc_data->capabilities |= p->tmio_caps;
165 mmc_data->capabilities2 |= p->tmio_caps2; 164 mmc_data->capabilities2 |= p->tmio_caps2;
166 mmc_data->cd_gpio = p->cd_gpio; 165 mmc_data->cd_gpio = p->cd_gpio;
166 if (p->set_pwr)
167 mmc_data->set_pwr = sh_mobile_sdhi_set_pwr;
168 if (p->get_cd)
169 mmc_data->get_cd = sh_mobile_sdhi_get_cd;
167 170
168 if (p->dma_slave_tx > 0 && p->dma_slave_rx > 0) { 171 if (p->dma_slave_tx > 0 && p->dma_slave_rx > 0) {
169 priv->param_tx.slave_id = p->dma_slave_tx; 172 priv->param_tx.slave_id = p->dma_slave_tx;
@@ -269,7 +272,7 @@ eirq_card_detect:
269eprobe: 272eprobe:
270 clk_put(priv->clk); 273 clk_put(priv->clk);
271eclkget: 274eclkget:
272 if (p->cleanup) 275 if (p && p->cleanup)
273 p->cleanup(pdev); 276 p->cleanup(pdev);
274einit: 277einit:
275 kfree(priv); 278 kfree(priv);
@@ -284,7 +287,8 @@ static int sh_mobile_sdhi_remove(struct platform_device *pdev)
284 struct sh_mobile_sdhi_info *p = pdev->dev.platform_data; 287 struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
285 int i = 0, irq; 288 int i = 0, irq;
286 289
287 p->pdata = NULL; 290 if (p)
291 p->pdata = NULL;
288 292
289 tmio_mmc_host_remove(host); 293 tmio_mmc_host_remove(host);
290 294
@@ -297,7 +301,7 @@ static int sh_mobile_sdhi_remove(struct platform_device *pdev)
297 301
298 clk_put(priv->clk); 302 clk_put(priv->clk);
299 303
300 if (p->cleanup) 304 if (p && p->cleanup)
301 p->cleanup(pdev); 305 p->cleanup(pdev);
302 306
303 kfree(priv); 307 kfree(priv);
@@ -312,11 +316,18 @@ static const struct dev_pm_ops tmio_mmc_dev_pm_ops = {
312 .runtime_resume = tmio_mmc_host_runtime_resume, 316 .runtime_resume = tmio_mmc_host_runtime_resume,
313}; 317};
314 318
319static const struct of_device_id sh_mobile_sdhi_of_match[] = {
320 { .compatible = "renesas,shmobile-sdhi" },
321 { }
322};
323MODULE_DEVICE_TABLE(of, sh_mobile_sdhi_of_match);
324
315static struct platform_driver sh_mobile_sdhi_driver = { 325static struct platform_driver sh_mobile_sdhi_driver = {
316 .driver = { 326 .driver = {
317 .name = "sh_mobile_sdhi", 327 .name = "sh_mobile_sdhi",
318 .owner = THIS_MODULE, 328 .owner = THIS_MODULE,
319 .pm = &tmio_mmc_dev_pm_ops, 329 .pm = &tmio_mmc_dev_pm_ops,
330 .of_match_table = sh_mobile_sdhi_of_match,
320 }, 331 },
321 .probe = sh_mobile_sdhi_probe, 332 .probe = sh_mobile_sdhi_probe,
322 .remove = __devexit_p(sh_mobile_sdhi_remove), 333 .remove = __devexit_p(sh_mobile_sdhi_remove),