aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Bresticker <abrestic@chromium.org>2014-10-03 04:35:29 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-10-03 17:44:45 -0400
commit29e409f0f7613f9fd2235e41f0fa33e48e94544e (patch)
tree3cbc0c17d8e7bfb2c86466b4cdfaac75c4abd423
parent436e8c7d457ff4ca89beca20cf54f5884de6af61 (diff)
xhci: Allow xHCI drivers to be built as separate modules
Instead of building all of the xHCI code into a single module, separate it out into the core (xhci-hcd), PCI (xhci-pci, now selected by the new config option CONFIG_USB_XHCI_PCI), and platform (xhci-plat) drivers. Also update the PCI/platform drivers with module descriptions/licenses and have them register their respective drivers in their initcalls. Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/host/Kconfig5
-rw-r--r--drivers/usb/host/Makefile12
-rw-r--r--drivers/usb/host/xhci-pci.c9
-rw-r--r--drivers/usb/host/xhci-plat.c9
-rw-r--r--drivers/usb/host/xhci.c22
-rw-r--r--drivers/usb/host/xhci.h19
6 files changed, 25 insertions, 51 deletions
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 002ba1d5bcf5..fa038a2e30b2 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -26,6 +26,11 @@ config USB_XHCI_HCD
26 26
27if USB_XHCI_HCD 27if USB_XHCI_HCD
28 28
29config USB_XHCI_PCI
30 tristate
31 depends on PCI
32 default y
33
29config USB_XHCI_PLATFORM 34config USB_XHCI_PLATFORM
30 tristate 35 tristate
31 36
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 0336bb2c0e6f..8c6918907b15 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -15,22 +15,22 @@ fhci-$(CONFIG_FHCI_DEBUG) += fhci-dbg.o
15xhci-hcd-y := xhci.o xhci-mem.o 15xhci-hcd-y := xhci.o xhci-mem.o
16xhci-hcd-y += xhci-ring.o xhci-hub.o xhci-dbg.o 16xhci-hcd-y += xhci-ring.o xhci-hub.o xhci-dbg.o
17xhci-hcd-y += xhci-trace.o 17xhci-hcd-y += xhci-trace.o
18xhci-hcd-$(CONFIG_PCI) += xhci-pci.o
19 18
20ifneq ($(CONFIG_USB_XHCI_PLATFORM), ) 19xhci-plat-hcd-y := xhci-plat.o
21 xhci-hcd-y += xhci-plat.o
22ifneq ($(CONFIG_USB_XHCI_MVEBU), ) 20ifneq ($(CONFIG_USB_XHCI_MVEBU), )
23 xhci-hcd-y += xhci-mvebu.o 21 xhci-plat-hcd-y += xhci-mvebu.o
24endif 22endif
25ifneq ($(CONFIG_USB_XHCI_RCAR), ) 23ifneq ($(CONFIG_USB_XHCI_RCAR), )
26 xhci-hcd-y += xhci-rcar.o 24 xhci-plat-hcd-y += xhci-rcar.o
27endif
28endif 25endif
29 26
30obj-$(CONFIG_USB_WHCI_HCD) += whci/ 27obj-$(CONFIG_USB_WHCI_HCD) += whci/
31 28
32obj-$(CONFIG_PCI) += pci-quirks.o 29obj-$(CONFIG_PCI) += pci-quirks.o
33 30
31obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o
32obj-$(CONFIG_USB_XHCI_PLATFORM) += xhci-plat-hcd.o
33
34obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o 34obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o
35obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o 35obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
36obj-$(CONFIG_USB_EHCI_HCD_PLATFORM) += ehci-platform.o 36obj-$(CONFIG_USB_EHCI_HCD_PLATFORM) += ehci-platform.o
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index effa62aa4a2e..280dde93abe5 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -355,7 +355,7 @@ static struct pci_driver xhci_pci_driver = {
355#endif 355#endif
356}; 356};
357 357
358int __init xhci_register_pci(void) 358static int __init xhci_pci_init(void)
359{ 359{
360 xhci_init_driver(&xhci_pci_hc_driver, xhci_pci_setup); 360 xhci_init_driver(&xhci_pci_hc_driver, xhci_pci_setup);
361#ifdef CONFIG_PM 361#ifdef CONFIG_PM
@@ -364,8 +364,13 @@ int __init xhci_register_pci(void)
364#endif 364#endif
365 return pci_register_driver(&xhci_pci_driver); 365 return pci_register_driver(&xhci_pci_driver);
366} 366}
367module_init(xhci_pci_init);
367 368
368void xhci_unregister_pci(void) 369static void __exit xhci_pci_exit(void)
369{ 370{
370 pci_unregister_driver(&xhci_pci_driver); 371 pci_unregister_driver(&xhci_pci_driver);
371} 372}
373module_exit(xhci_pci_exit);
374
375MODULE_DESCRIPTION("xHCI PCI Host Controller Driver");
376MODULE_LICENSE("GPL");
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index f35236805a62..3d78b0cd674b 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -247,14 +247,19 @@ static struct platform_driver usb_xhci_driver = {
247}; 247};
248MODULE_ALIAS("platform:xhci-hcd"); 248MODULE_ALIAS("platform:xhci-hcd");
249 249
250int xhci_register_plat(void) 250static int __init xhci_plat_init(void)
251{ 251{
252 xhci_init_driver(&xhci_plat_hc_driver, xhci_plat_setup); 252 xhci_init_driver(&xhci_plat_hc_driver, xhci_plat_setup);
253 xhci_plat_hc_driver.start = xhci_plat_start; 253 xhci_plat_hc_driver.start = xhci_plat_start;
254 return platform_driver_register(&usb_xhci_driver); 254 return platform_driver_register(&usb_xhci_driver);
255} 255}
256module_init(xhci_plat_init);
256 257
257void xhci_unregister_plat(void) 258static void __exit xhci_plat_exit(void)
258{ 259{
259 platform_driver_unregister(&usb_xhci_driver); 260 platform_driver_unregister(&usb_xhci_driver);
260} 261}
262module_exit(xhci_plat_exit);
263
264MODULE_DESCRIPTION("xHCI Platform Host Controller Driver");
265MODULE_LICENSE("GPL");
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 3e0f5c7aed7a..2a5d45b4cb15 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4982,18 +4982,6 @@ MODULE_LICENSE("GPL");
4982 4982
4983static int __init xhci_hcd_init(void) 4983static int __init xhci_hcd_init(void)
4984{ 4984{
4985 int retval;
4986
4987 retval = xhci_register_pci();
4988 if (retval < 0) {
4989 pr_debug("Problem registering PCI driver.\n");
4990 return retval;
4991 }
4992 retval = xhci_register_plat();
4993 if (retval < 0) {
4994 pr_debug("Problem registering platform driver.\n");
4995 goto unreg_pci;
4996 }
4997 /* 4985 /*
4998 * Check the compiler generated sizes of structures that must be laid 4986 * Check the compiler generated sizes of structures that must be laid
4999 * out in specific ways for hardware access. 4987 * out in specific ways for hardware access.
@@ -5012,15 +5000,5 @@ static int __init xhci_hcd_init(void)
5012 /* xhci_run_regs has eight fields and embeds 128 xhci_intr_regs */ 5000 /* xhci_run_regs has eight fields and embeds 128 xhci_intr_regs */
5013 BUILD_BUG_ON(sizeof(struct xhci_run_regs) != (8+8*128)*32/8); 5001 BUILD_BUG_ON(sizeof(struct xhci_run_regs) != (8+8*128)*32/8);
5014 return 0; 5002 return 0;
5015unreg_pci:
5016 xhci_unregister_pci();
5017 return retval;
5018} 5003}
5019module_init(xhci_hcd_init); 5004module_init(xhci_hcd_init);
5020
5021static void __exit xhci_hcd_cleanup(void)
5022{
5023 xhci_unregister_pci();
5024 xhci_unregister_plat();
5025}
5026module_exit(xhci_hcd_cleanup);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index a099f382bee0..df76d642e719 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1731,25 +1731,6 @@ void xhci_urb_free_priv(struct xhci_hcd *xhci, struct urb_priv *urb_priv);
1731void xhci_free_command(struct xhci_hcd *xhci, 1731void xhci_free_command(struct xhci_hcd *xhci,
1732 struct xhci_command *command); 1732 struct xhci_command *command);
1733 1733
1734#ifdef CONFIG_PCI
1735/* xHCI PCI glue */
1736int xhci_register_pci(void);
1737void xhci_unregister_pci(void);
1738#else
1739static inline int xhci_register_pci(void) { return 0; }
1740static inline void xhci_unregister_pci(void) {}
1741#endif
1742
1743#if IS_ENABLED(CONFIG_USB_XHCI_PLATFORM)
1744int xhci_register_plat(void);
1745void xhci_unregister_plat(void);
1746#else
1747static inline int xhci_register_plat(void)
1748{ return 0; }
1749static inline void xhci_unregister_plat(void)
1750{ }
1751#endif
1752
1753/* xHCI host controller glue */ 1734/* xHCI host controller glue */
1754typedef void (*xhci_get_quirks_t)(struct device *, struct xhci_hcd *); 1735typedef void (*xhci_get_quirks_t)(struct device *, struct xhci_hcd *);
1755int xhci_handshake(struct xhci_hcd *xhci, void __iomem *ptr, 1736int xhci_handshake(struct xhci_hcd *xhci, void __iomem *ptr,