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