diff options
Diffstat (limited to 'arch/arm/mach-orion5x/common.c')
-rw-r--r-- | arch/arm/mach-orion5x/common.c | 226 |
1 files changed, 136 insertions, 90 deletions
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c index fa4be3cb1549..b2986717319e 100644 --- a/arch/arm/mach-orion5x/common.c +++ b/arch/arm/mach-orion5x/common.c | |||
@@ -63,65 +63,20 @@ void __init orion5x_map_io(void) | |||
63 | iotable_init(orion5x_io_desc, ARRAY_SIZE(orion5x_io_desc)); | 63 | iotable_init(orion5x_io_desc, ARRAY_SIZE(orion5x_io_desc)); |
64 | } | 64 | } |
65 | 65 | ||
66 | |||
66 | /***************************************************************************** | 67 | /***************************************************************************** |
67 | * UART | 68 | * EHCI |
68 | ****************************************************************************/ | 69 | ****************************************************************************/ |
69 | 70 | static struct orion_ehci_data orion5x_ehci_data = { | |
70 | static struct resource orion5x_uart_resources[] = { | 71 | .dram = &orion5x_mbus_dram_info, |
71 | { | ||
72 | .start = UART0_PHYS_BASE, | ||
73 | .end = UART0_PHYS_BASE + 0xff, | ||
74 | .flags = IORESOURCE_MEM, | ||
75 | }, { | ||
76 | .start = IRQ_ORION5X_UART0, | ||
77 | .end = IRQ_ORION5X_UART0, | ||
78 | .flags = IORESOURCE_IRQ, | ||
79 | }, { | ||
80 | .start = UART1_PHYS_BASE, | ||
81 | .end = UART1_PHYS_BASE + 0xff, | ||
82 | .flags = IORESOURCE_MEM, | ||
83 | }, { | ||
84 | .start = IRQ_ORION5X_UART1, | ||
85 | .end = IRQ_ORION5X_UART1, | ||
86 | .flags = IORESOURCE_IRQ, | ||
87 | }, | ||
88 | }; | ||
89 | |||
90 | static struct plat_serial8250_port orion5x_uart_data[] = { | ||
91 | { | ||
92 | .mapbase = UART0_PHYS_BASE, | ||
93 | .membase = (char *)UART0_VIRT_BASE, | ||
94 | .irq = IRQ_ORION5X_UART0, | ||
95 | .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF, | ||
96 | .iotype = UPIO_MEM, | ||
97 | .regshift = 2, | ||
98 | .uartclk = ORION5X_TCLK, | ||
99 | }, { | ||
100 | .mapbase = UART1_PHYS_BASE, | ||
101 | .membase = (char *)UART1_VIRT_BASE, | ||
102 | .irq = IRQ_ORION5X_UART1, | ||
103 | .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF, | ||
104 | .iotype = UPIO_MEM, | ||
105 | .regshift = 2, | ||
106 | .uartclk = ORION5X_TCLK, | ||
107 | }, { | ||
108 | }, | ||
109 | }; | 72 | }; |
110 | 73 | ||
111 | static struct platform_device orion5x_uart = { | 74 | static u64 ehci_dmamask = 0xffffffffUL; |
112 | .name = "serial8250", | ||
113 | .id = PLAT8250_DEV_PLATFORM, | ||
114 | .dev = { | ||
115 | .platform_data = orion5x_uart_data, | ||
116 | }, | ||
117 | .resource = orion5x_uart_resources, | ||
118 | .num_resources = ARRAY_SIZE(orion5x_uart_resources), | ||
119 | }; | ||
120 | 75 | ||
121 | /******************************************************************************* | ||
122 | * USB Controller - 2 interfaces | ||
123 | ******************************************************************************/ | ||
124 | 76 | ||
77 | /***************************************************************************** | ||
78 | * EHCI0 | ||
79 | ****************************************************************************/ | ||
125 | static struct resource orion5x_ehci0_resources[] = { | 80 | static struct resource orion5x_ehci0_resources[] = { |
126 | { | 81 | { |
127 | .start = ORION5X_USB0_PHYS_BASE, | 82 | .start = ORION5X_USB0_PHYS_BASE, |
@@ -134,24 +89,6 @@ static struct resource orion5x_ehci0_resources[] = { | |||
134 | }, | 89 | }, |
135 | }; | 90 | }; |
136 | 91 | ||
137 | static struct resource orion5x_ehci1_resources[] = { | ||
138 | { | ||
139 | .start = ORION5X_USB1_PHYS_BASE, | ||
140 | .end = ORION5X_USB1_PHYS_BASE + SZ_4K - 1, | ||
141 | .flags = IORESOURCE_MEM, | ||
142 | }, { | ||
143 | .start = IRQ_ORION5X_USB1_CTRL, | ||
144 | .end = IRQ_ORION5X_USB1_CTRL, | ||
145 | .flags = IORESOURCE_IRQ, | ||
146 | }, | ||
147 | }; | ||
148 | |||
149 | static struct orion_ehci_data orion5x_ehci_data = { | ||
150 | .dram = &orion5x_mbus_dram_info, | ||
151 | }; | ||
152 | |||
153 | static u64 ehci_dmamask = 0xffffffffUL; | ||
154 | |||
155 | static struct platform_device orion5x_ehci0 = { | 92 | static struct platform_device orion5x_ehci0 = { |
156 | .name = "orion-ehci", | 93 | .name = "orion-ehci", |
157 | .id = 0, | 94 | .id = 0, |
@@ -164,6 +101,27 @@ static struct platform_device orion5x_ehci0 = { | |||
164 | .num_resources = ARRAY_SIZE(orion5x_ehci0_resources), | 101 | .num_resources = ARRAY_SIZE(orion5x_ehci0_resources), |
165 | }; | 102 | }; |
166 | 103 | ||
104 | void __init orion5x_ehci0_init(void) | ||
105 | { | ||
106 | platform_device_register(&orion5x_ehci0); | ||
107 | } | ||
108 | |||
109 | |||
110 | /***************************************************************************** | ||
111 | * EHCI1 | ||
112 | ****************************************************************************/ | ||
113 | static struct resource orion5x_ehci1_resources[] = { | ||
114 | { | ||
115 | .start = ORION5X_USB1_PHYS_BASE, | ||
116 | .end = ORION5X_USB1_PHYS_BASE + SZ_4K - 1, | ||
117 | .flags = IORESOURCE_MEM, | ||
118 | }, { | ||
119 | .start = IRQ_ORION5X_USB1_CTRL, | ||
120 | .end = IRQ_ORION5X_USB1_CTRL, | ||
121 | .flags = IORESOURCE_IRQ, | ||
122 | }, | ||
123 | }; | ||
124 | |||
167 | static struct platform_device orion5x_ehci1 = { | 125 | static struct platform_device orion5x_ehci1 = { |
168 | .name = "orion-ehci", | 126 | .name = "orion-ehci", |
169 | .id = 1, | 127 | .id = 1, |
@@ -176,11 +134,15 @@ static struct platform_device orion5x_ehci1 = { | |||
176 | .num_resources = ARRAY_SIZE(orion5x_ehci1_resources), | 134 | .num_resources = ARRAY_SIZE(orion5x_ehci1_resources), |
177 | }; | 135 | }; |
178 | 136 | ||
137 | void __init orion5x_ehci1_init(void) | ||
138 | { | ||
139 | platform_device_register(&orion5x_ehci1); | ||
140 | } | ||
141 | |||
142 | |||
179 | /***************************************************************************** | 143 | /***************************************************************************** |
180 | * Gigabit Ethernet port | 144 | * GigE |
181 | * (The Orion and Discovery (MV643xx) families use the same Ethernet driver) | ||
182 | ****************************************************************************/ | 145 | ****************************************************************************/ |
183 | |||
184 | struct mv643xx_eth_shared_platform_data orion5x_eth_shared_data = { | 146 | struct mv643xx_eth_shared_platform_data orion5x_eth_shared_data = { |
185 | .dram = &orion5x_mbus_dram_info, | 147 | .dram = &orion5x_mbus_dram_info, |
186 | .t_clk = ORION5X_TCLK, | 148 | .t_clk = ORION5X_TCLK, |
@@ -229,11 +191,10 @@ void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data) | |||
229 | platform_device_register(&orion5x_eth); | 191 | platform_device_register(&orion5x_eth); |
230 | } | 192 | } |
231 | 193 | ||
194 | |||
232 | /***************************************************************************** | 195 | /***************************************************************************** |
233 | * I2C controller | 196 | * I2C |
234 | * (The Orion and Discovery (MV643xx) families share the same I2C controller) | ||
235 | ****************************************************************************/ | 197 | ****************************************************************************/ |
236 | |||
237 | static struct mv64xxx_i2c_pdata orion5x_i2c_pdata = { | 198 | static struct mv64xxx_i2c_pdata orion5x_i2c_pdata = { |
238 | .freq_m = 8, /* assumes 166 MHz TCLK */ | 199 | .freq_m = 8, /* assumes 166 MHz TCLK */ |
239 | .freq_n = 3, | 200 | .freq_n = 3, |
@@ -244,7 +205,7 @@ static struct resource orion5x_i2c_resources[] = { | |||
244 | { | 205 | { |
245 | .name = "i2c base", | 206 | .name = "i2c base", |
246 | .start = I2C_PHYS_BASE, | 207 | .start = I2C_PHYS_BASE, |
247 | .end = I2C_PHYS_BASE + 0x20 -1, | 208 | .end = I2C_PHYS_BASE + 0x1f, |
248 | .flags = IORESOURCE_MEM, | 209 | .flags = IORESOURCE_MEM, |
249 | }, { | 210 | }, { |
250 | .name = "i2c irq", | 211 | .name = "i2c irq", |
@@ -264,8 +225,14 @@ static struct platform_device orion5x_i2c = { | |||
264 | }, | 225 | }, |
265 | }; | 226 | }; |
266 | 227 | ||
228 | void __init orion5x_i2c_init(void) | ||
229 | { | ||
230 | platform_device_register(&orion5x_i2c); | ||
231 | } | ||
232 | |||
233 | |||
267 | /***************************************************************************** | 234 | /***************************************************************************** |
268 | * Sata port | 235 | * SATA |
269 | ****************************************************************************/ | 236 | ****************************************************************************/ |
270 | static struct resource orion5x_sata_resources[] = { | 237 | static struct resource orion5x_sata_resources[] = { |
271 | { | 238 | { |
@@ -298,10 +265,98 @@ void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data) | |||
298 | platform_device_register(&orion5x_sata); | 265 | platform_device_register(&orion5x_sata); |
299 | } | 266 | } |
300 | 267 | ||
268 | |||
301 | /***************************************************************************** | 269 | /***************************************************************************** |
302 | * Time handling | 270 | * UART0 |
271 | ****************************************************************************/ | ||
272 | static struct plat_serial8250_port orion5x_uart0_data[] = { | ||
273 | { | ||
274 | .mapbase = UART0_PHYS_BASE, | ||
275 | .membase = (char *)UART0_VIRT_BASE, | ||
276 | .irq = IRQ_ORION5X_UART0, | ||
277 | .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF, | ||
278 | .iotype = UPIO_MEM, | ||
279 | .regshift = 2, | ||
280 | .uartclk = ORION5X_TCLK, | ||
281 | }, { | ||
282 | }, | ||
283 | }; | ||
284 | |||
285 | static struct resource orion5x_uart0_resources[] = { | ||
286 | { | ||
287 | .start = UART0_PHYS_BASE, | ||
288 | .end = UART0_PHYS_BASE + 0xff, | ||
289 | .flags = IORESOURCE_MEM, | ||
290 | }, { | ||
291 | .start = IRQ_ORION5X_UART0, | ||
292 | .end = IRQ_ORION5X_UART0, | ||
293 | .flags = IORESOURCE_IRQ, | ||
294 | }, | ||
295 | }; | ||
296 | |||
297 | static struct platform_device orion5x_uart0 = { | ||
298 | .name = "serial8250", | ||
299 | .id = PLAT8250_DEV_PLATFORM, | ||
300 | .dev = { | ||
301 | .platform_data = orion5x_uart0_data, | ||
302 | }, | ||
303 | .resource = orion5x_uart0_resources, | ||
304 | .num_resources = ARRAY_SIZE(orion5x_uart0_resources), | ||
305 | }; | ||
306 | |||
307 | void __init orion5x_uart0_init(void) | ||
308 | { | ||
309 | platform_device_register(&orion5x_uart0); | ||
310 | } | ||
311 | |||
312 | |||
313 | /***************************************************************************** | ||
314 | * UART1 | ||
303 | ****************************************************************************/ | 315 | ****************************************************************************/ |
316 | static struct plat_serial8250_port orion5x_uart1_data[] = { | ||
317 | { | ||
318 | .mapbase = UART1_PHYS_BASE, | ||
319 | .membase = (char *)UART1_VIRT_BASE, | ||
320 | .irq = IRQ_ORION5X_UART1, | ||
321 | .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF, | ||
322 | .iotype = UPIO_MEM, | ||
323 | .regshift = 2, | ||
324 | .uartclk = ORION5X_TCLK, | ||
325 | }, { | ||
326 | }, | ||
327 | }; | ||
328 | |||
329 | static struct resource orion5x_uart1_resources[] = { | ||
330 | { | ||
331 | .start = UART1_PHYS_BASE, | ||
332 | .end = UART1_PHYS_BASE + 0xff, | ||
333 | .flags = IORESOURCE_MEM, | ||
334 | }, { | ||
335 | .start = IRQ_ORION5X_UART1, | ||
336 | .end = IRQ_ORION5X_UART1, | ||
337 | .flags = IORESOURCE_IRQ, | ||
338 | }, | ||
339 | }; | ||
340 | |||
341 | static struct platform_device orion5x_uart1 = { | ||
342 | .name = "serial8250", | ||
343 | .id = PLAT8250_DEV_PLATFORM1, | ||
344 | .dev = { | ||
345 | .platform_data = orion5x_uart1_data, | ||
346 | }, | ||
347 | .resource = orion5x_uart1_resources, | ||
348 | .num_resources = ARRAY_SIZE(orion5x_uart1_resources), | ||
349 | }; | ||
350 | |||
351 | void __init orion5x_uart1_init(void) | ||
352 | { | ||
353 | platform_device_register(&orion5x_uart1); | ||
354 | } | ||
304 | 355 | ||
356 | |||
357 | /***************************************************************************** | ||
358 | * Time handling | ||
359 | ****************************************************************************/ | ||
305 | static void orion5x_timer_init(void) | 360 | static void orion5x_timer_init(void) |
306 | { | 361 | { |
307 | orion_time_init(IRQ_ORION5X_BRIDGE, ORION5X_TCLK); | 362 | orion_time_init(IRQ_ORION5X_BRIDGE, ORION5X_TCLK); |
@@ -311,10 +366,10 @@ struct sys_timer orion5x_timer = { | |||
311 | .init = orion5x_timer_init, | 366 | .init = orion5x_timer_init, |
312 | }; | 367 | }; |
313 | 368 | ||
369 | |||
314 | /***************************************************************************** | 370 | /***************************************************************************** |
315 | * General | 371 | * General |
316 | ****************************************************************************/ | 372 | ****************************************************************************/ |
317 | |||
318 | /* | 373 | /* |
319 | * Identify device ID and rev from PCIe configuration header space '0'. | 374 | * Identify device ID and rev from PCIe configuration header space '0'. |
320 | */ | 375 | */ |
@@ -359,15 +414,6 @@ void __init orion5x_init(void) | |||
359 | * Setup Orion address map | 414 | * Setup Orion address map |
360 | */ | 415 | */ |
361 | orion5x_setup_cpu_mbus_bridge(); | 416 | orion5x_setup_cpu_mbus_bridge(); |
362 | |||
363 | /* | ||
364 | * Register devices. | ||
365 | */ | ||
366 | platform_device_register(&orion5x_uart); | ||
367 | platform_device_register(&orion5x_ehci0); | ||
368 | if (dev == MV88F5182_DEV_ID) | ||
369 | platform_device_register(&orion5x_ehci1); | ||
370 | platform_device_register(&orion5x_i2c); | ||
371 | } | 417 | } |
372 | 418 | ||
373 | /* | 419 | /* |