OSDN Git Service

usb: dwc3: gadget: Check for prepared TRBs
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Fri, 15 May 2020 23:40:46 +0000 (16:40 -0700)
committerFelipe Balbi <balbi@kernel.org>
Mon, 25 May 2020 08:09:44 +0000 (11:09 +0300)
commit63c7bb299fc9c430070c0177f0879635e9ee23d0
tree98f575c10445c788d62f0bad36dfbd49cd677257
parent5d363120aa548ba52d58907a295eee25f8207ed2
usb: dwc3: gadget: Check for prepared TRBs

There are cases where the endpoint needs to be restarted. For example,
it may need to restart for NoStream rejection to reinitiate stream. If
so, check and make sure we don't prepare beyond the current transfer
when we restart the endpoint.

DWC_usb32 internal burst transfer feature will look into TRBs beyond a
transfer. Other controllers will stop on the last TRB, but not
DWC_usb32. This may cause the controller to incorrectly process TRBs of
a different transfer. Make sure to explicitly prevent preparing TRBs of
a different transfer.

This should only affect DWC_usb32 releases prior to v1.00a since it
doesn't use SET_ENDPOINT_PRIME to reinitiate stream. However, it's
better to be cautious in case users don't want to use SET_ENDPOINT_PRIME
command. Also, it's possible other controller IPs may share the same
features as DWC_usb32 in new releases.

Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/dwc3/gadget.c