diff options
author | Jonathan Liu <net147@gmail.com> | 2017-10-09 22:46:12 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-27 10:38:06 +0200 |
commit | 6f4a36f0ec7d46a7a72edcab838cdcd65eacfa0f (patch) | |
tree | b3fca291e10797ddd825f29919e5cc517b0ef52d /drivers/usb | |
parent | b4ecc15d6f5a13c0bbe2777438e87e321f83faaa (diff) | |
download | linux-stable-6f4a36f0ec7d46a7a72edcab838cdcd65eacfa0f.tar.gz linux-stable-6f4a36f0ec7d46a7a72edcab838cdcd65eacfa0f.tar.bz2 linux-stable-6f4a36f0ec7d46a7a72edcab838cdcd65eacfa0f.zip |
usb: musb: Check for host-mode using is_host_active() on reset interrupt
commit 445ef61543da3db5b699f87fb0aa4f227165f6ed upstream.
The sunxi musb has a bug where sometimes it will generate a babble
error on device disconnect instead of a disconnect IRQ. When this
happens the musb controller switches from host mode to device mode
(it clears MUSB_DEVCTL_HM/MUSB_DEVCTL_SESSION and sets
MUSB_DEVCTL_BDEVICE) and gets stuck in this state.
The babble error is misdetected as a bus reset because MUSB_DEVCTL_HM
was cleared.
To fix this, use is_host_active() rather than (devctl & MUSB_DEVCTL_HM)
to detect babble error so that sunxi musb babble recovery can handle it
by restoring the mode. This information is provided by the driver logic
and does not rely on register contents.
Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/musb/musb_core.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index a6b6b1cf1317..aac28d998073 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -890,7 +890,7 @@ b_host: */ if (int_usb & MUSB_INTR_RESET) { handled = IRQ_HANDLED; - if (devctl & MUSB_DEVCTL_HM) { + if (is_host_active(musb)) { /* * When BABBLE happens what we can depends on which * platform MUSB is running, because some platforms @@ -900,9 +900,7 @@ b_host: * drop the session. */ dev_err(musb->controller, "Babble\n"); - - if (is_host_active(musb)) - musb_recover_from_babble(musb); + musb_recover_from_babble(musb); } else { musb_dbg(musb, "BUS RESET as %s", usb_otg_state_string(musb->xceiv->otg->state)); |