Root/target/linux/cns3xxx/patches-3.3/106-cns3xxx_sata_support.patch

1--- a/arch/arm/mach-cns3xxx/devices.c
2+++ b/arch/arm/mach-cns3xxx/devices.c
3@@ -41,7 +41,7 @@ static struct resource cns3xxx_ahci_reso
4 static u64 cns3xxx_ahci_dmamask = DMA_BIT_MASK(32);
5 
6 static struct platform_device cns3xxx_ahci_pdev = {
7- .name = "ahci",
8+ .name = "ahci-cns3xxx",
9     .id = 0,
10     .resource = cns3xxx_ahci_resource,
11     .num_resources = ARRAY_SIZE(cns3xxx_ahci_resource),
12--- a/drivers/ata/ahci_platform.c
13+++ b/drivers/ata/ahci_platform.c
14@@ -27,6 +27,7 @@ enum ahci_type {
15     AHCI, /* standard platform ahci */
16     IMX53_AHCI, /* ahci on i.mx53 */
17     STRICT_AHCI, /* delayed DMA engine start */
18+ CNS3XXX_AHCI, /* AHCI on cns3xxx */
19 };
20 
21 static struct platform_device_id ahci_devtype[] = {
22@@ -40,11 +41,32 @@ static struct platform_device_id ahci_de
23         .name = "strict-ahci",
24         .driver_data = STRICT_AHCI,
25     }, {
26+ .name = "ahci-cns3xxx",
27+ .driver_data = CNS3XXX_AHCI,
28+ }, {
29         /* sentinel */
30     }
31 };
32 MODULE_DEVICE_TABLE(platform, ahci_devtype);
33 
34+static int
35+cns3xxx_ahci_softreset(struct ata_link *link, unsigned int *class,
36+ unsigned long deadline)
37+{
38+ int pmp = sata_srst_pmp(link);
39+ int ret;
40+
41+ ret = ahci_do_softreset(link, class, pmp, deadline, ahci_check_ready);
42+ if (pmp && ret)
43+ return ahci_do_softreset(link, class, 0, deadline,
44+ ahci_check_ready);
45+ return ret;
46+}
47+
48+static struct ata_port_operations cns3xxx_ahci_ops = {
49+ .inherits = &ahci_ops,
50+ .softreset = cns3xxx_ahci_softreset,
51+};
52 
53 static const struct ata_port_info ahci_port_info[] = {
54     /* by features */
55@@ -67,13 +89,19 @@ static const struct ata_port_info ahci_p
56         .udma_mask = ATA_UDMA6,
57         .port_ops = &ahci_ops,
58     },
59+ [CNS3XXX_AHCI] = {
60+ .flags = AHCI_FLAG_COMMON,
61+ .pio_mask = ATA_PIO4,
62+ .udma_mask = ATA_UDMA6,
63+ .port_ops = &cns3xxx_ahci_ops,
64+ }
65 };
66 
67 static struct scsi_host_template ahci_platform_sht = {
68     AHCI_SHT("ahci_platform"),
69 };
70 
71-static int __init ahci_probe(struct platform_device *pdev)
72+static int __devinit ahci_probe(struct platform_device *pdev)
73 {
74     struct device *dev = &pdev->dev;
75     struct ahci_platform_data *pdata = dev_get_platdata(dev);
76@@ -285,6 +313,7 @@ static const struct of_device_id ahci_of
77 MODULE_DEVICE_TABLE(of, ahci_of_match);
78 
79 static struct platform_driver ahci_driver = {
80+ .probe = ahci_probe,
81     .remove = __devexit_p(ahci_remove),
82     .driver = {
83         .name = "ahci",
84@@ -299,7 +328,7 @@ static struct platform_driver ahci_drive
85 
86 static int __init ahci_init(void)
87 {
88- return platform_driver_probe(&ahci_driver, ahci_probe);
89+ return platform_driver_register(&ahci_driver);
90 }
91 module_init(ahci_init);
92 
93@@ -312,4 +341,3 @@ module_exit(ahci_exit);
94 MODULE_DESCRIPTION("AHCI SATA platform driver");
95 MODULE_AUTHOR("Anton Vorontsov <avorontsov@ru.mvista.com>");
96 MODULE_LICENSE("GPL");
97-MODULE_ALIAS("platform:ahci");
98

Archive Download this file



interactive