[PATCH v2] usb: gadget: dwc2_udc_otg: implement pullup()
Mattijs Korpershoek
mkorpershoek at baylibre.com
Wed Jan 11 09:13:15 CET 2023
On Tue, Jan 10, 2023 at 18:23, Marek Vasut <marex at denx.de> wrote:
> 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(®->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.
Will do. thank you for your patience and your good advice !
More information about the U-Boot
mailing list