aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2011-05-15 07:32:49 -0400
committerNicolas Pitre <nico@fluxnic.net>2011-05-16 15:11:33 -0400
commit4fcd3f374a928081d391cd9a570afe3b2c692fdc (patch)
tree04359735b7e279174e8d183c9d87906472fc0987
parentee9627234dae8d1b8059b2ac39c961ee0932b803 (diff)
ARM: orion: Consolidate USB platform setup code.
Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
-rw-r--r--arch/arm/mach-dove/common.c65
-rw-r--r--arch/arm/mach-kirkwood/common.c39
-rw-r--r--arch/arm/mach-mv78xx0/common.c93
-rw-r--r--arch/arm/mach-orion5x/common.c66
-rw-r--r--arch/arm/plat-orion/common.c89
-rw-r--r--arch/arm/plat-orion/include/plat/common.h12
6 files changed, 117 insertions, 247 deletions
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 6703bf3120b6..1412592fdca1 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -30,7 +30,6 @@
30#include <mach/bridge-regs.h> 30#include <mach/bridge-regs.h>
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <linux/irq.h> 32#include <linux/irq.h>
33#include <plat/ehci-orion.h>
34#include <plat/time.h> 33#include <plat/time.h>
35#include <plat/common.h> 34#include <plat/common.h>
36#include "common.h" 35#include "common.h"
@@ -70,77 +69,21 @@ void __init dove_map_io(void)
70} 69}
71 70
72/***************************************************************************** 71/*****************************************************************************
73 * EHCI
74 ****************************************************************************/
75static struct orion_ehci_data dove_ehci_data = {
76 .dram = &dove_mbus_dram_info,
77 .phy_version = EHCI_PHY_NA,
78};
79
80static u64 ehci_dmamask = DMA_BIT_MASK(32);
81
82/*****************************************************************************
83 * EHCI0 72 * EHCI0
84 ****************************************************************************/ 73 ****************************************************************************/
85static struct resource dove_ehci0_resources[] = {
86 {
87 .start = DOVE_USB0_PHYS_BASE,
88 .end = DOVE_USB0_PHYS_BASE + SZ_4K - 1,
89 .flags = IORESOURCE_MEM,
90 }, {
91 .start = IRQ_DOVE_USB0,
92 .end = IRQ_DOVE_USB0,
93 .flags = IORESOURCE_IRQ,
94 },
95};
96
97static struct platform_device dove_ehci0 = {
98 .name = "orion-ehci",
99 .id = 0,
100 .dev = {
101 .dma_mask = &ehci_dmamask,
102 .coherent_dma_mask = DMA_BIT_MASK(32),
103 .platform_data = &dove_ehci_data,
104 },
105 .resource = dove_ehci0_resources,
106 .num_resources = ARRAY_SIZE(dove_ehci0_resources),
107};
108
109void __init dove_ehci0_init(void) 74void __init dove_ehci0_init(void)
110{ 75{
111 platform_device_register(&dove_ehci0); 76 orion_ehci_init(&dove_mbus_dram_info,
77 DOVE_USB0_PHYS_BASE, IRQ_DOVE_USB0);
112} 78}
113 79
114/***************************************************************************** 80/*****************************************************************************
115 * EHCI1 81 * EHCI1
116 ****************************************************************************/ 82 ****************************************************************************/
117static struct resource dove_ehci1_resources[] = {
118 {
119 .start = DOVE_USB1_PHYS_BASE,
120 .end = DOVE_USB1_PHYS_BASE + SZ_4K - 1,
121 .flags = IORESOURCE_MEM,
122 }, {
123 .start = IRQ_DOVE_USB1,
124 .end = IRQ_DOVE_USB1,
125 .flags = IORESOURCE_IRQ,
126 },
127};
128
129static struct platform_device dove_ehci1 = {
130 .name = "orion-ehci",
131 .id = 1,
132 .dev = {
133 .dma_mask = &ehci_dmamask,
134 .coherent_dma_mask = DMA_BIT_MASK(32),
135 .platform_data = &dove_ehci_data,
136 },
137 .resource = dove_ehci1_resources,
138 .num_resources = ARRAY_SIZE(dove_ehci1_resources),
139};
140
141void __init dove_ehci1_init(void) 83void __init dove_ehci1_init(void)
142{ 84{
143 platform_device_register(&dove_ehci1); 85 orion_ehci_1_init(&dove_mbus_dram_info,
86 DOVE_USB1_PHYS_BASE, IRQ_DOVE_USB1);
144} 87}
145 88
146/***************************************************************************** 89/*****************************************************************************
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 7c2b5df4aa1c..9e56cbb19184 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -26,7 +26,6 @@
26#include <mach/bridge-regs.h> 26#include <mach/bridge-regs.h>
27#include <plat/audio.h> 27#include <plat/audio.h>
28#include <plat/cache-feroceon-l2.h> 28#include <plat/cache-feroceon-l2.h>
29#include <plat/ehci-orion.h>
30#include <plat/mvsdio.h> 29#include <plat/mvsdio.h>
31#include <plat/orion_nand.h> 30#include <plat/orion_nand.h>
32#include <plat/common.h> 31#include <plat/common.h>
@@ -69,47 +68,13 @@ unsigned int kirkwood_clk_ctrl = CGC_DUNIT | CGC_RESERVED;
69 68
70 69
71/***************************************************************************** 70/*****************************************************************************
72 * EHCI
73 ****************************************************************************/
74static struct orion_ehci_data kirkwood_ehci_data = {
75 .dram = &kirkwood_mbus_dram_info,
76 .phy_version = EHCI_PHY_NA,
77};
78
79static u64 ehci_dmamask = DMA_BIT_MASK(32);
80
81
82/*****************************************************************************
83 * EHCI0 71 * EHCI0
84 ****************************************************************************/ 72 ****************************************************************************/
85static struct resource kirkwood_ehci_resources[] = {
86 {
87 .start = USB_PHYS_BASE,
88 .end = USB_PHYS_BASE + SZ_4K - 1,
89 .flags = IORESOURCE_MEM,
90 }, {
91 .start = IRQ_KIRKWOOD_USB,
92 .end = IRQ_KIRKWOOD_USB,
93 .flags = IORESOURCE_IRQ,
94 },
95};
96
97static struct platform_device kirkwood_ehci = {
98 .name = "orion-ehci",
99 .id = 0,
100 .dev = {
101 .dma_mask = &ehci_dmamask,
102 .coherent_dma_mask = DMA_BIT_MASK(32),
103 .platform_data = &kirkwood_ehci_data,
104 },
105 .resource = kirkwood_ehci_resources,
106 .num_resources = ARRAY_SIZE(kirkwood_ehci_resources),
107};
108
109void __init kirkwood_ehci_init(void) 73void __init kirkwood_ehci_init(void)
110{ 74{
111 kirkwood_clk_ctrl |= CGC_USB0; 75 kirkwood_clk_ctrl |= CGC_USB0;
112 platform_device_register(&kirkwood_ehci); 76 orion_ehci_init(&kirkwood_mbus_dram_info,
77 USB_PHYS_BASE, IRQ_KIRKWOOD_USB);
113} 78}
114 79
115 80
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
index aa27c154cd0d..f250196becd7 100644
--- a/arch/arm/mach-mv78xx0/common.c
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -20,7 +20,6 @@
20#include <mach/mv78xx0.h> 20#include <mach/mv78xx0.h>
21#include <mach/bridge-regs.h> 21#include <mach/bridge-regs.h>
22#include <plat/cache-feroceon-l2.h> 22#include <plat/cache-feroceon-l2.h>
23#include <plat/ehci-orion.h>
24#include <plat/orion_nand.h> 23#include <plat/orion_nand.h>
25#include <plat/time.h> 24#include <plat/time.h>
26#include <plat/common.h> 25#include <plat/common.h>
@@ -168,110 +167,30 @@ void __init mv78xx0_map_io(void)
168/***************************************************************************** 167/*****************************************************************************
169 * EHCI 168 * EHCI
170 ****************************************************************************/ 169 ****************************************************************************/
171static struct orion_ehci_data mv78xx0_ehci_data = {
172 .dram = &mv78xx0_mbus_dram_info,
173 .phy_version = EHCI_PHY_NA,
174};
175
176static u64 ehci_dmamask = DMA_BIT_MASK(32);
177
178
179/*****************************************************************************
180 * EHCI0
181 ****************************************************************************/
182static struct resource mv78xx0_ehci0_resources[] = {
183 {
184 .start = USB0_PHYS_BASE,
185 .end = USB0_PHYS_BASE + SZ_4K - 1,
186 .flags = IORESOURCE_MEM,
187 }, {
188 .start = IRQ_MV78XX0_USB_0,
189 .end = IRQ_MV78XX0_USB_0,
190 .flags = IORESOURCE_IRQ,
191 },
192};
193
194static struct platform_device mv78xx0_ehci0 = {
195 .name = "orion-ehci",
196 .id = 0,
197 .dev = {
198 .dma_mask = &ehci_dmamask,
199 .coherent_dma_mask = DMA_BIT_MASK(32),
200 .platform_data = &mv78xx0_ehci_data,
201 },
202 .resource = mv78xx0_ehci0_resources,
203 .num_resources = ARRAY_SIZE(mv78xx0_ehci0_resources),
204};
205
206void __init mv78xx0_ehci0_init(void) 170void __init mv78xx0_ehci0_init(void)
207{ 171{
208 platform_device_register(&mv78xx0_ehci0); 172 orion_ehci_init(&mv78xx0_mbus_dram_info,
173 USB0_PHYS_BASE, IRQ_MV78XX0_USB_0);
209} 174}
210 175
211 176
212/***************************************************************************** 177/*****************************************************************************
213 * EHCI1 178 * EHCI1
214 ****************************************************************************/ 179 ****************************************************************************/
215static struct resource mv78xx0_ehci1_resources[] = {
216 {
217 .start = USB1_PHYS_BASE,
218 .end = USB1_PHYS_BASE + SZ_4K - 1,
219 .flags = IORESOURCE_MEM,
220 }, {
221 .start = IRQ_MV78XX0_USB_1,
222 .end = IRQ_MV78XX0_USB_1,
223 .flags = IORESOURCE_IRQ,
224 },
225};
226
227static struct platform_device mv78xx0_ehci1 = {
228 .name = "orion-ehci",
229 .id = 1,
230 .dev = {
231 .dma_mask = &ehci_dmamask,
232 .coherent_dma_mask = DMA_BIT_MASK(32),
233 .platform_data = &mv78xx0_ehci_data,
234 },
235 .resource = mv78xx0_ehci1_resources,
236 .num_resources = ARRAY_SIZE(mv78xx0_ehci1_resources),
237};
238
239void __init mv78xx0_ehci1_init(void) 180void __init mv78xx0_ehci1_init(void)
240{ 181{
241 platform_device_register(&mv78xx0_ehci1); 182 orion_ehci_1_init(&mv78xx0_mbus_dram_info,
183 USB1_PHYS_BASE, IRQ_MV78XX0_USB_1);
242} 184}
243 185
244 186
245/***************************************************************************** 187/*****************************************************************************
246 * EHCI2 188 * EHCI2
247 ****************************************************************************/ 189 ****************************************************************************/
248static struct resource mv78xx0_ehci2_resources[] = {
249 {
250 .start = USB2_PHYS_BASE,
251 .end = USB2_PHYS_BASE + SZ_4K - 1,
252 .flags = IORESOURCE_MEM,
253 }, {
254 .start = IRQ_MV78XX0_USB_2,
255 .end = IRQ_MV78XX0_USB_2,
256 .flags = IORESOURCE_IRQ,
257 },
258};
259
260static struct platform_device mv78xx0_ehci2 = {
261 .name = "orion-ehci",
262 .id = 2,
263 .dev = {
264 .dma_mask = &ehci_dmamask,
265 .coherent_dma_mask = DMA_BIT_MASK(32),
266 .platform_data = &mv78xx0_ehci_data,
267 },
268 .resource = mv78xx0_ehci2_resources,
269 .num_resources = ARRAY_SIZE(mv78xx0_ehci2_resources),
270};
271
272void __init mv78xx0_ehci2_init(void) 190void __init mv78xx0_ehci2_init(void)
273{ 191{
274 platform_device_register(&mv78xx0_ehci2); 192 orion_ehci_2_init(&mv78xx0_mbus_dram_info,
193 USB2_PHYS_BASE, IRQ_MV78XX0_USB_2);
275} 194}
276 195
277 196
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 5c7e39164c5e..2132eafa7ccc 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -28,7 +28,6 @@
28#include <mach/bridge-regs.h> 28#include <mach/bridge-regs.h>
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30#include <mach/orion5x.h> 30#include <mach/orion5x.h>
31#include <plat/ehci-orion.h>
32#include <plat/orion_nand.h> 31#include <plat/orion_nand.h>
33#include <plat/time.h> 32#include <plat/time.h>
34#include <plat/common.h> 33#include <plat/common.h>
@@ -68,79 +67,22 @@ void __init orion5x_map_io(void)
68 67
69 68
70/***************************************************************************** 69/*****************************************************************************
71 * EHCI
72 ****************************************************************************/
73static struct orion_ehci_data orion5x_ehci_data = {
74 .dram = &orion5x_mbus_dram_info,
75 .phy_version = EHCI_PHY_ORION,
76};
77
78static u64 ehci_dmamask = DMA_BIT_MASK(32);
79
80
81/*****************************************************************************
82 * EHCI0 70 * EHCI0
83 ****************************************************************************/ 71 ****************************************************************************/
84static struct resource orion5x_ehci0_resources[] = {
85 {
86 .start = ORION5X_USB0_PHYS_BASE,
87 .end = ORION5X_USB0_PHYS_BASE + SZ_4K - 1,
88 .flags = IORESOURCE_MEM,
89 }, {
90 .start = IRQ_ORION5X_USB0_CTRL,
91 .end = IRQ_ORION5X_USB0_CTRL,
92 .flags = IORESOURCE_IRQ,
93 },
94};
95
96static struct platform_device orion5x_ehci0 = {
97 .name = "orion-ehci",
98 .id = 0,
99 .dev = {
100 .dma_mask = &ehci_dmamask,
101 .coherent_dma_mask = DMA_BIT_MASK(32),
102 .platform_data = &orion5x_ehci_data,
103 },
104 .resource = orion5x_ehci0_resources,
105 .num_resources = ARRAY_SIZE(orion5x_ehci0_resources),
106};
107
108void __init orion5x_ehci0_init(void) 72void __init orion5x_ehci0_init(void)
109{ 73{
110 platform_device_register(&orion5x_ehci0); 74 orion_ehci_init(&orion5x_mbus_dram_info,
75 ORION5X_USB0_PHYS_BASE, IRQ_ORION5X_USB0_CTRL);
111} 76}
112 77
113 78
114/***************************************************************************** 79/*****************************************************************************
115 * EHCI1 80 * EHCI1
116 ****************************************************************************/ 81 ****************************************************************************/
117static struct resource orion5x_ehci1_resources[] = {
118 {
119 .start = ORION5X_USB1_PHYS_BASE,
120 .end = ORION5X_USB1_PHYS_BASE + SZ_4K - 1,
121 .flags = IORESOURCE_MEM,
122 }, {
123 .start = IRQ_ORION5X_USB1_CTRL,
124 .end = IRQ_ORION5X_USB1_CTRL,
125 .flags = IORESOURCE_IRQ,
126 },
127};
128
129static struct platform_device orion5x_ehci1 = {
130 .name = "orion-ehci",
131 .id = 1,
132 .dev = {
133 .dma_mask = &ehci_dmamask,
134 .coherent_dma_mask = DMA_BIT_MASK(32),
135 .platform_data = &orion5x_ehci_data,
136 },
137 .resource = orion5x_ehci1_resources,
138 .num_resources = ARRAY_SIZE(orion5x_ehci1_resources),
139};
140
141void __init orion5x_ehci1_init(void) 82void __init orion5x_ehci1_init(void)
142{ 83{
143 platform_device_register(&orion5x_ehci1); 84 orion_ehci_1_init(&orion5x_mbus_dram_info,
85 ORION5X_USB1_PHYS_BASE, IRQ_ORION5X_USB1_CTRL);
144} 86}
145 87
146 88
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index 0a2face7109e..802cbf4b2f3c 100644
--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -20,6 +20,7 @@
20#include <linux/spi/orion_spi.h> 20#include <linux/spi/orion_spi.h>
21#include <plat/orion_wdt.h> 21#include <plat/orion_wdt.h>
22#include <plat/mv_xor.h> 22#include <plat/mv_xor.h>
23#include <plat/ehci-orion.h>
23 24
24/* Fill in the resources structure and link it into the platform 25/* Fill in the resources structure and link it into the platform
25 device structure. There is always a memory region, and nearly 26 device structure. There is always a memory region, and nearly
@@ -800,3 +801,91 @@ void __init orion_xor1_init(unsigned long mapbase_low,
800 orion_xor_init_channels(&orion_xor10_data, &orion_xor10_channel, 801 orion_xor_init_channels(&orion_xor10_data, &orion_xor10_channel,
801 &orion_xor11_data, &orion_xor11_channel); 802 &orion_xor11_data, &orion_xor11_channel);
802} 803}
804
805/*****************************************************************************
806 * EHCI
807 ****************************************************************************/
808static struct orion_ehci_data orion_ehci_data = {
809 .phy_version = EHCI_PHY_NA,
810};
811
812static u64 ehci_dmamask = DMA_BIT_MASK(32);
813
814
815/*****************************************************************************
816 * EHCI0
817 ****************************************************************************/
818static struct resource orion_ehci_resources[2];
819
820static struct platform_device orion_ehci = {
821 .name = "orion-ehci",
822 .id = 0,
823 .dev = {
824 .dma_mask = &ehci_dmamask,
825 .coherent_dma_mask = DMA_BIT_MASK(32),
826 .platform_data = &orion_ehci_data,
827 },
828};
829
830void __init orion_ehci_init(struct mbus_dram_target_info *mbus_dram_info,
831 unsigned long mapbase,
832 unsigned long irq)
833{
834 orion_ehci_data.dram = mbus_dram_info;
835 fill_resources(&orion_ehci, orion_ehci_resources, mapbase, SZ_4K - 1,
836 irq);
837
838 platform_device_register(&orion_ehci);
839}
840
841/*****************************************************************************
842 * EHCI1
843 ****************************************************************************/
844static struct resource orion_ehci_1_resources[2];
845
846static struct platform_device orion_ehci_1 = {
847 .name = "orion-ehci",
848 .id = 1,
849 .dev = {
850 .dma_mask = &ehci_dmamask,
851 .coherent_dma_mask = DMA_BIT_MASK(32),
852 .platform_data = &orion_ehci_data,
853 },
854};
855
856void __init orion_ehci_1_init(struct mbus_dram_target_info *mbus_dram_info,
857 unsigned long mapbase,
858 unsigned long irq)
859{
860 orion_ehci_data.dram = mbus_dram_info;
861 fill_resources(&orion_ehci_1, orion_ehci_1_resources,
862 mapbase, SZ_4K - 1, irq);
863
864 platform_device_register(&orion_ehci_1);
865}
866
867/*****************************************************************************
868 * EHCI2
869 ****************************************************************************/
870static struct resource orion_ehci_2_resources[2];
871
872static struct platform_device orion_ehci_2 = {
873 .name = "orion-ehci",
874 .id = 2,
875 .dev = {
876 .dma_mask = &ehci_dmamask,
877 .coherent_dma_mask = DMA_BIT_MASK(32),
878 .platform_data = &orion_ehci_data,
879 },
880};
881
882void __init orion_ehci_2_init(struct mbus_dram_target_info *mbus_dram_info,
883 unsigned long mapbase,
884 unsigned long irq)
885{
886 orion_ehci_data.dram = mbus_dram_info;
887 fill_resources(&orion_ehci_2, orion_ehci_2_resources,
888 mapbase, SZ_4K - 1, irq);
889
890 platform_device_register(&orion_ehci_2);
891}
diff --git a/arch/arm/plat-orion/include/plat/common.h b/arch/arm/plat-orion/include/plat/common.h
index 0e11ca5acd02..6386f8e5df25 100644
--- a/arch/arm/plat-orion/include/plat/common.h
+++ b/arch/arm/plat-orion/include/plat/common.h
@@ -92,4 +92,16 @@ void __init orion_xor1_init(unsigned long mapbase_low,
92 unsigned long mapbase_high, 92 unsigned long mapbase_high,
93 unsigned long irq_0, 93 unsigned long irq_0,
94 unsigned long irq_1); 94 unsigned long irq_1);
95
96void __init orion_ehci_init(struct mbus_dram_target_info *mbus_dram_info,
97 unsigned long mapbase,
98 unsigned long irq);
99
100void __init orion_ehci_1_init(struct mbus_dram_target_info *mbus_dram_info,
101 unsigned long mapbase,
102 unsigned long irq);
103
104void __init orion_ehci_2_init(struct mbus_dram_target_info *mbus_dram_info,
105 unsigned long mapbase,
106 unsigned long irq);
95#endif 107#endif