[U-Boot] [PATCH] usb: dwc2_udc_otg: Add gotgctl customization

Marek Vasut marex at denx.de
Fri Mar 16 16:28:14 UTC 2018


On 03/16/2018 01:27 PM, Patrice Chotard wrote:
> Allow passing in a custom configuration of the gotgctl
> register via platform data.
> This allows for example to override the A/B session valid signals
> by setting AvalidOvEn / AvalidOvVal and BvalidOvEn / BvalidOvVal
> bits in GOTGCTL reg.

If you need to override those, doesn't it mean the device is broken?

btw can we start moving this to DT instead ?

> Signed-off-by: Patrice Chotard <patrice.chotard at st.com>
> ---
> 
>  drivers/usb/gadget/dwc2_udc_otg.c | 3 +++
>  include/usb/dwc2_udc.h            | 1 +
>  2 files changed, 4 insertions(+)
> 
> diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c
> index 088811c19136..c6c2edf7affa 100644
> --- a/drivers/usb/gadget/dwc2_udc_otg.c
> +++ b/drivers/usb/gadget/dwc2_udc_otg.c
> @@ -426,6 +426,9 @@ static void reconfig_usbd(struct dwc2_udc *dev)
>  
>  	writel(dflt_gusbcfg, &reg->gusbcfg);
>  
> +	if (dev->pdata->usb_gotgctl)
> +		writel(dev->pdata->usb_gotgctl, &reg->gotgctl);
> +
>  	/* 3. Put the OTG device core in the disconnected state.*/
>  	uTemp = readl(&reg->dctl);
>  	uTemp |= SOFT_DISCONNECT;
> diff --git a/include/usb/dwc2_udc.h b/include/usb/dwc2_udc.h
> index 1a370e0e86b5..36ab78dfb7e8 100644
> --- a/include/usb/dwc2_udc.h
> +++ b/include/usb/dwc2_udc.h
> @@ -20,6 +20,7 @@ struct dwc2_plat_otg_data {
>  	unsigned int    usb_phy_ctrl;
>  	unsigned int    usb_flags;
>  	unsigned int	usb_gusbcfg;
> +	unsigned int	usb_gotgctl;
>  	unsigned int	rx_fifo_sz;
>  	unsigned int	np_tx_fifo_sz;
>  	unsigned int	tx_fifo_sz;
> 


-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list