imagebuilder: fix parallel building (closes #11117)
[openwrt.git] / target / linux / brcm47xx / patches-3.2 / 186-USB-OHCI-remove-old-SSB-OHCI-driver.patch
1 From 57857d7df6c22eaf11e3c67042d55a9546415059 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Sat, 26 Nov 2011 21:36:50 +0100
4 Subject: [PATCH 186/186] USB: OHCI: remove old SSB OHCI driver
5
6 This is now replaced by the new ssb USB driver, which also supports
7 devices with an EHCI controller.
8
9 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
10 ---
11 drivers/usb/host/Kconfig | 13 --
12 drivers/usb/host/ohci-hcd.c | 21 +----
13 drivers/usb/host/ohci-ssb.c | 260 -------------------------------------------
14 3 files changed, 1 insertions(+), 293 deletions(-)
15 delete mode 100644 drivers/usb/host/ohci-ssb.c
16
17 --- a/drivers/usb/host/Kconfig
18 +++ b/drivers/usb/host/Kconfig
19 @@ -351,19 +351,6 @@ config USB_OHCI_HCD_PCI
20 Enables support for PCI-bus plug-in USB controller cards.
21 If unsure, say Y.
22
23 -config USB_OHCI_HCD_SSB
24 - bool "OHCI support for Broadcom SSB OHCI core"
25 - depends on USB_OHCI_HCD && (SSB = y || SSB = USB_OHCI_HCD) && EXPERIMENTAL
26 - default n
27 - ---help---
28 - Support for the Sonics Silicon Backplane (SSB) attached
29 - Broadcom USB OHCI core.
30 -
31 - This device is present in some embedded devices with
32 - Broadcom based SSB bus.
33 -
34 - If unsure, say N.
35 -
36 config USB_OHCI_SH
37 bool "OHCI support for SuperH USB controller"
38 depends on USB_OHCI_HCD && SUPERH
39 --- a/drivers/usb/host/ohci-hcd.c
40 +++ b/drivers/usb/host/ohci-hcd.c
41 @@ -1076,11 +1076,6 @@ MODULE_LICENSE ("GPL");
42 #define PS3_SYSTEM_BUS_DRIVER ps3_ohci_driver
43 #endif
44
45 -#ifdef CONFIG_USB_OHCI_HCD_SSB
46 -#include "ohci-ssb.c"
47 -#define SSB_OHCI_DRIVER ssb_ohci_driver
48 -#endif
49 -
50 #ifdef CONFIG_MFD_SM501
51 #include "ohci-sm501.c"
52 #define SM501_OHCI_DRIVER ohci_hcd_sm501_driver
53 @@ -1129,8 +1124,7 @@ MODULE_LICENSE ("GPL");
54 !defined(SA1111_DRIVER) && \
55 !defined(PS3_SYSTEM_BUS_DRIVER) && \
56 !defined(SM501_OHCI_DRIVER) && \
57 - !defined(TMIO_OHCI_DRIVER) && \
58 - !defined(SSB_OHCI_DRIVER)
59 + !defined(TMIO_OHCI_DRIVER)
60 #error "missing bus glue for ohci-hcd"
61 #endif
62
63 @@ -1196,12 +1190,6 @@ static int __init ohci_hcd_mod_init(void
64 goto error_pci;
65 #endif
66
67 -#ifdef SSB_OHCI_DRIVER
68 - retval = ssb_driver_register(&SSB_OHCI_DRIVER);
69 - if (retval)
70 - goto error_ssb;
71 -#endif
72 -
73 #ifdef SM501_OHCI_DRIVER
74 retval = platform_driver_register(&SM501_OHCI_DRIVER);
75 if (retval < 0)
76 @@ -1225,10 +1213,6 @@ static int __init ohci_hcd_mod_init(void
77 platform_driver_unregister(&SM501_OHCI_DRIVER);
78 error_sm501:
79 #endif
80 -#ifdef SSB_OHCI_DRIVER
81 - ssb_driver_unregister(&SSB_OHCI_DRIVER);
82 - error_ssb:
83 -#endif
84 #ifdef PCI_DRIVER
85 pci_unregister_driver(&PCI_DRIVER);
86 error_pci:
87 @@ -1276,9 +1260,6 @@ static void __exit ohci_hcd_mod_exit(voi
88 #ifdef SM501_OHCI_DRIVER
89 platform_driver_unregister(&SM501_OHCI_DRIVER);
90 #endif
91 -#ifdef SSB_OHCI_DRIVER
92 - ssb_driver_unregister(&SSB_OHCI_DRIVER);
93 -#endif
94 #ifdef PCI_DRIVER
95 pci_unregister_driver(&PCI_DRIVER);
96 #endif
97 --- a/drivers/usb/host/ohci-ssb.c
98 +++ /dev/null
99 @@ -1,260 +0,0 @@
100 -/*
101 - * Sonics Silicon Backplane
102 - * Broadcom USB-core OHCI driver
103 - *
104 - * Copyright 2007 Michael Buesch <m@bues.ch>
105 - *
106 - * Derived from the OHCI-PCI driver
107 - * Copyright 1999 Roman Weissgaerber
108 - * Copyright 2000-2002 David Brownell
109 - * Copyright 1999 Linus Torvalds
110 - * Copyright 1999 Gregory P. Smith
111 - *
112 - * Derived from the USBcore related parts of Broadcom-SB
113 - * Copyright 2005 Broadcom Corporation
114 - *
115 - * Licensed under the GNU/GPL. See COPYING for details.
116 - */
117 -#include <linux/ssb/ssb.h>
118 -
119 -
120 -#define SSB_OHCI_TMSLOW_HOSTMODE (1 << 29)
121 -
122 -struct ssb_ohci_device {
123 - struct ohci_hcd ohci; /* _must_ be at the beginning. */
124 -
125 - u32 enable_flags;
126 -};
127 -
128 -static inline
129 -struct ssb_ohci_device *hcd_to_ssb_ohci(struct usb_hcd *hcd)
130 -{
131 - return (struct ssb_ohci_device *)(hcd->hcd_priv);
132 -}
133 -
134 -
135 -static int ssb_ohci_reset(struct usb_hcd *hcd)
136 -{
137 - struct ssb_ohci_device *ohcidev = hcd_to_ssb_ohci(hcd);
138 - struct ohci_hcd *ohci = &ohcidev->ohci;
139 - int err;
140 -
141 - ohci_hcd_init(ohci);
142 - err = ohci_init(ohci);
143 -
144 - return err;
145 -}
146 -
147 -static int ssb_ohci_start(struct usb_hcd *hcd)
148 -{
149 - struct ssb_ohci_device *ohcidev = hcd_to_ssb_ohci(hcd);
150 - struct ohci_hcd *ohci = &ohcidev->ohci;
151 - int err;
152 -
153 - err = ohci_run(ohci);
154 - if (err < 0) {
155 - ohci_err(ohci, "can't start\n");
156 - ohci_stop(hcd);
157 - }
158 -
159 - return err;
160 -}
161 -
162 -static const struct hc_driver ssb_ohci_hc_driver = {
163 - .description = "ssb-usb-ohci",
164 - .product_desc = "SSB OHCI Controller",
165 - .hcd_priv_size = sizeof(struct ssb_ohci_device),
166 -
167 - .irq = ohci_irq,
168 - .flags = HCD_MEMORY | HCD_USB11,
169 -
170 - .reset = ssb_ohci_reset,
171 - .start = ssb_ohci_start,
172 - .stop = ohci_stop,
173 - .shutdown = ohci_shutdown,
174 -
175 - .urb_enqueue = ohci_urb_enqueue,
176 - .urb_dequeue = ohci_urb_dequeue,
177 - .endpoint_disable = ohci_endpoint_disable,
178 -
179 - .get_frame_number = ohci_get_frame,
180 -
181 - .hub_status_data = ohci_hub_status_data,
182 - .hub_control = ohci_hub_control,
183 -#ifdef CONFIG_PM
184 - .bus_suspend = ohci_bus_suspend,
185 - .bus_resume = ohci_bus_resume,
186 -#endif
187 -
188 - .start_port_reset = ohci_start_port_reset,
189 -};
190 -
191 -static void ssb_ohci_detach(struct ssb_device *dev)
192 -{
193 - struct usb_hcd *hcd = ssb_get_drvdata(dev);
194 -
195 - if (hcd->driver->shutdown)
196 - hcd->driver->shutdown(hcd);
197 - usb_remove_hcd(hcd);
198 - iounmap(hcd->regs);
199 - release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
200 - usb_put_hcd(hcd);
201 - ssb_device_disable(dev, 0);
202 -}
203 -
204 -static int ssb_ohci_attach(struct ssb_device *dev)
205 -{
206 - struct ssb_ohci_device *ohcidev;
207 - struct usb_hcd *hcd;
208 - int err = -ENOMEM;
209 - u32 tmp, flags = 0;
210 -
211 - if (dma_set_mask(dev->dma_dev, DMA_BIT_MASK(32)) ||
212 - dma_set_coherent_mask(dev->dma_dev, DMA_BIT_MASK(32)))
213 - return -EOPNOTSUPP;
214 -
215 - if (dev->id.coreid == SSB_DEV_USB11_HOSTDEV) {
216 - /* Put the device into host-mode. */
217 - flags |= SSB_OHCI_TMSLOW_HOSTMODE;
218 - ssb_device_enable(dev, flags);
219 - } else if (dev->id.coreid == SSB_DEV_USB20_HOST) {
220 - /*
221 - * USB 2.0 special considerations:
222 - *
223 - * In addition to the standard SSB reset sequence, the Host
224 - * Control Register must be programmed to bring the USB core
225 - * and various phy components out of reset.
226 - */
227 - ssb_device_enable(dev, 0);
228 - ssb_write32(dev, 0x200, 0x7ff);
229 -
230 - /* Change Flush control reg */
231 - tmp = ssb_read32(dev, 0x400);
232 - tmp &= ~8;
233 - ssb_write32(dev, 0x400, tmp);
234 - tmp = ssb_read32(dev, 0x400);
235 -
236 - /* Change Shim control reg */
237 - tmp = ssb_read32(dev, 0x304);
238 - tmp &= ~0x100;
239 - ssb_write32(dev, 0x304, tmp);
240 - tmp = ssb_read32(dev, 0x304);
241 -
242 - udelay(1);
243 -
244 - /* Work around for 5354 failures */
245 - if (dev->id.revision == 2 && dev->bus->chip_id == 0x5354) {
246 - /* Change syn01 reg */
247 - tmp = 0x00fe00fe;
248 - ssb_write32(dev, 0x894, tmp);
249 -
250 - /* Change syn03 reg */
251 - tmp = ssb_read32(dev, 0x89c);
252 - tmp |= 0x1;
253 - ssb_write32(dev, 0x89c, tmp);
254 - }
255 - } else
256 - ssb_device_enable(dev, 0);
257 -
258 - hcd = usb_create_hcd(&ssb_ohci_hc_driver, dev->dev,
259 - dev_name(dev->dev));
260 - if (!hcd)
261 - goto err_dev_disable;
262 - ohcidev = hcd_to_ssb_ohci(hcd);
263 - ohcidev->enable_flags = flags;
264 -
265 - tmp = ssb_read32(dev, SSB_ADMATCH0);
266 - hcd->rsrc_start = ssb_admatch_base(tmp);
267 - hcd->rsrc_len = ssb_admatch_size(tmp);
268 - hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);
269 - if (!hcd->regs)
270 - goto err_put_hcd;
271 - err = usb_add_hcd(hcd, dev->irq, IRQF_SHARED);
272 - if (err)
273 - goto err_iounmap;
274 -
275 - ssb_set_drvdata(dev, hcd);
276 -
277 - return err;
278 -
279 -err_iounmap:
280 - iounmap(hcd->regs);
281 -err_put_hcd:
282 - usb_put_hcd(hcd);
283 -err_dev_disable:
284 - ssb_device_disable(dev, flags);
285 - return err;
286 -}
287 -
288 -static int ssb_ohci_probe(struct ssb_device *dev,
289 - const struct ssb_device_id *id)
290 -{
291 - int err;
292 - u16 chipid_top;
293 -
294 - /* USBcores are only connected on embedded devices. */
295 - chipid_top = (dev->bus->chip_id & 0xFF00);
296 - if (chipid_top != 0x4700 && chipid_top != 0x5300)
297 - return -ENODEV;
298 -
299 - /* TODO: Probably need checks here; is the core connected? */
300 -
301 - if (usb_disabled())
302 - return -ENODEV;
303 -
304 - /* We currently always attach SSB_DEV_USB11_HOSTDEV
305 - * as HOST OHCI. If we want to attach it as Client device,
306 - * we must branch here and call into the (yet to
307 - * be written) Client mode driver. Same for remove(). */
308 -
309 - err = ssb_ohci_attach(dev);
310 -
311 - return err;
312 -}
313 -
314 -static void ssb_ohci_remove(struct ssb_device *dev)
315 -{
316 - ssb_ohci_detach(dev);
317 -}
318 -
319 -#ifdef CONFIG_PM
320 -
321 -static int ssb_ohci_suspend(struct ssb_device *dev, pm_message_t state)
322 -{
323 - ssb_device_disable(dev, 0);
324 -
325 - return 0;
326 -}
327 -
328 -static int ssb_ohci_resume(struct ssb_device *dev)
329 -{
330 - struct usb_hcd *hcd = ssb_get_drvdata(dev);
331 - struct ssb_ohci_device *ohcidev = hcd_to_ssb_ohci(hcd);
332 -
333 - ssb_device_enable(dev, ohcidev->enable_flags);
334 -
335 - ohci_finish_controller_resume(hcd);
336 - return 0;
337 -}
338 -
339 -#else /* !CONFIG_PM */
340 -#define ssb_ohci_suspend NULL
341 -#define ssb_ohci_resume NULL
342 -#endif /* CONFIG_PM */
343 -
344 -static const struct ssb_device_id ssb_ohci_table[] = {
345 - SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB11_HOSTDEV, SSB_ANY_REV),
346 - SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB11_HOST, SSB_ANY_REV),
347 - SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB20_HOST, SSB_ANY_REV),
348 - SSB_DEVTABLE_END
349 -};
350 -MODULE_DEVICE_TABLE(ssb, ssb_ohci_table);
351 -
352 -static struct ssb_driver ssb_ohci_driver = {
353 - .name = KBUILD_MODNAME,
354 - .id_table = ssb_ohci_table,
355 - .probe = ssb_ohci_probe,
356 - .remove = ssb_ohci_remove,
357 - .suspend = ssb_ohci_suspend,
358 - .resume = ssb_ohci_resume,
359 -};
This page took 0.079667 seconds and 5 git commands to generate.