diff options
author | Andrew Lunn <andrew@lunn.ch> | 2011-05-15 07:32:44 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@fluxnic.net> | 2011-05-16 15:06:01 -0400 |
commit | 7e3819d820c9aa3536d15fe7310c054bef1f5f04 (patch) | |
tree | a65cf874aceae43813e5c03f587e8f5bfaaf32ad | |
parent | 4748058c5cbf70b3adfa37204c047fcb29f335c0 (diff) |
ARM: orion: Consolidate ethernet platform data
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
-rw-r--r-- | arch/arm/mach-dove/common.c | 53 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/common.c | 145 | ||||
-rw-r--r-- | arch/arm/mach-loki/common.c | 109 | ||||
-rw-r--r-- | arch/arm/mach-mv78xx0/common.c | 218 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/common.c | 85 | ||||
-rw-r--r-- | arch/arm/plat-orion/common.c | 276 | ||||
-rw-r--r-- | arch/arm/plat-orion/include/plat/common.h | 34 |
7 files changed, 348 insertions, 572 deletions
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c index 8a414cb71a23..1d878ce69d93 100644 --- a/arch/arm/mach-dove/common.c +++ b/arch/arm/mach-dove/common.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/serial_8250.h> | 16 | #include <linux/serial_8250.h> |
17 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
18 | #include <linux/mbus.h> | 18 | #include <linux/mbus.h> |
19 | #include <linux/mv643xx_eth.h> | ||
20 | #include <linux/mv643xx_i2c.h> | 19 | #include <linux/mv643xx_i2c.h> |
21 | #include <linux/ata_platform.h> | 20 | #include <linux/ata_platform.h> |
22 | #include <linux/serial_8250.h> | 21 | #include <linux/serial_8250.h> |
@@ -150,56 +149,11 @@ void __init dove_ehci1_init(void) | |||
150 | /***************************************************************************** | 149 | /***************************************************************************** |
151 | * GE00 | 150 | * GE00 |
152 | ****************************************************************************/ | 151 | ****************************************************************************/ |
153 | struct mv643xx_eth_shared_platform_data dove_ge00_shared_data = { | ||
154 | .t_clk = 0, | ||
155 | .dram = &dove_mbus_dram_info, | ||
156 | }; | ||
157 | |||
158 | static struct resource dove_ge00_shared_resources[] = { | ||
159 | { | ||
160 | .name = "ge00 base", | ||
161 | .start = DOVE_GE00_PHYS_BASE + 0x2000, | ||
162 | .end = DOVE_GE00_PHYS_BASE + SZ_16K - 1, | ||
163 | .flags = IORESOURCE_MEM, | ||
164 | }, | ||
165 | }; | ||
166 | |||
167 | static struct platform_device dove_ge00_shared = { | ||
168 | .name = MV643XX_ETH_SHARED_NAME, | ||
169 | .id = 0, | ||
170 | .dev = { | ||
171 | .platform_data = &dove_ge00_shared_data, | ||
172 | }, | ||
173 | .num_resources = 1, | ||
174 | .resource = dove_ge00_shared_resources, | ||
175 | }; | ||
176 | |||
177 | static struct resource dove_ge00_resources[] = { | ||
178 | { | ||
179 | .name = "ge00 irq", | ||
180 | .start = IRQ_DOVE_GE00_SUM, | ||
181 | .end = IRQ_DOVE_GE00_SUM, | ||
182 | .flags = IORESOURCE_IRQ, | ||
183 | }, | ||
184 | }; | ||
185 | |||
186 | static struct platform_device dove_ge00 = { | ||
187 | .name = MV643XX_ETH_NAME, | ||
188 | .id = 0, | ||
189 | .num_resources = 1, | ||
190 | .resource = dove_ge00_resources, | ||
191 | .dev = { | ||
192 | .coherent_dma_mask = 0xffffffff, | ||
193 | }, | ||
194 | }; | ||
195 | |||
196 | void __init dove_ge00_init(struct mv643xx_eth_platform_data *eth_data) | 152 | void __init dove_ge00_init(struct mv643xx_eth_platform_data *eth_data) |
197 | { | 153 | { |
198 | eth_data->shared = &dove_ge00_shared; | 154 | orion_ge00_init(eth_data, &dove_mbus_dram_info, |
199 | dove_ge00.dev.platform_data = eth_data; | 155 | DOVE_GE00_PHYS_BASE, IRQ_DOVE_GE00_SUM, |
200 | 156 | 0, get_tclk()); | |
201 | platform_device_register(&dove_ge00_shared); | ||
202 | platform_device_register(&dove_ge00); | ||
203 | } | 157 | } |
204 | 158 | ||
205 | /***************************************************************************** | 159 | /***************************************************************************** |
@@ -690,7 +644,6 @@ void __init dove_init(void) | |||
690 | #endif | 644 | #endif |
691 | dove_setup_cpu_mbus(); | 645 | dove_setup_cpu_mbus(); |
692 | 646 | ||
693 | dove_ge00_shared_data.t_clk = tclk; | ||
694 | dove_spi0_data.tclk = tclk; | 647 | dove_spi0_data.tclk = tclk; |
695 | dove_spi1_data.tclk = tclk; | 648 | dove_spi1_data.tclk = tclk; |
696 | 649 | ||
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index f6868fc2a7f0..485f3b9ba4e2 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/serial_8250.h> | 14 | #include <linux/serial_8250.h> |
15 | #include <linux/mbus.h> | 15 | #include <linux/mbus.h> |
16 | #include <linux/mv643xx_eth.h> | ||
17 | #include <linux/mv643xx_i2c.h> | 16 | #include <linux/mv643xx_i2c.h> |
18 | #include <linux/ata_platform.h> | 17 | #include <linux/ata_platform.h> |
19 | #include <linux/mtd/nand.h> | 18 | #include <linux/mtd/nand.h> |
@@ -70,7 +69,7 @@ void __init kirkwood_map_io(void) | |||
70 | * registered. Some reserved bits must be set to 1. | 69 | * registered. Some reserved bits must be set to 1. |
71 | */ | 70 | */ |
72 | unsigned int kirkwood_clk_ctrl = CGC_DUNIT | CGC_RESERVED; | 71 | unsigned int kirkwood_clk_ctrl = CGC_DUNIT | CGC_RESERVED; |
73 | 72 | ||
74 | 73 | ||
75 | /***************************************************************************** | 74 | /***************************************************************************** |
76 | * EHCI | 75 | * EHCI |
@@ -120,160 +119,36 @@ void __init kirkwood_ehci_init(void) | |||
120 | /***************************************************************************** | 119 | /***************************************************************************** |
121 | * GE00 | 120 | * GE00 |
122 | ****************************************************************************/ | 121 | ****************************************************************************/ |
123 | struct mv643xx_eth_shared_platform_data kirkwood_ge00_shared_data = { | ||
124 | .dram = &kirkwood_mbus_dram_info, | ||
125 | }; | ||
126 | |||
127 | static struct resource kirkwood_ge00_shared_resources[] = { | ||
128 | { | ||
129 | .name = "ge00 base", | ||
130 | .start = GE00_PHYS_BASE + 0x2000, | ||
131 | .end = GE00_PHYS_BASE + SZ_16K - 1, | ||
132 | .flags = IORESOURCE_MEM, | ||
133 | }, { | ||
134 | .name = "ge00 err irq", | ||
135 | .start = IRQ_KIRKWOOD_GE00_ERR, | ||
136 | .end = IRQ_KIRKWOOD_GE00_ERR, | ||
137 | .flags = IORESOURCE_IRQ, | ||
138 | }, | ||
139 | }; | ||
140 | |||
141 | static struct platform_device kirkwood_ge00_shared = { | ||
142 | .name = MV643XX_ETH_SHARED_NAME, | ||
143 | .id = 0, | ||
144 | .dev = { | ||
145 | .platform_data = &kirkwood_ge00_shared_data, | ||
146 | }, | ||
147 | .num_resources = ARRAY_SIZE(kirkwood_ge00_shared_resources), | ||
148 | .resource = kirkwood_ge00_shared_resources, | ||
149 | }; | ||
150 | |||
151 | static struct resource kirkwood_ge00_resources[] = { | ||
152 | { | ||
153 | .name = "ge00 irq", | ||
154 | .start = IRQ_KIRKWOOD_GE00_SUM, | ||
155 | .end = IRQ_KIRKWOOD_GE00_SUM, | ||
156 | .flags = IORESOURCE_IRQ, | ||
157 | }, | ||
158 | }; | ||
159 | |||
160 | static struct platform_device kirkwood_ge00 = { | ||
161 | .name = MV643XX_ETH_NAME, | ||
162 | .id = 0, | ||
163 | .num_resources = 1, | ||
164 | .resource = kirkwood_ge00_resources, | ||
165 | .dev = { | ||
166 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
167 | }, | ||
168 | }; | ||
169 | |||
170 | void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data) | 122 | void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data) |
171 | { | 123 | { |
172 | kirkwood_clk_ctrl |= CGC_GE0; | 124 | kirkwood_clk_ctrl |= CGC_GE0; |
173 | eth_data->shared = &kirkwood_ge00_shared; | ||
174 | kirkwood_ge00.dev.platform_data = eth_data; | ||
175 | 125 | ||
176 | platform_device_register(&kirkwood_ge00_shared); | 126 | orion_ge00_init(eth_data, &kirkwood_mbus_dram_info, |
177 | platform_device_register(&kirkwood_ge00); | 127 | GE00_PHYS_BASE, IRQ_KIRKWOOD_GE00_SUM, |
128 | IRQ_KIRKWOOD_GE00_ERR, kirkwood_tclk); | ||
178 | } | 129 | } |
179 | 130 | ||
180 | 131 | ||
181 | /***************************************************************************** | 132 | /***************************************************************************** |
182 | * GE01 | 133 | * GE01 |
183 | ****************************************************************************/ | 134 | ****************************************************************************/ |
184 | struct mv643xx_eth_shared_platform_data kirkwood_ge01_shared_data = { | ||
185 | .dram = &kirkwood_mbus_dram_info, | ||
186 | .shared_smi = &kirkwood_ge00_shared, | ||
187 | }; | ||
188 | |||
189 | static struct resource kirkwood_ge01_shared_resources[] = { | ||
190 | { | ||
191 | .name = "ge01 base", | ||
192 | .start = GE01_PHYS_BASE + 0x2000, | ||
193 | .end = GE01_PHYS_BASE + SZ_16K - 1, | ||
194 | .flags = IORESOURCE_MEM, | ||
195 | }, { | ||
196 | .name = "ge01 err irq", | ||
197 | .start = IRQ_KIRKWOOD_GE01_ERR, | ||
198 | .end = IRQ_KIRKWOOD_GE01_ERR, | ||
199 | .flags = IORESOURCE_IRQ, | ||
200 | }, | ||
201 | }; | ||
202 | |||
203 | static struct platform_device kirkwood_ge01_shared = { | ||
204 | .name = MV643XX_ETH_SHARED_NAME, | ||
205 | .id = 1, | ||
206 | .dev = { | ||
207 | .platform_data = &kirkwood_ge01_shared_data, | ||
208 | }, | ||
209 | .num_resources = ARRAY_SIZE(kirkwood_ge01_shared_resources), | ||
210 | .resource = kirkwood_ge01_shared_resources, | ||
211 | }; | ||
212 | |||
213 | static struct resource kirkwood_ge01_resources[] = { | ||
214 | { | ||
215 | .name = "ge01 irq", | ||
216 | .start = IRQ_KIRKWOOD_GE01_SUM, | ||
217 | .end = IRQ_KIRKWOOD_GE01_SUM, | ||
218 | .flags = IORESOURCE_IRQ, | ||
219 | }, | ||
220 | }; | ||
221 | |||
222 | static struct platform_device kirkwood_ge01 = { | ||
223 | .name = MV643XX_ETH_NAME, | ||
224 | .id = 1, | ||
225 | .num_resources = 1, | ||
226 | .resource = kirkwood_ge01_resources, | ||
227 | .dev = { | ||
228 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
229 | }, | ||
230 | }; | ||
231 | |||
232 | void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data) | 135 | void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data) |
233 | { | 136 | { |
137 | |||
234 | kirkwood_clk_ctrl |= CGC_GE1; | 138 | kirkwood_clk_ctrl |= CGC_GE1; |
235 | eth_data->shared = &kirkwood_ge01_shared; | ||
236 | kirkwood_ge01.dev.platform_data = eth_data; | ||
237 | 139 | ||
238 | platform_device_register(&kirkwood_ge01_shared); | 140 | orion_ge01_init(eth_data, &kirkwood_mbus_dram_info, |
239 | platform_device_register(&kirkwood_ge01); | 141 | GE01_PHYS_BASE, IRQ_KIRKWOOD_GE01_SUM, |
142 | IRQ_KIRKWOOD_GE01_ERR, kirkwood_tclk); | ||
240 | } | 143 | } |
241 | 144 | ||
242 | 145 | ||
243 | /***************************************************************************** | 146 | /***************************************************************************** |
244 | * Ethernet switch | 147 | * Ethernet switch |
245 | ****************************************************************************/ | 148 | ****************************************************************************/ |
246 | static struct resource kirkwood_switch_resources[] = { | ||
247 | { | ||
248 | .start = 0, | ||
249 | .end = 0, | ||
250 | .flags = IORESOURCE_IRQ, | ||
251 | }, | ||
252 | }; | ||
253 | |||
254 | static struct platform_device kirkwood_switch_device = { | ||
255 | .name = "dsa", | ||
256 | .id = 0, | ||
257 | .num_resources = 0, | ||
258 | .resource = kirkwood_switch_resources, | ||
259 | }; | ||
260 | |||
261 | void __init kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq) | 149 | void __init kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq) |
262 | { | 150 | { |
263 | int i; | 151 | orion_ge00_switch_init(d, irq); |
264 | |||
265 | if (irq != NO_IRQ) { | ||
266 | kirkwood_switch_resources[0].start = irq; | ||
267 | kirkwood_switch_resources[0].end = irq; | ||
268 | kirkwood_switch_device.num_resources = 1; | ||
269 | } | ||
270 | |||
271 | d->netdev = &kirkwood_ge00.dev; | ||
272 | for (i = 0; i < d->nr_chips; i++) | ||
273 | d->chip[i].mii_bus = &kirkwood_ge00_shared.dev; | ||
274 | kirkwood_switch_device.dev.platform_data = d; | ||
275 | |||
276 | platform_device_register(&kirkwood_switch_device); | ||
277 | } | 152 | } |
278 | 153 | ||
279 | 154 | ||
@@ -911,8 +786,6 @@ void __init kirkwood_init(void) | |||
911 | { | 786 | { |
912 | printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n", | 787 | printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n", |
913 | kirkwood_id(), kirkwood_tclk); | 788 | kirkwood_id(), kirkwood_tclk); |
914 | kirkwood_ge00_shared_data.t_clk = kirkwood_tclk; | ||
915 | kirkwood_ge01_shared_data.t_clk = kirkwood_tclk; | ||
916 | kirkwood_spi_plat_data.tclk = kirkwood_tclk; | 789 | kirkwood_spi_plat_data.tclk = kirkwood_tclk; |
917 | kirkwood_i2s_data.tclk = kirkwood_tclk; | 790 | kirkwood_i2s_data.tclk = kirkwood_tclk; |
918 | 791 | ||
diff --git a/arch/arm/mach-loki/common.c b/arch/arm/mach-loki/common.c index c07180492bf0..5f02664db812 100644 --- a/arch/arm/mach-loki/common.c +++ b/arch/arm/mach-loki/common.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/serial_8250.h> | 14 | #include <linux/serial_8250.h> |
15 | #include <linux/mbus.h> | 15 | #include <linux/mbus.h> |
16 | #include <linux/mv643xx_eth.h> | ||
17 | #include <linux/dma-mapping.h> | 16 | #include <linux/dma-mapping.h> |
18 | #include <asm/page.h> | 17 | #include <asm/page.h> |
19 | #include <asm/timex.h> | 18 | #include <asm/timex.h> |
@@ -45,116 +44,28 @@ void __init loki_map_io(void) | |||
45 | 44 | ||
46 | 45 | ||
47 | /***************************************************************************** | 46 | /***************************************************************************** |
48 | * GE0 | 47 | * GE00 |
49 | ****************************************************************************/ | 48 | ****************************************************************************/ |
50 | struct mv643xx_eth_shared_platform_data loki_ge0_shared_data = { | ||
51 | .t_clk = LOKI_TCLK, | ||
52 | .dram = &loki_mbus_dram_info, | ||
53 | }; | ||
54 | |||
55 | static struct resource loki_ge0_shared_resources[] = { | ||
56 | { | ||
57 | .name = "ge0 base", | ||
58 | .start = GE0_PHYS_BASE + 0x2000, | ||
59 | .end = GE0_PHYS_BASE + SZ_16K - 1, | ||
60 | .flags = IORESOURCE_MEM, | ||
61 | }, | ||
62 | }; | ||
63 | |||
64 | static struct platform_device loki_ge0_shared = { | ||
65 | .name = MV643XX_ETH_SHARED_NAME, | ||
66 | .id = 0, | ||
67 | .dev = { | ||
68 | .platform_data = &loki_ge0_shared_data, | ||
69 | }, | ||
70 | .num_resources = 1, | ||
71 | .resource = loki_ge0_shared_resources, | ||
72 | }; | ||
73 | |||
74 | static struct resource loki_ge0_resources[] = { | ||
75 | { | ||
76 | .name = "ge0 irq", | ||
77 | .start = IRQ_LOKI_GBE_A_INT, | ||
78 | .end = IRQ_LOKI_GBE_A_INT, | ||
79 | .flags = IORESOURCE_IRQ, | ||
80 | }, | ||
81 | }; | ||
82 | |||
83 | static struct platform_device loki_ge0 = { | ||
84 | .name = MV643XX_ETH_NAME, | ||
85 | .id = 0, | ||
86 | .num_resources = 1, | ||
87 | .resource = loki_ge0_resources, | ||
88 | .dev = { | ||
89 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
90 | }, | ||
91 | }; | ||
92 | |||
93 | void __init loki_ge0_init(struct mv643xx_eth_platform_data *eth_data) | 49 | void __init loki_ge0_init(struct mv643xx_eth_platform_data *eth_data) |
94 | { | 50 | { |
95 | eth_data->shared = &loki_ge0_shared; | ||
96 | loki_ge0.dev.platform_data = eth_data; | ||
97 | |||
98 | writel(0x00079220, GE0_VIRT_BASE + 0x20b0); | 51 | writel(0x00079220, GE0_VIRT_BASE + 0x20b0); |
99 | platform_device_register(&loki_ge0_shared); | 52 | |
100 | platform_device_register(&loki_ge0); | 53 | orion_ge00_init(eth_data, &loki_mbus_dram_info, |
54 | GE0_PHYS_BASE, IRQ_LOKI_GBE_A_INT, | ||
55 | 0, LOKI_TCLK); | ||
101 | } | 56 | } |
102 | 57 | ||
103 | 58 | ||
104 | /***************************************************************************** | 59 | /***************************************************************************** |
105 | * GE1 | 60 | * GE01 |
106 | ****************************************************************************/ | 61 | ****************************************************************************/ |
107 | struct mv643xx_eth_shared_platform_data loki_ge1_shared_data = { | ||
108 | .t_clk = LOKI_TCLK, | ||
109 | .dram = &loki_mbus_dram_info, | ||
110 | }; | ||
111 | |||
112 | static struct resource loki_ge1_shared_resources[] = { | ||
113 | { | ||
114 | .name = "ge1 base", | ||
115 | .start = GE1_PHYS_BASE + 0x2000, | ||
116 | .end = GE1_PHYS_BASE + SZ_16K - 1, | ||
117 | .flags = IORESOURCE_MEM, | ||
118 | }, | ||
119 | }; | ||
120 | |||
121 | static struct platform_device loki_ge1_shared = { | ||
122 | .name = MV643XX_ETH_SHARED_NAME, | ||
123 | .id = 1, | ||
124 | .dev = { | ||
125 | .platform_data = &loki_ge1_shared_data, | ||
126 | }, | ||
127 | .num_resources = 1, | ||
128 | .resource = loki_ge1_shared_resources, | ||
129 | }; | ||
130 | |||
131 | static struct resource loki_ge1_resources[] = { | ||
132 | { | ||
133 | .name = "ge1 irq", | ||
134 | .start = IRQ_LOKI_GBE_B_INT, | ||
135 | .end = IRQ_LOKI_GBE_B_INT, | ||
136 | .flags = IORESOURCE_IRQ, | ||
137 | }, | ||
138 | }; | ||
139 | |||
140 | static struct platform_device loki_ge1 = { | ||
141 | .name = MV643XX_ETH_NAME, | ||
142 | .id = 1, | ||
143 | .num_resources = 1, | ||
144 | .resource = loki_ge1_resources, | ||
145 | .dev = { | ||
146 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
147 | }, | ||
148 | }; | ||
149 | |||
150 | void __init loki_ge1_init(struct mv643xx_eth_platform_data *eth_data) | 62 | void __init loki_ge1_init(struct mv643xx_eth_platform_data *eth_data) |
151 | { | 63 | { |
152 | eth_data->shared = &loki_ge1_shared; | ||
153 | loki_ge1.dev.platform_data = eth_data; | ||
154 | |||
155 | writel(0x00079220, GE1_VIRT_BASE + 0x20b0); | 64 | writel(0x00079220, GE1_VIRT_BASE + 0x20b0); |
156 | platform_device_register(&loki_ge1_shared); | 65 | |
157 | platform_device_register(&loki_ge1); | 66 | orion_ge01_init(eth_data, &loki_mbus_dram_info, |
67 | GE1_PHYS_BASE, IRQ_LOKI_GBE_B_INT, | ||
68 | 0, LOKI_TCLK); | ||
158 | } | 69 | } |
159 | 70 | ||
160 | 71 | ||
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c index 5b474e4574de..0fd9a8329910 100644 --- a/arch/arm/mach-mv78xx0/common.c +++ b/arch/arm/mach-mv78xx0/common.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/serial_8250.h> | 14 | #include <linux/serial_8250.h> |
15 | #include <linux/mbus.h> | 15 | #include <linux/mbus.h> |
16 | #include <linux/mv643xx_eth.h> | ||
17 | #include <linux/mv643xx_i2c.h> | 16 | #include <linux/mv643xx_i2c.h> |
18 | #include <linux/ata_platform.h> | 17 | #include <linux/ata_platform.h> |
19 | #include <linux/ethtool.h> | 18 | #include <linux/ethtool.h> |
@@ -280,175 +279,32 @@ void __init mv78xx0_ehci2_init(void) | |||
280 | /***************************************************************************** | 279 | /***************************************************************************** |
281 | * GE00 | 280 | * GE00 |
282 | ****************************************************************************/ | 281 | ****************************************************************************/ |
283 | struct mv643xx_eth_shared_platform_data mv78xx0_ge00_shared_data = { | ||
284 | .t_clk = 0, | ||
285 | .dram = &mv78xx0_mbus_dram_info, | ||
286 | }; | ||
287 | |||
288 | static struct resource mv78xx0_ge00_shared_resources[] = { | ||
289 | { | ||
290 | .name = "ge00 base", | ||
291 | .start = GE00_PHYS_BASE + 0x2000, | ||
292 | .end = GE00_PHYS_BASE + SZ_16K - 1, | ||
293 | .flags = IORESOURCE_MEM, | ||
294 | }, { | ||
295 | .name = "ge err irq", | ||
296 | .start = IRQ_MV78XX0_GE_ERR, | ||
297 | .end = IRQ_MV78XX0_GE_ERR, | ||
298 | .flags = IORESOURCE_IRQ, | ||
299 | }, | ||
300 | }; | ||
301 | |||
302 | static struct platform_device mv78xx0_ge00_shared = { | ||
303 | .name = MV643XX_ETH_SHARED_NAME, | ||
304 | .id = 0, | ||
305 | .dev = { | ||
306 | .platform_data = &mv78xx0_ge00_shared_data, | ||
307 | }, | ||
308 | .num_resources = ARRAY_SIZE(mv78xx0_ge00_shared_resources), | ||
309 | .resource = mv78xx0_ge00_shared_resources, | ||
310 | }; | ||
311 | |||
312 | static struct resource mv78xx0_ge00_resources[] = { | ||
313 | { | ||
314 | .name = "ge00 irq", | ||
315 | .start = IRQ_MV78XX0_GE00_SUM, | ||
316 | .end = IRQ_MV78XX0_GE00_SUM, | ||
317 | .flags = IORESOURCE_IRQ, | ||
318 | }, | ||
319 | }; | ||
320 | |||
321 | static struct platform_device mv78xx0_ge00 = { | ||
322 | .name = MV643XX_ETH_NAME, | ||
323 | .id = 0, | ||
324 | .num_resources = 1, | ||
325 | .resource = mv78xx0_ge00_resources, | ||
326 | .dev = { | ||
327 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
328 | }, | ||
329 | }; | ||
330 | |||
331 | void __init mv78xx0_ge00_init(struct mv643xx_eth_platform_data *eth_data) | 282 | void __init mv78xx0_ge00_init(struct mv643xx_eth_platform_data *eth_data) |
332 | { | 283 | { |
333 | eth_data->shared = &mv78xx0_ge00_shared; | 284 | orion_ge00_init(eth_data, &mv78xx0_mbus_dram_info, |
334 | mv78xx0_ge00.dev.platform_data = eth_data; | 285 | GE00_PHYS_BASE, IRQ_MV78XX0_GE00_SUM, |
335 | 286 | IRQ_MV78XX0_GE_ERR, get_tclk()); | |
336 | platform_device_register(&mv78xx0_ge00_shared); | ||
337 | platform_device_register(&mv78xx0_ge00); | ||
338 | } | 287 | } |
339 | 288 | ||
340 | 289 | ||
341 | /***************************************************************************** | 290 | /***************************************************************************** |
342 | * GE01 | 291 | * GE01 |
343 | ****************************************************************************/ | 292 | ****************************************************************************/ |
344 | struct mv643xx_eth_shared_platform_data mv78xx0_ge01_shared_data = { | ||
345 | .t_clk = 0, | ||
346 | .dram = &mv78xx0_mbus_dram_info, | ||
347 | .shared_smi = &mv78xx0_ge00_shared, | ||
348 | }; | ||
349 | |||
350 | static struct resource mv78xx0_ge01_shared_resources[] = { | ||
351 | { | ||
352 | .name = "ge01 base", | ||
353 | .start = GE01_PHYS_BASE + 0x2000, | ||
354 | .end = GE01_PHYS_BASE + SZ_16K - 1, | ||
355 | .flags = IORESOURCE_MEM, | ||
356 | }, | ||
357 | }; | ||
358 | |||
359 | static struct platform_device mv78xx0_ge01_shared = { | ||
360 | .name = MV643XX_ETH_SHARED_NAME, | ||
361 | .id = 1, | ||
362 | .dev = { | ||
363 | .platform_data = &mv78xx0_ge01_shared_data, | ||
364 | }, | ||
365 | .num_resources = 1, | ||
366 | .resource = mv78xx0_ge01_shared_resources, | ||
367 | }; | ||
368 | |||
369 | static struct resource mv78xx0_ge01_resources[] = { | ||
370 | { | ||
371 | .name = "ge01 irq", | ||
372 | .start = IRQ_MV78XX0_GE01_SUM, | ||
373 | .end = IRQ_MV78XX0_GE01_SUM, | ||
374 | .flags = IORESOURCE_IRQ, | ||
375 | }, | ||
376 | }; | ||
377 | |||
378 | static struct platform_device mv78xx0_ge01 = { | ||
379 | .name = MV643XX_ETH_NAME, | ||
380 | .id = 1, | ||
381 | .num_resources = 1, | ||
382 | .resource = mv78xx0_ge01_resources, | ||
383 | .dev = { | ||
384 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
385 | }, | ||
386 | }; | ||
387 | |||
388 | void __init mv78xx0_ge01_init(struct mv643xx_eth_platform_data *eth_data) | 293 | void __init mv78xx0_ge01_init(struct mv643xx_eth_platform_data *eth_data) |
389 | { | 294 | { |
390 | eth_data->shared = &mv78xx0_ge01_shared; | 295 | orion_ge01_init(eth_data, &mv78xx0_mbus_dram_info, |
391 | mv78xx0_ge01.dev.platform_data = eth_data; | 296 | GE01_PHYS_BASE, IRQ_MV78XX0_GE01_SUM, |
392 | 297 | NO_IRQ, get_tclk()); | |
393 | platform_device_register(&mv78xx0_ge01_shared); | ||
394 | platform_device_register(&mv78xx0_ge01); | ||
395 | } | 298 | } |
396 | 299 | ||
397 | 300 | ||
398 | /***************************************************************************** | 301 | /***************************************************************************** |
399 | * GE10 | 302 | * GE10 |
400 | ****************************************************************************/ | 303 | ****************************************************************************/ |
401 | struct mv643xx_eth_shared_platform_data mv78xx0_ge10_shared_data = { | ||
402 | .t_clk = 0, | ||
403 | .dram = &mv78xx0_mbus_dram_info, | ||
404 | .shared_smi = &mv78xx0_ge00_shared, | ||
405 | }; | ||
406 | |||
407 | static struct resource mv78xx0_ge10_shared_resources[] = { | ||
408 | { | ||
409 | .name = "ge10 base", | ||
410 | .start = GE10_PHYS_BASE + 0x2000, | ||
411 | .end = GE10_PHYS_BASE + SZ_16K - 1, | ||
412 | .flags = IORESOURCE_MEM, | ||
413 | }, | ||
414 | }; | ||
415 | |||
416 | static struct platform_device mv78xx0_ge10_shared = { | ||
417 | .name = MV643XX_ETH_SHARED_NAME, | ||
418 | .id = 2, | ||
419 | .dev = { | ||
420 | .platform_data = &mv78xx0_ge10_shared_data, | ||
421 | }, | ||
422 | .num_resources = 1, | ||
423 | .resource = mv78xx0_ge10_shared_resources, | ||
424 | }; | ||
425 | |||
426 | static struct resource mv78xx0_ge10_resources[] = { | ||
427 | { | ||
428 | .name = "ge10 irq", | ||
429 | .start = IRQ_MV78XX0_GE10_SUM, | ||
430 | .end = IRQ_MV78XX0_GE10_SUM, | ||
431 | .flags = IORESOURCE_IRQ, | ||
432 | }, | ||
433 | }; | ||
434 | |||
435 | static struct platform_device mv78xx0_ge10 = { | ||
436 | .name = MV643XX_ETH_NAME, | ||
437 | .id = 2, | ||
438 | .num_resources = 1, | ||
439 | .resource = mv78xx0_ge10_resources, | ||
440 | .dev = { | ||
441 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
442 | }, | ||
443 | }; | ||
444 | |||
445 | void __init mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data) | 304 | void __init mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data) |
446 | { | 305 | { |
447 | u32 dev, rev; | 306 | u32 dev, rev; |
448 | 307 | ||
449 | eth_data->shared = &mv78xx0_ge10_shared; | ||
450 | mv78xx0_ge10.dev.platform_data = eth_data; | ||
451 | |||
452 | /* | 308 | /* |
453 | * On the Z0, ge10 and ge11 are internally connected back | 309 | * On the Z0, ge10 and ge11 are internally connected back |
454 | * to back, and not brought out. | 310 | * to back, and not brought out. |
@@ -460,65 +316,19 @@ void __init mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data) | |||
460 | eth_data->duplex = DUPLEX_FULL; | 316 | eth_data->duplex = DUPLEX_FULL; |
461 | } | 317 | } |
462 | 318 | ||
463 | platform_device_register(&mv78xx0_ge10_shared); | 319 | orion_ge10_init(eth_data, &mv78xx0_mbus_dram_info, |
464 | platform_device_register(&mv78xx0_ge10); | 320 | GE10_PHYS_BASE, IRQ_MV78XX0_GE10_SUM, |
321 | NO_IRQ, get_tclk()); | ||
465 | } | 322 | } |
466 | 323 | ||
467 | 324 | ||
468 | /***************************************************************************** | 325 | /***************************************************************************** |
469 | * GE11 | 326 | * GE11 |
470 | ****************************************************************************/ | 327 | ****************************************************************************/ |
471 | struct mv643xx_eth_shared_platform_data mv78xx0_ge11_shared_data = { | ||
472 | .t_clk = 0, | ||
473 | .dram = &mv78xx0_mbus_dram_info, | ||
474 | .shared_smi = &mv78xx0_ge00_shared, | ||
475 | }; | ||
476 | |||
477 | static struct resource mv78xx0_ge11_shared_resources[] = { | ||
478 | { | ||
479 | .name = "ge11 base", | ||
480 | .start = GE11_PHYS_BASE + 0x2000, | ||
481 | .end = GE11_PHYS_BASE + SZ_16K - 1, | ||
482 | .flags = IORESOURCE_MEM, | ||
483 | }, | ||
484 | }; | ||
485 | |||
486 | static struct platform_device mv78xx0_ge11_shared = { | ||
487 | .name = MV643XX_ETH_SHARED_NAME, | ||
488 | .id = 3, | ||
489 | .dev = { | ||
490 | .platform_data = &mv78xx0_ge11_shared_data, | ||
491 | }, | ||
492 | .num_resources = 1, | ||
493 | .resource = mv78xx0_ge11_shared_resources, | ||
494 | }; | ||
495 | |||
496 | static struct resource mv78xx0_ge11_resources[] = { | ||
497 | { | ||
498 | .name = "ge11 irq", | ||
499 | .start = IRQ_MV78XX0_GE11_SUM, | ||
500 | .end = IRQ_MV78XX0_GE11_SUM, | ||
501 | .flags = IORESOURCE_IRQ, | ||
502 | }, | ||
503 | }; | ||
504 | |||
505 | static struct platform_device mv78xx0_ge11 = { | ||
506 | .name = MV643XX_ETH_NAME, | ||
507 | .id = 3, | ||
508 | .num_resources = 1, | ||
509 | .resource = mv78xx0_ge11_resources, | ||
510 | .dev = { | ||
511 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
512 | }, | ||
513 | }; | ||
514 | |||
515 | void __init mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data) | 328 | void __init mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data) |
516 | { | 329 | { |
517 | u32 dev, rev; | 330 | u32 dev, rev; |
518 | 331 | ||
519 | eth_data->shared = &mv78xx0_ge11_shared; | ||
520 | mv78xx0_ge11.dev.platform_data = eth_data; | ||
521 | |||
522 | /* | 332 | /* |
523 | * On the Z0, ge10 and ge11 are internally connected back | 333 | * On the Z0, ge10 and ge11 are internally connected back |
524 | * to back, and not brought out. | 334 | * to back, and not brought out. |
@@ -530,8 +340,9 @@ void __init mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data) | |||
530 | eth_data->duplex = DUPLEX_FULL; | 340 | eth_data->duplex = DUPLEX_FULL; |
531 | } | 341 | } |
532 | 342 | ||
533 | platform_device_register(&mv78xx0_ge11_shared); | 343 | orion_ge11_init(eth_data, &mv78xx0_mbus_dram_info, |
534 | platform_device_register(&mv78xx0_ge11); | 344 | GE11_PHYS_BASE, IRQ_MV78XX0_GE11_SUM, |
345 | NO_IRQ, get_tclk()); | ||
535 | } | 346 | } |
536 | 347 | ||
537 | /***************************************************************************** | 348 | /***************************************************************************** |
@@ -759,9 +570,4 @@ void __init mv78xx0_init(void) | |||
759 | #ifdef CONFIG_CACHE_FEROCEON_L2 | 570 | #ifdef CONFIG_CACHE_FEROCEON_L2 |
760 | feroceon_l2_init(is_l2_writethrough()); | 571 | feroceon_l2_init(is_l2_writethrough()); |
761 | #endif | 572 | #endif |
762 | |||
763 | mv78xx0_ge00_shared_data.t_clk = tclk; | ||
764 | mv78xx0_ge01_shared_data.t_clk = tclk; | ||
765 | mv78xx0_ge10_shared_data.t_clk = tclk; | ||
766 | mv78xx0_ge11_shared_data.t_clk = tclk; | ||
767 | } | 573 | } |
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c index 310de50e1bb9..0a1c7600004e 100644 --- a/arch/arm/mach-orion5x/common.c +++ b/arch/arm/mach-orion5x/common.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/serial_8250.h> | 16 | #include <linux/serial_8250.h> |
17 | #include <linux/mbus.h> | 17 | #include <linux/mbus.h> |
18 | #include <linux/mv643xx_eth.h> | ||
19 | #include <linux/mv643xx_i2c.h> | 18 | #include <linux/mv643xx_i2c.h> |
20 | #include <linux/ata_platform.h> | 19 | #include <linux/ata_platform.h> |
21 | #include <linux/spi/orion_spi.h> | 20 | #include <linux/spi/orion_spi.h> |
@@ -150,95 +149,20 @@ void __init orion5x_ehci1_init(void) | |||
150 | /***************************************************************************** | 149 | /***************************************************************************** |
151 | * GE00 | 150 | * GE00 |
152 | ****************************************************************************/ | 151 | ****************************************************************************/ |
153 | struct mv643xx_eth_shared_platform_data orion5x_ge00_shared_data = { | ||
154 | .dram = &orion5x_mbus_dram_info, | ||
155 | }; | ||
156 | |||
157 | static struct resource orion5x_ge00_shared_resources[] = { | ||
158 | { | ||
159 | .start = ORION5X_ETH_PHYS_BASE + 0x2000, | ||
160 | .end = ORION5X_ETH_PHYS_BASE + SZ_16K - 1, | ||
161 | .flags = IORESOURCE_MEM, | ||
162 | }, { | ||
163 | .start = IRQ_ORION5X_ETH_ERR, | ||
164 | .end = IRQ_ORION5X_ETH_ERR, | ||
165 | .flags = IORESOURCE_IRQ, | ||
166 | }, | ||
167 | }; | ||
168 | |||
169 | static struct platform_device orion5x_ge00_shared = { | ||
170 | .name = MV643XX_ETH_SHARED_NAME, | ||
171 | .id = 0, | ||
172 | .dev = { | ||
173 | .platform_data = &orion5x_ge00_shared_data, | ||
174 | }, | ||
175 | .num_resources = ARRAY_SIZE(orion5x_ge00_shared_resources), | ||
176 | .resource = orion5x_ge00_shared_resources, | ||
177 | }; | ||
178 | |||
179 | static struct resource orion5x_ge00_resources[] = { | ||
180 | { | ||
181 | .name = "eth irq", | ||
182 | .start = IRQ_ORION5X_ETH_SUM, | ||
183 | .end = IRQ_ORION5X_ETH_SUM, | ||
184 | .flags = IORESOURCE_IRQ, | ||
185 | }, | ||
186 | }; | ||
187 | |||
188 | static struct platform_device orion5x_eth = { | ||
189 | .name = MV643XX_ETH_NAME, | ||
190 | .id = 0, | ||
191 | .num_resources = 1, | ||
192 | .resource = orion5x_ge00_resources, | ||
193 | .dev = { | ||
194 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
195 | }, | ||
196 | }; | ||
197 | |||
198 | void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data) | 152 | void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data) |
199 | { | 153 | { |
200 | eth_data->shared = &orion5x_ge00_shared; | 154 | orion_ge00_init(eth_data, &orion5x_mbus_dram_info, |
201 | orion5x_eth.dev.platform_data = eth_data; | 155 | ORION5X_ETH_PHYS_BASE, IRQ_ORION5X_ETH_SUM, |
202 | 156 | IRQ_ORION5X_ETH_ERR, orion5x_tclk); | |
203 | platform_device_register(&orion5x_ge00_shared); | ||
204 | platform_device_register(&orion5x_eth); | ||
205 | } | 157 | } |
206 | 158 | ||
207 | 159 | ||
208 | /***************************************************************************** | 160 | /***************************************************************************** |
209 | * Ethernet switch | 161 | * Ethernet switch |
210 | ****************************************************************************/ | 162 | ****************************************************************************/ |
211 | static struct resource orion5x_switch_resources[] = { | ||
212 | { | ||
213 | .start = 0, | ||
214 | .end = 0, | ||
215 | .flags = IORESOURCE_IRQ, | ||
216 | }, | ||
217 | }; | ||
218 | |||
219 | static struct platform_device orion5x_switch_device = { | ||
220 | .name = "dsa", | ||
221 | .id = 0, | ||
222 | .num_resources = 0, | ||
223 | .resource = orion5x_switch_resources, | ||
224 | }; | ||
225 | |||
226 | void __init orion5x_eth_switch_init(struct dsa_platform_data *d, int irq) | 163 | void __init orion5x_eth_switch_init(struct dsa_platform_data *d, int irq) |
227 | { | 164 | { |
228 | int i; | 165 | orion_ge00_switch_init(d, irq); |
229 | |||
230 | if (irq != NO_IRQ) { | ||
231 | orion5x_switch_resources[0].start = irq; | ||
232 | orion5x_switch_resources[0].end = irq; | ||
233 | orion5x_switch_device.num_resources = 1; | ||
234 | } | ||
235 | |||
236 | d->netdev = &orion5x_eth.dev; | ||
237 | for (i = 0; i < d->nr_chips; i++) | ||
238 | d->chip[i].mii_bus = &orion5x_ge00_shared.dev; | ||
239 | orion5x_switch_device.dev.platform_data = d; | ||
240 | |||
241 | platform_device_register(&orion5x_switch_device); | ||
242 | } | 166 | } |
243 | 167 | ||
244 | 168 | ||
@@ -616,7 +540,6 @@ void __init orion5x_init(void) | |||
616 | orion5x_id(&dev, &rev, &dev_name); | 540 | orion5x_id(&dev, &rev, &dev_name); |
617 | printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, orion5x_tclk); | 541 | printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, orion5x_tclk); |
618 | 542 | ||
619 | orion5x_ge00_shared_data.t_clk = orion5x_tclk; | ||
620 | orion5x_spi_plat_data.tclk = orion5x_tclk; | 543 | orion5x_spi_plat_data.tclk = orion5x_tclk; |
621 | 544 | ||
622 | /* | 545 | /* |
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c index d06559123835..15c3f353a9b5 100644 --- a/arch/arm/plat-orion/common.c +++ b/arch/arm/plat-orion/common.c | |||
@@ -11,7 +11,11 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/dma-mapping.h> | ||
14 | #include <linux/serial_8250.h> | 15 | #include <linux/serial_8250.h> |
16 | #include <linux/mbus.h> | ||
17 | #include <linux/mv643xx_eth.h> | ||
18 | #include <net/dsa.h> | ||
15 | 19 | ||
16 | /* Fill in the resources structure and link it into the platform | 20 | /* Fill in the resources structure and link it into the platform |
17 | device structure. There is always a memory region, and nearly | 21 | device structure. There is always a memory region, and nearly |
@@ -187,3 +191,275 @@ void __init orion_rtc_init(unsigned long mapbase, | |||
187 | 191 | ||
188 | platform_device_register_simple("rtc-mv", -1, orion_rtc_resource, 2); | 192 | platform_device_register_simple("rtc-mv", -1, orion_rtc_resource, 2); |
189 | } | 193 | } |
194 | |||
195 | /***************************************************************************** | ||
196 | * GE | ||
197 | ****************************************************************************/ | ||
198 | static __init void ge_complete( | ||
199 | struct mv643xx_eth_shared_platform_data *orion_ge_shared_data, | ||
200 | struct mbus_dram_target_info *mbus_dram_info, int tclk, | ||
201 | struct resource *orion_ge_resource, unsigned long irq, | ||
202 | struct platform_device *orion_ge_shared, | ||
203 | struct mv643xx_eth_platform_data *eth_data, | ||
204 | struct platform_device *orion_ge) | ||
205 | { | ||
206 | orion_ge_shared_data->dram = mbus_dram_info; | ||
207 | orion_ge_shared_data->t_clk = tclk; | ||
208 | orion_ge_resource->start = irq; | ||
209 | orion_ge_resource->end = irq; | ||
210 | eth_data->shared = orion_ge_shared; | ||
211 | orion_ge->dev.platform_data = eth_data; | ||
212 | |||
213 | platform_device_register(orion_ge_shared); | ||
214 | platform_device_register(orion_ge); | ||
215 | } | ||
216 | |||
217 | /***************************************************************************** | ||
218 | * GE00 | ||
219 | ****************************************************************************/ | ||
220 | struct mv643xx_eth_shared_platform_data orion_ge00_shared_data; | ||
221 | |||
222 | static struct resource orion_ge00_shared_resources[] = { | ||
223 | { | ||
224 | .name = "ge00 base", | ||
225 | }, { | ||
226 | .name = "ge00 err irq", | ||
227 | }, | ||
228 | }; | ||
229 | |||
230 | static struct platform_device orion_ge00_shared = { | ||
231 | .name = MV643XX_ETH_SHARED_NAME, | ||
232 | .id = 0, | ||
233 | .dev = { | ||
234 | .platform_data = &orion_ge00_shared_data, | ||
235 | }, | ||
236 | }; | ||
237 | |||
238 | static struct resource orion_ge00_resources[] = { | ||
239 | { | ||
240 | .name = "ge00 irq", | ||
241 | .flags = IORESOURCE_IRQ, | ||
242 | }, | ||
243 | }; | ||
244 | |||
245 | static struct platform_device orion_ge00 = { | ||
246 | .name = MV643XX_ETH_NAME, | ||
247 | .id = 0, | ||
248 | .num_resources = 1, | ||
249 | .resource = orion_ge00_resources, | ||
250 | .dev = { | ||
251 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
252 | }, | ||
253 | }; | ||
254 | |||
255 | void __init orion_ge00_init(struct mv643xx_eth_platform_data *eth_data, | ||
256 | struct mbus_dram_target_info *mbus_dram_info, | ||
257 | unsigned long mapbase, | ||
258 | unsigned long irq, | ||
259 | unsigned long irq_err, | ||
260 | int tclk) | ||
261 | { | ||
262 | fill_resources(&orion_ge00_shared, orion_ge00_shared_resources, | ||
263 | mapbase + 0x2000, SZ_16K - 1, irq_err); | ||
264 | ge_complete(&orion_ge00_shared_data, mbus_dram_info, tclk, | ||
265 | orion_ge00_resources, irq, &orion_ge00_shared, | ||
266 | eth_data, &orion_ge00); | ||
267 | } | ||
268 | |||
269 | /***************************************************************************** | ||
270 | * GE01 | ||
271 | ****************************************************************************/ | ||
272 | struct mv643xx_eth_shared_platform_data orion_ge01_shared_data = { | ||
273 | .shared_smi = &orion_ge00_shared, | ||
274 | }; | ||
275 | |||
276 | static struct resource orion_ge01_shared_resources[] = { | ||
277 | { | ||
278 | .name = "ge01 base", | ||
279 | }, { | ||
280 | .name = "ge01 err irq", | ||
281 | }, | ||
282 | }; | ||
283 | |||
284 | static struct platform_device orion_ge01_shared = { | ||
285 | .name = MV643XX_ETH_SHARED_NAME, | ||
286 | .id = 1, | ||
287 | .dev = { | ||
288 | .platform_data = &orion_ge01_shared_data, | ||
289 | }, | ||
290 | }; | ||
291 | |||
292 | static struct resource orion_ge01_resources[] = { | ||
293 | { | ||
294 | .name = "ge01 irq", | ||
295 | .flags = IORESOURCE_IRQ, | ||
296 | }, | ||
297 | }; | ||
298 | |||
299 | static struct platform_device orion_ge01 = { | ||
300 | .name = MV643XX_ETH_NAME, | ||
301 | .id = 1, | ||
302 | .num_resources = 1, | ||
303 | .resource = orion_ge01_resources, | ||
304 | .dev = { | ||
305 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
306 | }, | ||
307 | }; | ||
308 | |||
309 | void __init orion_ge01_init(struct mv643xx_eth_platform_data *eth_data, | ||
310 | struct mbus_dram_target_info *mbus_dram_info, | ||
311 | unsigned long mapbase, | ||
312 | unsigned long irq, | ||
313 | unsigned long irq_err, | ||
314 | int tclk) | ||
315 | { | ||
316 | fill_resources(&orion_ge01_shared, orion_ge01_shared_resources, | ||
317 | mapbase + 0x2000, SZ_16K - 1, irq_err); | ||
318 | ge_complete(&orion_ge01_shared_data, mbus_dram_info, tclk, | ||
319 | orion_ge01_resources, irq, &orion_ge01_shared, | ||
320 | eth_data, &orion_ge01); | ||
321 | } | ||
322 | |||
323 | /***************************************************************************** | ||
324 | * GE10 | ||
325 | ****************************************************************************/ | ||
326 | struct mv643xx_eth_shared_platform_data orion_ge10_shared_data = { | ||
327 | .shared_smi = &orion_ge00_shared, | ||
328 | }; | ||
329 | |||
330 | static struct resource orion_ge10_shared_resources[] = { | ||
331 | { | ||
332 | .name = "ge10 base", | ||
333 | }, { | ||
334 | .name = "ge10 err irq", | ||
335 | }, | ||
336 | }; | ||
337 | |||
338 | static struct platform_device orion_ge10_shared = { | ||
339 | .name = MV643XX_ETH_SHARED_NAME, | ||
340 | .id = 1, | ||
341 | .dev = { | ||
342 | .platform_data = &orion_ge10_shared_data, | ||
343 | }, | ||
344 | }; | ||
345 | |||
346 | static struct resource orion_ge10_resources[] = { | ||
347 | { | ||
348 | .name = "ge10 irq", | ||
349 | .flags = IORESOURCE_IRQ, | ||
350 | }, | ||
351 | }; | ||
352 | |||
353 | static struct platform_device orion_ge10 = { | ||
354 | .name = MV643XX_ETH_NAME, | ||
355 | .id = 1, | ||
356 | .num_resources = 2, | ||
357 | .resource = orion_ge10_resources, | ||
358 | .dev = { | ||
359 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
360 | }, | ||
361 | }; | ||
362 | |||
363 | void __init orion_ge10_init(struct mv643xx_eth_platform_data *eth_data, | ||
364 | struct mbus_dram_target_info *mbus_dram_info, | ||
365 | unsigned long mapbase, | ||
366 | unsigned long irq, | ||
367 | unsigned long irq_err, | ||
368 | int tclk) | ||
369 | { | ||
370 | fill_resources(&orion_ge10_shared, orion_ge10_shared_resources, | ||
371 | mapbase + 0x2000, SZ_16K - 1, irq_err); | ||
372 | ge_complete(&orion_ge10_shared_data, mbus_dram_info, tclk, | ||
373 | orion_ge10_resources, irq, &orion_ge10_shared, | ||
374 | eth_data, &orion_ge10); | ||
375 | } | ||
376 | |||
377 | /***************************************************************************** | ||
378 | * GE11 | ||
379 | ****************************************************************************/ | ||
380 | struct mv643xx_eth_shared_platform_data orion_ge11_shared_data = { | ||
381 | .shared_smi = &orion_ge00_shared, | ||
382 | }; | ||
383 | |||
384 | static struct resource orion_ge11_shared_resources[] = { | ||
385 | { | ||
386 | .name = "ge11 base", | ||
387 | }, { | ||
388 | .name = "ge11 err irq", | ||
389 | }, | ||
390 | }; | ||
391 | |||
392 | static struct platform_device orion_ge11_shared = { | ||
393 | .name = MV643XX_ETH_SHARED_NAME, | ||
394 | .id = 1, | ||
395 | .dev = { | ||
396 | .platform_data = &orion_ge11_shared_data, | ||
397 | }, | ||
398 | }; | ||
399 | |||
400 | static struct resource orion_ge11_resources[] = { | ||
401 | { | ||
402 | .name = "ge11 irq", | ||
403 | .flags = IORESOURCE_IRQ, | ||
404 | }, | ||
405 | }; | ||
406 | |||
407 | static struct platform_device orion_ge11 = { | ||
408 | .name = MV643XX_ETH_NAME, | ||
409 | .id = 1, | ||
410 | .num_resources = 2, | ||
411 | .resource = orion_ge11_resources, | ||
412 | .dev = { | ||
413 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
414 | }, | ||
415 | }; | ||
416 | |||
417 | void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data, | ||
418 | struct mbus_dram_target_info *mbus_dram_info, | ||
419 | unsigned long mapbase, | ||
420 | unsigned long irq, | ||
421 | unsigned long irq_err, | ||
422 | int tclk) | ||
423 | { | ||
424 | fill_resources(&orion_ge11_shared, orion_ge11_shared_resources, | ||
425 | mapbase + 0x2000, SZ_16K - 1, irq_err); | ||
426 | ge_complete(&orion_ge11_shared_data, mbus_dram_info, tclk, | ||
427 | orion_ge11_resources, irq, &orion_ge11_shared, | ||
428 | eth_data, &orion_ge11); | ||
429 | } | ||
430 | |||
431 | /***************************************************************************** | ||
432 | * Ethernet switch | ||
433 | ****************************************************************************/ | ||
434 | static struct resource orion_switch_resources[] = { | ||
435 | { | ||
436 | .start = 0, | ||
437 | .end = 0, | ||
438 | .flags = IORESOURCE_IRQ, | ||
439 | }, | ||
440 | }; | ||
441 | |||
442 | static struct platform_device orion_switch_device = { | ||
443 | .name = "dsa", | ||
444 | .id = 0, | ||
445 | .num_resources = 0, | ||
446 | .resource = orion_switch_resources, | ||
447 | }; | ||
448 | |||
449 | void __init orion_ge00_switch_init(struct dsa_platform_data *d, int irq) | ||
450 | { | ||
451 | int i; | ||
452 | |||
453 | if (irq != NO_IRQ) { | ||
454 | orion_switch_resources[0].start = irq; | ||
455 | orion_switch_resources[0].end = irq; | ||
456 | orion_switch_device.num_resources = 1; | ||
457 | } | ||
458 | |||
459 | d->netdev = &orion_ge00.dev; | ||
460 | for (i = 0; i < d->nr_chips; i++) | ||
461 | d->chip[i].mii_bus = &orion_ge00_shared.dev; | ||
462 | orion_switch_device.dev.platform_data = d; | ||
463 | |||
464 | platform_device_register(&orion_switch_device); | ||
465 | } | ||
diff --git a/arch/arm/plat-orion/include/plat/common.h b/arch/arm/plat-orion/include/plat/common.h index 016b95e87f3d..3f23258daa61 100644 --- a/arch/arm/plat-orion/include/plat/common.h +++ b/arch/arm/plat-orion/include/plat/common.h | |||
@@ -9,7 +9,9 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #ifndef __PLAT_COMMON_H | 11 | #ifndef __PLAT_COMMON_H |
12 | #include <linux/mv643xx_eth.h> | ||
12 | 13 | ||
14 | struct dsa_platform_data; | ||
13 | 15 | ||
14 | void __init orion_uart0_init(unsigned int membase, | 16 | void __init orion_uart0_init(unsigned int membase, |
15 | resource_size_t mapbase, | 17 | resource_size_t mapbase, |
@@ -33,4 +35,36 @@ void __init orion_uart3_init(unsigned int membase, | |||
33 | 35 | ||
34 | void __init orion_rtc_init(unsigned long mapbase, | 36 | void __init orion_rtc_init(unsigned long mapbase, |
35 | unsigned long irq); | 37 | unsigned long irq); |
38 | |||
39 | void __init orion_ge00_init(struct mv643xx_eth_platform_data *eth_data, | ||
40 | struct mbus_dram_target_info *mbus_dram_info, | ||
41 | unsigned long mapbase, | ||
42 | unsigned long irq, | ||
43 | unsigned long irq_err, | ||
44 | int tclk); | ||
45 | |||
46 | void __init orion_ge01_init(struct mv643xx_eth_platform_data *eth_data, | ||
47 | struct mbus_dram_target_info *mbus_dram_info, | ||
48 | unsigned long mapbase, | ||
49 | unsigned long irq, | ||
50 | unsigned long irq_err, | ||
51 | int tclk); | ||
52 | |||
53 | void __init orion_ge10_init(struct mv643xx_eth_platform_data *eth_data, | ||
54 | struct mbus_dram_target_info *mbus_dram_info, | ||
55 | unsigned long mapbase, | ||
56 | unsigned long irq, | ||
57 | unsigned long irq_err, | ||
58 | int tclk); | ||
59 | |||
60 | void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data, | ||
61 | struct mbus_dram_target_info *mbus_dram_info, | ||
62 | unsigned long mapbase, | ||
63 | unsigned long irq, | ||
64 | unsigned long irq_err, | ||
65 | int tclk); | ||
66 | |||
67 | void __init orion_ge00_switch_init(struct dsa_platform_data *d, | ||
68 | int irq); | ||
69 | |||
36 | #endif | 70 | #endif |