usb: dwc_otg_310: pcd: fix isoc in ep transfer issue
authorWilliam Wu <wulf@rock-chips.com>
Wed, 15 Mar 2017 02:15:24 +0000 (10:15 +0800)
committerWilliam Wu <wulf@rock-chips.com>
Wed, 15 Mar 2017 03:07:52 +0000 (11:07 +0800)
commitd3e500796dd16111a3df6bc7b530acffed6b135d
tree77602bd12f14c5365988af888f4b07e8c64570a6
parent51a9f0660f49a4b589d8ad424c1e96f6276b6114
usb: dwc_otg_310: pcd: fix isoc in ep transfer issue

When test usb gadget uvc function, we find a isoc in
ep transfer bug that will cause uvc data transfer fail.
The error case is:

1. The current EP request is done, call complete_ep()
to completes the request, and then call start_next_request()
to check the EP request queue, in this error case, the
queue is empty, so it doesn't start next request, just
set ep frame_num to 0xFFFFFFFF.

2. NAK Interrutp is triggered, check isoc ep frame_num
is 0xFFFFFFFF, then reset the frame_num to 0, and then
call start_next_request() to check the EP request queue,
in this error case, the queue is still empty, so set ep
frame_num to 0xFFFFFFFF again.

But afer the above operation, the current code will
modify the ep frame_num in NAK Interrutp handler by
add ep bInterval to frame_num, this cause frame_num
change again, but not keep in 0xFFFFFFFF, so the next
NAK Interrutp handler doesn't start next request any
more.

This patch reset the frame_num to the current frame
number got from DSTS SOFFN register if detect the
frame_num is 0xFFFFFFFF in NAK Interrutp handler.
And modify the frame_num in NAK Interrutp handler
only when the frame_num is not 0xFFFFFFFF.

TEST=Set usb gadget as webcam, use Ubuntu Guvcview
to preview the webcam, observe the preview screen
and the error log "There are no more ISOC requests".

Change-Id: I4403a67b1d5d257d092a2a71d5666c5d6fd5af3c
Signed-off-by: William Wu <wulf@rock-chips.com>
drivers/usb/dwc_otg_310/dwc_otg_pcd_intr.c