diff options
author | Manjunath Goudar <manjunath.goudar@linaro.org> | 2013-04-02 12:24:03 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-08 12:40:20 -0400 |
commit | 8c68e84f3a0361bf6053a055643a6ff18c7d86d4 (patch) | |
tree | 6f1e7467cba38f6b346c049a95cc6da2d9605acb | |
parent | 9773696105534dd5193576adfe4a0117a6489c64 (diff) |
USB: EHCI: make ehci-msm a separate driver
Separate the Qualcomm QSD/MSM on-chip host controller driver from
ehci-hcd host code so that it can be built as a separate driver module.
This work is part of enabling multi-platform kernels on ARM;
however, note that other changes are still needed before Qualcomm QSD/MSM
can be booted with a multi-platform kernel, which is not expected before
3.11.
With the infrastructure added by Alan Stern in patch 3e0232039
"USB: EHCI: prepare to make ehci-hcd a library module", we can
avoid this problem by turning a bus glue into a separate
module, as we do here for the msm bus glue.
In V5 (arnd):
- add FIXME about missing usb_add_hcd() or usb_remove_hcd() calls
In V3:
- Detailed commit message added here describing why this patch is required.
- Arranged #include's in alphabetical order.
- driver.name initialized hcd_name[] = "ehci-msm" in platform_driver
structure initialization instead of "msm-ehci", which was the reason
why it broke in EHCI USB testing
In V2:
Tegra patch related changes removed from this patch.
Signed-off-by: Manjunath Goudar <manjunath.goudar@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: David Brown <davidb@codeaurora.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/host/Kconfig | 2 | ||||
-rw-r--r-- | drivers/usb/host/Makefile | 1 | ||||
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 6 | ||||
-rw-r--r-- | drivers/usb/host/ehci-msm.c | 89 |
4 files changed, 44 insertions, 54 deletions
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index c7a6866115c7..dbeac41595de 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -191,7 +191,7 @@ config USB_EHCI_HCD_AT91 | |||
191 | Atmel chips. | 191 | Atmel chips. |
192 | 192 | ||
193 | config USB_EHCI_MSM | 193 | config USB_EHCI_MSM |
194 | bool "Support for MSM on-chip EHCI USB controller" | 194 | tristate "Support for Qualcomm QSD/MSM on-chip EHCI USB controller" |
195 | depends on USB_EHCI_HCD && ARCH_MSM | 195 | depends on USB_EHCI_HCD && ARCH_MSM |
196 | select USB_EHCI_ROOT_HUB_TT | 196 | select USB_EHCI_ROOT_HUB_TT |
197 | select USB_MSM_OTG | 197 | select USB_MSM_OTG |
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 368d3eb994d3..4fb73c156d72 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile | |||
@@ -32,6 +32,7 @@ obj-$(CONFIG_USB_EHCI_HCD_ORION) += ehci-orion.o | |||
32 | obj-$(CONFIG_USB_EHCI_HCD_SPEAR) += ehci-spear.o | 32 | obj-$(CONFIG_USB_EHCI_HCD_SPEAR) += ehci-spear.o |
33 | obj-$(CONFIG_USB_EHCI_S5P) += ehci-s5p.o | 33 | obj-$(CONFIG_USB_EHCI_S5P) += ehci-s5p.o |
34 | obj-$(CONFIG_USB_EHCI_HCD_AT91) += ehci-atmel.o | 34 | obj-$(CONFIG_USB_EHCI_HCD_AT91) += ehci-atmel.o |
35 | obj-$(CONFIG_USB_EHCI_MSM) += ehci-msm.o | ||
35 | 36 | ||
36 | obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o | 37 | obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o |
37 | obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o | 38 | obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index ccc78abd4500..2e0c2bd6495f 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -1259,11 +1259,6 @@ MODULE_LICENSE ("GPL"); | |||
1259 | #define PLATFORM_DRIVER ehci_octeon_driver | 1259 | #define PLATFORM_DRIVER ehci_octeon_driver |
1260 | #endif | 1260 | #endif |
1261 | 1261 | ||
1262 | #ifdef CONFIG_USB_EHCI_MSM | ||
1263 | #include "ehci-msm.c" | ||
1264 | #define PLATFORM_DRIVER ehci_msm_driver | ||
1265 | #endif | ||
1266 | |||
1267 | #ifdef CONFIG_TILE_USB | 1262 | #ifdef CONFIG_TILE_USB |
1268 | #include "ehci-tilegx.c" | 1263 | #include "ehci-tilegx.c" |
1269 | #define PLATFORM_DRIVER ehci_hcd_tilegx_driver | 1264 | #define PLATFORM_DRIVER ehci_hcd_tilegx_driver |
@@ -1303,6 +1298,7 @@ MODULE_LICENSE ("GPL"); | |||
1303 | !IS_ENABLED(CONFIG_USB_EHCI_HCD_SPEAR) && \ | 1298 | !IS_ENABLED(CONFIG_USB_EHCI_HCD_SPEAR) && \ |
1304 | !IS_ENABLED(CONFIG_USB_EHCI_S5P) && \ | 1299 | !IS_ENABLED(CONFIG_USB_EHCI_S5P) && \ |
1305 | !IS_ENABLED(CONFIG_USB_EHCI_HCD_AT91) && \ | 1300 | !IS_ENABLED(CONFIG_USB_EHCI_HCD_AT91) && \ |
1301 | !IS_ENABLED(CONFIG_USB_EHCI_MSM) && \ | ||
1306 | !defined(PLATFORM_DRIVER) && \ | 1302 | !defined(PLATFORM_DRIVER) && \ |
1307 | !defined(PS3_SYSTEM_BUS_DRIVER) && \ | 1303 | !defined(PS3_SYSTEM_BUS_DRIVER) && \ |
1308 | !defined(OF_PLATFORM_DRIVER) && \ | 1304 | !defined(OF_PLATFORM_DRIVER) && \ |
diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c index ebf410311957..0f717dc688b7 100644 --- a/drivers/usb/host/ehci-msm.c +++ b/drivers/usb/host/ehci-msm.c | |||
@@ -22,16 +22,26 @@ | |||
22 | * along with this program; if not, you can find it at http://www.fsf.org | 22 | * along with this program; if not, you can find it at http://www.fsf.org |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <linux/platform_device.h> | ||
26 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
27 | #include <linux/err.h> | 26 | #include <linux/err.h> |
27 | #include <linux/io.h> | ||
28 | #include <linux/kernel.h> | ||
29 | #include <linux/module.h> | ||
30 | #include <linux/platform_device.h> | ||
28 | #include <linux/pm_runtime.h> | 31 | #include <linux/pm_runtime.h> |
29 | |||
30 | #include <linux/usb/otg.h> | 32 | #include <linux/usb/otg.h> |
31 | #include <linux/usb/msm_hsusb_hw.h> | 33 | #include <linux/usb/msm_hsusb_hw.h> |
34 | #include <linux/usb.h> | ||
35 | #include <linux/usb/hcd.h> | ||
36 | |||
37 | #include "ehci.h" | ||
32 | 38 | ||
33 | #define MSM_USB_BASE (hcd->regs) | 39 | #define MSM_USB_BASE (hcd->regs) |
34 | 40 | ||
41 | #define DRIVER_DESC "Qualcomm On-Chip EHCI Host Controller" | ||
42 | |||
43 | static const char hcd_name[] = "ehci-msm"; | ||
44 | static struct hc_driver __read_mostly msm_hc_driver; | ||
35 | static struct usb_phy *phy; | 45 | static struct usb_phy *phy; |
36 | 46 | ||
37 | static int ehci_msm_reset(struct usb_hcd *hcd) | 47 | static int ehci_msm_reset(struct usb_hcd *hcd) |
@@ -56,52 +66,6 @@ static int ehci_msm_reset(struct usb_hcd *hcd) | |||
56 | return 0; | 66 | return 0; |
57 | } | 67 | } |
58 | 68 | ||
59 | static struct hc_driver msm_hc_driver = { | ||
60 | .description = hcd_name, | ||
61 | .product_desc = "Qualcomm On-Chip EHCI Host Controller", | ||
62 | .hcd_priv_size = sizeof(struct ehci_hcd), | ||
63 | |||
64 | /* | ||
65 | * generic hardware linkage | ||
66 | */ | ||
67 | .irq = ehci_irq, | ||
68 | .flags = HCD_USB2 | HCD_MEMORY, | ||
69 | |||
70 | .reset = ehci_msm_reset, | ||
71 | .start = ehci_run, | ||
72 | |||
73 | .stop = ehci_stop, | ||
74 | .shutdown = ehci_shutdown, | ||
75 | |||
76 | /* | ||
77 | * managing i/o requests and associated device resources | ||
78 | */ | ||
79 | .urb_enqueue = ehci_urb_enqueue, | ||
80 | .urb_dequeue = ehci_urb_dequeue, | ||
81 | .endpoint_disable = ehci_endpoint_disable, | ||
82 | .endpoint_reset = ehci_endpoint_reset, | ||
83 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | ||
84 | |||
85 | /* | ||
86 | * scheduling support | ||
87 | */ | ||
88 | .get_frame_number = ehci_get_frame, | ||
89 | |||
90 | /* | ||
91 | * root hub support | ||
92 | */ | ||
93 | .hub_status_data = ehci_hub_status_data, | ||
94 | .hub_control = ehci_hub_control, | ||
95 | .relinquish_port = ehci_relinquish_port, | ||
96 | .port_handed_over = ehci_port_handed_over, | ||
97 | |||
98 | /* | ||
99 | * PM support | ||
100 | */ | ||
101 | .bus_suspend = ehci_bus_suspend, | ||
102 | .bus_resume = ehci_bus_resume, | ||
103 | }; | ||
104 | |||
105 | static int ehci_msm_probe(struct platform_device *pdev) | 69 | static int ehci_msm_probe(struct platform_device *pdev) |
106 | { | 70 | { |
107 | struct usb_hcd *hcd; | 71 | struct usb_hcd *hcd; |
@@ -165,6 +129,8 @@ static int ehci_msm_probe(struct platform_device *pdev) | |||
165 | pm_runtime_no_callbacks(&pdev->dev); | 129 | pm_runtime_no_callbacks(&pdev->dev); |
166 | pm_runtime_enable(&pdev->dev); | 130 | pm_runtime_enable(&pdev->dev); |
167 | 131 | ||
132 | /* FIXME: need to call usb_add_hcd() here? */ | ||
133 | |||
168 | return 0; | 134 | return 0; |
169 | 135 | ||
170 | put_hcd: | 136 | put_hcd: |
@@ -183,6 +149,8 @@ static int ehci_msm_remove(struct platform_device *pdev) | |||
183 | 149 | ||
184 | otg_set_host(phy->otg, NULL); | 150 | otg_set_host(phy->otg, NULL); |
185 | 151 | ||
152 | /* FIXME: need to call usb_remove_hcd() here? */ | ||
153 | |||
186 | usb_put_hcd(hcd); | 154 | usb_put_hcd(hcd); |
187 | 155 | ||
188 | return 0; | 156 | return 0; |
@@ -226,3 +194,28 @@ static struct platform_driver ehci_msm_driver = { | |||
226 | .pm = &ehci_msm_dev_pm_ops, | 194 | .pm = &ehci_msm_dev_pm_ops, |
227 | }, | 195 | }, |
228 | }; | 196 | }; |
197 | |||
198 | static const struct ehci_driver_overrides msm_overrides __initdata = { | ||
199 | .reset = ehci_msm_reset, | ||
200 | }; | ||
201 | |||
202 | static int __init ehci_msm_init(void) | ||
203 | { | ||
204 | if (usb_disabled()) | ||
205 | return -ENODEV; | ||
206 | |||
207 | pr_info("%s: " DRIVER_DESC "\n", hcd_name); | ||
208 | ehci_init_driver(&msm_hc_driver, &msm_overrides); | ||
209 | return platform_driver_register(&ehci_msm_driver); | ||
210 | } | ||
211 | module_init(ehci_msm_init); | ||
212 | |||
213 | static void __exit ehci_msm_cleanup(void) | ||
214 | { | ||
215 | platform_driver_unregister(&ehci_msm_driver); | ||
216 | } | ||
217 | module_exit(ehci_msm_cleanup); | ||
218 | |||
219 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
220 | MODULE_ALIAS("platform:msm-ehci"); | ||
221 | MODULE_LICENSE("GPL"); | ||