[PATCH 4/5] usb: dwc2: update the dr_mode on set_mode callback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The dwc2 dr_mode can be configured with otg.mode in otg mode. Currently
the mode will not be set with the users decision. This patch fixes this
by overwriting the mode with the one set by set_mode callback.

Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>
---
 drivers/usb/dwc2/dwc2.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/dwc2/dwc2.c b/drivers/usb/dwc2/dwc2.c
index 6f5127fc3b..65b92b542e 100644
--- a/drivers/usb/dwc2/dwc2.c
+++ b/drivers/usb/dwc2/dwc2.c
@@ -20,6 +20,9 @@ static int dwc2_set_mode(void *ctx, enum usb_dr_mode mode)
 {
 	struct dwc2 *dwc2 = ctx;
 	int ret = -ENODEV;
+	int oldmode = dwc2->dr_mode;
+
+	dwc2->dr_mode = mode;
 
 	if (mode == USB_DR_MODE_HOST || mode == USB_DR_MODE_OTG) {
 		if (IS_ENABLED(CONFIG_USB_DWC2_HOST))
@@ -34,6 +37,9 @@ static int dwc2_set_mode(void *ctx, enum usb_dr_mode mode)
 			dwc2_err(dwc2, "Peripheral support not available\n");
 	}
 
+	if (ret)
+		dwc2->dr_mode = oldmode;
+
 	return ret;
 }
 
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux