aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmit Blay <ablay@codeaurora.org>2011-07-03 10:29:31 -0400
committerFelipe Balbi <balbi@ti.com>2011-07-08 06:57:54 -0400
commit57c97c02de0e7a59cb48d3d7666f4afaf9968e84 (patch)
tree93cabb75526859842ee1f0846aee10e3bff0b245
parent04617db7aa688598ebd3fce20691d31a5e778b45 (diff)
usb: gadget: zero: add superspeed support
This patch adds SuperSpeed descriptors to the g_zero gadget. The SuperSpeed descriptors were added both for f_soursesink and f_loopback function drivers. Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org> Signed-off-by: Amit Blay <ablay@codeaurora.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/gadget/f_loopback.c55
-rw-r--r--drivers/usb/gadget/f_sourcesink.c55
-rw-r--r--drivers/usb/gadget/zero.c2
3 files changed, 109 insertions, 3 deletions
diff --git a/drivers/usb/gadget/f_loopback.c b/drivers/usb/gadget/f_loopback.c
index 375632659a03..ca660d40b11a 100644
--- a/drivers/usb/gadget/f_loopback.c
+++ b/drivers/usb/gadget/f_loopback.c
@@ -118,6 +118,49 @@ static struct usb_descriptor_header *hs_loopback_descs[] = {
118 NULL, 118 NULL,
119}; 119};
120 120
121/* super speed support: */
122
123static struct usb_endpoint_descriptor ss_loop_source_desc = {
124 .bLength = USB_DT_ENDPOINT_SIZE,
125 .bDescriptorType = USB_DT_ENDPOINT,
126
127 .bmAttributes = USB_ENDPOINT_XFER_BULK,
128 .wMaxPacketSize = cpu_to_le16(1024),
129};
130
131struct usb_ss_ep_comp_descriptor ss_loop_source_comp_desc = {
132 .bLength = USB_DT_SS_EP_COMP_SIZE,
133 .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
134 .bMaxBurst = 0,
135 .bmAttributes = 0,
136 .wBytesPerInterval = 0,
137};
138
139static struct usb_endpoint_descriptor ss_loop_sink_desc = {
140 .bLength = USB_DT_ENDPOINT_SIZE,
141 .bDescriptorType = USB_DT_ENDPOINT,
142
143 .bmAttributes = USB_ENDPOINT_XFER_BULK,
144 .wMaxPacketSize = cpu_to_le16(1024),
145};
146
147struct usb_ss_ep_comp_descriptor ss_loop_sink_comp_desc = {
148 .bLength = USB_DT_SS_EP_COMP_SIZE,
149 .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
150 .bMaxBurst = 0,
151 .bmAttributes = 0,
152 .wBytesPerInterval = 0,
153};
154
155static struct usb_descriptor_header *ss_loopback_descs[] = {
156 (struct usb_descriptor_header *) &loopback_intf,
157 (struct usb_descriptor_header *) &ss_loop_source_desc,
158 (struct usb_descriptor_header *) &ss_loop_source_comp_desc,
159 (struct usb_descriptor_header *) &ss_loop_sink_desc,
160 (struct usb_descriptor_header *) &ss_loop_sink_comp_desc,
161 NULL,
162};
163
121/* function-specific strings: */ 164/* function-specific strings: */
122 165
123static struct usb_string strings_loopback[] = { 166static struct usb_string strings_loopback[] = {
@@ -175,8 +218,18 @@ autoconf_fail:
175 f->hs_descriptors = hs_loopback_descs; 218 f->hs_descriptors = hs_loopback_descs;
176 } 219 }
177 220
221 /* support super speed hardware */
222 if (gadget_is_superspeed(c->cdev->gadget)) {
223 ss_loop_source_desc.bEndpointAddress =
224 fs_loop_source_desc.bEndpointAddress;
225 ss_loop_sink_desc.bEndpointAddress =
226 fs_loop_sink_desc.bEndpointAddress;
227 f->ss_descriptors = ss_loopback_descs;
228 }
229
178 DBG(cdev, "%s speed %s: IN/%s, OUT/%s\n", 230 DBG(cdev, "%s speed %s: IN/%s, OUT/%s\n",
179 gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", 231 (gadget_is_superspeed(c->cdev->gadget) ? "super" :
232 (gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full")),
180 f->name, loop->in_ep->name, loop->out_ep->name); 233 f->name, loop->in_ep->name, loop->out_ep->name);
181 return 0; 234 return 0;
182} 235}
diff --git a/drivers/usb/gadget/f_sourcesink.c b/drivers/usb/gadget/f_sourcesink.c
index 5a92883f4c8c..e18b4f520951 100644
--- a/drivers/usb/gadget/f_sourcesink.c
+++ b/drivers/usb/gadget/f_sourcesink.c
@@ -131,6 +131,49 @@ static struct usb_descriptor_header *hs_source_sink_descs[] = {
131 NULL, 131 NULL,
132}; 132};
133 133
134/* super speed support: */
135
136static struct usb_endpoint_descriptor ss_source_desc = {
137 .bLength = USB_DT_ENDPOINT_SIZE,
138 .bDescriptorType = USB_DT_ENDPOINT,
139
140 .bmAttributes = USB_ENDPOINT_XFER_BULK,
141 .wMaxPacketSize = cpu_to_le16(1024),
142};
143
144struct usb_ss_ep_comp_descriptor ss_source_comp_desc = {
145 .bLength = USB_DT_SS_EP_COMP_SIZE,
146 .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
147 .bMaxBurst = 0,
148 .bmAttributes = 0,
149 .wBytesPerInterval = 0,
150};
151
152static struct usb_endpoint_descriptor ss_sink_desc = {
153 .bLength = USB_DT_ENDPOINT_SIZE,
154 .bDescriptorType = USB_DT_ENDPOINT,
155
156 .bmAttributes = USB_ENDPOINT_XFER_BULK,
157 .wMaxPacketSize = cpu_to_le16(1024),
158};
159
160struct usb_ss_ep_comp_descriptor ss_sink_comp_desc = {
161 .bLength = USB_DT_SS_EP_COMP_SIZE,
162 .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
163 .bMaxBurst = 0,
164 .bmAttributes = 0,
165 .wBytesPerInterval = 0,
166};
167
168static struct usb_descriptor_header *ss_source_sink_descs[] = {
169 (struct usb_descriptor_header *) &source_sink_intf,
170 (struct usb_descriptor_header *) &ss_source_desc,
171 (struct usb_descriptor_header *) &ss_source_comp_desc,
172 (struct usb_descriptor_header *) &ss_sink_desc,
173 (struct usb_descriptor_header *) &ss_sink_comp_desc,
174 NULL,
175};
176
134/* function-specific strings: */ 177/* function-specific strings: */
135 178
136static struct usb_string strings_sourcesink[] = { 179static struct usb_string strings_sourcesink[] = {
@@ -187,8 +230,18 @@ autoconf_fail:
187 f->hs_descriptors = hs_source_sink_descs; 230 f->hs_descriptors = hs_source_sink_descs;
188 } 231 }
189 232
233 /* support super speed hardware */
234 if (gadget_is_superspeed(c->cdev->gadget)) {
235 ss_source_desc.bEndpointAddress =
236 fs_source_desc.bEndpointAddress;
237 ss_sink_desc.bEndpointAddress =
238 fs_sink_desc.bEndpointAddress;
239 f->ss_descriptors = ss_source_sink_descs;
240 }
241
190 DBG(cdev, "%s speed %s: IN/%s, OUT/%s\n", 242 DBG(cdev, "%s speed %s: IN/%s, OUT/%s\n",
191 gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full", 243 (gadget_is_superspeed(c->cdev->gadget) ? "super" :
244 (gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full")),
192 f->name, ss->in_ep->name, ss->out_ep->name); 245 f->name, ss->in_ep->name, ss->out_ep->name);
193 return 0; 246 return 0;
194} 247}
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index af7e7c3818d8..00e2fd2d4791 100644
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -340,7 +340,7 @@ static struct usb_composite_driver zero_driver = {
340 .name = "zero", 340 .name = "zero",
341 .dev = &device_desc, 341 .dev = &device_desc,
342 .strings = dev_strings, 342 .strings = dev_strings,
343 .max_speed = USB_SPEED_HIGH, 343 .max_speed = USB_SPEED_SUPER,
344 .unbind = zero_unbind, 344 .unbind = zero_unbind,
345 .suspend = zero_suspend, 345 .suspend = zero_suspend,
346 .resume = zero_resume, 346 .resume = zero_resume,