mbox series

[v7,00/10] usb: dwc3: Fix broken BULK stream support to dwc3 gadget driver

Message ID 1543662811-5194-1-git-send-email-anurag.kumar.vulisha@xilinx.com (mailing list archive)
Headers show
Series usb: dwc3: Fix broken BULK stream support to dwc3 gadget driver | expand

Message

Anurag Kumar Vulisha Dec. 1, 2018, 11:13 a.m. UTC
This patch series fixes the broken BULK streaming support in
dwc3 gadget driver and also adds timers in udc/core.c  for
the endpoints which may go out of sync with host and enter into
deadlock. For example when bulk streams are enabled for an
endpoint, there can be a condition where the gadget controller
waits for the host to issue prime transaction and the host
controller waits for the gadget to issue ERDY. This condition
could create a deadlock. To avoid such potential deadlocks, a
timer is started after queuing any request for the endpoint in
usb_ep_queue(). The gadget driver is expected to stop the timer
if a valid event is found (ex: stream event for stream capable
endpoints). If no valid event is found, the timer expires after
the programmed timeout value and a timeout callback function
registered would be called. This callback function dequeues the
request and re-queues it again, doing so makes the controller
restart the transfer, thus avoiding deadlocks.
 
This kind of behaviour is observed in dwc3 controller and expected
to be generic issue with other controllers supporting bulk streams.


Changes in v7:
	1. Added timer timeout handler into udc/core.c
	2. Started timer per request instead of per endpoint as suggested by
	   "Felipe Balbi"
	3. Added usb_ep_dequeue() & usb_ep_queue() logic into timeout handler
	   as suggested by "Felipe Balbi"

Changes in v6:
	1. Added timer into udc/core.c for stream capable endpoint
	   as suggested by "Felipe Balbi"

Changes in v5:
	1. Removed the dev_dbg prints as suggested bt "Thinh Nguyen"

Changes in v4:
	1. Corrected the commit message and stream timeout description
	   as suggested by "Thinh Nguyen"

Changes in v3:
	1. Added the changes suggested by "Thinh Nguyen"

Changes in v2:
	1. Added "usb: dwc3:" in subject heading

Anurag Kumar Vulisha (10):
  usb: gadget: udc: Add timer support for usb requests
  usb: gadget: function: tcm: Add timeout for stream capable endpoints
  usb: dwc3: gadget: handle stream events
  usb: dwc3: update stream id in depcmd
  usb: dwc3: make controller clear transfer resources after complete
  usb: dwc3: don't issue no-op trb for stream capable endpoints
  usb: dwc3: check for requests in started list for stream capable
    endpoints
  usb: dwc3: Correct the logic for checking TRB full in
    __dwc3_prepare_one_trb()
  usb: dwc3: Check for IOC/LST bit in both event->status and TRB->ctrl
    fields
  usb: dwc3: Check MISSED ISOC bit only for ISOC endpoints

 drivers/usb/dwc3/gadget.c           |  67 +++++++++++++++++---
 drivers/usb/gadget/function/f_tcm.c |  25 +++++---
 drivers/usb/gadget/udc/core.c       | 119 +++++++++++++++++++++++++++++++-----
 include/linux/usb/gadget.h          |  15 +++++
 4 files changed, 197 insertions(+), 29 deletions(-)