mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-07 18:40:10 +00:00
usb: musb: dsps: fix otg state machine
[ Upstream commit 6010abf2c2 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
816a263d09
commit
558321c9b7
@@ -227,8 +227,13 @@ static int dsps_check_status(struct musb *musb, void *unused)
|
|||||||
|
|
||||||
switch (musb->xceiv->otg->state) {
|
switch (musb->xceiv->otg->state) {
|
||||||
case OTG_STATE_A_WAIT_VRISE:
|
case OTG_STATE_A_WAIT_VRISE:
|
||||||
|
if (musb->port_mode == MUSB_HOST) {
|
||||||
|
musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON;
|
||||||
dsps_mod_timer_optional(glue);
|
dsps_mod_timer_optional(glue);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
/* fall through */
|
||||||
|
|
||||||
case OTG_STATE_A_WAIT_BCON:
|
case OTG_STATE_A_WAIT_BCON:
|
||||||
/* keep VBUS on for host-only mode */
|
/* keep VBUS on for host-only mode */
|
||||||
if (musb->port_mode == MUSB_HOST) {
|
if (musb->port_mode == MUSB_HOST) {
|
||||||
|
|||||||
Reference in New Issue
Block a user