[PATCH v2] usb: gadget: dwc2_udc_otg: implement pullup()

Marek Vasut marex at denx.de
Tue Jan 10 18:23:34 CET 2023


On 1/10/23 17:29, Mattijs Korpershoek wrote:

[...]

> diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c
> index 77988f78ab30..d0a9be49ad9c 100644
> --- a/drivers/usb/gadget/dwc2_udc_otg.c
> +++ b/drivers/usb/gadget/dwc2_udc_otg.c
> @@ -236,6 +236,14 @@ static int udc_enable(struct dwc2_udc *dev)
>   	return 0;
>   }
>   
> +static int dwc2_gadget_pullup(struct usb_gadget *g, int is_on)
> +{
> +	clrsetbits_le32(&reg->dctl, SOFT_DISCONNECT,
> +			(!is_on) << SOFT_DISCONNECT_BIT);

Use

is_on ? 0 : SOFT_DISCONNECT

and you get rid of SOFT_DISCONNECT_BIT macro and the extra parenthesis 
around (!is_on) which are not needed.


More information about the U-Boot mailing list