]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.9.30/usb-musb-fix-trying-to-suspend-while-active-for-otg-configurations.patch
Linux 4.14.95
[thirdparty/kernel/stable-queue.git] / releases / 4.9.30 / usb-musb-fix-trying-to-suspend-while-active-for-otg-configurations.patch
1 From 3c50ffef25855a9d9e4b07b02d756a8cdd653069 Mon Sep 17 00:00:00 2001
2 From: Tony Lindgren <tony@atomide.com>
3 Date: Wed, 17 May 2017 11:23:10 -0500
4 Subject: usb: musb: Fix trying to suspend while active for OTG configurations
5
6 From: Tony Lindgren <tony@atomide.com>
7
8 commit 3c50ffef25855a9d9e4b07b02d756a8cdd653069 upstream.
9
10 Commit d8e5f0eca1e8 ("usb: musb: Fix hardirq-safe hardirq-unsafe
11 lock order error") caused a regression where musb keeps trying to
12 enable host mode with no cable connected. This seems to be caused
13 by the fact that now phy is enabled earlier, and we are wrongly
14 trying to force USB host mode on an OTG port. The errors we are
15 getting are "trying to suspend as a_idle while active".
16
17 For ports configured as OTG, we should not need to do anything
18 to try to force USB host mode on it's OTG port. Trying to force host
19 mode in this case just seems to completely confuse the musb state
20 machine.
21
22 Let's fix the issue by making musb_host_setup() attempt to force the
23 mode only if port_mode is configured for host mode.
24
25 Fixes: d8e5f0eca1e8 ("usb: musb: Fix hardirq-safe hardirq-unsafe lock order error")
26 Cc: Johan Hovold <johan@kernel.org>
27 Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
28 Reported-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
29 Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
30 Signed-off-by: Tony Lindgren <tony@atomide.com>
31 Signed-off-by: Bin Liu <b-liu@ti.com>
32 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
33
34 ---
35 drivers/usb/musb/musb_host.c | 9 +++++----
36 1 file changed, 5 insertions(+), 4 deletions(-)
37
38 --- a/drivers/usb/musb/musb_host.c
39 +++ b/drivers/usb/musb/musb_host.c
40 @@ -2780,10 +2780,11 @@ int musb_host_setup(struct musb *musb, i
41 int ret;
42 struct usb_hcd *hcd = musb->hcd;
43
44 - MUSB_HST_MODE(musb);
45 - musb->xceiv->otg->default_a = 1;
46 - musb->xceiv->otg->state = OTG_STATE_A_IDLE;
47 -
48 + if (musb->port_mode == MUSB_PORT_MODE_HOST) {
49 + MUSB_HST_MODE(musb);
50 + musb->xceiv->otg->default_a = 1;
51 + musb->xceiv->otg->state = OTG_STATE_A_IDLE;
52 + }
53 otg_set_host(musb->xceiv->otg, &hcd->self);
54 hcd->self.otg_port = 1;
55 musb->xceiv->otg->host = &hcd->self;