upgrade orion to 2.6.26-rc7
[librecmc/librecmc.git] / target / linux / orion / patches / 010-move_EHCI_I2C_UART_peripheral_init.patch
1 This patch moves initialisation of EHCI/I2C/UART platform devices
2 from the common orion5x_init() into the board support code.
3
4 The rationale behind this is that only the board support code knows
5 whether certain peripherals have been brought out on the board, and
6 not initialising peripherals that haven't been brought out is
7 desirable for example:
8 - to reduce user confusion (e.g. seeing both 'eth0' and 'eth1'
9   appear while there is only one ethernet port on the board); and
10 - to allow for future power savings (peripherals that have not
11   been brought out can be clock gated off entirely.)
12
13 Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
14 ---
15  arch/arm/mach-orion5x/common.c            |  226 +++++++++++++++++------------
16  arch/arm/mach-orion5x/common.h            |   35 ++---
17  arch/arm/mach-orion5x/db88f5281-setup.c   |   39 +++---
18  arch/arm/mach-orion5x/dns323-setup.c      |   40 +++---
19  arch/arm/mach-orion5x/kurobox_pro-setup.c |   28 +++--
20  arch/arm/mach-orion5x/rd88f5182-setup.c   |   29 ++--
21  arch/arm/mach-orion5x/ts209-setup.c       |   38 ++---
22  7 files changed, 240 insertions(+), 195 deletions(-)
23
24 --- a/arch/arm/mach-orion5x/common.c
25 +++ b/arch/arm/mach-orion5x/common.c
26 @@ -63,65 +63,20 @@
27         iotable_init(orion5x_io_desc, ARRAY_SIZE(orion5x_io_desc));
28  }
29  
30 +
31  /*****************************************************************************
32 - * UART
33 + * EHCI
34   ****************************************************************************/
35 -
36 -static struct resource orion5x_uart_resources[] = {
37 -       {
38 -               .start          = UART0_PHYS_BASE,
39 -               .end            = UART0_PHYS_BASE + 0xff,
40 -               .flags          = IORESOURCE_MEM,
41 -       }, {
42 -               .start          = IRQ_ORION5X_UART0,
43 -               .end            = IRQ_ORION5X_UART0,
44 -               .flags          = IORESOURCE_IRQ,
45 -       }, {
46 -               .start          = UART1_PHYS_BASE,
47 -               .end            = UART1_PHYS_BASE + 0xff,
48 -               .flags          = IORESOURCE_MEM,
49 -       }, {
50 -               .start          = IRQ_ORION5X_UART1,
51 -               .end            = IRQ_ORION5X_UART1,
52 -               .flags          = IORESOURCE_IRQ,
53 -       },
54 -};
55 -
56 -static struct plat_serial8250_port orion5x_uart_data[] = {
57 -       {
58 -               .mapbase        = UART0_PHYS_BASE,
59 -               .membase        = (char *)UART0_VIRT_BASE,
60 -               .irq            = IRQ_ORION5X_UART0,
61 -               .flags          = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
62 -               .iotype         = UPIO_MEM,
63 -               .regshift       = 2,
64 -               .uartclk        = ORION5X_TCLK,
65 -       }, {
66 -               .mapbase        = UART1_PHYS_BASE,
67 -               .membase        = (char *)UART1_VIRT_BASE,
68 -               .irq            = IRQ_ORION5X_UART1,
69 -               .flags          = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
70 -               .iotype         = UPIO_MEM,
71 -               .regshift       = 2,
72 -               .uartclk        = ORION5X_TCLK,
73 -       }, {
74 -       },
75 +static struct orion_ehci_data orion5x_ehci_data = {
76 +       .dram           = &orion5x_mbus_dram_info,
77  };
78  
79 -static struct platform_device orion5x_uart = {
80 -       .name                   = "serial8250",
81 -       .id                     = PLAT8250_DEV_PLATFORM,
82 -       .dev                    = {
83 -               .platform_data  = orion5x_uart_data,
84 -       },
85 -       .resource               = orion5x_uart_resources,
86 -       .num_resources          = ARRAY_SIZE(orion5x_uart_resources),
87 -};
88 +static u64 ehci_dmamask = 0xffffffffUL;
89  
90 -/*******************************************************************************
91 - * USB Controller - 2 interfaces
92 - ******************************************************************************/
93  
94 +/*****************************************************************************
95 + * EHCI0
96 + ****************************************************************************/
97  static struct resource orion5x_ehci0_resources[] = {
98         {
99                 .start  = ORION5X_USB0_PHYS_BASE,
100 @@ -134,24 +89,6 @@
101         },
102  };
103  
104 -static struct resource orion5x_ehci1_resources[] = {
105 -       {
106 -               .start  = ORION5X_USB1_PHYS_BASE,
107 -               .end    = ORION5X_USB1_PHYS_BASE + SZ_4K - 1,
108 -               .flags  = IORESOURCE_MEM,
109 -       }, {
110 -               .start  = IRQ_ORION5X_USB1_CTRL,
111 -               .end    = IRQ_ORION5X_USB1_CTRL,
112 -               .flags  = IORESOURCE_IRQ,
113 -       },
114 -};
115 -
116 -static struct orion_ehci_data orion5x_ehci_data = {
117 -       .dram           = &orion5x_mbus_dram_info,
118 -};
119 -
120 -static u64 ehci_dmamask = 0xffffffffUL;
121 -
122  static struct platform_device orion5x_ehci0 = {
123         .name           = "orion-ehci",
124         .id             = 0,
125 @@ -164,6 +101,27 @@
126         .num_resources  = ARRAY_SIZE(orion5x_ehci0_resources),
127  };
128  
129 +void __init orion5x_ehci0_init(void)
130 +{
131 +       platform_device_register(&orion5x_ehci0);
132 +}
133 +
134 +
135 +/*****************************************************************************
136 + * EHCI1
137 + ****************************************************************************/
138 +static struct resource orion5x_ehci1_resources[] = {
139 +       {
140 +               .start  = ORION5X_USB1_PHYS_BASE,
141 +               .end    = ORION5X_USB1_PHYS_BASE + SZ_4K - 1,
142 +               .flags  = IORESOURCE_MEM,
143 +       }, {
144 +               .start  = IRQ_ORION5X_USB1_CTRL,
145 +               .end    = IRQ_ORION5X_USB1_CTRL,
146 +               .flags  = IORESOURCE_IRQ,
147 +       },
148 +};
149 +
150  static struct platform_device orion5x_ehci1 = {
151         .name           = "orion-ehci",
152         .id             = 1,
153 @@ -176,11 +134,15 @@
154         .num_resources  = ARRAY_SIZE(orion5x_ehci1_resources),
155  };
156  
157 +void __init orion5x_ehci1_init(void)
158 +{
159 +       platform_device_register(&orion5x_ehci1);
160 +}
161 +
162 +
163  /*****************************************************************************
164 - * Gigabit Ethernet port
165 - * (The Orion and Discovery (MV643xx) families use the same Ethernet driver)
166 + * GigE
167   ****************************************************************************/
168 -
169  struct mv643xx_eth_shared_platform_data orion5x_eth_shared_data = {
170         .dram           = &orion5x_mbus_dram_info,
171         .t_clk          = ORION5X_TCLK,
172 @@ -229,11 +191,10 @@
173         platform_device_register(&orion5x_eth);
174  }
175  
176 +
177  /*****************************************************************************
178 - * I2C controller
179 - * (The Orion and Discovery (MV643xx) families share the same I2C controller)
180 + * I2C
181   ****************************************************************************/
182 -
183  static struct mv64xxx_i2c_pdata orion5x_i2c_pdata = {
184         .freq_m         = 8, /* assumes 166 MHz TCLK */
185         .freq_n         = 3,
186 @@ -244,7 +205,7 @@
187         {
188                 .name   = "i2c base",
189                 .start  = I2C_PHYS_BASE,
190 -               .end    = I2C_PHYS_BASE + 0x20 -1,
191 +               .end    = I2C_PHYS_BASE + 0x1f,
192                 .flags  = IORESOURCE_MEM,
193         }, {
194                 .name   = "i2c irq",
195 @@ -264,8 +225,14 @@
196         },
197  };
198  
199 +void __init orion5x_i2c_init(void)
200 +{
201 +       platform_device_register(&orion5x_i2c);
202 +}
203 +
204 +
205  /*****************************************************************************
206 - * Sata port
207 + * SATA
208   ****************************************************************************/
209  static struct resource orion5x_sata_resources[] = {
210         {
211 @@ -298,10 +265,98 @@
212         platform_device_register(&orion5x_sata);
213  }
214  
215 +
216  /*****************************************************************************
217 - * Time handling
218 + * UART0
219 + ****************************************************************************/
220 +static struct plat_serial8250_port orion5x_uart0_data[] = {
221 +       {
222 +               .mapbase        = UART0_PHYS_BASE,
223 +               .membase        = (char *)UART0_VIRT_BASE,
224 +               .irq            = IRQ_ORION5X_UART0,
225 +               .flags          = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
226 +               .iotype         = UPIO_MEM,
227 +               .regshift       = 2,
228 +               .uartclk        = ORION5X_TCLK,
229 +       }, {
230 +       },
231 +};
232 +
233 +static struct resource orion5x_uart0_resources[] = {
234 +       {
235 +               .start          = UART0_PHYS_BASE,
236 +               .end            = UART0_PHYS_BASE + 0xff,
237 +               .flags          = IORESOURCE_MEM,
238 +       }, {
239 +               .start          = IRQ_ORION5X_UART0,
240 +               .end            = IRQ_ORION5X_UART0,
241 +               .flags          = IORESOURCE_IRQ,
242 +       },
243 +};
244 +
245 +static struct platform_device orion5x_uart0 = {
246 +       .name                   = "serial8250",
247 +       .id                     = PLAT8250_DEV_PLATFORM,
248 +       .dev                    = {
249 +               .platform_data  = orion5x_uart0_data,
250 +       },
251 +       .resource               = orion5x_uart0_resources,
252 +       .num_resources          = ARRAY_SIZE(orion5x_uart0_resources),
253 +};
254 +
255 +void __init orion5x_uart0_init(void)
256 +{
257 +       platform_device_register(&orion5x_uart0);
258 +}
259 +
260 +
261 +/*****************************************************************************
262 + * UART1
263   ****************************************************************************/
264 +static struct plat_serial8250_port orion5x_uart1_data[] = {
265 +       {
266 +               .mapbase        = UART1_PHYS_BASE,
267 +               .membase        = (char *)UART1_VIRT_BASE,
268 +               .irq            = IRQ_ORION5X_UART1,
269 +               .flags          = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
270 +               .iotype         = UPIO_MEM,
271 +               .regshift       = 2,
272 +               .uartclk        = ORION5X_TCLK,
273 +       }, {
274 +       },
275 +};
276 +
277 +static struct resource orion5x_uart1_resources[] = {
278 +       {
279 +               .start          = UART1_PHYS_BASE,
280 +               .end            = UART1_PHYS_BASE + 0xff,
281 +               .flags          = IORESOURCE_MEM,
282 +       }, {
283 +               .start          = IRQ_ORION5X_UART1,
284 +               .end            = IRQ_ORION5X_UART1,
285 +               .flags          = IORESOURCE_IRQ,
286 +       },
287 +};
288 +
289 +static struct platform_device orion5x_uart1 = {
290 +       .name                   = "serial8250",
291 +       .id                     = PLAT8250_DEV_PLATFORM1,
292 +       .dev                    = {
293 +               .platform_data  = orion5x_uart1_data,
294 +       },
295 +       .resource               = orion5x_uart1_resources,
296 +       .num_resources          = ARRAY_SIZE(orion5x_uart1_resources),
297 +};
298 +
299 +void __init orion5x_uart1_init(void)
300 +{
301 +       platform_device_register(&orion5x_uart1);
302 +}
303  
304 +
305 +/*****************************************************************************
306 + * Time handling
307 + ****************************************************************************/
308  static void orion5x_timer_init(void)
309  {
310         orion_time_init(IRQ_ORION5X_BRIDGE, ORION5X_TCLK);
311 @@ -311,10 +366,10 @@
312         .init = orion5x_timer_init,
313  };
314  
315 +
316  /*****************************************************************************
317   * General
318   ****************************************************************************/
319 -
320  /*
321   * Identify device ID and rev from PCIe configuration header space '0'.
322   */
323 @@ -359,15 +414,6 @@
324          * Setup Orion address map
325          */
326         orion5x_setup_cpu_mbus_bridge();
327 -
328 -       /*
329 -        * Register devices.
330 -        */
331 -       platform_device_register(&orion5x_uart);
332 -       platform_device_register(&orion5x_ehci0);
333 -       if (dev == MV88F5182_DEV_ID)
334 -               platform_device_register(&orion5x_ehci1);
335 -       platform_device_register(&orion5x_i2c);
336  }
337  
338  /*
339 --- a/arch/arm/mach-orion5x/common.h
340 +++ b/arch/arm/mach-orion5x/common.h
341 @@ -1,10 +1,12 @@
342  #ifndef __ARCH_ORION5X_COMMON_H
343  #define __ARCH_ORION5X_COMMON_H
344  
345 +struct mv643xx_eth_platform_data;
346 +struct mv_sata_platform_data;
347 +
348  /*
349   * Basic Orion init functions used early by machine-setup.
350   */
351 -
352  void orion5x_map_io(void);
353  void orion5x_init_irq(void);
354  void orion5x_init(void);
355 @@ -23,13 +25,19 @@
356  void orion5x_setup_dev2_win(u32 base, u32 size);
357  void orion5x_setup_pcie_wa_win(u32 base, u32 size);
358  
359 +void orion5x_ehci0_init(void);
360 +void orion5x_ehci1_init(void);
361 +void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data);
362 +void orion5x_i2c_init(void);
363 +void orion5x_sata_init(struct mv_sata_platform_data *sata_data);
364 +void orion5x_uart0_init(void);
365 +void orion5x_uart1_init(void);
366 +
367  /*
368 - * Shared code used internally by other Orion core functions.
369 - * (/mach-orion/pci.c)
370 + * PCIe/PCI functions.
371   */
372 -
373 -struct pci_sys_data;
374  struct pci_bus;
375 +struct pci_sys_data;
376  
377  void orion5x_pcie_id(u32 *dev, u32 *rev);
378  int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys);
379 @@ -40,26 +48,9 @@
380   * Valid GPIO pins according to MPP setup, used by machine-setup.
381   * (/mach-orion/gpio.c).
382   */
383 -
384  void orion5x_gpio_set_valid_pins(u32 pins);
385  void gpio_display(void);       /* debug */
386  
387 -/*
388 - * Pull in Orion Ethernet platform_data, used by machine-setup
389 - */
390 -
391 -struct mv643xx_eth_platform_data;
392 -
393 -void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data);
394 -
395 -/*
396 - * Orion Sata platform_data, used by machine-setup
397 - */
398 -
399 -struct mv_sata_platform_data;
400 -
401 -void orion5x_sata_init(struct mv_sata_platform_data *sata_data);
402 -
403  struct machine_desc;
404  struct meminfo;
405  struct tag;
406 --- a/arch/arm/mach-orion5x/db88f5281-setup.c
407 +++ b/arch/arm/mach-orion5x/db88f5281-setup.c
408 @@ -298,13 +298,6 @@
409  /*****************************************************************************
410   * General Setup
411   ****************************************************************************/
412 -
413 -static struct platform_device *db88f5281_devs[] __initdata = {
414 -       &db88f5281_boot_flash,
415 -       &db88f5281_nor_flash,
416 -       &db88f5281_nand_flash,
417 -};
418 -
419  static void __init db88f5281_init(void)
420  {
421         /*
422 @@ -313,15 +306,6 @@
423         orion5x_init();
424  
425         /*
426 -        * Setup the CPU address decode windows for our on-board devices
427 -        */
428 -       orion5x_setup_dev_boot_win(DB88F5281_NOR_BOOT_BASE,
429 -                               DB88F5281_NOR_BOOT_SIZE);
430 -       orion5x_setup_dev0_win(DB88F5281_7SEG_BASE, DB88F5281_7SEG_SIZE);
431 -       orion5x_setup_dev1_win(DB88F5281_NOR_BASE, DB88F5281_NOR_SIZE);
432 -       orion5x_setup_dev2_win(DB88F5281_NAND_BASE, DB88F5281_NAND_SIZE);
433 -
434 -       /*
435          * Setup Multiplexing Pins:
436          * MPP0: GPIO (USB Over Current)        MPP1: GPIO (USB Vbat input)
437          * MPP2: PCI_REQn[2]                    MPP3: PCI_GNTn[2]
438 @@ -342,9 +326,28 @@
439  
440         orion5x_gpio_set_valid_pins(0x00003fc3);
441  
442 -       platform_add_devices(db88f5281_devs, ARRAY_SIZE(db88f5281_devs));
443 -       i2c_register_board_info(0, &db88f5281_i2c_rtc, 1);
444 +       /*
445 +        * Configure peripherals.
446 +        */
447 +       orion5x_ehci0_init();
448         orion5x_eth_init(&db88f5281_eth_data);
449 +       orion5x_i2c_init();
450 +       orion5x_uart0_init();
451 +       orion5x_uart1_init();
452 +
453 +       orion5x_setup_dev_boot_win(DB88F5281_NOR_BOOT_BASE,
454 +                               DB88F5281_NOR_BOOT_SIZE);
455 +       platform_device_register(&db88f5281_boot_flash);
456 +
457 +       orion5x_setup_dev0_win(DB88F5281_7SEG_BASE, DB88F5281_7SEG_SIZE);
458 +
459 +       orion5x_setup_dev1_win(DB88F5281_NOR_BASE, DB88F5281_NOR_SIZE);
460 +       platform_device_register(&db88f5281_nor_flash);
461 +
462 +       orion5x_setup_dev2_win(DB88F5281_NAND_BASE, DB88F5281_NAND_SIZE);
463 +       platform_device_register(&db88f5281_nand_flash);
464 +
465 +       i2c_register_board_info(0, &db88f5281_i2c_rtc, 1);
466  }
467  
468  MACHINE_START(DB88F5281, "Marvell Orion-2 Development Board")
469 --- a/arch/arm/mach-orion5x/dns323-setup.c
470 +++ b/arch/arm/mach-orion5x/dns323-setup.c
471 @@ -213,12 +213,6 @@
472   * General Setup
473   */
474  
475 -static struct platform_device *dns323_plat_devices[] __initdata = {
476 -       &dns323_nor_flash,
477 -       &dns323_gpio_leds,
478 -       &dns323_button_device,
479 -};
480 -
481  /*
482   * On the DNS-323 the following devices are attached via I2C:
483   *
484 @@ -253,11 +247,6 @@
485         /* Setup basic Orion functions. Need to be called early. */
486         orion5x_init();
487  
488 -       /* setup flash mapping
489 -        * CS3 holds a 8 MB Spansion S29GL064M90TFIR4
490 -        */
491 -       orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE);
492 -
493         /* DNS-323 has a Marvell 88X7042 SATA controller attached via PCIe
494          *
495          * Open a special address decode windows for the PCIe WA.
496 @@ -294,21 +283,32 @@
497         */
498         orion5x_gpio_set_valid_pins(0x07f6);
499  
500 -       /* register dns323 specific power-off method */
501 -       if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
502 -           gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
503 -               pr_err("DNS323: failed to setup power-off GPIO\n");
504 +       /*
505 +        * Configure peripherals.
506 +        */
507 +       orion5x_ehci0_init();
508 +       orion5x_eth_init(&dns323_eth_data);
509 +       orion5x_i2c_init();
510 +       orion5x_uart0_init();
511  
512 -       pm_power_off = dns323_power_off;
513 +       /* setup flash mapping
514 +        * CS3 holds a 8 MB Spansion S29GL064M90TFIR4
515 +        */
516 +       orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE);
517 +       platform_device_register(&dns323_nor_flash);
518 +
519 +       platform_device_register(&dns323_gpio_leds);
520  
521 -       /* register flash and other platform devices */
522 -       platform_add_devices(dns323_plat_devices,
523 -                            ARRAY_SIZE(dns323_plat_devices));
524 +       platform_device_register(&dns323_button_device);
525  
526         i2c_register_board_info(0, dns323_i2c_devices,
527                                 ARRAY_SIZE(dns323_i2c_devices));
528  
529 -       orion5x_eth_init(&dns323_eth_data);
530 +       /* register dns323 specific power-off method */
531 +       if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
532 +           gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
533 +               pr_err("DNS323: failed to setup power-off GPIO\n");
534 +       pm_power_off = dns323_power_off;
535  }
536  
537  /* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */
538 --- a/arch/arm/mach-orion5x/kurobox_pro-setup.c
539 +++ b/arch/arm/mach-orion5x/kurobox_pro-setup.c
540 @@ -188,13 +188,6 @@
541         orion5x_init();
542  
543         /*
544 -        * Setup the CPU address decode windows for our devices
545 -        */
546 -       orion5x_setup_dev_boot_win(KUROBOX_PRO_NOR_BOOT_BASE,
547 -                               KUROBOX_PRO_NOR_BOOT_SIZE);
548 -       orion5x_setup_dev0_win(KUROBOX_PRO_NAND_BASE, KUROBOX_PRO_NAND_SIZE);
549 -
550 -       /*
551          * Open a special address decode windows for the PCIe WA.
552          */
553         orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
554 @@ -221,12 +214,27 @@
555  
556         orion5x_gpio_set_valid_pins(0x0000000c);
557  
558 +       /*
559 +        * Configure peripherals.
560 +        */
561 +       orion5x_ehci0_init();
562 +       orion5x_ehci1_init();
563 +       orion5x_eth_init(&kurobox_pro_eth_data);
564 +       orion5x_i2c_init();
565 +       orion5x_sata_init(&kurobox_pro_sata_data);
566 +       orion5x_uart0_init();
567 +
568 +       orion5x_setup_dev_boot_win(KUROBOX_PRO_NOR_BOOT_BASE,
569 +                                  KUROBOX_PRO_NOR_BOOT_SIZE);
570         platform_device_register(&kurobox_pro_nor_flash);
571 -       if (machine_is_kurobox_pro())
572 +
573 +       if (machine_is_kurobox_pro()) {
574 +               orion5x_setup_dev0_win(KUROBOX_PRO_NAND_BASE,
575 +                                      KUROBOX_PRO_NAND_SIZE);
576                 platform_device_register(&kurobox_pro_nand_flash);
577 +       }
578 +
579         i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1);
580 -       orion5x_eth_init(&kurobox_pro_eth_data);
581 -       orion5x_sata_init(&kurobox_pro_sata_data);
582  }
583  
584  #ifdef CONFIG_MACH_KUROBOX_PRO
585 --- a/arch/arm/mach-orion5x/rd88f5182-setup.c
586 +++ b/arch/arm/mach-orion5x/rd88f5182-setup.c
587 @@ -241,11 +241,6 @@
588  /*****************************************************************************
589   * General Setup
590   ****************************************************************************/
591 -
592 -static struct platform_device *rd88f5182_devices[] __initdata = {
593 -       &rd88f5182_nor_flash,
594 -};
595 -
596  static void __init rd88f5182_init(void)
597  {
598         /*
599 @@ -254,13 +249,6 @@
600         orion5x_init();
601  
602         /*
603 -        * Setup the CPU address decode windows for our devices
604 -        */
605 -       orion5x_setup_dev_boot_win(RD88F5182_NOR_BOOT_BASE,
606 -                               RD88F5182_NOR_BOOT_SIZE);
607 -       orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE);
608 -
609 -       /*
610          * Open a special address decode windows for the PCIe WA.
611          */
612         orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
613 @@ -296,10 +284,23 @@
614  
615         orion5x_gpio_set_valid_pins(0x000000fb);
616  
617 -       platform_add_devices(rd88f5182_devices, ARRAY_SIZE(rd88f5182_devices));
618 -       i2c_register_board_info(0, &rd88f5182_i2c_rtc, 1);
619 +       /*
620 +        * Configure peripherals.
621 +        */
622 +       orion5x_ehci0_init();
623 +       orion5x_ehci1_init();
624         orion5x_eth_init(&rd88f5182_eth_data);
625 +       orion5x_i2c_init();
626         orion5x_sata_init(&rd88f5182_sata_data);
627 +       orion5x_uart0_init();
628 +
629 +       orion5x_setup_dev_boot_win(RD88F5182_NOR_BOOT_BASE,
630 +                                  RD88F5182_NOR_BOOT_SIZE);
631 +
632 +       orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE);
633 +       platform_device_register(&rd88f5182_nor_flash);
634 +
635 +       i2c_register_board_info(0, &rd88f5182_i2c_rtc, 1);
636  }
637  
638  MACHINE_START(RD88F5182, "Marvell Orion-NAS Reference Design")
639 --- a/arch/arm/mach-orion5x/ts209-setup.c
640 +++ b/arch/arm/mach-orion5x/ts209-setup.c
641 @@ -332,16 +332,9 @@
642  
643   * General Setup
644   ****************************************************************************/
645 -
646 -static struct platform_device *qnap_ts209_devices[] __initdata = {
647 -       &qnap_ts209_nor_flash,
648 -       &qnap_ts209_button_device,
649 -};
650 -
651  /*
652   * QNAP TS-[12]09 specific power off method via UART1-attached PIC
653   */
654 -
655  #define UART1_REG(x)   (UART1_VIRT_BASE + ((UART_##x) << 2))
656  
657  static void qnap_ts209_power_off(void)
658 @@ -372,12 +365,6 @@
659         orion5x_init();
660  
661         /*
662 -        * Setup flash mapping
663 -        */
664 -       orion5x_setup_dev_boot_win(QNAP_TS209_NOR_BOOT_BASE,
665 -                                  QNAP_TS209_NOR_BOOT_SIZE);
666 -
667 -       /*
668          * Open a special address decode windows for the PCIe WA.
669          */
670         orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE,
671 @@ -411,11 +398,22 @@
672         orion5x_write(MPP_16_19_CTRL, 0x5500);
673         orion5x_gpio_set_valid_pins(0x3cc0fff);
674  
675 -       /* register ts209 specific power-off method */
676 -       pm_power_off = qnap_ts209_power_off;
677 +       /*
678 +        * Configure peripherals.
679 +        */
680 +       orion5x_ehci0_init();
681 +       orion5x_ehci1_init();
682 +       ts209_find_mac_addr();
683 +       orion5x_eth_init(&qnap_ts209_eth_data);
684 +       orion5x_i2c_init();
685 +       orion5x_sata_init(&qnap_ts209_sata_data);
686 +       orion5x_uart0_init();
687 +
688 +       orion5x_setup_dev_boot_win(QNAP_TS209_NOR_BOOT_BASE,
689 +                                  QNAP_TS209_NOR_BOOT_SIZE);
690 +       platform_device_register(&qnap_ts209_nor_flash);
691  
692 -       platform_add_devices(qnap_ts209_devices,
693 -                               ARRAY_SIZE(qnap_ts209_devices));
694 +       platform_device_register(&qnap_ts209_button_device);
695  
696         /* Get RTC IRQ and register the chip */
697         if (gpio_request(TS209_RTC_GPIO, "rtc") == 0) {
698 @@ -428,10 +426,8 @@
699                 pr_warning("qnap_ts209_init: failed to get RTC IRQ\n");
700         i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1);
701  
702 -       ts209_find_mac_addr();
703 -       orion5x_eth_init(&qnap_ts209_eth_data);
704 -
705 -       orion5x_sata_init(&qnap_ts209_sata_data);
706 +       /* register ts209 specific power-off method */
707 +       pm_power_off = qnap_ts209_power_off;
708  }
709  
710  MACHINE_START(TS209, "QNAP TS-109/TS-209")