From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/4] usb: ci_udc: complete ep0 direction handling
Date: Sun, 1 Jun 2014 19:22:45 +0200 [thread overview]
Message-ID: <201406011922.45126.marex@denx.de> (raw)
In-Reply-To: <1401396783-21873-4-git-send-email-swarren@wwwdotorg.org>
On Thursday, May 29, 2014 at 10:53:03 PM, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> 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 | 48
> ++++++++++++++++++++++++++++++++++++++------- drivers/usb/gadget/ci_udc.h
> | 1 +
> 2 files changed, 42 insertions(+), 7 deletions(-)
Applied all, thanks.
btw. we should weed out those DBG() macros and replace them with regular debug()
or debug_cond().
Best regards,
Marek Vasut
next prev parent reply other threads:[~2014-06-01 17:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-29 20:53 [U-Boot] [PATCH 1/4] usb: ci_udc: detect queued requests on ep0 Stephen Warren
2014-05-29 20:53 ` [U-Boot] [PATCH 2/4] usb: ci_udc: use a single descriptor for ep0 Stephen Warren
2014-05-29 20:53 ` [U-Boot] [PATCH 3/4] usb: ci_udc: pre-allocate ep0 req Stephen Warren
2014-05-29 20:53 ` [U-Boot] [PATCH 4/4] usb: ci_udc: complete ep0 direction handling Stephen Warren
2014-06-01 17:22 ` Marek Vasut [this message]
2014-06-10 15:58 ` Stephen Warren
2014-06-10 18:49 ` Marek Vasut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201406011922.45126.marex@denx.de \
--to=marex@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox