diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2012-11-01 11:13:04 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-11-01 11:51:12 -0400 |
commit | adfa79d1c06a32650332930ca4c488ca570b3407 (patch) | |
tree | a7dfd00bdec32dbfbd52d018e5daf3a1bb2d0808 | |
parent | 3e0232039967d7a1a06c013d097458b4d5892af1 (diff) |
USB: EHCI: make ehci-pci a separate driver
This patch (as1625) splits the PCI portion of ehci-hcd out into its
own separate driver module, called ehci-pci. Consistently with the
current practice, the decision whether to build this module is not
user-configurable. If EHCI and PCI are enabled then the module will
be built, always.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/host/Kconfig | 5 | ||||
-rw-r--r-- | drivers/usb/host/Makefile | 2 | ||||
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 26 | ||||
-rw-r--r-- | drivers/usb/host/ehci-pci.c | 101 |
4 files changed, 60 insertions, 74 deletions
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 8cc06f054c6a..10130f47fc78 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -95,6 +95,11 @@ config USB_EHCI_TT_NEWSCHED | |||
95 | 95 | ||
96 | If unsure, say Y. | 96 | If unsure, say Y. |
97 | 97 | ||
98 | config USB_EHCI_PCI | ||
99 | tristate | ||
100 | depends on USB_EHCI_HCD && PCI | ||
101 | default y | ||
102 | |||
98 | config USB_EHCI_HCD_PMC_MSP | 103 | config USB_EHCI_HCD_PMC_MSP |
99 | tristate "EHCI support for on-chip PMC MSP71xx USB controller" | 104 | tristate "EHCI support for on-chip PMC MSP71xx USB controller" |
100 | depends on USB_EHCI_HCD && MSP_HAS_USB | 105 | depends on USB_EHCI_HCD && MSP_HAS_USB |
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 332ed897a6fb..a8390b091c4d 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile | |||
@@ -24,6 +24,8 @@ obj-$(CONFIG_USB_WHCI_HCD) += whci/ | |||
24 | obj-$(CONFIG_PCI) += pci-quirks.o | 24 | obj-$(CONFIG_PCI) += pci-quirks.o |
25 | 25 | ||
26 | obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o | 26 | obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o |
27 | obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o | ||
28 | |||
27 | obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o | 29 | obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o |
28 | obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o | 30 | obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o |
29 | obj-$(CONFIG_USB_ISP1362_HCD) += isp1362-hcd.o | 31 | obj-$(CONFIG_USB_ISP1362_HCD) += isp1362-hcd.o |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index dee3541bfae8..7113d6ad24f7 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -1252,11 +1252,6 @@ MODULE_DESCRIPTION(DRIVER_DESC); | |||
1252 | MODULE_AUTHOR (DRIVER_AUTHOR); | 1252 | MODULE_AUTHOR (DRIVER_AUTHOR); |
1253 | MODULE_LICENSE ("GPL"); | 1253 | MODULE_LICENSE ("GPL"); |
1254 | 1254 | ||
1255 | #ifdef CONFIG_PCI | ||
1256 | #include "ehci-pci.c" | ||
1257 | #define PCI_DRIVER ehci_pci_driver | ||
1258 | #endif | ||
1259 | |||
1260 | #ifdef CONFIG_USB_EHCI_FSL | 1255 | #ifdef CONFIG_USB_EHCI_FSL |
1261 | #include "ehci-fsl.c" | 1256 | #include "ehci-fsl.c" |
1262 | #define PLATFORM_DRIVER ehci_fsl_driver | 1257 | #define PLATFORM_DRIVER ehci_fsl_driver |
@@ -1367,9 +1362,11 @@ MODULE_LICENSE ("GPL"); | |||
1367 | #define PLATFORM_DRIVER ehci_platform_driver | 1362 | #define PLATFORM_DRIVER ehci_platform_driver |
1368 | #endif | 1363 | #endif |
1369 | 1364 | ||
1370 | #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \ | 1365 | #if !IS_ENABLED(CONFIG_USB_EHCI_PCI) && \ |
1371 | !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) && \ | 1366 | !defined(PLATFORM_DRIVER) && \ |
1372 | !defined(XILINX_OF_PLATFORM_DRIVER) | 1367 | !defined(PS3_SYSTEM_BUS_DRIVER) && \ |
1368 | !defined(OF_PLATFORM_DRIVER) && \ | ||
1369 | !defined(XILINX_OF_PLATFORM_DRIVER) | ||
1373 | #error "missing bus glue for ehci-hcd" | 1370 | #error "missing bus glue for ehci-hcd" |
1374 | #endif | 1371 | #endif |
1375 | 1372 | ||
@@ -1406,12 +1403,6 @@ static int __init ehci_hcd_init(void) | |||
1406 | goto clean0; | 1403 | goto clean0; |
1407 | #endif | 1404 | #endif |
1408 | 1405 | ||
1409 | #ifdef PCI_DRIVER | ||
1410 | retval = pci_register_driver(&PCI_DRIVER); | ||
1411 | if (retval < 0) | ||
1412 | goto clean1; | ||
1413 | #endif | ||
1414 | |||
1415 | #ifdef PS3_SYSTEM_BUS_DRIVER | 1406 | #ifdef PS3_SYSTEM_BUS_DRIVER |
1416 | retval = ps3_ehci_driver_register(&PS3_SYSTEM_BUS_DRIVER); | 1407 | retval = ps3_ehci_driver_register(&PS3_SYSTEM_BUS_DRIVER); |
1417 | if (retval < 0) | 1408 | if (retval < 0) |
@@ -1443,10 +1434,6 @@ clean3: | |||
1443 | ps3_ehci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER); | 1434 | ps3_ehci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER); |
1444 | clean2: | 1435 | clean2: |
1445 | #endif | 1436 | #endif |
1446 | #ifdef PCI_DRIVER | ||
1447 | pci_unregister_driver(&PCI_DRIVER); | ||
1448 | clean1: | ||
1449 | #endif | ||
1450 | #ifdef PLATFORM_DRIVER | 1437 | #ifdef PLATFORM_DRIVER |
1451 | platform_driver_unregister(&PLATFORM_DRIVER); | 1438 | platform_driver_unregister(&PLATFORM_DRIVER); |
1452 | clean0: | 1439 | clean0: |
@@ -1472,9 +1459,6 @@ static void __exit ehci_hcd_cleanup(void) | |||
1472 | #ifdef PLATFORM_DRIVER | 1459 | #ifdef PLATFORM_DRIVER |
1473 | platform_driver_unregister(&PLATFORM_DRIVER); | 1460 | platform_driver_unregister(&PLATFORM_DRIVER); |
1474 | #endif | 1461 | #endif |
1475 | #ifdef PCI_DRIVER | ||
1476 | pci_unregister_driver(&PCI_DRIVER); | ||
1477 | #endif | ||
1478 | #ifdef PS3_SYSTEM_BUS_DRIVER | 1462 | #ifdef PS3_SYSTEM_BUS_DRIVER |
1479 | ps3_ehci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER); | 1463 | ps3_ehci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER); |
1480 | #endif | 1464 | #endif |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index c92dcaee0d4d..46018e975244 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -18,9 +18,18 @@ | |||
18 | * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef CONFIG_PCI | 21 | #include <linux/kernel.h> |
22 | #error "This file is PCI bus glue. CONFIG_PCI must be defined." | 22 | #include <linux/module.h> |
23 | #endif | 23 | #include <linux/pci.h> |
24 | #include <linux/usb.h> | ||
25 | #include <linux/usb/hcd.h> | ||
26 | |||
27 | #include "ehci.h" | ||
28 | #include "pci-quirks.h" | ||
29 | |||
30 | #define DRIVER_DESC "EHCI PCI platform driver" | ||
31 | |||
32 | static const char hcd_name[] = "ehci-pci"; | ||
24 | 33 | ||
25 | /* defined here to avoid adding to pci_ids.h for single instance use */ | 34 | /* defined here to avoid adding to pci_ids.h for single instance use */ |
26 | #define PCI_DEVICE_ID_INTEL_CE4100_USB 0x2e70 | 35 | #define PCI_DEVICE_ID_INTEL_CE4100_USB 0x2e70 |
@@ -315,11 +324,6 @@ done: | |||
315 | * Also they depend on separate root hub suspend/resume. | 324 | * Also they depend on separate root hub suspend/resume. |
316 | */ | 325 | */ |
317 | 326 | ||
318 | static int ehci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) | ||
319 | { | ||
320 | return ehci_suspend(hcd, do_wakeup); | ||
321 | } | ||
322 | |||
323 | static bool usb_is_intel_switchable_ehci(struct pci_dev *pdev) | 327 | static bool usb_is_intel_switchable_ehci(struct pci_dev *pdev) |
324 | { | 328 | { |
325 | return pdev->class == PCI_CLASS_SERIAL_USB_EHCI && | 329 | return pdev->class == PCI_CLASS_SERIAL_USB_EHCI && |
@@ -370,55 +374,18 @@ static int ehci_pci_resume(struct usb_hcd *hcd, bool hibernated) | |||
370 | (void) ehci_pci_reinit(ehci, pdev); | 374 | (void) ehci_pci_reinit(ehci, pdev); |
371 | return 0; | 375 | return 0; |
372 | } | 376 | } |
373 | #endif | ||
374 | |||
375 | static const struct hc_driver ehci_pci_hc_driver = { | ||
376 | .description = hcd_name, | ||
377 | .product_desc = "EHCI Host Controller", | ||
378 | .hcd_priv_size = sizeof(struct ehci_hcd), | ||
379 | 377 | ||
380 | /* | 378 | #else |
381 | * generic hardware linkage | ||
382 | */ | ||
383 | .irq = ehci_irq, | ||
384 | .flags = HCD_MEMORY | HCD_USB2, | ||
385 | |||
386 | /* | ||
387 | * basic lifecycle operations | ||
388 | */ | ||
389 | .reset = ehci_pci_setup, | ||
390 | .start = ehci_run, | ||
391 | #ifdef CONFIG_PM | ||
392 | .pci_suspend = ehci_pci_suspend, | ||
393 | .pci_resume = ehci_pci_resume, | ||
394 | #endif | ||
395 | .stop = ehci_stop, | ||
396 | .shutdown = ehci_shutdown, | ||
397 | 379 | ||
398 | /* | 380 | #define ehci_suspend NULL |
399 | * managing i/o requests and associated device resources | 381 | #define ehci_pci_resume NULL |
400 | */ | 382 | #endif /* CONFIG_PM */ |
401 | .urb_enqueue = ehci_urb_enqueue, | ||
402 | .urb_dequeue = ehci_urb_dequeue, | ||
403 | .endpoint_disable = ehci_endpoint_disable, | ||
404 | .endpoint_reset = ehci_endpoint_reset, | ||
405 | 383 | ||
406 | /* | 384 | static struct hc_driver __read_mostly ehci_pci_hc_driver; |
407 | * scheduling support | ||
408 | */ | ||
409 | .get_frame_number = ehci_get_frame, | ||
410 | 385 | ||
411 | /* | 386 | static const struct ehci_driver_overrides overrides = { |
412 | * root hub support | 387 | .product_desc = "EHCI PCI host controller", |
413 | */ | 388 | .reset = ehci_pci_setup, |
414 | .hub_status_data = ehci_hub_status_data, | ||
415 | .hub_control = ehci_hub_control, | ||
416 | .bus_suspend = ehci_bus_suspend, | ||
417 | .bus_resume = ehci_bus_resume, | ||
418 | .relinquish_port = ehci_relinquish_port, | ||
419 | .port_handed_over = ehci_port_handed_over, | ||
420 | |||
421 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | ||
422 | }; | 389 | }; |
423 | 390 | ||
424 | /*-------------------------------------------------------------------------*/ | 391 | /*-------------------------------------------------------------------------*/ |
@@ -451,3 +418,31 @@ static struct pci_driver ehci_pci_driver = { | |||
451 | }, | 418 | }, |
452 | #endif | 419 | #endif |
453 | }; | 420 | }; |
421 | |||
422 | static int __init ehci_pci_init(void) | ||
423 | { | ||
424 | if (usb_disabled()) | ||
425 | return -ENODEV; | ||
426 | |||
427 | pr_info("%s: " DRIVER_DESC "\n", hcd_name); | ||
428 | |||
429 | ehci_init_driver(&ehci_pci_hc_driver, &overrides); | ||
430 | |||
431 | /* Entries for the PCI suspend/resume callbacks are special */ | ||
432 | ehci_pci_hc_driver.pci_suspend = ehci_suspend; | ||
433 | ehci_pci_hc_driver.pci_resume = ehci_pci_resume; | ||
434 | |||
435 | return pci_register_driver(&ehci_pci_driver); | ||
436 | } | ||
437 | module_init(ehci_pci_init); | ||
438 | |||
439 | static void __exit ehci_pci_cleanup(void) | ||
440 | { | ||
441 | pci_unregister_driver(&ehci_pci_driver); | ||
442 | } | ||
443 | module_exit(ehci_pci_cleanup); | ||
444 | |||
445 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
446 | MODULE_AUTHOR("David Brownell"); | ||
447 | MODULE_AUTHOR("Alan Stern"); | ||
448 | MODULE_LICENSE("GPL"); | ||