aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2017-05-17 12:23:10 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-05-25 09:44:40 -0400
commitdbb127332abf38e6df266b9cabee7d73ef6ea6da (patch)
tree623162621f9261868fe03070618a15d6d6426129
parent08c735a15d5b420879cd096b6c417837e1dbe8fa (diff)
usb: musb: Fix trying to suspend while active for OTG configurations
commit 3c50ffef25855a9d9e4b07b02d756a8cdd653069 upstream. Commit d8e5f0eca1e8 ("usb: musb: Fix hardirq-safe hardirq-unsafe lock order error") caused a regression where musb keeps trying to enable host mode with no cable connected. This seems to be caused by the fact that now phy is enabled earlier, and we are wrongly trying to force USB host mode on an OTG port. The errors we are getting are "trying to suspend as a_idle while active". For ports configured as OTG, we should not need to do anything to try to force USB host mode on it's OTG port. Trying to force host mode in this case just seems to completely confuse the musb state machine. Let's fix the issue by making musb_host_setup() attempt to force the mode only if port_mode is configured for host mode. Fixes: d8e5f0eca1e8 ("usb: musb: Fix hardirq-safe hardirq-unsafe lock order error") Cc: Johan Hovold <johan@kernel.org> Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reported-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.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_host.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 806451418cfe..99beda9e241d 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -2780,10 +2780,11 @@ int musb_host_setup(struct musb *musb, int power_budget)
2780 int ret; 2780 int ret;
2781 struct usb_hcd *hcd = musb->hcd; 2781 struct usb_hcd *hcd = musb->hcd;
2782 2782
2783 MUSB_HST_MODE(musb); 2783 if (musb->port_mode == MUSB_PORT_MODE_HOST) {
2784 musb->xceiv->otg->default_a = 1; 2784 MUSB_HST_MODE(musb);
2785 musb->xceiv->otg->state = OTG_STATE_A_IDLE; 2785 musb->xceiv->otg->default_a = 1;
2786 2786 musb->xceiv->otg->state = OTG_STATE_A_IDLE;
2787 }
2787 otg_set_host(musb->xceiv->otg, &hcd->self); 2788 otg_set_host(musb->xceiv->otg, &hcd->self);
2788 hcd->self.otg_port = 1; 2789 hcd->self.otg_port = 1;
2789 musb->xceiv->otg->host = &hcd->self; 2790 musb->xceiv->otg->host = &hcd->self;