aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/ahci_platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/ahci_platform.c')
-rw-r--r--drivers/ata/ahci_platform.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index b7078afddb74..1cc467bdb63d 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -25,6 +25,8 @@
25#include <linux/ahci_platform.h> 25#include <linux/ahci_platform.h>
26#include "ahci.h" 26#include "ahci.h"
27 27
28static void ahci_host_stop(struct ata_host *host);
29
28enum ahci_type { 30enum ahci_type {
29 AHCI, /* standard platform ahci */ 31 AHCI, /* standard platform ahci */
30 IMX53_AHCI, /* ahci on i.mx53 */ 32 IMX53_AHCI, /* ahci on i.mx53 */
@@ -47,6 +49,15 @@ static struct platform_device_id ahci_devtype[] = {
47}; 49};
48MODULE_DEVICE_TABLE(platform, ahci_devtype); 50MODULE_DEVICE_TABLE(platform, ahci_devtype);
49 51
52static struct ata_port_operations ahci_platform_ops = {
53 .inherits = &ahci_ops,
54 .host_stop = ahci_host_stop,
55};
56
57static struct ata_port_operations ahci_platform_retry_srst_ops = {
58 .inherits = &ahci_pmp_retry_srst_ops,
59 .host_stop = ahci_host_stop,
60};
50 61
51static const struct ata_port_info ahci_port_info[] = { 62static const struct ata_port_info ahci_port_info[] = {
52 /* by features */ 63 /* by features */
@@ -54,20 +65,20 @@ static const struct ata_port_info ahci_port_info[] = {
54 .flags = AHCI_FLAG_COMMON, 65 .flags = AHCI_FLAG_COMMON,
55 .pio_mask = ATA_PIO4, 66 .pio_mask = ATA_PIO4,
56 .udma_mask = ATA_UDMA6, 67 .udma_mask = ATA_UDMA6,
57 .port_ops = &ahci_ops, 68 .port_ops = &ahci_platform_ops,
58 }, 69 },
59 [IMX53_AHCI] = { 70 [IMX53_AHCI] = {
60 .flags = AHCI_FLAG_COMMON, 71 .flags = AHCI_FLAG_COMMON,
61 .pio_mask = ATA_PIO4, 72 .pio_mask = ATA_PIO4,
62 .udma_mask = ATA_UDMA6, 73 .udma_mask = ATA_UDMA6,
63 .port_ops = &ahci_pmp_retry_srst_ops, 74 .port_ops = &ahci_platform_retry_srst_ops,
64 }, 75 },
65 [STRICT_AHCI] = { 76 [STRICT_AHCI] = {
66 AHCI_HFLAGS (AHCI_HFLAG_DELAY_ENGINE), 77 AHCI_HFLAGS (AHCI_HFLAG_DELAY_ENGINE),
67 .flags = AHCI_FLAG_COMMON, 78 .flags = AHCI_FLAG_COMMON,
68 .pio_mask = ATA_PIO4, 79 .pio_mask = ATA_PIO4,
69 .udma_mask = ATA_UDMA6, 80 .udma_mask = ATA_UDMA6,
70 .port_ops = &ahci_ops, 81 .port_ops = &ahci_platform_ops,
71 }, 82 },
72}; 83};
73 84
@@ -75,7 +86,7 @@ static struct scsi_host_template ahci_platform_sht = {
75 AHCI_SHT("ahci_platform"), 86 AHCI_SHT("ahci_platform"),
76}; 87};
77 88
78static int __init ahci_probe(struct platform_device *pdev) 89static int __devinit ahci_probe(struct platform_device *pdev)
79{ 90{
80 struct device *dev = &pdev->dev; 91 struct device *dev = &pdev->dev;
81 struct ahci_platform_data *pdata = dev_get_platdata(dev); 92 struct ahci_platform_data *pdata = dev_get_platdata(dev);
@@ -218,15 +229,12 @@ free_clk:
218 return rc; 229 return rc;
219} 230}
220 231
221static int __devexit ahci_remove(struct platform_device *pdev) 232static void ahci_host_stop(struct ata_host *host)
222{ 233{
223 struct device *dev = &pdev->dev; 234 struct device *dev = host->dev;
224 struct ahci_platform_data *pdata = dev_get_platdata(dev); 235 struct ahci_platform_data *pdata = dev_get_platdata(dev);
225 struct ata_host *host = dev_get_drvdata(dev);
226 struct ahci_host_priv *hpriv = host->private_data; 236 struct ahci_host_priv *hpriv = host->private_data;
227 237
228 ata_host_detach(host);
229
230 if (pdata && pdata->exit) 238 if (pdata && pdata->exit)
231 pdata->exit(dev); 239 pdata->exit(dev);
232 240
@@ -234,8 +242,6 @@ static int __devexit ahci_remove(struct platform_device *pdev)
234 clk_disable_unprepare(hpriv->clk); 242 clk_disable_unprepare(hpriv->clk);
235 clk_put(hpriv->clk); 243 clk_put(hpriv->clk);
236 } 244 }
237
238 return 0;
239} 245}
240 246
241#ifdef CONFIG_PM_SLEEP 247#ifdef CONFIG_PM_SLEEP
@@ -317,7 +323,7 @@ disable_unprepare_clk:
317} 323}
318#endif 324#endif
319 325
320SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_suspend, ahci_resume); 326static SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_suspend, ahci_resume);
321 327
322static const struct of_device_id ahci_of_match[] = { 328static const struct of_device_id ahci_of_match[] = {
323 { .compatible = "snps,spear-ahci", }, 329 { .compatible = "snps,spear-ahci", },
@@ -326,7 +332,8 @@ static const struct of_device_id ahci_of_match[] = {
326MODULE_DEVICE_TABLE(of, ahci_of_match); 332MODULE_DEVICE_TABLE(of, ahci_of_match);
327 333
328static struct platform_driver ahci_driver = { 334static struct platform_driver ahci_driver = {
329 .remove = __devexit_p(ahci_remove), 335 .probe = ahci_probe,
336 .remove = ata_platform_remove_one,
330 .driver = { 337 .driver = {
331 .name = "ahci", 338 .name = "ahci",
332 .owner = THIS_MODULE, 339 .owner = THIS_MODULE,
@@ -335,18 +342,7 @@ static struct platform_driver ahci_driver = {
335 }, 342 },
336 .id_table = ahci_devtype, 343 .id_table = ahci_devtype,
337}; 344};
338 345module_platform_driver(ahci_driver);
339static int __init ahci_init(void)
340{
341 return platform_driver_probe(&ahci_driver, ahci_probe);
342}
343module_init(ahci_init);
344
345static void __exit ahci_exit(void)
346{
347 platform_driver_unregister(&ahci_driver);
348}
349module_exit(ahci_exit);
350 346
351MODULE_DESCRIPTION("AHCI SATA platform driver"); 347MODULE_DESCRIPTION("AHCI SATA platform driver");
352MODULE_AUTHOR("Anton Vorontsov <avorontsov@ru.mvista.com>"); 348MODULE_AUTHOR("Anton Vorontsov <avorontsov@ru.mvista.com>");