aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/momentum
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2006-11-03 12:45:25 -0500
committerRalf Baechle <ralf@linux-mips.org>2006-11-06 15:55:35 -0500
commit9c422e2ad6a1d8bd03e2e9d49e5c63b82165d596 (patch)
treef65ad96c4ba9c4c0f68176444083289dd4ab608b /arch/mips/momentum
parentcca72333e71e348995859b88628c1abcb58b759e (diff)
[MIPS] Ocelot C: fix eth registration after conversion to platform_device
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/momentum')
-rw-r--r--arch/mips/momentum/ocelot_c/setup.c124
1 files changed, 121 insertions, 3 deletions
diff --git a/arch/mips/momentum/ocelot_c/setup.c b/arch/mips/momentum/ocelot_c/setup.c
index 9c0c462af650..0a3ffa33771d 100644
--- a/arch/mips/momentum/ocelot_c/setup.c
+++ b/arch/mips/momentum/ocelot_c/setup.c
@@ -50,6 +50,7 @@
50#include <linux/sched.h> 50#include <linux/sched.h>
51#include <linux/interrupt.h> 51#include <linux/interrupt.h>
52#include <linux/pci.h> 52#include <linux/pci.h>
53#include <linux/platform_device.h>
53#include <linux/pm.h> 54#include <linux/pm.h>
54#include <linux/timex.h> 55#include <linux/timex.h>
55#include <linux/vmalloc.h> 56#include <linux/vmalloc.h>
@@ -69,7 +70,6 @@
69#include "ocelot_c_fpga.h" 70#include "ocelot_c_fpga.h"
70 71
71unsigned long marvell_base; 72unsigned long marvell_base;
72extern unsigned long mv64340_sram_base;
73unsigned long cpu_clock; 73unsigned long cpu_clock;
74 74
75/* These functions are used for rebooting or halting the machine*/ 75/* These functions are used for rebooting or halting the machine*/
@@ -119,7 +119,6 @@ void PMON_v2_setup(void)
119 add_wired_entry(ENTRYLO(0xfe000000), ENTRYLO(0xff000000), 0xfffffffffe000000, PM_16M); 119 add_wired_entry(ENTRYLO(0xfe000000), ENTRYLO(0xff000000), 0xfffffffffe000000, PM_16M);
120 120
121 marvell_base = 0xfffffffff4000000; 121 marvell_base = 0xfffffffff4000000;
122 mv64340_sram_base = 0xfffffffffe000000;
123#else 122#else
124 /* marvell and extra space */ 123 /* marvell and extra space */
125 add_wired_entry(ENTRYLO(0xf4000000), ENTRYLO(0xf4010000), 0xf4000000, PM_64K); 124 add_wired_entry(ENTRYLO(0xf4000000), ENTRYLO(0xf4010000), 0xf4000000, PM_64K);
@@ -129,7 +128,6 @@ void PMON_v2_setup(void)
129 add_wired_entry(ENTRYLO(0xfe000000), ENTRYLO(0xff000000), 0xfe000000, PM_16M); 128 add_wired_entry(ENTRYLO(0xfe000000), ENTRYLO(0xff000000), 0xfe000000, PM_16M);
130 129
131 marvell_base = 0xf4000000; 130 marvell_base = 0xf4000000;
132 mv64340_sram_base = 0xfe000000;
133#endif 131#endif
134} 132}
135 133
@@ -365,3 +363,123 @@ static int io_base_ioremap(void)
365 363
366module_init(io_base_ioremap); 364module_init(io_base_ioremap);
367#endif 365#endif
366
367#if defined(CONFIG_MV643XX_ETH) || defined(CONFIG_MV643XX_ETH_MODULE)
368
369static struct resource mv643xx_eth_shared_resources[] = {
370 [0] = {
371 .name = "ethernet shared base",
372 .start = 0xf1000000 + MV643XX_ETH_SHARED_REGS,
373 .end = 0xf1000000 + MV643XX_ETH_SHARED_REGS +
374 MV643XX_ETH_SHARED_REGS_SIZE - 1,
375 .flags = IORESOURCE_MEM,
376 },
377};
378
379static struct platform_device mv643xx_eth_shared_device = {
380 .name = MV643XX_ETH_SHARED_NAME,
381 .id = 0,
382 .num_resources = ARRAY_SIZE(mv643xx_eth_shared_resources),
383 .resource = mv643xx_eth_shared_resources,
384};
385
386#define MV_SRAM_BASE 0xfe000000UL
387#define MV_SRAM_SIZE (256 * 1024)
388
389#define MV_SRAM_RXRING_SIZE (MV_SRAM_SIZE / 4)
390#define MV_SRAM_TXRING_SIZE (MV_SRAM_SIZE / 4)
391
392#define MV_SRAM_BASE_ETH0 MV_SRAM_BASE
393#define MV_SRAM_BASE_ETH1 (MV_SRAM_BASE + (MV_SRAM_SIZE / 2))
394
395#define MV64x60_IRQ_ETH_0 48
396#define MV64x60_IRQ_ETH_1 49
397
398#ifdef CONFIG_MV643XX_ETH_0
399
400static struct resource mv64x60_eth0_resources[] = {
401 [0] = {
402 .name = "eth0 irq",
403 .start = MV64x60_IRQ_ETH_0,
404 .end = MV64x60_IRQ_ETH_0,
405 .flags = IORESOURCE_IRQ,
406 },
407};
408
409static struct mv643xx_eth_platform_data eth0_pd = {
410 .tx_sram_addr = MV_SRAM_BASE_ETH0,
411 .tx_sram_size = MV_SRAM_TXRING_SIZE,
412 .tx_queue_size = MV_SRAM_TXRING_SIZE / 16,
413
414 .rx_sram_addr = MV_SRAM_BASE_ETH0 + MV_SRAM_TXRING_SIZE,
415 .rx_sram_size = MV_SRAM_RXRING_SIZE,
416 .rx_queue_size = MV_SRAM_RXRING_SIZE / 16,
417};
418
419static struct platform_device eth0_device = {
420 .name = MV643XX_ETH_NAME,
421 .id = 0,
422 .num_resources = ARRAY_SIZE(mv64x60_eth0_resources),
423 .resource = mv64x60_eth0_resources,
424 .dev = {
425 .platform_data = &eth0_pd,
426 },
427};
428#endif /* CONFIG_MV643XX_ETH_0 */
429
430#ifdef CONFIG_MV643XX_ETH_1
431
432static struct resource mv64x60_eth1_resources[] = {
433 [0] = {
434 .name = "eth1 irq",
435 .start = MV64x60_IRQ_ETH_1,
436 .end = MV64x60_IRQ_ETH_1,
437 .flags = IORESOURCE_IRQ,
438 },
439};
440
441static struct mv643xx_eth_platform_data eth1_pd = {
442 .tx_sram_addr = MV_SRAM_BASE_ETH1,
443 .tx_sram_size = MV_SRAM_TXRING_SIZE,
444 .tx_queue_size = MV_SRAM_TXRING_SIZE / 16,
445
446 .rx_sram_addr = MV_SRAM_BASE_ETH1 + MV_SRAM_TXRING_SIZE,
447 .rx_sram_size = MV_SRAM_RXRING_SIZE,
448 .rx_queue_size = MV_SRAM_RXRING_SIZE / 16,
449};
450
451static struct platform_device eth1_device = {
452 .name = MV643XX_ETH_NAME,
453 .id = 1,
454 .num_resources = ARRAY_SIZE(mv64x60_eth1_resources),
455 .resource = mv64x60_eth1_resources,
456 .dev = {
457 .platform_data = &eth1_pd,
458 },
459};
460#endif /* CONFIG_MV643XX_ETH_1 */
461
462static struct platform_device *mv643xx_eth_pd_devs[] __initdata = {
463 &mv643xx_eth_shared_device,
464#ifdef CONFIG_MV643XX_ETH_0
465 &eth0_device,
466#endif
467#ifdef CONFIG_MV643XX_ETH_1
468 &eth1_device,
469#endif
470 /* The third port is not wired up on the Ocelot C */
471};
472
473int mv643xx_eth_add_pds(void)
474{
475 int ret;
476
477 ret = platform_add_devices(mv643xx_eth_pd_devs,
478 ARRAY_SIZE(mv643xx_eth_pd_devs));
479
480 return ret;
481}
482
483device_initcall(mv643xx_eth_add_pds);
484
485#endif /* defined(CONFIG_MV643XX_ETH) || defined(CONFIG_MV643XX_ETH_MODULE) */