Lines Matching +full:high +full:- +full:speed

2  * epautoconf.c -- endpoint autoconfiguration for usb gadget drivers
6 * SPDX-License-Identifier: GPL-2.0+
8 * SPDX-License-Identifier: GPL-2.0+
10 * Ported to U-Boot by: Thomas Smits <ts.smits@gmail.com> and
37 * - ep1, ep2, ... address is fixed, not direction or type
38 * - ep1in, ep2out, ... address and direction are fixed, not type
39 * - ep1-bulk, ep2-bulk, ... address and type are fixed, not direction
40 * - ep1in-bulk, ep2out-iso, ... all three are fixed
41 * - ep-* ... no functionality restrictions
43 * Type suffixes are "-bulk", "-iso", or "-int". Numbers are decimal.
60 if (NULL != ep->driver_data) in ep_matches()
64 type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; in ep_matches()
69 if ('e' != ep->name[0]) in ep_matches()
72 /* type-restriction: "-iso", "-bulk", or "-int". in ep_matches()
73 * direction-restriction: "in", "out". in ep_matches()
75 if ('-' != ep->name[2]) { in ep_matches()
76 tmp = strrchr(ep->name, '-'); in ep_matches()
81 * except the toggle-quirky iso-synch kind in ep_matches()
83 if ('s' == tmp[2]) /* == "-iso" */ in ep_matches()
85 /* for now, avoid PXA "interrupt-in"; in ep_matches()
93 if ('b' != tmp[1]) /* != "-bulk" */ in ep_matches()
97 if ('s' != tmp[2]) /* != "-iso" */ in ep_matches()
101 tmp = ep->name + strlen(ep->name); in ep_matches()
104 /* direction-restriction: "..in-..", "out-.." */ in ep_matches()
105 tmp--; in ep_matches()
107 if (desc->bEndpointAddress & USB_DIR_IN) { in ep_matches()
118 * where it's an output parameter representing the full speed limit. in ep_matches()
119 * the usb spec fixes high speed bulk maxpacket at 512 bytes. in ep_matches()
121 max = 0x7ff & le16_to_cpu(get_unaligned(&desc->wMaxPacketSize)); in ep_matches()
124 /* INT: limit 64 bytes full speed, 1024 high speed */ in ep_matches()
125 if (!gadget->is_dualspeed && max > 64) in ep_matches()
130 /* ISO: limit 1023 bytes full speed, 1024 high speed */ in ep_matches()
131 if (ep->maxpacket < max) in ep_matches()
133 if (!gadget->is_dualspeed && max > 1023) in ep_matches()
136 /* BOTH: "high bandwidth" works only at high speed */ in ep_matches()
137 if ((get_unaligned(&desc->wMaxPacketSize) & in ep_matches()
139 if (!gadget->is_dualspeed) in ep_matches()
149 if (isdigit(ep->name[2])) { in ep_matches()
150 u8 num = simple_strtoul(&ep->name[2], NULL, 10); in ep_matches()
151 desc->bEndpointAddress |= num; in ep_matches()
153 } else if (desc->bEndpointAddress & USB_DIR_IN) { in ep_matches()
156 desc->bEndpointAddress = USB_DIR_IN | in_epnum; in ep_matches()
161 desc->bEndpointAddress |= epnum; in ep_matches()
164 /* report (variable) full speed bulk maxpacket */ in ep_matches()
166 int size = ep->maxpacket; in ep_matches()
168 /* min() doesn't work on bitfields with gcc-3.5 */ in ep_matches()
171 put_unaligned(cpu_to_le16(size), &desc->wMaxPacketSize); in ep_matches()
181 list_for_each_entry(ep, &gadget->ep_list, ep_list) { in find_ep()
182 if (0 == strcmp(ep->name, name)) in find_ep()
189 * usb_ep_autoconfig - choose an endpoint matching the descriptor
201 * For example, isochronous endpoints can be autoconfigured for high
203 * Also, high and full speed descriptors will be different.
210 * On success, this returns an un-claimed usb_ep, and modifies the endpoint
212 * is initialized as if the endpoint were used at full speed. To prevent
214 * by assigning ep->driver_data to some non-null value.
226 type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; in usb_ep_autoconfig()
228 /* First, apply chip-specific "best usage" knowledge. in usb_ep_autoconfig()
232 /* ep-e, ep-f are PIO with only 64 byte fifos */ in usb_ep_autoconfig()
233 ep = find_ep(gadget, "ep-e"); in usb_ep_autoconfig()
236 ep = find_ep(gadget, "ep-f"); in usb_ep_autoconfig()
243 ep = find_ep(gadget, "ep3-bulk"); in usb_ep_autoconfig()
247 && (USB_DIR_IN & desc->bEndpointAddress)) { in usb_ep_autoconfig()
249 ep = find_ep(gadget, "ep2-bulk"); in usb_ep_autoconfig()
256 ep = find_ep(gadget, "ep3in-bulk"); in usb_ep_autoconfig()
261 ep = find_ep(gadget, "ep1-bulk"); in usb_ep_autoconfig()
267 * First try standard, common configuration: ep1in-bulk, in usb_ep_autoconfig()
268 * ep2out-bulk, ep3in-int to match other udc drivers to avoid in usb_ep_autoconfig()
272 if ((desc->bEndpointAddress & USB_DIR_IN) && in usb_ep_autoconfig()
275 else if ((desc->bEndpointAddress & USB_DIR_IN) == 0 && in usb_ep_autoconfig()
278 else if ((desc->bEndpointAddress & USB_DIR_IN) && in usb_ep_autoconfig()
288 if (gadget->ops->match_ep) in usb_ep_autoconfig()
289 ep = gadget->ops->match_ep(gadget, desc, NULL); in usb_ep_autoconfig()
292 list_for_each_entry(ep, &gadget->ep_list, ep_list) { in usb_ep_autoconfig()
302 * usb_ep_autoconfig_reset - reset endpoint autoconfig state
307 * state such as ep->driver_data and the record of assigned endpoints
314 list_for_each_entry(ep, &gadget->ep_list, ep_list) { in usb_ep_autoconfig_reset()
315 ep->driver_data = NULL; in usb_ep_autoconfig_reset()