OHCI: remove existing autosuspend code
[pandora-kernel.git] / drivers / usb / host / ohci-hub.c
1 /*
2  * OHCI HCD (Host Controller Driver) for USB.
3  * 
4  * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
5  * (C) Copyright 2000-2004 David Brownell <dbrownell@users.sourceforge.net>
6  * 
7  * This file is licenced under GPL
8  */
9
10 /*-------------------------------------------------------------------------*/
11
12 /*
13  * OHCI Root Hub ... the nonsharable stuff
14  */
15
16 #define dbg_port(hc,label,num,value) \
17         ohci_dbg (hc, \
18                 "%s roothub.portstatus [%d] " \
19                 "= 0x%08x%s%s%s%s%s%s%s%s%s%s%s%s\n", \
20                 label, num, temp, \
21                 (temp & RH_PS_PRSC) ? " PRSC" : "", \
22                 (temp & RH_PS_OCIC) ? " OCIC" : "", \
23                 (temp & RH_PS_PSSC) ? " PSSC" : "", \
24                 (temp & RH_PS_PESC) ? " PESC" : "", \
25                 (temp & RH_PS_CSC) ? " CSC" : "", \
26                 \
27                 (temp & RH_PS_LSDA) ? " LSDA" : "", \
28                 (temp & RH_PS_PPS) ? " PPS" : "", \
29                 (temp & RH_PS_PRS) ? " PRS" : "", \
30                 (temp & RH_PS_POCI) ? " POCI" : "", \
31                 (temp & RH_PS_PSS) ? " PSS" : "", \
32                 \
33                 (temp & RH_PS_PES) ? " PES" : "", \
34                 (temp & RH_PS_CCS) ? " CCS" : "" \
35                 );
36
37 /*-------------------------------------------------------------------------*/
38
39 /* hcd->hub_irq_enable() */
40 static void ohci_rhsc_enable (struct usb_hcd *hcd)
41 {
42         struct ohci_hcd         *ohci = hcd_to_ohci (hcd);
43
44         hcd->poll_rh = 0;
45         ohci_writel (ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable);
46 }
47
48 #ifdef  CONFIG_PM
49
50 #define OHCI_SCHED_ENABLES \
51         (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE)
52
53 static void dl_done_list (struct ohci_hcd *, struct pt_regs *);
54 static void finish_unlinks (struct ohci_hcd *, u16 , struct pt_regs *);
55 static int ohci_restart (struct ohci_hcd *ohci);
56
57 static int ohci_bus_suspend (struct usb_hcd *hcd)
58 {
59         struct ohci_hcd         *ohci = hcd_to_ohci (hcd);
60         int                     status = 0;
61         unsigned long           flags;
62
63         spin_lock_irqsave (&ohci->lock, flags);
64
65         if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))) {
66                 spin_unlock_irqrestore (&ohci->lock, flags);
67                 return -ESHUTDOWN;
68         }
69
70         ohci->hc_control = ohci_readl (ohci, &ohci->regs->control);
71         switch (ohci->hc_control & OHCI_CTRL_HCFS) {
72         case OHCI_USB_RESUME:
73                 ohci_dbg (ohci, "resume/suspend?\n");
74                 ohci->hc_control &= ~OHCI_CTRL_HCFS;
75                 ohci->hc_control |= OHCI_USB_RESET;
76                 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
77                 (void) ohci_readl (ohci, &ohci->regs->control);
78                 /* FALL THROUGH */
79         case OHCI_USB_RESET:
80                 status = -EBUSY;
81                 ohci_dbg (ohci, "needs reinit!\n");
82                 goto done;
83         case OHCI_USB_SUSPEND:
84                 ohci_dbg (ohci, "already suspended\n");
85                 goto done;
86         }
87         ohci_dbg (ohci, "suspend root hub\n");
88
89         /* First stop any processing */
90         if (ohci->hc_control & OHCI_SCHED_ENABLES) {
91                 int             limit;
92
93                 ohci->hc_control &= ~OHCI_SCHED_ENABLES;
94                 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
95                 ohci->hc_control = ohci_readl (ohci, &ohci->regs->control);
96                 ohci_writel (ohci, OHCI_INTR_SF, &ohci->regs->intrstatus);
97
98                 /* sched disables take effect on the next frame,
99                  * then the last WDH could take 6+ msec
100                  */
101                 ohci_dbg (ohci, "stopping schedules ...\n");
102                 limit = 2000;
103                 while (limit > 0) {
104                         udelay (250);
105                         limit =- 250;
106                         if (ohci_readl (ohci, &ohci->regs->intrstatus)
107                                         & OHCI_INTR_SF)
108                                 break;
109                 }
110                 dl_done_list (ohci, NULL);
111                 mdelay (7);
112         }
113         dl_done_list (ohci, NULL);
114         finish_unlinks (ohci, ohci_frame_no(ohci), NULL);
115         ohci_writel (ohci, ohci_readl (ohci, &ohci->regs->intrstatus),
116                         &ohci->regs->intrstatus);
117
118         /* maybe resume can wake root hub */
119         if (device_may_wakeup(&ohci_to_hcd(ohci)->self.root_hub->dev))
120                 ohci->hc_control |= OHCI_CTRL_RWE;
121         else {
122                 ohci_writel (ohci, OHCI_INTR_RHSC, &ohci->regs->intrdisable);
123                 ohci->hc_control &= ~OHCI_CTRL_RWE;
124         }
125
126         /* Suspend hub ... this is the "global (to this bus) suspend" mode,
127          * which doesn't imply ports will first be individually suspended.
128          */
129         ohci->hc_control &= ~OHCI_CTRL_HCFS;
130         ohci->hc_control |= OHCI_USB_SUSPEND;
131         ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
132         (void) ohci_readl (ohci, &ohci->regs->control);
133
134         /* no resumes until devices finish suspending */
135         ohci->next_statechange = jiffies + msecs_to_jiffies (5);
136
137         /* no timer polling */
138         hcd->poll_rh = 0;
139
140 done:
141         spin_unlock_irqrestore (&ohci->lock, flags);
142         return status;
143 }
144
145 static inline struct ed *find_head (struct ed *ed)
146 {
147         /* for bulk and control lists */
148         while (ed->ed_prev)
149                 ed = ed->ed_prev;
150         return ed;
151 }
152
153 /* caller has locked the root hub */
154 static int ohci_bus_resume (struct usb_hcd *hcd)
155 {
156         struct ohci_hcd         *ohci = hcd_to_ohci (hcd);
157         u32                     temp, enables;
158         int                     status = -EINPROGRESS;
159         unsigned long           flags;
160
161         if (time_before (jiffies, ohci->next_statechange))
162                 msleep(5);
163
164         spin_lock_irqsave (&ohci->lock, flags);
165
166         if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))) {
167                 spin_unlock_irqrestore (&ohci->lock, flags);
168                 return -ESHUTDOWN;
169         }
170
171
172         ohci->hc_control = ohci_readl (ohci, &ohci->regs->control);
173
174         if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) {
175                 /* this can happen after resuming a swsusp snapshot */
176                 if (hcd->state == HC_STATE_RESUMING) {
177                         ohci_dbg (ohci, "BIOS/SMM active, control %03x\n",
178                                         ohci->hc_control);
179                         status = -EBUSY;
180                 /* this happens when pmcore resumes HC then root */
181                 } else {
182                         ohci_dbg (ohci, "duplicate resume\n");
183                         status = 0;
184                 }
185         } else switch (ohci->hc_control & OHCI_CTRL_HCFS) {
186         case OHCI_USB_SUSPEND:
187                 ohci->hc_control &= ~(OHCI_CTRL_HCFS|OHCI_SCHED_ENABLES);
188                 ohci->hc_control |= OHCI_USB_RESUME;
189                 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
190                 (void) ohci_readl (ohci, &ohci->regs->control);
191                 ohci_dbg (ohci, "resume root hub\n");
192                 break;
193         case OHCI_USB_RESUME:
194                 /* HCFS changes sometime after INTR_RD */
195                 ohci_info (ohci, "wakeup\n");
196                 break;
197         case OHCI_USB_OPER:
198                 /* this can happen after resuming a swsusp snapshot */
199                 ohci_dbg (ohci, "snapshot resume? reinit\n");
200                 status = -EBUSY;
201                 break;
202         default:                /* RESET, we lost power */
203                 ohci_dbg (ohci, "lost power\n");
204                 status = -EBUSY;
205         }
206         spin_unlock_irqrestore (&ohci->lock, flags);
207         if (status == -EBUSY) {
208                 (void) ohci_init (ohci);
209                 return ohci_restart (ohci);
210         }
211         if (status != -EINPROGRESS)
212                 return status;
213
214         temp = ohci->num_ports;
215         enables = 0;
216         while (temp--) {
217                 u32 stat = ohci_readl (ohci,
218                                        &ohci->regs->roothub.portstatus [temp]);
219
220                 /* force global, not selective, resume */
221                 if (!(stat & RH_PS_PSS))
222                         continue;
223                 ohci_writel (ohci, RH_PS_POCI,
224                                 &ohci->regs->roothub.portstatus [temp]);
225         }
226
227         /* Some controllers (lucent erratum) need extra-long delays */
228         msleep (20 /* usb 11.5.1.10 */ + 12 /* 32 msec counter */ + 1);
229
230         temp = ohci_readl (ohci, &ohci->regs->control);
231         temp &= OHCI_CTRL_HCFS;
232         if (temp != OHCI_USB_RESUME) {
233                 ohci_err (ohci, "controller won't resume\n");
234                 return -EBUSY;
235         }
236
237         /* disable old schedule state, reinit from scratch */
238         ohci_writel (ohci, 0, &ohci->regs->ed_controlhead);
239         ohci_writel (ohci, 0, &ohci->regs->ed_controlcurrent);
240         ohci_writel (ohci, 0, &ohci->regs->ed_bulkhead);
241         ohci_writel (ohci, 0, &ohci->regs->ed_bulkcurrent);
242         ohci_writel (ohci, 0, &ohci->regs->ed_periodcurrent);
243         ohci_writel (ohci, (u32) ohci->hcca_dma, &ohci->regs->hcca);
244
245         /* Sometimes PCI D3 suspend trashes frame timings ... */
246         periodic_reinit (ohci);
247
248         /* interrupts might have been disabled */
249         ohci_writel (ohci, OHCI_INTR_INIT, &ohci->regs->intrenable);
250         if (ohci->ed_rm_list)
251                 ohci_writel (ohci, OHCI_INTR_SF, &ohci->regs->intrenable);
252         ohci_writel (ohci, ohci_readl (ohci, &ohci->regs->intrstatus),
253                         &ohci->regs->intrstatus);
254
255         /* Then re-enable operations */
256         ohci_writel (ohci, OHCI_USB_OPER, &ohci->regs->control);
257         (void) ohci_readl (ohci, &ohci->regs->control);
258         msleep (3);
259
260         temp = ohci->hc_control;
261         temp &= OHCI_CTRL_RWC;
262         temp |= OHCI_CONTROL_INIT | OHCI_USB_OPER;
263         ohci->hc_control = temp;
264         ohci_writel (ohci, temp, &ohci->regs->control);
265         (void) ohci_readl (ohci, &ohci->regs->control);
266
267         /* TRSMRCY */
268         msleep (10);
269
270         /* keep it alive for more than ~5x suspend + resume costs */
271         ohci->next_statechange = jiffies + STATECHANGE_DELAY;
272
273         /* maybe turn schedules back on */
274         enables = 0;
275         temp = 0;
276         if (!ohci->ed_rm_list) {
277                 if (ohci->ed_controltail) {
278                         ohci_writel (ohci,
279                                         find_head (ohci->ed_controltail)->dma,
280                                         &ohci->regs->ed_controlhead);
281                         enables |= OHCI_CTRL_CLE;
282                         temp |= OHCI_CLF;
283                 }
284                 if (ohci->ed_bulktail) {
285                         ohci_writel (ohci, find_head (ohci->ed_bulktail)->dma,
286                                 &ohci->regs->ed_bulkhead);
287                         enables |= OHCI_CTRL_BLE;
288                         temp |= OHCI_BLF;
289                 }
290         }
291         if (hcd->self.bandwidth_isoc_reqs || hcd->self.bandwidth_int_reqs)
292                 enables |= OHCI_CTRL_PLE|OHCI_CTRL_IE;
293         if (enables) {
294                 ohci_dbg (ohci, "restarting schedules ... %08x\n", enables);
295                 ohci->hc_control |= enables;
296                 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
297                 if (temp)
298                         ohci_writel (ohci, temp, &ohci->regs->cmdstatus);
299                 (void) ohci_readl (ohci, &ohci->regs->control);
300         }
301
302         return 0;
303 }
304
305 #endif  /* CONFIG_PM */
306
307 /*-------------------------------------------------------------------------*/
308
309 /* build "status change" packet (one or two bytes) from HC registers */
310
311 static int
312 ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
313 {
314         struct ohci_hcd *ohci = hcd_to_ohci (hcd);
315         int             i, changed = 0, length = 1;
316         unsigned long   flags;
317
318         spin_lock_irqsave (&ohci->lock, flags);
319
320         /* handle autosuspended root:  finish resuming before
321          * letting khubd or root hub timer see state changes.
322          */
323         if (unlikely((ohci->hc_control & OHCI_CTRL_HCFS) != OHCI_USB_OPER
324                      || !HC_IS_RUNNING(hcd->state)))
325                 goto done;
326
327         /* undocumented erratum seen on at least rev D */
328         if ((ohci->flags & OHCI_QUIRK_AMD756)
329                         && (roothub_a (ohci) & RH_A_NDP) > MAX_ROOT_PORTS) {
330                 ohci_warn (ohci, "bogus NDP, rereads as NDP=%d\n",
331                           ohci_readl (ohci, &ohci->regs->roothub.a) & RH_A_NDP);
332                 /* retry later; "should not happen" */
333                 goto done;
334         }
335
336         /* init status */
337         if (roothub_status (ohci) & (RH_HS_LPSC | RH_HS_OCIC))
338                 buf [0] = changed = 1;
339         else
340                 buf [0] = 0;
341         if (ohci->num_ports > 7) {
342                 buf [1] = 0;
343                 length++;
344         }
345
346         /* look at each port */
347         for (i = 0; i < ohci->num_ports; i++) {
348                 u32     status = roothub_portstatus (ohci, i);
349
350                 if (status & (RH_PS_CSC | RH_PS_PESC | RH_PS_PSSC
351                                 | RH_PS_OCIC | RH_PS_PRSC)) {
352                         changed = 1;
353                         if (i < 7)
354                             buf [0] |= 1 << (i + 1);
355                         else
356                             buf [1] |= 1 << (i - 7);
357                         continue;
358                 }
359         }
360
361         /* after root hub changes, stop polling after debouncing
362          * for a while and maybe kicking in autosuspend
363          */
364         if (changed)
365                 ohci->next_statechange = jiffies + STATECHANGE_DELAY;
366
367 done:
368         spin_unlock_irqrestore (&ohci->lock, flags);
369
370         return changed ? length : 0;
371 }
372
373 /*-------------------------------------------------------------------------*/
374
375 static void
376 ohci_hub_descriptor (
377         struct ohci_hcd                 *ohci,
378         struct usb_hub_descriptor       *desc
379 ) {
380         u32             rh = roothub_a (ohci);
381         u16             temp;
382
383         desc->bDescriptorType = 0x29;
384         desc->bPwrOn2PwrGood = (rh & RH_A_POTPGT) >> 24;
385         desc->bHubContrCurrent = 0;
386
387         desc->bNbrPorts = ohci->num_ports;
388         temp = 1 + (ohci->num_ports / 8);
389         desc->bDescLength = 7 + 2 * temp;
390
391         temp = 0;
392         if (rh & RH_A_NPS)              /* no power switching? */
393             temp |= 0x0002;
394         if (rh & RH_A_PSM)              /* per-port power switching? */
395             temp |= 0x0001;
396         if (rh & RH_A_NOCP)             /* no overcurrent reporting? */
397             temp |= 0x0010;
398         else if (rh & RH_A_OCPM)        /* per-port overcurrent reporting? */
399             temp |= 0x0008;
400         desc->wHubCharacteristics = (__force __u16)cpu_to_hc16(ohci, temp);
401
402         /* two bitmaps:  ports removable, and usb 1.0 legacy PortPwrCtrlMask */
403         rh = roothub_b (ohci);
404         memset(desc->bitmap, 0xff, sizeof(desc->bitmap));
405         desc->bitmap [0] = rh & RH_B_DR;
406         if (ohci->num_ports > 7) {
407                 desc->bitmap [1] = (rh & RH_B_DR) >> 8;
408                 desc->bitmap [2] = 0xff;
409         } else
410                 desc->bitmap [1] = 0xff;
411 }
412
413 /*-------------------------------------------------------------------------*/
414
415 #ifdef  CONFIG_USB_OTG
416
417 static int ohci_start_port_reset (struct usb_hcd *hcd, unsigned port)
418 {
419         struct ohci_hcd *ohci = hcd_to_ohci (hcd);
420         u32                     status;
421
422         if (!port)
423                 return -EINVAL;
424         port--;
425
426         /* start port reset before HNP protocol times out */
427         status = ohci_readl(ohci, &ohci->regs->roothub.portstatus [port]);
428         if (!(status & RH_PS_CCS))
429                 return -ENODEV;
430
431         /* khubd will finish the reset later */
432         ohci_writel(ohci, RH_PS_PRS, &ohci->regs->roothub.portstatus [port]);
433         return 0;
434 }
435
436 static void start_hnp(struct ohci_hcd *ohci);
437
438 #else
439
440 #define ohci_start_port_reset           NULL
441
442 #endif
443
444 /*-------------------------------------------------------------------------*/
445
446
447 /* See usb 7.1.7.5:  root hubs must issue at least 50 msec reset signaling,
448  * not necessarily continuous ... to guard against resume signaling.
449  * The short timeout is safe for non-root hubs, and is backward-compatible
450  * with earlier Linux hosts.
451  */
452 #ifdef  CONFIG_USB_SUSPEND
453 #define PORT_RESET_MSEC         50
454 #else
455 #define PORT_RESET_MSEC         10
456 #endif
457
458 /* this timer value might be vendor-specific ... */
459 #define PORT_RESET_HW_MSEC      10
460
461 /* wrap-aware logic morphed from <linux/jiffies.h> */
462 #define tick_before(t1,t2) ((s16)(((s16)(t1))-((s16)(t2))) < 0)
463
464 /* called from some task, normally khubd */
465 static inline void root_port_reset (struct ohci_hcd *ohci, unsigned port)
466 {
467         __hc32 __iomem *portstat = &ohci->regs->roothub.portstatus [port];
468         u32     temp;
469         u16     now = ohci_readl(ohci, &ohci->regs->fmnumber);
470         u16     reset_done = now + PORT_RESET_MSEC;
471
472         /* build a "continuous enough" reset signal, with up to
473          * 3msec gap between pulses.  scheduler HZ==100 must work;
474          * this might need to be deadline-scheduled.
475          */
476         do {
477                 /* spin until any current reset finishes */
478                 for (;;) {
479                         temp = ohci_readl (ohci, portstat);
480                         if (!(temp & RH_PS_PRS))
481                                 break;
482                         udelay (500);
483                 } 
484
485                 if (!(temp & RH_PS_CCS))
486                         break;
487                 if (temp & RH_PS_PRSC)
488                         ohci_writel (ohci, RH_PS_PRSC, portstat);
489
490                 /* start the next reset, sleep till it's probably done */
491                 ohci_writel (ohci, RH_PS_PRS, portstat);
492                 msleep(PORT_RESET_HW_MSEC);
493                 now = ohci_readl(ohci, &ohci->regs->fmnumber);
494         } while (tick_before(now, reset_done));
495         /* caller synchronizes using PRSC */
496 }
497
498 static int ohci_hub_control (
499         struct usb_hcd  *hcd,
500         u16             typeReq,
501         u16             wValue,
502         u16             wIndex,
503         char            *buf,
504         u16             wLength
505 ) {
506         struct ohci_hcd *ohci = hcd_to_ohci (hcd);
507         int             ports = hcd_to_bus (hcd)->root_hub->maxchild;
508         u32             temp;
509         int             retval = 0;
510
511         if (unlikely(!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)))
512                 return -ESHUTDOWN;
513
514         switch (typeReq) {
515         case ClearHubFeature:
516                 switch (wValue) {
517                 case C_HUB_OVER_CURRENT:
518                         ohci_writel (ohci, RH_HS_OCIC,
519                                         &ohci->regs->roothub.status);
520                 case C_HUB_LOCAL_POWER:
521                         break;
522                 default:
523                         goto error;
524                 }
525                 break;
526         case ClearPortFeature:
527                 if (!wIndex || wIndex > ports)
528                         goto error;
529                 wIndex--;
530
531                 switch (wValue) {
532                 case USB_PORT_FEAT_ENABLE:
533                         temp = RH_PS_CCS;
534                         break;
535                 case USB_PORT_FEAT_C_ENABLE:
536                         temp = RH_PS_PESC;
537                         break;
538                 case USB_PORT_FEAT_SUSPEND:
539                         temp = RH_PS_POCI;
540                         break;
541                 case USB_PORT_FEAT_C_SUSPEND:
542                         temp = RH_PS_PSSC;
543                         break;
544                 case USB_PORT_FEAT_POWER:
545                         temp = RH_PS_LSDA;
546                         break;
547                 case USB_PORT_FEAT_C_CONNECTION:
548                         temp = RH_PS_CSC;
549                         break;
550                 case USB_PORT_FEAT_C_OVER_CURRENT:
551                         temp = RH_PS_OCIC;
552                         break;
553                 case USB_PORT_FEAT_C_RESET:
554                         temp = RH_PS_PRSC;
555                         break;
556                 default:
557                         goto error;
558                 }
559                 ohci_writel (ohci, temp,
560                                 &ohci->regs->roothub.portstatus [wIndex]);
561                 // ohci_readl (ohci, &ohci->regs->roothub.portstatus [wIndex]);
562                 break;
563         case GetHubDescriptor:
564                 ohci_hub_descriptor (ohci, (struct usb_hub_descriptor *) buf);
565                 break;
566         case GetHubStatus:
567                 temp = roothub_status (ohci) & ~(RH_HS_CRWE | RH_HS_DRWE);
568                 put_unaligned(cpu_to_le32 (temp), (__le32 *) buf);
569                 break;
570         case GetPortStatus:
571                 if (!wIndex || wIndex > ports)
572                         goto error;
573                 wIndex--;
574                 temp = roothub_portstatus (ohci, wIndex);
575                 put_unaligned(cpu_to_le32 (temp), (__le32 *) buf);
576
577 #ifndef OHCI_VERBOSE_DEBUG
578         if (*(u16*)(buf+2))     /* only if wPortChange is interesting */
579 #endif
580                 dbg_port (ohci, "GetStatus", wIndex, temp);
581                 break;
582         case SetHubFeature:
583                 switch (wValue) {
584                 case C_HUB_OVER_CURRENT:
585                         // FIXME:  this can be cleared, yes?
586                 case C_HUB_LOCAL_POWER:
587                         break;
588                 default:
589                         goto error;
590                 }
591                 break;
592         case SetPortFeature:
593                 if (!wIndex || wIndex > ports)
594                         goto error;
595                 wIndex--;
596                 switch (wValue) {
597                 case USB_PORT_FEAT_SUSPEND:
598 #ifdef  CONFIG_USB_OTG
599                         if (hcd->self.otg_port == (wIndex + 1)
600                                         && hcd->self.b_hnp_enable)
601                                 start_hnp(ohci);
602                         else
603 #endif
604                         ohci_writel (ohci, RH_PS_PSS,
605                                 &ohci->regs->roothub.portstatus [wIndex]);
606                         break;
607                 case USB_PORT_FEAT_POWER:
608                         ohci_writel (ohci, RH_PS_PPS,
609                                 &ohci->regs->roothub.portstatus [wIndex]);
610                         break;
611                 case USB_PORT_FEAT_RESET:
612                         root_port_reset (ohci, wIndex);
613                         break;
614                 default:
615                         goto error;
616                 }
617                 break;
618
619         default:
620 error:
621                 /* "protocol stall" on error */
622                 retval = -EPIPE;
623         }
624         return retval;
625 }
626