diff options
author | Arnd Bergmann <arnd@arndb.de> | 2016-09-05 10:18:45 -0400 |
---|---|---|
committer | Gregory CLEMENT <gregory.clement@free-electrons.com> | 2016-09-14 10:36:13 -0400 |
commit | fe158a17c1e0d477f08990f426f30e13eb3c8851 (patch) | |
tree | 8b034931e9de00ab7293e2d52057d882465de464 | |
parent | 93a753bdc1b77e01721c709761fb796a33455a53 (diff) |
ARM: orion: simplify orion_ge00_switch_init
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>
-rw-r--r-- | arch/arm/mach-orion5x/common.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/common.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/rd88f5181l-ge-setup.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/wnr854t-setup.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/wrt350n-v2-setup.c | 4 | ||||
-rw-r--r-- | arch/arm/plat-orion/common.c | 26 | ||||
-rw-r--r-- | arch/arm/plat-orion/include/plat/common.h | 3 |
9 files changed, 16 insertions, 41 deletions
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c index 058994e99570..04910764c385 100644 --- a/arch/arm/mach-orion5x/common.c +++ b/arch/arm/mach-orion5x/common.c | |||
@@ -105,9 +105,9 @@ void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data) | |||
105 | /***************************************************************************** | 105 | /***************************************************************************** |
106 | * Ethernet switch | 106 | * Ethernet switch |
107 | ****************************************************************************/ | 107 | ****************************************************************************/ |
108 | void __init orion5x_eth_switch_init(struct dsa_platform_data *d, int irq) | 108 | void __init orion5x_eth_switch_init(struct dsa_platform_data *d) |
109 | { | 109 | { |
110 | orion_ge00_switch_init(d, irq); | 110 | orion_ge00_switch_init(d); |
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h index cd0389c6e822..8a4115bd441d 100644 --- a/arch/arm/mach-orion5x/common.h +++ b/arch/arm/mach-orion5x/common.h | |||
@@ -41,7 +41,7 @@ void orion5x_setup_wins(void); | |||
41 | void orion5x_ehci0_init(void); | 41 | void orion5x_ehci0_init(void); |
42 | void orion5x_ehci1_init(void); | 42 | void orion5x_ehci1_init(void); |
43 | void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data); | 43 | void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data); |
44 | void orion5x_eth_switch_init(struct dsa_platform_data *d, int irq); | 44 | void orion5x_eth_switch_init(struct dsa_platform_data *d); |
45 | void orion5x_i2c_init(void); | 45 | void orion5x_i2c_init(void); |
46 | void orion5x_sata_init(struct mv_sata_platform_data *sata_data); | 46 | void orion5x_sata_init(struct mv_sata_platform_data *sata_data); |
47 | void orion5x_spi_init(void); | 47 | void orion5x_spi_init(void); |
diff --git a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c index c742e7b40b0d..dccadf68ea2b 100644 --- a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c +++ b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c | |||
@@ -101,7 +101,7 @@ static struct dsa_chip_data rd88f5181l_fxo_switch_chip_data = { | |||
101 | .port_names[7] = "lan3", | 101 | .port_names[7] = "lan3", |
102 | }; | 102 | }; |
103 | 103 | ||
104 | static struct dsa_platform_data rd88f5181l_fxo_switch_plat_data = { | 104 | static struct dsa_platform_data __initdata rd88f5181l_fxo_switch_plat_data = { |
105 | .nr_chips = 1, | 105 | .nr_chips = 1, |
106 | .chip = &rd88f5181l_fxo_switch_chip_data, | 106 | .chip = &rd88f5181l_fxo_switch_chip_data, |
107 | }; | 107 | }; |
@@ -120,7 +120,7 @@ static void __init rd88f5181l_fxo_init(void) | |||
120 | */ | 120 | */ |
121 | orion5x_ehci0_init(); | 121 | orion5x_ehci0_init(); |
122 | orion5x_eth_init(&rd88f5181l_fxo_eth_data); | 122 | orion5x_eth_init(&rd88f5181l_fxo_eth_data); |
123 | orion5x_eth_switch_init(&rd88f5181l_fxo_switch_plat_data, NO_IRQ); | 123 | orion5x_eth_switch_init(&rd88f5181l_fxo_switch_plat_data); |
124 | orion5x_uart0_init(); | 124 | orion5x_uart0_init(); |
125 | 125 | ||
126 | mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET, | 126 | mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET, |
diff --git a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c index 7e977b794b0c..affe5ec825de 100644 --- a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c +++ b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c | |||
@@ -102,7 +102,7 @@ static struct dsa_chip_data rd88f5181l_ge_switch_chip_data = { | |||
102 | .port_names[7] = "lan3", | 102 | .port_names[7] = "lan3", |
103 | }; | 103 | }; |
104 | 104 | ||
105 | static struct dsa_platform_data rd88f5181l_ge_switch_plat_data = { | 105 | static struct dsa_platform_data __initdata rd88f5181l_ge_switch_plat_data = { |
106 | .nr_chips = 1, | 106 | .nr_chips = 1, |
107 | .chip = &rd88f5181l_ge_switch_chip_data, | 107 | .chip = &rd88f5181l_ge_switch_chip_data, |
108 | }; | 108 | }; |
@@ -125,8 +125,7 @@ static void __init rd88f5181l_ge_init(void) | |||
125 | */ | 125 | */ |
126 | orion5x_ehci0_init(); | 126 | orion5x_ehci0_init(); |
127 | orion5x_eth_init(&rd88f5181l_ge_eth_data); | 127 | orion5x_eth_init(&rd88f5181l_ge_eth_data); |
128 | orion5x_eth_switch_init(&rd88f5181l_ge_switch_plat_data, | 128 | orion5x_eth_switch_init(&rd88f5181l_ge_switch_plat_data); |
129 | gpio_to_irq(8)); | ||
130 | orion5x_i2c_init(); | 129 | orion5x_i2c_init(); |
131 | orion5x_uart0_init(); | 130 | orion5x_uart0_init(); |
132 | 131 | ||
diff --git a/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c b/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c index 4bf80dd5478c..f2db56dc818c 100644 --- a/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c +++ b/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c | |||
@@ -40,7 +40,7 @@ static struct dsa_chip_data rd88f6183ap_ge_switch_chip_data = { | |||
40 | .port_names[5] = "cpu", | 40 | .port_names[5] = "cpu", |
41 | }; | 41 | }; |
42 | 42 | ||
43 | static struct dsa_platform_data rd88f6183ap_ge_switch_plat_data = { | 43 | static struct dsa_platform_data __initdata rd88f6183ap_ge_switch_plat_data = { |
44 | .nr_chips = 1, | 44 | .nr_chips = 1, |
45 | .chip = &rd88f6183ap_ge_switch_chip_data, | 45 | .chip = &rd88f6183ap_ge_switch_chip_data, |
46 | }; | 46 | }; |
@@ -90,8 +90,7 @@ static void __init rd88f6183ap_ge_init(void) | |||
90 | */ | 90 | */ |
91 | orion5x_ehci0_init(); | 91 | orion5x_ehci0_init(); |
92 | orion5x_eth_init(&rd88f6183ap_ge_eth_data); | 92 | orion5x_eth_init(&rd88f6183ap_ge_eth_data); |
93 | orion5x_eth_switch_init(&rd88f6183ap_ge_switch_plat_data, | 93 | orion5x_eth_switch_init(&rd88f6183ap_ge_switch_plat_data); |
94 | gpio_to_irq(3)); | ||
95 | spi_register_board_info(rd88f6183ap_ge_spi_slave_info, | 94 | spi_register_board_info(rd88f6183ap_ge_spi_slave_info, |
96 | ARRAY_SIZE(rd88f6183ap_ge_spi_slave_info)); | 95 | ARRAY_SIZE(rd88f6183ap_ge_spi_slave_info)); |
97 | orion5x_spi_init(); | 96 | orion5x_spi_init(); |
diff --git a/arch/arm/mach-orion5x/wnr854t-setup.c b/arch/arm/mach-orion5x/wnr854t-setup.c index 4e1e5c8f6111..4dbcdbe1de7c 100644 --- a/arch/arm/mach-orion5x/wnr854t-setup.c +++ b/arch/arm/mach-orion5x/wnr854t-setup.c | |||
@@ -106,7 +106,7 @@ static struct dsa_chip_data wnr854t_switch_chip_data = { | |||
106 | .port_names[7] = "lan2", | 106 | .port_names[7] = "lan2", |
107 | }; | 107 | }; |
108 | 108 | ||
109 | static struct dsa_platform_data wnr854t_switch_plat_data = { | 109 | static struct dsa_platform_data __initdata wnr854t_switch_plat_data = { |
110 | .nr_chips = 1, | 110 | .nr_chips = 1, |
111 | .chip = &wnr854t_switch_chip_data, | 111 | .chip = &wnr854t_switch_chip_data, |
112 | }; | 112 | }; |
@@ -124,7 +124,7 @@ static void __init wnr854t_init(void) | |||
124 | * Configure peripherals. | 124 | * Configure peripherals. |
125 | */ | 125 | */ |
126 | orion5x_eth_init(&wnr854t_eth_data); | 126 | orion5x_eth_init(&wnr854t_eth_data); |
127 | orion5x_eth_switch_init(&wnr854t_switch_plat_data, NO_IRQ); | 127 | orion5x_eth_switch_init(&wnr854t_switch_plat_data); |
128 | orion5x_uart0_init(); | 128 | orion5x_uart0_init(); |
129 | 129 | ||
130 | mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET, | 130 | mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET, |
diff --git a/arch/arm/mach-orion5x/wrt350n-v2-setup.c b/arch/arm/mach-orion5x/wrt350n-v2-setup.c index 61e9027ef224..a6a8c4648d74 100644 --- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c +++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c | |||
@@ -191,7 +191,7 @@ static struct dsa_chip_data wrt350n_v2_switch_chip_data = { | |||
191 | .port_names[7] = "lan4", | 191 | .port_names[7] = "lan4", |
192 | }; | 192 | }; |
193 | 193 | ||
194 | static struct dsa_platform_data wrt350n_v2_switch_plat_data = { | 194 | static struct dsa_platform_data __initdata wrt350n_v2_switch_plat_data = { |
195 | .nr_chips = 1, | 195 | .nr_chips = 1, |
196 | .chip = &wrt350n_v2_switch_chip_data, | 196 | .chip = &wrt350n_v2_switch_chip_data, |
197 | }; | 197 | }; |
@@ -210,7 +210,7 @@ static void __init wrt350n_v2_init(void) | |||
210 | */ | 210 | */ |
211 | orion5x_ehci0_init(); | 211 | orion5x_ehci0_init(); |
212 | orion5x_eth_init(&wrt350n_v2_eth_data); | 212 | orion5x_eth_init(&wrt350n_v2_eth_data); |
213 | orion5x_eth_switch_init(&wrt350n_v2_switch_plat_data, NO_IRQ); | 213 | orion5x_eth_switch_init(&wrt350n_v2_switch_plat_data); |
214 | orion5x_uart0_init(); | 214 | orion5x_uart0_init(); |
215 | 215 | ||
216 | mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET, | 216 | mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET, |
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c index 7b9b70785a54..272f49b2c68f 100644 --- a/arch/arm/plat-orion/common.c +++ b/arch/arm/plat-orion/common.c | |||
@@ -470,37 +470,15 @@ void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data, | |||
470 | /***************************************************************************** | 470 | /***************************************************************************** |
471 | * Ethernet switch | 471 | * Ethernet switch |
472 | ****************************************************************************/ | 472 | ****************************************************************************/ |
473 | static struct resource orion_switch_resources[] = { | 473 | void __init orion_ge00_switch_init(struct dsa_platform_data *d) |
474 | { | ||
475 | .start = 0, | ||
476 | .end = 0, | ||
477 | .flags = IORESOURCE_IRQ, | ||
478 | }, | ||
479 | }; | ||
480 | |||
481 | static struct platform_device orion_switch_device = { | ||
482 | .name = "dsa", | ||
483 | .id = 0, | ||
484 | .num_resources = 0, | ||
485 | .resource = orion_switch_resources, | ||
486 | }; | ||
487 | |||
488 | void __init orion_ge00_switch_init(struct dsa_platform_data *d, int irq) | ||
489 | { | 474 | { |
490 | int i; | 475 | int i; |
491 | 476 | ||
492 | if (irq != NO_IRQ) { | ||
493 | orion_switch_resources[0].start = irq; | ||
494 | orion_switch_resources[0].end = irq; | ||
495 | orion_switch_device.num_resources = 1; | ||
496 | } | ||
497 | |||
498 | d->netdev = &orion_ge00.dev; | 477 | d->netdev = &orion_ge00.dev; |
499 | for (i = 0; i < d->nr_chips; i++) | 478 | for (i = 0; i < d->nr_chips; i++) |
500 | d->chip[i].host_dev = &orion_ge_mvmdio.dev; | 479 | d->chip[i].host_dev = &orion_ge_mvmdio.dev; |
501 | orion_switch_device.dev.platform_data = d; | ||
502 | 480 | ||
503 | platform_device_register(&orion_switch_device); | 481 | platform_device_register_data(NULL, "dsa", 0, d, sizeof(d)); |
504 | } | 482 | } |
505 | 483 | ||
506 | /***************************************************************************** | 484 | /***************************************************************************** |
diff --git a/arch/arm/plat-orion/include/plat/common.h b/arch/arm/plat-orion/include/plat/common.h index 8519727faa5e..9347f3c58a6d 100644 --- a/arch/arm/plat-orion/include/plat/common.h +++ b/arch/arm/plat-orion/include/plat/common.h | |||
@@ -57,8 +57,7 @@ void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data, | |||
57 | unsigned long mapbase, | 57 | unsigned long mapbase, |
58 | unsigned long irq); | 58 | unsigned long irq); |
59 | 59 | ||
60 | void __init orion_ge00_switch_init(struct dsa_platform_data *d, | 60 | void __init orion_ge00_switch_init(struct dsa_platform_data *d); |
61 | int irq); | ||
62 | 61 | ||
63 | void __init orion_i2c_init(unsigned long mapbase, | 62 | void __init orion_i2c_init(unsigned long mapbase, |
64 | unsigned long irq, | 63 | unsigned long irq, |