aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-orion
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2013-03-21 23:39:28 -0400
committerDavid S. Miller <davem@davemloft.net>2013-03-22 10:25:15 -0400
commitc3a07134e6aa5b93a37f72ffa3d11fadf72bf757 (patch)
treee61bf96df027d188c5b07722911121ec1186e701 /arch/arm/plat-orion
parent2ec985213864cb64c45dc0284d7316142eefb5d4 (diff)
mv643xx_eth: convert to use the Marvell Orion MDIO driver
This patch converts the Marvell MV643XX ethernet driver to use the Marvell Orion MDIO driver. As a result, PowerPC and ARM platforms registering the Marvell MV643XX ethernet driver are also updated to register a Marvell Orion MDIO driver. This driver voluntarily overlaps with the Marvell Ethernet shared registers because it will use a subset of this shared register (shared_base + 0x4 to shared_base + 0x84). The Ethernet driver is also updated to look up for a PHY device using the Orion MDIO bus driver. For ARM and PowerPC we register a single instance of the "mvmdio" driver in the system like it used to be done with the use of the "shared_smi" platform_data cookie on ARM. Note that it is safe to register the mvmdio driver only for the "ge00" instance of the driver because this "ge00" interface is guaranteed to always be explicitely registered by consumers of arch/arm/plat-orion/common.c and other instances (ge01, ge10 and ge11) were all pointing their shared_smi to ge00. For PowerPC the in-tree Device Tree Source files mention only one MV643XX ethernet MAC instance so the MDIO bus driver is registered only when id == 0. Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/arm/plat-orion')
-rw-r--r--arch/arm/plat-orion/common.c54
1 files changed, 31 insertions, 23 deletions
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index 2d4b6414609f..251f827271e9 100644
--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -238,6 +238,7 @@ static __init void ge_complete(
238 struct mv643xx_eth_shared_platform_data *orion_ge_shared_data, 238 struct mv643xx_eth_shared_platform_data *orion_ge_shared_data,
239 struct resource *orion_ge_resource, unsigned long irq, 239 struct resource *orion_ge_resource, unsigned long irq,
240 struct platform_device *orion_ge_shared, 240 struct platform_device *orion_ge_shared,
241 struct platform_device *orion_ge_mvmdio,
241 struct mv643xx_eth_platform_data *eth_data, 242 struct mv643xx_eth_platform_data *eth_data,
242 struct platform_device *orion_ge) 243 struct platform_device *orion_ge)
243{ 244{
@@ -247,6 +248,8 @@ static __init void ge_complete(
247 orion_ge->dev.platform_data = eth_data; 248 orion_ge->dev.platform_data = eth_data;
248 249
249 platform_device_register(orion_ge_shared); 250 platform_device_register(orion_ge_shared);
251 if (orion_ge_mvmdio)
252 platform_device_register(orion_ge_mvmdio);
250 platform_device_register(orion_ge); 253 platform_device_register(orion_ge);
251} 254}
252 255
@@ -258,8 +261,6 @@ struct mv643xx_eth_shared_platform_data orion_ge00_shared_data;
258static struct resource orion_ge00_shared_resources[] = { 261static struct resource orion_ge00_shared_resources[] = {
259 { 262 {
260 .name = "ge00 base", 263 .name = "ge00 base",
261 }, {
262 .name = "ge00 err irq",
263 }, 264 },
264}; 265};
265 266
@@ -271,6 +272,19 @@ static struct platform_device orion_ge00_shared = {
271 }, 272 },
272}; 273};
273 274
275static struct resource orion_ge_mvmdio_resources[] = {
276 {
277 .name = "ge00 mvmdio base",
278 }, {
279 .name = "ge00 mvmdio err irq",
280 },
281};
282
283static struct platform_device orion_ge_mvmdio = {
284 .name = "orion-mdio",
285 .id = -1,
286};
287
274static struct resource orion_ge00_resources[] = { 288static struct resource orion_ge00_resources[] = {
275 { 289 {
276 .name = "ge00 irq", 290 .name = "ge00 irq",
@@ -295,26 +309,25 @@ void __init orion_ge00_init(struct mv643xx_eth_platform_data *eth_data,
295 unsigned int tx_csum_limit) 309 unsigned int tx_csum_limit)
296{ 310{
297 fill_resources(&orion_ge00_shared, orion_ge00_shared_resources, 311 fill_resources(&orion_ge00_shared, orion_ge00_shared_resources,
298 mapbase + 0x2000, SZ_16K - 1, irq_err); 312 mapbase + 0x2000, SZ_16K - 1, NO_IRQ);
313 fill_resources(&orion_ge_mvmdio, orion_ge_mvmdio_resources,
314 mapbase + 0x2004, 0x84 - 1, irq_err);
299 orion_ge00_shared_data.tx_csum_limit = tx_csum_limit; 315 orion_ge00_shared_data.tx_csum_limit = tx_csum_limit;
300 ge_complete(&orion_ge00_shared_data, 316 ge_complete(&orion_ge00_shared_data,
301 orion_ge00_resources, irq, &orion_ge00_shared, 317 orion_ge00_resources, irq, &orion_ge00_shared,
318 &orion_ge_mvmdio,
302 eth_data, &orion_ge00); 319 eth_data, &orion_ge00);
303} 320}
304 321
305/***************************************************************************** 322/*****************************************************************************
306 * GE01 323 * GE01
307 ****************************************************************************/ 324 ****************************************************************************/
308struct mv643xx_eth_shared_platform_data orion_ge01_shared_data = { 325struct mv643xx_eth_shared_platform_data orion_ge01_shared_data;
309 .shared_smi = &orion_ge00_shared,
310};
311 326
312static struct resource orion_ge01_shared_resources[] = { 327static struct resource orion_ge01_shared_resources[] = {
313 { 328 {
314 .name = "ge01 base", 329 .name = "ge01 base",
315 }, { 330 }
316 .name = "ge01 err irq",
317 },
318}; 331};
319 332
320static struct platform_device orion_ge01_shared = { 333static struct platform_device orion_ge01_shared = {
@@ -349,26 +362,23 @@ void __init orion_ge01_init(struct mv643xx_eth_platform_data *eth_data,
349 unsigned int tx_csum_limit) 362 unsigned int tx_csum_limit)
350{ 363{
351 fill_resources(&orion_ge01_shared, orion_ge01_shared_resources, 364 fill_resources(&orion_ge01_shared, orion_ge01_shared_resources,
352 mapbase + 0x2000, SZ_16K - 1, irq_err); 365 mapbase + 0x2000, SZ_16K - 1, NO_IRQ);
353 orion_ge01_shared_data.tx_csum_limit = tx_csum_limit; 366 orion_ge01_shared_data.tx_csum_limit = tx_csum_limit;
354 ge_complete(&orion_ge01_shared_data, 367 ge_complete(&orion_ge01_shared_data,
355 orion_ge01_resources, irq, &orion_ge01_shared, 368 orion_ge01_resources, irq, &orion_ge01_shared,
369 NULL,
356 eth_data, &orion_ge01); 370 eth_data, &orion_ge01);
357} 371}
358 372
359/***************************************************************************** 373/*****************************************************************************
360 * GE10 374 * GE10
361 ****************************************************************************/ 375 ****************************************************************************/
362struct mv643xx_eth_shared_platform_data orion_ge10_shared_data = { 376struct mv643xx_eth_shared_platform_data orion_ge10_shared_data;
363 .shared_smi = &orion_ge00_shared,
364};
365 377
366static struct resource orion_ge10_shared_resources[] = { 378static struct resource orion_ge10_shared_resources[] = {
367 { 379 {
368 .name = "ge10 base", 380 .name = "ge10 base",
369 }, { 381 }
370 .name = "ge10 err irq",
371 },
372}; 382};
373 383
374static struct platform_device orion_ge10_shared = { 384static struct platform_device orion_ge10_shared = {
@@ -402,24 +412,21 @@ void __init orion_ge10_init(struct mv643xx_eth_platform_data *eth_data,
402 unsigned long irq_err) 412 unsigned long irq_err)
403{ 413{
404 fill_resources(&orion_ge10_shared, orion_ge10_shared_resources, 414 fill_resources(&orion_ge10_shared, orion_ge10_shared_resources,
405 mapbase + 0x2000, SZ_16K - 1, irq_err); 415 mapbase + 0x2000, SZ_16K - 1, NO_IRQ);
406 ge_complete(&orion_ge10_shared_data, 416 ge_complete(&orion_ge10_shared_data,
407 orion_ge10_resources, irq, &orion_ge10_shared, 417 orion_ge10_resources, irq, &orion_ge10_shared,
418 NULL,
408 eth_data, &orion_ge10); 419 eth_data, &orion_ge10);
409} 420}
410 421
411/***************************************************************************** 422/*****************************************************************************
412 * GE11 423 * GE11
413 ****************************************************************************/ 424 ****************************************************************************/
414struct mv643xx_eth_shared_platform_data orion_ge11_shared_data = { 425struct mv643xx_eth_shared_platform_data orion_ge11_shared_data;
415 .shared_smi = &orion_ge00_shared,
416};
417 426
418static struct resource orion_ge11_shared_resources[] = { 427static struct resource orion_ge11_shared_resources[] = {
419 { 428 {
420 .name = "ge11 base", 429 .name = "ge11 base",
421 }, {
422 .name = "ge11 err irq",
423 }, 430 },
424}; 431};
425 432
@@ -454,9 +461,10 @@ void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data,
454 unsigned long irq_err) 461 unsigned long irq_err)
455{ 462{
456 fill_resources(&orion_ge11_shared, orion_ge11_shared_resources, 463 fill_resources(&orion_ge11_shared, orion_ge11_shared_resources,
457 mapbase + 0x2000, SZ_16K - 1, irq_err); 464 mapbase + 0x2000, SZ_16K - 1, NO_IRQ);
458 ge_complete(&orion_ge11_shared_data, 465 ge_complete(&orion_ge11_shared_data,
459 orion_ge11_resources, irq, &orion_ge11_shared, 466 orion_ge11_resources, irq, &orion_ge11_shared,
467 NULL,
460 eth_data, &orion_ge11); 468 eth_data, &orion_ge11);
461} 469}
462 470