1 --- a/drivers/usb/host/ohci-ssb.c
2 +++ b/drivers/usb/host/ohci-ssb.c
5 #include <linux/ssb/ssb.h>
7 +extern int ssb_ehci_attach(struct ssb_device *dev, struct usb_hcd **hcd);
8 +extern void ssb_ehci_detach(struct ssb_device *dev, struct usb_hcd *hcd);
10 #define SSB_OHCI_TMSLOW_HOSTMODE (1 << 29)
12 @@ -24,6 +26,9 @@ struct ssb_ohci_device {
13 struct ohci_hcd ohci; /* _must_ be at the beginning. */
16 +#ifdef CONFIG_USB_EHCI_HCD_SSB
17 + struct usb_hcd *ehci_hcd;
22 @@ -92,6 +97,9 @@ static const struct hc_driver ssb_ohci_h
23 static void ssb_ohci_detach(struct ssb_device *dev)
25 struct usb_hcd *hcd = ssb_get_drvdata(dev);
26 +#ifdef CONFIG_USB_EHCI_HCD_SSB
27 + struct ssb_ohci_device *ohcidev = hcd_to_ssb_ohci(hcd);
30 if (hcd->driver->shutdown)
31 hcd->driver->shutdown(hcd);
32 @@ -99,6 +107,14 @@ static void ssb_ohci_detach(struct ssb_d
34 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
37 +#ifdef CONFIG_USB_EHCI_HCD_SSB
39 + * Also detach ehci function
41 + if (dev->id.coreid == SSB_DEV_USB20_HOST)
42 + ssb_ehci_detach(dev, ohcidev->ehci_hcd);
44 ssb_device_disable(dev, 0);
47 @@ -121,6 +137,9 @@ static int ssb_ohci_attach(struct ssb_de
49 * USB 2.0 special considerations:
51 + * Since the core supports both OHCI and EHCI functions,
52 + * it must only be reset once.
54 * In addition to the standard SSB reset sequence, the Host
55 * Control Register must be programmed to bring the USB core
56 * and various phy components out of reset.
57 @@ -175,6 +194,14 @@ static int ssb_ohci_attach(struct ssb_de
59 ssb_set_drvdata(dev, hcd);
61 +#ifdef CONFIG_USB_EHCI_HCD_SSB
63 + * attach ehci function in this core
65 + if (dev->id.coreid == SSB_DEV_USB20_HOST)
66 + err = ssb_ehci_attach(dev, &(ohcidev->ehci_hcd));
72 --- a/drivers/usb/host/ehci-ssb.c
73 +++ b/drivers/usb/host/ehci-ssb.c
74 @@ -106,10 +106,18 @@ static void ssb_ehci_detach(struct ssb_d
76 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
78 +#ifndef CONFIG_USB_OHCI_HCD_SSB
79 + ssb_device_disable(dev, 0);
81 ssb_device_disable(dev, 0);
83 +EXPORT_SYMBOL_GPL(ssb_ehci_detach);
85 +#ifndef CONFIG_USB_OHCI_HCD_SSB
86 static int ssb_ehci_attach(struct ssb_device *dev)
88 +static int ssb_ehci_attach(struct ssb_device *dev, struct usb_hcd **ehci_hcd)
91 struct ssb_ehci_device *ehcidev;
93 @@ -120,6 +128,7 @@ static int ssb_ehci_attach(struct ssb_de
94 dma_set_coherent_mask(dev->dma_dev, DMA_BIT_MASK(32)))
97 +#ifndef CONFIG_USB_OHCI_HCD_SSB
99 * USB 2.0 special considerations:
101 @@ -155,6 +164,7 @@ static int ssb_ehci_attach(struct ssb_de
103 ssb_write32(dev, 0x89c, tmp);
107 hcd = usb_create_hcd(&ssb_ehci_hc_driver, dev->dev,
109 @@ -175,7 +185,11 @@ static int ssb_ehci_attach(struct ssb_de
113 +#ifndef CONFIG_USB_OHCI_HCD_SSB
114 ssb_set_drvdata(dev, hcd);
121 @@ -187,7 +201,9 @@ err_dev_disable:
122 ssb_device_disable(dev, 0);
125 +EXPORT_SYMBOL_GPL(ssb_ehci_attach);
127 +#ifndef CONFIG_USB_OHCI_HCD_SSB
128 static int ssb_ehci_probe(struct ssb_device *dev,
129 const struct ssb_device_id *id)
131 @@ -238,6 +254,7 @@ static int ssb_ehci_resume(struct ssb_de
132 #define ssb_ehci_suspend NULL
133 #define ssb_ehci_resume NULL
134 #endif /* CONFIG_PM */
135 +#endif /* !CONFIG_USB_OHCI_HCD_SSB */
137 static const struct ssb_device_id ssb_ehci_table[] = {
138 SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB20_HOST, SSB_ANY_REV),
139 @@ -245,6 +262,8 @@ static const struct ssb_device_id ssb_eh
141 MODULE_DEVICE_TABLE(ssb, ssb_ehci_table);
144 +#ifndef CONFIG_USB_OHCI_HCD_SSB
145 static struct ssb_driver ssb_ehci_driver = {
146 .name = KBUILD_MODNAME,
147 .id_table = ssb_ehci_table,
148 @@ -253,3 +272,4 @@ static struct ssb_driver ssb_ehci_driver
149 .suspend = ssb_ehci_suspend,
150 .resume = ssb_ehci_resume,
153 --- a/drivers/usb/host/ehci-hcd.c
154 +++ b/drivers/usb/host/ehci-hcd.c
155 @@ -1322,17 +1322,21 @@ static int __init ehci_hcd_init(void)
159 +#ifndef CONFIG_USB_OHCI_HCD_SSB
160 #ifdef SSB_EHCI_DRIVER
161 retval = ssb_driver_register(&SSB_EHCI_DRIVER);
165 +#endif /* !CONFIG_USB_OHCI_HCD_SSB */
168 +#ifndef CONFIG_USB_OHCI_HCD_SSB
169 #ifdef SSB_EHCI_DRIVER
170 /* ssb_driver_unregister(&SSB_EHCI_DRIVER); */
173 +#endif /* !CONFIG_USB_OHCI_HCD_SSB */
174 #ifdef XILINX_OF_PLATFORM_DRIVER
175 of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER);
177 @@ -1365,9 +1369,11 @@ module_init(ehci_hcd_init);
179 static void __exit ehci_hcd_cleanup(void)
181 +#ifndef CONFIG_USB_OHCI_HCD_SSB
182 #ifdef SSB_EHCI_DRIVER
183 ssb_driver_unregister(&SSB_EHCI_DRIVER);
185 +#endif /* !CONFIG_USB_OHCI_HCD_SSB */
186 #ifdef XILINX_OF_PLATFORM_DRIVER
187 of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER);