Last active
May 13, 2017 23:38
-
-
Save lategoodbye/5e842f22c1f5a94fde24b466569a7d10 to your computer and use it in GitHub Desktop.
usb: dwc2: platform: Swap mode init order
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 157045fd728964f9c864863f70f5cb0e6e0ee8d8 Mon Sep 17 00:00:00 2001 | |
From: Stefan Wahren <stefan.wahren@i2se.com> | |
Date: Sat, 13 May 2017 23:23:53 +0000 | |
Subject: [PATCH] usb: dwc2: platform: Swap mode init order | |
Before this change there could be gadget enumeration issues in | |
dual mode. These might be caused by runtime issues between the gadget | |
and the hcd init. So swap the order to avoid this. | |
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> | |
--- | |
drivers/usb/dwc2/platform.c | 14 +++++++------- | |
1 file changed, 7 insertions(+), 7 deletions(-) | |
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c | |
index 9564bc7..d317b2b 100644 | |
--- a/drivers/usb/dwc2/platform.c | |
+++ b/drivers/usb/dwc2/platform.c | |
@@ -437,21 +437,21 @@ static int dwc2_driver_probe(struct platform_device *dev) | |
if (retval) | |
goto error; | |
- if (hsotg->dr_mode != USB_DR_MODE_HOST) { | |
- retval = dwc2_gadget_init(hsotg, hsotg->irq); | |
+ if (hsotg->dr_mode != USB_DR_MODE_PERIPHERAL) { | |
+ retval = dwc2_hcd_init(hsotg); | |
if (retval) | |
goto error; | |
- hsotg->gadget_enabled = 1; | |
+ hsotg->hcd_enabled = 1; | |
} | |
- if (hsotg->dr_mode != USB_DR_MODE_PERIPHERAL) { | |
- retval = dwc2_hcd_init(hsotg); | |
+ if (hsotg->dr_mode != USB_DR_MODE_HOST) { | |
+ retval = dwc2_gadget_init(hsotg, hsotg->irq); | |
if (retval) { | |
- if (hsotg->gadget_enabled) | |
+ if (hsotg->hcd_enabled) | |
dwc2_hsotg_remove(hsotg); | |
goto error; | |
} | |
- hsotg->hcd_enabled = 1; | |
+ hsotg->gadget_enabled = 1; | |
} | |
platform_set_drvdata(dev, hsotg); | |
-- | |
1.7.9.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment