ar71xx: unify LED names on TP-Link boards
[openwrt.git] / target / linux / cns3xxx / patches / 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/Kconfig
13 +++ b/drivers/ata/Kconfig
14 @@ -83,6 +83,17 @@ config SATA_AHCI_PLATFORM
15
16 If unsure, say N.
17
18 +config SATA_AHCI_CNS3XXX
19 + bool "AHCI Support on the Cavium Networks CNS3xxx SOC"
20 + depends on ARCH_CNS3XXX
21 + depends on SATA_AHCI_PLATFORM
22 + help
23 + This option enables AHCI platform driver to support CNS3xxx
24 + System-on-Chip devices. This is only needed when using CNS3xxx AHCI
25 + controller.
26 +
27 + If unsure, say N.
28 +
29 config SATA_FSL
30 tristate "Freescale 3.0Gbps SATA support"
31 depends on FSL_SOC
32 --- a/drivers/ata/Makefile
33 +++ b/drivers/ata/Makefile
34 @@ -4,7 +4,10 @@ obj-$(CONFIG_ATA) += libata.o
35 # non-SFF interface
36 obj-$(CONFIG_SATA_AHCI) += ahci.o libahci.o
37 obj-$(CONFIG_SATA_ACARD_AHCI) += acard-ahci.o libahci.o
38 -obj-$(CONFIG_SATA_AHCI_PLATFORM) += ahci_platform.o libahci.o
39 +obj-$(CONFIG_SATA_AHCI_PLATFORM) += ahci_platforms.o libahci.o
40 +ahci_platforms-y += ahci_platform.o
41 +ahci_platforms-$(CONFIG_SATA_AHCI_CNS3XXX) += ahci_cns3xxx.o
42 +
43 obj-$(CONFIG_SATA_FSL) += sata_fsl.o
44 obj-$(CONFIG_SATA_INIC162X) += sata_inic162x.o
45 obj-$(CONFIG_SATA_SIL24) += sata_sil24.o
46 --- /dev/null
47 +++ b/drivers/ata/ahci_cns3xxx.c
48 @@ -0,0 +1,52 @@
49 +/*
50 + * AHCI support for CNS3xxx SoC
51 + *
52 + * Copyright 2010 MontaVista Software, LLC.
53 + * Copyright 2010 Cavium Networks
54 + *
55 + * Authors: Anton Vorontsov <avorontsov@xxxxxxxxxx>
56 + * Mac Lin <mkl0301@xxxxxxxxx>
57 + *
58 + * This program is free software; you can redistribute it and/or modify
59 + * it under the terms of the GNU General Public License version 2 as
60 + * published by the Free Software Foundation.
61 + */
62 +
63 +#include <linux/libata.h>
64 +#include <linux/ahci_platform.h>
65 +#include "ahci.h"
66 +
67 +/*
68 + * TODO: move cns3xxx_ahci_init to here after cns3xxx_pwr*() calls are
69 + * thread-safe
70 + */
71 +
72 +static int cns3xxx_ahci_softreset(struct ata_link *link, unsigned int *class,
73 + unsigned long deadline)
74 +{
75 + int pmp = sata_srst_pmp(link);
76 + int ret;
77 +
78 + ret = ahci_do_softreset(link, class, pmp, deadline, ahci_check_ready);
79 + if (pmp && ret)
80 + return ahci_do_softreset(link, class, 0, deadline,
81 + ahci_check_ready);
82 + return ret;
83 +}
84 +
85 +static struct ata_port_operations cns3xxx_ahci_ops = {
86 + .inherits = &ahci_ops,
87 + .softreset = cns3xxx_ahci_softreset,
88 +};
89 +
90 +static const struct ata_port_info cns3xxx_ata_port_info = {
91 + .flags = AHCI_FLAG_COMMON,
92 + .pio_mask = ATA_PIO4,
93 + .udma_mask = ATA_UDMA6,
94 + .port_ops = &cns3xxx_ahci_ops,
95 +};
96 +
97 +struct ahci_platform_data cns3xxx_ahci_platform_data = {
98 + .ata_port_info = &cns3xxx_ata_port_info,
99 +};
100 +
101 --- a/drivers/ata/ahci_platform.c
102 +++ b/drivers/ata/ahci_platform.c
103 @@ -19,9 +19,11 @@
104 #include <linux/interrupt.h>
105 #include <linux/device.h>
106 #include <linux/platform_device.h>
107 +#include <linux/mod_devicetable.h>
108 #include <linux/libata.h>
109 #include <linux/ahci_platform.h>
110 #include "ahci.h"
111 +#include "ahci_platform.h"
112
113 static struct scsi_host_template ahci_platform_sht = {
114 AHCI_SHT("ahci_platform"),
115 @@ -29,6 +31,7 @@ static struct scsi_host_template ahci_pl
116
117 static int __init ahci_probe(struct platform_device *pdev)
118 {
119 + const struct platform_device_id *platid = platform_get_device_id(pdev);
120 struct device *dev = &pdev->dev;
121 struct ahci_platform_data *pdata = dev->platform_data;
122 struct ata_port_info pi = {
123 @@ -46,6 +49,9 @@ static int __init ahci_probe(struct plat
124 int i;
125 int rc;
126
127 + if (!pdata && platid && platid->driver_data)
128 + pdata = (void *)platid->driver_data;
129 +
130 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
131 if (!mem) {
132 dev_err(dev, "no mmio space\n");
133 @@ -171,17 +177,28 @@ static int __devexit ahci_remove(struct
134 return 0;
135 }
136
137 +static const struct platform_device_id ahci_platform_ids[] = {
138 + { "ahci", },
139 +#ifdef CONFIG_SATA_AHCI_CNS3XXX
140 + { "ahci-cns3xxx", (kernel_ulong_t)&cns3xxx_ahci_platform_data},
141 +#endif
142 + { },
143 +};
144 +MODULE_DEVICE_TABLE(platform, ahci_platform_ids);
145 +
146 static struct platform_driver ahci_driver = {
147 - .remove = __devexit_p(ahci_remove),
148 .driver = {
149 .name = "ahci",
150 .owner = THIS_MODULE,
151 },
152 + .probe = ahci_probe,
153 + .remove = __devexit_p(ahci_remove),
154 + .id_table = ahci_platform_ids,
155 };
156
157 static int __init ahci_init(void)
158 {
159 - return platform_driver_probe(&ahci_driver, ahci_probe);
160 + return platform_driver_register(&ahci_driver);
161 }
162 module_init(ahci_init);
163
164 @@ -194,4 +211,3 @@ module_exit(ahci_exit);
165 MODULE_DESCRIPTION("AHCI SATA platform driver");
166 MODULE_AUTHOR("Anton Vorontsov <avorontsov@ru.mvista.com>");
167 MODULE_LICENSE("GPL");
168 -MODULE_ALIAS("platform:ahci");
169 --- /dev/null
170 +++ b/drivers/ata/ahci_platform.h
171 @@ -0,0 +1,19 @@
172 +/*
173 + * Copyright 2010 MontaVista Software, LLC.
174 + * Copyright 2010 Cavium Networks
175 + *
176 + * Authors: Anton Vorontsov <avorontsov@xxxxxxxxxx>
177 + * Mac Lin <mkl0301@xxxxxxxxx>
178 + *
179 + * This program is free software; you can redistribute it and/or modify
180 + * it under the terms of the GNU General Public License version 2 as
181 + * published by the Free Software Foundation.
182 + */
183 +
184 +#ifndef _DRIVERS_SATA_AHCI_PLATFORMS_H
185 +#define _DRIVERS_SATA_AHCI_PLATFORMS_H
186 +
187 +extern struct ahci_platform_data cns3xxx_ahci_platform_data;
188 +
189 +#endif /*_DRIVERS_SATA_AHCI_PLATFORMS_H*/
190 +
This page took 0.050686 seconds and 5 git commands to generate.