dwc3.rst 1.8 KB

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