usb: dwc3: gadget: Default mode for DRD
Subsystems (2)
Thinh Nguyen
maintainercover usb: dwc3: gadget: Default mode for DRD
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(-)
Signature · 1 line
2.11.0
Thinh Nguyen
maintainerPATCH 1/2 usb: dwc3: drd: Don't free non-existing irq
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 <[email protected]>
--- drivers/usb/dwc3/drd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/drd.c +1 -1
@@ -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); }
Signature · 1 line
2.11.0
Thinh Nguyen
maintainerPATCH 2/2 usb: dwc3: core: Use role-switch default dr_mode
In reply to Thinh NguyenIf the driver is configured to use DRD role-switch, let the drd code path decide the default dr_mode.
Signed-off-by Thinh Nguyen <[email protected]>
--- drivers/usb/dwc3/core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/dwc3/core.c +2 -0
@@ -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 ; }
Signature · 1 line
2.11.0