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