0001 ===========
0002 DWC3 driver
0003 ===========
0004
0005
0006 TODO
0007 ~~~~
0008
0009 Please pick something while reading :)
0010
0011 - Convert interrupt handler to per-ep-thread-irq
0012
0013 As it turns out some DWC3-commands ~1ms to complete. Currently we spin
0014 until the command completes which is bad.
0015
0016 Implementation idea:
0017
0018 - dwc core implements a demultiplexing irq chip for interrupts per
0019 endpoint. The interrupt numbers are allocated during probe and belong
0020 to the device. If MSI provides per-endpoint interrupt this dummy
0021 interrupt chip can be replaced with "real" interrupts.
0022 - interrupts are requested / allocated on usb_ep_enable() and removed on
0023 usb_ep_disable(). Worst case are 32 interrupts, the lower limit is two
0024 for ep0/1.
0025 - dwc3_send_gadget_ep_cmd() will sleep in wait_for_completion_timeout()
0026 until the command completes.
0027 - the interrupt handler is split into the following pieces:
0028
0029 - primary handler of the device
0030 goes through every event and calls generic_handle_irq() for event
0031 it. On return from generic_handle_irq() in acknowledges the event
0032 counter so interrupt goes away (eventually).
0033
0034 - threaded handler of the device
0035 none
0036
0037 - primary handler of the EP-interrupt
0038 reads the event and tries to process it. Everything that requires
0039 sleeping is handed over to the Thread. The event is saved in an
0040 per-endpoint data-structure.
0041 We probably have to pay attention not to process events once we
0042 handed something to thread so we don't process event X prio Y
0043 where X > Y.
0044
0045 - threaded handler of the EP-interrupt
0046 handles the remaining EP work which might sleep such as waiting
0047 for command completion.
0048
0049 Latency:
0050
0051 There should be no increase in latency since the interrupt-thread has a
0052 high priority and will be run before an average task in user land
0053 (except the user changed priorities).