Commit 3c4f1158cd887a1a8c1309fc6d07907160e8e820
Exists in
master
and in
4 other branches
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (21 commits) USB: musb: fix srp sysfs entry deletion USB: musb: resume suspended root hub on disconnect USB: musb: use right poll limit for low speed devices USB: musb: be careful with 64K+ transfer lengths, host side USB: musb: fix data toggle saving with shared FIFO USB: musb: host endpoint_disable() oops fixes USB: musb: fix urb_dequeue() method USB: musb: fix musb_host_tx() for shared endpoint FIFO USB: musb: be careful with 64K+ transfer lengths (gadget side) usb: musb: make Davinci *work* in mainline USB: usb_get_string should check the descriptor type USB: gadget: fix build error in omap_apollon_2420_defconfig USB: g_file_storage: automatically disable stalls under Atmel USB: usb-storage: add IGNORE_RESIDUE flag for Genesys Logic adapters USB: Quirk for Hummingbird huc56s / Conexant ACM modem USB: serial: add support for second revision of Ericsson F3507G WWAN card USB: cdc-acm: add usb id for motomagx phones USB: option: add BenQ 3g modem information usb: gadget: obex: select correct ep descriptors USB: EHCI: slow down ITD reuse ...
Showing 19 changed files Side-by-side Diff
- arch/arm/mach-davinci/board-evm.c
- arch/arm/mach-davinci/clock.c
- arch/arm/mach-davinci/usb.c
- drivers/usb/class/cdc-acm.c
- drivers/usb/core/message.c
- drivers/usb/gadget/Kconfig
- drivers/usb/gadget/f_obex.c
- drivers/usb/gadget/file_storage.c
- drivers/usb/gadget/fsl_usb2_udc.c
- drivers/usb/host/ehci-hcd.c
- drivers/usb/host/ehci-mem.c
- drivers/usb/host/ehci-sched.c
- drivers/usb/host/ehci.h
- drivers/usb/musb/davinci.c
- drivers/usb/musb/musb_core.c
- drivers/usb/musb/musb_gadget.c
- drivers/usb/musb/musb_host.c
- drivers/usb/serial/option.c
- drivers/usb/storage/unusual_devs.h
arch/arm/mach-davinci/board-evm.c
... | ... | @@ -311,6 +311,9 @@ |
311 | 311 | gpio_request(gpio + 7, "nCF_SEL"); |
312 | 312 | gpio_direction_output(gpio + 7, 1); |
313 | 313 | |
314 | + /* irlml6401 sustains over 3A, switches 5V in under 8 msec */ | |
315 | + setup_usb(500, 8); | |
316 | + | |
314 | 317 | return 0; |
315 | 318 | } |
316 | 319 | |
... | ... | @@ -417,9 +420,6 @@ |
417 | 420 | platform_add_devices(davinci_evm_devices, |
418 | 421 | ARRAY_SIZE(davinci_evm_devices)); |
419 | 422 | evm_init_i2c(); |
420 | - | |
421 | - /* irlml6401 sustains over 3A, switches 5V in under 8 msec */ | |
422 | - setup_usb(500, 8); | |
423 | 423 | } |
424 | 424 | |
425 | 425 | static __init void davinci_evm_irq_init(void) |
arch/arm/mach-davinci/clock.c
arch/arm/mach-davinci/usb.c
drivers/usb/class/cdc-acm.c
... | ... | @@ -1376,6 +1376,15 @@ |
1376 | 1376 | { USB_DEVICE(0x0572, 0x1324), /* Conexant USB MODEM RD02-D400 */ |
1377 | 1377 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ |
1378 | 1378 | }, |
1379 | + { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */ | |
1380 | + }, | |
1381 | + { USB_DEVICE(0x0572, 0x1329), /* Hummingbird huc56s (Conexant) */ | |
1382 | + .driver_info = NO_UNION_NORMAL, /* union descriptor misplaced on | |
1383 | + data interface instead of | |
1384 | + communications interface. | |
1385 | + Maybe we should define a new | |
1386 | + quirk for this. */ | |
1387 | + }, | |
1379 | 1388 | |
1380 | 1389 | /* control interfaces with various AT-command sets */ |
1381 | 1390 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, |
drivers/usb/core/message.c
... | ... | @@ -653,7 +653,7 @@ |
653 | 653 | if (result <= 0 && result != -ETIMEDOUT) |
654 | 654 | continue; |
655 | 655 | if (result > 1 && ((u8 *)buf)[1] != type) { |
656 | - result = -EPROTO; | |
656 | + result = -ENODATA; | |
657 | 657 | continue; |
658 | 658 | } |
659 | 659 | break; |
... | ... | @@ -696,8 +696,13 @@ |
696 | 696 | USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, |
697 | 697 | (USB_DT_STRING << 8) + index, langid, buf, size, |
698 | 698 | USB_CTRL_GET_TIMEOUT); |
699 | - if (!(result == 0 || result == -EPIPE)) | |
700 | - break; | |
699 | + if (result == 0 || result == -EPIPE) | |
700 | + continue; | |
701 | + if (result > 1 && ((u8 *) buf)[1] != USB_DT_STRING) { | |
702 | + result = -ENODATA; | |
703 | + continue; | |
704 | + } | |
705 | + break; | |
701 | 706 | } |
702 | 707 | return result; |
703 | 708 | } |
drivers/usb/gadget/Kconfig
... | ... | @@ -191,6 +191,7 @@ |
191 | 191 | boolean "OMAP USB Device Controller" |
192 | 192 | depends on ARCH_OMAP |
193 | 193 | select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_H4_OTG |
194 | + select USB_OTG_UTILS if ARCH_OMAP | |
194 | 195 | help |
195 | 196 | Many Texas Instruments OMAP processors have flexible full |
196 | 197 | speed USB device controllers, with support for up to 30 |
drivers/usb/gadget/f_obex.c
... | ... | @@ -366,9 +366,9 @@ |
366 | 366 | f->hs_descriptors = usb_copy_descriptors(hs_function); |
367 | 367 | |
368 | 368 | obex->hs.obex_in = usb_find_endpoint(hs_function, |
369 | - f->descriptors, &obex_hs_ep_in_desc); | |
369 | + f->hs_descriptors, &obex_hs_ep_in_desc); | |
370 | 370 | obex->hs.obex_out = usb_find_endpoint(hs_function, |
371 | - f->descriptors, &obex_hs_ep_out_desc); | |
371 | + f->hs_descriptors, &obex_hs_ep_out_desc); | |
372 | 372 | } |
373 | 373 | |
374 | 374 | /* Avoid letting this gadget enumerate until the userspace |
drivers/usb/gadget/file_storage.c
... | ... | @@ -3879,7 +3879,11 @@ |
3879 | 3879 | mod_data.protocol_type = USB_SC_SCSI; |
3880 | 3880 | mod_data.protocol_name = "Transparent SCSI"; |
3881 | 3881 | |
3882 | - if (gadget_is_sh(fsg->gadget)) | |
3882 | + /* Some peripheral controllers are known not to be able to | |
3883 | + * halt bulk endpoints correctly. If one of them is present, | |
3884 | + * disable stalls. | |
3885 | + */ | |
3886 | + if (gadget_is_sh(fsg->gadget) || gadget_is_at91(fsg->gadget)) | |
3883 | 3887 | mod_data.can_stall = 0; |
3884 | 3888 | |
3885 | 3889 | if (mod_data.release == 0xffff) { // Parameter wasn't set |
drivers/usb/gadget/fsl_usb2_udc.c
drivers/usb/host/ehci-hcd.c
... | ... | @@ -485,6 +485,7 @@ |
485 | 485 | * periodic_size can shrink by USBCMD update if hcc_params allows. |
486 | 486 | */ |
487 | 487 | ehci->periodic_size = DEFAULT_I_TDPS; |
488 | + INIT_LIST_HEAD(&ehci->cached_itd_list); | |
488 | 489 | if ((retval = ehci_mem_init(ehci, GFP_KERNEL)) < 0) |
489 | 490 | return retval; |
490 | 491 | |
... | ... | @@ -497,6 +498,7 @@ |
497 | 498 | |
498 | 499 | ehci->reclaim = NULL; |
499 | 500 | ehci->next_uframe = -1; |
501 | + ehci->clock_frame = -1; | |
500 | 502 | |
501 | 503 | /* |
502 | 504 | * dedicate a qh for the async ring head, since we couldn't unlink |
drivers/usb/host/ehci-mem.c
drivers/usb/host/ehci-sched.c
... | ... | @@ -1004,7 +1004,8 @@ |
1004 | 1004 | |
1005 | 1005 | is_in = (stream->bEndpointAddress & USB_DIR_IN) ? 0x10 : 0; |
1006 | 1006 | stream->bEndpointAddress &= 0x0f; |
1007 | - stream->ep->hcpriv = NULL; | |
1007 | + if (stream->ep) | |
1008 | + stream->ep->hcpriv = NULL; | |
1008 | 1009 | |
1009 | 1010 | if (stream->rescheduled) { |
1010 | 1011 | ehci_info (ehci, "ep%d%s-iso rescheduled " |
1011 | 1012 | |
... | ... | @@ -1653,14 +1654,28 @@ |
1653 | 1654 | (stream->bEndpointAddress & USB_DIR_IN) ? "in" : "out"); |
1654 | 1655 | } |
1655 | 1656 | iso_stream_put (ehci, stream); |
1656 | - /* OK to recycle this ITD now that its completion callback ran. */ | |
1657 | + | |
1657 | 1658 | done: |
1658 | 1659 | usb_put_urb(urb); |
1659 | 1660 | itd->urb = NULL; |
1660 | - itd->stream = NULL; | |
1661 | - list_move(&itd->itd_list, &stream->free_list); | |
1662 | - iso_stream_put(ehci, stream); | |
1663 | - | |
1661 | + if (ehci->clock_frame != itd->frame || itd->index[7] != -1) { | |
1662 | + /* OK to recycle this ITD now. */ | |
1663 | + itd->stream = NULL; | |
1664 | + list_move(&itd->itd_list, &stream->free_list); | |
1665 | + iso_stream_put(ehci, stream); | |
1666 | + } else { | |
1667 | + /* HW might remember this ITD, so we can't recycle it yet. | |
1668 | + * Move it to a safe place until a new frame starts. | |
1669 | + */ | |
1670 | + list_move(&itd->itd_list, &ehci->cached_itd_list); | |
1671 | + if (stream->refcount == 2) { | |
1672 | + /* If iso_stream_put() were called here, stream | |
1673 | + * would be freed. Instead, just prevent reuse. | |
1674 | + */ | |
1675 | + stream->ep->hcpriv = NULL; | |
1676 | + stream->ep = NULL; | |
1677 | + } | |
1678 | + } | |
1664 | 1679 | return retval; |
1665 | 1680 | } |
1666 | 1681 | |
... | ... | @@ -2101,6 +2116,20 @@ |
2101 | 2116 | |
2102 | 2117 | /*-------------------------------------------------------------------------*/ |
2103 | 2118 | |
2119 | +static void free_cached_itd_list(struct ehci_hcd *ehci) | |
2120 | +{ | |
2121 | + struct ehci_itd *itd, *n; | |
2122 | + | |
2123 | + list_for_each_entry_safe(itd, n, &ehci->cached_itd_list, itd_list) { | |
2124 | + struct ehci_iso_stream *stream = itd->stream; | |
2125 | + itd->stream = NULL; | |
2126 | + list_move(&itd->itd_list, &stream->free_list); | |
2127 | + iso_stream_put(ehci, stream); | |
2128 | + } | |
2129 | +} | |
2130 | + | |
2131 | +/*-------------------------------------------------------------------------*/ | |
2132 | + | |
2104 | 2133 | static void |
2105 | 2134 | scan_periodic (struct ehci_hcd *ehci) |
2106 | 2135 | { |
2107 | 2136 | |
2108 | 2137 | |
... | ... | @@ -2115,10 +2144,17 @@ |
2115 | 2144 | * Touches as few pages as possible: cache-friendly. |
2116 | 2145 | */ |
2117 | 2146 | now_uframe = ehci->next_uframe; |
2118 | - if (HC_IS_RUNNING (ehci_to_hcd(ehci)->state)) | |
2147 | + if (HC_IS_RUNNING(ehci_to_hcd(ehci)->state)) { | |
2119 | 2148 | clock = ehci_readl(ehci, &ehci->regs->frame_index); |
2120 | - else | |
2149 | + clock_frame = (clock >> 3) % ehci->periodic_size; | |
2150 | + } else { | |
2121 | 2151 | clock = now_uframe + mod - 1; |
2152 | + clock_frame = -1; | |
2153 | + } | |
2154 | + if (ehci->clock_frame != clock_frame) { | |
2155 | + free_cached_itd_list(ehci); | |
2156 | + ehci->clock_frame = clock_frame; | |
2157 | + } | |
2122 | 2158 | clock %= mod; |
2123 | 2159 | clock_frame = clock >> 3; |
2124 | 2160 | |
... | ... | @@ -2277,6 +2313,10 @@ |
2277 | 2313 | /* rescan the rest of this frame, then ... */ |
2278 | 2314 | clock = now; |
2279 | 2315 | clock_frame = clock >> 3; |
2316 | + if (ehci->clock_frame != clock_frame) { | |
2317 | + free_cached_itd_list(ehci); | |
2318 | + ehci->clock_frame = clock_frame; | |
2319 | + } | |
2280 | 2320 | } else { |
2281 | 2321 | now_uframe++; |
2282 | 2322 | now_uframe %= mod; |
drivers/usb/host/ehci.h
... | ... | @@ -87,6 +87,10 @@ |
87 | 87 | int next_uframe; /* scan periodic, start here */ |
88 | 88 | unsigned periodic_sched; /* periodic activity count */ |
89 | 89 | |
90 | + /* list of itds completed while clock_frame was still active */ | |
91 | + struct list_head cached_itd_list; | |
92 | + unsigned clock_frame; | |
93 | + | |
90 | 94 | /* per root hub port */ |
91 | 95 | unsigned long reset_done [EHCI_MAX_ROOT_PORTS]; |
92 | 96 | |
... | ... | @@ -219,6 +223,8 @@ |
219 | 223 | mod_timer(&ehci->watchdog, t + jiffies); |
220 | 224 | } |
221 | 225 | } |
226 | + | |
227 | +static void free_cached_itd_list(struct ehci_hcd *ehci); | |
222 | 228 | |
223 | 229 | /*-------------------------------------------------------------------------*/ |
224 | 230 |
drivers/usb/musb/davinci.c
... | ... | @@ -377,18 +377,8 @@ |
377 | 377 | u32 revision; |
378 | 378 | |
379 | 379 | musb->mregs += DAVINCI_BASE_OFFSET; |
380 | -#if 0 | |
381 | - /* REVISIT there's something odd about clocking, this | |
382 | - * didn't appear do the job ... | |
383 | - */ | |
384 | - musb->clock = clk_get(pDevice, "usb"); | |
385 | - if (IS_ERR(musb->clock)) | |
386 | - return PTR_ERR(musb->clock); | |
387 | 380 | |
388 | - status = clk_enable(musb->clock); | |
389 | - if (status < 0) | |
390 | - return -ENODEV; | |
391 | -#endif | |
381 | + clk_enable(musb->clock); | |
392 | 382 | |
393 | 383 | /* returns zero if e.g. not clocked */ |
394 | 384 | revision = musb_readl(tibase, DAVINCI_USB_VERSION_REG); |
... | ... | @@ -453,6 +443,9 @@ |
453 | 443 | } |
454 | 444 | |
455 | 445 | phy_off(); |
446 | + | |
447 | + clk_disable(musb->clock); | |
448 | + | |
456 | 449 | return 0; |
457 | 450 | } |
drivers/usb/musb/musb_core.c
... | ... | @@ -115,7 +115,7 @@ |
115 | 115 | |
116 | 116 | |
117 | 117 | unsigned musb_debug; |
118 | -module_param(musb_debug, uint, S_IRUGO | S_IWUSR); | |
118 | +module_param_named(debug, musb_debug, uint, S_IRUGO | S_IWUSR); | |
119 | 119 | MODULE_PARM_DESC(debug, "Debug message level. Default = 0"); |
120 | 120 | |
121 | 121 | #define DRIVER_AUTHOR "Mentor Graphics, Texas Instruments, Nokia" |
... | ... | @@ -767,6 +767,7 @@ |
767 | 767 | #ifdef CONFIG_USB_MUSB_HDRC_HCD |
768 | 768 | case OTG_STATE_A_HOST: |
769 | 769 | case OTG_STATE_A_SUSPEND: |
770 | + usb_hcd_resume_root_hub(musb_to_hcd(musb)); | |
770 | 771 | musb_root_disconnect(musb); |
771 | 772 | if (musb->a_wait_bcon != 0) |
772 | 773 | musb_platform_try_idle(musb, jiffies |
... | ... | @@ -1815,7 +1816,7 @@ |
1815 | 1816 | #ifdef CONFIG_SYSFS |
1816 | 1817 | device_remove_file(musb->controller, &dev_attr_mode); |
1817 | 1818 | device_remove_file(musb->controller, &dev_attr_vbus); |
1818 | -#ifdef CONFIG_USB_MUSB_OTG | |
1819 | +#ifdef CONFIG_USB_GADGET_MUSB_HDRC | |
1819 | 1820 | device_remove_file(musb->controller, &dev_attr_srp); |
1820 | 1821 | #endif |
1821 | 1822 | #endif |
... | ... | @@ -2063,7 +2064,7 @@ |
2063 | 2064 | #ifdef CONFIG_SYSFS |
2064 | 2065 | device_remove_file(musb->controller, &dev_attr_mode); |
2065 | 2066 | device_remove_file(musb->controller, &dev_attr_vbus); |
2066 | -#ifdef CONFIG_USB_MUSB_OTG | |
2067 | +#ifdef CONFIG_USB_GADGET_MUSB_HDRC | |
2067 | 2068 | device_remove_file(musb->controller, &dev_attr_srp); |
2068 | 2069 | #endif |
2069 | 2070 | #endif |
2070 | 2071 | |
... | ... | @@ -2243,10 +2244,10 @@ |
2243 | 2244 | return platform_driver_probe(&musb_driver, musb_probe); |
2244 | 2245 | } |
2245 | 2246 | |
2246 | -/* make us init after usbcore and before usb | |
2247 | - * gadget and host-side drivers start to register | |
2247 | +/* make us init after usbcore and i2c (transceivers, regulators, etc) | |
2248 | + * and before usb gadget and host-side drivers start to register | |
2248 | 2249 | */ |
2249 | -subsys_initcall(musb_init); | |
2250 | +fs_initcall(musb_init); | |
2250 | 2251 | |
2251 | 2252 | static void __exit musb_cleanup(void) |
2252 | 2253 | { |
drivers/usb/musb/musb_gadget.c
... | ... | @@ -575,7 +575,7 @@ |
575 | 575 | struct usb_request *request = &req->request; |
576 | 576 | struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out; |
577 | 577 | void __iomem *epio = musb->endpoints[epnum].regs; |
578 | - u16 fifo_count = 0; | |
578 | + unsigned fifo_count = 0; | |
579 | 579 | u16 len = musb_ep->packet_sz; |
580 | 580 | |
581 | 581 | csr = musb_readw(epio, MUSB_RXCSR); |
... | ... | @@ -687,7 +687,7 @@ |
687 | 687 | len, fifo_count, |
688 | 688 | musb_ep->packet_sz); |
689 | 689 | |
690 | - fifo_count = min(len, fifo_count); | |
690 | + fifo_count = min_t(unsigned, len, fifo_count); | |
691 | 691 | |
692 | 692 | #ifdef CONFIG_USB_TUSB_OMAP_DMA |
693 | 693 | if (tusb_dma_omap() && musb_ep->dma) { |
drivers/usb/musb/musb_host.c
... | ... | @@ -335,16 +335,11 @@ |
335 | 335 | static struct musb_qh * |
336 | 336 | musb_giveback(struct musb_qh *qh, struct urb *urb, int status) |
337 | 337 | { |
338 | - int is_in; | |
339 | 338 | struct musb_hw_ep *ep = qh->hw_ep; |
340 | 339 | struct musb *musb = ep->musb; |
340 | + int is_in = usb_pipein(urb->pipe); | |
341 | 341 | int ready = qh->is_ready; |
342 | 342 | |
343 | - if (ep->is_shared_fifo) | |
344 | - is_in = 1; | |
345 | - else | |
346 | - is_in = usb_pipein(urb->pipe); | |
347 | - | |
348 | 343 | /* save toggle eagerly, for paranoia */ |
349 | 344 | switch (qh->type) { |
350 | 345 | case USB_ENDPOINT_XFER_BULK: |
... | ... | @@ -432,7 +427,7 @@ |
432 | 427 | else |
433 | 428 | qh = musb_giveback(qh, urb, urb->status); |
434 | 429 | |
435 | - if (qh && qh->is_ready && !list_empty(&qh->hep->urb_list)) { | |
430 | + if (qh != NULL && qh->is_ready) { | |
436 | 431 | DBG(4, "... next ep%d %cX urb %p\n", |
437 | 432 | hw_ep->epnum, is_in ? 'R' : 'T', |
438 | 433 | next_urb(qh)); |
... | ... | @@ -942,8 +937,8 @@ |
942 | 937 | switch (musb->ep0_stage) { |
943 | 938 | case MUSB_EP0_IN: |
944 | 939 | fifo_dest = urb->transfer_buffer + urb->actual_length; |
945 | - fifo_count = min(len, ((u16) (urb->transfer_buffer_length | |
946 | - - urb->actual_length))); | |
940 | + fifo_count = min_t(size_t, len, urb->transfer_buffer_length - | |
941 | + urb->actual_length); | |
947 | 942 | if (fifo_count < len) |
948 | 943 | urb->status = -EOVERFLOW; |
949 | 944 | |
... | ... | @@ -976,10 +971,9 @@ |
976 | 971 | } |
977 | 972 | /* FALLTHROUGH */ |
978 | 973 | case MUSB_EP0_OUT: |
979 | - fifo_count = min(qh->maxpacket, ((u16) | |
980 | - (urb->transfer_buffer_length | |
981 | - - urb->actual_length))); | |
982 | - | |
974 | + fifo_count = min_t(size_t, qh->maxpacket, | |
975 | + urb->transfer_buffer_length - | |
976 | + urb->actual_length); | |
983 | 977 | if (fifo_count) { |
984 | 978 | fifo_dest = (u8 *) (urb->transfer_buffer |
985 | 979 | + urb->actual_length); |
... | ... | @@ -1161,7 +1155,8 @@ |
1161 | 1155 | struct urb *urb; |
1162 | 1156 | struct musb_hw_ep *hw_ep = musb->endpoints + epnum; |
1163 | 1157 | void __iomem *epio = hw_ep->regs; |
1164 | - struct musb_qh *qh = hw_ep->out_qh; | |
1158 | + struct musb_qh *qh = hw_ep->is_shared_fifo ? hw_ep->in_qh | |
1159 | + : hw_ep->out_qh; | |
1165 | 1160 | u32 status = 0; |
1166 | 1161 | void __iomem *mbase = musb->mregs; |
1167 | 1162 | struct dma_channel *dma; |
... | ... | @@ -1308,7 +1303,8 @@ |
1308 | 1303 | * packets before updating TXCSR ... other docs disagree ... |
1309 | 1304 | */ |
1310 | 1305 | /* PIO: start next packet in this URB */ |
1311 | - wLength = min(qh->maxpacket, (u16) wLength); | |
1306 | + if (wLength > qh->maxpacket) | |
1307 | + wLength = qh->maxpacket; | |
1312 | 1308 | musb_write_fifo(hw_ep, wLength, buf); |
1313 | 1309 | qh->segsize = wLength; |
1314 | 1310 | |
1315 | 1311 | |
1316 | 1312 | |
... | ... | @@ -1867,19 +1863,21 @@ |
1867 | 1863 | } |
1868 | 1864 | qh->type_reg = type_reg; |
1869 | 1865 | |
1870 | - /* precompute rxinterval/txinterval register */ | |
1871 | - interval = min((u8)16, epd->bInterval); /* log encoding */ | |
1866 | + /* Precompute RXINTERVAL/TXINTERVAL register */ | |
1872 | 1867 | switch (qh->type) { |
1873 | 1868 | case USB_ENDPOINT_XFER_INT: |
1874 | - /* fullspeed uses linear encoding */ | |
1875 | - if (USB_SPEED_FULL == urb->dev->speed) { | |
1876 | - interval = epd->bInterval; | |
1877 | - if (!interval) | |
1878 | - interval = 1; | |
1869 | + /* | |
1870 | + * Full/low speeds use the linear encoding, | |
1871 | + * high speed uses the logarithmic encoding. | |
1872 | + */ | |
1873 | + if (urb->dev->speed <= USB_SPEED_FULL) { | |
1874 | + interval = max_t(u8, epd->bInterval, 1); | |
1875 | + break; | |
1879 | 1876 | } |
1880 | 1877 | /* FALLTHROUGH */ |
1881 | 1878 | case USB_ENDPOINT_XFER_ISOC: |
1882 | - /* iso always uses log encoding */ | |
1879 | + /* ISO always uses logarithmic encoding */ | |
1880 | + interval = min_t(u8, epd->bInterval, 16); | |
1883 | 1881 | break; |
1884 | 1882 | default: |
1885 | 1883 | /* REVISIT we actually want to use NAK limits, hinting to the |
1886 | 1884 | |
... | ... | @@ -2037,9 +2035,9 @@ |
2037 | 2035 | goto done; |
2038 | 2036 | |
2039 | 2037 | /* Any URB not actively programmed into endpoint hardware can be |
2040 | - * immediately given back. Such an URB must be at the head of its | |
2038 | + * immediately given back; that's any URB not at the head of an | |
2041 | 2039 | * endpoint queue, unless someday we get real DMA queues. And even |
2042 | - * then, it might not be known to the hardware... | |
2040 | + * if it's at the head, it might not be known to the hardware... | |
2043 | 2041 | * |
2044 | 2042 | * Otherwise abort current transfer, pending dma, etc.; urb->status |
2045 | 2043 | * has already been updated. This is a synchronous abort; it'd be |
... | ... | @@ -2078,6 +2076,15 @@ |
2078 | 2076 | qh->is_ready = 0; |
2079 | 2077 | __musb_giveback(musb, urb, 0); |
2080 | 2078 | qh->is_ready = ready; |
2079 | + | |
2080 | + /* If nothing else (usually musb_giveback) is using it | |
2081 | + * and its URB list has emptied, recycle this qh. | |
2082 | + */ | |
2083 | + if (ready && list_empty(&qh->hep->urb_list)) { | |
2084 | + qh->hep->hcpriv = NULL; | |
2085 | + list_del(&qh->ring); | |
2086 | + kfree(qh); | |
2087 | + } | |
2081 | 2088 | } else |
2082 | 2089 | ret = musb_cleanup_urb(urb, qh, urb->pipe & USB_DIR_IN); |
2083 | 2090 | done: |
2084 | 2091 | |
2085 | 2092 | |
... | ... | @@ -2093,15 +2100,16 @@ |
2093 | 2100 | unsigned long flags; |
2094 | 2101 | struct musb *musb = hcd_to_musb(hcd); |
2095 | 2102 | u8 is_in = epnum & USB_DIR_IN; |
2096 | - struct musb_qh *qh = hep->hcpriv; | |
2097 | - struct urb *urb, *tmp; | |
2103 | + struct musb_qh *qh; | |
2104 | + struct urb *urb; | |
2098 | 2105 | struct list_head *sched; |
2099 | 2106 | |
2100 | - if (!qh) | |
2101 | - return; | |
2102 | - | |
2103 | 2107 | spin_lock_irqsave(&musb->lock, flags); |
2104 | 2108 | |
2109 | + qh = hep->hcpriv; | |
2110 | + if (qh == NULL) | |
2111 | + goto exit; | |
2112 | + | |
2105 | 2113 | switch (qh->type) { |
2106 | 2114 | case USB_ENDPOINT_XFER_CONTROL: |
2107 | 2115 | sched = &musb->control; |
2108 | 2116 | |
2109 | 2117 | |
... | ... | @@ -2135,13 +2143,28 @@ |
2135 | 2143 | |
2136 | 2144 | /* cleanup */ |
2137 | 2145 | musb_cleanup_urb(urb, qh, urb->pipe & USB_DIR_IN); |
2138 | - } else | |
2139 | - urb = NULL; | |
2140 | 2146 | |
2141 | - /* then just nuke all the others */ | |
2142 | - list_for_each_entry_safe_from(urb, tmp, &hep->urb_list, urb_list) | |
2143 | - musb_giveback(qh, urb, -ESHUTDOWN); | |
2147 | + /* Then nuke all the others ... and advance the | |
2148 | + * queue on hw_ep (e.g. bulk ring) when we're done. | |
2149 | + */ | |
2150 | + while (!list_empty(&hep->urb_list)) { | |
2151 | + urb = next_urb(qh); | |
2152 | + urb->status = -ESHUTDOWN; | |
2153 | + musb_advance_schedule(musb, urb, qh->hw_ep, is_in); | |
2154 | + } | |
2155 | + } else { | |
2156 | + /* Just empty the queue; the hardware is busy with | |
2157 | + * other transfers, and since !qh->is_ready nothing | |
2158 | + * will activate any of these as it advances. | |
2159 | + */ | |
2160 | + while (!list_empty(&hep->urb_list)) | |
2161 | + __musb_giveback(musb, next_urb(qh), -ESHUTDOWN); | |
2144 | 2162 | |
2163 | + hep->hcpriv = NULL; | |
2164 | + list_del(&qh->ring); | |
2165 | + kfree(qh); | |
2166 | + } | |
2167 | +exit: | |
2145 | 2168 | spin_unlock_irqrestore(&musb->lock, flags); |
2146 | 2169 | } |
2147 | 2170 |
drivers/usb/serial/option.c
... | ... | @@ -294,8 +294,12 @@ |
294 | 294 | |
295 | 295 | /* Ericsson products */ |
296 | 296 | #define ERICSSON_VENDOR_ID 0x0bdb |
297 | -#define ERICSSON_PRODUCT_F3507G 0x1900 | |
297 | +#define ERICSSON_PRODUCT_F3507G_1 0x1900 | |
298 | +#define ERICSSON_PRODUCT_F3507G_2 0x1902 | |
298 | 299 | |
300 | +#define BENQ_VENDOR_ID 0x04a5 | |
301 | +#define BENQ_PRODUCT_H10 0x4068 | |
302 | + | |
299 | 303 | static struct usb_device_id option_ids[] = { |
300 | 304 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, |
301 | 305 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, |
... | ... | @@ -509,7 +513,10 @@ |
509 | 513 | { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF626) }, |
510 | 514 | { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) }, |
511 | 515 | { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) }, |
512 | - { USB_DEVICE(ERICSSON_VENDOR_ID, ERICSSON_PRODUCT_F3507G) }, | |
516 | + { USB_DEVICE(ERICSSON_VENDOR_ID, ERICSSON_PRODUCT_F3507G_1) }, | |
517 | + { USB_DEVICE(ERICSSON_VENDOR_ID, ERICSSON_PRODUCT_F3507G_2) }, | |
518 | + { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, | |
519 | + { USB_DEVICE(0x1da5, 0x4515) }, /* BenQ H20 */ | |
513 | 520 | { } /* Terminating entry */ |
514 | 521 | }; |
515 | 522 | MODULE_DEVICE_TABLE(usb, option_ids); |
drivers/usb/storage/unusual_devs.h
... | ... | @@ -907,13 +907,13 @@ |
907 | 907 | "Genesys Logic", |
908 | 908 | "USB to IDE Optical", |
909 | 909 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
910 | - US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ), | |
910 | + US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 | US_FL_IGNORE_RESIDUE ), | |
911 | 911 | |
912 | 912 | UNUSUAL_DEV( 0x05e3, 0x0702, 0x0000, 0xffff, |
913 | 913 | "Genesys Logic", |
914 | 914 | "USB to IDE Disk", |
915 | 915 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
916 | - US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ), | |
916 | + US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 | US_FL_IGNORE_RESIDUE ), | |
917 | 917 | |
918 | 918 | /* Reported by Ben Efros <ben@pc-doctor.com> */ |
919 | 919 | UNUSUAL_DEV( 0x05e3, 0x0723, 0x9451, 0x9451, |