linux/drivers/usb
Frank Li 1b8be5ecff usb: cdns3: fix uvc failure work since sg support enabled
When IP version >= DEV_VER_V2, gadget:sg_supported is true. So uvc gadget
function driver will use sg to equeue data, first is 8bytes header, the
second is 1016bytes data.

    cdns3_prepare_trb: ep2in: trb 0000000000ac755f, dma buf: 0xbf455000, size: 8, burst: 128 ctrl: 0x00000415 (C=1, T=0, ISP, CHAIN, Normal)
    cdns3_prepare_trb: ep2in: trb 00000000a574e693, dma buf: 0xc0200fe0, size: 1016, burst: 128 ctrl: 0x00000405 (C=1, T=0, ISP, Normal)

But cdns3_ep_run_transfer() can't correctly handle this case, which only
support one TRB for ISO transfer.

The controller requires duplicate the TD for each SOF if priv_ep->interval
is not 1. DMA will read data from DDR to internal FIFO when get SOF. Send
data to bus when receive IN token. DMA always refill FIFO when get SOF
regardless host send IN token or not. If host send IN token later, some
frames data will be lost.

Fixed it by below major steps:

1. Calculate numembers of TRB base on sg_nums and priv_ep->interval.
2. Remove CHAIN flags for each end TRB of TD when duplicate TD.
3. The controller requires LINK TRB must be first TRB of TD. When check
there are not enough TRBs lefts, just fill LINK TRB for left TRBs.

.... CHAIN_TRB DATA_TRB, CHAIN_TRB DATA_TRB,  LINK_TRB ... LINK_TRB
                                                           ^End of TRB List

Cc:  <stable@vger.kernel.org>
Fixes: 7733f6c32e ("usb: cdns3: Add Cadence USB3 DRD Driver")
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20231224153816.1664687-2-Frank.Li@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-01-04 16:01:44 +01:00
..
atm usb: ueagle-atm: Use wait_event_freezable_timeout() in uea_wait() 2024-01-04 15:57:29 +01:00
c67x00 USB: c67x00: Remove unused declaration c67x00_hcd_msg_received() 2023-10-02 16:42:33 +02:00
cdns3 usb: cdns3: fix uvc failure work since sg support enabled 2024-01-04 16:01:44 +01:00
chipidea usb: chipidea: Remove usage of the deprecated ida_simple_xx() API 2023-12-15 13:53:33 +01:00
class usb: cdc-acm: return correct error code on unsupported break 2023-12-15 13:52:47 +01:00
common Merge 6.5-rc6 into usb-next 2023-08-14 22:22:31 +02:00
core usb: core: Fix crash w/ usb_choose_configuration() if no driver 2023-12-15 13:54:09 +01:00
dwc2 usb: dwc2: Disable clock gating feature on Rockchip SoCs 2024-01-02 14:35:23 +01:00
dwc3 usb: dwc3: set pm runtime active before resume common 2024-01-04 16:00:45 +01:00
early usb: early: xhci-dbc: Use memcpy_and_pad() 2023-01-31 10:40:54 +01:00
fotg210 usb: fotg210-udc: fix function kernel-doc comments 2023-12-11 09:08:42 +01:00
gadget usb: gadget: ncm: Add support to update wMaxSegmentSize via configfs 2024-01-04 16:01:14 +01:00
host usb: xhci-plat: fix usb disconnect issue after s4 2024-01-04 15:58:12 +01:00
image scsi: usb: uas: Declare two host templates and host template pointers const 2023-03-24 19:20:00 -04:00
isp1760 usb: isp1760: Convert to platform remove callback returning void 2023-05-28 12:38:01 +01:00
misc usb: yurex: Fix inconsistent locking bug in yurex_read() 2024-01-02 14:41:51 +01:00
mon usb: mon_text: Replace snprintf() with the safer scnprintf() variant 2023-12-15 13:55:30 +01:00
mtu3 usb: mtu3: Convert to platform remove callback returning void 2023-10-21 12:49:08 +02:00
musb Merge 6.6-rc6 into usb-next 2023-10-16 17:36:12 +02:00
phy usb: phy: twl6030: Remove snprintf() from sysfs call-backs and replace with sysfs_emit() 2023-12-15 13:55:30 +01:00
renesas_usbhs usb: Explicitly include correct DT includes 2023-07-25 18:20:02 +02:00
roles USB: roles: make role_class a static const structure 2023-06-20 16:20:40 +02:00
serial USB: serial: option: add Luat Air72*U series products 2023-11-23 18:39:30 +01:00
storage usb: storage: Remove snprintf() from sysfs call-backs and replace with sysfs_emit() 2023-12-15 13:55:30 +01:00
typec usb: typec: tcpm: Support multiple capabilities 2024-01-04 16:00:23 +01:00
usbip USB: usbip: vudc: Convert to platform remove callback returning void 2023-11-22 12:02:53 +00:00
Kconfig usb: pci-quirks: handle HAS_IOPORT dependency for AMD quirk 2023-10-02 16:19:12 +02:00
Makefile usb: host: u132-hcd: Delete driver 2023-03-21 14:06:11 +01:00
usb-skeleton.c usb: add usb_set_intfdata() documentation 2022-11-29 08:56:09 +01:00