usb: dwc3:Handle race between composition switch and cable disconnect
The current implementation of handling run/~stop of DCTL based
on state of VBUS or the pullup call from the udc core can
result in a below race condition where the run/~stop is cleared
twice leading to an invalid state of controller.
Thread -1 Thread-2
vbus_session (1)
spin_lock
no run_stop(1) call pullup(1)
spin_unlock softconnect = 1
vbus_active checked
vbus_session (0)
spin_lock
run_stop(0) called
spin_unlock
Prevent this by ensuring a proper state transitions and clear
run/~stop only when when there is a transition from ACTIVE
and there is an pullup(0) event or vbus_session(0) call.
Change-Id: I03c4acfc2c6697e02c510d079c7d48d9a82bb322
Signed-off-by:
Sriharsha Allenki <sallenki@codeaurora.org>
Loading
Please register or sign in to comment