aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/f_eem.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/f_eem.c')
-rw-r--r--drivers/usb/gadget/f_eem.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/drivers/usb/gadget/f_eem.c b/drivers/usb/gadget/f_eem.c
index 3e412740e2ef..046c6d0e6960 100644
--- a/drivers/usb/gadget/f_eem.c
+++ b/drivers/usb/gadget/f_eem.c
@@ -115,6 +115,45 @@ static struct usb_descriptor_header *eem_hs_function[] __initdata = {
115 NULL, 115 NULL,
116}; 116};
117 117
118/* super speed support: */
119
120static struct usb_endpoint_descriptor eem_ss_in_desc __initdata = {
121 .bLength = USB_DT_ENDPOINT_SIZE,
122 .bDescriptorType = USB_DT_ENDPOINT,
123
124 .bEndpointAddress = USB_DIR_IN,
125 .bmAttributes = USB_ENDPOINT_XFER_BULK,
126 .wMaxPacketSize = cpu_to_le16(1024),
127};
128
129static struct usb_endpoint_descriptor eem_ss_out_desc __initdata = {
130 .bLength = USB_DT_ENDPOINT_SIZE,
131 .bDescriptorType = USB_DT_ENDPOINT,
132
133 .bEndpointAddress = USB_DIR_OUT,
134 .bmAttributes = USB_ENDPOINT_XFER_BULK,
135 .wMaxPacketSize = cpu_to_le16(1024),
136};
137
138static struct usb_ss_ep_comp_descriptor eem_ss_bulk_comp_desc __initdata = {
139 .bLength = sizeof eem_ss_bulk_comp_desc,
140 .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
141
142 /* the following 2 values can be tweaked if necessary */
143 /* .bMaxBurst = 0, */
144 /* .bmAttributes = 0, */
145};
146
147static struct usb_descriptor_header *eem_ss_function[] __initdata = {
148 /* CDC EEM control descriptors */
149 (struct usb_descriptor_header *) &eem_intf,
150 (struct usb_descriptor_header *) &eem_ss_in_desc,
151 (struct usb_descriptor_header *) &eem_ss_bulk_comp_desc,
152 (struct usb_descriptor_header *) &eem_ss_out_desc,
153 (struct usb_descriptor_header *) &eem_ss_bulk_comp_desc,
154 NULL,
155};
156
118/* string descriptors: */ 157/* string descriptors: */
119 158
120static struct usb_string eem_string_defs[] = { 159static struct usb_string eem_string_defs[] = {
@@ -265,7 +304,20 @@ eem_bind(struct usb_configuration *c, struct usb_function *f)
265 goto fail; 304 goto fail;
266 } 305 }
267 306
307 if (gadget_is_superspeed(c->cdev->gadget)) {
308 eem_ss_in_desc.bEndpointAddress =
309 eem_fs_in_desc.bEndpointAddress;
310 eem_ss_out_desc.bEndpointAddress =
311 eem_fs_out_desc.bEndpointAddress;
312
313 /* copy descriptors, and track endpoint copies */
314 f->ss_descriptors = usb_copy_descriptors(eem_ss_function);
315 if (!f->ss_descriptors)
316 goto fail;
317 }
318
268 DBG(cdev, "CDC Ethernet (EEM): %s speed IN/%s OUT/%s\n", 319 DBG(cdev, "CDC Ethernet (EEM): %s speed IN/%s OUT/%s\n",
320 gadget_is_superspeed(c->cdev->gadget) ? "super" :
269 gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", 321 gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full",
270 eem->port.in_ep->name, eem->port.out_ep->name); 322 eem->port.in_ep->name, eem->port.out_ep->name);
271 return 0; 323 return 0;
@@ -273,6 +325,8 @@ eem_bind(struct usb_configuration *c, struct usb_function *f)
273fail: 325fail:
274 if (f->descriptors) 326 if (f->descriptors)
275 usb_free_descriptors(f->descriptors); 327 usb_free_descriptors(f->descriptors);
328 if (f->hs_descriptors)
329 usb_free_descriptors(f->hs_descriptors);
276 330
277 /* we might as well release our claims on endpoints */ 331 /* we might as well release our claims on endpoints */
278 if (eem->port.out_ep->desc) 332 if (eem->port.out_ep->desc)
@@ -292,6 +346,8 @@ eem_unbind(struct usb_configuration *c, struct usb_function *f)
292 346
293 DBG(c->cdev, "eem unbind\n"); 347 DBG(c->cdev, "eem unbind\n");
294 348
349 if (gadget_is_superspeed(c->cdev->gadget))
350 usb_free_descriptors(f->ss_descriptors);
295 if (gadget_is_dualspeed(c->cdev->gadget)) 351 if (gadget_is_dualspeed(c->cdev->gadget))
296 usb_free_descriptors(f->hs_descriptors); 352 usb_free_descriptors(f->hs_descriptors);
297 usb_free_descriptors(f->descriptors); 353 usb_free_descriptors(f->descriptors);