aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68knommu
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@uclinux.org>2009-02-27 01:40:38 -0500
committerDavid S. Miller <davem@davemloft.net>2009-02-27 01:40:38 -0500
commitffba3f48bcd2d8af0570e7d4ce9b86fc4de9b10d (patch)
treed10a834586c8e66b496589aa55966368f9c08889 /arch/m68knommu
parent211174ea8dca4502e20008de7ff2ad389db023a5 (diff)
fec: add FEC platform support to ColdFire CPU's setup code
m68knommu: add FEC platform support to ColdFire CPU's setup code Move the per-CPU FEC driver setup code into the actual platform setup code for each ColdFire CPU varient. Signed-off-by: Greg Ungerer <gerg@uclinux.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/m68knommu')
-rw-r--r--arch/m68knommu/platform/520x/config.c56
-rw-r--r--arch/m68knommu/platform/523x/config.c51
-rw-r--r--arch/m68knommu/platform/5272/config.c48
-rw-r--r--arch/m68knommu/platform/527x/config.c113
-rw-r--r--arch/m68knommu/platform/528x/config.c58
-rw-r--r--arch/m68knommu/platform/532x/config.c49
6 files changed, 374 insertions, 1 deletions
diff --git a/arch/m68knommu/platform/520x/config.c b/arch/m68knommu/platform/520x/config.c
index 06d887cdcbfb..855fc6a79d72 100644
--- a/arch/m68knommu/platform/520x/config.c
+++ b/arch/m68knommu/platform/520x/config.c
@@ -49,8 +49,39 @@ static struct platform_device m520x_uart = {
49 .dev.platform_data = m520x_uart_platform, 49 .dev.platform_data = m520x_uart_platform,
50}; 50};
51 51
52static struct resource m520x_fec_resources[] = {
53 {
54 .start = MCF_MBAR + 0x30000,
55 .end = MCF_MBAR + 0x30000 + 0x7ff,
56 .flags = IORESOURCE_MEM,
57 },
58 {
59 .start = 64 + 36,
60 .end = 64 + 36,
61 .flags = IORESOURCE_IRQ,
62 },
63 {
64 .start = 64 + 40,
65 .end = 64 + 40,
66 .flags = IORESOURCE_IRQ,
67 },
68 {
69 .start = 64 + 42,
70 .end = 64 + 42,
71 .flags = IORESOURCE_IRQ,
72 },
73};
74
75static struct platform_device m520x_fec = {
76 .name = "fec",
77 .id = 0,
78 .num_resources = ARRAY_SIZE(m520x_fec_resources),
79 .resource = m520x_fec_resources,
80};
81
52static struct platform_device *m520x_devices[] __initdata = { 82static struct platform_device *m520x_devices[] __initdata = {
53 &m520x_uart, 83 &m520x_uart,
84 &m520x_fec,
54}; 85};
55 86
56/***************************************************************************/ 87/***************************************************************************/
@@ -103,6 +134,30 @@ static void __init m520x_uarts_init(void)
103 134
104/***************************************************************************/ 135/***************************************************************************/
105 136
137static void __init m520x_fec_init(void)
138{
139 u32 imr;
140 u8 v;
141
142 /* Unmask FEC interrupts at ColdFire interrupt controller */
143 writeb(0x4, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 36);
144 writeb(0x4, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 40);
145 writeb(0x4, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 42);
146
147 imr = readl(MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH);
148 imr &= ~0x0001FFF0;
149 writel(imr, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH);
150
151 /* Set multi-function pins to ethernet mode */
152 v = readb(MCF_IPSBAR + MCF_GPIO_PAR_FEC);
153 writeb(v | 0xf0, MCF_IPSBAR + MCF_GPIO_PAR_FEC);
154
155 v = readb(MCF_IPSBAR + MCF_GPIO_PAR_FECI2C);
156 writeb(v | 0x0f, MCF_IPSBAR + MCF_GPIO_PAR_FECI2C);
157}
158
159/***************************************************************************/
160
106/* 161/*
107 * Program the vector to be an auto-vectored. 162 * Program the vector to be an auto-vectored.
108 */ 163 */
@@ -118,6 +173,7 @@ void __init config_BSP(char *commandp, int size)
118{ 173{
119 mach_reset = coldfire_reset; 174 mach_reset = coldfire_reset;
120 m520x_uarts_init(); 175 m520x_uarts_init();
176 m520x_fec_init();
121} 177}
122 178
123/***************************************************************************/ 179/***************************************************************************/
diff --git a/arch/m68knommu/platform/523x/config.c b/arch/m68knommu/platform/523x/config.c
index 13f02611ea23..74133f27b30c 100644
--- a/arch/m68knommu/platform/523x/config.c
+++ b/arch/m68knommu/platform/523x/config.c
@@ -50,8 +50,39 @@ static struct platform_device m523x_uart = {
50 .dev.platform_data = m523x_uart_platform, 50 .dev.platform_data = m523x_uart_platform,
51}; 51};
52 52
53static struct resource m523x_fec_resources[] = {
54 {
55 .start = MCF_MBAR + 0x1000,
56 .end = MCF_MBAR + 0x1000 + 0x7ff,
57 .flags = IORESOURCE_MEM,
58 },
59 {
60 .start = 64 + 23,
61 .end = 64 + 23,
62 .flags = IORESOURCE_IRQ,
63 },
64 {
65 .start = 64 + 27,
66 .end = 64 + 27,
67 .flags = IORESOURCE_IRQ,
68 },
69 {
70 .start = 64 + 29,
71 .end = 64 + 29,
72 .flags = IORESOURCE_IRQ,
73 },
74};
75
76static struct platform_device m523x_fec = {
77 .name = "fec",
78 .id = 0,
79 .num_resources = ARRAY_SIZE(m523x_fec_resources),
80 .resource = m523x_fec_resources,
81};
82
53static struct platform_device *m523x_devices[] __initdata = { 83static struct platform_device *m523x_devices[] __initdata = {
54 &m523x_uart, 84 &m523x_uart,
85 &m523x_fec,
55}; 86};
56 87
57/***************************************************************************/ 88/***************************************************************************/
@@ -83,6 +114,25 @@ static void __init m523x_uarts_init(void)
83 114
84/***************************************************************************/ 115/***************************************************************************/
85 116
117static void __init m523x_fec_init(void)
118{
119 u32 imr;
120
121 /* Unmask FEC interrupts at ColdFire interrupt controller */
122 writeb(0x28, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 23);
123 writeb(0x27, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 27);
124 writeb(0x26, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 29);
125
126 imr = readl(MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH);
127 imr &= ~0xf;
128 writel(imr, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH);
129 imr = readl(MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL);
130 imr &= ~0xff800001;
131 writel(imr, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL);
132}
133
134/***************************************************************************/
135
86void mcf_disableall(void) 136void mcf_disableall(void)
87{ 137{
88 *((volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH)) = 0xffffffff; 138 *((volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH)) = 0xffffffff;
@@ -103,6 +153,7 @@ void __init config_BSP(char *commandp, int size)
103 mcf_disableall(); 153 mcf_disableall();
104 mach_reset = coldfire_reset; 154 mach_reset = coldfire_reset;
105 m523x_uarts_init(); 155 m523x_uarts_init();
156 m523x_fec_init();
106} 157}
107 158
108/***************************************************************************/ 159/***************************************************************************/
diff --git a/arch/m68knommu/platform/5272/config.c b/arch/m68knommu/platform/5272/config.c
index 230bae691a7f..e049245f4092 100644
--- a/arch/m68knommu/platform/5272/config.c
+++ b/arch/m68knommu/platform/5272/config.c
@@ -55,8 +55,39 @@ static struct platform_device m5272_uart = {
55 .dev.platform_data = m5272_uart_platform, 55 .dev.platform_data = m5272_uart_platform,
56}; 56};
57 57
58static struct resource m5272_fec_resources[] = {
59 {
60 .start = MCF_MBAR + 0x840,
61 .end = MCF_MBAR + 0x840 + 0x1cf,
62 .flags = IORESOURCE_MEM,
63 },
64 {
65 .start = 86,
66 .end = 86,
67 .flags = IORESOURCE_IRQ,
68 },
69 {
70 .start = 87,
71 .end = 87,
72 .flags = IORESOURCE_IRQ,
73 },
74 {
75 .start = 88,
76 .end = 88,
77 .flags = IORESOURCE_IRQ,
78 },
79};
80
81static struct platform_device m5272_fec = {
82 .name = "fec",
83 .id = 0,
84 .num_resources = ARRAY_SIZE(m5272_fec_resources),
85 .resource = m5272_fec_resources,
86};
87
58static struct platform_device *m5272_devices[] __initdata = { 88static struct platform_device *m5272_devices[] __initdata = {
59 &m5272_uart, 89 &m5272_uart,
90 &m5272_fec,
60}; 91};
61 92
62/***************************************************************************/ 93/***************************************************************************/
@@ -91,6 +122,22 @@ static void __init m5272_uarts_init(void)
91 122
92/***************************************************************************/ 123/***************************************************************************/
93 124
125static void __init m5272_fec_init(void)
126{
127 u32 imr;
128
129 /* Unmask FEC interrupts at ColdFire interrupt controller */
130 imr = readl(MCF_MBAR + MCFSIM_ICR3);
131 imr = (imr & ~0x00000fff) | 0x00000ddd;
132 writel(imr, MCF_MBAR + MCFSIM_ICR3);
133
134 imr = readl(MCF_MBAR + MCFSIM_ICR1);
135 imr = (imr & ~0x0f000000) | 0x0d000000;
136 writel(imr, MCF_MBAR + MCFSIM_ICR1);
137}
138
139/***************************************************************************/
140
94void mcf_disableall(void) 141void mcf_disableall(void)
95{ 142{
96 volatile unsigned long *icrp; 143 volatile unsigned long *icrp;
@@ -155,6 +202,7 @@ void __init config_BSP(char *commandp, int size)
155static int __init init_BSP(void) 202static int __init init_BSP(void)
156{ 203{
157 m5272_uarts_init(); 204 m5272_uarts_init();
205 m5272_fec_init();
158 platform_add_devices(m5272_devices, ARRAY_SIZE(m5272_devices)); 206 platform_add_devices(m5272_devices, ARRAY_SIZE(m5272_devices));
159 return 0; 207 return 0;
160} 208}
diff --git a/arch/m68knommu/platform/527x/config.c b/arch/m68knommu/platform/527x/config.c
index 73cd1aef4a90..49343fb157b0 100644
--- a/arch/m68knommu/platform/527x/config.c
+++ b/arch/m68knommu/platform/527x/config.c
@@ -50,8 +50,73 @@ static struct platform_device m527x_uart = {
50 .dev.platform_data = m527x_uart_platform, 50 .dev.platform_data = m527x_uart_platform,
51}; 51};
52 52
53static struct resource m527x_fec0_resources[] = {
54 {
55 .start = MCF_MBAR + 0x1000,
56 .end = MCF_MBAR + 0x1000 + 0x7ff,
57 .flags = IORESOURCE_MEM,
58 },
59 {
60 .start = 64 + 23,
61 .end = 64 + 23,
62 .flags = IORESOURCE_IRQ,
63 },
64 {
65 .start = 64 + 27,
66 .end = 64 + 27,
67 .flags = IORESOURCE_IRQ,
68 },
69 {
70 .start = 64 + 29,
71 .end = 64 + 29,
72 .flags = IORESOURCE_IRQ,
73 },
74};
75
76static struct resource m527x_fec1_resources[] = {
77 {
78 .start = MCF_MBAR + 0x1800,
79 .end = MCF_MBAR + 0x1800 + 0x7ff,
80 .flags = IORESOURCE_MEM,
81 },
82 {
83 .start = 128 + 23,
84 .end = 128 + 23,
85 .flags = IORESOURCE_IRQ,
86 },
87 {
88 .start = 128 + 27,
89 .end = 128 + 27,
90 .flags = IORESOURCE_IRQ,
91 },
92 {
93 .start = 128 + 29,
94 .end = 128 + 29,
95 .flags = IORESOURCE_IRQ,
96 },
97};
98
99static struct platform_device m527x_fec[] = {
100 {
101 .name = "fec",
102 .id = 0,
103 .num_resources = ARRAY_SIZE(m527x_fec0_resources),
104 .resource = m527x_fec0_resources,
105 },
106 {
107 .name = "fec",
108 .id = 1,
109 .num_resources = ARRAY_SIZE(m527x_fec1_resources),
110 .resource = m527x_fec1_resources,
111 },
112};
113
53static struct platform_device *m527x_devices[] __initdata = { 114static struct platform_device *m527x_devices[] __initdata = {
54 &m527x_uart, 115 &m527x_uart,
116 &m527x_fec[0],
117#ifdef CONFIG_FEC2
118 &m527x_fec[1],
119#endif
55}; 120};
56 121
57/***************************************************************************/ 122/***************************************************************************/
@@ -97,6 +162,51 @@ static void __init m527x_uarts_init(void)
97 162
98/***************************************************************************/ 163/***************************************************************************/
99 164
165static void __init m527x_fec_irq_init(int nr)
166{
167 unsigned long base;
168 u32 imr;
169
170 base = MCF_IPSBAR + (nr ? MCFICM_INTC1 : MCFICM_INTC0);
171
172 writeb(0x28, base + MCFINTC_ICR0 + 23);
173 writeb(0x27, base + MCFINTC_ICR0 + 27);
174 writeb(0x26, base + MCFINTC_ICR0 + 29);
175
176 imr = readl(base + MCFINTC_IMRH);
177 imr &= ~0xf;
178 writel(imr, base + MCFINTC_IMRH);
179 imr = readl(base + MCFINTC_IMRL);
180 imr &= ~0xff800001;
181 writel(imr, base + MCFINTC_IMRL);
182}
183
184static void __init m527x_fec_init(void)
185{
186 u16 par;
187 u8 v;
188
189 m527x_fec_irq_init(0);
190
191 /* Set multi-function pins to ethernet mode for fec0 */
192 par = readw(MCF_IPSBAR + 0x100082);
193 writew(par | 0xf00, MCF_IPSBAR + 0x100082);
194 v = readb(MCF_IPSBAR + 0x100078);
195 writeb(v | 0xc0, MCF_IPSBAR + 0x100078);
196
197#ifdef CONFIG_FEC2
198 m527x_fec_irq_init(1);
199
200 /* Set multi-function pins to ethernet mode for fec1 */
201 par = readw(MCF_IPSBAR + 0x100082);
202 writew(par | 0xa0, MCF_IPSBAR + 0x100082);
203 v = readb(MCF_IPSBAR + 0x100079);
204 writeb(v | 0xc0, MCF_IPSBAR + 0x100079);
205#endif
206}
207
208/***************************************************************************/
209
100void mcf_disableall(void) 210void mcf_disableall(void)
101{ 211{
102 *((volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH)) = 0xffffffff; 212 *((volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH)) = 0xffffffff;
@@ -116,13 +226,14 @@ void __init config_BSP(char *commandp, int size)
116{ 226{
117 mcf_disableall(); 227 mcf_disableall();
118 mach_reset = coldfire_reset; 228 mach_reset = coldfire_reset;
229 m527x_uarts_init();
230 m527x_fec_init();
119} 231}
120 232
121/***************************************************************************/ 233/***************************************************************************/
122 234
123static int __init init_BSP(void) 235static int __init init_BSP(void)
124{ 236{
125 m527x_uarts_init();
126 platform_add_devices(m527x_devices, ARRAY_SIZE(m527x_devices)); 237 platform_add_devices(m527x_devices, ARRAY_SIZE(m527x_devices));
127 return 0; 238 return 0;
128} 239}
diff --git a/arch/m68knommu/platform/528x/config.c b/arch/m68knommu/platform/528x/config.c
index dfdb5c2ed8e6..2ffb549876f0 100644
--- a/arch/m68knommu/platform/528x/config.c
+++ b/arch/m68knommu/platform/528x/config.c
@@ -285,8 +285,40 @@ static struct platform_device m528x_uart = {
285 .dev.platform_data = m528x_uart_platform, 285 .dev.platform_data = m528x_uart_platform,
286}; 286};
287 287
288static struct resource m528x_fec_resources[] = {
289 {
290 .start = MCF_MBAR + 0x1000,
291 .end = MCF_MBAR + 0x1000 + 0x7ff,
292 .flags = IORESOURCE_MEM,
293 },
294 {
295 .start = 64 + 23,
296 .end = 64 + 23,
297 .flags = IORESOURCE_IRQ,
298 },
299 {
300 .start = 64 + 27,
301 .end = 64 + 27,
302 .flags = IORESOURCE_IRQ,
303 },
304 {
305 .start = 64 + 29,
306 .end = 64 + 29,
307 .flags = IORESOURCE_IRQ,
308 },
309};
310
311static struct platform_device m528x_fec = {
312 .name = "fec",
313 .id = 0,
314 .num_resources = ARRAY_SIZE(m528x_fec_resources),
315 .resource = m528x_fec_resources,
316};
317
318
288static struct platform_device *m528x_devices[] __initdata = { 319static struct platform_device *m528x_devices[] __initdata = {
289 &m528x_uart, 320 &m528x_uart,
321 &m528x_fec,
290}; 322};
291 323
292/***************************************************************************/ 324/***************************************************************************/
@@ -327,6 +359,31 @@ static void __init m528x_uarts_init(void)
327 359
328/***************************************************************************/ 360/***************************************************************************/
329 361
362static void __init m528x_fec_init(void)
363{
364 u32 imr;
365 u16 v16;
366
367 /* Unmask FEC interrupts at ColdFire interrupt controller */
368 writeb(0x28, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 23);
369 writeb(0x27, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 27);
370 writeb(0x26, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 29);
371
372 imr = readl(MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH);
373 imr &= ~0xf;
374 writel(imr, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH);
375 imr = readl(MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL);
376 imr &= ~0xff800001;
377 writel(imr, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL);
378
379 /* Set multi-function pins to ethernet mode for fec0 */
380 v16 = readw(MCF_IPSBAR + 0x100056);
381 writew(v16 | 0xf00, MCF_IPSBAR + 0x100056);
382 writeb(0xc0, MCF_IPSBAR + 0x100058);
383}
384
385/***************************************************************************/
386
330void mcf_disableall(void) 387void mcf_disableall(void)
331{ 388{
332 *((volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH)) = 0xffffffff; 389 *((volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH)) = 0xffffffff;
@@ -386,6 +443,7 @@ void __init config_BSP(char *commandp, int size)
386static int __init init_BSP(void) 443static int __init init_BSP(void)
387{ 444{
388 m528x_uarts_init(); 445 m528x_uarts_init();
446 m528x_fec_init();
389 platform_add_devices(m528x_devices, ARRAY_SIZE(m528x_devices)); 447 platform_add_devices(m528x_devices, ARRAY_SIZE(m528x_devices));
390 return 0; 448 return 0;
391} 449}
diff --git a/arch/m68knommu/platform/532x/config.c b/arch/m68knommu/platform/532x/config.c
index a347623d6ee6..591f2f801134 100644
--- a/arch/m68knommu/platform/532x/config.c
+++ b/arch/m68knommu/platform/532x/config.c
@@ -61,8 +61,38 @@ static struct platform_device m532x_uart = {
61 .dev.platform_data = m532x_uart_platform, 61 .dev.platform_data = m532x_uart_platform,
62}; 62};
63 63
64static struct resource m532x_fec_resources[] = {
65 {
66 .start = 0xfc030000,
67 .end = 0xfc0307ff,
68 .flags = IORESOURCE_MEM,
69 },
70 {
71 .start = 64 + 36,
72 .end = 64 + 36,
73 .flags = IORESOURCE_IRQ,
74 },
75 {
76 .start = 64 + 40,
77 .end = 64 + 40,
78 .flags = IORESOURCE_IRQ,
79 },
80 {
81 .start = 64 + 42,
82 .end = 64 + 42,
83 .flags = IORESOURCE_IRQ,
84 },
85};
86
87static struct platform_device m532x_fec = {
88 .name = "fec",
89 .id = 0,
90 .num_resources = ARRAY_SIZE(m532x_fec_resources),
91 .resource = m532x_fec_resources,
92};
64static struct platform_device *m532x_devices[] __initdata = { 93static struct platform_device *m532x_devices[] __initdata = {
65 &m532x_uart, 94 &m532x_uart,
95 &m532x_fec,
66}; 96};
67 97
68/***************************************************************************/ 98/***************************************************************************/
@@ -93,6 +123,24 @@ static void __init m532x_uarts_init(void)
93 for (line = 0; (line < nrlines); line++) 123 for (line = 0; (line < nrlines); line++)
94 m532x_uart_init_line(line, m532x_uart_platform[line].irq); 124 m532x_uart_init_line(line, m532x_uart_platform[line].irq);
95} 125}
126/***************************************************************************/
127
128static void __init m532x_fec_init(void)
129{
130 /* Unmask FEC interrupts at ColdFire interrupt controller */
131 MCF_INTC0_ICR36 = 0x2;
132 MCF_INTC0_ICR40 = 0x2;
133 MCF_INTC0_ICR42 = 0x2;
134
135 MCF_INTC0_IMRH &= ~(MCF_INTC_IMRH_INT_MASK36 |
136 MCF_INTC_IMRH_INT_MASK40 | MCF_INTC_IMRH_INT_MASK42);
137
138 /* Set multi-function pins to ethernet mode for fec0 */
139 MCF_GPIO_PAR_FECI2C |= (MCF_GPIO_PAR_FECI2C_PAR_MDC_EMDC |
140 MCF_GPIO_PAR_FECI2C_PAR_MDIO_EMDIO);
141 MCF_GPIO_PAR_FEC = (MCF_GPIO_PAR_FEC_PAR_FEC_7W_FEC |
142 MCF_GPIO_PAR_FEC_PAR_FEC_MII_FEC);
143}
96 144
97/***************************************************************************/ 145/***************************************************************************/
98 146
@@ -150,6 +198,7 @@ void __init config_BSP(char *commandp, int size)
150static int __init init_BSP(void) 198static int __init init_BSP(void)
151{ 199{
152 m532x_uarts_init(); 200 m532x_uarts_init();
201 m532x_fec_init();
153 platform_add_devices(m532x_devices, ARRAY_SIZE(m532x_devices)); 202 platform_add_devices(m532x_devices, ARRAY_SIZE(m532x_devices));
154 return 0; 203 return 0;
155} 204}