[RFC/PATCH 11/12] usb: gadget: f_obex: add basic SuperSpeed endpoint descriptors

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

 



add the bare minimum SS endpoint descriptors for
f_obex function driver.

Signed-off-by: Felipe Balbi <balbi@xxxxxx>
---
 drivers/usb/gadget/f_obex.c |   69 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/gadget/f_obex.c b/drivers/usb/gadget/f_obex.c
index 8f8c643..b1c7c3d 100644
--- a/drivers/usb/gadget/f_obex.c
+++ b/drivers/usb/gadget/f_obex.c
@@ -53,6 +53,7 @@ struct f_obex {
 
 	struct obex_ep_descs		fs;
 	struct obex_ep_descs		hs;
+	struct obex_ep_descs		ss;
 };
 
 static inline struct f_obex *func_to_obex(struct usb_function *f)
@@ -141,6 +142,59 @@ static struct usb_cdc_obex_desc obex_desc __initdata = {
 	.bcdVersion		= cpu_to_le16(0x0100),
 };
 
+/* Super-Speed Support */
+
+static struct usb_endpoint_descriptor obex_ss_ep_out_desc __initdata = {
+	.bLength		= USB_DT_ENDPOINT_SIZE,
+	.bDescriptorType	= USB_DT_ENDPOINT,
+
+	.bEndpointAddress	= USB_DIR_OUT,
+	.bmAttributes		= USB_ENDPOINT_XFER_BULK,
+	.wMaxPacketSize		= cpu_to_le16(1024),
+};
+
+static struct usb_ss_ep_comp_descriptor obex_ss_ep_out_comp_desc __initdata = {
+	.bLength		= USB_DT_SS_EP_COMP_SIZE,
+	.bDescriptorType	= USB_DT_SS_ENDPOINT_COMP,
+
+	.bMaxBurst		= 0,
+	.bmAttributes		= 0,
+	.wBytesPerInterval	= 0,
+};
+
+static struct usb_endpoint_descriptor obex_ss_ep_in_desc __initdata = {
+	.bLength		= USB_DT_ENDPOINT_SIZE,
+	.bDescriptorType	= USB_DT_ENDPOINT,
+
+	.bEndpointAddress	= USB_DIR_IN,
+	.bmAttributes		= USB_ENDPOINT_XFER_BULK,
+	.wMaxPacketSize		= cpu_to_le16(512),
+};
+
+static struct usb_ss_ep_comp_descriptor obex_ss_ep_in_comp_desc __initdata = {
+	.bLength		= USB_DT_SS_EP_COMP_SIZE,
+	.bDescriptorType	= USB_DT_SS_ENDPOINT_COMP,
+
+	.bMaxBurst		= 0,
+	.bmAttributes		= 0,
+	.wBytesPerInterval	= 0,
+};
+
+static struct usb_descriptor_header *ss_function[] __initdata = {
+	(struct usb_descriptor_header *) &obex_control_intf,
+	(struct usb_descriptor_header *) &obex_cdc_header_desc,
+	(struct usb_descriptor_header *) &obex_desc,
+	(struct usb_descriptor_header *) &obex_cdc_union_desc,
+
+	(struct usb_descriptor_header *) &obex_data_nop_intf,
+	(struct usb_descriptor_header *) &obex_data_intf,
+	(struct usb_descriptor_header *) &obex_ss_ep_in_desc,
+	(struct usb_descriptor_header *) &obex_ss_ep_in_comp_desc,
+	(struct usb_descriptor_header *) &obex_ss_ep_out_desc,
+	(struct usb_descriptor_header *) &obex_ss_ep_out_comp_desc,
+	NULL,
+};
+
 /* High-Speed Support */
 
 static struct usb_endpoint_descriptor obex_hs_ep_out_desc __initdata = {
@@ -371,6 +425,21 @@ obex_bind(struct usb_configuration *c, struct usb_function *f)
 				f->hs_descriptors, &obex_hs_ep_out_desc);
 	}
 
+	if (gadget_is_superspeed(c->cdev->gadget)) {
+		obex_ss_ep_in_desc.bEndpointAddress =
+				obex_fs_ep_in_desc.bEndpointAddress;
+		obex_ss_ep_out_desc.bEndpointAddress =
+				obex_fs_ep_out_desc.bEndpointAddress;
+
+		/* copy descriptors, and track endpoint copies */
+		f->ss_descriptors = usb_copy_descriptors(ss_function);
+
+		obex->ss.obex_in = usb_find_endpoint(ss_function,
+				f->ss_descriptors, &obex_ss_ep_in_desc);
+		obex->ss.obex_out = usb_find_endpoint(ss_function,
+				f->ss_descriptors, &obex_ss_ep_out_desc);
+	}
+
 	/* Avoid letting this gadget enumerate until the userspace
 	 * OBEX server is active.
 	 */
-- 
1.7.4.rc2

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