aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-orion5x/common.c
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@wantstofly.org>2008-04-21 23:37:12 -0400
committerLennert Buytenhek <buytenh@marvell.com>2008-06-22 16:44:45 -0400
commit044f6c7c449ae8ba0353b032706b098a7ad5e304 (patch)
tree527bebfce6634c7d24a9521272142c67be182679 /arch/arm/mach-orion5x/common.c
parent6eef84a5496c678ab27b72bec0fc785c9cee063b (diff)
[ARM] Orion: move EHCI/I2C/UART peripheral init into board code
This patch moves initialisation of EHCI/I2C/UART platform devices from the common orion5x_init() into the board support code. The rationale behind this is that only the board support code knows whether certain peripherals have been brought out on the board, and not initialising peripherals that haven't been brought out is desirable for example: - to reduce user confusion (e.g. seeing both 'eth0' and 'eth1' appear while there is only one ethernet port on the board); and - to allow for future power savings (peripherals that have not been brought out can be clock gated off entirely). Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Russell King <linux@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-orion5x/common.c')
-rw-r--r--arch/arm/mach-orion5x/common.c226
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 70static struct orion_ehci_data orion5x_ehci_data = {
70static 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
90static 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
111static struct platform_device orion5x_uart = { 74static 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 ****************************************************************************/
125static struct resource orion5x_ehci0_resources[] = { 80static 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
137static 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
149static struct orion_ehci_data orion5x_ehci_data = {
150 .dram = &orion5x_mbus_dram_info,
151};
152
153static u64 ehci_dmamask = 0xffffffffUL;
154
155static struct platform_device orion5x_ehci0 = { 92static 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
104void __init orion5x_ehci0_init(void)
105{
106 platform_device_register(&orion5x_ehci0);
107}
108
109
110/*****************************************************************************
111 * EHCI1
112 ****************************************************************************/
113static 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
167static struct platform_device orion5x_ehci1 = { 125static 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
137void __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
184struct mv643xx_eth_shared_platform_data orion5x_eth_shared_data = { 146struct 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
237static struct mv64xxx_i2c_pdata orion5x_i2c_pdata = { 198static 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
228void __init orion5x_i2c_init(void)
229{
230 platform_device_register(&orion5x_i2c);
231}
232
233
267/***************************************************************************** 234/*****************************************************************************
268 * Sata port 235 * SATA
269 ****************************************************************************/ 236 ****************************************************************************/
270static struct resource orion5x_sata_resources[] = { 237static 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 ****************************************************************************/
272static 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
285static 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
297static 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
307void __init orion5x_uart0_init(void)
308{
309 platform_device_register(&orion5x_uart0);
310}
311
312
313/*****************************************************************************
314 * UART1
303 ****************************************************************************/ 315 ****************************************************************************/
316static 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
329static 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
341static 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
351void __init orion5x_uart1_init(void)
352{
353 platform_device_register(&orion5x_uart1);
354}
304 355
356
357/*****************************************************************************
358 * Time handling
359 ****************************************************************************/
305static void orion5x_timer_init(void) 360static 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/*