From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kpdg7-0007Wk-4Z for barebox@lists.infradead.org; Wed, 16 Dec 2020 20:45:45 +0000 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpdg0-0005TC-CS for barebox@lists.infradead.org; Wed, 16 Dec 2020 21:45:36 +0100 Received: from mgr by dude.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1kpdfz-00027j-Uk for barebox@lists.infradead.org; Wed, 16 Dec 2020 21:45:35 +0100 From: Michael Grzeschik Date: Wed, 16 Dec 2020 21:45:33 +0100 Message-Id: <20201216204534.8054-5-m.grzeschik@pengutronix.de> In-Reply-To: <20201216204534.8054-1-m.grzeschik@pengutronix.de> References: <20201216204534.8054-1-m.grzeschik@pengutronix.de> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 4/5] usb: dwc2: update the dr_mode on set_mode callback To: barebox@lists.infradead.org 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 --- 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@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox