Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'usb-3.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB fixes from Greg Kroah-Hartman:
"Here are some USB fixes to resolve issues reported recently, as well
as a new device id for the ftdi_sio driver."

* tag 'usb-3.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
usb: ftdi_sio: Add support for Mitsubishi FX-USB-AW/-BD
usb: Fix compile error by selecting USB_OTG_UTILS
USB: serial: fix hang when opening port
USB: EHCI: fix bug in iTD/siTD DMA pool allocation
xhci: Don't warn on empty ring for suspended devices.
usb: xhci: Fix TRB transfer length macro used for Event TRB.
usb/acpi: binding xhci root hub usb port with ACPI
usb: add find_raw_port_number callback to struct hc_driver()
usb: xhci: fix build warning

+101 -55
+8
drivers/usb/core/hcd.c
··· 2412 2412 } 2413 2413 EXPORT_SYMBOL_GPL(usb_hcd_is_primary_hcd); 2414 2414 2415 + int usb_hcd_find_raw_port_number(struct usb_hcd *hcd, int port1) 2416 + { 2417 + if (!hcd->driver->find_raw_port_number) 2418 + return port1; 2419 + 2420 + return hcd->driver->find_raw_port_number(hcd, port1); 2421 + } 2422 + 2415 2423 static int usb_hcd_request_irqs(struct usb_hcd *hcd, 2416 2424 unsigned int irqnum, unsigned long irqflags) 2417 2425 {
+7 -1
drivers/usb/core/usb-acpi.c
··· 15 15 #include <linux/kernel.h> 16 16 #include <linux/acpi.h> 17 17 #include <linux/pci.h> 18 + #include <linux/usb/hcd.h> 18 19 #include <acpi/acpi_bus.h> 19 20 20 21 #include "usb.h" ··· 189 188 * connected to. 190 189 */ 191 190 if (!udev->parent) { 192 - *handle = acpi_get_child(DEVICE_ACPI_HANDLE(&udev->dev), 191 + struct usb_hcd *hcd = bus_to_hcd(udev->bus); 192 + int raw_port_num; 193 + 194 + raw_port_num = usb_hcd_find_raw_port_number(hcd, 193 195 port_num); 196 + *handle = acpi_get_child(DEVICE_ACPI_HANDLE(&udev->dev), 197 + raw_port_num); 194 198 if (!*handle) 195 199 return -ENODEV; 196 200 } else {
+1
drivers/usb/gadget/Kconfig
··· 145 145 tristate "LPC32XX USB Peripheral Controller" 146 146 depends on ARCH_LPC32XX 147 147 select USB_ISP1301 148 + select USB_OTG_UTILS 148 149 help 149 150 This option selects the USB device controller in the LPC32xx SoC. 150 151
+2
drivers/usb/host/ehci-sched.c
··· 1214 1214 1215 1215 memset (itd, 0, sizeof *itd); 1216 1216 itd->itd_dma = itd_dma; 1217 + itd->frame = 9999; /* an invalid value */ 1217 1218 list_add (&itd->itd_list, &sched->td_list); 1218 1219 } 1219 1220 spin_unlock_irqrestore (&ehci->lock, flags); ··· 1916 1915 1917 1916 memset (sitd, 0, sizeof *sitd); 1918 1917 sitd->sitd_dma = sitd_dma; 1918 + sitd->frame = 9999; /* an invalid value */ 1919 1919 list_add (&sitd->sitd_list, &iso_sched->td_list); 1920 1920 } 1921 1921
+8 -28
drivers/usb/host/xhci-mem.c
··· 1022 1022 * is attached to (or the roothub port its ancestor hub is attached to). All we 1023 1023 * know is the index of that port under either the USB 2.0 or the USB 3.0 1024 1024 * roothub, but that doesn't give us the real index into the HW port status 1025 - * registers. Scan through the xHCI roothub port array, looking for the Nth 1026 - * entry of the correct port speed. Return the port number of that entry. 1025 + * registers. Call xhci_find_raw_port_number() to get real index. 1027 1026 */ 1028 1027 static u32 xhci_find_real_port_number(struct xhci_hcd *xhci, 1029 1028 struct usb_device *udev) 1030 1029 { 1031 1030 struct usb_device *top_dev; 1032 - unsigned int num_similar_speed_ports; 1033 - unsigned int faked_port_num; 1034 - int i; 1031 + struct usb_hcd *hcd; 1032 + 1033 + if (udev->speed == USB_SPEED_SUPER) 1034 + hcd = xhci->shared_hcd; 1035 + else 1036 + hcd = xhci->main_hcd; 1035 1037 1036 1038 for (top_dev = udev; top_dev->parent && top_dev->parent->parent; 1037 1039 top_dev = top_dev->parent) 1038 1040 /* Found device below root hub */; 1039 - faked_port_num = top_dev->portnum; 1040 - for (i = 0, num_similar_speed_ports = 0; 1041 - i < HCS_MAX_PORTS(xhci->hcs_params1); i++) { 1042 - u8 port_speed = xhci->port_array[i]; 1043 1041 1044 - /* 1045 - * Skip ports that don't have known speeds, or have duplicate 1046 - * Extended Capabilities port speed entries. 1047 - */ 1048 - if (port_speed == 0 || port_speed == DUPLICATE_ENTRY) 1049 - continue; 1050 - 1051 - /* 1052 - * USB 3.0 ports are always under a USB 3.0 hub. USB 2.0 and 1053 - * 1.1 ports are under the USB 2.0 hub. If the port speed 1054 - * matches the device speed, it's a similar speed port. 1055 - */ 1056 - if ((port_speed == 0x03) == (udev->speed == USB_SPEED_SUPER)) 1057 - num_similar_speed_ports++; 1058 - if (num_similar_speed_ports == faked_port_num) 1059 - /* Roothub ports are numbered from 1 to N */ 1060 - return i+1; 1061 - } 1062 - return 0; 1042 + return xhci_find_raw_port_number(hcd, top_dev->portnum); 1063 1043 } 1064 1044 1065 1045 /* Setup an xHCI virtual device for a Set Address command */
+1
drivers/usb/host/xhci-pci.c
··· 313 313 .set_usb2_hw_lpm = xhci_set_usb2_hardware_lpm, 314 314 .enable_usb3_lpm_timeout = xhci_enable_usb3_lpm_timeout, 315 315 .disable_usb3_lpm_timeout = xhci_disable_usb3_lpm_timeout, 316 + .find_raw_port_number = xhci_find_raw_port_number, 316 317 }; 317 318 318 319 /*-------------------------------------------------------------------------*/
+35 -26
drivers/usb/host/xhci-ring.c
··· 1599 1599 max_ports = HCS_MAX_PORTS(xhci->hcs_params1); 1600 1600 if ((port_id <= 0) || (port_id > max_ports)) { 1601 1601 xhci_warn(xhci, "Invalid port id %d\n", port_id); 1602 - bogus_port_status = true; 1603 - goto cleanup; 1602 + inc_deq(xhci, xhci->event_ring); 1603 + return; 1604 1604 } 1605 1605 1606 1606 /* Figure out which usb_hcd this port is attached to: 1607 1607 * is it a USB 3.0 port or a USB 2.0/1.1 port? 1608 1608 */ 1609 1609 major_revision = xhci->port_array[port_id - 1]; 1610 + 1611 + /* Find the right roothub. */ 1612 + hcd = xhci_to_hcd(xhci); 1613 + if ((major_revision == 0x03) != (hcd->speed == HCD_USB3)) 1614 + hcd = xhci->shared_hcd; 1615 + 1610 1616 if (major_revision == 0) { 1611 1617 xhci_warn(xhci, "Event for port %u not in " 1612 1618 "Extended Capabilities, ignoring.\n", ··· 1635 1629 * into the index into the ports on the correct split roothub, and the 1636 1630 * correct bus_state structure. 1637 1631 */ 1638 - /* Find the right roothub. */ 1639 - hcd = xhci_to_hcd(xhci); 1640 - if ((major_revision == 0x03) != (hcd->speed == HCD_USB3)) 1641 - hcd = xhci->shared_hcd; 1642 1632 bus_state = &xhci->bus_state[hcd_index(hcd)]; 1643 1633 if (hcd->speed == HCD_USB3) 1644 1634 port_array = xhci->usb3_ports; ··· 2029 2027 if (event_trb != ep_ring->dequeue && 2030 2028 event_trb != td->last_trb) 2031 2029 td->urb->actual_length = 2032 - td->urb->transfer_buffer_length 2033 - - TRB_LEN(le32_to_cpu(event->transfer_len)); 2030 + td->urb->transfer_buffer_length - 2031 + EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); 2034 2032 else 2035 2033 td->urb->actual_length = 0; 2036 2034 ··· 2062 2060 /* Maybe the event was for the data stage? */ 2063 2061 td->urb->actual_length = 2064 2062 td->urb->transfer_buffer_length - 2065 - TRB_LEN(le32_to_cpu(event->transfer_len)); 2063 + EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); 2066 2064 xhci_dbg(xhci, "Waiting for status " 2067 2065 "stage event\n"); 2068 2066 return 0; ··· 2098 2096 /* handle completion code */ 2099 2097 switch (trb_comp_code) { 2100 2098 case COMP_SUCCESS: 2101 - if (TRB_LEN(le32_to_cpu(event->transfer_len)) == 0) { 2099 + if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) == 0) { 2102 2100 frame->status = 0; 2103 2101 break; 2104 2102 } ··· 2143 2141 len += TRB_LEN(le32_to_cpu(cur_trb->generic.field[2])); 2144 2142 } 2145 2143 len += TRB_LEN(le32_to_cpu(cur_trb->generic.field[2])) - 2146 - TRB_LEN(le32_to_cpu(event->transfer_len)); 2144 + EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); 2147 2145 2148 2146 if (trb_comp_code != COMP_STOP_INVAL) { 2149 2147 frame->actual_length = len; ··· 2201 2199 case COMP_SUCCESS: 2202 2200 /* Double check that the HW transferred everything. */ 2203 2201 if (event_trb != td->last_trb || 2204 - TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) { 2202 + EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) { 2205 2203 xhci_warn(xhci, "WARN Successful completion " 2206 2204 "on short TX\n"); 2207 2205 if (td->urb->transfer_flags & URB_SHORT_NOT_OK) ··· 2229 2227 "%d bytes untransferred\n", 2230 2228 td->urb->ep->desc.bEndpointAddress, 2231 2229 td->urb->transfer_buffer_length, 2232 - TRB_LEN(le32_to_cpu(event->transfer_len))); 2230 + EVENT_TRB_LEN(le32_to_cpu(event->transfer_len))); 2233 2231 /* Fast path - was this the last TRB in the TD for this URB? */ 2234 2232 if (event_trb == td->last_trb) { 2235 - if (TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) { 2233 + if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) { 2236 2234 td->urb->actual_length = 2237 2235 td->urb->transfer_buffer_length - 2238 - TRB_LEN(le32_to_cpu(event->transfer_len)); 2236 + EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); 2239 2237 if (td->urb->transfer_buffer_length < 2240 2238 td->urb->actual_length) { 2241 2239 xhci_warn(xhci, "HC gave bad length " 2242 2240 "of %d bytes left\n", 2243 - TRB_LEN(le32_to_cpu(event->transfer_len))); 2241 + EVENT_TRB_LEN(le32_to_cpu(event->transfer_len))); 2244 2242 td->urb->actual_length = 0; 2245 2243 if (td->urb->transfer_flags & URB_SHORT_NOT_OK) 2246 2244 *status = -EREMOTEIO; ··· 2282 2280 if (trb_comp_code != COMP_STOP_INVAL) 2283 2281 td->urb->actual_length += 2284 2282 TRB_LEN(le32_to_cpu(cur_trb->generic.field[2])) - 2285 - TRB_LEN(le32_to_cpu(event->transfer_len)); 2283 + EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); 2286 2284 } 2287 2285 2288 2286 return finish_td(xhci, td, event_trb, event, ep, status, false); ··· 2370 2368 * transfer type 2371 2369 */ 2372 2370 case COMP_SUCCESS: 2373 - if (TRB_LEN(le32_to_cpu(event->transfer_len)) == 0) 2371 + if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) == 0) 2374 2372 break; 2375 2373 if (xhci->quirks & XHCI_TRUST_TX_LENGTH) 2376 2374 trb_comp_code = COMP_SHORT_TX; ··· 2463 2461 * TD list. 2464 2462 */ 2465 2463 if (list_empty(&ep_ring->td_list)) { 2466 - xhci_warn(xhci, "WARN Event TRB for slot %d ep %d " 2467 - "with no TDs queued?\n", 2468 - TRB_TO_SLOT_ID(le32_to_cpu(event->flags)), 2469 - ep_index); 2470 - xhci_dbg(xhci, "Event TRB with TRB type ID %u\n", 2471 - (le32_to_cpu(event->flags) & 2472 - TRB_TYPE_BITMASK)>>10); 2473 - xhci_print_trb_offsets(xhci, (union xhci_trb *) event); 2464 + /* 2465 + * A stopped endpoint may generate an extra completion 2466 + * event if the device was suspended. Don't print 2467 + * warnings. 2468 + */ 2469 + if (!(trb_comp_code == COMP_STOP || 2470 + trb_comp_code == COMP_STOP_INVAL)) { 2471 + xhci_warn(xhci, "WARN Event TRB for slot %d ep %d with no TDs queued?\n", 2472 + TRB_TO_SLOT_ID(le32_to_cpu(event->flags)), 2473 + ep_index); 2474 + xhci_dbg(xhci, "Event TRB with TRB type ID %u\n", 2475 + (le32_to_cpu(event->flags) & 2476 + TRB_TYPE_BITMASK)>>10); 2477 + xhci_print_trb_offsets(xhci, (union xhci_trb *) event); 2478 + } 2474 2479 if (ep->skip) { 2475 2480 ep->skip = false; 2476 2481 xhci_dbg(xhci, "td_list is empty while skip "
+22
drivers/usb/host/xhci.c
··· 3779 3779 return 0; 3780 3780 } 3781 3781 3782 + /* 3783 + * Transfer the port index into real index in the HW port status 3784 + * registers. Caculate offset between the port's PORTSC register 3785 + * and port status base. Divide the number of per port register 3786 + * to get the real index. The raw port number bases 1. 3787 + */ 3788 + int xhci_find_raw_port_number(struct usb_hcd *hcd, int port1) 3789 + { 3790 + struct xhci_hcd *xhci = hcd_to_xhci(hcd); 3791 + __le32 __iomem *base_addr = &xhci->op_regs->port_status_base; 3792 + __le32 __iomem *addr; 3793 + int raw_port; 3794 + 3795 + if (hcd->speed != HCD_USB3) 3796 + addr = xhci->usb2_ports[port1 - 1]; 3797 + else 3798 + addr = xhci->usb3_ports[port1 - 1]; 3799 + 3800 + raw_port = (addr - base_addr)/NUM_PORT_REGS + 1; 3801 + return raw_port; 3802 + } 3803 + 3782 3804 #ifdef CONFIG_USB_SUSPEND 3783 3805 3784 3806 /* BESL to HIRD Encoding array for USB2 LPM */
+5
drivers/usb/host/xhci.h
··· 972 972 __le32 flags; 973 973 }; 974 974 975 + /* Transfer event TRB length bit mask */ 976 + /* bits 0:23 */ 977 + #define EVENT_TRB_LEN(p) ((p) & 0xffffff) 978 + 975 979 /** Transfer Event bit fields **/ 976 980 #define TRB_TO_EP_ID(p) (((p) >> 16) & 0x1f) 977 981 ··· 1833 1829 int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, 1834 1830 char *buf, u16 wLength); 1835 1831 int xhci_hub_status_data(struct usb_hcd *hcd, char *buf); 1832 + int xhci_find_raw_port_number(struct usb_hcd *hcd, int port1); 1836 1833 1837 1834 #ifdef CONFIG_PM 1838 1835 int xhci_bus_suspend(struct usb_hcd *hcd);
+1
drivers/usb/phy/Kconfig
··· 38 38 tristate "NXP ISP1301 USB transceiver support" 39 39 depends on USB || USB_GADGET 40 40 depends on I2C 41 + select USB_OTG_UTILS 41 42 help 42 43 Say Y here to add support for the NXP ISP1301 USB transceiver driver. 43 44 This chip is typically used as USB transceiver for USB host, gadget
+1
drivers/usb/serial/ftdi_sio.c
··· 640 640 { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, 641 641 { USB_DEVICE(ACTON_VID, ACTON_SPECTRAPRO_PID) }, 642 642 { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) }, 643 + { USB_DEVICE(MITSUBISHI_VID, MITSUBISHI_FXUSB_PID) }, 643 644 { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, 644 645 { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, 645 646 { USB_DEVICE(BANDB_VID, BANDB_USO9ML2_PID) },
+7
drivers/usb/serial/ftdi_sio_ids.h
··· 584 584 #define CONTEC_COM1USBH_PID 0x8311 /* COM-1(USB)H */ 585 585 586 586 /* 587 + * Mitsubishi Electric Corp. (http://www.meau.com) 588 + * Submitted by Konstantin Holoborodko 589 + */ 590 + #define MITSUBISHI_VID 0x06D3 591 + #define MITSUBISHI_FXUSB_PID 0x0284 /* USB/RS422 converters: FX-USB-AW/-BD */ 592 + 593 + /* 587 594 * Definitions for B&B Electronics products. 588 595 */ 589 596 #define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */
+1
drivers/usb/serial/usb-serial.c
··· 903 903 port->port.ops = &serial_port_ops; 904 904 port->serial = serial; 905 905 spin_lock_init(&port->lock); 906 + init_waitqueue_head(&port->delta_msr_wait); 906 907 /* Keep this for private driver use for the moment but 907 908 should probably go away */ 908 909 INIT_WORK(&port->work, usb_serial_port_work);
+2
include/linux/usb/hcd.h
··· 357 357 */ 358 358 int (*disable_usb3_lpm_timeout)(struct usb_hcd *, 359 359 struct usb_device *, enum usb3_link_state state); 360 + int (*find_raw_port_number)(struct usb_hcd *, int); 360 361 }; 361 362 362 363 extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); ··· 397 396 extern int usb_add_hcd(struct usb_hcd *hcd, 398 397 unsigned int irqnum, unsigned long irqflags); 399 398 extern void usb_remove_hcd(struct usb_hcd *hcd); 399 + extern int usb_hcd_find_raw_port_number(struct usb_hcd *hcd, int port1); 400 400 401 401 struct platform_device; 402 402 extern void usb_hcd_platform_shutdown(struct platform_device *dev);