aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-kirkwood
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/mach-kirkwood
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/mach-kirkwood')
-rw-r--r--arch/arm/mach-kirkwood/common.c145
1 files changed, 9 insertions, 136 deletions
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 */
72unsigned int kirkwood_clk_ctrl = CGC_DUNIT | CGC_RESERVED; 71unsigned 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 ****************************************************************************/
123struct mv643xx_eth_shared_platform_data kirkwood_ge00_shared_data = {
124 .dram = &kirkwood_mbus_dram_info,
125};
126
127static 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
141static 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
151static 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
160static 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
170void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data) 122void __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 ****************************************************************************/
184struct mv643xx_eth_shared_platform_data kirkwood_ge01_shared_data = {
185 .dram = &kirkwood_mbus_dram_info,
186 .shared_smi = &kirkwood_ge00_shared,
187};
188
189static 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
203static 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
213static 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
222static 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
232void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data) 135void __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 ****************************************************************************/
246static struct resource kirkwood_switch_resources[] = {
247 {
248 .start = 0,
249 .end = 0,
250 .flags = IORESOURCE_IRQ,
251 },
252};
253
254static struct platform_device kirkwood_switch_device = {
255 .name = "dsa",
256 .id = 0,
257 .num_resources = 0,
258 .resource = kirkwood_switch_resources,
259};
260
261void __init kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq) 149void __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