* [PATCH] usb: musb: Check for host-mode using is_host_active() on reset interrupt
@ 2017-09-27 10:35 Jonathan Liu
2017-10-09 16:03 ` Bin Liu
0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Liu @ 2017-09-27 10:35 UTC (permalink / raw)
To: linux-arm-kernel
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 at vger.kernel.org # v4.1+
Signed-off-by: Jonathan Liu <net147@gmail.com>
---
drivers/usb/musb/musb_core.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 029692053dd3..1bce7df3e110 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -906,7 +906,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
*/
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
@@ -916,9 +916,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
* 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));
--
2.13.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] usb: musb: Check for host-mode using is_host_active() on reset interrupt
2017-09-27 10:35 [PATCH] usb: musb: Check for host-mode using is_host_active() on reset interrupt Jonathan Liu
@ 2017-10-09 16:03 ` Bin Liu
0 siblings, 0 replies; 2+ messages in thread
From: Bin Liu @ 2017-10-09 16:03 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On Wed, Sep 27, 2017 at 08:35:22PM +1000, Jonathan Liu wrote:
> 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 at vger.kernel.org # v4.1+
> Signed-off-by: Jonathan Liu <net147@gmail.com>
Applied. Thanks.
-Bin.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-09 16:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-27 10:35 [PATCH] usb: musb: Check for host-mode using is_host_active() on reset interrupt Jonathan Liu
2017-10-09 16:03 ` Bin Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).