linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] usb: dwc3: gadget: Default mode for DRD
@ 2020-03-30  0:09 Thinh Nguyen
  2020-03-30  0:09 ` [PATCH 1/2] usb: dwc3: drd: Don't free non-existing irq Thinh Nguyen
  2020-03-30  0:10 ` [PATCH 2/2] usb: dwc3: core: Use role-switch default dr_mode Thinh Nguyen
  0 siblings, 2 replies; 3+ messages in thread
From: Thinh Nguyen @ 2020-03-30  0:09 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, Thinh Nguyen, linux-usb; +Cc: John Youn

DWC3 just learned to use the DRD role-switch API. If the driver is configured
to use it, then delegate its default mode selection to the drd role-switch
code-path. Also, make sure not to free non-existing OTG irq.




Thinh Nguyen (2):
  usb: dwc3: drd: Don't free non-existing irq
  usb: dwc3: core: Use role-switch default dr_mode

 drivers/usb/dwc3/core.c | 2 ++
 drivers/usb/dwc3/drd.c  | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

-- 
2.11.0


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

* [PATCH 1/2] usb: dwc3: drd: Don't free non-existing irq
  2020-03-30  0:09 [PATCH 0/2] usb: dwc3: gadget: Default mode for DRD Thinh Nguyen
@ 2020-03-30  0:09 ` Thinh Nguyen
  2020-03-30  0:10 ` [PATCH 2/2] usb: dwc3: core: Use role-switch default dr_mode Thinh Nguyen
  1 sibling, 0 replies; 3+ messages in thread
From: Thinh Nguyen @ 2020-03-30  0:09 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, Thinh Nguyen, linux-usb; +Cc: John Youn

If the driver is configured to use DRD role-switch, it's not OTG. There
won't be OTG irq to free. Check for dwc->otg_irq before freeing it.

Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
---
 drivers/usb/dwc3/drd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
index db68d48c2267..e6ec01972029 100644
--- a/drivers/usb/dwc3/drd.c
+++ b/drivers/usb/dwc3/drd.c
@@ -651,6 +651,6 @@ void dwc3_drd_exit(struct dwc3 *dwc)
 		break;
 	}
 
-	if (!dwc->edev)
+	if (dwc->otg_irq)
 		free_irq(dwc->otg_irq, dwc);
 }
-- 
2.11.0


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

* [PATCH 2/2] usb: dwc3: core: Use role-switch default dr_mode
  2020-03-30  0:09 [PATCH 0/2] usb: dwc3: gadget: Default mode for DRD Thinh Nguyen
  2020-03-30  0:09 ` [PATCH 1/2] usb: dwc3: drd: Don't free non-existing irq Thinh Nguyen
@ 2020-03-30  0:10 ` Thinh Nguyen
  1 sibling, 0 replies; 3+ messages in thread
From: Thinh Nguyen @ 2020-03-30  0:10 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, Thinh Nguyen, linux-usb; +Cc: John Youn

If the driver is configured to use DRD role-switch, let the drd code
path decide the default dr_mode.

Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
---
 drivers/usb/dwc3/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 7046c681fece..ab6323b8e323 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -85,6 +85,8 @@ static int dwc3_get_dr_mode(struct dwc3 *dwc)
 		 * specified or set to OTG, then set the mode to peripheral.
 		 */
 		if (mode == USB_DR_MODE_OTG &&
+		    (!IS_ENABLED(CONFIG_USB_ROLE_SWITCH) ||
+		     !device_property_read_bool(dwc->dev, "usb-role-switch")) &&
 		    dwc->revision >= DWC3_REVISION_330A)
 			mode = USB_DR_MODE_PERIPHERAL;
 	}
-- 
2.11.0


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

end of thread, other threads:[~2020-03-30  0:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-30  0:09 [PATCH 0/2] usb: dwc3: gadget: Default mode for DRD Thinh Nguyen
2020-03-30  0:09 ` [PATCH 1/2] usb: dwc3: drd: Don't free non-existing irq Thinh Nguyen
2020-03-30  0:10 ` [PATCH 2/2] usb: dwc3: core: Use role-switch default dr_mode Thinh Nguyen

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).