ARM: orion: simplify orion_ge00_switch_init
authorArnd Bergmann <arnd@arndb.de>
Mon, 5 Sep 2016 14:18:45 +0000 (16:18 +0200)
committerGregory CLEMENT <gregory.clement@free-electrons.com>
Wed, 14 Sep 2016 14:36:13 +0000 (16:36 +0200)
One of the last users of NO_IRQ on ARM is the switch initialization
code on orion5x, which sometimes passes a GPIO based IRQ number.

However, the driver doesn't actually use this number, and according
to Andrew Lunn never will do it for non-DT based machines, so
we can simply drop the irq argument.

Simplifying it further, we can also drop the static platform_device
and instead call platform_device_register_data(), which in turn
lets us mark the platform_data structures as __initdata and slightly
reduce the memory consumption.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
arch/arm/mach-orion5x/common.c
arch/arm/mach-orion5x/common.h
arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
arch/arm/mach-orion5x/wnr854t-setup.c
arch/arm/mach-orion5x/wrt350n-v2-setup.c
arch/arm/plat-orion/common.c
arch/arm/plat-orion/include/plat/common.h

index 058994e..0491076 100644 (file)
@@ -105,9 +105,9 @@ void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data)
 /*****************************************************************************
  * Ethernet switch
  ****************************************************************************/
-void __init orion5x_eth_switch_init(struct dsa_platform_data *d, int irq)
+void __init orion5x_eth_switch_init(struct dsa_platform_data *d)
 {
-       orion_ge00_switch_init(d, irq);
+       orion_ge00_switch_init(d);
 }
 
 
index cd0389c..8a4115b 100644 (file)
@@ -41,7 +41,7 @@ void orion5x_setup_wins(void);
 void orion5x_ehci0_init(void);
 void orion5x_ehci1_init(void);
 void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data);
-void orion5x_eth_switch_init(struct dsa_platform_data *d, int irq);
+void orion5x_eth_switch_init(struct dsa_platform_data *d);
 void orion5x_i2c_init(void);
 void orion5x_sata_init(struct mv_sata_platform_data *sata_data);
 void orion5x_spi_init(void);
index c742e7b..dccadf6 100644 (file)
@@ -101,7 +101,7 @@ static struct dsa_chip_data rd88f5181l_fxo_switch_chip_data = {
        .port_names[7]  = "lan3",
 };
 
-static struct dsa_platform_data rd88f5181l_fxo_switch_plat_data = {
+static struct dsa_platform_data __initdata rd88f5181l_fxo_switch_plat_data = {
        .nr_chips       = 1,
        .chip           = &rd88f5181l_fxo_switch_chip_data,
 };
@@ -120,7 +120,7 @@ static void __init rd88f5181l_fxo_init(void)
         */
        orion5x_ehci0_init();
        orion5x_eth_init(&rd88f5181l_fxo_eth_data);
-       orion5x_eth_switch_init(&rd88f5181l_fxo_switch_plat_data, NO_IRQ);
+       orion5x_eth_switch_init(&rd88f5181l_fxo_switch_plat_data);
        orion5x_uart0_init();
 
        mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET,
index 7e977b7..affe5ec 100644 (file)
@@ -102,7 +102,7 @@ static struct dsa_chip_data rd88f5181l_ge_switch_chip_data = {
        .port_names[7]  = "lan3",
 };
 
-static struct dsa_platform_data rd88f5181l_ge_switch_plat_data = {
+static struct dsa_platform_data __initdata rd88f5181l_ge_switch_plat_data = {
        .nr_chips       = 1,
        .chip           = &rd88f5181l_ge_switch_chip_data,
 };
@@ -125,8 +125,7 @@ static void __init rd88f5181l_ge_init(void)
         */
        orion5x_ehci0_init();
        orion5x_eth_init(&rd88f5181l_ge_eth_data);
-       orion5x_eth_switch_init(&rd88f5181l_ge_switch_plat_data,
-                               gpio_to_irq(8));
+       orion5x_eth_switch_init(&rd88f5181l_ge_switch_plat_data);
        orion5x_i2c_init();
        orion5x_uart0_init();
 
index 4bf80dd..f2db56d 100644 (file)
@@ -40,7 +40,7 @@ static struct dsa_chip_data rd88f6183ap_ge_switch_chip_data = {
        .port_names[5]  = "cpu",
 };
 
-static struct dsa_platform_data rd88f6183ap_ge_switch_plat_data = {
+static struct dsa_platform_data __initdata rd88f6183ap_ge_switch_plat_data = {
        .nr_chips       = 1,
        .chip           = &rd88f6183ap_ge_switch_chip_data,
 };
@@ -90,8 +90,7 @@ static void __init rd88f6183ap_ge_init(void)
         */
        orion5x_ehci0_init();
        orion5x_eth_init(&rd88f6183ap_ge_eth_data);
-       orion5x_eth_switch_init(&rd88f6183ap_ge_switch_plat_data,
-                               gpio_to_irq(3));
+       orion5x_eth_switch_init(&rd88f6183ap_ge_switch_plat_data);
        spi_register_board_info(rd88f6183ap_ge_spi_slave_info,
                                ARRAY_SIZE(rd88f6183ap_ge_spi_slave_info));
        orion5x_spi_init();
index 4e1e5c8..4dbcdbe 100644 (file)
@@ -106,7 +106,7 @@ static struct dsa_chip_data wnr854t_switch_chip_data = {
        .port_names[7] = "lan2",
 };
 
-static struct dsa_platform_data wnr854t_switch_plat_data = {
+static struct dsa_platform_data __initdata wnr854t_switch_plat_data = {
        .nr_chips       = 1,
        .chip           = &wnr854t_switch_chip_data,
 };
@@ -124,7 +124,7 @@ static void __init wnr854t_init(void)
         * Configure peripherals.
         */
        orion5x_eth_init(&wnr854t_eth_data);
-       orion5x_eth_switch_init(&wnr854t_switch_plat_data, NO_IRQ);
+       orion5x_eth_switch_init(&wnr854t_switch_plat_data);
        orion5x_uart0_init();
 
        mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET,
index 61e9027..a6a8c46 100644 (file)
@@ -191,7 +191,7 @@ static struct dsa_chip_data wrt350n_v2_switch_chip_data = {
        .port_names[7]  = "lan4",
 };
 
-static struct dsa_platform_data wrt350n_v2_switch_plat_data = {
+static struct dsa_platform_data __initdata wrt350n_v2_switch_plat_data = {
        .nr_chips       = 1,
        .chip           = &wrt350n_v2_switch_chip_data,
 };
@@ -210,7 +210,7 @@ static void __init wrt350n_v2_init(void)
         */
        orion5x_ehci0_init();
        orion5x_eth_init(&wrt350n_v2_eth_data);
-       orion5x_eth_switch_init(&wrt350n_v2_switch_plat_data, NO_IRQ);
+       orion5x_eth_switch_init(&wrt350n_v2_switch_plat_data);
        orion5x_uart0_init();
 
        mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET,
index 7b9b707..272f49b 100644 (file)
@@ -470,37 +470,15 @@ void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data,
 /*****************************************************************************
  * Ethernet switch
  ****************************************************************************/
-static struct resource orion_switch_resources[] = {
-       {
-               .start  = 0,
-               .end    = 0,
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device orion_switch_device = {
-       .name           = "dsa",
-       .id             = 0,
-       .num_resources  = 0,
-       .resource       = orion_switch_resources,
-};
-
-void __init orion_ge00_switch_init(struct dsa_platform_data *d, int irq)
+void __init orion_ge00_switch_init(struct dsa_platform_data *d)
 {
        int i;
 
-       if (irq != NO_IRQ) {
-               orion_switch_resources[0].start = irq;
-               orion_switch_resources[0].end = irq;
-               orion_switch_device.num_resources = 1;
-       }
-
        d->netdev = &orion_ge00.dev;
        for (i = 0; i < d->nr_chips; i++)
                d->chip[i].host_dev = &orion_ge_mvmdio.dev;
-       orion_switch_device.dev.platform_data = d;
 
-       platform_device_register(&orion_switch_device);
+       platform_device_register_data(NULL, "dsa", 0, d, sizeof(d));
 }
 
 /*****************************************************************************
index 8519727..9347f3c 100644 (file)
@@ -57,8 +57,7 @@ void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data,
                            unsigned long mapbase,
                            unsigned long irq);
 
-void __init orion_ge00_switch_init(struct dsa_platform_data *d,
-                                  int irq);
+void __init orion_ge00_switch_init(struct dsa_platform_data *d);
 
 void __init orion_i2c_init(unsigned long mapbase,
                           unsigned long irq,