dwc3.txt 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. TODO
  2. ~~~~~~
  3. Please pick something while reading :)
  4. - Implement streaming support for BULK endpoints
  5. Tatyana's patch "usb: Add streams support to the gadget framework"
  6. introduces streaming support for the gadget driver.
  7. Every usb_request has new field called stream_id which holds its id.
  8. Every usb_ep has a field num_supported_strms which describes the max
  9. number of streams supported (for this ep).
  10. UAS is AFAIK the only gadget with streaming support.
  11. - Convert interrupt handler to per-ep-thread-irq
  12. As it turns out some DWC3-commands ~1ms to complete. Currently we spin
  13. until the command completes which is bad.
  14. Implementation idea:
  15. - dwc core implements a demultiplexing irq chip for interrupts per
  16. endpoint. The interrupt numbers are allocated during probe and belong
  17. to the device. If MSI provides per-endpoint interrupt this dummy
  18. interrupt chip can be replaced with "real" interrupts.
  19. - interrupts are requested / allocated on usb_ep_enable() and removed on
  20. usb_ep_disable(). Worst case are 32 interrupts, the lower limit is two
  21. for ep0/1.
  22. - dwc3_send_gadget_ep_cmd() will sleep in wait_for_completion_timeout()
  23. until the command completes.
  24. - the interrupt handler is split into the following pieces:
  25. - primary handler of the device
  26. goes through every event and calls generic_handle_irq() for event
  27. it. On return from generic_handle_irq() in acknowledges the event
  28. counter so interrupt goes away (eventually).
  29. - threaded handler of the device
  30. none
  31. - primary handler of the EP-interrupt
  32. reads the event and tries to process it. Everything that requries
  33. sleeping is handed over to the Thread. The event is saved in an
  34. per-endpoint data-structure.
  35. We probably have to pay attention not to process events once we
  36. handed something to thread so we don't process event X prio Y
  37. where X > Y.
  38. - threaded handler of the EP-interrupt
  39. handles the remaining EP work which might sleep such as waiting
  40. for command completion.
  41. Latency:
  42. There should be no increase in latency since the interrupt-thread has a
  43. high priority and will be run before an average task in user land
  44. (except the user changed priorities).