zephyr/subsys/usb
Emil Obalski 773f02e6e9 usb: drivers: Fix ZLP handling for Nordic driver.
ZLP - zero length packet is used to indicate that the device
has no more data to send. If the Host asks for more data that the
device can provide and the data size is mutliplication of Endpoint
wMaxPacketSize then the device must terminate the data transfer
with ZLP.

Until this patch Nordic device driver controller was not aware of
the requested data length and could not determine when the ZLP was
required.

This patch introduces a fix that prevents the driver from starting
setup stage before the ZLP is being send.

For consistance with the Zephyr USB stack sending ZLP must be
issued from the stack level. Making trans_zlp flag true results
in blocking the driver from starting setup stage without required
ZLP.

After the data transfer finishes the driver will be prepared for ZLP
and will call back the stack to start writing ZLP. After the ZLP
is being send the driver will automatically start status stage and
end the Control Transfer.

This patch also removes CONFIG_USB_DEVICE_DISABLE_ZLP_EPIN_HANDLING
and aligns Nordic driver with others.

Without this patch the issue could occur when handling get requests.
Typical case is string descriptor of length equal to wMaxPacketSize.
Hosts usually asks for wLength = 255 Bytes when string descriptors
are being requested. In that case to successfully finish the data
stage of the Control transfer the device must send wMacPacketSize
Bytes of actual string descriptor and then ZLP to indicate that no
more data are present. After ZLP the status stage may start and the
request is finished successfully.

Without this patch the driver will not send ZLP making it unable
to end the Control Request successful - this may lead to failing
'Device Descriptor Test' from USB3CV test tool.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-11-17 18:06:26 +01:00
..
class usb/class/usb_dfu: makes USB_DFU_WAIT_DELAY_MS configurable 2020-11-13 13:37:18 +01:00
CMakeLists.txt usb: add optional work queue 2020-09-16 13:32:22 -05:00
Kconfig usb: drivers: Fix ZLP handling for Nordic driver. 2020-11-17 18:06:26 +01:00
bos.c
os_desc.c
os_desc.h
usb_descriptor.c code-guideline: Fixing code violation 10.4 Rule 2020-10-01 17:13:29 -04:00
usb_descriptor.h
usb_device.c usb: drivers: Fix ZLP handling for Nordic driver. 2020-11-17 18:06:26 +01:00
usb_transfer.c usb: add optional work queue 2020-09-16 13:32:22 -05:00
usb_transfer.h usb: fix header language linkage 2020-09-16 13:32:22 -05:00
usb_work_q.c usb: add optional work queue 2020-09-16 13:32:22 -05:00
usb_work_q.h usb: add optional work queue 2020-09-16 13:32:22 -05:00