aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--arch/arm/mach-orion5x/common.c226
-rw-r--r--arch/arm/mach-orion5x/common.h35
-rw-r--r--arch/arm/mach-orion5x/db88f5281-setup.c39
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c40
-rw-r--r--arch/arm/mach-orion5x/kurobox_pro-setup.c28
-rw-r--r--arch/arm/mach-orion5x/rd88f5182-setup.c29
-rw-r--r--arch/arm/mach-orion5x/ts209-setup.c38
7 files changed, 240 insertions, 195 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/*
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h
index bd0f05de6e18..da37c204bc38 100644
--- a/arch/arm/mach-orion5x/common.h
+++ b/arch/arm/mach-orion5x/common.h
@@ -1,10 +1,12 @@
1#ifndef __ARCH_ORION5X_COMMON_H 1#ifndef __ARCH_ORION5X_COMMON_H
2#define __ARCH_ORION5X_COMMON_H 2#define __ARCH_ORION5X_COMMON_H
3 3
4struct mv643xx_eth_platform_data;
5struct mv_sata_platform_data;
6
4/* 7/*
5 * Basic Orion init functions used early by machine-setup. 8 * Basic Orion init functions used early by machine-setup.
6 */ 9 */
7
8void orion5x_map_io(void); 10void orion5x_map_io(void);
9void orion5x_init_irq(void); 11void orion5x_init_irq(void);
10void orion5x_init(void); 12void orion5x_init(void);
@@ -23,13 +25,19 @@ void orion5x_setup_dev1_win(u32 base, u32 size);
23void orion5x_setup_dev2_win(u32 base, u32 size); 25void orion5x_setup_dev2_win(u32 base, u32 size);
24void orion5x_setup_pcie_wa_win(u32 base, u32 size); 26void orion5x_setup_pcie_wa_win(u32 base, u32 size);
25 27
28void orion5x_ehci0_init(void);
29void orion5x_ehci1_init(void);
30void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data);
31void orion5x_i2c_init(void);
32void orion5x_sata_init(struct mv_sata_platform_data *sata_data);
33void orion5x_uart0_init(void);
34void orion5x_uart1_init(void);
35
26/* 36/*
27 * Shared code used internally by other Orion core functions. 37 * PCIe/PCI functions.
28 * (/mach-orion/pci.c)
29 */ 38 */
30
31struct pci_sys_data;
32struct pci_bus; 39struct pci_bus;
40struct pci_sys_data;
33 41
34void orion5x_pcie_id(u32 *dev, u32 *rev); 42void orion5x_pcie_id(u32 *dev, u32 *rev);
35int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys); 43int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys);
@@ -40,26 +48,9 @@ int orion5x_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin);
40 * Valid GPIO pins according to MPP setup, used by machine-setup. 48 * Valid GPIO pins according to MPP setup, used by machine-setup.
41 * (/mach-orion/gpio.c). 49 * (/mach-orion/gpio.c).
42 */ 50 */
43
44void orion5x_gpio_set_valid_pins(u32 pins); 51void orion5x_gpio_set_valid_pins(u32 pins);
45void gpio_display(void); /* debug */ 52void gpio_display(void); /* debug */
46 53
47/*
48 * Pull in Orion Ethernet platform_data, used by machine-setup
49 */
50
51struct mv643xx_eth_platform_data;
52
53void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data);
54
55/*
56 * Orion Sata platform_data, used by machine-setup
57 */
58
59struct mv_sata_platform_data;
60
61void orion5x_sata_init(struct mv_sata_platform_data *sata_data);
62
63struct machine_desc; 54struct machine_desc;
64struct meminfo; 55struct meminfo;
65struct tag; 56struct tag;
diff --git a/arch/arm/mach-orion5x/db88f5281-setup.c b/arch/arm/mach-orion5x/db88f5281-setup.c
index 4ee695028254..eca76b3348bc 100644
--- a/arch/arm/mach-orion5x/db88f5281-setup.c
+++ b/arch/arm/mach-orion5x/db88f5281-setup.c
@@ -298,13 +298,6 @@ static struct i2c_board_info __initdata db88f5281_i2c_rtc = {
298/***************************************************************************** 298/*****************************************************************************
299 * General Setup 299 * General Setup
300 ****************************************************************************/ 300 ****************************************************************************/
301
302static struct platform_device *db88f5281_devs[] __initdata = {
303 &db88f5281_boot_flash,
304 &db88f5281_nor_flash,
305 &db88f5281_nand_flash,
306};
307
308static void __init db88f5281_init(void) 301static void __init db88f5281_init(void)
309{ 302{
310 /* 303 /*
@@ -313,15 +306,6 @@ static void __init db88f5281_init(void)
313 orion5x_init(); 306 orion5x_init();
314 307
315 /* 308 /*
316 * Setup the CPU address decode windows for our on-board devices
317 */
318 orion5x_setup_dev_boot_win(DB88F5281_NOR_BOOT_BASE,
319 DB88F5281_NOR_BOOT_SIZE);
320 orion5x_setup_dev0_win(DB88F5281_7SEG_BASE, DB88F5281_7SEG_SIZE);
321 orion5x_setup_dev1_win(DB88F5281_NOR_BASE, DB88F5281_NOR_SIZE);
322 orion5x_setup_dev2_win(DB88F5281_NAND_BASE, DB88F5281_NAND_SIZE);
323
324 /*
325 * Setup Multiplexing Pins: 309 * Setup Multiplexing Pins:
326 * MPP0: GPIO (USB Over Current) MPP1: GPIO (USB Vbat input) 310 * MPP0: GPIO (USB Over Current) MPP1: GPIO (USB Vbat input)
327 * MPP2: PCI_REQn[2] MPP3: PCI_GNTn[2] 311 * MPP2: PCI_REQn[2] MPP3: PCI_GNTn[2]
@@ -342,9 +326,28 @@ static void __init db88f5281_init(void)
342 326
343 orion5x_gpio_set_valid_pins(0x00003fc3); 327 orion5x_gpio_set_valid_pins(0x00003fc3);
344 328
345 platform_add_devices(db88f5281_devs, ARRAY_SIZE(db88f5281_devs)); 329 /*
346 i2c_register_board_info(0, &db88f5281_i2c_rtc, 1); 330 * Configure peripherals.
331 */
332 orion5x_ehci0_init();
347 orion5x_eth_init(&db88f5281_eth_data); 333 orion5x_eth_init(&db88f5281_eth_data);
334 orion5x_i2c_init();
335 orion5x_uart0_init();
336 orion5x_uart1_init();
337
338 orion5x_setup_dev_boot_win(DB88F5281_NOR_BOOT_BASE,
339 DB88F5281_NOR_BOOT_SIZE);
340 platform_device_register(&db88f5281_boot_flash);
341
342 orion5x_setup_dev0_win(DB88F5281_7SEG_BASE, DB88F5281_7SEG_SIZE);
343
344 orion5x_setup_dev1_win(DB88F5281_NOR_BASE, DB88F5281_NOR_SIZE);
345 platform_device_register(&db88f5281_nor_flash);
346
347 orion5x_setup_dev2_win(DB88F5281_NAND_BASE, DB88F5281_NAND_SIZE);
348 platform_device_register(&db88f5281_nand_flash);
349
350 i2c_register_board_info(0, &db88f5281_i2c_rtc, 1);
348} 351}
349 352
350MACHINE_START(DB88F5281, "Marvell Orion-2 Development Board") 353MACHINE_START(DB88F5281, "Marvell Orion-2 Development Board")
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index ec53f866ed11..cd200f766099 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -213,12 +213,6 @@ static struct platform_device dns323_button_device = {
213 * General Setup 213 * General Setup
214 */ 214 */
215 215
216static struct platform_device *dns323_plat_devices[] __initdata = {
217 &dns323_nor_flash,
218 &dns323_gpio_leds,
219 &dns323_button_device,
220};
221
222/* 216/*
223 * On the DNS-323 the following devices are attached via I2C: 217 * On the DNS-323 the following devices are attached via I2C:
224 * 218 *
@@ -253,11 +247,6 @@ static void __init dns323_init(void)
253 /* Setup basic Orion functions. Need to be called early. */ 247 /* Setup basic Orion functions. Need to be called early. */
254 orion5x_init(); 248 orion5x_init();
255 249
256 /* setup flash mapping
257 * CS3 holds a 8 MB Spansion S29GL064M90TFIR4
258 */
259 orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE);
260
261 /* DNS-323 has a Marvell 88X7042 SATA controller attached via PCIe 250 /* DNS-323 has a Marvell 88X7042 SATA controller attached via PCIe
262 * 251 *
263 * Open a special address decode windows for the PCIe WA. 252 * Open a special address decode windows for the PCIe WA.
@@ -294,21 +283,32 @@ static void __init dns323_init(void)
294 */ 283 */
295 orion5x_gpio_set_valid_pins(0x07f6); 284 orion5x_gpio_set_valid_pins(0x07f6);
296 285
297 /* register dns323 specific power-off method */ 286 /*
298 if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 || 287 * Configure peripherals.
299 gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0) 288 */
300 pr_err("DNS323: failed to setup power-off GPIO\n"); 289 orion5x_ehci0_init();
290 orion5x_eth_init(&dns323_eth_data);
291 orion5x_i2c_init();
292 orion5x_uart0_init();
301 293
302 pm_power_off = dns323_power_off; 294 /* setup flash mapping
295 * CS3 holds a 8 MB Spansion S29GL064M90TFIR4
296 */
297 orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE);
298 platform_device_register(&dns323_nor_flash);
299
300 platform_device_register(&dns323_gpio_leds);
303 301
304 /* register flash and other platform devices */ 302 platform_device_register(&dns323_button_device);
305 platform_add_devices(dns323_plat_devices,
306 ARRAY_SIZE(dns323_plat_devices));
307 303
308 i2c_register_board_info(0, dns323_i2c_devices, 304 i2c_register_board_info(0, dns323_i2c_devices,
309 ARRAY_SIZE(dns323_i2c_devices)); 305 ARRAY_SIZE(dns323_i2c_devices));
310 306
311 orion5x_eth_init(&dns323_eth_data); 307 /* register dns323 specific power-off method */
308 if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
309 gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
310 pr_err("DNS323: failed to setup power-off GPIO\n");
311 pm_power_off = dns323_power_off;
312} 312}
313 313
314/* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */ 314/* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */
diff --git a/arch/arm/mach-orion5x/kurobox_pro-setup.c b/arch/arm/mach-orion5x/kurobox_pro-setup.c
index 60fcbf1e5d72..10d9fc2ef11a 100644
--- a/arch/arm/mach-orion5x/kurobox_pro-setup.c
+++ b/arch/arm/mach-orion5x/kurobox_pro-setup.c
@@ -188,13 +188,6 @@ static void __init kurobox_pro_init(void)
188 orion5x_init(); 188 orion5x_init();
189 189
190 /* 190 /*
191 * Setup the CPU address decode windows for our devices
192 */
193 orion5x_setup_dev_boot_win(KUROBOX_PRO_NOR_BOOT_BASE,
194 KUROBOX_PRO_NOR_BOOT_SIZE);
195 orion5x_setup_dev0_win(KUROBOX_PRO_NAND_BASE, KUROBOX_PRO_NAND_SIZE);
196
197 /*
198 * Open a special address decode windows for the PCIe WA. 191 * Open a special address decode windows for the PCIe WA.
199 */ 192 */
200 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE, 193 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
@@ -221,12 +214,27 @@ static void __init kurobox_pro_init(void)
221 214
222 orion5x_gpio_set_valid_pins(0x0000000c); 215 orion5x_gpio_set_valid_pins(0x0000000c);
223 216
217 /*
218 * Configure peripherals.
219 */
220 orion5x_ehci0_init();
221 orion5x_ehci1_init();
222 orion5x_eth_init(&kurobox_pro_eth_data);
223 orion5x_i2c_init();
224 orion5x_sata_init(&kurobox_pro_sata_data);
225 orion5x_uart0_init();
226
227 orion5x_setup_dev_boot_win(KUROBOX_PRO_NOR_BOOT_BASE,
228 KUROBOX_PRO_NOR_BOOT_SIZE);
224 platform_device_register(&kurobox_pro_nor_flash); 229 platform_device_register(&kurobox_pro_nor_flash);
225 if (machine_is_kurobox_pro()) 230
231 if (machine_is_kurobox_pro()) {
232 orion5x_setup_dev0_win(KUROBOX_PRO_NAND_BASE,
233 KUROBOX_PRO_NAND_SIZE);
226 platform_device_register(&kurobox_pro_nand_flash); 234 platform_device_register(&kurobox_pro_nand_flash);
235 }
236
227 i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1); 237 i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1);
228 orion5x_eth_init(&kurobox_pro_eth_data);
229 orion5x_sata_init(&kurobox_pro_sata_data);
230} 238}
231 239
232#ifdef CONFIG_MACH_KUROBOX_PRO 240#ifdef CONFIG_MACH_KUROBOX_PRO
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c
index 62fd99fc664a..4496ed1cab73 100644
--- a/arch/arm/mach-orion5x/rd88f5182-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5182-setup.c
@@ -241,11 +241,6 @@ static struct mv_sata_platform_data rd88f5182_sata_data = {
241/***************************************************************************** 241/*****************************************************************************
242 * General Setup 242 * General Setup
243 ****************************************************************************/ 243 ****************************************************************************/
244
245static struct platform_device *rd88f5182_devices[] __initdata = {
246 &rd88f5182_nor_flash,
247};
248
249static void __init rd88f5182_init(void) 244static void __init rd88f5182_init(void)
250{ 245{
251 /* 246 /*
@@ -254,13 +249,6 @@ static void __init rd88f5182_init(void)
254 orion5x_init(); 249 orion5x_init();
255 250
256 /* 251 /*
257 * Setup the CPU address decode windows for our devices
258 */
259 orion5x_setup_dev_boot_win(RD88F5182_NOR_BOOT_BASE,
260 RD88F5182_NOR_BOOT_SIZE);
261 orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE);
262
263 /*
264 * Open a special address decode windows for the PCIe WA. 252 * Open a special address decode windows for the PCIe WA.
265 */ 253 */
266 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE, 254 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
@@ -296,10 +284,23 @@ static void __init rd88f5182_init(void)
296 284
297 orion5x_gpio_set_valid_pins(0x000000fb); 285 orion5x_gpio_set_valid_pins(0x000000fb);
298 286
299 platform_add_devices(rd88f5182_devices, ARRAY_SIZE(rd88f5182_devices)); 287 /*
300 i2c_register_board_info(0, &rd88f5182_i2c_rtc, 1); 288 * Configure peripherals.
289 */
290 orion5x_ehci0_init();
291 orion5x_ehci1_init();
301 orion5x_eth_init(&rd88f5182_eth_data); 292 orion5x_eth_init(&rd88f5182_eth_data);
293 orion5x_i2c_init();
302 orion5x_sata_init(&rd88f5182_sata_data); 294 orion5x_sata_init(&rd88f5182_sata_data);
295 orion5x_uart0_init();
296
297 orion5x_setup_dev_boot_win(RD88F5182_NOR_BOOT_BASE,
298 RD88F5182_NOR_BOOT_SIZE);
299
300 orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE);
301 platform_device_register(&rd88f5182_nor_flash);
302
303 i2c_register_board_info(0, &rd88f5182_i2c_rtc, 1);
303} 304}
304 305
305MACHINE_START(RD88F5182, "Marvell Orion-NAS Reference Design") 306MACHINE_START(RD88F5182, "Marvell Orion-NAS Reference Design")
diff --git a/arch/arm/mach-orion5x/ts209-setup.c b/arch/arm/mach-orion5x/ts209-setup.c
index 5374b6edb9a1..b62fdb6cf6cb 100644
--- a/arch/arm/mach-orion5x/ts209-setup.c
+++ b/arch/arm/mach-orion5x/ts209-setup.c
@@ -332,16 +332,9 @@ static struct mv_sata_platform_data qnap_ts209_sata_data = {
332 332
333 * General Setup 333 * General Setup
334 ****************************************************************************/ 334 ****************************************************************************/
335
336static struct platform_device *qnap_ts209_devices[] __initdata = {
337 &qnap_ts209_nor_flash,
338 &qnap_ts209_button_device,
339};
340
341/* 335/*
342 * QNAP TS-[12]09 specific power off method via UART1-attached PIC 336 * QNAP TS-[12]09 specific power off method via UART1-attached PIC
343 */ 337 */
344
345#define UART1_REG(x) (UART1_VIRT_BASE + ((UART_##x) << 2)) 338#define UART1_REG(x) (UART1_VIRT_BASE + ((UART_##x) << 2))
346 339
347static void qnap_ts209_power_off(void) 340static void qnap_ts209_power_off(void)
@@ -372,12 +365,6 @@ static void __init qnap_ts209_init(void)
372 orion5x_init(); 365 orion5x_init();
373 366
374 /* 367 /*
375 * Setup flash mapping
376 */
377 orion5x_setup_dev_boot_win(QNAP_TS209_NOR_BOOT_BASE,
378 QNAP_TS209_NOR_BOOT_SIZE);
379
380 /*
381 * Open a special address decode windows for the PCIe WA. 368 * Open a special address decode windows for the PCIe WA.
382 */ 369 */
383 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE, 370 orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
@@ -411,11 +398,22 @@ static void __init qnap_ts209_init(void)
411 orion5x_write(MPP_16_19_CTRL, 0x5500); 398 orion5x_write(MPP_16_19_CTRL, 0x5500);
412 orion5x_gpio_set_valid_pins(0x3cc0fff); 399 orion5x_gpio_set_valid_pins(0x3cc0fff);
413 400
414 /* register ts209 specific power-off method */ 401 /*
415 pm_power_off = qnap_ts209_power_off; 402 * Configure peripherals.
403 */
404 orion5x_ehci0_init();
405 orion5x_ehci1_init();
406 ts209_find_mac_addr();
407 orion5x_eth_init(&qnap_ts209_eth_data);
408 orion5x_i2c_init();
409 orion5x_sata_init(&qnap_ts209_sata_data);
410 orion5x_uart0_init();
411
412 orion5x_setup_dev_boot_win(QNAP_TS209_NOR_BOOT_BASE,
413 QNAP_TS209_NOR_BOOT_SIZE);
414 platform_device_register(&qnap_ts209_nor_flash);
416 415
417 platform_add_devices(qnap_ts209_devices, 416 platform_device_register(&qnap_ts209_button_device);
418 ARRAY_SIZE(qnap_ts209_devices));
419 417
420 /* Get RTC IRQ and register the chip */ 418 /* Get RTC IRQ and register the chip */
421 if (gpio_request(TS209_RTC_GPIO, "rtc") == 0) { 419 if (gpio_request(TS209_RTC_GPIO, "rtc") == 0) {
@@ -428,10 +426,8 @@ static void __init qnap_ts209_init(void)
428 pr_warning("qnap_ts209_init: failed to get RTC IRQ\n"); 426 pr_warning("qnap_ts209_init: failed to get RTC IRQ\n");
429 i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1); 427 i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1);
430 428
431 ts209_find_mac_addr(); 429 /* register ts209 specific power-off method */
432 orion5x_eth_init(&qnap_ts209_eth_data); 430 pm_power_off = qnap_ts209_power_off;
433
434 orion5x_sata_init(&qnap_ts209_sata_data);
435} 431}
436 432
437MACHINE_START(TS209, "QNAP TS-109/TS-209") 433MACHINE_START(TS209, "QNAP TS-109/TS-209")