linux-imx/drivers/usb/chipidea
Xu Yang 2ffc90eb9e LF-12220 usb: chipidea: udc: disable sg_support for uvc and enable it dynamically
The UVC rev1.5 spec has requirements with data payload as below, take HS
Isoc transfer as example (2.4.3.2.2 Sample Isochronous Transfers):

+-----+ +----+ +---+-------+ +----+ +-------+ +----+ +-------+ +-----+
| SOF | | IN | | H | DATA2 | | IN | | DATA1 | | IN | | DATA0 | | SOF |
+-----+ +----+ +---+-------+ +----+ +-------+ +----+ +-------+ +-----+
                 \
                  Payload Header (8 bytes)

Three DATA packets need to be sent to the USB bus within 1 micro-frame.

However, the start address of payload header and DATA2 passed from uvc
layer may be not 4K page-aligned when using scatterlist.

The sgs may have below formats:
sgs:
 - sg[0]: 8 bytes (payload header)
 - sg[1]: 3064 bytes (payload)

In this case, the udc needs 2 dTDs to send data out. However, the packets
on USB bus will show as:

+-----+ +----+ +---+ +-----+ +----+ +-------+ +----+ +-------+ +----+ +-------+ +-----+
| SOF | | IN | | H | | SOF | | IN | | DATA2 | | IN | | DATA1 | | IN | | DATA0 | | SOF |
+-----+ +----+ +---+ +-----+ +----+ +-------+ +----+ +-------+ +----+ +-------+ +-----+
                 \
                  Payload Header (8 bytes)

This behavior is unexpected since the host will not recognize uvc data
correctly. The root cause should be dTD doesn't support scatterlist very
well. Such as (1) doesn't support one DATA packet span two or more dTD
(2) doesn't support specify offset for page1-4.

So in order for uvc gadget works properly, disable sg_support when it has
uvc function, or else enable it.

Note: most of the functions use sg_support after bind stage, except uvc
      which uses sg_support when call bind(), so if a function in future
      also uses sg_support when call bind(), it will be limited to non-sg
      way.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Reviewed-by: Jun Li <jun.li@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2024-05-08 11:14:12 +08:00
..
bits.h MLK-22025-1 usb: chipidea: phy enter low power mode when host suspend 2023-10-30 16:19:11 +08:00
ci_hdrc_imx.c LF-10575-2 usb: chipidea: ci_hdrc_imx: add wakeup irq handling 2023-11-20 22:14:10 +08:00
ci_hdrc_imx.h usb: chipidea: imx: add one fsl picophy parameter tuning implementation 2023-07-25 18:21:52 +02:00
ci_hdrc_msm.c
ci_hdrc_pci.c
ci_hdrc_tegra.c usb: Explicitly include correct DT includes 2023-07-25 18:20:02 +02:00
ci_hdrc_usb2.c usb: chipidea/ci_hdrc_usb2: Convert to platform remove callback returning void 2023-05-28 12:36:15 +01:00
ci.h usb: chipidea: core: handle power lost in workqueue 2024-01-29 11:50:32 +08:00
core.c usb: chipidea: core: handle power lost in workqueue 2024-01-29 11:50:32 +08:00
debug.c
host.c Merge tag 'v6.6.2' into lf-6.6.y 2023-11-30 09:40:58 -06:00
host.h
Kconfig
Makefile
otg_fsm.c
otg_fsm.h
otg.c
otg.h
trace.c
trace.h
udc.c LF-12220 usb: chipidea: udc: disable sg_support for uvc and enable it dynamically 2024-05-08 11:14:12 +08:00
udc.h
ulpi.c
usbmisc_imx.c LF-10575-3 usb: chipidea: imx: add HSIO blkctl wakup handling 2023-11-20 22:14:19 +08:00