aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-orion
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2011-05-15 07:32:44 -0400
committerNicolas Pitre <nico@fluxnic.net>2011-05-16 15:06:01 -0400
commit7e3819d820c9aa3536d15fe7310c054bef1f5f04 (patch)
treea65cf874aceae43813e5c03f587e8f5bfaaf32ad /arch/arm/plat-orion
parent4748058c5cbf70b3adfa37204c047fcb29f335c0 (diff)
ARM: orion: Consolidate ethernet platform data
Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Diffstat (limited to 'arch/arm/plat-orion')
-rw-r--r--arch/arm/plat-orion/common.c276
-rw-r--r--arch/arm/plat-orion/include/plat/common.h34
2 files changed, 310 insertions, 0 deletions
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 ****************************************************************************/
198static __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 ****************************************************************************/
220struct mv643xx_eth_shared_platform_data orion_ge00_shared_data;
221
222static struct resource orion_ge00_shared_resources[] = {
223 {
224 .name = "ge00 base",
225 }, {
226 .name = "ge00 err irq",
227 },
228};
229
230static 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
238static struct resource orion_ge00_resources[] = {
239 {
240 .name = "ge00 irq",
241 .flags = IORESOURCE_IRQ,
242 },
243};
244
245static 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
255void __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 ****************************************************************************/
272struct mv643xx_eth_shared_platform_data orion_ge01_shared_data = {
273 .shared_smi = &orion_ge00_shared,
274};
275
276static struct resource orion_ge01_shared_resources[] = {
277 {
278 .name = "ge01 base",
279 }, {
280 .name = "ge01 err irq",
281 },
282};
283
284static 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
292static struct resource orion_ge01_resources[] = {
293 {
294 .name = "ge01 irq",
295 .flags = IORESOURCE_IRQ,
296 },
297};
298
299static 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
309void __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 ****************************************************************************/
326struct mv643xx_eth_shared_platform_data orion_ge10_shared_data = {
327 .shared_smi = &orion_ge00_shared,
328};
329
330static struct resource orion_ge10_shared_resources[] = {
331 {
332 .name = "ge10 base",
333 }, {
334 .name = "ge10 err irq",
335 },
336};
337
338static 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
346static struct resource orion_ge10_resources[] = {
347 {
348 .name = "ge10 irq",
349 .flags = IORESOURCE_IRQ,
350 },
351};
352
353static 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
363void __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 ****************************************************************************/
380struct mv643xx_eth_shared_platform_data orion_ge11_shared_data = {
381 .shared_smi = &orion_ge00_shared,
382};
383
384static struct resource orion_ge11_shared_resources[] = {
385 {
386 .name = "ge11 base",
387 }, {
388 .name = "ge11 err irq",
389 },
390};
391
392static 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
400static struct resource orion_ge11_resources[] = {
401 {
402 .name = "ge11 irq",
403 .flags = IORESOURCE_IRQ,
404 },
405};
406
407static 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
417void __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 ****************************************************************************/
434static struct resource orion_switch_resources[] = {
435 {
436 .start = 0,
437 .end = 0,
438 .flags = IORESOURCE_IRQ,
439 },
440};
441
442static struct platform_device orion_switch_device = {
443 .name = "dsa",
444 .id = 0,
445 .num_resources = 0,
446 .resource = orion_switch_resources,
447};
448
449void __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
14struct dsa_platform_data;
13 15
14void __init orion_uart0_init(unsigned int membase, 16void __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
34void __init orion_rtc_init(unsigned long mapbase, 36void __init orion_rtc_init(unsigned long mapbase,
35 unsigned long irq); 37 unsigned long irq);
38
39void __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
46void __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
53void __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
60void __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
67void __init orion_ge00_switch_init(struct dsa_platform_data *d,
68 int irq);
69
36#endif 70#endif