diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2006-04-11 11:07:16 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-21 18:04:09 -0400 |
commit | 01cced250722d22d99c2342979490f93ca886521 (patch) | |
tree | b29b395305836a0f3690a69173e1df2a2f0ecf4f /arch | |
parent | df47e5330b0f5decb0a5736e9a81fff49d46d151 (diff) |
[PATCH] USB: allow multiple types of EHCI controllers to be built as modules
In some systems we may have both a platform EHCI controller and PCI EHCI
controller. Previously we couldn't build the EHCI support as a module due
to conflicting module_init() calls in the code.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/sysdev/fsl_soc.c | 66 | ||||
-rw-r--r-- | arch/ppc/syslib/mpc83xx_devices.c | 6 |
2 files changed, 29 insertions, 43 deletions
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index ceb584682fa3..71a3275935ec 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c | |||
@@ -372,7 +372,7 @@ static int __init fsl_usb_of_init(void) | |||
372 | { | 372 | { |
373 | struct device_node *np; | 373 | struct device_node *np; |
374 | unsigned int i; | 374 | unsigned int i; |
375 | struct platform_device *usb_dev; | 375 | struct platform_device *usb_dev_mph = NULL, *usb_dev_dr = NULL; |
376 | int ret; | 376 | int ret; |
377 | 377 | ||
378 | for (np = NULL, i = 0; | 378 | for (np = NULL, i = 0; |
@@ -393,15 +393,15 @@ static int __init fsl_usb_of_init(void) | |||
393 | r[1].end = np->intrs[0].line; | 393 | r[1].end = np->intrs[0].line; |
394 | r[1].flags = IORESOURCE_IRQ; | 394 | r[1].flags = IORESOURCE_IRQ; |
395 | 395 | ||
396 | usb_dev = | 396 | usb_dev_mph = |
397 | platform_device_register_simple("fsl-usb2-mph", i, r, 2); | 397 | platform_device_register_simple("fsl-ehci", i, r, 2); |
398 | if (IS_ERR(usb_dev)) { | 398 | if (IS_ERR(usb_dev_mph)) { |
399 | ret = PTR_ERR(usb_dev); | 399 | ret = PTR_ERR(usb_dev_mph); |
400 | goto err; | 400 | goto err; |
401 | } | 401 | } |
402 | 402 | ||
403 | usb_dev->dev.coherent_dma_mask = 0xffffffffUL; | 403 | usb_dev_mph->dev.coherent_dma_mask = 0xffffffffUL; |
404 | usb_dev->dev.dma_mask = &usb_dev->dev.coherent_dma_mask; | 404 | usb_dev_mph->dev.dma_mask = &usb_dev_mph->dev.coherent_dma_mask; |
405 | 405 | ||
406 | usb_data.operating_mode = FSL_USB2_MPH_HOST; | 406 | usb_data.operating_mode = FSL_USB2_MPH_HOST; |
407 | 407 | ||
@@ -417,31 +417,14 @@ static int __init fsl_usb_of_init(void) | |||
417 | usb_data.phy_mode = determine_usb_phy(prop); | 417 | usb_data.phy_mode = determine_usb_phy(prop); |
418 | 418 | ||
419 | ret = | 419 | ret = |
420 | platform_device_add_data(usb_dev, &usb_data, | 420 | platform_device_add_data(usb_dev_mph, &usb_data, |
421 | sizeof(struct | 421 | sizeof(struct |
422 | fsl_usb2_platform_data)); | 422 | fsl_usb2_platform_data)); |
423 | if (ret) | 423 | if (ret) |
424 | goto unreg; | 424 | goto unreg_mph; |
425 | } | 425 | } |
426 | 426 | ||
427 | return 0; | 427 | for (np = NULL; |
428 | |||
429 | unreg: | ||
430 | platform_device_unregister(usb_dev); | ||
431 | err: | ||
432 | return ret; | ||
433 | } | ||
434 | |||
435 | arch_initcall(fsl_usb_of_init); | ||
436 | |||
437 | static int __init fsl_usb_dr_of_init(void) | ||
438 | { | ||
439 | struct device_node *np; | ||
440 | unsigned int i; | ||
441 | struct platform_device *usb_dev; | ||
442 | int ret; | ||
443 | |||
444 | for (np = NULL, i = 0; | ||
445 | (np = of_find_compatible_node(np, "usb", "fsl-usb2-dr")) != NULL; | 428 | (np = of_find_compatible_node(np, "usb", "fsl-usb2-dr")) != NULL; |
446 | i++) { | 429 | i++) { |
447 | struct resource r[2]; | 430 | struct resource r[2]; |
@@ -453,21 +436,21 @@ static int __init fsl_usb_dr_of_init(void) | |||
453 | 436 | ||
454 | ret = of_address_to_resource(np, 0, &r[0]); | 437 | ret = of_address_to_resource(np, 0, &r[0]); |
455 | if (ret) | 438 | if (ret) |
456 | goto err; | 439 | goto unreg_mph; |
457 | 440 | ||
458 | r[1].start = np->intrs[0].line; | 441 | r[1].start = np->intrs[0].line; |
459 | r[1].end = np->intrs[0].line; | 442 | r[1].end = np->intrs[0].line; |
460 | r[1].flags = IORESOURCE_IRQ; | 443 | r[1].flags = IORESOURCE_IRQ; |
461 | 444 | ||
462 | usb_dev = | 445 | usb_dev_dr = |
463 | platform_device_register_simple("fsl-usb2-dr", i, r, 2); | 446 | platform_device_register_simple("fsl-ehci", i, r, 2); |
464 | if (IS_ERR(usb_dev)) { | 447 | if (IS_ERR(usb_dev_dr)) { |
465 | ret = PTR_ERR(usb_dev); | 448 | ret = PTR_ERR(usb_dev_dr); |
466 | goto err; | 449 | goto err; |
467 | } | 450 | } |
468 | 451 | ||
469 | usb_dev->dev.coherent_dma_mask = 0xffffffffUL; | 452 | usb_dev_dr->dev.coherent_dma_mask = 0xffffffffUL; |
470 | usb_dev->dev.dma_mask = &usb_dev->dev.coherent_dma_mask; | 453 | usb_dev_dr->dev.dma_mask = &usb_dev_dr->dev.coherent_dma_mask; |
471 | 454 | ||
472 | usb_data.operating_mode = FSL_USB2_DR_HOST; | 455 | usb_data.operating_mode = FSL_USB2_DR_HOST; |
473 | 456 | ||
@@ -475,19 +458,22 @@ static int __init fsl_usb_dr_of_init(void) | |||
475 | usb_data.phy_mode = determine_usb_phy(prop); | 458 | usb_data.phy_mode = determine_usb_phy(prop); |
476 | 459 | ||
477 | ret = | 460 | ret = |
478 | platform_device_add_data(usb_dev, &usb_data, | 461 | platform_device_add_data(usb_dev_dr, &usb_data, |
479 | sizeof(struct | 462 | sizeof(struct |
480 | fsl_usb2_platform_data)); | 463 | fsl_usb2_platform_data)); |
481 | if (ret) | 464 | if (ret) |
482 | goto unreg; | 465 | goto unreg_dr; |
483 | } | 466 | } |
484 | |||
485 | return 0; | 467 | return 0; |
486 | 468 | ||
487 | unreg: | 469 | unreg_dr: |
488 | platform_device_unregister(usb_dev); | 470 | if (usb_dev_dr) |
471 | platform_device_unregister(usb_dev_dr); | ||
472 | unreg_mph: | ||
473 | if (usb_dev_mph) | ||
474 | platform_device_unregister(usb_dev_mph); | ||
489 | err: | 475 | err: |
490 | return ret; | 476 | return ret; |
491 | } | 477 | } |
492 | 478 | ||
493 | arch_initcall(fsl_usb_dr_of_init); | 479 | arch_initcall(fsl_usb_of_init); |
diff --git a/arch/ppc/syslib/mpc83xx_devices.c b/arch/ppc/syslib/mpc83xx_devices.c index 1af2c000fcfa..5c4932ca8e9b 100644 --- a/arch/ppc/syslib/mpc83xx_devices.c +++ b/arch/ppc/syslib/mpc83xx_devices.c | |||
@@ -186,7 +186,7 @@ struct platform_device ppc_sys_platform_devices[] = { | |||
186 | }, | 186 | }, |
187 | }, | 187 | }, |
188 | [MPC83xx_USB2_DR] = { | 188 | [MPC83xx_USB2_DR] = { |
189 | .name = "fsl-usb2-dr", | 189 | .name = "fsl-ehci", |
190 | .id = 1, | 190 | .id = 1, |
191 | .num_resources = 2, | 191 | .num_resources = 2, |
192 | .resource = (struct resource[]) { | 192 | .resource = (struct resource[]) { |
@@ -203,8 +203,8 @@ struct platform_device ppc_sys_platform_devices[] = { | |||
203 | }, | 203 | }, |
204 | }, | 204 | }, |
205 | [MPC83xx_USB2_MPH] = { | 205 | [MPC83xx_USB2_MPH] = { |
206 | .name = "fsl-usb2-mph", | 206 | .name = "fsl-ehci", |
207 | .id = 1, | 207 | .id = 2, |
208 | .num_resources = 2, | 208 | .num_resources = 2, |
209 | .resource = (struct resource[]) { | 209 | .resource = (struct resource[]) { |
210 | { | 210 | { |