[U-Boot] [PATCH v2 3/3] usb: dwc2: allow peripheral mode for OTG configuration

Marek Vasut marex at denx.de
Tue Jun 18 16:46:24 UTC 2019


On 6/18/19 4:57 PM, Patrick Delaunay wrote:
> Allow device mode in DWC2 driver when device tree select the dr_mode
> "peripheral" or "otg".
> 
> The device mode is not allowed when dr_mode = "host" in device tree.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>

Reviewed-by: Marek Vasut <marex at denx.de>

> ---
> 
> Changes in v2: None
> 
>  drivers/usb/gadget/dwc2_udc_otg.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c
> index 023439c..35f4147 100644
> --- a/drivers/usb/gadget/dwc2_udc_otg.c
> +++ b/drivers/usb/gadget/dwc2_udc_otg.c
> @@ -1041,7 +1041,8 @@ static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev)
>  	void (*set_params)(struct dwc2_plat_otg_data *data);
>  	int ret;
>  
> -	if (usb_get_dr_mode(node) != USB_DR_MODE_PERIPHERAL) {
> +	if (usb_get_dr_mode(node) != USB_DR_MODE_PERIPHERAL &&
> +	    usb_get_dr_mode(node) != USB_DR_MODE_OTG) {
>  		dev_dbg(dev, "Invalid mode\n");
>  		return -ENODEV;
>  	}
> 


-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list