diff options
author | Andrew Lunn <andrew@lunn.ch> | 2011-05-15 07:32:50 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@fluxnic.net> | 2011-05-16 15:13:19 -0400 |
commit | 9e613f8a7904f2b7516eed08f413463c579325bd (patch) | |
tree | 30c0fb01bc1af921009079536b4d9ec3a0222e41 | |
parent | 4fcd3f374a928081d391cd9a570afe3b2c692fdc (diff) |
ARM: orion: Consolidate SATA platform setup.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
-rw-r--r-- | arch/arm/mach-dove/common.c | 30 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/common.c | 30 | ||||
-rw-r--r-- | arch/arm/mach-mv78xx0/common.c | 29 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/common.c | 29 | ||||
-rw-r--r-- | arch/arm/plat-orion/common.c | 35 | ||||
-rw-r--r-- | arch/arm/plat-orion/include/plat/common.h | 5 |
6 files changed, 50 insertions, 108 deletions
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c index 1412592fdca1..5ed51b84c1b2 100644 --- a/arch/arm/mach-dove/common.c +++ b/arch/arm/mach-dove/common.c | |||
@@ -107,35 +107,11 @@ void __init dove_rtc_init(void) | |||
107 | /***************************************************************************** | 107 | /***************************************************************************** |
108 | * SATA | 108 | * SATA |
109 | ****************************************************************************/ | 109 | ****************************************************************************/ |
110 | static struct resource dove_sata_resources[] = { | ||
111 | { | ||
112 | .name = "sata base", | ||
113 | .start = DOVE_SATA_PHYS_BASE, | ||
114 | .end = DOVE_SATA_PHYS_BASE + 0x5000 - 1, | ||
115 | .flags = IORESOURCE_MEM, | ||
116 | }, { | ||
117 | .name = "sata irq", | ||
118 | .start = IRQ_DOVE_SATA, | ||
119 | .end = IRQ_DOVE_SATA, | ||
120 | .flags = IORESOURCE_IRQ, | ||
121 | }, | ||
122 | }; | ||
123 | |||
124 | static struct platform_device dove_sata = { | ||
125 | .name = "sata_mv", | ||
126 | .id = 0, | ||
127 | .dev = { | ||
128 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
129 | }, | ||
130 | .num_resources = ARRAY_SIZE(dove_sata_resources), | ||
131 | .resource = dove_sata_resources, | ||
132 | }; | ||
133 | |||
134 | void __init dove_sata_init(struct mv_sata_platform_data *sata_data) | 110 | void __init dove_sata_init(struct mv_sata_platform_data *sata_data) |
135 | { | 111 | { |
136 | sata_data->dram = &dove_mbus_dram_info; | 112 | orion_sata_init(sata_data, &dove_mbus_dram_info, |
137 | dove_sata.dev.platform_data = sata_data; | 113 | DOVE_SATA_PHYS_BASE, IRQ_DOVE_SATA); |
138 | platform_device_register(&dove_sata); | 114 | |
139 | } | 115 | } |
140 | 116 | ||
141 | /***************************************************************************** | 117 | /***************************************************************************** |
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index 9e56cbb19184..e96ec4e61615 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c | |||
@@ -172,38 +172,14 @@ static void __init kirkwood_rtc_init(void) | |||
172 | /***************************************************************************** | 172 | /***************************************************************************** |
173 | * SATA | 173 | * SATA |
174 | ****************************************************************************/ | 174 | ****************************************************************************/ |
175 | static struct resource kirkwood_sata_resources[] = { | ||
176 | { | ||
177 | .name = "sata base", | ||
178 | .start = SATA_PHYS_BASE, | ||
179 | .end = SATA_PHYS_BASE + 0x5000 - 1, | ||
180 | .flags = IORESOURCE_MEM, | ||
181 | }, { | ||
182 | .name = "sata irq", | ||
183 | .start = IRQ_KIRKWOOD_SATA, | ||
184 | .end = IRQ_KIRKWOOD_SATA, | ||
185 | .flags = IORESOURCE_IRQ, | ||
186 | }, | ||
187 | }; | ||
188 | |||
189 | static struct platform_device kirkwood_sata = { | ||
190 | .name = "sata_mv", | ||
191 | .id = 0, | ||
192 | .dev = { | ||
193 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
194 | }, | ||
195 | .num_resources = ARRAY_SIZE(kirkwood_sata_resources), | ||
196 | .resource = kirkwood_sata_resources, | ||
197 | }; | ||
198 | |||
199 | void __init kirkwood_sata_init(struct mv_sata_platform_data *sata_data) | 175 | void __init kirkwood_sata_init(struct mv_sata_platform_data *sata_data) |
200 | { | 176 | { |
201 | kirkwood_clk_ctrl |= CGC_SATA0; | 177 | kirkwood_clk_ctrl |= CGC_SATA0; |
202 | if (sata_data->n_ports > 1) | 178 | if (sata_data->n_ports > 1) |
203 | kirkwood_clk_ctrl |= CGC_SATA1; | 179 | kirkwood_clk_ctrl |= CGC_SATA1; |
204 | sata_data->dram = &kirkwood_mbus_dram_info; | 180 | |
205 | kirkwood_sata.dev.platform_data = sata_data; | 181 | orion_sata_init(sata_data, &kirkwood_mbus_dram_info, |
206 | platform_device_register(&kirkwood_sata); | 182 | SATA_PHYS_BASE, IRQ_KIRKWOOD_SATA); |
207 | } | 183 | } |
208 | 184 | ||
209 | 185 | ||
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c index f250196becd7..23d3980ef59d 100644 --- a/arch/arm/mach-mv78xx0/common.c +++ b/arch/arm/mach-mv78xx0/common.c | |||
@@ -275,35 +275,10 @@ void __init mv78xx0_i2c_init(void) | |||
275 | /***************************************************************************** | 275 | /***************************************************************************** |
276 | * SATA | 276 | * SATA |
277 | ****************************************************************************/ | 277 | ****************************************************************************/ |
278 | static struct resource mv78xx0_sata_resources[] = { | ||
279 | { | ||
280 | .name = "sata base", | ||
281 | .start = SATA_PHYS_BASE, | ||
282 | .end = SATA_PHYS_BASE + 0x5000 - 1, | ||
283 | .flags = IORESOURCE_MEM, | ||
284 | }, { | ||
285 | .name = "sata irq", | ||
286 | .start = IRQ_MV78XX0_SATA, | ||
287 | .end = IRQ_MV78XX0_SATA, | ||
288 | .flags = IORESOURCE_IRQ, | ||
289 | }, | ||
290 | }; | ||
291 | |||
292 | static struct platform_device mv78xx0_sata = { | ||
293 | .name = "sata_mv", | ||
294 | .id = 0, | ||
295 | .dev = { | ||
296 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
297 | }, | ||
298 | .num_resources = ARRAY_SIZE(mv78xx0_sata_resources), | ||
299 | .resource = mv78xx0_sata_resources, | ||
300 | }; | ||
301 | |||
302 | void __init mv78xx0_sata_init(struct mv_sata_platform_data *sata_data) | 278 | void __init mv78xx0_sata_init(struct mv_sata_platform_data *sata_data) |
303 | { | 279 | { |
304 | sata_data->dram = &mv78xx0_mbus_dram_info; | 280 | orion_sata_init(sata_data, &mv78xx0_mbus_dram_info, |
305 | mv78xx0_sata.dev.platform_data = sata_data; | 281 | SATA_PHYS_BASE, IRQ_MV78XX0_SATA); |
306 | platform_device_register(&mv78xx0_sata); | ||
307 | } | 282 | } |
308 | 283 | ||
309 | 284 | ||
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c index 2132eafa7ccc..8bbf497cc5f1 100644 --- a/arch/arm/mach-orion5x/common.c +++ b/arch/arm/mach-orion5x/common.c | |||
@@ -119,35 +119,10 @@ void __init orion5x_i2c_init(void) | |||
119 | /***************************************************************************** | 119 | /***************************************************************************** |
120 | * SATA | 120 | * SATA |
121 | ****************************************************************************/ | 121 | ****************************************************************************/ |
122 | static struct resource orion5x_sata_resources[] = { | ||
123 | { | ||
124 | .name = "sata base", | ||
125 | .start = ORION5X_SATA_PHYS_BASE, | ||
126 | .end = ORION5X_SATA_PHYS_BASE + 0x5000 - 1, | ||
127 | .flags = IORESOURCE_MEM, | ||
128 | }, { | ||
129 | .name = "sata irq", | ||
130 | .start = IRQ_ORION5X_SATA, | ||
131 | .end = IRQ_ORION5X_SATA, | ||
132 | .flags = IORESOURCE_IRQ, | ||
133 | }, | ||
134 | }; | ||
135 | |||
136 | static struct platform_device orion5x_sata = { | ||
137 | .name = "sata_mv", | ||
138 | .id = 0, | ||
139 | .dev = { | ||
140 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
141 | }, | ||
142 | .num_resources = ARRAY_SIZE(orion5x_sata_resources), | ||
143 | .resource = orion5x_sata_resources, | ||
144 | }; | ||
145 | |||
146 | void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data) | 122 | void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data) |
147 | { | 123 | { |
148 | sata_data->dram = &orion5x_mbus_dram_info; | 124 | orion_sata_init(sata_data, &orion5x_mbus_dram_info, |
149 | orion5x_sata.dev.platform_data = sata_data; | 125 | ORION5X_SATA_PHYS_BASE, IRQ_ORION5X_SATA); |
150 | platform_device_register(&orion5x_sata); | ||
151 | } | 126 | } |
152 | 127 | ||
153 | 128 | ||
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c index 802cbf4b2f3c..d1cf7c3fb744 100644 --- a/arch/arm/plat-orion/common.c +++ b/arch/arm/plat-orion/common.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/dma-mapping.h> | 14 | #include <linux/dma-mapping.h> |
15 | #include <linux/serial_8250.h> | 15 | #include <linux/serial_8250.h> |
16 | #include <linux/mbus.h> | 16 | #include <linux/mbus.h> |
17 | #include <linux/ata_platform.h> | ||
17 | #include <linux/mv643xx_eth.h> | 18 | #include <linux/mv643xx_eth.h> |
18 | #include <linux/mv643xx_i2c.h> | 19 | #include <linux/mv643xx_i2c.h> |
19 | #include <net/dsa.h> | 20 | #include <net/dsa.h> |
@@ -889,3 +890,37 @@ void __init orion_ehci_2_init(struct mbus_dram_target_info *mbus_dram_info, | |||
889 | 890 | ||
890 | platform_device_register(&orion_ehci_2); | 891 | platform_device_register(&orion_ehci_2); |
891 | } | 892 | } |
893 | |||
894 | /***************************************************************************** | ||
895 | * SATA | ||
896 | ****************************************************************************/ | ||
897 | static struct resource orion_sata_resources[2] = { | ||
898 | { | ||
899 | .name = "sata base", | ||
900 | }, { | ||
901 | .name = "sata irq", | ||
902 | }, | ||
903 | }; | ||
904 | |||
905 | static struct platform_device orion_sata = { | ||
906 | .name = "sata_mv", | ||
907 | .id = 0, | ||
908 | .dev = { | ||
909 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
910 | }, | ||
911 | }; | ||
912 | |||
913 | void __init orion_sata_init(struct mv_sata_platform_data *sata_data, | ||
914 | struct mbus_dram_target_info *mbus_dram_info, | ||
915 | unsigned long mapbase, | ||
916 | unsigned long irq) | ||
917 | { | ||
918 | sata_data->dram = mbus_dram_info; | ||
919 | orion_sata.dev.platform_data = sata_data; | ||
920 | fill_resources(&orion_sata, orion_sata_resources, | ||
921 | mapbase, 0x5000 - 1, irq); | ||
922 | |||
923 | platform_device_register(&orion_sata); | ||
924 | } | ||
925 | |||
926 | |||
diff --git a/arch/arm/plat-orion/include/plat/common.h b/arch/arm/plat-orion/include/plat/common.h index 6386f8e5df25..0ec6b663a834 100644 --- a/arch/arm/plat-orion/include/plat/common.h +++ b/arch/arm/plat-orion/include/plat/common.h | |||
@@ -104,4 +104,9 @@ void __init orion_ehci_1_init(struct mbus_dram_target_info *mbus_dram_info, | |||
104 | void __init orion_ehci_2_init(struct mbus_dram_target_info *mbus_dram_info, | 104 | void __init orion_ehci_2_init(struct mbus_dram_target_info *mbus_dram_info, |
105 | unsigned long mapbase, | 105 | unsigned long mapbase, |
106 | unsigned long irq); | 106 | unsigned long irq); |
107 | |||
108 | void __init orion_sata_init(struct mv_sata_platform_data *sata_data, | ||
109 | struct mbus_dram_target_info *mbus_dram_info, | ||
110 | unsigned long mapbase, | ||
111 | unsigned long irq); | ||
107 | #endif | 112 | #endif |