Re: [PATCH 08/11] usb: gadget: musb: Convert interrupt handling to usb_gadget_generic_ops

2024-06-18 Thread Mattijs Korpershoek
Hi Marek,

Thank you for the patch.

On ven., juin 14, 2024 at 02:51, Marek Vasut  
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 

Reviewed-by: Mattijs Korpershoek 

> ---
> Cc: Alexander Sverdlin 
> Cc: Felipe Balbi 
> Cc: Lukasz Majewski 
> Cc: Mattijs Korpershoek 
> Cc: Nishanth Menon 
> Cc: Simon Glass 
> Cc: Thinh Nguyen 
> Cc: Tom Rini 
> Cc: u-boot@lists.denx.de
> ---
>  drivers/usb/musb-new/ti-musb.c | 23 ++-
>  1 file changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c
> index 76e8b88369e..ec1baa9337d 100644
> --- a/drivers/usb/musb-new/ti-musb.c
> +++ b/drivers/usb/musb-new/ti-musb.c
> @@ -233,15 +233,6 @@ static int ti_musb_peripheral_of_to_plat(struct udevice 
> *dev)
>  }
>  #endif
>  
> -int dm_usb_gadget_handle_interrupts(struct udevice *dev)
> -{
> - struct ti_musb_peripheral *priv = dev_get_priv(dev);
> -
> - priv->periph->isr(0, priv->periph);
> -
> - return 0;
> -}
> -
>  static int ti_musb_peripheral_probe(struct udevice *dev)
>  {
>   struct ti_musb_peripheral *priv = dev_get_priv(dev);
> @@ -269,12 +260,26 @@ static int ti_musb_peripheral_remove(struct udevice 
> *dev)
>   return 0;
>  }
>  
> +static int ti_musb_gadget_handle_interrupts(struct udevice *dev)
> +{
> + struct ti_musb_peripheral *priv = dev_get_priv(dev);
> +
> + priv->periph->isr(0, priv->periph);
> +
> + return 0;
> +}
> +
> +static const struct usb_gadget_generic_ops ti_musb_gadget_ops = {
> + .handle_interrupts  = ti_musb_gadget_handle_interrupts,
> +};
> +
>  U_BOOT_DRIVER(ti_musb_peripheral) = {
>   .name   = "ti-musb-peripheral",
>   .id = UCLASS_USB_GADGET_GENERIC,
>  #if CONFIG_IS_ENABLED(OF_CONTROL)
>   .of_to_plat = ti_musb_peripheral_of_to_plat,
>  #endif
> + .ops= _musb_gadget_ops,
>   .probe = ti_musb_peripheral_probe,
>   .remove = ti_musb_peripheral_remove,
>   .ops= _usb_ops,
> -- 
> 2.43.0


[PATCH 08/11] usb: gadget: musb: Convert interrupt handling to usb_gadget_generic_ops

2024-06-13 Thread Marek Vasut
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 
---
Cc: Alexander Sverdlin 
Cc: Felipe Balbi 
Cc: Lukasz Majewski 
Cc: Mattijs Korpershoek 
Cc: Nishanth Menon 
Cc: Simon Glass 
Cc: Thinh Nguyen 
Cc: Tom Rini 
Cc: u-boot@lists.denx.de
---
 drivers/usb/musb-new/ti-musb.c | 23 ++-
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c
index 76e8b88369e..ec1baa9337d 100644
--- a/drivers/usb/musb-new/ti-musb.c
+++ b/drivers/usb/musb-new/ti-musb.c
@@ -233,15 +233,6 @@ static int ti_musb_peripheral_of_to_plat(struct udevice 
*dev)
 }
 #endif
 
-int dm_usb_gadget_handle_interrupts(struct udevice *dev)
-{
-   struct ti_musb_peripheral *priv = dev_get_priv(dev);
-
-   priv->periph->isr(0, priv->periph);
-
-   return 0;
-}
-
 static int ti_musb_peripheral_probe(struct udevice *dev)
 {
struct ti_musb_peripheral *priv = dev_get_priv(dev);
@@ -269,12 +260,26 @@ static int ti_musb_peripheral_remove(struct udevice *dev)
return 0;
 }
 
+static int ti_musb_gadget_handle_interrupts(struct udevice *dev)
+{
+   struct ti_musb_peripheral *priv = dev_get_priv(dev);
+
+   priv->periph->isr(0, priv->periph);
+
+   return 0;
+}
+
+static const struct usb_gadget_generic_ops ti_musb_gadget_ops = {
+   .handle_interrupts  = ti_musb_gadget_handle_interrupts,
+};
+
 U_BOOT_DRIVER(ti_musb_peripheral) = {
.name   = "ti-musb-peripheral",
.id = UCLASS_USB_GADGET_GENERIC,
 #if CONFIG_IS_ENABLED(OF_CONTROL)
.of_to_plat = ti_musb_peripheral_of_to_plat,
 #endif
+   .ops= _musb_gadget_ops,
.probe = ti_musb_peripheral_probe,
.remove = ti_musb_peripheral_remove,
.ops= _usb_ops,
-- 
2.43.0