Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c8ba6a8b authored by Jack Pham's avatar Jack Pham
Browse files

usb: dwc3: Disable ep0 and interrupts when clearing run/stop



In dwc3_gadget_run_stop() when clearing the run/stop bit, ensure
that IRQs are masked and the ep0 in and out endpoints are disabled.
In case pullups are removed while a control transfer is in progress,
this makes sure that the control endpoints are properly cleaned up.
If and when run/stop is set again, the function already re-enables
the IRQ and ep0 when calling dwc3_gadget_restart(). While at it,
memset() the event buffers to clear stale contents when
reinitializing them in dwc3_event_buffers_setup().

Also, since calling dwc3_gadget_disable_irq() only masks the
interrupts at the controller layer, it might not catch instances
where an IRQ itself may have already been asserted but does not
arrive at the handler until after the pullups are removed. Add a
check to dwc3_interrupt() to catch this case as well.

Change-Id: Ie58979fe4b229240231760652189338ec5343a2d
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 8ca03863
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment