aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHartley Sweeten <hartleys@visionengravers.com>2008-10-04 15:01:49 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-10-04 15:04:35 -0400
commita0a08fdca534e1dffc6d8bb239f53177ab06f946 (patch)
treec8caa1b1f349a3619131016dbaccb7ee356f2e34
parent92e88aa7fb8190031dca9e04acbf4821bd77941b (diff)
[ARM] 5273/2: ep93xx: move ethernet support into core.c
All EP93xx based systems can support Ethernet. This patch moves the platform_device setup from the various board support files into the core support file. The Ethernet driver data still remains in the individual platform setup files to allow specific platform configuration. This also adds Ethernet support to the edb9302, edb9312, and edb9315 platforms. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mach-ep93xx/adssphere.c26
-rw-r--r--arch/arm/mach-ep93xx/core.c35
-rw-r--r--arch/arm/mach-ep93xx/edb9302.c6
-rw-r--r--arch/arm/mach-ep93xx/edb9302a.c26
-rw-r--r--arch/arm/mach-ep93xx/edb9307.c26
-rw-r--r--arch/arm/mach-ep93xx/edb9312.c6
-rw-r--r--arch/arm/mach-ep93xx/edb9315.c6
-rw-r--r--arch/arm/mach-ep93xx/edb9315a.c26
-rw-r--r--arch/arm/mach-ep93xx/gesbc9312.c27
-rw-r--r--arch/arm/mach-ep93xx/include/mach/platform.h12
-rw-r--r--arch/arm/mach-ep93xx/micro9.c31
-rw-r--r--arch/arm/mach-ep93xx/ts72xx.c26
12 files changed, 68 insertions, 185 deletions
diff --git a/arch/arm/mach-ep93xx/adssphere.c b/arch/arm/mach-ep93xx/adssphere.c
index aa1fb352fb8f..8e3bbb5299e9 100644
--- a/arch/arm/mach-ep93xx/adssphere.c
+++ b/arch/arm/mach-ep93xx/adssphere.c
@@ -47,36 +47,12 @@ static struct ep93xx_eth_data adssphere_eth_data = {
47 .phy_id = 1, 47 .phy_id = 1,
48}; 48};
49 49
50static struct resource adssphere_eth_resource[] = {
51 {
52 .start = EP93XX_ETHERNET_PHYS_BASE,
53 .end = EP93XX_ETHERNET_PHYS_BASE + 0xffff,
54 .flags = IORESOURCE_MEM,
55 }, {
56 .start = IRQ_EP93XX_ETHERNET,
57 .end = IRQ_EP93XX_ETHERNET,
58 .flags = IORESOURCE_IRQ,
59 }
60};
61
62static struct platform_device adssphere_eth_device = {
63 .name = "ep93xx-eth",
64 .id = -1,
65 .dev = {
66 .platform_data = &adssphere_eth_data,
67 },
68 .num_resources = 2,
69 .resource = adssphere_eth_resource,
70};
71
72static void __init adssphere_init_machine(void) 50static void __init adssphere_init_machine(void)
73{ 51{
74 ep93xx_init_devices(); 52 ep93xx_init_devices();
75 platform_device_register(&adssphere_flash); 53 platform_device_register(&adssphere_flash);
76 54
77 memcpy(adssphere_eth_data.dev_addr, 55 ep93xx_register_eth(&adssphere_eth_data, 1);
78 (void *)(EP93XX_ETHERNET_BASE + 0x50), 6);
79 platform_device_register(&adssphere_eth_device);
80} 56}
81 57
82MACHINE_START(ADSSPHERE, "ADS Sphere board") 58MACHINE_START(ADSSPHERE, "ADS Sphere board")
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index d6967dedce52..52ee8aa046c4 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -461,6 +461,41 @@ static struct platform_device ep93xx_ohci_device = {
461 .resource = ep93xx_ohci_resources, 461 .resource = ep93xx_ohci_resources,
462}; 462};
463 463
464static struct ep93xx_eth_data ep93xx_eth_data;
465
466static struct resource ep93xx_eth_resource[] = {
467 {
468 .start = EP93XX_ETHERNET_PHYS_BASE,
469 .end = EP93XX_ETHERNET_PHYS_BASE + 0xffff,
470 .flags = IORESOURCE_MEM,
471 }, {
472 .start = IRQ_EP93XX_ETHERNET,
473 .end = IRQ_EP93XX_ETHERNET,
474 .flags = IORESOURCE_IRQ,
475 }
476};
477
478static struct platform_device ep93xx_eth_device = {
479 .name = "ep93xx-eth",
480 .id = -1,
481 .dev = {
482 .platform_data = &ep93xx_eth_data,
483 },
484 .num_resources = ARRAY_SIZE(ep93xx_eth_resource),
485 .resource = ep93xx_eth_resource,
486};
487
488void __init ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr)
489{
490 if (copy_addr) {
491 memcpy(data->dev_addr,
492 (void *)(EP93XX_ETHERNET_BASE + 0x50), 6);
493 }
494
495 ep93xx_eth_data = *data;
496 platform_device_register(&ep93xx_eth_device);
497}
498
464extern void ep93xx_gpio_init(void); 499extern void ep93xx_gpio_init(void);
465 500
466void __init ep93xx_init_devices(void) 501void __init ep93xx_init_devices(void)
diff --git a/arch/arm/mach-ep93xx/edb9302.c b/arch/arm/mach-ep93xx/edb9302.c
index 97550c0ad7b0..899784f3b7b8 100644
--- a/arch/arm/mach-ep93xx/edb9302.c
+++ b/arch/arm/mach-ep93xx/edb9302.c
@@ -43,10 +43,16 @@ static struct platform_device edb9302_flash = {
43 .resource = &edb9302_flash_resource, 43 .resource = &edb9302_flash_resource,
44}; 44};
45 45
46static struct ep93xx_eth_data edb9302_eth_data = {
47 .phy_id = 1,
48};
49
46static void __init edb9302_init_machine(void) 50static void __init edb9302_init_machine(void)
47{ 51{
48 ep93xx_init_devices(); 52 ep93xx_init_devices();
49 platform_device_register(&edb9302_flash); 53 platform_device_register(&edb9302_flash);
54
55 ep93xx_register_eth(&edb9302_eth_data, 1);
50} 56}
51 57
52MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board") 58MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board")
diff --git a/arch/arm/mach-ep93xx/edb9302a.c b/arch/arm/mach-ep93xx/edb9302a.c
index 99b01d44bf1c..ea7e4eb0cc2d 100644
--- a/arch/arm/mach-ep93xx/edb9302a.c
+++ b/arch/arm/mach-ep93xx/edb9302a.c
@@ -47,36 +47,12 @@ static struct ep93xx_eth_data edb9302a_eth_data = {
47 .phy_id = 1, 47 .phy_id = 1,
48}; 48};
49 49
50static struct resource edb9302a_eth_resource[] = {
51 {
52 .start = EP93XX_ETHERNET_PHYS_BASE,
53 .end = EP93XX_ETHERNET_PHYS_BASE + 0xffff,
54 .flags = IORESOURCE_MEM,
55 }, {
56 .start = IRQ_EP93XX_ETHERNET,
57 .end = IRQ_EP93XX_ETHERNET,
58 .flags = IORESOURCE_IRQ,
59 }
60};
61
62static struct platform_device edb9302a_eth_device = {
63 .name = "ep93xx-eth",
64 .id = -1,
65 .dev = {
66 .platform_data = &edb9302a_eth_data,
67 },
68 .num_resources = 2,
69 .resource = edb9302a_eth_resource,
70};
71
72static void __init edb9302a_init_machine(void) 50static void __init edb9302a_init_machine(void)
73{ 51{
74 ep93xx_init_devices(); 52 ep93xx_init_devices();
75 platform_device_register(&edb9302a_flash); 53 platform_device_register(&edb9302a_flash);
76 54
77 memcpy(edb9302a_eth_data.dev_addr, 55 ep93xx_register_eth(&edb9302a_eth_data, 1);
78 (void *)(EP93XX_ETHERNET_BASE + 0x50), 6);
79 platform_device_register(&edb9302a_eth_device);
80} 56}
81 57
82MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board") 58MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board")
diff --git a/arch/arm/mach-ep93xx/edb9307.c b/arch/arm/mach-ep93xx/edb9307.c
index 9fb72d01a36c..7dee28e9d7f9 100644
--- a/arch/arm/mach-ep93xx/edb9307.c
+++ b/arch/arm/mach-ep93xx/edb9307.c
@@ -47,36 +47,12 @@ static struct ep93xx_eth_data edb9307_eth_data = {
47 .phy_id = 1, 47 .phy_id = 1,
48}; 48};
49 49
50static struct resource edb9307_eth_resource[] = {
51 {
52 .start = EP93XX_ETHERNET_PHYS_BASE,
53 .end = EP93XX_ETHERNET_PHYS_BASE + 0xffff,
54 .flags = IORESOURCE_MEM,
55 }, {
56 .start = IRQ_EP93XX_ETHERNET,
57 .end = IRQ_EP93XX_ETHERNET,
58 .flags = IORESOURCE_IRQ,
59 }
60};
61
62static struct platform_device edb9307_eth_device = {
63 .name = "ep93xx-eth",
64 .id = -1,
65 .dev = {
66 .platform_data = &edb9307_eth_data,
67 },
68 .num_resources = 2,
69 .resource = edb9307_eth_resource,
70};
71
72static void __init edb9307_init_machine(void) 50static void __init edb9307_init_machine(void)
73{ 51{
74 ep93xx_init_devices(); 52 ep93xx_init_devices();
75 platform_device_register(&edb9307_flash); 53 platform_device_register(&edb9307_flash);
76 54
77 memcpy(edb9307_eth_data.dev_addr, 55 ep93xx_register_eth(&edb9307_eth_data, 1);
78 (void *)(EP93XX_ETHERNET_BASE + 0x50), 6);
79 platform_device_register(&edb9307_eth_device);
80} 56}
81 57
82MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board") 58MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board")
diff --git a/arch/arm/mach-ep93xx/edb9312.c b/arch/arm/mach-ep93xx/edb9312.c
index 87267a574f5e..3f660d1fc966 100644
--- a/arch/arm/mach-ep93xx/edb9312.c
+++ b/arch/arm/mach-ep93xx/edb9312.c
@@ -44,10 +44,16 @@ static struct platform_device edb9312_flash = {
44 .resource = &edb9312_flash_resource, 44 .resource = &edb9312_flash_resource,
45}; 45};
46 46
47static struct ep93xx_eth_data edb9312_eth_data = {
48 .phy_id = 1,
49};
50
47static void __init edb9312_init_machine(void) 51static void __init edb9312_init_machine(void)
48{ 52{
49 ep93xx_init_devices(); 53 ep93xx_init_devices();
50 platform_device_register(&edb9312_flash); 54 platform_device_register(&edb9312_flash);
55
56 ep93xx_register_eth(&edb9312_eth_data, 1);
51} 57}
52 58
53MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board") 59MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board")
diff --git a/arch/arm/mach-ep93xx/edb9315.c b/arch/arm/mach-ep93xx/edb9315.c
index 7e373950be4d..a1e76c329daa 100644
--- a/arch/arm/mach-ep93xx/edb9315.c
+++ b/arch/arm/mach-ep93xx/edb9315.c
@@ -43,10 +43,16 @@ static struct platform_device edb9315_flash = {
43 .resource = &edb9315_flash_resource, 43 .resource = &edb9315_flash_resource,
44}; 44};
45 45
46static struct ep93xx_eth_data edb9315_eth_data = {
47 .phy_id = 1,
48};
49
46static void __init edb9315_init_machine(void) 50static void __init edb9315_init_machine(void)
47{ 51{
48 ep93xx_init_devices(); 52 ep93xx_init_devices();
49 platform_device_register(&edb9315_flash); 53 platform_device_register(&edb9315_flash);
54
55 ep93xx_register_eth(&edb9315_eth_data, 1);
50} 56}
51 57
52MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board") 58MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board")
diff --git a/arch/arm/mach-ep93xx/edb9315a.c b/arch/arm/mach-ep93xx/edb9315a.c
index 08a7c9bfb689..cbd77bf18aaf 100644
--- a/arch/arm/mach-ep93xx/edb9315a.c
+++ b/arch/arm/mach-ep93xx/edb9315a.c
@@ -47,36 +47,12 @@ static struct ep93xx_eth_data edb9315a_eth_data = {
47 .phy_id = 1, 47 .phy_id = 1,
48}; 48};
49 49
50static struct resource edb9315a_eth_resource[] = {
51 {
52 .start = EP93XX_ETHERNET_PHYS_BASE,
53 .end = EP93XX_ETHERNET_PHYS_BASE + 0xffff,
54 .flags = IORESOURCE_MEM,
55 }, {
56 .start = IRQ_EP93XX_ETHERNET,
57 .end = IRQ_EP93XX_ETHERNET,
58 .flags = IORESOURCE_IRQ,
59 }
60};
61
62static struct platform_device edb9315a_eth_device = {
63 .name = "ep93xx-eth",
64 .id = -1,
65 .dev = {
66 .platform_data = &edb9315a_eth_data,
67 },
68 .num_resources = 2,
69 .resource = edb9315a_eth_resource,
70};
71
72static void __init edb9315a_init_machine(void) 50static void __init edb9315a_init_machine(void)
73{ 51{
74 ep93xx_init_devices(); 52 ep93xx_init_devices();
75 platform_device_register(&edb9315a_flash); 53 platform_device_register(&edb9315a_flash);
76 54
77 memcpy(edb9315a_eth_data.dev_addr, 55 ep93xx_register_eth(&edb9315a_eth_data, 1);
78 (void *)(EP93XX_ETHERNET_BASE + 0x50), 6);
79 platform_device_register(&edb9315a_eth_device);
80} 56}
81 57
82MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board") 58MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board")
diff --git a/arch/arm/mach-ep93xx/gesbc9312.c b/arch/arm/mach-ep93xx/gesbc9312.c
index 9b41ec1f089e..8a67e53cba61 100644
--- a/arch/arm/mach-ep93xx/gesbc9312.c
+++ b/arch/arm/mach-ep93xx/gesbc9312.c
@@ -44,36 +44,15 @@ static struct platform_device gesbc9312_flash = {
44}; 44};
45 45
46static struct ep93xx_eth_data gesbc9312_eth_data = { 46static struct ep93xx_eth_data gesbc9312_eth_data = {
47 .phy_id = 1, 47 .phy_id = 1,
48};
49
50static struct resource gesbc9312_eth_resource[] = {
51 {
52 .start = EP93XX_ETHERNET_PHYS_BASE,
53 .end = EP93XX_ETHERNET_PHYS_BASE + 0xffff,
54 .flags = IORESOURCE_MEM,
55 }, {
56 .start = IRQ_EP93XX_ETHERNET,
57 .end = IRQ_EP93XX_ETHERNET,
58 .flags = IORESOURCE_IRQ,
59 }
60};
61
62static struct platform_device gesbc9312_eth_device = {
63 .name = "ep93xx-eth",
64 .id = -1,
65 .dev = {
66 .platform_data = &gesbc9312_eth_data,
67 },
68 .num_resources = 2,
69 .resource = gesbc9312_eth_resource,
70}; 48};
71 49
72static void __init gesbc9312_init_machine(void) 50static void __init gesbc9312_init_machine(void)
73{ 51{
74 ep93xx_init_devices(); 52 ep93xx_init_devices();
75 platform_device_register(&gesbc9312_flash); 53 platform_device_register(&gesbc9312_flash);
76 platform_device_register(&gesbc9312_eth_device); 54
55 ep93xx_register_eth(&gesbc9312_eth_data, 0);
77} 56}
78 57
79MACHINE_START(GESBC9312, "Glomation GESBC-9312-sx") 58MACHINE_START(GESBC9312, "Glomation GESBC-9312-sx")
diff --git a/arch/arm/mach-ep93xx/include/mach/platform.h b/arch/arm/mach-ep93xx/include/mach/platform.h
index b5c182473f5d..db2489d3bda7 100644
--- a/arch/arm/mach-ep93xx/include/mach/platform.h
+++ b/arch/arm/mach-ep93xx/include/mach/platform.h
@@ -4,17 +4,17 @@
4 4
5#ifndef __ASSEMBLY__ 5#ifndef __ASSEMBLY__
6 6
7void ep93xx_map_io(void);
8void ep93xx_init_irq(void);
9void ep93xx_init_time(unsigned long);
10void ep93xx_init_devices(void);
11extern struct sys_timer ep93xx_timer;
12
13struct ep93xx_eth_data 7struct ep93xx_eth_data
14{ 8{
15 unsigned char dev_addr[6]; 9 unsigned char dev_addr[6];
16 unsigned char phy_id; 10 unsigned char phy_id;
17}; 11};
18 12
13void ep93xx_map_io(void);
14void ep93xx_init_irq(void);
15void ep93xx_init_time(unsigned long);
16void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr);
17void ep93xx_init_devices(void);
18extern struct sys_timer ep93xx_timer;
19 19
20#endif 20#endif
diff --git a/arch/arm/mach-ep93xx/micro9.c b/arch/arm/mach-ep93xx/micro9.c
index de047a5c8112..72c8d44f4ddb 100644
--- a/arch/arm/mach-ep93xx/micro9.c
+++ b/arch/arm/mach-ep93xx/micro9.c
@@ -29,38 +29,9 @@ static struct ep93xx_eth_data micro9_eth_data = {
29 .phy_id = 0x1f, 29 .phy_id = 0x1f,
30}; 30};
31 31
32static struct resource micro9_eth_resource[] = {
33 {
34 .start = EP93XX_ETHERNET_PHYS_BASE,
35 .end = EP93XX_ETHERNET_PHYS_BASE + 0xffff,
36 .flags = IORESOURCE_MEM,
37 }, {
38 .start = IRQ_EP93XX_ETHERNET,
39 .end = IRQ_EP93XX_ETHERNET,
40 .flags = IORESOURCE_IRQ,
41 }
42};
43
44static struct platform_device micro9_eth_device = {
45 .name = "ep93xx-eth",
46 .id = -1,
47 .dev = {
48 .platform_data = &micro9_eth_data,
49 },
50 .num_resources = ARRAY_SIZE(micro9_eth_resource),
51 .resource = micro9_eth_resource,
52};
53
54static void __init micro9_eth_init(void)
55{
56 memcpy(micro9_eth_data.dev_addr,
57 (void *)(EP93XX_ETHERNET_BASE + 0x50), 6);
58 platform_device_register(&micro9_eth_device);
59}
60
61static void __init micro9_init(void) 32static void __init micro9_init(void)
62{ 33{
63 micro9_eth_init(); 34 ep93xx_register_eth(&micro9_eth_data, 1);
64} 35}
65 36
66/* 37/*
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index c3cbff126d0c..61e7d664fd22 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -161,28 +161,6 @@ static struct ep93xx_eth_data ts72xx_eth_data = {
161 .phy_id = 1, 161 .phy_id = 1,
162}; 162};
163 163
164static struct resource ts72xx_eth_resource[] = {
165 {
166 .start = EP93XX_ETHERNET_PHYS_BASE,
167 .end = EP93XX_ETHERNET_PHYS_BASE + 0xffff,
168 .flags = IORESOURCE_MEM,
169 }, {
170 .start = IRQ_EP93XX_ETHERNET,
171 .end = IRQ_EP93XX_ETHERNET,
172 .flags = IORESOURCE_IRQ,
173 }
174};
175
176static struct platform_device ts72xx_eth_device = {
177 .name = "ep93xx-eth",
178 .id = -1,
179 .dev = {
180 .platform_data = &ts72xx_eth_data,
181 },
182 .num_resources = 2,
183 .resource = ts72xx_eth_resource,
184};
185
186static void __init ts72xx_init_machine(void) 164static void __init ts72xx_init_machine(void)
187{ 165{
188 ep93xx_init_devices(); 166 ep93xx_init_devices();
@@ -190,9 +168,7 @@ static void __init ts72xx_init_machine(void)
190 platform_device_register(&ts72xx_flash); 168 platform_device_register(&ts72xx_flash);
191 platform_device_register(&ts72xx_rtc_device); 169 platform_device_register(&ts72xx_rtc_device);
192 170
193 memcpy(ts72xx_eth_data.dev_addr, 171 ep93xx_register_eth(&ts72xx_eth_data, 1);
194 (void *)(EP93XX_ETHERNET_BASE + 0x50), 6);
195 platform_device_register(&ts72xx_eth_device);
196} 172}
197 173
198MACHINE_START(TS72XX, "Technologic Systems TS-72xx SBC") 174MACHINE_START(TS72XX, "Technologic Systems TS-72xx SBC")