]> git.kernelconcepts.de Git - karo-tx-uboot.git/commit
usb: ci_udc: complete ep0 direction handling
authorStephen Warren <swarren@nvidia.com>
Thu, 29 May 2014 20:53:03 +0000 (14:53 -0600)
committerMarek Vasut <marex@denx.de>
Sun, 1 Jun 2014 17:22:40 +0000 (19:22 +0200)
commit006c7026882011ba49c9a39d27c4aff3ace07847
tree593719e6f12ae0073bb67cb844ac85ed76b481e8
parenta2d8f929857b7bc50528114c29e48a99cbcee1f1
usb: ci_udc: complete ep0 direction handling

handle_setup() currently assumes that the response to a Setup transaction
will be an OUT transaction, and any subsequent packet (if any) will be an
IN transaction. This appears to be valid in many cases; both USB
enumeration and Mass Storage work OK with this restriction. However, DFU
uses ep0 to transfer data in both directions. This renders the assumption
invalid; when sending data from device to host, the Data Stage is an IN
transaction, and the Status Stage is an OUT transaction. Enhance
handle_setup() to deduce the correct direction for the USB transactions
based on Setup transaction data.

ep0's request object only needs to be automatically re-queued when the
Data Stage completes, in order to implement the Status Stage. Once the
Status Stage transaction is complete, there is no need to re-queue the
USB request, so don't do that.

Don't sent USB request completion callbacks for Status Stage transactions.
These were queued by ci_udc itself, and only serve to confuse the USB
function code. For example, f_dfu attempts to interpret the 0-length data
buffers for Status Stage transactions as DFU packets. These buffers
contain stale data from the previous transaction. This causes f_dfu to
complain about a sequence number mismatch.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
drivers/usb/gadget/ci_udc.c
drivers/usb/gadget/ci_udc.h