]> err.no Git - linux-2.6/commitdiff
[ARM] Orion: move EHCI/I2C/UART peripheral init into board code
authorLennert Buytenhek <buytenh@wantstofly.org>
Tue, 22 Apr 2008 03:37:12 +0000 (05:37 +0200)
committerLennert Buytenhek <buytenh@marvell.com>
Sun, 22 Jun 2008 20:44:45 +0000 (22:44 +0200)
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>
arch/arm/mach-orion5x/common.c
arch/arm/mach-orion5x/common.h
arch/arm/mach-orion5x/db88f5281-setup.c
arch/arm/mach-orion5x/dns323-setup.c
arch/arm/mach-orion5x/kurobox_pro-setup.c
arch/arm/mach-orion5x/rd88f5182-setup.c
arch/arm/mach-orion5x/ts209-setup.c

index fa4be3cb15496fd12b4a912e117c25a7da550d6f..b2986717319ea0313e1e14d02feedc86ec10afb3 100644 (file)
@@ -63,65 +63,20 @@ void __init orion5x_map_io(void)
        iotable_init(orion5x_io_desc, ARRAY_SIZE(orion5x_io_desc));
 }
 
+
 /*****************************************************************************
- * UART
+ * EHCI
  ****************************************************************************/
-
-static struct resource orion5x_uart_resources[] = {
-       {
-               .start          = UART0_PHYS_BASE,
-               .end            = UART0_PHYS_BASE + 0xff,
-               .flags          = IORESOURCE_MEM,
-       }, {
-               .start          = IRQ_ORION5X_UART0,
-               .end            = IRQ_ORION5X_UART0,
-               .flags          = IORESOURCE_IRQ,
-       }, {
-               .start          = UART1_PHYS_BASE,
-               .end            = UART1_PHYS_BASE + 0xff,
-               .flags          = IORESOURCE_MEM,
-       }, {
-               .start          = IRQ_ORION5X_UART1,
-               .end            = IRQ_ORION5X_UART1,
-               .flags          = IORESOURCE_IRQ,
-       },
-};
-
-static struct plat_serial8250_port orion5x_uart_data[] = {
-       {
-               .mapbase        = UART0_PHYS_BASE,
-               .membase        = (char *)UART0_VIRT_BASE,
-               .irq            = IRQ_ORION5X_UART0,
-               .flags          = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
-               .iotype         = UPIO_MEM,
-               .regshift       = 2,
-               .uartclk        = ORION5X_TCLK,
-       }, {
-               .mapbase        = UART1_PHYS_BASE,
-               .membase        = (char *)UART1_VIRT_BASE,
-               .irq            = IRQ_ORION5X_UART1,
-               .flags          = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
-               .iotype         = UPIO_MEM,
-               .regshift       = 2,
-               .uartclk        = ORION5X_TCLK,
-       }, {
-       },
+static struct orion_ehci_data orion5x_ehci_data = {
+       .dram           = &orion5x_mbus_dram_info,
 };
 
-static struct platform_device orion5x_uart = {
-       .name                   = "serial8250",
-       .id                     = PLAT8250_DEV_PLATFORM,
-       .dev                    = {
-               .platform_data  = orion5x_uart_data,
-       },
-       .resource               = orion5x_uart_resources,
-       .num_resources          = ARRAY_SIZE(orion5x_uart_resources),
-};
+static u64 ehci_dmamask = 0xffffffffUL;
 
-/*******************************************************************************
- * USB Controller - 2 interfaces
- ******************************************************************************/
 
+/*****************************************************************************
+ * EHCI0
+ ****************************************************************************/
 static struct resource orion5x_ehci0_resources[] = {
        {
                .start  = ORION5X_USB0_PHYS_BASE,
@@ -134,24 +89,6 @@ static struct resource orion5x_ehci0_resources[] = {
        },
 };
 
-static struct resource orion5x_ehci1_resources[] = {
-       {
-               .start  = ORION5X_USB1_PHYS_BASE,
-               .end    = ORION5X_USB1_PHYS_BASE + SZ_4K - 1,
-               .flags  = IORESOURCE_MEM,
-       }, {
-               .start  = IRQ_ORION5X_USB1_CTRL,
-               .end    = IRQ_ORION5X_USB1_CTRL,
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct orion_ehci_data orion5x_ehci_data = {
-       .dram           = &orion5x_mbus_dram_info,
-};
-
-static u64 ehci_dmamask = 0xffffffffUL;
-
 static struct platform_device orion5x_ehci0 = {
        .name           = "orion-ehci",
        .id             = 0,
@@ -164,6 +101,27 @@ static struct platform_device orion5x_ehci0 = {
        .num_resources  = ARRAY_SIZE(orion5x_ehci0_resources),
 };
 
+void __init orion5x_ehci0_init(void)
+{
+       platform_device_register(&orion5x_ehci0);
+}
+
+
+/*****************************************************************************
+ * EHCI1
+ ****************************************************************************/
+static struct resource orion5x_ehci1_resources[] = {
+       {
+               .start  = ORION5X_USB1_PHYS_BASE,
+               .end    = ORION5X_USB1_PHYS_BASE + SZ_4K - 1,
+               .flags  = IORESOURCE_MEM,
+       }, {
+               .start  = IRQ_ORION5X_USB1_CTRL,
+               .end    = IRQ_ORION5X_USB1_CTRL,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
 static struct platform_device orion5x_ehci1 = {
        .name           = "orion-ehci",
        .id             = 1,
@@ -176,11 +134,15 @@ static struct platform_device orion5x_ehci1 = {
        .num_resources  = ARRAY_SIZE(orion5x_ehci1_resources),
 };
 
+void __init orion5x_ehci1_init(void)
+{
+       platform_device_register(&orion5x_ehci1);
+}
+
+
 /*****************************************************************************
- * Gigabit Ethernet port
- * (The Orion and Discovery (MV643xx) families use the same Ethernet driver)
+ * GigE
  ****************************************************************************/
-
 struct mv643xx_eth_shared_platform_data orion5x_eth_shared_data = {
        .dram           = &orion5x_mbus_dram_info,
        .t_clk          = ORION5X_TCLK,
@@ -229,11 +191,10 @@ void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data)
        platform_device_register(&orion5x_eth);
 }
 
+
 /*****************************************************************************
- * I2C controller
- * (The Orion and Discovery (MV643xx) families share the same I2C controller)
+ * I2C
  ****************************************************************************/
-
 static struct mv64xxx_i2c_pdata orion5x_i2c_pdata = {
        .freq_m         = 8, /* assumes 166 MHz TCLK */
        .freq_n         = 3,
@@ -244,7 +205,7 @@ static struct resource orion5x_i2c_resources[] = {
        {
                .name   = "i2c base",
                .start  = I2C_PHYS_BASE,
-               .end    = I2C_PHYS_BASE + 0x20 -1,
+               .end    = I2C_PHYS_BASE + 0x1f,
                .flags  = IORESOURCE_MEM,
        }, {
                .name   = "i2c irq",
@@ -264,8 +225,14 @@ static struct platform_device orion5x_i2c = {
        },
 };
 
+void __init orion5x_i2c_init(void)
+{
+       platform_device_register(&orion5x_i2c);
+}
+
+
 /*****************************************************************************
- * Sata port
+ * SATA
  ****************************************************************************/
 static struct resource orion5x_sata_resources[] = {
        {
@@ -298,10 +265,98 @@ void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data)
        platform_device_register(&orion5x_sata);
 }
 
+
 /*****************************************************************************
- * Time handling
+ * UART0
+ ****************************************************************************/
+static struct plat_serial8250_port orion5x_uart0_data[] = {
+       {
+               .mapbase        = UART0_PHYS_BASE,
+               .membase        = (char *)UART0_VIRT_BASE,
+               .irq            = IRQ_ORION5X_UART0,
+               .flags          = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
+               .iotype         = UPIO_MEM,
+               .regshift       = 2,
+               .uartclk        = ORION5X_TCLK,
+       }, {
+       },
+};
+
+static struct resource orion5x_uart0_resources[] = {
+       {
+               .start          = UART0_PHYS_BASE,
+               .end            = UART0_PHYS_BASE + 0xff,
+               .flags          = IORESOURCE_MEM,
+       }, {
+               .start          = IRQ_ORION5X_UART0,
+               .end            = IRQ_ORION5X_UART0,
+               .flags          = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device orion5x_uart0 = {
+       .name                   = "serial8250",
+       .id                     = PLAT8250_DEV_PLATFORM,
+       .dev                    = {
+               .platform_data  = orion5x_uart0_data,
+       },
+       .resource               = orion5x_uart0_resources,
+       .num_resources          = ARRAY_SIZE(orion5x_uart0_resources),
+};
+
+void __init orion5x_uart0_init(void)
+{
+       platform_device_register(&orion5x_uart0);
+}
+
+
+/*****************************************************************************
+ * UART1
  ****************************************************************************/
+static struct plat_serial8250_port orion5x_uart1_data[] = {
+       {
+               .mapbase        = UART1_PHYS_BASE,
+               .membase        = (char *)UART1_VIRT_BASE,
+               .irq            = IRQ_ORION5X_UART1,
+               .flags          = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
+               .iotype         = UPIO_MEM,
+               .regshift       = 2,
+               .uartclk        = ORION5X_TCLK,
+       }, {
+       },
+};
+
+static struct resource orion5x_uart1_resources[] = {
+       {
+               .start          = UART1_PHYS_BASE,
+               .end            = UART1_PHYS_BASE + 0xff,
+               .flags          = IORESOURCE_MEM,
+       }, {
+               .start          = IRQ_ORION5X_UART1,
+               .end            = IRQ_ORION5X_UART1,
+               .flags          = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device orion5x_uart1 = {
+       .name                   = "serial8250",
+       .id                     = PLAT8250_DEV_PLATFORM1,
+       .dev                    = {
+               .platform_data  = orion5x_uart1_data,
+       },
+       .resource               = orion5x_uart1_resources,
+       .num_resources          = ARRAY_SIZE(orion5x_uart1_resources),
+};
+
+void __init orion5x_uart1_init(void)
+{
+       platform_device_register(&orion5x_uart1);
+}
 
+
+/*****************************************************************************
+ * Time handling
+ ****************************************************************************/
 static void orion5x_timer_init(void)
 {
        orion_time_init(IRQ_ORION5X_BRIDGE, ORION5X_TCLK);
@@ -311,10 +366,10 @@ struct sys_timer orion5x_timer = {
        .init = orion5x_timer_init,
 };
 
+
 /*****************************************************************************
  * General
  ****************************************************************************/
-
 /*
  * Identify device ID and rev from PCIe configuration header space '0'.
  */
@@ -359,15 +414,6 @@ void __init orion5x_init(void)
         * Setup Orion address map
         */
        orion5x_setup_cpu_mbus_bridge();
-
-       /*
-        * Register devices.
-        */
-       platform_device_register(&orion5x_uart);
-       platform_device_register(&orion5x_ehci0);
-       if (dev == MV88F5182_DEV_ID)
-               platform_device_register(&orion5x_ehci1);
-       platform_device_register(&orion5x_i2c);
 }
 
 /*
index bd0f05de6e18d2698087a5c72393101798477b26..da37c204bc386da4b14faf786df2074be8f2ce3b 100644 (file)
@@ -1,10 +1,12 @@
 #ifndef __ARCH_ORION5X_COMMON_H
 #define __ARCH_ORION5X_COMMON_H
 
+struct mv643xx_eth_platform_data;
+struct mv_sata_platform_data;
+
 /*
  * Basic Orion init functions used early by machine-setup.
  */
-
 void orion5x_map_io(void);
 void orion5x_init_irq(void);
 void orion5x_init(void);
@@ -23,13 +25,19 @@ void orion5x_setup_dev1_win(u32 base, u32 size);
 void orion5x_setup_dev2_win(u32 base, u32 size);
 void orion5x_setup_pcie_wa_win(u32 base, u32 size);
 
+void orion5x_ehci0_init(void);
+void orion5x_ehci1_init(void);
+void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data);
+void orion5x_i2c_init(void);
+void orion5x_sata_init(struct mv_sata_platform_data *sata_data);
+void orion5x_uart0_init(void);
+void orion5x_uart1_init(void);
+
 /*
- * Shared code used internally by other Orion core functions.
- * (/mach-orion/pci.c)
+ * PCIe/PCI functions.
  */
-
-struct pci_sys_data;
 struct pci_bus;
+struct pci_sys_data;
 
 void orion5x_pcie_id(u32 *dev, u32 *rev);
 int 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);
  * Valid GPIO pins according to MPP setup, used by machine-setup.
  * (/mach-orion/gpio.c).
  */
-
 void orion5x_gpio_set_valid_pins(u32 pins);
 void gpio_display(void);       /* debug */
 
-/*
- * Pull in Orion Ethernet platform_data, used by machine-setup
- */
-
-struct mv643xx_eth_platform_data;
-
-void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data);
-
-/*
- * Orion Sata platform_data, used by machine-setup
- */
-
-struct mv_sata_platform_data;
-
-void orion5x_sata_init(struct mv_sata_platform_data *sata_data);
-
 struct machine_desc;
 struct meminfo;
 struct tag;
index 4ee69502825412e5ddb53d097e39f0ec4f367a83..eca76b3348bc07f41d37c8d860a207a731448adf 100644 (file)
@@ -298,13 +298,6 @@ static struct i2c_board_info __initdata db88f5281_i2c_rtc = {
 /*****************************************************************************
  * General Setup
  ****************************************************************************/
-
-static struct platform_device *db88f5281_devs[] __initdata = {
-       &db88f5281_boot_flash,
-       &db88f5281_nor_flash,
-       &db88f5281_nand_flash,
-};
-
 static void __init db88f5281_init(void)
 {
        /*
@@ -312,15 +305,6 @@ static void __init db88f5281_init(void)
         */
        orion5x_init();
 
-       /*
-        * Setup the CPU address decode windows for our on-board devices
-        */
-       orion5x_setup_dev_boot_win(DB88F5281_NOR_BOOT_BASE,
-                               DB88F5281_NOR_BOOT_SIZE);
-       orion5x_setup_dev0_win(DB88F5281_7SEG_BASE, DB88F5281_7SEG_SIZE);
-       orion5x_setup_dev1_win(DB88F5281_NOR_BASE, DB88F5281_NOR_SIZE);
-       orion5x_setup_dev2_win(DB88F5281_NAND_BASE, DB88F5281_NAND_SIZE);
-
        /*
         * Setup Multiplexing Pins:
         * MPP0: GPIO (USB Over Current)        MPP1: GPIO (USB Vbat input)
@@ -342,9 +326,28 @@ static void __init db88f5281_init(void)
 
        orion5x_gpio_set_valid_pins(0x00003fc3);
 
-       platform_add_devices(db88f5281_devs, ARRAY_SIZE(db88f5281_devs));
-       i2c_register_board_info(0, &db88f5281_i2c_rtc, 1);
+       /*
+        * Configure peripherals.
+        */
+       orion5x_ehci0_init();
        orion5x_eth_init(&db88f5281_eth_data);
+       orion5x_i2c_init();
+       orion5x_uart0_init();
+       orion5x_uart1_init();
+
+       orion5x_setup_dev_boot_win(DB88F5281_NOR_BOOT_BASE,
+                               DB88F5281_NOR_BOOT_SIZE);
+       platform_device_register(&db88f5281_boot_flash);
+
+       orion5x_setup_dev0_win(DB88F5281_7SEG_BASE, DB88F5281_7SEG_SIZE);
+
+       orion5x_setup_dev1_win(DB88F5281_NOR_BASE, DB88F5281_NOR_SIZE);
+       platform_device_register(&db88f5281_nor_flash);
+
+       orion5x_setup_dev2_win(DB88F5281_NAND_BASE, DB88F5281_NAND_SIZE);
+       platform_device_register(&db88f5281_nand_flash);
+
+       i2c_register_board_info(0, &db88f5281_i2c_rtc, 1);
 }
 
 MACHINE_START(DB88F5281, "Marvell Orion-2 Development Board")
index ec53f866ed11923607d32cae51682316fac0c346..cd200f766099653d5be6c1c826b1bfd15a38aab9 100644 (file)
@@ -213,12 +213,6 @@ static struct platform_device dns323_button_device = {
  * General Setup
  */
 
-static struct platform_device *dns323_plat_devices[] __initdata = {
-       &dns323_nor_flash,
-       &dns323_gpio_leds,
-       &dns323_button_device,
-};
-
 /*
  * On the DNS-323 the following devices are attached via I2C:
  *
@@ -253,11 +247,6 @@ static void __init dns323_init(void)
        /* Setup basic Orion functions. Need to be called early. */
        orion5x_init();
 
-       /* setup flash mapping
-        * CS3 holds a 8 MB Spansion S29GL064M90TFIR4
-        */
-       orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE);
-
        /* DNS-323 has a Marvell 88X7042 SATA controller attached via PCIe
         *
         * Open a special address decode windows for the PCIe WA.
@@ -294,21 +283,32 @@ static void __init dns323_init(void)
        */
        orion5x_gpio_set_valid_pins(0x07f6);
 
-       /* register dns323 specific power-off method */
-       if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
-           gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
-               pr_err("DNS323: failed to setup power-off GPIO\n");
+       /*
+        * Configure peripherals.
+        */
+       orion5x_ehci0_init();
+       orion5x_eth_init(&dns323_eth_data);
+       orion5x_i2c_init();
+       orion5x_uart0_init();
 
-       pm_power_off = dns323_power_off;
+       /* setup flash mapping
+        * CS3 holds a 8 MB Spansion S29GL064M90TFIR4
+        */
+       orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE);
+       platform_device_register(&dns323_nor_flash);
+
+       platform_device_register(&dns323_gpio_leds);
 
-       /* register flash and other platform devices */
-       platform_add_devices(dns323_plat_devices,
-                            ARRAY_SIZE(dns323_plat_devices));
+       platform_device_register(&dns323_button_device);
 
        i2c_register_board_info(0, dns323_i2c_devices,
                                ARRAY_SIZE(dns323_i2c_devices));
 
-       orion5x_eth_init(&dns323_eth_data);
+       /* register dns323 specific power-off method */
+       if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
+           gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
+               pr_err("DNS323: failed to setup power-off GPIO\n");
+       pm_power_off = dns323_power_off;
 }
 
 /* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */
index 60fcbf1e5d72265bc575c005b1a8626059ad7975..10d9fc2ef11a40a984ba35049d9711be0916ee4e 100644 (file)
@@ -187,13 +187,6 @@ static void __init kurobox_pro_init(void)
         */
        orion5x_init();
 
-       /*
-        * Setup the CPU address decode windows for our devices
-        */
-       orion5x_setup_dev_boot_win(KUROBOX_PRO_NOR_BOOT_BASE,
-                               KUROBOX_PRO_NOR_BOOT_SIZE);
-       orion5x_setup_dev0_win(KUROBOX_PRO_NAND_BASE, KUROBOX_PRO_NAND_SIZE);
-
        /*
         * Open a special address decode windows for the PCIe WA.
         */
@@ -221,12 +214,27 @@ static void __init kurobox_pro_init(void)
 
        orion5x_gpio_set_valid_pins(0x0000000c);
 
+       /*
+        * Configure peripherals.
+        */
+       orion5x_ehci0_init();
+       orion5x_ehci1_init();
+       orion5x_eth_init(&kurobox_pro_eth_data);
+       orion5x_i2c_init();
+       orion5x_sata_init(&kurobox_pro_sata_data);
+       orion5x_uart0_init();
+
+       orion5x_setup_dev_boot_win(KUROBOX_PRO_NOR_BOOT_BASE,
+                                  KUROBOX_PRO_NOR_BOOT_SIZE);
        platform_device_register(&kurobox_pro_nor_flash);
-       if (machine_is_kurobox_pro())
+
+       if (machine_is_kurobox_pro()) {
+               orion5x_setup_dev0_win(KUROBOX_PRO_NAND_BASE,
+                                      KUROBOX_PRO_NAND_SIZE);
                platform_device_register(&kurobox_pro_nand_flash);
+       }
+
        i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1);
-       orion5x_eth_init(&kurobox_pro_eth_data);
-       orion5x_sata_init(&kurobox_pro_sata_data);
 }
 
 #ifdef CONFIG_MACH_KUROBOX_PRO
index 62fd99fc664a996ca44ab2c96a5c75c10e38c6ec..4496ed1cab730076e504012c3236c6aeccce6140 100644 (file)
@@ -241,11 +241,6 @@ static struct mv_sata_platform_data rd88f5182_sata_data = {
 /*****************************************************************************
  * General Setup
  ****************************************************************************/
-
-static struct platform_device *rd88f5182_devices[] __initdata = {
-       &rd88f5182_nor_flash,
-};
-
 static void __init rd88f5182_init(void)
 {
        /*
@@ -253,13 +248,6 @@ static void __init rd88f5182_init(void)
         */
        orion5x_init();
 
-       /*
-        * Setup the CPU address decode windows for our devices
-        */
-       orion5x_setup_dev_boot_win(RD88F5182_NOR_BOOT_BASE,
-                               RD88F5182_NOR_BOOT_SIZE);
-       orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE);
-
        /*
         * Open a special address decode windows for the PCIe WA.
         */
@@ -296,10 +284,23 @@ static void __init rd88f5182_init(void)
 
        orion5x_gpio_set_valid_pins(0x000000fb);
 
-       platform_add_devices(rd88f5182_devices, ARRAY_SIZE(rd88f5182_devices));
-       i2c_register_board_info(0, &rd88f5182_i2c_rtc, 1);
+       /*
+        * Configure peripherals.
+        */
+       orion5x_ehci0_init();
+       orion5x_ehci1_init();
        orion5x_eth_init(&rd88f5182_eth_data);
+       orion5x_i2c_init();
        orion5x_sata_init(&rd88f5182_sata_data);
+       orion5x_uart0_init();
+
+       orion5x_setup_dev_boot_win(RD88F5182_NOR_BOOT_BASE,
+                                  RD88F5182_NOR_BOOT_SIZE);
+
+       orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE);
+       platform_device_register(&rd88f5182_nor_flash);
+
+       i2c_register_board_info(0, &rd88f5182_i2c_rtc, 1);
 }
 
 MACHINE_START(RD88F5182, "Marvell Orion-NAS Reference Design")
index 5374b6edb9a152ddbf5fdab89c18643b4bdb9104..b62fdb6cf6cb77a1ec323252674e508e6e89672a 100644 (file)
@@ -332,16 +332,9 @@ static struct mv_sata_platform_data qnap_ts209_sata_data = {
 
  * General Setup
  ****************************************************************************/
-
-static struct platform_device *qnap_ts209_devices[] __initdata = {
-       &qnap_ts209_nor_flash,
-       &qnap_ts209_button_device,
-};
-
 /*
  * QNAP TS-[12]09 specific power off method via UART1-attached PIC
  */
-
 #define UART1_REG(x)   (UART1_VIRT_BASE + ((UART_##x) << 2))
 
 static void qnap_ts209_power_off(void)
@@ -371,12 +364,6 @@ static void __init qnap_ts209_init(void)
         */
        orion5x_init();
 
-       /*
-        * Setup flash mapping
-        */
-       orion5x_setup_dev_boot_win(QNAP_TS209_NOR_BOOT_BASE,
-                                  QNAP_TS209_NOR_BOOT_SIZE);
-
        /*
         * Open a special address decode windows for the PCIe WA.
         */
@@ -411,11 +398,22 @@ static void __init qnap_ts209_init(void)
        orion5x_write(MPP_16_19_CTRL, 0x5500);
        orion5x_gpio_set_valid_pins(0x3cc0fff);
 
-       /* register ts209 specific power-off method */
-       pm_power_off = qnap_ts209_power_off;
+       /*
+        * Configure peripherals.
+        */
+       orion5x_ehci0_init();
+       orion5x_ehci1_init();
+       ts209_find_mac_addr();
+       orion5x_eth_init(&qnap_ts209_eth_data);
+       orion5x_i2c_init();
+       orion5x_sata_init(&qnap_ts209_sata_data);
+       orion5x_uart0_init();
+
+       orion5x_setup_dev_boot_win(QNAP_TS209_NOR_BOOT_BASE,
+                                  QNAP_TS209_NOR_BOOT_SIZE);
+       platform_device_register(&qnap_ts209_nor_flash);
 
-       platform_add_devices(qnap_ts209_devices,
-                               ARRAY_SIZE(qnap_ts209_devices));
+       platform_device_register(&qnap_ts209_button_device);
 
        /* Get RTC IRQ and register the chip */
        if (gpio_request(TS209_RTC_GPIO, "rtc") == 0) {
@@ -428,10 +426,8 @@ static void __init qnap_ts209_init(void)
                pr_warning("qnap_ts209_init: failed to get RTC IRQ\n");
        i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1);
 
-       ts209_find_mac_addr();
-       orion5x_eth_init(&qnap_ts209_eth_data);
-
-       orion5x_sata_init(&qnap_ts209_sata_data);
+       /* register ts209 specific power-off method */
+       pm_power_off = qnap_ts209_power_off;
 }
 
 MACHINE_START(TS209, "QNAP TS-109/TS-209")