From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Marek Vasut <marek.vasut+renesas@mailbox.org>, u-boot@lists.denx.de
Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>,
Alexander Sverdlin <alexander.sverdlin@siemens.com>,
Felipe Balbi <felipe.balbi@linux.intel.com>,
Lukasz Majewski <lukma@denx.de>, Nishanth Menon <nm@ti.com>,
Simon Glass <sjg@chromium.org>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH 02/11] usb: gadget: cdns3: Convert interrupt handling to usb_gadget_generic_ops
Date: Tue, 18 Jun 2024 09:18:47 +0200 [thread overview]
Message-ID: <877cemk9bc.fsf@baylibre.com> (raw)
In-Reply-To: <20240614005309.34433-3-marek.vasut+renesas@mailbox.org>
Hi Marek,
Thank you for the patch.
On ven., juin 14, 2024 at 02:51, Marek Vasut <marek.vasut+renesas@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.
>
> Keep the dm_usb_gadget_handle_interrupts() in this driver for non-DM
> case for now, until this driver gets fully converted to DM USB gadget.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
> Cc: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
> Cc: Lukasz Majewski <lukma@denx.de>
> Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: u-boot@lists.denx.de
> ---
> drivers/usb/cdns3/core.c | 24 ++++++++++++++++++++++++
> drivers/usb/cdns3/gadget-export.h | 2 ++
> drivers/usb/cdns3/gadget.c | 11 +----------
> 3 files changed, 27 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
> index b4e931646b8..cbe06a9e7b6 100644
> --- a/drivers/usb/cdns3/core.c
> +++ b/drivers/usb/cdns3/core.c
> @@ -20,6 +20,7 @@
> #include <linux/bug.h>
> #include <linux/kernel.h>
> #include <linux/io.h>
> +#include <linux/usb/gadget.h>
> #include <usb.h>
> #include <usb/xhci.h>
>
> @@ -462,15 +463,38 @@ static int cdns3_gadget_remove(struct udevice *dev)
> return cdns3_remove(cdns);
> }
>
> +static int cdns3_gadget_handle_interrupts(struct udevice *dev)
> +{
> + struct cdns3 *cdns = dev_get_priv(dev);
> +
> + cdns3_gadget_uboot_handle_interrupt(cdns);
> +
> + return 0;
> +}
> +
> +static const struct usb_gadget_generic_ops cdns3_gadget_ops = {
> + .handle_interrupts = cdns3_gadget_handle_interrupts,
> +};
> +
> U_BOOT_DRIVER(cdns_usb3_peripheral) = {
> .name = "cdns-usb3-peripheral",
> .id = UCLASS_USB_GADGET_GENERIC,
> .of_match = cdns3_ids,
> + .ops = &cdns3_gadget_ops,
> .probe = cdns3_gadget_probe,
> .remove = cdns3_gadget_remove,
> .priv_auto = sizeof(struct cdns3_gadget_priv),
> .flags = DM_FLAG_ALLOC_PRIV_DMA,
> };
> +#else
> +int dm_usb_gadget_handle_interrupts(struct udevice *dev)
> +{
> + struct cdns3 *cdns = dev_get_priv(dev);
> +
> + cdns3_gadget_uboot_handle_interrupt(cdns);
> +
> + return 0;
> +}
> #endif
>
> #if defined(CONFIG_SPL_USB_HOST) || \
> diff --git a/drivers/usb/cdns3/gadget-export.h b/drivers/usb/cdns3/gadget-export.h
> index 577469eee96..b3fd7c53039 100644
> --- a/drivers/usb/cdns3/gadget-export.h
> +++ b/drivers/usb/cdns3/gadget-export.h
> @@ -25,4 +25,6 @@ static inline void cdns3_gadget_exit(struct cdns3 *cdns) { }
>
> #endif
>
> +void cdns3_gadget_uboot_handle_interrupt(struct cdns3 *cdns);
> +
> #endif /* __LINUX_CDNS3_GADGET_EXPORT */
> diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
> index d11175dc5b6..32b2c412068 100644
> --- a/drivers/usb/cdns3/gadget.c
> +++ b/drivers/usb/cdns3/gadget.c
> @@ -2755,19 +2755,10 @@ int cdns3_gadget_init(struct cdns3 *cdns)
> *
> * Handles ep0 and gadget interrupt
> */
> -static void cdns3_gadget_uboot_handle_interrupt(struct cdns3 *cdns)
> +void cdns3_gadget_uboot_handle_interrupt(struct cdns3 *cdns)
> {
> int ret = cdns3_device_irq_handler(0, cdns);
>
> if (ret == IRQ_WAKE_THREAD)
> cdns3_device_thread_irq_handler(0, cdns);
> }
> -
> -int dm_usb_gadget_handle_interrupts(struct udevice *dev)
> -{
> - struct cdns3 *cdns = dev_get_priv(dev);
> -
> - cdns3_gadget_uboot_handle_interrupt(cdns);
> -
> - return 0;
> -}
> --
> 2.43.0
next prev parent reply other threads:[~2024-06-18 7:19 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-14 0:51 [PATCH 00/11] usb: gadget: Introduce handle_interrupts ops to USB_GADGET_GENERIC uclass Marek Vasut
2024-06-14 0:51 ` [PATCH 01/11] " Marek Vasut
2024-06-18 7:12 ` Mattijs Korpershoek
2024-06-14 0:51 ` [PATCH 02/11] usb: gadget: cdns3: Convert interrupt handling to usb_gadget_generic_ops Marek Vasut
2024-06-18 7:18 ` Mattijs Korpershoek [this message]
2024-06-14 0:51 ` [PATCH 03/11] usb: gadget: dwc2: " Marek Vasut
2024-06-18 7:20 ` Mattijs Korpershoek
2024-06-14 0:51 ` [PATCH 04/11] usb: gadget: dwc3: " Marek Vasut
2024-06-18 7:27 ` Mattijs Korpershoek
2024-06-14 0:51 ` [PATCH 05/11] usb: gadget: max3420: " Marek Vasut
2024-06-18 7:28 ` Mattijs Korpershoek
2024-06-14 0:51 ` [PATCH 06/11] usb: gadget: mtu3: " Marek Vasut
2024-06-18 7:29 ` Mattijs Korpershoek
2024-06-14 0:51 ` [PATCH 07/11] usb: gadget: omap2430: " Marek Vasut
2024-06-14 0:51 ` [PATCH 08/11] usb: gadget: musb: " Marek Vasut
2024-06-18 7:36 ` Mattijs Korpershoek
2024-06-14 0:51 ` [PATCH 09/11] usb: gadget: ux500: " Marek Vasut
2024-06-18 7:40 ` Mattijs Korpershoek
2024-06-14 0:51 ` [PATCH 10/11] usb: gadget: sandbox: Drop dm_usb_gadget_handle_interrupts() Marek Vasut
2024-06-18 7:45 ` Mattijs Korpershoek
2024-06-14 0:51 ` [PATCH 11/11] usb: gadget: Mark dm_usb_gadget_handle_interrupts as non-weak for DM_USB_GADGET Marek Vasut
2024-06-18 7:46 ` Mattijs Korpershoek
2024-06-14 10:24 ` [PATCH 00/11] usb: gadget: Introduce handle_interrupts ops to USB_GADGET_GENERIC uclass Sverdlin, Alexander
2024-06-14 14:05 ` Marek Vasut
2024-06-18 7:10 ` Mattijs Korpershoek
2024-07-05 12:10 ` Mattijs Korpershoek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877cemk9bc.fsf@baylibre.com \
--to=mkorpershoek@baylibre.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=alexander.sverdlin@siemens.com \
--cc=felipe.balbi@linux.intel.com \
--cc=lukma@denx.de \
--cc=marek.vasut+renesas@mailbox.org \
--cc=nm@ti.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox