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-4.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB fixes from Greg KH:
"Here are some small USB fixes for 4.13-rc2.

The usual batch, gadget fixes for reported issues, as well as xhci
fixes, and a small random collection of other fixes for reported
issues.

All have been in linux-next with no reported issues"

* tag 'usb-4.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (25 commits)
xhci: fix memleak in xhci_run()
usb: xhci: fix spinlock recursion for USB2 test mode
xhci: fix 20000ms port resume timeout
usb: xhci: Issue stop EP command only when the EP state is running
xhci: Bad Ethernet performance plugged in ASM1042A host
xhci: Fix NULL pointer dereference when cleaning up streams for removed host
usb: renesas_usbhs: gadget: disable all eps when the driver stops
usb: renesas_usbhs: fix usbhsc_resume() for !USBHSF_RUNTIME_PWCTRL
usb: gadget: udc: renesas_usb3: protect usb3_ep->started in usb3_start_pipen()
usb: gadget: udc: renesas_usb3: fix zlp transfer by the dmac
usb: gadget: udc: renesas_usb3: fix free size in renesas_usb3_dma_free_prd()
usb: gadget: f_uac2: endianness fixes.
usb: gadget: f_uac1: endianness fixes.
include: usb: audio: specify exact endiannes of descriptors
usb: gadget: udc: start_udc() can be static
usb: dwc2: gadget: On USB RESET reset device address to zero
usb: storage: return on error to avoid a null pointer dereference
usb: typec: include linux/device.h in ucsi.h
USB: cdc-acm: add device-id for quirky printer
usb: dwc3: gadget: only unmap requests from DMA if mapped
...

+200 -75
+3
drivers/usb/class/cdc-acm.c
··· 1829 1829 { USB_DEVICE(0x1576, 0x03b1), /* Maretron USB100 */ 1830 1830 .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ 1831 1831 }, 1832 + { USB_DEVICE(0xfff0, 0x0100), /* DATECS FP-2000 */ 1833 + .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ 1834 + }, 1832 1835 1833 1836 { USB_DEVICE(0x2912, 0x0001), /* ATOL FPrint */ 1834 1837 .driver_info = CLEAR_HALT_CONDITIONS,
+3
drivers/usb/dwc2/gadget.c
··· 3573 3573 /* Report disconnection if it is not already done. */ 3574 3574 dwc2_hsotg_disconnect(hsotg); 3575 3575 3576 + /* Reset device address to zero */ 3577 + __bic32(hsotg->regs + DCFG, DCFG_DEVADDR_MASK); 3578 + 3576 3579 if (usb_status & GOTGCTL_BSESVLD && connected) 3577 3580 dwc2_hsotg_core_init_disconnected(hsotg, true); 3578 3581 }
+4 -4
drivers/usb/dwc3/core.c
··· 766 766 dwc->maximum_speed = USB_SPEED_HIGH; 767 767 } 768 768 769 + ret = dwc3_core_get_phy(dwc); 770 + if (ret) 771 + goto err0; 772 + 769 773 ret = dwc3_core_soft_reset(dwc); 770 774 if (ret) 771 775 goto err0; 772 776 773 777 ret = dwc3_phy_setup(dwc); 774 - if (ret) 775 - goto err0; 776 - 777 - ret = dwc3_core_get_phy(dwc); 778 778 if (ret) 779 779 goto err0; 780 780
+8 -10
drivers/usb/dwc3/dwc3-omap.c
··· 512 512 513 513 /* check the DMA Status */ 514 514 reg = dwc3_omap_readl(omap->base, USBOTGSS_SYSCONFIG); 515 - irq_set_status_flags(omap->irq, IRQ_NOAUTOEN); 516 - ret = devm_request_threaded_irq(dev, omap->irq, dwc3_omap_interrupt, 517 - dwc3_omap_interrupt_thread, IRQF_SHARED, 518 - "dwc3-omap", omap); 519 - if (ret) { 520 - dev_err(dev, "failed to request IRQ #%d --> %d\n", 521 - omap->irq, ret); 522 - goto err1; 523 - } 524 515 525 516 ret = dwc3_omap_extcon_register(omap); 526 517 if (ret < 0) ··· 523 532 goto err1; 524 533 } 525 534 535 + ret = devm_request_threaded_irq(dev, omap->irq, dwc3_omap_interrupt, 536 + dwc3_omap_interrupt_thread, IRQF_SHARED, 537 + "dwc3-omap", omap); 538 + if (ret) { 539 + dev_err(dev, "failed to request IRQ #%d --> %d\n", 540 + omap->irq, ret); 541 + goto err1; 542 + } 526 543 dwc3_omap_enable_irqs(omap); 527 - enable_irq(omap->irq); 528 544 return 0; 529 545 530 546 err1:
+5 -3
drivers/usb/dwc3/gadget.c
··· 191 191 192 192 req->started = false; 193 193 list_del(&req->list); 194 - req->trb = NULL; 195 194 req->remaining = 0; 196 195 197 196 if (req->request.status == -EINPROGRESS) 198 197 req->request.status = status; 199 198 200 - usb_gadget_unmap_request_by_dev(dwc->sysdev, 201 - &req->request, req->direction); 199 + if (req->trb) 200 + usb_gadget_unmap_request_by_dev(dwc->sysdev, 201 + &req->request, req->direction); 202 + 203 + req->trb = NULL; 202 204 203 205 trace_dwc3_gadget_giveback(req); 204 206
+1 -1
drivers/usb/gadget/function/f_mass_storage.c
··· 2490 2490 int i; 2491 2491 2492 2492 down_write(&common->filesem); 2493 - for (i = 0; i < ARRAY_SIZE(common->luns); --i) { 2493 + for (i = 0; i < ARRAY_SIZE(common->luns); i++) { 2494 2494 struct fsg_lun *curlun = common->luns[i]; 2495 2495 if (!curlun || !fsg_lun_is_open(curlun)) 2496 2496 continue;
+10 -10
drivers/usb/gadget/function/f_uac1.c
··· 92 92 .bDescriptorType = USB_DT_CS_INTERFACE, 93 93 .bDescriptorSubtype = UAC_INPUT_TERMINAL, 94 94 .bTerminalID = USB_OUT_IT_ID, 95 - .wTerminalType = UAC_TERMINAL_STREAMING, 95 + .wTerminalType = cpu_to_le16(UAC_TERMINAL_STREAMING), 96 96 .bAssocTerminal = 0, 97 - .wChannelConfig = 0x3, 97 + .wChannelConfig = cpu_to_le16(0x3), 98 98 }; 99 99 100 100 #define IO_OUT_OT_ID 2 ··· 103 103 .bDescriptorType = USB_DT_CS_INTERFACE, 104 104 .bDescriptorSubtype = UAC_OUTPUT_TERMINAL, 105 105 .bTerminalID = IO_OUT_OT_ID, 106 - .wTerminalType = UAC_OUTPUT_TERMINAL_SPEAKER, 106 + .wTerminalType = cpu_to_le16(UAC_OUTPUT_TERMINAL_SPEAKER), 107 107 .bAssocTerminal = 0, 108 108 .bSourceID = USB_OUT_IT_ID, 109 109 }; ··· 114 114 .bDescriptorType = USB_DT_CS_INTERFACE, 115 115 .bDescriptorSubtype = UAC_INPUT_TERMINAL, 116 116 .bTerminalID = IO_IN_IT_ID, 117 - .wTerminalType = UAC_INPUT_TERMINAL_MICROPHONE, 117 + .wTerminalType = cpu_to_le16(UAC_INPUT_TERMINAL_MICROPHONE), 118 118 .bAssocTerminal = 0, 119 - .wChannelConfig = 0x3, 119 + .wChannelConfig = cpu_to_le16(0x3), 120 120 }; 121 121 122 122 #define USB_IN_OT_ID 4 ··· 125 125 .bDescriptorType = USB_DT_CS_INTERFACE, 126 126 .bDescriptorSubtype = UAC_OUTPUT_TERMINAL, 127 127 .bTerminalID = USB_IN_OT_ID, 128 - .wTerminalType = UAC_TERMINAL_STREAMING, 128 + .wTerminalType = cpu_to_le16(UAC_TERMINAL_STREAMING), 129 129 .bAssocTerminal = 0, 130 130 .bSourceID = IO_IN_IT_ID, 131 131 }; ··· 174 174 .bDescriptorSubtype = UAC_AS_GENERAL, 175 175 .bTerminalLink = USB_OUT_IT_ID, 176 176 .bDelay = 1, 177 - .wFormatTag = UAC_FORMAT_TYPE_I_PCM, 177 + .wFormatTag = cpu_to_le16(UAC_FORMAT_TYPE_I_PCM), 178 178 }; 179 179 180 180 static struct uac1_as_header_descriptor as_in_header_desc = { ··· 183 183 .bDescriptorSubtype = UAC_AS_GENERAL, 184 184 .bTerminalLink = USB_IN_OT_ID, 185 185 .bDelay = 1, 186 - .wFormatTag = UAC_FORMAT_TYPE_I_PCM, 186 + .wFormatTag = cpu_to_le16(UAC_FORMAT_TYPE_I_PCM), 187 187 }; 188 188 189 189 DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(1); ··· 606 606 if (status) 607 607 goto fail; 608 608 609 - audio->out_ep_maxpsize = as_out_ep_desc.wMaxPacketSize; 610 - audio->in_ep_maxpsize = as_in_ep_desc.wMaxPacketSize; 609 + audio->out_ep_maxpsize = le16_to_cpu(as_out_ep_desc.wMaxPacketSize); 610 + audio->in_ep_maxpsize = le16_to_cpu(as_in_ep_desc.wMaxPacketSize); 611 611 audio->params.c_chmask = audio_opts->c_chmask; 612 612 audio->params.c_srate = audio_opts->c_srate; 613 613 audio->params.c_ssize = audio_opts->c_ssize;
+14 -11
drivers/usb/gadget/function/f_uac2.c
··· 168 168 .bAssocTerminal = 0, 169 169 .bCSourceID = USB_OUT_CLK_ID, 170 170 .iChannelNames = 0, 171 - .bmControls = (CONTROL_RDWR << COPY_CTRL), 171 + .bmControls = cpu_to_le16(CONTROL_RDWR << COPY_CTRL), 172 172 }; 173 173 174 174 /* Input Terminal for I/O-In */ ··· 182 182 .bAssocTerminal = 0, 183 183 .bCSourceID = USB_IN_CLK_ID, 184 184 .iChannelNames = 0, 185 - .bmControls = (CONTROL_RDWR << COPY_CTRL), 185 + .bmControls = cpu_to_le16(CONTROL_RDWR << COPY_CTRL), 186 186 }; 187 187 188 188 /* Ouput Terminal for USB_IN */ ··· 196 196 .bAssocTerminal = 0, 197 197 .bSourceID = IO_IN_IT_ID, 198 198 .bCSourceID = USB_IN_CLK_ID, 199 - .bmControls = (CONTROL_RDWR << COPY_CTRL), 199 + .bmControls = cpu_to_le16(CONTROL_RDWR << COPY_CTRL), 200 200 }; 201 201 202 202 /* Ouput Terminal for I/O-Out */ ··· 210 210 .bAssocTerminal = 0, 211 211 .bSourceID = USB_OUT_IT_ID, 212 212 .bCSourceID = USB_OUT_CLK_ID, 213 - .bmControls = (CONTROL_RDWR << COPY_CTRL), 213 + .bmControls = cpu_to_le16(CONTROL_RDWR << COPY_CTRL), 214 214 }; 215 215 216 216 static struct uac2_ac_header_descriptor ac_hdr_desc = { ··· 220 220 .bDescriptorSubtype = UAC_MS_HEADER, 221 221 .bcdADC = cpu_to_le16(0x200), 222 222 .bCategory = UAC2_FUNCTION_IO_BOX, 223 - .wTotalLength = sizeof in_clk_src_desc + sizeof out_clk_src_desc 224 - + sizeof usb_out_it_desc + sizeof io_in_it_desc 225 - + sizeof usb_in_ot_desc + sizeof io_out_ot_desc, 223 + .wTotalLength = cpu_to_le16(sizeof in_clk_src_desc 224 + + sizeof out_clk_src_desc + sizeof usb_out_it_desc 225 + + sizeof io_in_it_desc + sizeof usb_in_ot_desc 226 + + sizeof io_out_ot_desc), 226 227 .bmControls = 0, 227 228 }; 228 229 ··· 570 569 return ret; 571 570 } 572 571 573 - agdev->in_ep_maxpsize = max(fs_epin_desc.wMaxPacketSize, 574 - hs_epin_desc.wMaxPacketSize); 575 - agdev->out_ep_maxpsize = max(fs_epout_desc.wMaxPacketSize, 576 - hs_epout_desc.wMaxPacketSize); 572 + agdev->in_ep_maxpsize = max_t(u16, 573 + le16_to_cpu(fs_epin_desc.wMaxPacketSize), 574 + le16_to_cpu(hs_epin_desc.wMaxPacketSize)); 575 + agdev->out_ep_maxpsize = max_t(u16, 576 + le16_to_cpu(fs_epout_desc.wMaxPacketSize), 577 + le16_to_cpu(hs_epout_desc.wMaxPacketSize)); 577 578 578 579 hs_epout_desc.bEndpointAddress = fs_epout_desc.bEndpointAddress; 579 580 hs_epin_desc.bEndpointAddress = fs_epin_desc.bEndpointAddress;
+3 -2
drivers/usb/gadget/udc/Kconfig
··· 192 192 config USB_RENESAS_USB3 193 193 tristate 'Renesas USB3.0 Peripheral controller' 194 194 depends on ARCH_RENESAS || COMPILE_TEST 195 - depends on EXTCON 195 + depends on EXTCON && HAS_DMA 196 196 help 197 197 Renesas USB3.0 Peripheral controller is a USB peripheral controller 198 198 that supports super, high, and full speed USB 3.0 data transfers. ··· 257 257 258 258 config USB_SNP_CORE 259 259 depends on (USB_AMD5536UDC || USB_SNP_UDC_PLAT) 260 + depends on HAS_DMA 260 261 tristate 261 262 help 262 263 This enables core driver support for Synopsys USB 2.0 Device ··· 272 271 273 272 config USB_SNP_UDC_PLAT 274 273 tristate "Synopsys USB 2.0 Device controller" 275 - depends on (USB_GADGET && OF) 274 + depends on USB_GADGET && OF && HAS_DMA 276 275 select USB_GADGET_DUALSPEED 277 276 select USB_SNP_CORE 278 277 default ARCH_BCM_IPROC
+12 -6
drivers/usb/gadget/udc/renesas_usb3.c
··· 89 89 90 90 /* USB_COM_CON */ 91 91 #define USB_COM_CON_CONF BIT(24) 92 + #define USB_COM_CON_PN_WDATAIF_NL BIT(23) 93 + #define USB_COM_CON_PN_RDATAIF_NL BIT(22) 94 + #define USB_COM_CON_PN_LSTTR_PP BIT(21) 92 95 #define USB_COM_CON_SPD_MODE BIT(17) 93 96 #define USB_COM_CON_EP0_EN BIT(16) 94 97 #define USB_COM_CON_DEV_ADDR_SHIFT 8 ··· 689 686 { 690 687 usb3_init_axi_bridge(usb3); 691 688 usb3_init_epc_registers(usb3); 689 + usb3_set_bit(usb3, USB_COM_CON_PN_WDATAIF_NL | 690 + USB_COM_CON_PN_RDATAIF_NL | USB_COM_CON_PN_LSTTR_PP, 691 + USB3_USB_COM_CON); 692 692 usb3_write(usb3, USB_OTG_IDMON, USB3_USB_OTG_INT_STA); 693 693 usb3_write(usb3, USB_OTG_IDMON, USB3_USB_OTG_INT_ENA); 694 694 ··· 1375 1369 1376 1370 usb3_for_each_dma(usb3, dma, i) { 1377 1371 if (dma->prd) { 1378 - dma_free_coherent(dev, USB3_DMA_MAX_XFER_SIZE, 1372 + dma_free_coherent(dev, USB3_DMA_PRD_SIZE, 1379 1373 dma->prd, dma->prd_dma); 1380 1374 dma->prd = NULL; 1381 1375 } ··· 1415 1409 int ret = -EAGAIN; 1416 1410 u32 enable_bits = 0; 1417 1411 1418 - if (usb3_ep->halt || usb3_ep->started) 1419 - return; 1420 - if (usb3_req != usb3_req_first) 1421 - return; 1422 - 1423 1412 spin_lock_irqsave(&usb3->lock, flags); 1413 + if (usb3_ep->halt || usb3_ep->started) 1414 + goto out; 1415 + if (usb3_req != usb3_req_first) 1416 + goto out; 1417 + 1424 1418 if (usb3_pn_change(usb3, usb3_ep->num) < 0) 1425 1419 goto out; 1426 1420
+3 -3
drivers/usb/gadget/udc/snps_udc_plat.c
··· 28 28 /* description */ 29 29 #define UDC_MOD_DESCRIPTION "Synopsys UDC platform driver" 30 30 31 - void start_udc(struct udc *udc) 31 + static void start_udc(struct udc *udc) 32 32 { 33 33 if (udc->driver) { 34 34 dev_info(udc->dev, "Connecting...\n"); ··· 38 38 } 39 39 } 40 40 41 - void stop_udc(struct udc *udc) 41 + static void stop_udc(struct udc *udc) 42 42 { 43 43 int tmp; 44 44 u32 reg; ··· 76 76 dev_info(udc->dev, "Device disconnected\n"); 77 77 } 78 78 79 - void udc_drd_work(struct work_struct *work) 79 + static void udc_drd_work(struct work_struct *work) 80 80 { 81 81 struct udc *udc; 82 82
+54
drivers/usb/host/pci-quirks.c
··· 77 77 #define USB_INTEL_USB3_PSSEN 0xD8 78 78 #define USB_INTEL_USB3PRM 0xDC 79 79 80 + /* ASMEDIA quirk use */ 81 + #define ASMT_DATA_WRITE0_REG 0xF8 82 + #define ASMT_DATA_WRITE1_REG 0xFC 83 + #define ASMT_CONTROL_REG 0xE0 84 + #define ASMT_CONTROL_WRITE_BIT 0x02 85 + #define ASMT_WRITEREG_CMD 0x10423 86 + #define ASMT_FLOWCTL_ADDR 0xFA30 87 + #define ASMT_FLOWCTL_DATA 0xBA 88 + #define ASMT_PSEUDO_DATA 0 89 + 80 90 /* 81 91 * amd_chipset_gen values represent AMD different chipset generations 82 92 */ ··· 421 411 usb_amd_quirk_pll(1); 422 412 } 423 413 EXPORT_SYMBOL_GPL(usb_amd_quirk_pll_disable); 414 + 415 + static int usb_asmedia_wait_write(struct pci_dev *pdev) 416 + { 417 + unsigned long retry_count; 418 + unsigned char value; 419 + 420 + for (retry_count = 1000; retry_count > 0; --retry_count) { 421 + 422 + pci_read_config_byte(pdev, ASMT_CONTROL_REG, &value); 423 + 424 + if (value == 0xff) { 425 + dev_err(&pdev->dev, "%s: check_ready ERROR", __func__); 426 + return -EIO; 427 + } 428 + 429 + if ((value & ASMT_CONTROL_WRITE_BIT) == 0) 430 + return 0; 431 + 432 + usleep_range(40, 60); 433 + } 434 + 435 + dev_warn(&pdev->dev, "%s: check_write_ready timeout", __func__); 436 + return -ETIMEDOUT; 437 + } 438 + 439 + void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev) 440 + { 441 + if (usb_asmedia_wait_write(pdev) != 0) 442 + return; 443 + 444 + /* send command and address to device */ 445 + pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_WRITEREG_CMD); 446 + pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_FLOWCTL_ADDR); 447 + pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT); 448 + 449 + if (usb_asmedia_wait_write(pdev) != 0) 450 + return; 451 + 452 + /* send data to device */ 453 + pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_FLOWCTL_DATA); 454 + pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_PSEUDO_DATA); 455 + pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT); 456 + } 457 + EXPORT_SYMBOL_GPL(usb_asmedia_modifyflowcontrol); 424 458 425 459 void usb_amd_quirk_pll_enable(void) 426 460 {
+2
drivers/usb/host/pci-quirks.h
··· 11 11 void usb_amd_dev_put(void); 12 12 void usb_amd_quirk_pll_disable(void); 13 13 void usb_amd_quirk_pll_enable(void); 14 + void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev); 14 15 void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev); 15 16 void usb_disable_xhci_ports(struct pci_dev *xhci_pdev); 16 17 void sb800_prefetch(struct device *dev, int on); ··· 19 18 struct pci_dev; 20 19 static inline void usb_amd_quirk_pll_disable(void) {} 21 20 static inline void usb_amd_quirk_pll_enable(void) {} 21 + static inline void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev) {} 22 22 static inline void usb_amd_dev_put(void) {} 23 23 static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {} 24 24 static inline void sb800_prefetch(struct device *dev, int on) {}
+13 -1
drivers/usb/host/xhci-hub.c
··· 398 398 spin_lock_irqsave(&xhci->lock, flags); 399 399 for (i = LAST_EP_INDEX; i > 0; i--) { 400 400 if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue) { 401 + struct xhci_ep_ctx *ep_ctx; 401 402 struct xhci_command *command; 403 + 404 + ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->out_ctx, i); 405 + 406 + /* Check ep is running, required by AMD SNPS 3.1 xHC */ 407 + if (GET_EP_CTX_STATE(ep_ctx) != EP_STATE_RUNNING) 408 + continue; 409 + 402 410 command = xhci_alloc_command(xhci, false, false, 403 411 GFP_NOWAIT); 404 412 if (!command) { 405 413 spin_unlock_irqrestore(&xhci->lock, flags); 406 414 xhci_free_command(xhci, cmd); 407 415 return -ENOMEM; 408 - 409 416 } 410 417 xhci_queue_stop_endpoint(xhci, command, slot_id, i, 411 418 suspend); ··· 610 603 611 604 /* Disable all Device Slots */ 612 605 xhci_dbg(xhci, "Disable all slots\n"); 606 + spin_unlock_irqrestore(&xhci->lock, *flags); 613 607 for (i = 1; i <= HCS_MAX_SLOTS(xhci->hcs_params1); i++) { 614 608 retval = xhci_disable_slot(xhci, NULL, i); 615 609 if (retval) 616 610 xhci_err(xhci, "Failed to disable slot %d, %d. Enter test mode anyway\n", 617 611 i, retval); 618 612 } 613 + spin_lock_irqsave(&xhci->lock, *flags); 619 614 /* Put all ports to the Disable state by clear PP */ 620 615 xhci_dbg(xhci, "Disable all port (PP = 0)\n"); 621 616 /* Power off USB3 ports*/ ··· 906 897 clear_bit(wIndex, &bus_state->resuming_ports); 907 898 908 899 set_bit(wIndex, &bus_state->rexit_ports); 900 + 901 + xhci_test_and_clear_bit(xhci, port_array, wIndex, 902 + PORT_PLC); 909 903 xhci_set_link_state(xhci, port_array, wIndex, 910 904 XDEV_U0); 911 905
+6
drivers/usb/host/xhci-pci.c
··· 59 59 #define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb 60 60 #define PCI_DEVICE_ID_AMD_PROMONTORYA_1 0x43bc 61 61 62 + #define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142 63 + 62 64 static const char hcd_name[] = "xhci_hcd"; 63 65 64 66 static struct hc_driver __read_mostly xhci_pci_hc_driver; ··· 218 216 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && 219 217 pdev->device == 0x1142) 220 218 xhci->quirks |= XHCI_TRUST_TX_LENGTH; 219 + 220 + if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && 221 + pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI) 222 + xhci->quirks |= XHCI_ASMEDIA_MODIFY_FLOWCONTROL; 221 223 222 224 if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241) 223 225 xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7;
+7 -4
drivers/usb/host/xhci-ring.c
··· 864 864 (ep->ep_state & EP_GETTING_NO_STREAMS)) { 865 865 int stream_id; 866 866 867 - for (stream_id = 0; stream_id < ep->stream_info->num_streams; 867 + for (stream_id = 1; stream_id < ep->stream_info->num_streams; 868 868 stream_id++) { 869 + ring = ep->stream_info->stream_rings[stream_id]; 870 + if (!ring) 871 + continue; 872 + 869 873 xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, 870 874 "Killing URBs for slot ID %u, ep index %u, stream %u", 871 - slot_id, ep_index, stream_id + 1); 872 - xhci_kill_ring_urbs(xhci, 873 - ep->stream_info->stream_rings[stream_id]); 875 + slot_id, ep_index, stream_id); 876 + xhci_kill_ring_urbs(xhci, ring); 874 877 } 875 878 } else { 876 879 ring = ep->ring;
+9 -1
drivers/usb/host/xhci.c
··· 198 198 if (ret) 199 199 return ret; 200 200 201 + if (xhci->quirks & XHCI_ASMEDIA_MODIFY_FLOWCONTROL) 202 + usb_asmedia_modifyflowcontrol(to_pci_dev(xhci_to_hcd(xhci)->self.controller)); 203 + 201 204 xhci_dbg_trace(xhci, trace_xhci_dbg_init, 202 205 "Wait for controller to be ready for doorbell rings"); 203 206 /* ··· 625 622 if (!command) 626 623 return -ENOMEM; 627 624 628 - xhci_queue_vendor_command(xhci, command, 0, 0, 0, 625 + ret = xhci_queue_vendor_command(xhci, command, 0, 0, 0, 629 626 TRB_TYPE(TRB_NEC_GET_FW)); 627 + if (ret) 628 + xhci_free_command(xhci, command); 630 629 } 631 630 xhci_dbg_trace(xhci, trace_xhci_dbg_init, 632 631 "Finished xhci_run for USB2 roothub"); ··· 1089 1084 */ 1090 1085 if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && !comp_timer_running) 1091 1086 compliance_mode_recovery_timer_init(xhci); 1087 + 1088 + if (xhci->quirks & XHCI_ASMEDIA_MODIFY_FLOWCONTROL) 1089 + usb_asmedia_modifyflowcontrol(to_pci_dev(hcd->self.controller)); 1092 1090 1093 1091 /* Re-enable port polling. */ 1094 1092 xhci_dbg(xhci, "%s: starting port polling.\n", __func__);
+1
drivers/usb/host/xhci.h
··· 1820 1820 #define XHCI_BROKEN_PORT_PED (1 << 25) 1821 1821 #define XHCI_LIMIT_ENDPOINT_INTERVAL_7 (1 << 26) 1822 1822 #define XHCI_U2_DISABLE_WAKE (1 << 27) 1823 + #define XHCI_ASMEDIA_MODIFY_FLOWCONTROL (1 << 28) 1823 1824 1824 1825 unsigned int num_active_eps; 1825 1826 unsigned int limit_active_eps;
+3 -1
drivers/usb/renesas_usbhs/common.c
··· 752 752 struct usbhs_priv *priv = dev_get_drvdata(dev); 753 753 struct platform_device *pdev = usbhs_priv_to_pdev(priv); 754 754 755 - if (!usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL)) 755 + if (!usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL)) { 756 756 usbhsc_power_ctrl(priv, 1); 757 + usbhs_mod_autonomy_mode(priv); 758 + } 757 759 758 760 usbhs_platform_call(priv, phy_reset, pdev); 759 761
+24 -7
drivers/usb/renesas_usbhs/mod_gadget.c
··· 37 37 struct usbhsg_uep { 38 38 struct usb_ep ep; 39 39 struct usbhs_pipe *pipe; 40 + spinlock_t lock; /* protect the pipe */ 40 41 41 42 char ep_name[EP_NAME_SIZE]; 42 43 ··· 637 636 static int usbhsg_ep_disable(struct usb_ep *ep) 638 637 { 639 638 struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep); 640 - struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep); 639 + struct usbhs_pipe *pipe; 640 + unsigned long flags; 641 + int ret = 0; 641 642 642 - if (!pipe) 643 - return -EINVAL; 643 + spin_lock_irqsave(&uep->lock, flags); 644 + pipe = usbhsg_uep_to_pipe(uep); 645 + if (!pipe) { 646 + ret = -EINVAL; 647 + goto out; 648 + } 644 649 645 650 usbhsg_pipe_disable(uep); 646 651 usbhs_pipe_free(pipe); 647 652 648 653 uep->pipe->mod_private = NULL; 649 654 uep->pipe = NULL; 655 + 656 + out: 657 + spin_unlock_irqrestore(&uep->lock, flags); 650 658 651 659 return 0; 652 660 } ··· 706 696 { 707 697 struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep); 708 698 struct usbhsg_request *ureq = usbhsg_req_to_ureq(req); 709 - struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep); 699 + struct usbhs_pipe *pipe; 700 + unsigned long flags; 710 701 702 + spin_lock_irqsave(&uep->lock, flags); 703 + pipe = usbhsg_uep_to_pipe(uep); 711 704 if (pipe) 712 705 usbhs_pkt_pop(pipe, usbhsg_ureq_to_pkt(ureq)); 713 706 ··· 719 706 * even if the pipe is NULL. 720 707 */ 721 708 usbhsg_queue_pop(uep, ureq, -ECONNRESET); 709 + spin_unlock_irqrestore(&uep->lock, flags); 722 710 723 711 return 0; 724 712 } ··· 866 852 { 867 853 struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv); 868 854 struct usbhs_mod *mod = usbhs_mod_get_current(priv); 869 - struct usbhsg_uep *dcp = usbhsg_gpriv_to_dcp(gpriv); 855 + struct usbhsg_uep *uep; 870 856 struct device *dev = usbhs_priv_to_dev(priv); 871 857 unsigned long flags; 872 - int ret = 0; 858 + int ret = 0, i; 873 859 874 860 /******************** spin lock ********************/ 875 861 usbhs_lock(priv, flags); ··· 901 887 usbhs_sys_set_test_mode(priv, 0); 902 888 usbhs_sys_function_ctrl(priv, 0); 903 889 904 - usbhsg_ep_disable(&dcp->ep); 890 + /* disable all eps */ 891 + usbhsg_for_each_uep_with_dcp(uep, gpriv, i) 892 + usbhsg_ep_disable(&uep->ep); 905 893 906 894 dev_dbg(dev, "stop gadget\n"); 907 895 ··· 1085 1069 ret = -ENOMEM; 1086 1070 goto usbhs_mod_gadget_probe_err_gpriv; 1087 1071 } 1072 + spin_lock_init(&uep->lock); 1088 1073 1089 1074 gpriv->transceiver = usb_get_phy(USB_PHY_TYPE_UNDEFINED); 1090 1075 dev_info(dev, "%stransceiver found\n",
+4 -1
drivers/usb/storage/isd200.c
··· 1529 1529 1530 1530 /* Make sure driver was initialized */ 1531 1531 1532 - if (us->extra == NULL) 1532 + if (us->extra == NULL) { 1533 1533 usb_stor_dbg(us, "ERROR Driver not initialized\n"); 1534 + srb->result = DID_ERROR << 16; 1535 + return; 1536 + } 1534 1537 1535 1538 scsi_set_resid(srb, 0); 1536 1539 /* scsi_bufflen might change in protocol translation to ata */
+1
drivers/usb/typec/ucsi/ucsi.h
··· 3 3 #define __DRIVER_USB_TYPEC_UCSI_H 4 4 5 5 #include <linux/bitops.h> 6 + #include <linux/device.h> 6 7 #include <linux/types.h> 7 8 8 9 /* -------------------------------------------------------------------------- */
+7 -7
include/linux/usb/audio-v2.h
··· 115 115 __u8 bDescriptorType; 116 116 __u8 bDescriptorSubtype; 117 117 __u8 bTerminalID; 118 - __u16 wTerminalType; 118 + __le16 wTerminalType; 119 119 __u8 bAssocTerminal; 120 120 __u8 bCSourceID; 121 121 __u8 bNrChannels; 122 - __u32 bmChannelConfig; 122 + __le32 bmChannelConfig; 123 123 __u8 iChannelNames; 124 - __u16 bmControls; 124 + __le16 bmControls; 125 125 __u8 iTerminal; 126 126 } __attribute__((packed)); 127 127 ··· 132 132 __u8 bDescriptorType; 133 133 __u8 bDescriptorSubtype; 134 134 __u8 bTerminalID; 135 - __u16 wTerminalType; 135 + __le16 wTerminalType; 136 136 __u8 bAssocTerminal; 137 137 __u8 bSourceID; 138 138 __u8 bCSourceID; 139 - __u16 bmControls; 139 + __le16 bmControls; 140 140 __u8 iTerminal; 141 141 } __attribute__((packed)); 142 142 ··· 164 164 __u8 bTerminalLink; 165 165 __u8 bmControls; 166 166 __u8 bFormatType; 167 - __u32 bmFormats; 167 + __le32 bmFormats; 168 168 __u8 bNrChannels; 169 - __u32 bmChannelConfig; 169 + __le32 bmChannelConfig; 170 170 __u8 iChannelNames; 171 171 } __attribute__((packed)); 172 172
+3 -3
include/uapi/linux/usb/audio.h
··· 333 333 __u8 bDescriptorType; 334 334 __u8 bDescriptorSubtype; 335 335 __u8 bUnitID; 336 - __u16 wProcessType; 336 + __le16 wProcessType; 337 337 __u8 bNrInPins; 338 338 __u8 baSourceID[]; 339 339 } __attribute__ ((packed)); ··· 491 491 __u8 bDescriptorType; 492 492 __u8 bDescriptorSubtype; 493 493 __u8 bFormatType; 494 - __u16 wMaxBitRate; 495 - __u16 wSamplesPerFrame; 494 + __le16 wMaxBitRate; 495 + __le16 wSamplesPerFrame; 496 496 __u8 bHeaderLength; 497 497 __u8 bSideBandProtocol; 498 498 } __attribute__((packed));