[PATCH v3 6/7] usb: gadget: atmel: Add attach/detach support

Mattijs Korpershoek mkorpershoek at baylibre.com
Wed Jul 24 12:18:23 CEST 2024


Hi Zixun,

Thank you for the patch.

On mar., juil. 23, 2024 at 15:18, Zixun LI <admin at hifiphile.com> wrote:

> Add controller attach/detach support by using
> usb_gadget_ops.pullup() method.
>
> Signed-off-by: Zixun LI <zli at ogga.fr>

Reviewed-by: Mattijs Korpershoek <mkorpershoek at baylibre.com>

> ---
>  drivers/usb/gadget/atmel_usba_udc.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
> index ea9ad7585e..a7b96449f8 100644
> --- a/drivers/usb/gadget/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/atmel_usba_udc.c
> @@ -506,10 +506,28 @@ usba_udc_set_selfpowered(struct usb_gadget *gadget, int is_selfpowered)
>  	return 0;
>  }
>  
> +static int usba_udc_pullup(struct usb_gadget *gadget, int is_on)
> +{
> +	struct usba_udc *udc = to_usba_udc(gadget);
> +	u32 ctrl;
> +
> +	ctrl = usba_readl(udc, CTRL);
> +
> +	if (is_on)
> +		ctrl &= ~USBA_DETACH;
> +	else
> +		ctrl |= USBA_DETACH;
> +
> +	usba_writel(udc, CTRL, ctrl);
> +
> +	return 0;
> +}
> +
>  static const struct usb_gadget_ops usba_udc_ops = {
>  	.get_frame		= usba_udc_get_frame,
>  	.wakeup			= usba_udc_wakeup,
>  	.set_selfpowered	= usba_udc_set_selfpowered,
> +	.pullup			= usba_udc_pullup,
>  };
>  
>  static struct usb_endpoint_descriptor usba_ep0_desc = {
> -- 
> 2.45.2


More information about the U-Boot mailing list