Skip to content

Commit aa62936

Browse files
net147gregkh
authored andcommitted
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>
1 parent 583a421 commit aa62936

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/usb/musb/musb_core.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
877877
*/
878878
if (int_usb & MUSB_INTR_RESET) {
879879
handled = IRQ_HANDLED;
880-
if (devctl & MUSB_DEVCTL_HM) {
880+
if (is_host_active(musb)) {
881881
/*
882882
* When BABBLE happens what we can depends on which
883883
* platform MUSB is running, because some platforms
@@ -887,9 +887,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
887887
* drop the session.
888888
*/
889889
dev_err(musb->controller, "Babble\n");
890-
891-
if (is_host_active(musb))
892-
musb_recover_from_babble(musb);
890+
musb_recover_from_babble(musb);
893891
} else {
894892
dev_dbg(musb->controller, "BUS RESET as %s\n",
895893
usb_otg_state_string(musb->xceiv->otg->state));

0 commit comments

Comments
 (0)