The dev argument is missing.
Introduced in the commit 1cccf28d5e
("drivers: usb: udc: Reduce unnecessary ep config lookups").
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
UDC API passes struct udc_ep_config to all functions. Some UDC functions
were using endpoint config structure while some were using device and
endpoint number. This API inconsistency led to completely unnecessary
endpoint structure lookups. Remove unnecessary lookups by using endpoint
config structure pointer where it makes sense.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
USB stack does not check api->lock() and api->unlock() return value and
all UDC drivers block without timeout in its lock() and unlock() api
implementations. There is no realistic way to handle lock() and unlock()
errors without making USB device stack API unnecessarily complex.
Remove the return type from lock() and unlock() to make it clear that
the functions must not fail.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
There is an issue where OUT data is not handled correctly when the
toatl length exceeds the MPS. This update fixes the control handling
for the OUT endpoint.
Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
The ready bit is automatically cleared by hardware. When setting other
bits, there is a chance that the ready bit hasn't been cleared yet,
leading to unexpected USB transactions. This commit addresses this
isuue and locks irq for critical section to prevent racing condition.
Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
The IT82xx2 chip has three FIFOs shared across endpoint 1 to 15, and
the FIFO control register is configured based on the active endpoints.
However, there are some issues with FIFO control.
Firstly, when a TRANS_DONE interrupt occurs, the completion of the
transaction should be determined by the ready and enable bits of the
corresponding endpoint. Additionally, only one non-control IN endpoint
can access the IN FIFO at a time. The FIFO control register is selected
before writing data and cleared after the IN transaction is completed.
For OUT endpoints, all endpoint bits must be selected in the OUT FIFO
control register when the endpoint is enabled. This can result in fake
OUT tokens being detected if an interrupt is triggered by another FIFO.
To prevent this, an atomic out_fifo_state variable has been introduced
to handle the detection of fake OUT tokens.
Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
Instead, use the helper to get the size field from the MPS value.
MPS value may contain information about additional transaction
per microframe (bits 12..11).
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Add UDC driver for IT82xx2 SoC. This commit passes tests with
1. samples/subsys/usb/cdc_acm/
2. samples/subsys/usb/console/
3. The extend endpoint test with CDC ACM tool
4. USB suspend/resume detection
Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>