diff options
Diffstat (limited to 'drivers/usb/host')
-rw-r--r-- | drivers/usb/host/ohci-at91.c | 3 | ||||
-rw-r--r-- | drivers/usb/host/ohci-au1xxx.c | 4 | ||||
-rw-r--r-- | drivers/usb/host/ohci-dbg.c | 8 | ||||
-rw-r--r-- | drivers/usb/host/ohci-ep93xx.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ohci-hcd.c | 110 | ||||
-rw-r--r-- | drivers/usb/host/ohci-hub.c | 21 | ||||
-rw-r--r-- | drivers/usb/host/ohci-lh7a404.c | 8 | ||||
-rw-r--r-- | drivers/usb/host/ohci-mem.c | 10 | ||||
-rw-r--r-- | drivers/usb/host/ohci-omap.c | 4 | ||||
-rw-r--r-- | drivers/usb/host/ohci-pci.c | 16 | ||||
-rw-r--r-- | drivers/usb/host/ohci-pnx4008.c | 4 | ||||
-rw-r--r-- | drivers/usb/host/ohci-pnx8550.c | 258 | ||||
-rw-r--r-- | drivers/usb/host/ohci-ppc-soc.c | 8 | ||||
-rw-r--r-- | drivers/usb/host/ohci-pxa27x.c | 10 | ||||
-rw-r--r-- | drivers/usb/host/ohci-q.c | 103 | ||||
-rw-r--r-- | drivers/usb/host/ohci-s3c2410.c | 4 | ||||
-rw-r--r-- | drivers/usb/host/ohci-sa1111.c | 8 | ||||
-rw-r--r-- | drivers/usb/host/ohci.h | 92 | ||||
-rw-r--r-- | drivers/usb/host/u132-hcd.c | 92 | ||||
-rw-r--r-- | drivers/usb/host/uhci-hcd.c | 13 | ||||
-rw-r--r-- | drivers/usb/host/uhci-hub.c | 14 |
21 files changed, 497 insertions, 295 deletions
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index b466581beb4a..cc405512fa1c 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -187,7 +187,6 @@ ohci_at91_start (struct usb_hcd *hcd) | |||
187 | { | 187 | { |
188 | struct at91_usbh_data *board = hcd->self.controller->platform_data; | 188 | struct at91_usbh_data *board = hcd->self.controller->platform_data; |
189 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | 189 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); |
190 | struct usb_device *root = hcd->self.root_hub; | ||
191 | int ret; | 190 | int ret; |
192 | 191 | ||
193 | if ((ret = ohci_init(ohci)) < 0) | 192 | if ((ret = ohci_init(ohci)) < 0) |
@@ -221,7 +220,7 @@ static const struct hc_driver ohci_at91_hc_driver = { | |||
221 | */ | 220 | */ |
222 | .start = ohci_at91_start, | 221 | .start = ohci_at91_start, |
223 | .stop = ohci_stop, | 222 | .stop = ohci_stop, |
224 | .shutdown = ohci_shutdown, | 223 | .shutdown = ohci_shutdown, |
225 | 224 | ||
226 | /* | 225 | /* |
227 | * managing i/o requests and associated device resources | 226 | * managing i/o requests and associated device resources |
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c index 24e23c5783d8..e70b2430e2a9 100644 --- a/drivers/usb/host/ohci-au1xxx.c +++ b/drivers/usb/host/ohci-au1xxx.c | |||
@@ -269,7 +269,7 @@ static const struct hc_driver ohci_au1xxx_hc_driver = { | |||
269 | */ | 269 | */ |
270 | .start = ohci_au1xxx_start, | 270 | .start = ohci_au1xxx_start, |
271 | .stop = ohci_stop, | 271 | .stop = ohci_stop, |
272 | .shutdown = ohci_shutdown, | 272 | .shutdown = ohci_shutdown, |
273 | 273 | ||
274 | /* | 274 | /* |
275 | * managing i/o requests and associated device resources | 275 | * managing i/o requests and associated device resources |
@@ -336,7 +336,7 @@ static int ohci_hcd_au1xxx_drv_resume(struct platform_device *dev) | |||
336 | static struct platform_driver ohci_hcd_au1xxx_driver = { | 336 | static struct platform_driver ohci_hcd_au1xxx_driver = { |
337 | .probe = ohci_hcd_au1xxx_drv_probe, | 337 | .probe = ohci_hcd_au1xxx_drv_probe, |
338 | .remove = ohci_hcd_au1xxx_drv_remove, | 338 | .remove = ohci_hcd_au1xxx_drv_remove, |
339 | .shutdown = usb_hcd_platform_shutdown, | 339 | .shutdown = usb_hcd_platform_shutdown, |
340 | /*.suspend = ohci_hcd_au1xxx_drv_suspend, */ | 340 | /*.suspend = ohci_hcd_au1xxx_drv_suspend, */ |
341 | /*.resume = ohci_hcd_au1xxx_drv_resume, */ | 341 | /*.resume = ohci_hcd_au1xxx_drv_resume, */ |
342 | .driver = { | 342 | .driver = { |
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c index 0f47a57dac28..273d5ddb72be 100644 --- a/drivers/usb/host/ohci-dbg.c +++ b/drivers/usb/host/ohci-dbg.c | |||
@@ -16,7 +16,7 @@ | |||
16 | case PIPE_CONTROL: temp = "ctrl"; break; \ | 16 | case PIPE_CONTROL: temp = "ctrl"; break; \ |
17 | case PIPE_BULK: temp = "bulk"; break; \ | 17 | case PIPE_BULK: temp = "bulk"; break; \ |
18 | case PIPE_INTERRUPT: temp = "intr"; break; \ | 18 | case PIPE_INTERRUPT: temp = "intr"; break; \ |
19 | default: temp = "isoc"; break; \ | 19 | default: temp = "isoc"; break; \ |
20 | }; temp;}) | 20 | }; temp;}) |
21 | #define pipestring(pipe) edstring(usb_pipetype(pipe)) | 21 | #define pipestring(pipe) edstring(usb_pipetype(pipe)) |
22 | 22 | ||
@@ -205,13 +205,13 @@ ohci_dump_status (struct ohci_hcd *controller, char **next, unsigned *size) | |||
205 | (temp & RH_PS_PSSC) ? " PSSC" : "", \ | 205 | (temp & RH_PS_PSSC) ? " PSSC" : "", \ |
206 | (temp & RH_PS_PESC) ? " PESC" : "", \ | 206 | (temp & RH_PS_PESC) ? " PESC" : "", \ |
207 | (temp & RH_PS_CSC) ? " CSC" : "", \ | 207 | (temp & RH_PS_CSC) ? " CSC" : "", \ |
208 | \ | 208 | \ |
209 | (temp & RH_PS_LSDA) ? " LSDA" : "", \ | 209 | (temp & RH_PS_LSDA) ? " LSDA" : "", \ |
210 | (temp & RH_PS_PPS) ? " PPS" : "", \ | 210 | (temp & RH_PS_PPS) ? " PPS" : "", \ |
211 | (temp & RH_PS_PRS) ? " PRS" : "", \ | 211 | (temp & RH_PS_PRS) ? " PRS" : "", \ |
212 | (temp & RH_PS_POCI) ? " POCI" : "", \ | 212 | (temp & RH_PS_POCI) ? " POCI" : "", \ |
213 | (temp & RH_PS_PSS) ? " PSS" : "", \ | 213 | (temp & RH_PS_PSS) ? " PSS" : "", \ |
214 | \ | 214 | \ |
215 | (temp & RH_PS_PES) ? " PES" : "", \ | 215 | (temp & RH_PS_PES) ? " PES" : "", \ |
216 | (temp & RH_PS_CCS) ? " CCS" : "" \ | 216 | (temp & RH_PS_CCS) ? " CCS" : "" \ |
217 | ); | 217 | ); |
@@ -563,7 +563,7 @@ show_periodic (struct class_device *class_dev, char *buf) | |||
563 | (info & ED_SKIP) ? " K" : "", | 563 | (info & ED_SKIP) ? " K" : "", |
564 | (ed->hwHeadP & | 564 | (ed->hwHeadP & |
565 | cpu_to_hc32(ohci, ED_H)) ? | 565 | cpu_to_hc32(ohci, ED_H)) ? |
566 | " H" : ""); | 566 | " H" : ""); |
567 | size -= temp; | 567 | size -= temp; |
568 | next += temp; | 568 | next += temp; |
569 | 569 | ||
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c index 1bf5e7a4e735..43ae696b2ec2 100644 --- a/drivers/usb/host/ohci-ep93xx.c +++ b/drivers/usb/host/ohci-ep93xx.c | |||
@@ -204,7 +204,7 @@ static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev) | |||
204 | static struct platform_driver ohci_hcd_ep93xx_driver = { | 204 | static struct platform_driver ohci_hcd_ep93xx_driver = { |
205 | .probe = ohci_hcd_ep93xx_drv_probe, | 205 | .probe = ohci_hcd_ep93xx_drv_probe, |
206 | .remove = ohci_hcd_ep93xx_drv_remove, | 206 | .remove = ohci_hcd_ep93xx_drv_remove, |
207 | .shutdown = usb_hcd_platform_shutdown, | 207 | .shutdown = usb_hcd_platform_shutdown, |
208 | #ifdef CONFIG_PM | 208 | #ifdef CONFIG_PM |
209 | .suspend = ohci_hcd_ep93xx_drv_suspend, | 209 | .suspend = ohci_hcd_ep93xx_drv_suspend, |
210 | .resume = ohci_hcd_ep93xx_drv_resume, | 210 | .resume = ohci_hcd_ep93xx_drv_resume, |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index b28a9b602066..c1c1d871aba4 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -3,77 +3,21 @@ | |||
3 | * | 3 | * |
4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> | 4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> |
5 | * (C) Copyright 2000-2004 David Brownell <dbrownell@users.sourceforge.net> | 5 | * (C) Copyright 2000-2004 David Brownell <dbrownell@users.sourceforge.net> |
6 | * | 6 | * |
7 | * [ Initialisation is based on Linus' ] | 7 | * [ Initialisation is based on Linus' ] |
8 | * [ uhci code and gregs ohci fragments ] | 8 | * [ uhci code and gregs ohci fragments ] |
9 | * [ (C) Copyright 1999 Linus Torvalds ] | 9 | * [ (C) Copyright 1999 Linus Torvalds ] |
10 | * [ (C) Copyright 1999 Gregory P. Smith] | 10 | * [ (C) Copyright 1999 Gregory P. Smith] |
11 | * | 11 | * |
12 | * | 12 | * |
13 | * OHCI is the main "non-Intel/VIA" standard for USB 1.1 host controller | 13 | * OHCI is the main "non-Intel/VIA" standard for USB 1.1 host controller |
14 | * interfaces (though some non-x86 Intel chips use it). It supports | 14 | * interfaces (though some non-x86 Intel chips use it). It supports |
15 | * smarter hardware than UHCI. A download link for the spec available | 15 | * smarter hardware than UHCI. A download link for the spec available |
16 | * through the http://www.usb.org website. | 16 | * through the http://www.usb.org website. |
17 | * | 17 | * |
18 | * History: | ||
19 | * | ||
20 | * 2004/03/24 LH7A404 support (Durgesh Pattamatta & Marc Singer) | ||
21 | * 2004/02/04 use generic dma_* functions instead of pci_* (dsaxena@plexity.net) | ||
22 | * 2003/02/24 show registers in sysfs (Kevin Brosius) | ||
23 | * | ||
24 | * 2002/09/03 get rid of ed hashtables, rework periodic scheduling and | ||
25 | * bandwidth accounting; if debugging, show schedules in driverfs | ||
26 | * 2002/07/19 fixes to management of ED and schedule state. | ||
27 | * 2002/06/09 SA-1111 support (Christopher Hoover) | ||
28 | * 2002/06/01 remember frame when HC won't see EDs any more; use that info | ||
29 | * to fix urb unlink races caused by interrupt latency assumptions; | ||
30 | * minor ED field and function naming updates | ||
31 | * 2002/01/18 package as a patch for 2.5.3; this should match the | ||
32 | * 2.4.17 kernel modulo some bugs being fixed. | ||
33 | * | ||
34 | * 2001/10/18 merge pmac cleanup (Benjamin Herrenschmidt) and bugfixes | ||
35 | * from post-2.4.5 patches. | ||
36 | * 2001/09/20 URB_ZERO_PACKET support; hcca_dma portability, OPTi warning | ||
37 | * 2001/09/07 match PCI PM changes, errnos from Linus' tree | ||
38 | * 2001/05/05 fork 2.4.5 version into "hcd" framework, cleanup, simplify; | ||
39 | * pbook pci quirks gone (please fix pbook pci sw!) (db) | ||
40 | * | ||
41 | * 2001/04/08 Identify version on module load (gb) | ||
42 | * 2001/03/24 td/ed hashing to remove bus_to_virt (Steve Longerbeam); | ||
43 | pci_map_single (db) | ||
44 | * 2001/03/21 td and dev/ed allocation uses new pci_pool API (db) | ||
45 | * 2001/03/07 hcca allocation uses pci_alloc_consistent (Steve Longerbeam) | ||
46 | * | ||
47 | * 2000/09/26 fixed races in removing the private portion of the urb | ||
48 | * 2000/09/07 disable bulk and control lists when unlinking the last | ||
49 | * endpoint descriptor in order to avoid unrecoverable errors on | ||
50 | * the Lucent chips. (rwc@sgi) | ||
51 | * 2000/08/29 use bandwidth claiming hooks (thanks Randy!), fix some | ||
52 | * urb unlink probs, indentation fixes | ||
53 | * 2000/08/11 various oops fixes mostly affecting iso and cleanup from | ||
54 | * device unplugs. | ||
55 | * 2000/06/28 use PCI hotplug framework, for better power management | ||
56 | * and for Cardbus support (David Brownell) | ||
57 | * 2000/earlier: fixes for NEC/Lucent chips; suspend/resume handling | ||
58 | * when the controller loses power; handle UE; cleanup; ... | ||
59 | * | ||
60 | * v5.2 1999/12/07 URB 3rd preview, | ||
61 | * v5.1 1999/11/30 URB 2nd preview, cpia, (usb-scsi) | ||
62 | * v5.0 1999/11/22 URB Technical preview, Paul Mackerras powerbook susp/resume | ||
63 | * i386: HUB, Keyboard, Mouse, Printer | ||
64 | * | ||
65 | * v4.3 1999/10/27 multiple HCs, bulk_request | ||
66 | * v4.2 1999/09/05 ISO API alpha, new dev alloc, neg Error-codes | ||
67 | * v4.1 1999/08/27 Randy Dunlap's - ISO API first impl. | ||
68 | * v4.0 1999/08/18 | ||
69 | * v3.0 1999/06/25 | ||
70 | * v2.1 1999/05/09 code clean up | ||
71 | * v2.0 1999/05/04 | ||
72 | * v1.0 1999/04/27 initial release | ||
73 | * | ||
74 | * This file is licenced under the GPL. | 18 | * This file is licenced under the GPL. |
75 | */ | 19 | */ |
76 | 20 | ||
77 | #include <linux/module.h> | 21 | #include <linux/module.h> |
78 | #include <linux/moduleparam.h> | 22 | #include <linux/moduleparam.h> |
79 | #include <linux/pci.h> | 23 | #include <linux/pci.h> |
@@ -89,7 +33,7 @@ | |||
89 | #include <linux/list.h> | 33 | #include <linux/list.h> |
90 | #include <linux/usb.h> | 34 | #include <linux/usb.h> |
91 | #include <linux/usb/otg.h> | 35 | #include <linux/usb/otg.h> |
92 | #include <linux/dma-mapping.h> | 36 | #include <linux/dma-mapping.h> |
93 | #include <linux/dmapool.h> | 37 | #include <linux/dmapool.h> |
94 | #include <linux/reboot.h> | 38 | #include <linux/reboot.h> |
95 | 39 | ||
@@ -183,11 +127,11 @@ static int ohci_urb_enqueue ( | |||
183 | int i, size = 0; | 127 | int i, size = 0; |
184 | unsigned long flags; | 128 | unsigned long flags; |
185 | int retval = 0; | 129 | int retval = 0; |
186 | 130 | ||
187 | #ifdef OHCI_VERBOSE_DEBUG | 131 | #ifdef OHCI_VERBOSE_DEBUG |
188 | urb_print (urb, "SUB", usb_pipein (pipe)); | 132 | urb_print (urb, "SUB", usb_pipein (pipe)); |
189 | #endif | 133 | #endif |
190 | 134 | ||
191 | /* every endpoint has a ed, locate and maybe (re)initialize it */ | 135 | /* every endpoint has a ed, locate and maybe (re)initialize it */ |
192 | if (! (ed = ed_get (ohci, ep, urb->dev, pipe, urb->interval))) | 136 | if (! (ed = ed_get (ohci, ep, urb->dev, pipe, urb->interval))) |
193 | return -ENOMEM; | 137 | return -ENOMEM; |
@@ -232,7 +176,7 @@ static int ohci_urb_enqueue ( | |||
232 | memset (urb_priv, 0, sizeof (urb_priv_t) + size * sizeof (struct td *)); | 176 | memset (urb_priv, 0, sizeof (urb_priv_t) + size * sizeof (struct td *)); |
233 | INIT_LIST_HEAD (&urb_priv->pending); | 177 | INIT_LIST_HEAD (&urb_priv->pending); |
234 | urb_priv->length = size; | 178 | urb_priv->length = size; |
235 | urb_priv->ed = ed; | 179 | urb_priv->ed = ed; |
236 | 180 | ||
237 | /* allocate the TDs (deferring hash chain updates) */ | 181 | /* allocate the TDs (deferring hash chain updates) */ |
238 | for (i = 0; i < size; i++) { | 182 | for (i = 0; i < size; i++) { |
@@ -242,7 +186,7 @@ static int ohci_urb_enqueue ( | |||
242 | urb_free_priv (ohci, urb_priv); | 186 | urb_free_priv (ohci, urb_priv); |
243 | return -ENOMEM; | 187 | return -ENOMEM; |
244 | } | 188 | } |
245 | } | 189 | } |
246 | 190 | ||
247 | spin_lock_irqsave (&ohci->lock, flags); | 191 | spin_lock_irqsave (&ohci->lock, flags); |
248 | 192 | ||
@@ -313,13 +257,13 @@ static int ohci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb) | |||
313 | { | 257 | { |
314 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | 258 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); |
315 | unsigned long flags; | 259 | unsigned long flags; |
316 | 260 | ||
317 | #ifdef OHCI_VERBOSE_DEBUG | 261 | #ifdef OHCI_VERBOSE_DEBUG |
318 | urb_print (urb, "UNLINK", 1); | 262 | urb_print (urb, "UNLINK", 1); |
319 | #endif | 263 | #endif |
320 | 264 | ||
321 | spin_lock_irqsave (&ohci->lock, flags); | 265 | spin_lock_irqsave (&ohci->lock, flags); |
322 | if (HC_IS_RUNNING(hcd->state)) { | 266 | if (HC_IS_RUNNING(hcd->state)) { |
323 | urb_priv_t *urb_priv; | 267 | urb_priv_t *urb_priv; |
324 | 268 | ||
325 | /* Unless an IRQ completed the unlink while it was being | 269 | /* Unless an IRQ completed the unlink while it was being |
@@ -512,11 +456,11 @@ static int ohci_init (struct ohci_hcd *ohci) | |||
512 | 456 | ||
513 | /* Start an OHCI controller, set the BUS operational | 457 | /* Start an OHCI controller, set the BUS operational |
514 | * resets USB and controller | 458 | * resets USB and controller |
515 | * enable interrupts | 459 | * enable interrupts |
516 | */ | 460 | */ |
517 | static int ohci_run (struct ohci_hcd *ohci) | 461 | static int ohci_run (struct ohci_hcd *ohci) |
518 | { | 462 | { |
519 | u32 mask, temp; | 463 | u32 mask, temp; |
520 | int first = ohci->fminterval == 0; | 464 | int first = ohci->fminterval == 0; |
521 | struct usb_hcd *hcd = ohci_to_hcd(ohci); | 465 | struct usb_hcd *hcd = ohci_to_hcd(ohci); |
522 | 466 | ||
@@ -534,7 +478,7 @@ static int ohci_run (struct ohci_hcd *ohci) | |||
534 | /* also: power/overcurrent flags in roothub.a */ | 478 | /* also: power/overcurrent flags in roothub.a */ |
535 | } | 479 | } |
536 | 480 | ||
537 | /* Reset USB nearly "by the book". RemoteWakeupConnected was | 481 | /* Reset USB nearly "by the book". RemoteWakeupConnected was |
538 | * saved if boot firmware (BIOS/SMM/...) told us it's connected, | 482 | * saved if boot firmware (BIOS/SMM/...) told us it's connected, |
539 | * or if bus glue did the same (e.g. for PCI add-in cards with | 483 | * or if bus glue did the same (e.g. for PCI add-in cards with |
540 | * PCI PM support). | 484 | * PCI PM support). |
@@ -765,9 +709,9 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd) | |||
765 | dl_done_list (ohci); | 709 | dl_done_list (ohci); |
766 | spin_unlock (&ohci->lock); | 710 | spin_unlock (&ohci->lock); |
767 | if (HC_IS_RUNNING(hcd->state)) | 711 | if (HC_IS_RUNNING(hcd->state)) |
768 | ohci_writel (ohci, OHCI_INTR_WDH, ®s->intrenable); | 712 | ohci_writel (ohci, OHCI_INTR_WDH, ®s->intrenable); |
769 | } | 713 | } |
770 | 714 | ||
771 | /* could track INTR_SO to reduce available PCI/... bandwidth */ | 715 | /* could track INTR_SO to reduce available PCI/... bandwidth */ |
772 | 716 | ||
773 | /* handle any pending URB/ED unlinks, leaving INTR_SF enabled | 717 | /* handle any pending URB/ED unlinks, leaving INTR_SF enabled |
@@ -778,12 +722,12 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd) | |||
778 | finish_unlinks (ohci, ohci_frame_no(ohci)); | 722 | finish_unlinks (ohci, ohci_frame_no(ohci)); |
779 | if ((ints & OHCI_INTR_SF) != 0 && !ohci->ed_rm_list | 723 | if ((ints & OHCI_INTR_SF) != 0 && !ohci->ed_rm_list |
780 | && HC_IS_RUNNING(hcd->state)) | 724 | && HC_IS_RUNNING(hcd->state)) |
781 | ohci_writel (ohci, OHCI_INTR_SF, ®s->intrdisable); | 725 | ohci_writel (ohci, OHCI_INTR_SF, ®s->intrdisable); |
782 | spin_unlock (&ohci->lock); | 726 | spin_unlock (&ohci->lock); |
783 | 727 | ||
784 | if (HC_IS_RUNNING(hcd->state)) { | 728 | if (HC_IS_RUNNING(hcd->state)) { |
785 | ohci_writel (ohci, ints, ®s->intrstatus); | 729 | ohci_writel (ohci, ints, ®s->intrstatus); |
786 | ohci_writel (ohci, OHCI_INTR_MIE, ®s->intrenable); | 730 | ohci_writel (ohci, OHCI_INTR_MIE, ®s->intrenable); |
787 | // flush those writes | 731 | // flush those writes |
788 | (void) ohci_readl (ohci, &ohci->regs->control); | 732 | (void) ohci_readl (ohci, &ohci->regs->control); |
789 | } | 733 | } |
@@ -794,7 +738,7 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd) | |||
794 | /*-------------------------------------------------------------------------*/ | 738 | /*-------------------------------------------------------------------------*/ |
795 | 739 | ||
796 | static void ohci_stop (struct usb_hcd *hcd) | 740 | static void ohci_stop (struct usb_hcd *hcd) |
797 | { | 741 | { |
798 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | 742 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); |
799 | 743 | ||
800 | ohci_dbg (ohci, "stop %s controller (state 0x%02x)\n", | 744 | ohci_dbg (ohci, "stop %s controller (state 0x%02x)\n", |
@@ -812,8 +756,8 @@ static void ohci_stop (struct usb_hcd *hcd) | |||
812 | remove_debug_files (ohci); | 756 | remove_debug_files (ohci); |
813 | ohci_mem_cleanup (ohci); | 757 | ohci_mem_cleanup (ohci); |
814 | if (ohci->hcca) { | 758 | if (ohci->hcca) { |
815 | dma_free_coherent (hcd->self.controller, | 759 | dma_free_coherent (hcd->self.controller, |
816 | sizeof *ohci->hcca, | 760 | sizeof *ohci->hcca, |
817 | ohci->hcca, ohci->hcca_dma); | 761 | ohci->hcca, ohci->hcca_dma); |
818 | ohci->hcca = NULL; | 762 | ohci->hcca = NULL; |
819 | ohci->hcca_dma = 0; | 763 | ohci->hcca_dma = 0; |
@@ -836,7 +780,7 @@ static int ohci_restart (struct ohci_hcd *ohci) | |||
836 | * recycle any "live" eds/tds (and urbs) right away. | 780 | * recycle any "live" eds/tds (and urbs) right away. |
837 | * later, khubd disconnect processing will recycle the other state, | 781 | * later, khubd disconnect processing will recycle the other state, |
838 | * (either as disconnect/reconnect, or maybe someday as a reset). | 782 | * (either as disconnect/reconnect, or maybe someday as a reset). |
839 | */ | 783 | */ |
840 | spin_lock_irq(&ohci->lock); | 784 | spin_lock_irq(&ohci->lock); |
841 | disable (ohci); | 785 | disable (ohci); |
842 | usb_root_hub_lost_power(ohci_to_hcd(ohci)->self.root_hub); | 786 | usb_root_hub_lost_power(ohci_to_hcd(ohci)->self.root_hub); |
@@ -875,11 +819,11 @@ static int ohci_restart (struct ohci_hcd *ohci) | |||
875 | /* empty the interrupt branches */ | 819 | /* empty the interrupt branches */ |
876 | for (i = 0; i < NUM_INTS; i++) ohci->load [i] = 0; | 820 | for (i = 0; i < NUM_INTS; i++) ohci->load [i] = 0; |
877 | for (i = 0; i < NUM_INTS; i++) ohci->hcca->int_table [i] = 0; | 821 | for (i = 0; i < NUM_INTS; i++) ohci->hcca->int_table [i] = 0; |
878 | 822 | ||
879 | /* no EDs to remove */ | 823 | /* no EDs to remove */ |
880 | ohci->ed_rm_list = NULL; | 824 | ohci->ed_rm_list = NULL; |
881 | 825 | ||
882 | /* empty control and bulk lists */ | 826 | /* empty control and bulk lists */ |
883 | ohci->ed_controltail = NULL; | 827 | ohci->ed_controltail = NULL; |
884 | ohci->ed_bulktail = NULL; | 828 | ohci->ed_bulktail = NULL; |
885 | 829 | ||
@@ -941,6 +885,10 @@ MODULE_LICENSE ("GPL"); | |||
941 | #include "ohci-au1xxx.c" | 885 | #include "ohci-au1xxx.c" |
942 | #endif | 886 | #endif |
943 | 887 | ||
888 | #ifdef CONFIG_PNX8550 | ||
889 | #include "ohci-pnx8550.c" | ||
890 | #endif | ||
891 | |||
944 | #ifdef CONFIG_USB_OHCI_HCD_PPC_SOC | 892 | #ifdef CONFIG_USB_OHCI_HCD_PPC_SOC |
945 | #include "ohci-ppc-soc.c" | 893 | #include "ohci-ppc-soc.c" |
946 | #endif | 894 | #endif |
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index 2441642cb7b4..216c9c9d4d6d 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * OHCI HCD (Host Controller Driver) for USB. | 2 | * OHCI HCD (Host Controller Driver) for USB. |
3 | * | 3 | * |
4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> | 4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> |
5 | * (C) Copyright 2000-2004 David Brownell <dbrownell@users.sourceforge.net> | 5 | * (C) Copyright 2000-2004 David Brownell <dbrownell@users.sourceforge.net> |
6 | * | 6 | * |
7 | * This file is licenced under GPL | 7 | * This file is licenced under GPL |
8 | */ | 8 | */ |
9 | 9 | ||
@@ -23,13 +23,13 @@ | |||
23 | (temp & RH_PS_PSSC) ? " PSSC" : "", \ | 23 | (temp & RH_PS_PSSC) ? " PSSC" : "", \ |
24 | (temp & RH_PS_PESC) ? " PESC" : "", \ | 24 | (temp & RH_PS_PESC) ? " PESC" : "", \ |
25 | (temp & RH_PS_CSC) ? " CSC" : "", \ | 25 | (temp & RH_PS_CSC) ? " CSC" : "", \ |
26 | \ | 26 | \ |
27 | (temp & RH_PS_LSDA) ? " LSDA" : "", \ | 27 | (temp & RH_PS_LSDA) ? " LSDA" : "", \ |
28 | (temp & RH_PS_PPS) ? " PPS" : "", \ | 28 | (temp & RH_PS_PPS) ? " PPS" : "", \ |
29 | (temp & RH_PS_PRS) ? " PRS" : "", \ | 29 | (temp & RH_PS_PRS) ? " PRS" : "", \ |
30 | (temp & RH_PS_POCI) ? " POCI" : "", \ | 30 | (temp & RH_PS_POCI) ? " POCI" : "", \ |
31 | (temp & RH_PS_PSS) ? " PSS" : "", \ | 31 | (temp & RH_PS_PSS) ? " PSS" : "", \ |
32 | \ | 32 | \ |
33 | (temp & RH_PS_PES) ? " PES" : "", \ | 33 | (temp & RH_PS_PES) ? " PES" : "", \ |
34 | (temp & RH_PS_CCS) ? " CCS" : "" \ | 34 | (temp & RH_PS_CCS) ? " CCS" : "" \ |
35 | ); | 35 | ); |
@@ -484,7 +484,7 @@ ohci_hub_descriptor ( | |||
484 | temp = 0; | 484 | temp = 0; |
485 | if (rh & RH_A_NPS) /* no power switching? */ | 485 | if (rh & RH_A_NPS) /* no power switching? */ |
486 | temp |= 0x0002; | 486 | temp |= 0x0002; |
487 | if (rh & RH_A_PSM) /* per-port power switching? */ | 487 | if (rh & RH_A_PSM) /* per-port power switching? */ |
488 | temp |= 0x0001; | 488 | temp |= 0x0001; |
489 | if (rh & RH_A_NOCP) /* no overcurrent reporting? */ | 489 | if (rh & RH_A_NOCP) /* no overcurrent reporting? */ |
490 | temp |= 0x0010; | 490 | temp |= 0x0010; |
@@ -555,7 +555,7 @@ static void start_hnp(struct ohci_hcd *ohci); | |||
555 | #define tick_before(t1,t2) ((s16)(((s16)(t1))-((s16)(t2))) < 0) | 555 | #define tick_before(t1,t2) ((s16)(((s16)(t1))-((s16)(t2))) < 0) |
556 | 556 | ||
557 | /* called from some task, normally khubd */ | 557 | /* called from some task, normally khubd */ |
558 | static inline void root_port_reset (struct ohci_hcd *ohci, unsigned port) | 558 | static inline int root_port_reset (struct ohci_hcd *ohci, unsigned port) |
559 | { | 559 | { |
560 | __hc32 __iomem *portstat = &ohci->regs->roothub.portstatus [port]; | 560 | __hc32 __iomem *portstat = &ohci->regs->roothub.portstatus [port]; |
561 | u32 temp; | 561 | u32 temp; |
@@ -570,10 +570,13 @@ static inline void root_port_reset (struct ohci_hcd *ohci, unsigned port) | |||
570 | /* spin until any current reset finishes */ | 570 | /* spin until any current reset finishes */ |
571 | for (;;) { | 571 | for (;;) { |
572 | temp = ohci_readl (ohci, portstat); | 572 | temp = ohci_readl (ohci, portstat); |
573 | /* handle e.g. CardBus eject */ | ||
574 | if (temp == ~(u32)0) | ||
575 | return -ESHUTDOWN; | ||
573 | if (!(temp & RH_PS_PRS)) | 576 | if (!(temp & RH_PS_PRS)) |
574 | break; | 577 | break; |
575 | udelay (500); | 578 | udelay (500); |
576 | } | 579 | } |
577 | 580 | ||
578 | if (!(temp & RH_PS_CCS)) | 581 | if (!(temp & RH_PS_CCS)) |
579 | break; | 582 | break; |
@@ -586,6 +589,8 @@ static inline void root_port_reset (struct ohci_hcd *ohci, unsigned port) | |||
586 | now = ohci_readl(ohci, &ohci->regs->fmnumber); | 589 | now = ohci_readl(ohci, &ohci->regs->fmnumber); |
587 | } while (tick_before(now, reset_done)); | 590 | } while (tick_before(now, reset_done)); |
588 | /* caller synchronizes using PRSC */ | 591 | /* caller synchronizes using PRSC */ |
592 | |||
593 | return 0; | ||
589 | } | 594 | } |
590 | 595 | ||
591 | static int ohci_hub_control ( | 596 | static int ohci_hub_control ( |
@@ -702,7 +707,7 @@ static int ohci_hub_control ( | |||
702 | &ohci->regs->roothub.portstatus [wIndex]); | 707 | &ohci->regs->roothub.portstatus [wIndex]); |
703 | break; | 708 | break; |
704 | case USB_PORT_FEAT_RESET: | 709 | case USB_PORT_FEAT_RESET: |
705 | root_port_reset (ohci, wIndex); | 710 | retval = root_port_reset (ohci, wIndex); |
706 | break; | 711 | break; |
707 | default: | 712 | default: |
708 | goto error; | 713 | goto error; |
diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c index e121d97ed91c..e9807cf73a2f 100644 --- a/drivers/usb/host/ohci-lh7a404.c +++ b/drivers/usb/host/ohci-lh7a404.c | |||
@@ -38,7 +38,7 @@ static void lh7a404_start_hc(struct platform_device *dev) | |||
38 | CSC_PWRCNT |= CSC_PWRCNT_USBH_EN; /* Enable clock */ | 38 | CSC_PWRCNT |= CSC_PWRCNT_USBH_EN; /* Enable clock */ |
39 | udelay(1000); | 39 | udelay(1000); |
40 | USBH_CMDSTATUS = OHCI_HCR; | 40 | USBH_CMDSTATUS = OHCI_HCR; |
41 | 41 | ||
42 | printk(KERN_DEBUG __FILE__ | 42 | printk(KERN_DEBUG __FILE__ |
43 | ": Clock to USB host has been enabled \n"); | 43 | ": Clock to USB host has been enabled \n"); |
44 | } | 44 | } |
@@ -89,7 +89,7 @@ int usb_hcd_lh7a404_probe (const struct hc_driver *driver, | |||
89 | retval = -EBUSY; | 89 | retval = -EBUSY; |
90 | goto err1; | 90 | goto err1; |
91 | } | 91 | } |
92 | 92 | ||
93 | hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); | 93 | hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); |
94 | if (!hcd->regs) { | 94 | if (!hcd->regs) { |
95 | pr_debug("ioremap failed"); | 95 | pr_debug("ioremap failed"); |
@@ -174,7 +174,7 @@ static const struct hc_driver ohci_lh7a404_hc_driver = { | |||
174 | */ | 174 | */ |
175 | .start = ohci_lh7a404_start, | 175 | .start = ohci_lh7a404_start, |
176 | .stop = ohci_stop, | 176 | .stop = ohci_stop, |
177 | .shutdown = ohci_shutdown, | 177 | .shutdown = ohci_shutdown, |
178 | 178 | ||
179 | /* | 179 | /* |
180 | * managing i/o requests and associated device resources | 180 | * managing i/o requests and associated device resources |
@@ -242,7 +242,7 @@ static int ohci_hcd_lh7a404_drv_resume(struct platform_device *dev) | |||
242 | static struct platform_driver ohci_hcd_lh7a404_driver = { | 242 | static struct platform_driver ohci_hcd_lh7a404_driver = { |
243 | .probe = ohci_hcd_lh7a404_drv_probe, | 243 | .probe = ohci_hcd_lh7a404_drv_probe, |
244 | .remove = ohci_hcd_lh7a404_drv_remove, | 244 | .remove = ohci_hcd_lh7a404_drv_remove, |
245 | .shutdown = usb_hcd_platform_shutdown, | 245 | .shutdown = usb_hcd_platform_shutdown, |
246 | /*.suspend = ohci_hcd_lh7a404_drv_suspend, */ | 246 | /*.suspend = ohci_hcd_lh7a404_drv_suspend, */ |
247 | /*.resume = ohci_hcd_lh7a404_drv_resume, */ | 247 | /*.resume = ohci_hcd_lh7a404_drv_resume, */ |
248 | .driver = { | 248 | .driver = { |
diff --git a/drivers/usb/host/ohci-mem.c b/drivers/usb/host/ohci-mem.c index d976614eebd3..2f20d3dc895b 100644 --- a/drivers/usb/host/ohci-mem.c +++ b/drivers/usb/host/ohci-mem.c | |||
@@ -1,24 +1,24 @@ | |||
1 | /* | 1 | /* |
2 | * OHCI HCD (Host Controller Driver) for USB. | 2 | * OHCI HCD (Host Controller Driver) for USB. |
3 | * | 3 | * |
4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> | 4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> |
5 | * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net> | 5 | * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net> |
6 | * | 6 | * |
7 | * This file is licenced under the GPL. | 7 | * This file is licenced under the GPL. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | /*-------------------------------------------------------------------------*/ | 10 | /*-------------------------------------------------------------------------*/ |
11 | 11 | ||
12 | /* | 12 | /* |
13 | * There's basically three types of memory: | 13 | * OHCI deals with three types of memory: |
14 | * - data used only by the HCD ... kmalloc is fine | 14 | * - data used only by the HCD ... kmalloc is fine |
15 | * - async and periodic schedules, shared by HC and HCD ... these | 15 | * - async and periodic schedules, shared by HC and HCD ... these |
16 | * need to use dma_pool or dma_alloc_coherent | 16 | * need to use dma_pool or dma_alloc_coherent |
17 | * - driver buffers, read/written by HC ... the hcd glue or the | 17 | * - driver buffers, read/written by HC ... the hcd glue or the |
18 | * device driver provides us with dma addresses | 18 | * device driver provides us with dma addresses |
19 | * | 19 | * |
20 | * There's also PCI "register" data, which is memory mapped. | 20 | * There's also "register" data, which is memory mapped. |
21 | * No memory seen by this driver is pagable. | 21 | * No memory seen by this driver (or any HCD) may be paged out. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /*-------------------------------------------------------------------------*/ | 24 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index 9c02177de50a..27be1f936885 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c | |||
@@ -447,7 +447,7 @@ static const struct hc_driver ohci_omap_hc_driver = { | |||
447 | .reset = ohci_omap_init, | 447 | .reset = ohci_omap_init, |
448 | .start = ohci_omap_start, | 448 | .start = ohci_omap_start, |
449 | .stop = ohci_omap_stop, | 449 | .stop = ohci_omap_stop, |
450 | .shutdown = ohci_shutdown, | 450 | .shutdown = ohci_shutdown, |
451 | 451 | ||
452 | /* | 452 | /* |
453 | * managing i/o requests and associated device resources | 453 | * managing i/o requests and associated device resources |
@@ -533,7 +533,7 @@ static int ohci_omap_resume(struct platform_device *dev) | |||
533 | static struct platform_driver ohci_hcd_omap_driver = { | 533 | static struct platform_driver ohci_hcd_omap_driver = { |
534 | .probe = ohci_hcd_omap_drv_probe, | 534 | .probe = ohci_hcd_omap_drv_probe, |
535 | .remove = ohci_hcd_omap_drv_remove, | 535 | .remove = ohci_hcd_omap_drv_remove, |
536 | .shutdown = usb_hcd_platform_shutdown, | 536 | .shutdown = usb_hcd_platform_shutdown, |
537 | #ifdef CONFIG_PM | 537 | #ifdef CONFIG_PM |
538 | .suspend = ohci_omap_suspend, | 538 | .suspend = ohci_omap_suspend, |
539 | .resume = ohci_omap_resume, | 539 | .resume = ohci_omap_resume, |
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index 874418552789..596e0b41e606 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c | |||
@@ -3,17 +3,17 @@ | |||
3 | * | 3 | * |
4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> | 4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> |
5 | * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net> | 5 | * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net> |
6 | * | 6 | * |
7 | * [ Initialisation is based on Linus' ] | 7 | * [ Initialisation is based on Linus' ] |
8 | * [ uhci code and gregs ohci fragments ] | 8 | * [ uhci code and gregs ohci fragments ] |
9 | * [ (C) Copyright 1999 Linus Torvalds ] | 9 | * [ (C) Copyright 1999 Linus Torvalds ] |
10 | * [ (C) Copyright 1999 Gregory P. Smith] | 10 | * [ (C) Copyright 1999 Gregory P. Smith] |
11 | * | 11 | * |
12 | * PCI Bus Glue | 12 | * PCI Bus Glue |
13 | * | 13 | * |
14 | * This file is licenced under the GPL. | 14 | * This file is licenced under the GPL. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #ifndef CONFIG_PCI | 17 | #ifndef CONFIG_PCI |
18 | #error "This file is PCI bus glue. CONFIG_PCI must be defined." | 18 | #error "This file is PCI bus glue. CONFIG_PCI must be defined." |
19 | #endif | 19 | #endif |
@@ -83,7 +83,7 @@ ohci_pci_start (struct usb_hcd *hcd) | |||
83 | pci_dev_put(b); | 83 | pci_dev_put(b); |
84 | } | 84 | } |
85 | 85 | ||
86 | /* Check for Compaq's ZFMicro chipset, which needs short | 86 | /* Check for Compaq's ZFMicro chipset, which needs short |
87 | * delays before control or bulk queues get re-activated | 87 | * delays before control or bulk queues get re-activated |
88 | * in finish_unlinks() | 88 | * in finish_unlinks() |
89 | */ | 89 | */ |
@@ -238,8 +238,8 @@ static struct pci_driver ohci_pci_driver = { | |||
238 | .shutdown = usb_hcd_pci_shutdown, | 238 | .shutdown = usb_hcd_pci_shutdown, |
239 | }; | 239 | }; |
240 | 240 | ||
241 | 241 | ||
242 | static int __init ohci_hcd_pci_init (void) | 242 | static int __init ohci_hcd_pci_init (void) |
243 | { | 243 | { |
244 | printk (KERN_DEBUG "%s: " DRIVER_INFO " (PCI)\n", hcd_name); | 244 | printk (KERN_DEBUG "%s: " DRIVER_INFO " (PCI)\n", hcd_name); |
245 | if (usb_disabled()) | 245 | if (usb_disabled()) |
@@ -253,8 +253,8 @@ module_init (ohci_hcd_pci_init); | |||
253 | 253 | ||
254 | /*-------------------------------------------------------------------------*/ | 254 | /*-------------------------------------------------------------------------*/ |
255 | 255 | ||
256 | static void __exit ohci_hcd_pci_cleanup (void) | 256 | static void __exit ohci_hcd_pci_cleanup (void) |
257 | { | 257 | { |
258 | pci_unregister_driver (&ohci_pci_driver); | 258 | pci_unregister_driver (&ohci_pci_driver); |
259 | } | 259 | } |
260 | module_exit (ohci_hcd_pci_cleanup); | 260 | module_exit (ohci_hcd_pci_cleanup); |
diff --git a/drivers/usb/host/ohci-pnx4008.c b/drivers/usb/host/ohci-pnx4008.c index 7f26f9bdbaf1..3a8cbfb69054 100644 --- a/drivers/usb/host/ohci-pnx4008.c +++ b/drivers/usb/host/ohci-pnx4008.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * driver for Philips PNX4008 USB Host | 4 | * driver for Philips PNX4008 USB Host |
5 | * | 5 | * |
6 | * Authors: Dmitry Chigirev <source@mvista.com> | 6 | * Authors: Dmitry Chigirev <source@mvista.com> |
7 | * Vitaly Wool <vitalywool@gmail.com> | 7 | * Vitaly Wool <vitalywool@gmail.com> |
8 | * | 8 | * |
9 | * register initialization is based on code examples provided by Philips | 9 | * register initialization is based on code examples provided by Philips |
10 | * Copyright (c) 2005 Koninklijke Philips Electronics N.V. | 10 | * Copyright (c) 2005 Koninklijke Philips Electronics N.V. |
@@ -29,7 +29,7 @@ | |||
29 | #include <asm/arch/irqs.h> | 29 | #include <asm/arch/irqs.h> |
30 | #include <asm/arch/gpio.h> | 30 | #include <asm/arch/gpio.h> |
31 | 31 | ||
32 | #define USB_CTRL IO_ADDRESS(PNX4008_PWRMAN_BASE + 0x64) | 32 | #define USB_CTRL IO_ADDRESS(PNX4008_PWRMAN_BASE + 0x64) |
33 | 33 | ||
34 | /* USB_CTRL bit defines */ | 34 | /* USB_CTRL bit defines */ |
35 | #define USB_SLAVE_HCLK_EN (1 << 24) | 35 | #define USB_SLAVE_HCLK_EN (1 << 24) |
diff --git a/drivers/usb/host/ohci-pnx8550.c b/drivers/usb/host/ohci-pnx8550.c new file mode 100644 index 000000000000..6922b91b1704 --- /dev/null +++ b/drivers/usb/host/ohci-pnx8550.c | |||
@@ -0,0 +1,258 @@ | |||
1 | /* | ||
2 | * OHCI HCD (Host Controller Driver) for USB. | ||
3 | * | ||
4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> | ||
5 | * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net> | ||
6 | * (C) Copyright 2002 Hewlett-Packard Company | ||
7 | * (C) Copyright 2005 Embedded Alley Solutions, Inc. | ||
8 | * | ||
9 | * Bus Glue for PNX8550 | ||
10 | * | ||
11 | * Written by Christopher Hoover <ch@hpl.hp.com> | ||
12 | * Based on fragments of previous driver by Russell King et al. | ||
13 | * | ||
14 | * Modified for LH7A404 from ohci-sa1111.c | ||
15 | * by Durgesh Pattamatta <pattamattad@sharpsec.com> | ||
16 | * | ||
17 | * Modified for PNX8550 from ohci-sa1111.c and sa-omap.c | ||
18 | * by Vitaly Wool <vitalywool@gmail.com> | ||
19 | * | ||
20 | * This file is licenced under the GPL. | ||
21 | */ | ||
22 | |||
23 | #include <linux/device.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | #include <asm/mach-pnx8550/usb.h> | ||
26 | #include <asm/mach-pnx8550/int.h> | ||
27 | #include <asm/mach-pnx8550/pci.h> | ||
28 | |||
29 | #ifndef CONFIG_PNX8550 | ||
30 | #error "This file is PNX8550 bus glue. CONFIG_PNX8550 must be defined." | ||
31 | #endif | ||
32 | |||
33 | extern int usb_disabled(void); | ||
34 | |||
35 | /*-------------------------------------------------------------------------*/ | ||
36 | |||
37 | static void pnx8550_start_hc(struct platform_device *dev) | ||
38 | { | ||
39 | /* | ||
40 | * Set register CLK48CTL to enable and 48MHz | ||
41 | */ | ||
42 | outl(0x00000003, PCI_BASE | 0x0004770c); | ||
43 | |||
44 | /* | ||
45 | * Set register CLK12CTL to enable and 48MHz | ||
46 | */ | ||
47 | outl(0x00000003, PCI_BASE | 0x00047710); | ||
48 | |||
49 | udelay(100); | ||
50 | } | ||
51 | |||
52 | static void pnx8550_stop_hc(struct platform_device *dev) | ||
53 | { | ||
54 | udelay(10); | ||
55 | } | ||
56 | |||
57 | |||
58 | /*-------------------------------------------------------------------------*/ | ||
59 | |||
60 | /* configure so an HC device and id are always provided */ | ||
61 | /* always called with process context; sleeping is OK */ | ||
62 | |||
63 | |||
64 | /** | ||
65 | * usb_hcd_pnx8550_probe - initialize pnx8550-based HCDs | ||
66 | * Context: !in_interrupt() | ||
67 | * | ||
68 | * Allocates basic resources for this USB host controller, and | ||
69 | * then invokes the start() method for the HCD associated with it | ||
70 | * through the hotplug entry's driver_data. | ||
71 | * | ||
72 | */ | ||
73 | int usb_hcd_pnx8550_probe (const struct hc_driver *driver, | ||
74 | struct platform_device *dev) | ||
75 | { | ||
76 | int retval; | ||
77 | struct usb_hcd *hcd; | ||
78 | |||
79 | if (dev->resource[0].flags != IORESOURCE_MEM || | ||
80 | dev->resource[1].flags != IORESOURCE_IRQ) { | ||
81 | dev_err (&dev->dev,"invalid resource type\n"); | ||
82 | return -ENOMEM; | ||
83 | } | ||
84 | |||
85 | hcd = usb_create_hcd (driver, &dev->dev, "pnx8550"); | ||
86 | if (!hcd) | ||
87 | return -ENOMEM; | ||
88 | hcd->rsrc_start = dev->resource[0].start; | ||
89 | hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1; | ||
90 | |||
91 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | ||
92 | dev_err(&dev->dev, "request_mem_region [0x%08llx, 0x%08llx] " | ||
93 | "failed\n", hcd->rsrc_start, hcd->rsrc_len); | ||
94 | retval = -EBUSY; | ||
95 | goto err1; | ||
96 | } | ||
97 | |||
98 | hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); | ||
99 | if (!hcd->regs) { | ||
100 | dev_err(&dev->dev, "ioremap [[0x%08llx, 0x%08llx] failed\n", | ||
101 | hcd->rsrc_start, hcd->rsrc_len); | ||
102 | retval = -ENOMEM; | ||
103 | goto err2; | ||
104 | } | ||
105 | |||
106 | pnx8550_start_hc(dev); | ||
107 | |||
108 | ohci_hcd_init(hcd_to_ohci(hcd)); | ||
109 | |||
110 | retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT); | ||
111 | if (retval == 0) | ||
112 | return retval; | ||
113 | |||
114 | pnx8550_stop_hc(dev); | ||
115 | iounmap(hcd->regs); | ||
116 | err2: | ||
117 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
118 | err1: | ||
119 | usb_put_hcd(hcd); | ||
120 | return retval; | ||
121 | } | ||
122 | |||
123 | |||
124 | /* may be called without controller electrically present */ | ||
125 | /* may be called with controller, bus, and devices active */ | ||
126 | |||
127 | /** | ||
128 | * usb_hcd_pnx8550_remove - shutdown processing for pnx8550-based HCDs | ||
129 | * @dev: USB Host Controller being removed | ||
130 | * Context: !in_interrupt() | ||
131 | * | ||
132 | * Reverses the effect of usb_hcd_pnx8550_probe(), first invoking | ||
133 | * the HCD's stop() method. It is always called from a thread | ||
134 | * context, normally "rmmod", "apmd", or something similar. | ||
135 | * | ||
136 | */ | ||
137 | void usb_hcd_pnx8550_remove (struct usb_hcd *hcd, struct platform_device *dev) | ||
138 | { | ||
139 | usb_remove_hcd(hcd); | ||
140 | pnx8550_stop_hc(dev); | ||
141 | iounmap(hcd->regs); | ||
142 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
143 | usb_put_hcd(hcd); | ||
144 | } | ||
145 | |||
146 | /*-------------------------------------------------------------------------*/ | ||
147 | |||
148 | static int __devinit | ||
149 | ohci_pnx8550_start (struct usb_hcd *hcd) | ||
150 | { | ||
151 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | ||
152 | int ret; | ||
153 | |||
154 | ohci_dbg (ohci, "ohci_pnx8550_start, ohci:%p", ohci); | ||
155 | |||
156 | if ((ret = ohci_init(ohci)) < 0) | ||
157 | return ret; | ||
158 | |||
159 | if ((ret = ohci_run (ohci)) < 0) { | ||
160 | err ("can't start %s", hcd->self.bus_name); | ||
161 | ohci_stop (hcd); | ||
162 | return ret; | ||
163 | } | ||
164 | |||
165 | return 0; | ||
166 | } | ||
167 | |||
168 | /*-------------------------------------------------------------------------*/ | ||
169 | |||
170 | static const struct hc_driver ohci_pnx8550_hc_driver = { | ||
171 | .description = hcd_name, | ||
172 | .product_desc = "PNX8550 OHCI", | ||
173 | .hcd_priv_size = sizeof(struct ohci_hcd), | ||
174 | |||
175 | /* | ||
176 | * generic hardware linkage | ||
177 | */ | ||
178 | .irq = ohci_irq, | ||
179 | .flags = HCD_USB11 | HCD_MEMORY, | ||
180 | |||
181 | /* | ||
182 | * basic lifecycle operations | ||
183 | */ | ||
184 | .start = ohci_pnx8550_start, | ||
185 | .stop = ohci_stop, | ||
186 | |||
187 | /* | ||
188 | * managing i/o requests and associated device resources | ||
189 | */ | ||
190 | .urb_enqueue = ohci_urb_enqueue, | ||
191 | .urb_dequeue = ohci_urb_dequeue, | ||
192 | .endpoint_disable = ohci_endpoint_disable, | ||
193 | |||
194 | /* | ||
195 | * scheduling support | ||
196 | */ | ||
197 | .get_frame_number = ohci_get_frame, | ||
198 | |||
199 | /* | ||
200 | * root hub support | ||
201 | */ | ||
202 | .hub_status_data = ohci_hub_status_data, | ||
203 | .hub_control = ohci_hub_control, | ||
204 | .hub_irq_enable = ohci_rhsc_enable, | ||
205 | #ifdef CONFIG_PM | ||
206 | .bus_suspend = ohci_bus_suspend, | ||
207 | .bus_resume = ohci_bus_resume, | ||
208 | #endif | ||
209 | .start_port_reset = ohci_start_port_reset, | ||
210 | }; | ||
211 | |||
212 | /*-------------------------------------------------------------------------*/ | ||
213 | |||
214 | static int ohci_hcd_pnx8550_drv_probe(struct platform_device *pdev) | ||
215 | { | ||
216 | int ret; | ||
217 | |||
218 | if (usb_disabled()) | ||
219 | return -ENODEV; | ||
220 | |||
221 | ret = usb_hcd_pnx8550_probe(&ohci_pnx8550_hc_driver, pdev); | ||
222 | return ret; | ||
223 | } | ||
224 | |||
225 | static int ohci_hcd_pnx8550_drv_remove(struct platform_device *pdev) | ||
226 | { | ||
227 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | ||
228 | |||
229 | usb_hcd_pnx8550_remove(hcd, pdev); | ||
230 | return 0; | ||
231 | } | ||
232 | |||
233 | MODULE_ALIAS("pnx8550-ohci"); | ||
234 | |||
235 | static struct platform_driver ohci_hcd_pnx8550_driver = { | ||
236 | .driver = { | ||
237 | .name = "pnx8550-ohci", | ||
238 | }, | ||
239 | .probe = ohci_hcd_pnx8550_drv_probe, | ||
240 | .remove = ohci_hcd_pnx8550_drv_remove, | ||
241 | }; | ||
242 | |||
243 | static int __init ohci_hcd_pnx8550_init (void) | ||
244 | { | ||
245 | pr_debug (DRIVER_INFO " (pnx8550)"); | ||
246 | pr_debug ("block sizes: ed %d td %d\n", | ||
247 | sizeof (struct ed), sizeof (struct td)); | ||
248 | |||
249 | return platform_driver_register(&ohci_hcd_pnx8550_driver); | ||
250 | } | ||
251 | |||
252 | static void __exit ohci_hcd_pnx8550_cleanup (void) | ||
253 | { | ||
254 | platform_driver_unregister(&ohci_hcd_pnx8550_driver); | ||
255 | } | ||
256 | |||
257 | module_init (ohci_hcd_pnx8550_init); | ||
258 | module_exit (ohci_hcd_pnx8550_cleanup); | ||
diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c index d9d1ae236bd5..e1a7eb817313 100644 --- a/drivers/usb/host/ohci-ppc-soc.c +++ b/drivers/usb/host/ohci-ppc-soc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net> | 5 | * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net> |
6 | * (C) Copyright 2002 Hewlett-Packard Company | 6 | * (C) Copyright 2002 Hewlett-Packard Company |
7 | * (C) Copyright 2003-2005 MontaVista Software Inc. | 7 | * (C) Copyright 2003-2005 MontaVista Software Inc. |
8 | * | 8 | * |
9 | * Bus Glue for PPC On-Chip OHCI driver | 9 | * Bus Glue for PPC On-Chip OHCI driver |
10 | * Tested on Freescale MPC5200 and IBM STB04xxx | 10 | * Tested on Freescale MPC5200 and IBM STB04xxx |
11 | * | 11 | * |
@@ -85,7 +85,7 @@ static int usb_hcd_ppc_soc_probe(const struct hc_driver *driver, | |||
85 | err2: | 85 | err2: |
86 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | 86 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
87 | err1: | 87 | err1: |
88 | usb_put_hcd(hcd); | 88 | usb_put_hcd(hcd); |
89 | return retval; | 89 | return retval; |
90 | } | 90 | } |
91 | 91 | ||
@@ -148,7 +148,7 @@ static const struct hc_driver ohci_ppc_soc_hc_driver = { | |||
148 | */ | 148 | */ |
149 | .start = ohci_ppc_soc_start, | 149 | .start = ohci_ppc_soc_start, |
150 | .stop = ohci_stop, | 150 | .stop = ohci_stop, |
151 | .shutdown = ohci_shutdown, | 151 | .shutdown = ohci_shutdown, |
152 | 152 | ||
153 | /* | 153 | /* |
154 | * managing i/o requests and associated device resources | 154 | * managing i/o requests and associated device resources |
@@ -197,7 +197,7 @@ static int ohci_hcd_ppc_soc_drv_remove(struct platform_device *pdev) | |||
197 | static struct platform_driver ohci_hcd_ppc_soc_driver = { | 197 | static struct platform_driver ohci_hcd_ppc_soc_driver = { |
198 | .probe = ohci_hcd_ppc_soc_drv_probe, | 198 | .probe = ohci_hcd_ppc_soc_drv_probe, |
199 | .remove = ohci_hcd_ppc_soc_drv_remove, | 199 | .remove = ohci_hcd_ppc_soc_drv_remove, |
200 | .shutdown = usb_hcd_platform_shutdown, | 200 | .shutdown = usb_hcd_platform_shutdown, |
201 | #ifdef CONFIG_PM | 201 | #ifdef CONFIG_PM |
202 | /*.suspend = ohci_hcd_ppc_soc_drv_suspend,*/ | 202 | /*.suspend = ohci_hcd_ppc_soc_drv_suspend,*/ |
203 | /*.resume = ohci_hcd_ppc_soc_drv_resume,*/ | 203 | /*.resume = ohci_hcd_ppc_soc_drv_resume,*/ |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index e176b04d7aeb..3bbea844a9e3 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -47,7 +47,7 @@ static int pxa27x_ohci_select_pmm( int mode ) | |||
47 | switch ( mode ) { | 47 | switch ( mode ) { |
48 | case PMM_NPS_MODE: | 48 | case PMM_NPS_MODE: |
49 | UHCRHDA |= RH_A_NPS; | 49 | UHCRHDA |= RH_A_NPS; |
50 | break; | 50 | break; |
51 | case PMM_GLOBAL_MODE: | 51 | case PMM_GLOBAL_MODE: |
52 | UHCRHDA &= ~(RH_A_NPS & RH_A_PSM); | 52 | UHCRHDA &= ~(RH_A_NPS & RH_A_PSM); |
53 | break; | 53 | break; |
@@ -60,7 +60,7 @@ static int pxa27x_ohci_select_pmm( int mode ) | |||
60 | break; | 60 | break; |
61 | default: | 61 | default: |
62 | printk( KERN_ERR | 62 | printk( KERN_ERR |
63 | "Invalid mode %d, set to non-power switch mode.\n", | 63 | "Invalid mode %d, set to non-power switch mode.\n", |
64 | mode ); | 64 | mode ); |
65 | 65 | ||
66 | UHCRHDA |= RH_A_NPS; | 66 | UHCRHDA |= RH_A_NPS; |
@@ -270,7 +270,7 @@ static const struct hc_driver ohci_pxa27x_hc_driver = { | |||
270 | */ | 270 | */ |
271 | .start = ohci_pxa27x_start, | 271 | .start = ohci_pxa27x_start, |
272 | .stop = ohci_stop, | 272 | .stop = ohci_stop, |
273 | .shutdown = ohci_shutdown, | 273 | .shutdown = ohci_shutdown, |
274 | 274 | ||
275 | /* | 275 | /* |
276 | * managing i/o requests and associated device resources | 276 | * managing i/o requests and associated device resources |
@@ -359,9 +359,9 @@ static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev) | |||
359 | static struct platform_driver ohci_hcd_pxa27x_driver = { | 359 | static struct platform_driver ohci_hcd_pxa27x_driver = { |
360 | .probe = ohci_hcd_pxa27x_drv_probe, | 360 | .probe = ohci_hcd_pxa27x_drv_probe, |
361 | .remove = ohci_hcd_pxa27x_drv_remove, | 361 | .remove = ohci_hcd_pxa27x_drv_remove, |
362 | .shutdown = usb_hcd_platform_shutdown, | 362 | .shutdown = usb_hcd_platform_shutdown, |
363 | #ifdef CONFIG_PM | 363 | #ifdef CONFIG_PM |
364 | .suspend = ohci_hcd_pxa27x_drv_suspend, | 364 | .suspend = ohci_hcd_pxa27x_drv_suspend, |
365 | .resume = ohci_hcd_pxa27x_drv_resume, | 365 | .resume = ohci_hcd_pxa27x_drv_resume, |
366 | #endif | 366 | #endif |
367 | .driver = { | 367 | .driver = { |
diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c index fe1fe2f97cb5..830a3fe8615e 100644 --- a/drivers/usb/host/ohci-q.c +++ b/drivers/usb/host/ohci-q.c | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * OHCI HCD (Host Controller Driver) for USB. | 2 | * OHCI HCD (Host Controller Driver) for USB. |
3 | * | 3 | * |
4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> | 4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> |
5 | * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net> | 5 | * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net> |
6 | * | 6 | * |
7 | * This file is licenced under the GPL. | 7 | * This file is licenced under the GPL. |
8 | */ | 8 | */ |
9 | 9 | ||
@@ -89,7 +89,7 @@ __acquires(ohci->lock) | |||
89 | 89 | ||
90 | /*-------------------------------------------------------------------------* | 90 | /*-------------------------------------------------------------------------* |
91 | * ED handling functions | 91 | * ED handling functions |
92 | *-------------------------------------------------------------------------*/ | 92 | *-------------------------------------------------------------------------*/ |
93 | 93 | ||
94 | /* search for the right schedule branch to use for a periodic ed. | 94 | /* search for the right schedule branch to use for a periodic ed. |
95 | * does some load balancing; returns the branch, or negative errno. | 95 | * does some load balancing; returns the branch, or negative errno. |
@@ -107,7 +107,6 @@ static int balance (struct ohci_hcd *ohci, int interval, int load) | |||
107 | */ | 107 | */ |
108 | for (i = 0; i < interval ; i++) { | 108 | for (i = 0; i < interval ; i++) { |
109 | if (branch < 0 || ohci->load [branch] > ohci->load [i]) { | 109 | if (branch < 0 || ohci->load [branch] > ohci->load [i]) { |
110 | #if 1 /* CONFIG_USB_BANDWIDTH */ | ||
111 | int j; | 110 | int j; |
112 | 111 | ||
113 | /* usb 1.1 says 90% of one frame */ | 112 | /* usb 1.1 says 90% of one frame */ |
@@ -117,8 +116,7 @@ static int balance (struct ohci_hcd *ohci, int interval, int load) | |||
117 | } | 116 | } |
118 | if (j < NUM_INTS) | 117 | if (j < NUM_INTS) |
119 | continue; | 118 | continue; |
120 | #endif | 119 | branch = i; |
121 | branch = i; | ||
122 | } | 120 | } |
123 | } | 121 | } |
124 | return branch; | 122 | return branch; |
@@ -171,7 +169,7 @@ static void periodic_link (struct ohci_hcd *ohci, struct ed *ed) | |||
171 | /* link an ed into one of the HC chains */ | 169 | /* link an ed into one of the HC chains */ |
172 | 170 | ||
173 | static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed) | 171 | static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed) |
174 | { | 172 | { |
175 | int branch; | 173 | int branch; |
176 | 174 | ||
177 | if (ohci_to_hcd(ohci)->state == HC_STATE_QUIESCING) | 175 | if (ohci_to_hcd(ohci)->state == HC_STATE_QUIESCING) |
@@ -248,7 +246,7 @@ static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed) | |||
248 | } | 246 | } |
249 | ed->branch = branch; | 247 | ed->branch = branch; |
250 | periodic_link (ohci, ed); | 248 | periodic_link (ohci, ed); |
251 | } | 249 | } |
252 | 250 | ||
253 | /* the HC may not see the schedule updates yet, but if it does | 251 | /* the HC may not see the schedule updates yet, but if it does |
254 | * then they'll be properly ordered. | 252 | * then they'll be properly ordered. |
@@ -277,7 +275,7 @@ static void periodic_unlink (struct ohci_hcd *ohci, struct ed *ed) | |||
277 | *prev = ed->ed_next; | 275 | *prev = ed->ed_next; |
278 | } | 276 | } |
279 | ohci->load [i] -= ed->load; | 277 | ohci->load [i] -= ed->load; |
280 | } | 278 | } |
281 | ohci_to_hcd(ohci)->self.bandwidth_allocated -= ed->load / ed->interval; | 279 | ohci_to_hcd(ohci)->self.bandwidth_allocated -= ed->load / ed->interval; |
282 | 280 | ||
283 | ohci_vdbg (ohci, "unlink %sed %p branch %d [%dus.], interval %d\n", | 281 | ohci_vdbg (ohci, "unlink %sed %p branch %d [%dus.], interval %d\n", |
@@ -285,7 +283,7 @@ static void periodic_unlink (struct ohci_hcd *ohci, struct ed *ed) | |||
285 | ed, ed->branch, ed->load, ed->interval); | 283 | ed, ed->branch, ed->load, ed->interval); |
286 | } | 284 | } |
287 | 285 | ||
288 | /* unlink an ed from one of the HC chains. | 286 | /* unlink an ed from one of the HC chains. |
289 | * just the link to the ed is unlinked. | 287 | * just the link to the ed is unlinked. |
290 | * the link from the ed still points to another operational ed or 0 | 288 | * the link from the ed still points to another operational ed or 0 |
291 | * so the HC can eventually finish the processing of the unlinked ed | 289 | * so the HC can eventually finish the processing of the unlinked ed |
@@ -307,7 +305,7 @@ static void periodic_unlink (struct ohci_hcd *ohci, struct ed *ed) | |||
307 | * When finish_unlinks() runs later, after SOF interrupt, it will often | 305 | * When finish_unlinks() runs later, after SOF interrupt, it will often |
308 | * complete one or more URB unlinks before making that state change. | 306 | * complete one or more URB unlinks before making that state change. |
309 | */ | 307 | */ |
310 | static void ed_deschedule (struct ohci_hcd *ohci, struct ed *ed) | 308 | static void ed_deschedule (struct ohci_hcd *ohci, struct ed *ed) |
311 | { | 309 | { |
312 | ed->hwINFO |= cpu_to_hc32 (ohci, ED_SKIP); | 310 | ed->hwINFO |= cpu_to_hc32 (ohci, ED_SKIP); |
313 | wmb (); | 311 | wmb (); |
@@ -397,7 +395,7 @@ static struct ed *ed_get ( | |||
397 | unsigned int pipe, | 395 | unsigned int pipe, |
398 | int interval | 396 | int interval |
399 | ) { | 397 | ) { |
400 | struct ed *ed; | 398 | struct ed *ed; |
401 | unsigned long flags; | 399 | unsigned long flags; |
402 | 400 | ||
403 | spin_lock_irqsave (&ohci->lock, flags); | 401 | spin_lock_irqsave (&ohci->lock, flags); |
@@ -413,9 +411,9 @@ static struct ed *ed_get ( | |||
413 | goto done; | 411 | goto done; |
414 | } | 412 | } |
415 | 413 | ||
416 | /* dummy td; end of td list for ed */ | 414 | /* dummy td; end of td list for ed */ |
417 | td = td_alloc (ohci, GFP_ATOMIC); | 415 | td = td_alloc (ohci, GFP_ATOMIC); |
418 | if (!td) { | 416 | if (!td) { |
419 | /* out of memory */ | 417 | /* out of memory */ |
420 | ed_free (ohci, ed); | 418 | ed_free (ohci, ed); |
421 | ed = NULL; | 419 | ed = NULL; |
@@ -462,7 +460,7 @@ static struct ed *ed_get ( | |||
462 | 460 | ||
463 | done: | 461 | done: |
464 | spin_unlock_irqrestore (&ohci->lock, flags); | 462 | spin_unlock_irqrestore (&ohci->lock, flags); |
465 | return ed; | 463 | return ed; |
466 | } | 464 | } |
467 | 465 | ||
468 | /*-------------------------------------------------------------------------*/ | 466 | /*-------------------------------------------------------------------------*/ |
@@ -474,7 +472,7 @@ done: | |||
474 | * and that ed->state is ED_OPER | 472 | * and that ed->state is ED_OPER |
475 | */ | 473 | */ |
476 | static void start_ed_unlink (struct ohci_hcd *ohci, struct ed *ed) | 474 | static void start_ed_unlink (struct ohci_hcd *ohci, struct ed *ed) |
477 | { | 475 | { |
478 | ed->hwINFO |= cpu_to_hc32 (ohci, ED_DEQUEUE); | 476 | ed->hwINFO |= cpu_to_hc32 (ohci, ED_DEQUEUE); |
479 | ed_deschedule (ohci, ed); | 477 | ed_deschedule (ohci, ed); |
480 | 478 | ||
@@ -541,7 +539,7 @@ td_fill (struct ohci_hcd *ohci, u32 info, | |||
541 | td->ed = urb_priv->ed; | 539 | td->ed = urb_priv->ed; |
542 | td->next_dl_td = NULL; | 540 | td->next_dl_td = NULL; |
543 | td->index = index; | 541 | td->index = index; |
544 | td->urb = urb; | 542 | td->urb = urb; |
545 | td->data_dma = data; | 543 | td->data_dma = data; |
546 | if (!len) | 544 | if (!len) |
547 | data = 0; | 545 | data = 0; |
@@ -553,8 +551,8 @@ td_fill (struct ohci_hcd *ohci, u32 info, | |||
553 | (data & 0x0FFF) | 0xE000); | 551 | (data & 0x0FFF) | 0xE000); |
554 | td->ed->last_iso = info & 0xffff; | 552 | td->ed->last_iso = info & 0xffff; |
555 | } else { | 553 | } else { |
556 | td->hwCBP = cpu_to_hc32 (ohci, data); | 554 | td->hwCBP = cpu_to_hc32 (ohci, data); |
557 | } | 555 | } |
558 | if (data) | 556 | if (data) |
559 | td->hwBE = cpu_to_hc32 (ohci, data + len - 1); | 557 | td->hwBE = cpu_to_hc32 (ohci, data + len - 1); |
560 | else | 558 | else |
@@ -597,7 +595,7 @@ static void td_submit_urb ( | |||
597 | * use the device toggle bits for resetting, and rely on the fact | 595 | * use the device toggle bits for resetting, and rely on the fact |
598 | * that resetting toggle is meaningless if the endpoint is active. | 596 | * that resetting toggle is meaningless if the endpoint is active. |
599 | */ | 597 | */ |
600 | if (!usb_gettoggle (urb->dev, usb_pipeendpoint (urb->pipe), is_out)) { | 598 | if (!usb_gettoggle (urb->dev, usb_pipeendpoint (urb->pipe), is_out)) { |
601 | usb_settoggle (urb->dev, usb_pipeendpoint (urb->pipe), | 599 | usb_settoggle (urb->dev, usb_pipeendpoint (urb->pipe), |
602 | is_out, 1); | 600 | is_out, 1); |
603 | urb_priv->ed->hwHeadP &= ~cpu_to_hc32 (ohci, ED_C); | 601 | urb_priv->ed->hwHeadP &= ~cpu_to_hc32 (ohci, ED_C); |
@@ -721,16 +719,16 @@ static void td_done (struct ohci_hcd *ohci, struct urb *urb, struct td *td) | |||
721 | list_del (&td->td_list); | 719 | list_del (&td->td_list); |
722 | 720 | ||
723 | /* ISO ... drivers see per-TD length/status */ | 721 | /* ISO ... drivers see per-TD length/status */ |
724 | if (tdINFO & TD_ISO) { | 722 | if (tdINFO & TD_ISO) { |
725 | u16 tdPSW = ohci_hwPSW (ohci, td, 0); | 723 | u16 tdPSW = ohci_hwPSW (ohci, td, 0); |
726 | int dlen = 0; | 724 | int dlen = 0; |
727 | 725 | ||
728 | /* NOTE: assumes FC in tdINFO == 0, and that | 726 | /* NOTE: assumes FC in tdINFO == 0, and that |
729 | * only the first of 0..MAXPSW psws is used. | 727 | * only the first of 0..MAXPSW psws is used. |
730 | */ | 728 | */ |
731 | 729 | ||
732 | cc = (tdPSW >> 12) & 0xF; | 730 | cc = (tdPSW >> 12) & 0xF; |
733 | if (tdINFO & TD_CC) /* hc didn't touch? */ | 731 | if (tdINFO & TD_CC) /* hc didn't touch? */ |
734 | return; | 732 | return; |
735 | 733 | ||
736 | if (usb_pipeout (urb->pipe)) | 734 | if (usb_pipeout (urb->pipe)) |
@@ -758,7 +756,7 @@ static void td_done (struct ohci_hcd *ohci, struct urb *urb, struct td *td) | |||
758 | int type = usb_pipetype (urb->pipe); | 756 | int type = usb_pipetype (urb->pipe); |
759 | u32 tdBE = hc32_to_cpup (ohci, &td->hwBE); | 757 | u32 tdBE = hc32_to_cpup (ohci, &td->hwBE); |
760 | 758 | ||
761 | cc = TD_CC_GET (tdINFO); | 759 | cc = TD_CC_GET (tdINFO); |
762 | 760 | ||
763 | /* update packet status if needed (short is normally ok) */ | 761 | /* update packet status if needed (short is normally ok) */ |
764 | if (cc == TD_DATAUNDERRUN | 762 | if (cc == TD_DATAUNDERRUN |
@@ -787,7 +785,7 @@ static void td_done (struct ohci_hcd *ohci, struct urb *urb, struct td *td) | |||
787 | urb, td, 1 + td->index, cc, | 785 | urb, td, 1 + td->index, cc, |
788 | urb->actual_length, | 786 | urb->actual_length, |
789 | urb->transfer_buffer_length); | 787 | urb->transfer_buffer_length); |
790 | } | 788 | } |
791 | } | 789 | } |
792 | 790 | ||
793 | /*-------------------------------------------------------------------------*/ | 791 | /*-------------------------------------------------------------------------*/ |
@@ -795,7 +793,7 @@ static void td_done (struct ohci_hcd *ohci, struct urb *urb, struct td *td) | |||
795 | static inline struct td * | 793 | static inline struct td * |
796 | ed_halted (struct ohci_hcd *ohci, struct td *td, int cc, struct td *rev) | 794 | ed_halted (struct ohci_hcd *ohci, struct td *td, int cc, struct td *rev) |
797 | { | 795 | { |
798 | struct urb *urb = td->urb; | 796 | struct urb *urb = td->urb; |
799 | struct ed *ed = td->ed; | 797 | struct ed *ed = td->ed; |
800 | struct list_head *tmp = td->td_list.next; | 798 | struct list_head *tmp = td->td_list.next; |
801 | __hc32 toggle = ed->hwHeadP & cpu_to_hc32 (ohci, ED_C); | 799 | __hc32 toggle = ed->hwHeadP & cpu_to_hc32 (ohci, ED_C); |
@@ -805,7 +803,7 @@ ed_halted (struct ohci_hcd *ohci, struct td *td, int cc, struct td *rev) | |||
805 | */ | 803 | */ |
806 | ed->hwINFO |= cpu_to_hc32 (ohci, ED_SKIP); | 804 | ed->hwINFO |= cpu_to_hc32 (ohci, ED_SKIP); |
807 | wmb (); | 805 | wmb (); |
808 | ed->hwHeadP &= ~cpu_to_hc32 (ohci, ED_H); | 806 | ed->hwHeadP &= ~cpu_to_hc32 (ohci, ED_H); |
809 | 807 | ||
810 | /* put any later tds from this urb onto the donelist, after 'td', | 808 | /* put any later tds from this urb onto the donelist, after 'td', |
811 | * order won't matter here: no errors, and nothing was transferred. | 809 | * order won't matter here: no errors, and nothing was transferred. |
@@ -833,7 +831,7 @@ ed_halted (struct ohci_hcd *ohci, struct td *td, int cc, struct td *rev) | |||
833 | info &= ~cpu_to_hc32 (ohci, TD_CC); | 831 | info &= ~cpu_to_hc32 (ohci, TD_CC); |
834 | next->hwINFO = info; | 832 | next->hwINFO = info; |
835 | 833 | ||
836 | next->next_dl_td = rev; | 834 | next->next_dl_td = rev; |
837 | rev = next; | 835 | rev = next; |
838 | 836 | ||
839 | ed->hwHeadP = next->hwNextTD | toggle; | 837 | ed->hwHeadP = next->hwNextTD | toggle; |
@@ -881,8 +879,8 @@ static struct td *dl_reverse_done_list (struct ohci_hcd *ohci) | |||
881 | /* get TD from hc's singly linked list, and | 879 | /* get TD from hc's singly linked list, and |
882 | * prepend to ours. ed->td_list changes later. | 880 | * prepend to ours. ed->td_list changes later. |
883 | */ | 881 | */ |
884 | while (td_dma) { | 882 | while (td_dma) { |
885 | int cc; | 883 | int cc; |
886 | 884 | ||
887 | td = dma_to_td (ohci, td_dma); | 885 | td = dma_to_td (ohci, td_dma); |
888 | if (!td) { | 886 | if (!td) { |
@@ -901,10 +899,10 @@ static struct td *dl_reverse_done_list (struct ohci_hcd *ohci) | |||
901 | && (td->ed->hwHeadP & cpu_to_hc32 (ohci, ED_H))) | 899 | && (td->ed->hwHeadP & cpu_to_hc32 (ohci, ED_H))) |
902 | td_rev = ed_halted (ohci, td, cc, td_rev); | 900 | td_rev = ed_halted (ohci, td, cc, td_rev); |
903 | 901 | ||
904 | td->next_dl_td = td_rev; | 902 | td->next_dl_td = td_rev; |
905 | td_rev = td; | 903 | td_rev = td; |
906 | td_dma = hc32_to_cpup (ohci, &td->hwNextTD); | 904 | td_dma = hc32_to_cpup (ohci, &td->hwNextTD); |
907 | } | 905 | } |
908 | return td_rev; | 906 | return td_rev; |
909 | } | 907 | } |
910 | 908 | ||
@@ -1013,9 +1011,9 @@ rescan_this: | |||
1013 | 1011 | ||
1014 | if (modified) | 1012 | if (modified) |
1015 | goto rescan_all; | 1013 | goto rescan_all; |
1016 | } | 1014 | } |
1017 | 1015 | ||
1018 | /* maybe reenable control and bulk lists */ | 1016 | /* maybe reenable control and bulk lists */ |
1019 | if (HC_IS_RUNNING(ohci_to_hcd(ohci)->state) | 1017 | if (HC_IS_RUNNING(ohci_to_hcd(ohci)->state) |
1020 | && ohci_to_hcd(ohci)->state != HC_STATE_QUIESCING | 1018 | && ohci_to_hcd(ohci)->state != HC_STATE_QUIESCING |
1021 | && !ohci->ed_rm_list) { | 1019 | && !ohci->ed_rm_list) { |
@@ -1041,20 +1039,20 @@ rescan_this: | |||
1041 | &ohci->regs->ed_bulkcurrent); | 1039 | &ohci->regs->ed_bulkcurrent); |
1042 | } | 1040 | } |
1043 | } | 1041 | } |
1044 | 1042 | ||
1045 | /* CLE/BLE to enable, CLF/BLF to (maybe) kickstart */ | 1043 | /* CLE/BLE to enable, CLF/BLF to (maybe) kickstart */ |
1046 | if (control) { | 1044 | if (control) { |
1047 | ohci->hc_control |= control; | 1045 | ohci->hc_control |= control; |
1048 | if (ohci->flags & OHCI_QUIRK_ZFMICRO) | 1046 | if (ohci->flags & OHCI_QUIRK_ZFMICRO) |
1049 | mdelay(1); | 1047 | mdelay(1); |
1050 | ohci_writel (ohci, ohci->hc_control, | 1048 | ohci_writel (ohci, ohci->hc_control, |
1051 | &ohci->regs->control); | 1049 | &ohci->regs->control); |
1052 | } | 1050 | } |
1053 | if (command) { | 1051 | if (command) { |
1054 | if (ohci->flags & OHCI_QUIRK_ZFMICRO) | 1052 | if (ohci->flags & OHCI_QUIRK_ZFMICRO) |
1055 | mdelay(1); | 1053 | mdelay(1); |
1056 | ohci_writel (ohci, command, &ohci->regs->cmdstatus); | 1054 | ohci_writel (ohci, command, &ohci->regs->cmdstatus); |
1057 | } | 1055 | } |
1058 | } | 1056 | } |
1059 | } | 1057 | } |
1060 | 1058 | ||
@@ -1074,19 +1072,19 @@ dl_done_list (struct ohci_hcd *ohci) | |||
1074 | { | 1072 | { |
1075 | struct td *td = dl_reverse_done_list (ohci); | 1073 | struct td *td = dl_reverse_done_list (ohci); |
1076 | 1074 | ||
1077 | while (td) { | 1075 | while (td) { |
1078 | struct td *td_next = td->next_dl_td; | 1076 | struct td *td_next = td->next_dl_td; |
1079 | struct urb *urb = td->urb; | 1077 | struct urb *urb = td->urb; |
1080 | urb_priv_t *urb_priv = urb->hcpriv; | 1078 | urb_priv_t *urb_priv = urb->hcpriv; |
1081 | struct ed *ed = td->ed; | 1079 | struct ed *ed = td->ed; |
1082 | 1080 | ||
1083 | /* update URB's length and status from TD */ | 1081 | /* update URB's length and status from TD */ |
1084 | td_done (ohci, urb, td); | 1082 | td_done (ohci, urb, td); |
1085 | urb_priv->td_cnt++; | 1083 | urb_priv->td_cnt++; |
1086 | 1084 | ||
1087 | /* If all this urb's TDs are done, call complete() */ | 1085 | /* If all this urb's TDs are done, call complete() */ |
1088 | if (urb_priv->td_cnt == urb_priv->length) | 1086 | if (urb_priv->td_cnt == urb_priv->length) |
1089 | finish_urb (ohci, urb); | 1087 | finish_urb (ohci, urb); |
1090 | 1088 | ||
1091 | /* clean schedule: unlink EDs that are no longer busy */ | 1089 | /* clean schedule: unlink EDs that are no longer busy */ |
1092 | if (list_empty (&ed->td_list)) { | 1090 | if (list_empty (&ed->td_list)) { |
@@ -1094,25 +1092,26 @@ dl_done_list (struct ohci_hcd *ohci) | |||
1094 | start_ed_unlink (ohci, ed); | 1092 | start_ed_unlink (ohci, ed); |
1095 | 1093 | ||
1096 | /* ... reenabling halted EDs only after fault cleanup */ | 1094 | /* ... reenabling halted EDs only after fault cleanup */ |
1097 | } else if ((ed->hwINFO & cpu_to_hc32 (ohci, ED_SKIP | ED_DEQUEUE)) | 1095 | } else if ((ed->hwINFO & cpu_to_hc32 (ohci, |
1096 | ED_SKIP | ED_DEQUEUE)) | ||
1098 | == cpu_to_hc32 (ohci, ED_SKIP)) { | 1097 | == cpu_to_hc32 (ohci, ED_SKIP)) { |
1099 | td = list_entry (ed->td_list.next, struct td, td_list); | 1098 | td = list_entry (ed->td_list.next, struct td, td_list); |
1100 | if (!(td->hwINFO & cpu_to_hc32 (ohci, TD_DONE))) { | 1099 | if (!(td->hwINFO & cpu_to_hc32 (ohci, TD_DONE))) { |
1101 | ed->hwINFO &= ~cpu_to_hc32 (ohci, ED_SKIP); | 1100 | ed->hwINFO &= ~cpu_to_hc32 (ohci, ED_SKIP); |
1102 | /* ... hc may need waking-up */ | 1101 | /* ... hc may need waking-up */ |
1103 | switch (ed->type) { | 1102 | switch (ed->type) { |
1104 | case PIPE_CONTROL: | 1103 | case PIPE_CONTROL: |
1105 | ohci_writel (ohci, OHCI_CLF, | 1104 | ohci_writel (ohci, OHCI_CLF, |
1106 | &ohci->regs->cmdstatus); | 1105 | &ohci->regs->cmdstatus); |
1107 | break; | 1106 | break; |
1108 | case PIPE_BULK: | 1107 | case PIPE_BULK: |
1109 | ohci_writel (ohci, OHCI_BLF, | 1108 | ohci_writel (ohci, OHCI_BLF, |
1110 | &ohci->regs->cmdstatus); | 1109 | &ohci->regs->cmdstatus); |
1111 | break; | 1110 | break; |
1112 | } | 1111 | } |
1113 | } | 1112 | } |
1114 | } | 1113 | } |
1115 | 1114 | ||
1116 | td = td_next; | 1115 | td = td_next; |
1117 | } | 1116 | } |
1118 | } | 1117 | } |
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index 59e436424d41..b350d45033e7 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c | |||
@@ -447,7 +447,7 @@ static const struct hc_driver ohci_s3c2410_hc_driver = { | |||
447 | */ | 447 | */ |
448 | .start = ohci_s3c2410_start, | 448 | .start = ohci_s3c2410_start, |
449 | .stop = ohci_stop, | 449 | .stop = ohci_stop, |
450 | .shutdown = ohci_shutdown, | 450 | .shutdown = ohci_shutdown, |
451 | 451 | ||
452 | /* | 452 | /* |
453 | * managing i/o requests and associated device resources | 453 | * managing i/o requests and associated device resources |
@@ -492,7 +492,7 @@ static int ohci_hcd_s3c2410_drv_remove(struct platform_device *pdev) | |||
492 | static struct platform_driver ohci_hcd_s3c2410_driver = { | 492 | static struct platform_driver ohci_hcd_s3c2410_driver = { |
493 | .probe = ohci_hcd_s3c2410_drv_probe, | 493 | .probe = ohci_hcd_s3c2410_drv_probe, |
494 | .remove = ohci_hcd_s3c2410_drv_remove, | 494 | .remove = ohci_hcd_s3c2410_drv_remove, |
495 | .shutdown = usb_hcd_platform_shutdown, | 495 | .shutdown = usb_hcd_platform_shutdown, |
496 | /*.suspend = ohci_hcd_s3c2410_drv_suspend, */ | 496 | /*.suspend = ohci_hcd_s3c2410_drv_suspend, */ |
497 | /*.resume = ohci_hcd_s3c2410_drv_resume, */ | 497 | /*.resume = ohci_hcd_s3c2410_drv_resume, */ |
498 | .driver = { | 498 | .driver = { |
diff --git a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c index 71371de32ada..fe0090e33675 100644 --- a/drivers/usb/host/ohci-sa1111.c +++ b/drivers/usb/host/ohci-sa1111.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> | 4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> |
5 | * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net> | 5 | * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net> |
6 | * (C) Copyright 2002 Hewlett-Packard Company | 6 | * (C) Copyright 2002 Hewlett-Packard Company |
7 | * | 7 | * |
8 | * SA1111 Bus Glue | 8 | * SA1111 Bus Glue |
9 | * | 9 | * |
10 | * Written by Christopher Hoover <ch@hpl.hp.com> | 10 | * Written by Christopher Hoover <ch@hpl.hp.com> |
@@ -12,7 +12,7 @@ | |||
12 | * | 12 | * |
13 | * This file is licenced under the GPL. | 13 | * This file is licenced under the GPL. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <asm/hardware.h> | 16 | #include <asm/hardware.h> |
17 | #include <asm/mach-types.h> | 17 | #include <asm/mach-types.h> |
18 | #include <asm/arch/assabet.h> | 18 | #include <asm/arch/assabet.h> |
@@ -31,7 +31,7 @@ static void sa1111_start_hc(struct sa1111_dev *dev) | |||
31 | { | 31 | { |
32 | unsigned int usb_rst = 0; | 32 | unsigned int usb_rst = 0; |
33 | 33 | ||
34 | printk(KERN_DEBUG __FILE__ | 34 | printk(KERN_DEBUG __FILE__ |
35 | ": starting SA-1111 OHCI USB Controller\n"); | 35 | ": starting SA-1111 OHCI USB Controller\n"); |
36 | 36 | ||
37 | #ifdef CONFIG_SA1100_BADGE4 | 37 | #ifdef CONFIG_SA1100_BADGE4 |
@@ -65,7 +65,7 @@ static void sa1111_start_hc(struct sa1111_dev *dev) | |||
65 | static void sa1111_stop_hc(struct sa1111_dev *dev) | 65 | static void sa1111_stop_hc(struct sa1111_dev *dev) |
66 | { | 66 | { |
67 | unsigned int usb_rst; | 67 | unsigned int usb_rst; |
68 | printk(KERN_DEBUG __FILE__ | 68 | printk(KERN_DEBUG __FILE__ |
69 | ": stopping SA-1111 OHCI USB Controller\n"); | 69 | ": stopping SA-1111 OHCI USB Controller\n"); |
70 | 70 | ||
71 | /* | 71 | /* |
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index a2f42a2f47c6..405257f3e853 100644 --- a/drivers/usb/host/ohci.h +++ b/drivers/usb/host/ohci.h | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * OHCI HCD (Host Controller Driver) for USB. | 2 | * OHCI HCD (Host Controller Driver) for USB. |
3 | * | 3 | * |
4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> | 4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> |
5 | * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net> | 5 | * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net> |
6 | * | 6 | * |
7 | * This file is licenced under the GPL. | 7 | * This file is licenced under the GPL. |
8 | */ | 8 | */ |
9 | 9 | ||
@@ -14,7 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | typedef __u32 __bitwise __hc32; | 15 | typedef __u32 __bitwise __hc32; |
16 | typedef __u16 __bitwise __hc16; | 16 | typedef __u16 __bitwise __hc16; |
17 | 17 | ||
18 | /* | 18 | /* |
19 | * OHCI Endpoint Descriptor (ED) ... holds TD queue | 19 | * OHCI Endpoint Descriptor (ED) ... holds TD queue |
20 | * See OHCI spec, section 4.2 | 20 | * See OHCI spec, section 4.2 |
@@ -24,7 +24,7 @@ typedef __u16 __bitwise __hc16; | |||
24 | */ | 24 | */ |
25 | struct ed { | 25 | struct ed { |
26 | /* first fields are hardware-specified */ | 26 | /* first fields are hardware-specified */ |
27 | __hc32 hwINFO; /* endpoint config bitmap */ | 27 | __hc32 hwINFO; /* endpoint config bitmap */ |
28 | /* info bits defined by hcd */ | 28 | /* info bits defined by hcd */ |
29 | #define ED_DEQUEUE (1 << 27) | 29 | #define ED_DEQUEUE (1 << 27) |
30 | /* info bits defined by the hardware */ | 30 | /* info bits defined by the hardware */ |
@@ -52,11 +52,11 @@ struct ed { | |||
52 | * usually: OPER --> UNLINK --> (IDLE | OPER) --> ... | 52 | * usually: OPER --> UNLINK --> (IDLE | OPER) --> ... |
53 | */ | 53 | */ |
54 | u8 state; /* ED_{IDLE,UNLINK,OPER} */ | 54 | u8 state; /* ED_{IDLE,UNLINK,OPER} */ |
55 | #define ED_IDLE 0x00 /* NOT linked to HC */ | 55 | #define ED_IDLE 0x00 /* NOT linked to HC */ |
56 | #define ED_UNLINK 0x01 /* being unlinked from hc */ | 56 | #define ED_UNLINK 0x01 /* being unlinked from hc */ |
57 | #define ED_OPER 0x02 /* IS linked to hc */ | 57 | #define ED_OPER 0x02 /* IS linked to hc */ |
58 | 58 | ||
59 | u8 type; /* PIPE_{BULK,...} */ | 59 | u8 type; /* PIPE_{BULK,...} */ |
60 | 60 | ||
61 | /* periodic scheduling params (for intr and iso) */ | 61 | /* periodic scheduling params (for intr and iso) */ |
62 | u8 branch; | 62 | u8 branch; |
@@ -70,7 +70,7 @@ struct ed { | |||
70 | 70 | ||
71 | #define ED_MASK ((u32)~0x0f) /* strip hw status in low addr bits */ | 71 | #define ED_MASK ((u32)~0x0f) /* strip hw status in low addr bits */ |
72 | 72 | ||
73 | 73 | ||
74 | /* | 74 | /* |
75 | * OHCI Transfer Descriptor (TD) ... one per transfer segment | 75 | * OHCI Transfer Descriptor (TD) ... one per transfer segment |
76 | * See OHCI spec, sections 4.3.1 (general = control/bulk/interrupt) | 76 | * See OHCI spec, sections 4.3.1 (general = control/bulk/interrupt) |
@@ -107,22 +107,22 @@ struct td { | |||
107 | 107 | ||
108 | /* (no hwINFO #defines yet for iso tds) */ | 108 | /* (no hwINFO #defines yet for iso tds) */ |
109 | 109 | ||
110 | __hc32 hwCBP; /* Current Buffer Pointer (or 0) */ | 110 | __hc32 hwCBP; /* Current Buffer Pointer (or 0) */ |
111 | __hc32 hwNextTD; /* Next TD Pointer */ | 111 | __hc32 hwNextTD; /* Next TD Pointer */ |
112 | __hc32 hwBE; /* Memory Buffer End Pointer */ | 112 | __hc32 hwBE; /* Memory Buffer End Pointer */ |
113 | 113 | ||
114 | /* PSW is only for ISO. Only 1 PSW entry is used, but on | 114 | /* PSW is only for ISO. Only 1 PSW entry is used, but on |
115 | * big-endian PPC hardware that's the second entry. | 115 | * big-endian PPC hardware that's the second entry. |
116 | */ | 116 | */ |
117 | #define MAXPSW 2 | 117 | #define MAXPSW 2 |
118 | __hc16 hwPSW [MAXPSW]; | 118 | __hc16 hwPSW [MAXPSW]; |
119 | 119 | ||
120 | /* rest are purely for the driver's use */ | 120 | /* rest are purely for the driver's use */ |
121 | __u8 index; | 121 | __u8 index; |
122 | struct ed *ed; | 122 | struct ed *ed; |
123 | struct td *td_hash; /* dma-->td hashtable */ | 123 | struct td *td_hash; /* dma-->td hashtable */ |
124 | struct td *next_dl_td; | 124 | struct td *next_dl_td; |
125 | struct urb *urb; | 125 | struct urb *urb; |
126 | 126 | ||
127 | dma_addr_t td_dma; /* addr of this TD */ | 127 | dma_addr_t td_dma; /* addr of this TD */ |
128 | dma_addr_t data_dma; /* addr of data it points to */ | 128 | dma_addr_t data_dma; /* addr of data it points to */ |
@@ -152,8 +152,8 @@ struct td { | |||
152 | #define TD_NOTACCESSED 0x0F | 152 | #define TD_NOTACCESSED 0x0F |
153 | 153 | ||
154 | 154 | ||
155 | /* map OHCI TD status codes (CC) to errno values */ | 155 | /* map OHCI TD status codes (CC) to errno values */ |
156 | static const int cc_to_error [16] = { | 156 | static const int cc_to_error [16] = { |
157 | /* No Error */ 0, | 157 | /* No Error */ 0, |
158 | /* CRC Error */ -EILSEQ, | 158 | /* CRC Error */ -EILSEQ, |
159 | /* Bit Stuff */ -EPROTO, | 159 | /* Bit Stuff */ -EPROTO, |
@@ -169,7 +169,7 @@ static const int cc_to_error [16] = { | |||
169 | /* BufferOver */ -ECOMM, | 169 | /* BufferOver */ -ECOMM, |
170 | /* BuffUnder */ -ENOSR, | 170 | /* BuffUnder */ -ENOSR, |
171 | /* (for HCD) */ -EALREADY, | 171 | /* (for HCD) */ -EALREADY, |
172 | /* (for HCD) */ -EALREADY | 172 | /* (for HCD) */ -EALREADY |
173 | }; | 173 | }; |
174 | 174 | ||
175 | 175 | ||
@@ -182,7 +182,7 @@ struct ohci_hcca { | |||
182 | #define NUM_INTS 32 | 182 | #define NUM_INTS 32 |
183 | __hc32 int_table [NUM_INTS]; /* periodic schedule */ | 183 | __hc32 int_table [NUM_INTS]; /* periodic schedule */ |
184 | 184 | ||
185 | /* | 185 | /* |
186 | * OHCI defines u16 frame_no, followed by u16 zero pad. | 186 | * OHCI defines u16 frame_no, followed by u16 zero pad. |
187 | * Since some processors can't do 16 bit bus accesses, | 187 | * Since some processors can't do 16 bit bus accesses, |
188 | * portable access must be a 32 bits wide. | 188 | * portable access must be a 32 bits wide. |
@@ -262,10 +262,10 @@ struct ohci_regs { | |||
262 | * HcCommandStatus (cmdstatus) register masks | 262 | * HcCommandStatus (cmdstatus) register masks |
263 | */ | 263 | */ |
264 | #define OHCI_HCR (1 << 0) /* host controller reset */ | 264 | #define OHCI_HCR (1 << 0) /* host controller reset */ |
265 | #define OHCI_CLF (1 << 1) /* control list filled */ | 265 | #define OHCI_CLF (1 << 1) /* control list filled */ |
266 | #define OHCI_BLF (1 << 2) /* bulk list filled */ | 266 | #define OHCI_BLF (1 << 2) /* bulk list filled */ |
267 | #define OHCI_OCR (1 << 3) /* ownership change request */ | 267 | #define OHCI_OCR (1 << 3) /* ownership change request */ |
268 | #define OHCI_SOC (3 << 16) /* scheduling overrun count */ | 268 | #define OHCI_SOC (3 << 16) /* scheduling overrun count */ |
269 | 269 | ||
270 | /* | 270 | /* |
271 | * masks used with interrupt registers: | 271 | * masks used with interrupt registers: |
@@ -285,20 +285,20 @@ struct ohci_regs { | |||
285 | 285 | ||
286 | 286 | ||
287 | /* OHCI ROOT HUB REGISTER MASKS */ | 287 | /* OHCI ROOT HUB REGISTER MASKS */ |
288 | 288 | ||
289 | /* roothub.portstatus [i] bits */ | 289 | /* roothub.portstatus [i] bits */ |
290 | #define RH_PS_CCS 0x00000001 /* current connect status */ | 290 | #define RH_PS_CCS 0x00000001 /* current connect status */ |
291 | #define RH_PS_PES 0x00000002 /* port enable status*/ | 291 | #define RH_PS_PES 0x00000002 /* port enable status*/ |
292 | #define RH_PS_PSS 0x00000004 /* port suspend status */ | 292 | #define RH_PS_PSS 0x00000004 /* port suspend status */ |
293 | #define RH_PS_POCI 0x00000008 /* port over current indicator */ | 293 | #define RH_PS_POCI 0x00000008 /* port over current indicator */ |
294 | #define RH_PS_PRS 0x00000010 /* port reset status */ | 294 | #define RH_PS_PRS 0x00000010 /* port reset status */ |
295 | #define RH_PS_PPS 0x00000100 /* port power status */ | 295 | #define RH_PS_PPS 0x00000100 /* port power status */ |
296 | #define RH_PS_LSDA 0x00000200 /* low speed device attached */ | 296 | #define RH_PS_LSDA 0x00000200 /* low speed device attached */ |
297 | #define RH_PS_CSC 0x00010000 /* connect status change */ | 297 | #define RH_PS_CSC 0x00010000 /* connect status change */ |
298 | #define RH_PS_PESC 0x00020000 /* port enable status change */ | 298 | #define RH_PS_PESC 0x00020000 /* port enable status change */ |
299 | #define RH_PS_PSSC 0x00040000 /* port suspend status change */ | 299 | #define RH_PS_PSSC 0x00040000 /* port suspend status change */ |
300 | #define RH_PS_OCIC 0x00080000 /* over current indicator change */ | 300 | #define RH_PS_OCIC 0x00080000 /* over current indicator change */ |
301 | #define RH_PS_PRSC 0x00100000 /* port reset status change */ | 301 | #define RH_PS_PRSC 0x00100000 /* port reset status change */ |
302 | 302 | ||
303 | /* roothub.status bits */ | 303 | /* roothub.status bits */ |
304 | #define RH_HS_LPS 0x00000001 /* local power status */ | 304 | #define RH_HS_LPS 0x00000001 /* local power status */ |
@@ -333,7 +333,7 @@ typedef struct urb_priv { | |||
333 | } urb_priv_t; | 333 | } urb_priv_t; |
334 | 334 | ||
335 | #define TD_HASH_SIZE 64 /* power'o'two */ | 335 | #define TD_HASH_SIZE 64 /* power'o'two */ |
336 | // sizeof (struct td) ~= 64 == 2^6 ... | 336 | // sizeof (struct td) ~= 64 == 2^6 ... |
337 | #define TD_HASH_FUNC(td_dma) ((td_dma ^ (td_dma >> 6)) % TD_HASH_SIZE) | 337 | #define TD_HASH_FUNC(td_dma) ((td_dma ^ (td_dma >> 6)) % TD_HASH_SIZE) |
338 | 338 | ||
339 | 339 | ||
@@ -364,11 +364,11 @@ struct ohci_hcd { | |||
364 | 364 | ||
365 | struct ed *ed_bulktail; /* last in bulk list */ | 365 | struct ed *ed_bulktail; /* last in bulk list */ |
366 | struct ed *ed_controltail; /* last in ctrl list */ | 366 | struct ed *ed_controltail; /* last in ctrl list */ |
367 | struct ed *periodic [NUM_INTS]; /* shadow int_table */ | 367 | struct ed *periodic [NUM_INTS]; /* shadow int_table */ |
368 | 368 | ||
369 | /* | 369 | /* |
370 | * OTG controllers and transceivers need software interaction; | 370 | * OTG controllers and transceivers need software interaction; |
371 | * other external transceivers should be software-transparent | 371 | * other external transceivers should be software-transparent |
372 | */ | 372 | */ |
373 | struct otg_transceiver *transceiver; | 373 | struct otg_transceiver *transceiver; |
374 | 374 | ||
@@ -385,7 +385,7 @@ struct ohci_hcd { | |||
385 | */ | 385 | */ |
386 | int num_ports; | 386 | int num_ports; |
387 | int load [NUM_INTS]; | 387 | int load [NUM_INTS]; |
388 | u32 hc_control; /* copy of hc control reg */ | 388 | u32 hc_control; /* copy of hc control reg */ |
389 | unsigned long next_statechange; /* suspend/resume */ | 389 | unsigned long next_statechange; /* suspend/resume */ |
390 | u32 fminterval; /* saved register */ | 390 | u32 fminterval; /* saved register */ |
391 | unsigned autostop:1; /* rh auto stopping/stopped */ | 391 | unsigned autostop:1; /* rh auto stopping/stopped */ |
@@ -598,11 +598,11 @@ static inline void disable (struct ohci_hcd *ohci) | |||
598 | } | 598 | } |
599 | 599 | ||
600 | #define FI 0x2edf /* 12000 bits per frame (-1) */ | 600 | #define FI 0x2edf /* 12000 bits per frame (-1) */ |
601 | #define FSMP(fi) (0x7fff & ((6 * ((fi) - 210)) / 7)) | 601 | #define FSMP(fi) (0x7fff & ((6 * ((fi) - 210)) / 7)) |
602 | #define FIT (1 << 31) | 602 | #define FIT (1 << 31) |
603 | #define LSTHRESH 0x628 /* lowspeed bit threshold */ | 603 | #define LSTHRESH 0x628 /* lowspeed bit threshold */ |
604 | 604 | ||
605 | static void periodic_reinit (struct ohci_hcd *ohci) | 605 | static inline void periodic_reinit (struct ohci_hcd *ohci) |
606 | { | 606 | { |
607 | u32 fi = ohci->fminterval & 0x03fff; | 607 | u32 fi = ohci->fminterval & 0x03fff; |
608 | u32 fit = ohci_readl(ohci, &ohci->regs->fminterval) & FIT; | 608 | u32 fit = ohci_readl(ohci, &ohci->regs->fminterval) & FIT; |
@@ -626,11 +626,11 @@ static void periodic_reinit (struct ohci_hcd *ohci) | |||
626 | temp = ohci_readl (hc, &hc->regs->roothub.register); \ | 626 | temp = ohci_readl (hc, &hc->regs->roothub.register); \ |
627 | temp; }) | 627 | temp; }) |
628 | 628 | ||
629 | static u32 roothub_a (struct ohci_hcd *hc) | 629 | static inline u32 roothub_a (struct ohci_hcd *hc) |
630 | { return read_roothub (hc, a, 0xfc0fe000); } | 630 | { return read_roothub (hc, a, 0xfc0fe000); } |
631 | static inline u32 roothub_b (struct ohci_hcd *hc) | 631 | static inline u32 roothub_b (struct ohci_hcd *hc) |
632 | { return ohci_readl (hc, &hc->regs->roothub.b); } | 632 | { return ohci_readl (hc, &hc->regs->roothub.b); } |
633 | static inline u32 roothub_status (struct ohci_hcd *hc) | 633 | static inline u32 roothub_status (struct ohci_hcd *hc) |
634 | { return ohci_readl (hc, &hc->regs->roothub.status); } | 634 | { return ohci_readl (hc, &hc->regs->roothub.status); } |
635 | static u32 roothub_portstatus (struct ohci_hcd *hc, int i) | 635 | static inline u32 roothub_portstatus (struct ohci_hcd *hc, int i) |
636 | { return read_roothub (hc, portstatus [i], 0xffe0fce0); } | 636 | { return read_roothub (hc, portstatus [i], 0xffe0fce0); } |
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c index a9d7119e3176..a7fa0d75567d 100644 --- a/drivers/usb/host/u132-hcd.c +++ b/drivers/usb/host/u132-hcd.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/moduleparam.h> | 40 | #include <linux/moduleparam.h> |
41 | #include <linux/delay.h> | 41 | #include <linux/delay.h> |
42 | #include <linux/ioport.h> | 42 | #include <linux/ioport.h> |
43 | #include <linux/pci_ids.h> | ||
43 | #include <linux/sched.h> | 44 | #include <linux/sched.h> |
44 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
45 | #include <linux/smp_lock.h> | 46 | #include <linux/smp_lock.h> |
@@ -210,15 +211,16 @@ struct u132 { | |||
210 | * these cannot be inlines because we need the structure offset!! | 211 | * these cannot be inlines because we need the structure offset!! |
211 | * Does anyone have a better way????? | 212 | * Does anyone have a better way????? |
212 | */ | 213 | */ |
214 | #define ftdi_read_pcimem(pdev, member, data) usb_ftdi_elan_read_pcimem(pdev, \ | ||
215 | offsetof(struct ohci_regs, member), 0, data); | ||
216 | #define ftdi_write_pcimem(pdev, member, data) usb_ftdi_elan_write_pcimem(pdev, \ | ||
217 | offsetof(struct ohci_regs, member), 0, data); | ||
213 | #define u132_read_pcimem(u132, member, data) \ | 218 | #define u132_read_pcimem(u132, member, data) \ |
214 | usb_ftdi_elan_read_pcimem(u132->platform_dev, offsetof(struct \ | 219 | usb_ftdi_elan_read_pcimem(u132->platform_dev, offsetof(struct \ |
215 | ohci_regs, member), 0, data); | 220 | ohci_regs, member), 0, data); |
216 | #define u132_write_pcimem(u132, member, data) \ | 221 | #define u132_write_pcimem(u132, member, data) \ |
217 | usb_ftdi_elan_write_pcimem(u132->platform_dev, offsetof(struct \ | 222 | usb_ftdi_elan_write_pcimem(u132->platform_dev, offsetof(struct \ |
218 | ohci_regs, member), 0, data); | 223 | ohci_regs, member), 0, data); |
219 | #define u132_write_pcimem_byte(u132, member, data) \ | ||
220 | usb_ftdi_elan_write_pcimem(u132->platform_dev, offsetof(struct \ | ||
221 | ohci_regs, member), 0x0e, data); | ||
222 | static inline struct u132 *udev_to_u132(struct u132_udev *udev) | 224 | static inline struct u132 *udev_to_u132(struct u132_udev *udev) |
223 | { | 225 | { |
224 | u8 udev_number = udev->udev_number; | 226 | u8 udev_number = udev->udev_number; |
@@ -1574,59 +1576,12 @@ static char *hcfs2string(int state) | |||
1574 | return "?"; | 1576 | return "?"; |
1575 | } | 1577 | } |
1576 | 1578 | ||
1577 | static int u132_usb_reset(struct u132 *u132) | ||
1578 | { | ||
1579 | int retval; | ||
1580 | retval = u132_read_pcimem(u132, control, &u132->hc_control); | ||
1581 | if (retval) | ||
1582 | return retval; | ||
1583 | u132->hc_control &= OHCI_CTRL_RWC; | ||
1584 | retval = u132_write_pcimem(u132, control, u132->hc_control); | ||
1585 | if (retval) | ||
1586 | return retval; | ||
1587 | return 0; | ||
1588 | } | ||
1589 | |||
1590 | static int u132_init(struct u132 *u132) | 1579 | static int u132_init(struct u132 *u132) |
1591 | { | 1580 | { |
1592 | int retval; | 1581 | int retval; |
1593 | u32 control; | 1582 | u32 control; |
1594 | u132_disable(u132); | 1583 | u132_disable(u132); |
1595 | u132->next_statechange = | 1584 | u132->next_statechange = jiffies; |
1596 | jiffies; /* SMM owns the HC? not for long! */ { | ||
1597 | u32 control; | ||
1598 | retval = u132_read_pcimem(u132, control, &control); | ||
1599 | if (retval) | ||
1600 | return retval; | ||
1601 | if (control & OHCI_CTRL_IR) { | ||
1602 | u32 temp = 50; | ||
1603 | retval = u132_write_pcimem(u132, intrenable, | ||
1604 | OHCI_INTR_OC); | ||
1605 | if (retval) | ||
1606 | return retval; | ||
1607 | retval = u132_write_pcimem_byte(u132, cmdstatus, | ||
1608 | OHCI_OCR); | ||
1609 | if (retval) | ||
1610 | return retval; | ||
1611 | check:{ | ||
1612 | retval = u132_read_pcimem(u132, control, | ||
1613 | &control); | ||
1614 | if (retval) | ||
1615 | return retval; | ||
1616 | } | ||
1617 | if (control & OHCI_CTRL_IR) { | ||
1618 | msleep(10); | ||
1619 | if (--temp == 0) { | ||
1620 | dev_err(&u132->platform_dev->dev, "USB " | ||
1621 | "HC takeover failed!(BIOS/SMM b" | ||
1622 | "ug) control=%08X\n", control); | ||
1623 | return -EBUSY; | ||
1624 | } | ||
1625 | goto check; | ||
1626 | } | ||
1627 | u132_usb_reset(u132); | ||
1628 | } | ||
1629 | } | ||
1630 | retval = u132_write_pcimem(u132, intrdisable, OHCI_INTR_MIE); | 1585 | retval = u132_write_pcimem(u132, intrdisable, OHCI_INTR_MIE); |
1631 | if (retval) | 1586 | if (retval) |
1632 | return retval; | 1587 | return retval; |
@@ -1725,7 +1680,7 @@ static int u132_run(struct u132 *u132) | |||
1725 | retry:retval = u132_read_pcimem(u132, cmdstatus, &status); | 1680 | retry:retval = u132_read_pcimem(u132, cmdstatus, &status); |
1726 | if (retval) | 1681 | if (retval) |
1727 | return retval; | 1682 | return retval; |
1728 | retval = u132_write_pcimem_byte(u132, cmdstatus, OHCI_HCR); | 1683 | retval = u132_write_pcimem(u132, cmdstatus, OHCI_HCR); |
1729 | if (retval) | 1684 | if (retval) |
1730 | return retval; | 1685 | return retval; |
1731 | extra:{ | 1686 | extra:{ |
@@ -1782,7 +1737,7 @@ static int u132_run(struct u132 *u132) | |||
1782 | retval = u132_write_pcimem(u132, control, u132->hc_control); | 1737 | retval = u132_write_pcimem(u132, control, u132->hc_control); |
1783 | if (retval) | 1738 | if (retval) |
1784 | return retval; | 1739 | return retval; |
1785 | retval = u132_write_pcimem_byte(u132, cmdstatus, OHCI_BLF); | 1740 | retval = u132_write_pcimem(u132, cmdstatus, OHCI_BLF); |
1786 | if (retval) | 1741 | if (retval) |
1787 | return retval; | 1742 | return retval; |
1788 | retval = u132_read_pcimem(u132, cmdstatus, &cmdstatus); | 1743 | retval = u132_read_pcimem(u132, cmdstatus, &cmdstatus); |
@@ -1839,8 +1794,8 @@ static void u132_hcd_stop(struct usb_hcd *hcd) | |||
1839 | { | 1794 | { |
1840 | struct u132 *u132 = hcd_to_u132(hcd); | 1795 | struct u132 *u132 = hcd_to_u132(hcd); |
1841 | if (u132->going > 1) { | 1796 | if (u132->going > 1) { |
1842 | dev_err(&u132->platform_dev->dev, "device has been removed %d\n" | 1797 | dev_err(&u132->platform_dev->dev, "u132 device %p(hcd=%p) has b" |
1843 | , u132->going); | 1798 | "een removed %d\n", u132, hcd, u132->going); |
1844 | } else if (u132->going > 0) { | 1799 | } else if (u132->going > 0) { |
1845 | dev_err(&u132->platform_dev->dev, "device hcd=%p is being remov" | 1800 | dev_err(&u132->platform_dev->dev, "device hcd=%p is being remov" |
1846 | "ed\n", hcd); | 1801 | "ed\n", hcd); |
@@ -2545,8 +2500,9 @@ static void u132_endpoint_disable(struct usb_hcd *hcd, | |||
2545 | { | 2500 | { |
2546 | struct u132 *u132 = hcd_to_u132(hcd); | 2501 | struct u132 *u132 = hcd_to_u132(hcd); |
2547 | if (u132->going > 2) { | 2502 | if (u132->going > 2) { |
2548 | dev_err(&u132->platform_dev->dev, "device has been removed %d\n" | 2503 | dev_err(&u132->platform_dev->dev, "u132 device %p(hcd=%p hep=%p" |
2549 | , u132->going); | 2504 | ") has been removed %d\n", u132, hcd, hep, |
2505 | u132->going); | ||
2550 | } else { | 2506 | } else { |
2551 | struct u132_endp *endp = hep->hcpriv; | 2507 | struct u132_endp *endp = hep->hcpriv; |
2552 | if (endp) | 2508 | if (endp) |
@@ -2790,7 +2746,6 @@ static int u132_hub_status_data(struct usb_hcd *hcd, char *buf) | |||
2790 | } else if (u132->going > 0) { | 2746 | } else if (u132->going > 0) { |
2791 | dev_err(&u132->platform_dev->dev, "device hcd=%p is being remov" | 2747 | dev_err(&u132->platform_dev->dev, "device hcd=%p is being remov" |
2792 | "ed\n", hcd); | 2748 | "ed\n", hcd); |
2793 | dump_stack(); | ||
2794 | return -ESHUTDOWN; | 2749 | return -ESHUTDOWN; |
2795 | } else { | 2750 | } else { |
2796 | int i, changed = 0, length = 1; | 2751 | int i, changed = 0, length = 1; |
@@ -3034,12 +2989,15 @@ static int __devexit u132_remove(struct platform_device *pdev) | |||
3034 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 2989 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
3035 | if (hcd) { | 2990 | if (hcd) { |
3036 | struct u132 *u132 = hcd_to_u132(hcd); | 2991 | struct u132 *u132 = hcd_to_u132(hcd); |
3037 | dump_stack(); | ||
3038 | if (u132->going++ > 1) { | 2992 | if (u132->going++ > 1) { |
2993 | dev_err(&u132->platform_dev->dev, "already being remove" | ||
2994 | "d\n"); | ||
3039 | return -ENODEV; | 2995 | return -ENODEV; |
3040 | } else { | 2996 | } else { |
3041 | int rings = MAX_U132_RINGS; | 2997 | int rings = MAX_U132_RINGS; |
3042 | int endps = MAX_U132_ENDPS; | 2998 | int endps = MAX_U132_ENDPS; |
2999 | dev_err(&u132->platform_dev->dev, "removing device u132" | ||
3000 | ".%d\n", u132->sequence_num); | ||
3043 | msleep(100); | 3001 | msleep(100); |
3044 | down(&u132->sw_lock); | 3002 | down(&u132->sw_lock); |
3045 | u132_monitor_cancel_work(u132); | 3003 | u132_monitor_cancel_work(u132); |
@@ -3121,10 +3079,24 @@ static void u132_initialise(struct u132 *u132, struct platform_device *pdev) | |||
3121 | static int __devinit u132_probe(struct platform_device *pdev) | 3079 | static int __devinit u132_probe(struct platform_device *pdev) |
3122 | { | 3080 | { |
3123 | struct usb_hcd *hcd; | 3081 | struct usb_hcd *hcd; |
3082 | int retval; | ||
3083 | u32 control; | ||
3084 | u32 rh_a = -1; | ||
3085 | u32 num_ports; | ||
3124 | msleep(100); | 3086 | msleep(100); |
3125 | if (u132_exiting > 0) { | 3087 | if (u132_exiting > 0) { |
3126 | return -ENODEV; | 3088 | return -ENODEV; |
3127 | } /* refuse to confuse usbcore */ | 3089 | } |
3090 | retval = ftdi_write_pcimem(pdev, intrdisable, OHCI_INTR_MIE); | ||
3091 | if (retval) | ||
3092 | return retval; | ||
3093 | retval = ftdi_read_pcimem(pdev, control, &control); | ||
3094 | if (retval) | ||
3095 | return retval; | ||
3096 | retval = ftdi_read_pcimem(pdev, roothub.a, &rh_a); | ||
3097 | if (retval) | ||
3098 | return retval; | ||
3099 | num_ports = rh_a & RH_A_NDP; /* refuse to confuse usbcore */ | ||
3128 | if (pdev->dev.dma_mask) { | 3100 | if (pdev->dev.dma_mask) { |
3129 | return -EINVAL; | 3101 | return -EINVAL; |
3130 | } | 3102 | } |
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index e87692c31be4..acd101caeeeb 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c | |||
@@ -60,6 +60,11 @@ Randy Dunlap, Georg Acher, Deti Fliegl, Thomas Sailer, Roman Weissgaerber, \ | |||
60 | Alan Stern" | 60 | Alan Stern" |
61 | #define DRIVER_DESC "USB Universal Host Controller Interface driver" | 61 | #define DRIVER_DESC "USB Universal Host Controller Interface driver" |
62 | 62 | ||
63 | /* for flakey hardware, ignore overcurrent indicators */ | ||
64 | static int ignore_oc; | ||
65 | module_param(ignore_oc, bool, S_IRUGO); | ||
66 | MODULE_PARM_DESC(ignore_oc, "ignore hardware overcurrent indications"); | ||
67 | |||
63 | /* | 68 | /* |
64 | * debug = 0, no debugging messages | 69 | * debug = 0, no debugging messages |
65 | * debug = 1, dump failed URBs except for stalls | 70 | * debug = 1, dump failed URBs except for stalls |
@@ -169,6 +174,11 @@ static int resume_detect_interrupts_are_broken(struct uhci_hcd *uhci) | |||
169 | { | 174 | { |
170 | int port; | 175 | int port; |
171 | 176 | ||
177 | /* If we have to ignore overcurrent events then almost by definition | ||
178 | * we can't depend on resume-detect interrupts. */ | ||
179 | if (ignore_oc) | ||
180 | return 1; | ||
181 | |||
172 | switch (to_pci_dev(uhci_dev(uhci))->vendor) { | 182 | switch (to_pci_dev(uhci_dev(uhci))->vendor) { |
173 | default: | 183 | default: |
174 | break; | 184 | break; |
@@ -921,7 +931,8 @@ static int __init uhci_hcd_init(void) | |||
921 | { | 931 | { |
922 | int retval = -ENOMEM; | 932 | int retval = -ENOMEM; |
923 | 933 | ||
924 | printk(KERN_INFO DRIVER_DESC " " DRIVER_VERSION "\n"); | 934 | printk(KERN_INFO DRIVER_DESC " " DRIVER_VERSION "%s\n", |
935 | ignore_oc ? ", overcurrent ignored" : ""); | ||
925 | 936 | ||
926 | if (usb_disabled()) | 937 | if (usb_disabled()) |
927 | return -ENODEV; | 938 | return -ENODEV; |
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c index f8347f1a10b6..bacc25c53ba3 100644 --- a/drivers/usb/host/uhci-hub.c +++ b/drivers/usb/host/uhci-hub.c | |||
@@ -52,10 +52,20 @@ static int any_ports_active(struct uhci_hcd *uhci) | |||
52 | static inline int get_hub_status_data(struct uhci_hcd *uhci, char *buf) | 52 | static inline int get_hub_status_data(struct uhci_hcd *uhci, char *buf) |
53 | { | 53 | { |
54 | int port; | 54 | int port; |
55 | int mask = RWC_BITS; | ||
56 | |||
57 | /* Some boards (both VIA and Intel apparently) report bogus | ||
58 | * overcurrent indications, causing massive log spam unless | ||
59 | * we completely ignore them. This doesn't seem to be a problem | ||
60 | * with the chipset so much as with the way it is connected on | ||
61 | * the motherboard; if the overcurrent input is left to float | ||
62 | * then it may constantly register false positives. */ | ||
63 | if (ignore_oc) | ||
64 | mask &= ~USBPORTSC_OCC; | ||
55 | 65 | ||
56 | *buf = 0; | 66 | *buf = 0; |
57 | for (port = 0; port < uhci->rh_numports; ++port) { | 67 | for (port = 0; port < uhci->rh_numports; ++port) { |
58 | if ((inw(uhci->io_addr + USBPORTSC1 + port * 2) & RWC_BITS) || | 68 | if ((inw(uhci->io_addr + USBPORTSC1 + port * 2) & mask) || |
59 | test_bit(port, &uhci->port_c_suspend)) | 69 | test_bit(port, &uhci->port_c_suspend)) |
60 | *buf |= (1 << (port + 1)); | 70 | *buf |= (1 << (port + 1)); |
61 | } | 71 | } |
@@ -263,7 +273,7 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
263 | wPortChange |= USB_PORT_STAT_C_CONNECTION; | 273 | wPortChange |= USB_PORT_STAT_C_CONNECTION; |
264 | if (status & USBPORTSC_PEC) | 274 | if (status & USBPORTSC_PEC) |
265 | wPortChange |= USB_PORT_STAT_C_ENABLE; | 275 | wPortChange |= USB_PORT_STAT_C_ENABLE; |
266 | if (status & USBPORTSC_OCC) | 276 | if ((status & USBPORTSC_OCC) && !ignore_oc) |
267 | wPortChange |= USB_PORT_STAT_C_OVERCURRENT; | 277 | wPortChange |= USB_PORT_STAT_C_OVERCURRENT; |
268 | 278 | ||
269 | if (test_bit(port, &uhci->port_c_suspend)) { | 279 | if (test_bit(port, &uhci->port_c_suspend)) { |