linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: musb: Support gadget mode when the port is set to dual role
@ 2018-03-28 21:52 Paul Kocialkowski
  2018-03-29  9:23 ` Maxime Ripard
  0 siblings, 1 reply; 26+ messages in thread
From: Paul Kocialkowski @ 2018-03-28 21:52 UTC (permalink / raw)
  To: linux-kernel, linux-usb
  Cc: Greg Kroah-Hartman, Bin Liu, Chen-Yu Tsai, Maxime Ripard,
	Paul Kocialkowski

This allows dual-role ports to be reported as having gadget mode by the
musb_has_gadget helper. This is required to enable MUSB at all with MUSB
glue layers that set the port mode to MUSB_PORT_MODE_DUAL_ROLE at init.

Most notably, this allows calling musb_start when needed in the virtual
MUSB root HUB, regardless of whether the current mode should be gadget
or host.

This fixes USB OTG on Allwinner devices that I could test it with,
mainly A20 devices.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 drivers/usb/musb/musb_virthub.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c
index 5165d2b07ade..8fd5c5f86e82 100644
--- a/drivers/usb/musb/musb_virthub.c
+++ b/drivers/usb/musb/musb_virthub.c
@@ -249,7 +249,8 @@ static int musb_has_gadget(struct musb *musb)
 #ifdef CONFIG_USB_MUSB_HOST
 	return 1;
 #else
-	return musb->port_mode == MUSB_PORT_MODE_HOST;
+	return musb->port_mode == MUSB_PORT_MODE_HOST ||
+	       musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE;
 #endif
 }
 
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2019-03-22 14:04 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-28 21:52 [PATCH] usb: musb: Support gadget mode when the port is set to dual role Paul Kocialkowski
2018-03-29  9:23 ` Maxime Ripard
2018-03-29 11:57   ` Paul Kocialkowski
2018-04-03  9:29     ` Maxime Ripard
2018-04-21 10:51       ` Paul Kocialkowski
2018-04-20 14:25     ` Bin Liu
2018-04-21 10:59       ` Paul Kocialkowski
2018-04-21 14:34         ` Bin Liu
2018-04-30 21:08           ` Paul Kocialkowski
2018-05-01 12:25             ` Bin Liu
2018-05-01 13:26               ` Paul Kocialkowski
2018-05-01 16:22                 ` Bin Liu
2019-03-21 10:02           ` Bin Liu
2019-03-21 13:01           ` Maxime Ripard
2019-03-21 16:41             ` Greg Kroah-Hartman
2019-03-22 12:46               ` Bin Liu
2019-03-22 13:09                 ` Maxime Ripard
2019-03-22 13:28                   ` Bin Liu
2019-03-22 13:34                     ` Paul Kocialkowski
2019-03-22 13:44                       ` Bin Liu
2019-03-22 13:46                     ` Maxime Ripard
2019-03-22 14:04                       ` Bin Liu
2019-03-22 13:10                 ` Paul Kocialkowski
2019-03-22 13:36                   ` Bin Liu
2019-03-22 13:37                     ` Paul Kocialkowski
2019-03-22 13:46                       ` 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).