usb: musb: omap2430: Fix flakeyness enumerating when connected to a lapdock
diff mbox series

Message ID 20190828151100.31996-1-tony@atomide.com
State New
Headers show
Series
  • usb: musb: omap2430: Fix flakeyness enumerating when connected to a lapdock
Related show

Commit Message

Tony Lindgren Aug. 28, 2019, 3:11 p.m. UTC
With commit 594632efbb9a ("usb: musb: Adding musb support for OMAP4430")
we were supposed to call otg_set_vbus() only if enabling session for a
A-device fails. But the conditional test was always true and at some point
commit 10770c5aa0fe ("usb: musb: omap2430.c delete unused variable.")
removed the check.

Looks like always calling otg_set_vbus() causes flakeyness enumerating when
droid4 is connected to a lapdock. In this case lapdock runs in USB carkit
type mode and feeds the VBUS.

Let's fix the issue by adding a flag to call otg_set_vbus() conditionally
only if A-device session fails that probably was the intention originally.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/usb/musb/omap2430.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Tony Lindgren Aug. 29, 2019, 1:14 p.m. UTC | #1
* Tony Lindgren <tony@atomide.com> [190828 08:11]:
> With commit 594632efbb9a ("usb: musb: Adding musb support for OMAP4430")
> Looks like always calling otg_set_vbus() causes flakeyness enumerating when
> droid4 is connected to a lapdock. In this case lapdock runs in USB carkit
> type mode and feeds the VBUS.

I don't think this patch helps much actually, let's forget it for now.

Looks like the core reason for flakeyness enumerating devices is that
clocks are not idling on disconnect properly, and then the next
enumeration will fail. I'll debug more and will send a better patch
at some point.

Regards,

Tony

Patch
diff mbox series

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -52,6 +52,7 @@  static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
 
 	if (is_on) {
 		if (musb->xceiv->otg->state == OTG_STATE_A_IDLE) {
+			bool need_otg_set_vbus = true;
 			int loops = 100;
 			/* start the session */
 			devctl |= MUSB_DEVCTL_SESSION;
@@ -72,9 +73,13 @@  static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
 					"configured as A device timeout");
 					break;
 				}
+
+				/* Session enabled as A-device, we have VBUS */
+				need_otg_set_vbus = false;
 			}
 
-			otg_set_vbus(otg, 1);
+			if (need_otg_set_vbus)
+				otg_set_vbus(otg, 1);
 		} else {
 			musb->is_active = 1;
 			musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;