[PATCH 2/2] usb: gadget: dwc2: Set endpoint capabilities via .caps field

Mattijs Korpershoek mkorpershoek at kernel.org
Fri Jul 3 15:29:37 CEST 2026


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 at 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



More information about the U-Boot mailing list