blob: ece9e37e89fe2888379d57a63814ed21d00b28be [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Universal Host Controller Interface driver for USB.
3 *
4 * Maintainer: Alan Stern <stern@rowland.harvard.edu>
5 *
6 * (C) Copyright 1999 Linus Torvalds
7 * (C) Copyright 1999-2002 Johannes Erdfelt, johannes@erdfelt.com
8 * (C) Copyright 1999 Randy Dunlap
9 * (C) Copyright 1999 Georg Acher, acher@in.tum.de
10 * (C) Copyright 1999 Deti Fliegl, deti@fliegl.de
11 * (C) Copyright 1999 Thomas Sailer, sailer@ife.ee.ethz.ch
12 * (C) Copyright 2004 Alan Stern, stern@rowland.harvard.edu
13 */
14
Ming Leibef46652008-06-08 16:44:40 +080015static const __u8 root_hub_hub_des[] =
Linus Torvalds1da177e2005-04-16 15:20:36 -070016{
17 0x09, /* __u8 bLength; */
Sergei Shtylyov3e5dd4c2015-03-29 01:30:04 +030018 USB_DT_HUB, /* __u8 bDescriptorType; Hub-descriptor */
Linus Torvalds1da177e2005-04-16 15:20:36 -070019 0x02, /* __u8 bNbrPorts; */
Sergei Shtylyov673016d2015-01-25 21:00:44 +030020 HUB_CHAR_NO_LPSM | /* __u16 wHubCharacteristics; */
21 HUB_CHAR_INDV_PORT_OCPM, /* (per-port OC, no power switching) */
22 0x00,
Linus Torvalds1da177e2005-04-16 15:20:36 -070023 0x01, /* __u8 bPwrOn2pwrGood; 2ms */
24 0x00, /* __u8 bHubContrCurrent; 0 mA */
Chen Gang3171fca2013-01-24 09:41:45 +080025 0x00, /* __u8 DeviceRemovable; *** 7 Ports max */
26 0xff /* __u8 PortPwrCtrlMask; *** 7 ports max */
Linus Torvalds1da177e2005-04-16 15:20:36 -070027};
28
29#define UHCI_RH_MAXCHILD 7
30
31/* must write as zeroes */
32#define WZ_BITS (USBPORTSC_RES2 | USBPORTSC_RES3 | USBPORTSC_RES4)
33
34/* status change bits: nonzero writes will clear */
35#define RWC_BITS (USBPORTSC_OCC | USBPORTSC_PEC | USBPORTSC_CSC)
36
Alan Stern88018152007-02-26 17:16:06 -050037/* suspend/resume bits: port suspended or port resuming */
38#define SUSPEND_BITS (USBPORTSC_SUSP | USBPORTSC_RD)
39
Alan Sternf5946f82005-04-09 17:26:00 -040040/* A port that either is connected or has a changed-bit set will prevent
41 * us from AUTO_STOPPING.
42 */
43static int any_ports_active(struct uhci_hcd *uhci)
44{
45 int port;
46
47 for (port = 0; port < uhci->rh_numports; ++port) {
Jan Andersson9faa0912011-05-06 12:00:16 +020048 if ((uhci_readw(uhci, USBPORTSC1 + port * 2) &
Alan Sternf5946f82005-04-09 17:26:00 -040049 (USBPORTSC_CCS | RWC_BITS)) ||
50 test_bit(port, &uhci->port_c_suspend))
51 return 1;
52 }
53 return 0;
54}
55
Alan Stern6c1b4452005-04-21 16:04:58 -040056static inline int get_hub_status_data(struct uhci_hcd *uhci, char *buf)
Linus Torvalds1da177e2005-04-16 15:20:36 -070057{
Linus Torvalds1da177e2005-04-16 15:20:36 -070058 int port;
Alan Stern5f8364b2006-12-05 16:29:55 -050059 int mask = RWC_BITS;
60
61 /* Some boards (both VIA and Intel apparently) report bogus
62 * overcurrent indications, causing massive log spam unless
63 * we completely ignore them. This doesn't seem to be a problem
64 * with the chipset so much as with the way it is connected on
65 * the motherboard; if the overcurrent input is left to float
66 * then it may constantly register false positives. */
67 if (ignore_oc)
68 mask &= ~USBPORTSC_OCC;
Linus Torvalds1da177e2005-04-16 15:20:36 -070069
70 *buf = 0;
71 for (port = 0; port < uhci->rh_numports; ++port) {
Jan Andersson9faa0912011-05-06 12:00:16 +020072 if ((uhci_readw(uhci, USBPORTSC1 + port * 2) & mask) ||
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 test_bit(port, &uhci->port_c_suspend))
74 *buf |= (1 << (port + 1));
75 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 return !!*buf;
77}
78
Linus Torvalds1da177e2005-04-16 15:20:36 -070079#define CLR_RH_PORTSTAT(x) \
Jan Andersson9faa0912011-05-06 12:00:16 +020080 status = uhci_readw(uhci, port_addr); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 status &= ~(RWC_BITS|WZ_BITS); \
82 status &= ~(x); \
83 status |= RWC_BITS & (x); \
Jan Andersson9faa0912011-05-06 12:00:16 +020084 uhci_writew(uhci, status, port_addr)
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
86#define SET_RH_PORTSTAT(x) \
Jan Andersson9faa0912011-05-06 12:00:16 +020087 status = uhci_readw(uhci, port_addr); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070088 status |= (x); \
89 status &= ~(RWC_BITS|WZ_BITS); \
Jan Andersson9faa0912011-05-06 12:00:16 +020090 uhci_writew(uhci, status, port_addr)
Linus Torvalds1da177e2005-04-16 15:20:36 -070091
92/* UHCI controllers don't automatically stop resume signalling after 20 msec,
93 * so we have to poll and check timeouts in order to take care of it.
94 */
95static void uhci_finish_suspend(struct uhci_hcd *uhci, int port,
96 unsigned long port_addr)
97{
98 int status;
Alan Sternde06a3b2006-08-11 11:33:58 -040099 int i;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100
Jan Andersson9faa0912011-05-06 12:00:16 +0200101 if (uhci_readw(uhci, port_addr) & SUSPEND_BITS) {
Alan Stern88018152007-02-26 17:16:06 -0500102 CLR_RH_PORTSTAT(SUSPEND_BITS);
Alan Stern8e326402006-04-04 14:47:44 -0400103 if (test_bit(port, &uhci->resuming_ports))
104 set_bit(port, &uhci->port_c_suspend);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105
106 /* The controller won't actually turn off the RD bit until
107 * it has had a chance to send a low-speed EOP sequence,
Alan Sternde06a3b2006-08-11 11:33:58 -0400108 * which is supposed to take 3 bit times (= 2 microseconds).
109 * Experiments show that some controllers take longer, so
110 * we'll poll for completion. */
111 for (i = 0; i < 10; ++i) {
Jan Andersson9faa0912011-05-06 12:00:16 +0200112 if (!(uhci_readw(uhci, port_addr) & SUSPEND_BITS))
Alan Sternde06a3b2006-08-11 11:33:58 -0400113 break;
114 udelay(1);
115 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116 }
Alan Stern8e326402006-04-04 14:47:44 -0400117 clear_bit(port, &uhci->resuming_ports);
Alan Stern840008b2013-01-25 17:09:55 -0500118 usb_hcd_end_port_resume(&uhci_to_hcd(uhci)->self, port);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119}
120
Alan Sternae557172006-02-28 10:16:12 -0500121/* Wait for the UHCI controller in HP's iLO2 server management chip.
122 * It can take up to 250 us to finish a reset and set the CSC bit.
123 */
Jan Andersson9faa0912011-05-06 12:00:16 +0200124static void wait_for_HP(struct uhci_hcd *uhci, unsigned long port_addr)
Alan Sternae557172006-02-28 10:16:12 -0500125{
126 int i;
127
128 for (i = 10; i < 250; i += 10) {
Jan Andersson9faa0912011-05-06 12:00:16 +0200129 if (uhci_readw(uhci, port_addr) & USBPORTSC_CSC)
Alan Sternae557172006-02-28 10:16:12 -0500130 return;
131 udelay(10);
132 }
133 /* Log a warning? */
134}
135
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136static void uhci_check_ports(struct uhci_hcd *uhci)
137{
138 unsigned int port;
139 unsigned long port_addr;
140 int status;
141
142 for (port = 0; port < uhci->rh_numports; ++port) {
Jan Andersson9faa0912011-05-06 12:00:16 +0200143 port_addr = USBPORTSC1 + 2 * port;
144 status = uhci_readw(uhci, port_addr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145 if (unlikely(status & USBPORTSC_PR)) {
146 if (time_after_eq(jiffies, uhci->ports_timeout)) {
147 CLR_RH_PORTSTAT(USBPORTSC_PR);
148 udelay(10);
149
Alan Sternae557172006-02-28 10:16:12 -0500150 /* HP's server management chip requires
151 * a longer delay. */
Jan Anderssondfeca7a2011-05-06 12:00:12 +0200152 if (uhci->wait_for_hp)
Jan Andersson9faa0912011-05-06 12:00:16 +0200153 wait_for_HP(uhci, port_addr);
Alan Sternae557172006-02-28 10:16:12 -0500154
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155 /* If the port was enabled before, turning
156 * reset on caused a port enable change.
157 * Turning reset off causes a port connect
158 * status change. Clear these changes. */
159 CLR_RH_PORTSTAT(USBPORTSC_CSC | USBPORTSC_PEC);
160 SET_RH_PORTSTAT(USBPORTSC_PE);
161 }
162 }
163 if (unlikely(status & USBPORTSC_RD)) {
164 if (!test_bit(port, &uhci->resuming_ports)) {
165
166 /* Port received a wakeup request */
167 set_bit(port, &uhci->resuming_ports);
168 uhci->ports_timeout = jiffies +
Felipe Balbib8fb6f72015-02-13 14:44:17 -0600169 msecs_to_jiffies(USB_RESUME_TIMEOUT);
Alan Stern840008b2013-01-25 17:09:55 -0500170 usb_hcd_start_port_resume(
171 &uhci_to_hcd(uhci)->self, port);
Alan Stern6c1b4452005-04-21 16:04:58 -0400172
173 /* Make sure we see the port again
174 * after the resuming period is over. */
175 mod_timer(&uhci_to_hcd(uhci)->rh_timer,
176 uhci->ports_timeout);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177 } else if (time_after_eq(jiffies,
178 uhci->ports_timeout)) {
179 uhci_finish_suspend(uhci, port, port_addr);
180 }
181 }
182 }
183}
184
Alan Stern6c1b4452005-04-21 16:04:58 -0400185static int uhci_hub_status_data(struct usb_hcd *hcd, char *buf)
186{
187 struct uhci_hcd *uhci = hcd_to_uhci(hcd);
188 unsigned long flags;
Alan Stern1f09df82005-09-05 13:59:51 -0400189 int status = 0;
Alan Stern6c1b4452005-04-21 16:04:58 -0400190
191 spin_lock_irqsave(&uhci->lock, flags);
Alan Stern6c1b4452005-04-21 16:04:58 -0400192
David Howells7d12e782006-10-05 14:55:46 +0100193 uhci_scan_schedule(uhci);
Alan Stern541c7d42010-06-22 16:39:10 -0400194 if (!HCD_HW_ACCESSIBLE(hcd) || uhci->dead)
Alan Stern1f09df82005-09-05 13:59:51 -0400195 goto done;
Alan Stern6c1b4452005-04-21 16:04:58 -0400196 uhci_check_ports(uhci);
Alan Stern1f09df82005-09-05 13:59:51 -0400197
Alan Stern6c1b4452005-04-21 16:04:58 -0400198 status = get_hub_status_data(uhci, buf);
199
200 switch (uhci->rh_state) {
Alan Stern6c1b4452005-04-21 16:04:58 -0400201 case UHCI_RH_SUSPENDED:
202 /* if port change, ask to be resumed */
Alan Sternb446b962012-04-03 15:24:43 -0400203 if (status || uhci->resuming_ports) {
204 status = 1;
Alan Stern6c1b4452005-04-21 16:04:58 -0400205 usb_hcd_resume_root_hub(hcd);
Alan Sternb446b962012-04-03 15:24:43 -0400206 }
Alan Stern6c1b4452005-04-21 16:04:58 -0400207 break;
208
209 case UHCI_RH_AUTO_STOPPED:
210 /* if port change, auto start */
211 if (status)
212 wakeup_rh(uhci);
213 break;
214
215 case UHCI_RH_RUNNING:
216 /* are any devices attached? */
217 if (!any_ports_active(uhci)) {
218 uhci->rh_state = UHCI_RH_RUNNING_NODEVS;
219 uhci->auto_stop_time = jiffies + HZ;
220 }
221 break;
222
223 case UHCI_RH_RUNNING_NODEVS:
224 /* auto-stop if nothing connected for 1 second */
225 if (any_ports_active(uhci))
226 uhci->rh_state = UHCI_RH_RUNNING;
Alan Stern997ff892013-05-14 13:55:29 -0400227 else if (time_after_eq(jiffies, uhci->auto_stop_time) &&
228 !uhci->wait_for_hp)
Alan Stern6c1b4452005-04-21 16:04:58 -0400229 suspend_rh(uhci, UHCI_RH_AUTO_STOPPED);
230 break;
231
232 default:
233 break;
234 }
235
236done:
237 spin_unlock_irqrestore(&uhci->lock, flags);
238 return status;
239}
240
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241/* size of returned buffer is part of USB spec */
242static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
243 u16 wIndex, char *buf, u16 wLength)
244{
245 struct uhci_hcd *uhci = hcd_to_uhci(hcd);
Deng-Cheng Zhu5a3e2052013-10-05 23:08:17 -0700246 int status, lstatus, retval = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247 unsigned int port = wIndex - 1;
Jan Andersson9faa0912011-05-06 12:00:16 +0200248 unsigned long port_addr = USBPORTSC1 + 2 * port;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249 u16 wPortChange, wPortStatus;
250 unsigned long flags;
251
Alan Stern541c7d42010-06-22 16:39:10 -0400252 if (!HCD_HW_ACCESSIBLE(hcd) || uhci->dead)
Alan Sterna8bed8b2005-04-09 17:29:00 -0400253 return -ETIMEDOUT;
254
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255 spin_lock_irqsave(&uhci->lock, flags);
256 switch (typeReq) {
257
258 case GetHubStatus:
259 *(__le32 *)buf = cpu_to_le32(0);
Deng-Cheng Zhu5a3e2052013-10-05 23:08:17 -0700260 retval = 4; /* hub power */
261 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262 case GetPortStatus:
263 if (port >= uhci->rh_numports)
264 goto err;
265
266 uhci_check_ports(uhci);
Jan Andersson9faa0912011-05-06 12:00:16 +0200267 status = uhci_readw(uhci, port_addr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268
269 /* Intel controllers report the OverCurrent bit active on.
270 * VIA controllers report it active off, so we'll adjust the
271 * bit value. (It's not standardized in the UHCI spec.)
272 */
Jan Anderssondfeca7a2011-05-06 12:00:12 +0200273 if (uhci->oc_low)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700274 status ^= USBPORTSC_OC;
275
276 /* UHCI doesn't support C_RESET (always false) */
277 wPortChange = lstatus = 0;
278 if (status & USBPORTSC_CSC)
279 wPortChange |= USB_PORT_STAT_C_CONNECTION;
280 if (status & USBPORTSC_PEC)
281 wPortChange |= USB_PORT_STAT_C_ENABLE;
Alan Stern5f8364b2006-12-05 16:29:55 -0500282 if ((status & USBPORTSC_OCC) && !ignore_oc)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700283 wPortChange |= USB_PORT_STAT_C_OVERCURRENT;
284
285 if (test_bit(port, &uhci->port_c_suspend)) {
286 wPortChange |= USB_PORT_STAT_C_SUSPEND;
287 lstatus |= 1;
288 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700289 if (test_bit(port, &uhci->resuming_ports))
290 lstatus |= 4;
291
292 /* UHCI has no power switching (always on) */
293 wPortStatus = USB_PORT_STAT_POWER;
294 if (status & USBPORTSC_CCS)
295 wPortStatus |= USB_PORT_STAT_CONNECTION;
296 if (status & USBPORTSC_PE) {
297 wPortStatus |= USB_PORT_STAT_ENABLE;
Alan Stern88018152007-02-26 17:16:06 -0500298 if (status & SUSPEND_BITS)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299 wPortStatus |= USB_PORT_STAT_SUSPEND;
300 }
301 if (status & USBPORTSC_OC)
302 wPortStatus |= USB_PORT_STAT_OVERCURRENT;
303 if (status & USBPORTSC_PR)
304 wPortStatus |= USB_PORT_STAT_RESET;
305 if (status & USBPORTSC_LSDA)
306 wPortStatus |= USB_PORT_STAT_LOW_SPEED;
307
308 if (wPortChange)
309 dev_dbg(uhci_dev(uhci), "port %d portsc %04x,%02x\n",
310 wIndex, status, lstatus);
311
312 *(__le16 *)buf = cpu_to_le16(wPortStatus);
313 *(__le16 *)(buf + 2) = cpu_to_le16(wPortChange);
Deng-Cheng Zhu5a3e2052013-10-05 23:08:17 -0700314 retval = 4;
315 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700316 case SetHubFeature: /* We don't implement these */
317 case ClearHubFeature:
318 switch (wValue) {
319 case C_HUB_OVER_CURRENT:
320 case C_HUB_LOCAL_POWER:
Deng-Cheng Zhu5a3e2052013-10-05 23:08:17 -0700321 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322 default:
323 goto err;
324 }
325 break;
326 case SetPortFeature:
327 if (port >= uhci->rh_numports)
328 goto err;
329
330 switch (wValue) {
331 case USB_PORT_FEAT_SUSPEND:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700332 SET_RH_PORTSTAT(USBPORTSC_SUSP);
Deng-Cheng Zhu5a3e2052013-10-05 23:08:17 -0700333 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334 case USB_PORT_FEAT_RESET:
335 SET_RH_PORTSTAT(USBPORTSC_PR);
336
337 /* Reset terminates Resume signalling */
338 uhci_finish_suspend(uhci, port, port_addr);
339
340 /* USB v2.0 7.1.7.5 */
Felipe Balbib8fb6f72015-02-13 14:44:17 -0600341 uhci->ports_timeout = jiffies +
342 msecs_to_jiffies(USB_RESUME_TIMEOUT);
Deng-Cheng Zhu5a3e2052013-10-05 23:08:17 -0700343 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344 case USB_PORT_FEAT_POWER:
345 /* UHCI has no power switching */
Deng-Cheng Zhu5a3e2052013-10-05 23:08:17 -0700346 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700347 default:
348 goto err;
349 }
350 break;
351 case ClearPortFeature:
352 if (port >= uhci->rh_numports)
353 goto err;
354
355 switch (wValue) {
356 case USB_PORT_FEAT_ENABLE:
357 CLR_RH_PORTSTAT(USBPORTSC_PE);
358
359 /* Disable terminates Resume signalling */
360 uhci_finish_suspend(uhci, port, port_addr);
Deng-Cheng Zhu5a3e2052013-10-05 23:08:17 -0700361 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700362 case USB_PORT_FEAT_C_ENABLE:
363 CLR_RH_PORTSTAT(USBPORTSC_PEC);
Deng-Cheng Zhu5a3e2052013-10-05 23:08:17 -0700364 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700365 case USB_PORT_FEAT_SUSPEND:
Jan Andersson9faa0912011-05-06 12:00:16 +0200366 if (!(uhci_readw(uhci, port_addr) & USBPORTSC_SUSP)) {
Alan Stern8e326402006-04-04 14:47:44 -0400367
368 /* Make certain the port isn't suspended */
369 uhci_finish_suspend(uhci, port, port_addr);
370 } else if (!test_and_set_bit(port,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700371 &uhci->resuming_ports)) {
372 SET_RH_PORTSTAT(USBPORTSC_RD);
373
374 /* The controller won't allow RD to be set
375 * if the port is disabled. When this happens
376 * just skip the Resume signalling.
377 */
Jan Andersson9faa0912011-05-06 12:00:16 +0200378 if (!(uhci_readw(uhci, port_addr) &
379 USBPORTSC_RD))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380 uhci_finish_suspend(uhci, port,
381 port_addr);
382 else
383 /* USB v2.0 7.1.7.7 */
384 uhci->ports_timeout = jiffies +
385 msecs_to_jiffies(20);
386 }
Deng-Cheng Zhu5a3e2052013-10-05 23:08:17 -0700387 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700388 case USB_PORT_FEAT_C_SUSPEND:
389 clear_bit(port, &uhci->port_c_suspend);
Deng-Cheng Zhu5a3e2052013-10-05 23:08:17 -0700390 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700391 case USB_PORT_FEAT_POWER:
392 /* UHCI has no power switching */
393 goto err;
394 case USB_PORT_FEAT_C_CONNECTION:
395 CLR_RH_PORTSTAT(USBPORTSC_CSC);
Deng-Cheng Zhu5a3e2052013-10-05 23:08:17 -0700396 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700397 case USB_PORT_FEAT_C_OVER_CURRENT:
398 CLR_RH_PORTSTAT(USBPORTSC_OCC);
Deng-Cheng Zhu5a3e2052013-10-05 23:08:17 -0700399 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700400 case USB_PORT_FEAT_C_RESET:
401 /* this driver won't report these */
Deng-Cheng Zhu5a3e2052013-10-05 23:08:17 -0700402 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403 default:
404 goto err;
405 }
406 break;
407 case GetHubDescriptor:
Deng-Cheng Zhu5a3e2052013-10-05 23:08:17 -0700408 retval = min_t(unsigned int, sizeof(root_hub_hub_des), wLength);
409 memcpy(buf, root_hub_hub_des, retval);
410 if (retval > 2)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700411 buf[2] = uhci->rh_numports;
Deng-Cheng Zhu5a3e2052013-10-05 23:08:17 -0700412 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413 default:
414err:
415 retval = -EPIPE;
416 }
417 spin_unlock_irqrestore(&uhci->lock, flags);
418
419 return retval;
420}