diff mbox series

usb: dwc3-meson-g12a: always configure dr-mode

Message ID 20201214113419.19103-1-m.szyprowski@samsung.com
State Accepted
Commit 5c88b6ad400c42cabd347ad58098b149ede34281
Headers show
Series usb: dwc3-meson-g12a: always configure dr-mode | expand

Commit Message

Marek Szyprowski Dec. 14, 2020, 11:34 a.m. UTC
dwc3_meson_g12a_force_mode() sets the dr-mode of the USB PHY. However
it skips setting the mode if it matches the one done during driver probe
(stored in private structure). This fails if the mode has been changed
to other value and then back to initial one. Fix this by configuring the
dr-mode always, regadless of the one set at the driver probe).

This fixes operation of USB gadget based drivers when they are initialized
for the second time.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

---
 drivers/usb/dwc3/dwc3-meson-g12a.c | 3 ---
 1 file changed, 3 deletions(-)

-- 
2.17.1

Comments

Neil Armstrong Dec. 14, 2020, 6:50 p.m. UTC | #1
Hi,

On 14/12/2020 12:34, Marek Szyprowski wrote:
> dwc3_meson_g12a_force_mode() sets the dr-mode of the USB PHY. However

> it skips setting the mode if it matches the one done during driver probe

> (stored in private structure). This fails if the mode has been changed

> to other value and then back to initial one. Fix this by configuring the

> dr-mode always, regadless of the one set at the driver probe).

> 

> This fixes operation of USB gadget based drivers when they are initialized

> for the second time.

> 

> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

> ---

>  drivers/usb/dwc3/dwc3-meson-g12a.c | 3 ---

>  1 file changed, 3 deletions(-)

> 

> diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c

> index 6567502cdd1..6f0bac2a00c 100644

> --- a/drivers/usb/dwc3/dwc3-meson-g12a.c

> +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c

> @@ -269,9 +269,6 @@ int dwc3_meson_g12a_force_mode(struct udevice *dev, enum usb_dr_mode mode)

>  	if (!priv->phys[USB2_OTG_PHY].dev)

>  		return -EINVAL;

>  

> -	if (mode == priv->otg_mode)

> -		return 0;

> -

>  	if (mode == USB_DR_MODE_HOST)

>  		debug("%s: switching to Host Mode\n", __func__);

>  	else

> 


Thanks,

Acked-by: Neil Armstrong <narmstrong@baylibre.com>


Applied to u-boot-amlogic

Neil
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
index 6567502cdd1..6f0bac2a00c 100644
--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -269,9 +269,6 @@  int dwc3_meson_g12a_force_mode(struct udevice *dev, enum usb_dr_mode mode)
 	if (!priv->phys[USB2_OTG_PHY].dev)
 		return -EINVAL;
 
-	if (mode == priv->otg_mode)
-		return 0;
-
 	if (mode == USB_DR_MODE_HOST)
 		debug("%s: switching to Host Mode\n", __func__);
 	else