Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: musb: dsps: fix otg state machine

Due to lack of ID pin interrupt event on AM335x devices, the musb dsps
driver uses polling to detect usb device attach for dual-role port.

But in the case if a micro-A cable adapter is attached without a USB device
attached to the cable, the musb state machine gets stuck in a_wait_vrise
state waiting for the MUSB_CONNECT interrupt which won't happen due to the
usb device is not attached. The state is stuck in a_wait_vrise even after
the micro-A cable is detached, which could cause VBUS retention if then the
dual-role port is attached to a host port.

To fix the problem, make a_wait_vrise as a transient state, then move the
state to either a_wait_bcon for host port or a_idle state for dual-role
port, if no usb device is attached to the port.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Bin Liu and committed by
Greg Kroah-Hartman
6010abf2 1d6e81a2

+7 -2
+7 -2
drivers/usb/musb/musb_dsps.c
··· 227 227 228 228 switch (musb->xceiv->otg->state) { 229 229 case OTG_STATE_A_WAIT_VRISE: 230 - dsps_mod_timer_optional(glue); 231 - break; 230 + if (musb->port_mode == MUSB_HOST) { 231 + musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON; 232 + dsps_mod_timer_optional(glue); 233 + break; 234 + } 235 + /* fall through */ 236 + 232 237 case OTG_STATE_A_WAIT_BCON: 233 238 /* keep VBUS on for host-only mode */ 234 239 if (musb->port_mode == MUSB_HOST) {