diff options
author | Amit Blay <ablay@codeaurora.org> | 2011-07-03 10:29:31 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2011-07-08 06:57:54 -0400 |
commit | 57c97c02de0e7a59cb48d3d7666f4afaf9968e84 (patch) | |
tree | 93cabb75526859842ee1f0846aee10e3bff0b245 /drivers/usb/gadget/f_loopback.c | |
parent | 04617db7aa688598ebd3fce20691d31a5e778b45 (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>
Diffstat (limited to 'drivers/usb/gadget/f_loopback.c')
-rw-r--r-- | drivers/usb/gadget/f_loopback.c | 55 |
1 files changed, 54 insertions, 1 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 | |||
123 | static 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 | |||
131 | struct 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 | |||
139 | static 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 | |||
147 | struct 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 | |||
155 | static 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 | ||
123 | static struct usb_string strings_loopback[] = { | 166 | static 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 | } |