[PATCH 03/11] usb: gadget: dwc2: Convert interrupt handling to usb_gadget_generic_ops

Mattijs Korpershoek mkorpershoek at baylibre.com
Tue Jun 18 09:20:12 CEST 2024


Hi Marek,

Thank you for the patch.

On ven., juin 14, 2024 at 02:51, Marek Vasut <marek.vasut+renesas at mailbox.org> wrote:

> Implement .handle_interrupts callback as a replacement for deprecated
> dm_usb_gadget_handle_interrupts() function. The new callback allows
> for each DM capable USB gadget controller driver to define its own
> IRQ handling implementation without colliding with other controller
> drivers.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>

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

> ---
> Cc: Alexander Sverdlin <alexander.sverdlin at siemens.com>
> Cc: Felipe Balbi <felipe.balbi at linux.intel.com>
> Cc: Lukasz Majewski <lukma at denx.de>
> Cc: Mattijs Korpershoek <mkorpershoek at baylibre.com>
> Cc: Nishanth Menon <nm at ti.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Thinh Nguyen <Thinh.Nguyen at synopsys.com>
> Cc: Tom Rini <trini at konsulko.com>
> Cc: u-boot at lists.denx.de
> ---
>  drivers/usb/gadget/dwc2_udc_otg.c | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c
> index 6bd395a6235..7e9dd6f4268 100644
> --- a/drivers/usb/gadget/dwc2_udc_otg.c
> +++ b/drivers/usb/gadget/dwc2_udc_otg.c
> @@ -941,11 +941,6 @@ int dwc2_udc_handle_interrupt(void)
>  	return 0;
>  }
>  
> -int dm_usb_gadget_handle_interrupts(struct udevice *dev)
> -{
> -	return dwc2_udc_handle_interrupt();
> -}
> -
>  #if CONFIG_IS_ENABLED(DM_USB_GADGET)
>  struct dwc2_priv_data {
>  	struct clk_bulk		clks;
> @@ -1173,6 +1168,15 @@ static int dwc2_udc_otg_remove(struct udevice *dev)
>  	return dm_scan_fdt_dev(dev);
>  }
>  
> +static int dwc2_gadget_handle_interrupts(struct udevice *dev)
> +{
> +	return dwc2_udc_handle_interrupt();
> +}
> +
> +static const struct usb_gadget_generic_ops dwc2_gadget_ops = {
> +	.handle_interrupts	= dwc2_gadget_handle_interrupts,
> +};
> +
>  static const struct udevice_id dwc2_udc_otg_ids[] = {
>  	{ .compatible = "snps,dwc2" },
>  	{ .compatible = "brcm,bcm2835-usb" },
> @@ -1185,6 +1189,7 @@ U_BOOT_DRIVER(dwc2_udc_otg) = {
>  	.name	= "dwc2-udc-otg",
>  	.id	= UCLASS_USB_GADGET_GENERIC,
>  	.of_match = dwc2_udc_otg_ids,
> +	.ops	= &dwc2_gadget_ops,
>  	.of_to_plat = dwc2_udc_otg_of_to_plat,
>  	.probe = dwc2_udc_otg_probe,
>  	.remove = dwc2_udc_otg_remove,
> @@ -1200,4 +1205,9 @@ int dwc2_udc_B_session_valid(struct udevice *dev)
>  
>  	return readl(&usbotg_reg->gotgctl) & B_SESSION_VALID;
>  }
> +#else
> +int dm_usb_gadget_handle_interrupts(struct udevice *dev)
> +{
> +	return dwc2_udc_handle_interrupt();
> +}
>  #endif /* CONFIG_IS_ENABLED(DM_USB_GADGET) */
> -- 
> 2.43.0


More information about the U-Boot mailing list