aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Liu <net147@gmail.com>2017-10-09 23:46:12 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-10-17 05:42:51 -0400
commit445ef61543da3db5b699f87fb0aa4f227165f6ed (patch)
tree93f4be5cffce42290d107b908e2bf6b9f2ceeaed
parent297d7fe9e439473800ab1f2f853b4b5f8c888500 (diff)
usb: musb: Check for host-mode using is_host_active() on reset interrupt
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. Cc: stable@vger.kernel.org # v4.1+ 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>
-rw-r--r--drivers/usb/musb/musb_core.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 1ced3af75b05..ff5a1a8989d5 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -906,7 +906,7 @@ b_host:
906 */ 906 */
907 if (int_usb & MUSB_INTR_RESET) { 907 if (int_usb & MUSB_INTR_RESET) {
908 handled = IRQ_HANDLED; 908 handled = IRQ_HANDLED;
909 if (devctl & MUSB_DEVCTL_HM) { 909 if (is_host_active(musb)) {
910 /* 910 /*
911 * When BABBLE happens what we can depends on which 911 * When BABBLE happens what we can depends on which
912 * platform MUSB is running, because some platforms 912 * platform MUSB is running, because some platforms
@@ -916,9 +916,7 @@ b_host:
916 * drop the session. 916 * drop the session.
917 */ 917 */
918 dev_err(musb->controller, "Babble\n"); 918 dev_err(musb->controller, "Babble\n");
919 919 musb_recover_from_babble(musb);
920 if (is_host_active(musb))
921 musb_recover_from_babble(musb);
922 } else { 920 } else {
923 musb_dbg(musb, "BUS RESET as %s", 921 musb_dbg(musb, "BUS RESET as %s",
924 usb_otg_state_string(musb->xceiv->otg->state)); 922 usb_otg_state_string(musb->xceiv->otg->state));