All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@kernel.org>
To: u-boot@lists.denx.de
Cc: Lukasz Majewski <lukma@denx.de>, Marek Vasut <marex@nabladev.com>,
	 Tom Rini <trini@konsulko.com>,
	 Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	 Jonas Karlman <jonas@kwiboo.se>,
	 Mattijs Korpershoek <mkorpershoek@kernel.org>
Subject: [PATCH 2/2] usb: gadget: dwc2: Set endpoint capabilities via .caps field
Date: Fri, 03 Jul 2026 15:29:37 +0200	[thread overview]
Message-ID: <20260703-usb-prep-dwc3-sync-v1-2-1352bc238c9b@kernel.org> (raw)
In-Reply-To: <20260703-usb-prep-dwc3-sync-v1-0-1352bc238c9b@kernel.org>

Endpoint capabilities can be described via the .caps field of
struct usb_ep since commit
77dcbdf3c1ce ("usb: gadget: Add match_ep() op to usb_gadget_ops")

In linux, the following commit introduces it:
b86f33a3a371 ("usb: gadget: epautoconf: add endpoint capabilities flags verification")

Linux's change also reworks the ep matching function by relying on
these new capabilities instead of guessing based on the endpoint name.

Prepare the dwc2 UDC driver for capability-based matching by adding the
required capabilities for each endpoint.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
---
 drivers/usb/gadget/dwc2_udc_otg.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c
index 9c85383fd62a..570fed347c9e 100644
--- a/drivers/usb/gadget/dwc2_udc_otg.c
+++ b/drivers/usb/gadget/dwc2_udc_otg.c
@@ -828,6 +828,11 @@ static struct dwc2_udc memory = {
 		.ep = {
 			.name = ep0name,
 			.ops = &dwc2_ep_ops,
+			.caps = {
+				.type_control = 1,
+				.dir_in = 1,
+				.dir_out = 1,
+			},
 		},
 		.dev = &memory,
 
@@ -842,6 +847,10 @@ static struct dwc2_udc memory = {
 		.ep = {
 			.name = "ep1in-bulk",
 			.ops = &dwc2_ep_ops,
+			.caps = {
+				.type_bulk = 1,
+				.dir_in = 1,
+			},
 		},
 		.dev = &memory,
 
@@ -856,6 +865,10 @@ static struct dwc2_udc memory = {
 		.ep = {
 			.name = "ep2out-bulk",
 			.ops = &dwc2_ep_ops,
+			.caps = {
+				.type_bulk = 1,
+				.dir_out = 1,
+			},
 		},
 		.dev = &memory,
 
@@ -870,6 +883,10 @@ static struct dwc2_udc memory = {
 		.ep = {
 			.name = "ep3in-int",
 			.ops = &dwc2_ep_ops,
+			.caps = {
+				.type_int = 1,
+				.dir_in = 1,
+			},
 		},
 		.dev = &memory,
 

-- 
2.54.0


  parent reply	other threads:[~2026-07-03 13:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03 13:29 [PATCH 0/2] usb: gadget: dwc2: Prepare for UDC core migration Mattijs Korpershoek
2026-07-03 13:29 ` [PATCH 1/2] usb: gadget: dwc2: Use usb_ep_set_maxpacket_limit() for fifo sizes Mattijs Korpershoek
2026-07-09  9:21   ` Ilias Apalodimas
2026-07-03 13:29 ` Mattijs Korpershoek [this message]
2026-07-09  9:22   ` [PATCH 2/2] usb: gadget: dwc2: Set endpoint capabilities via .caps field Ilias Apalodimas
2026-07-22  6:54 ` [PATCH 0/2] usb: gadget: dwc2: Prepare for UDC core migration Mattijs Korpershoek via U-Boot
2026-07-22  7:02   ` Mattijs Korpershoek via U-Boot

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=20260703-usb-prep-dwc3-sync-v1-2-1352bc238c9b@kernel.org \
    --to=mkorpershoek@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jonas@kwiboo.se \
    --cc=lukma@denx.de \
    --cc=marex@nabladev.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.