[RFCv3 3/3] usb: dwc3: gadget: set endpoint feature flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



just so we can start using a more solid endpoint
matching system.

Signed-off-by: Felipe Balbi <balbi@xxxxxx>
---
 drivers/usb/dwc3/gadget.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 5452c0f..d687c3a 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1655,6 +1655,18 @@ static int dwc3_gadget_init_hw_endpoints(struct dwc3 *dwc,
 		if (epnum == 0 || epnum == 1) {
 			dep->endpoint.maxpacket = 512;
 			dep->endpoint.maxburst = 1;
+			dep->endpoint.has_control = true;
+
+			/*
+			 * REVISIT here we lie a bit to gadget framework,
+			 * because gadget framework expects to see a single
+			 * USB Endpoint zero, and we want the driver to manage
+			 * HW endpoints, we must tell gadget framework that
+			 * HW Endpoint zero supports both directions.
+			 */
+			dep->endpoint.has_dir_in = true;
+			dep->endpoint.has_dir_out = true;
+
 			dep->endpoint.ops = &dwc3_gadget_ep0_ops;
 			if (!epnum)
 				dwc->gadget.ep0 = &dep->endpoint;
@@ -1663,6 +1675,13 @@ static int dwc3_gadget_init_hw_endpoints(struct dwc3 *dwc,
 
 			dep->endpoint.maxpacket = 1024;
 			dep->endpoint.max_streams = 15;
+
+			dep->endpoint.has_bulk = true;
+			dep->endpoint.has_interrupt = true;
+			dep->endpoint.has_isochronous = true;
+			dep->endpoint.has_dir_in = !!direction;
+			dep->endpoint.has_dir_out = !direction;
+
 			dep->endpoint.ops = &dwc3_gadget_ep_ops;
 			list_add_tail(&dep->endpoint.ep_list,
 					&dwc->gadget.ep_list);
-- 
1.8.4.GIT

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux