diff options
Diffstat (limited to 'drivers/usb/gadget/f_serial.c')
-rw-r--r-- | drivers/usb/gadget/f_serial.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/usb/gadget/f_serial.c b/drivers/usb/gadget/f_serial.c index cf33a8d0fd5d..07197d63d9b1 100644 --- a/drivers/usb/gadget/f_serial.c +++ b/drivers/usb/gadget/f_serial.c | |||
@@ -99,6 +99,34 @@ static struct usb_descriptor_header *gser_hs_function[] __initdata = { | |||
99 | NULL, | 99 | NULL, |
100 | }; | 100 | }; |
101 | 101 | ||
102 | static struct usb_endpoint_descriptor gser_ss_in_desc __initdata = { | ||
103 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
104 | .bDescriptorType = USB_DT_ENDPOINT, | ||
105 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | ||
106 | .wMaxPacketSize = cpu_to_le16(1024), | ||
107 | }; | ||
108 | |||
109 | static struct usb_endpoint_descriptor gser_ss_out_desc __initdata = { | ||
110 | .bLength = USB_DT_ENDPOINT_SIZE, | ||
111 | .bDescriptorType = USB_DT_ENDPOINT, | ||
112 | .bmAttributes = USB_ENDPOINT_XFER_BULK, | ||
113 | .wMaxPacketSize = cpu_to_le16(1024), | ||
114 | }; | ||
115 | |||
116 | static struct usb_ss_ep_comp_descriptor gser_ss_bulk_comp_desc __initdata = { | ||
117 | .bLength = sizeof gser_ss_bulk_comp_desc, | ||
118 | .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, | ||
119 | }; | ||
120 | |||
121 | static struct usb_descriptor_header *gser_ss_function[] __initdata = { | ||
122 | (struct usb_descriptor_header *) &gser_interface_desc, | ||
123 | (struct usb_descriptor_header *) &gser_ss_in_desc, | ||
124 | (struct usb_descriptor_header *) &gser_ss_bulk_comp_desc, | ||
125 | (struct usb_descriptor_header *) &gser_ss_out_desc, | ||
126 | (struct usb_descriptor_header *) &gser_ss_bulk_comp_desc, | ||
127 | NULL, | ||
128 | }; | ||
129 | |||
102 | /* string descriptors: */ | 130 | /* string descriptors: */ |
103 | 131 | ||
104 | static struct usb_string gser_string_defs[] = { | 132 | static struct usb_string gser_string_defs[] = { |
@@ -201,9 +229,21 @@ gser_bind(struct usb_configuration *c, struct usb_function *f) | |||
201 | /* copy descriptors, and track endpoint copies */ | 229 | /* copy descriptors, and track endpoint copies */ |
202 | f->hs_descriptors = usb_copy_descriptors(gser_hs_function); | 230 | f->hs_descriptors = usb_copy_descriptors(gser_hs_function); |
203 | } | 231 | } |
232 | if (gadget_is_superspeed(c->cdev->gadget)) { | ||
233 | gser_ss_in_desc.bEndpointAddress = | ||
234 | gser_fs_in_desc.bEndpointAddress; | ||
235 | gser_ss_out_desc.bEndpointAddress = | ||
236 | gser_fs_out_desc.bEndpointAddress; | ||
237 | |||
238 | /* copy descriptors, and track endpoint copies */ | ||
239 | f->ss_descriptors = usb_copy_descriptors(gser_ss_function); | ||
240 | if (!f->ss_descriptors) | ||
241 | goto fail; | ||
242 | } | ||
204 | 243 | ||
205 | DBG(cdev, "generic ttyGS%d: %s speed IN/%s OUT/%s\n", | 244 | DBG(cdev, "generic ttyGS%d: %s speed IN/%s OUT/%s\n", |
206 | gser->port_num, | 245 | gser->port_num, |
246 | gadget_is_superspeed(c->cdev->gadget) ? "super" : | ||
207 | gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", | 247 | gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", |
208 | gser->port.in->name, gser->port.out->name); | 248 | gser->port.in->name, gser->port.out->name); |
209 | return 0; | 249 | return 0; |
@@ -225,6 +265,8 @@ gser_unbind(struct usb_configuration *c, struct usb_function *f) | |||
225 | { | 265 | { |
226 | if (gadget_is_dualspeed(c->cdev->gadget)) | 266 | if (gadget_is_dualspeed(c->cdev->gadget)) |
227 | usb_free_descriptors(f->hs_descriptors); | 267 | usb_free_descriptors(f->hs_descriptors); |
268 | if (gadget_is_superspeed(c->cdev->gadget)) | ||
269 | usb_free_descriptors(f->ss_descriptors); | ||
228 | usb_free_descriptors(f->descriptors); | 270 | usb_free_descriptors(f->descriptors); |
229 | kfree(func_to_gser(f)); | 271 | kfree(func_to_gser(f)); |
230 | } | 272 | } |