dwc3.txt 1.8 KB

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