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

1 // SPDX-License-Identifier: GPL-2.0+
3 * epautoconf.c -- endpoint autoconfiguration for usb gadget drivers
7 * Ported to U-Boot by: Thomas Smits <ts.smits@gmail.com> and
34 * - ep1, ep2, ... address is fixed, not direction or type
35 * - ep1in, ep2out, ... address and direction are fixed, not type
36 * - ep1-bulk, ep2-bulk, ... address and type are fixed, not direction
37 * - ep1in-bulk, ep2out-iso, ... all three are fixed
38 * - ep-* ... no functionality restrictions
40 * Type suffixes are "-bulk", "-iso", or "-int". Numbers are decimal.
57 if (NULL != ep->driver_data) in ep_matches()
61 type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; in ep_matches()
66 if ('e' != ep->name[0]) in ep_matches()
69 /* type-restriction: "-iso", "-bulk", or "-int". in ep_matches()
70 * direction-restriction: "in", "out". in ep_matches()
72 if ('-' != ep->name[2]) { in ep_matches()
73 tmp = strrchr(ep->name, '-'); in ep_matches()
78 * except the toggle-quirky iso-synch kind in ep_matches()
80 if ('s' == tmp[2]) /* == "-iso" */ in ep_matches()
82 /* for now, avoid PXA "interrupt-in"; in ep_matches()
90 if ('b' != tmp[1]) /* != "-bulk" */ in ep_matches()
94 if ('s' != tmp[2]) /* != "-iso" */ in ep_matches()
98 tmp = ep->name + strlen(ep->name); in ep_matches()
101 /* direction-restriction: "..in-..", "out-.." */ in ep_matches()
102 tmp--; in ep_matches()
104 if (desc->bEndpointAddress & USB_DIR_IN) { in ep_matches()
115 * where it's an output parameter representing the full speed limit. in ep_matches()
116 * the usb spec fixes high speed bulk maxpacket at 512 bytes. in ep_matches()
118 max = 0x7ff & le16_to_cpu(get_unaligned(&desc->wMaxPacketSize)); in ep_matches()
121 /* INT: limit 64 bytes full speed, 1024 high speed */ in ep_matches()
122 if (!gadget->is_dualspeed && max > 64) in ep_matches()
127 /* ISO: limit 1023 bytes full speed, 1024 high speed */ in ep_matches()
128 if (ep->maxpacket < max) in ep_matches()
130 if (!gadget->is_dualspeed && max > 1023) in ep_matches()
133 /* BOTH: "high bandwidth" works only at high speed */ in ep_matches()
134 if ((get_unaligned(&desc->wMaxPacketSize) & in ep_matches()
136 if (!gadget->is_dualspeed) in ep_matches()
146 if (isdigit(ep->name[2])) { in ep_matches()
147 u8 num = simple_strtoul(&ep->name[2], NULL, 10); in ep_matches()
148 desc->bEndpointAddress |= num; in ep_matches()
150 } else if (desc->bEndpointAddress & USB_DIR_IN) { in ep_matches()
153 desc->bEndpointAddress = USB_DIR_IN | in_epnum; in ep_matches()
158 desc->bEndpointAddress |= epnum; in ep_matches()
161 /* report (variable) full speed bulk maxpacket */ in ep_matches()
163 int size = ep->maxpacket; in ep_matches()
165 /* min() doesn't work on bitfields with gcc-3.5 */ in ep_matches()
168 put_unaligned(cpu_to_le16(size), &desc->wMaxPacketSize); in ep_matches()
178 list_for_each_entry(ep, &gadget->ep_list, ep_list) { in find_ep()
179 if (0 == strcmp(ep->name, name)) in find_ep()
186 * usb_ep_autoconfig - choose an endpoint matching the descriptor
198 * For example, isochronous endpoints can be autoconfigured for high
200 * Also, high and full speed descriptors will be different.
207 * On success, this returns an un-claimed usb_ep, and modifies the endpoint
209 * is initialized as if the endpoint were used at full speed. To prevent
211 * by assigning ep->driver_data to some non-null value.
223 type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; in usb_ep_autoconfig()
225 /* First, apply chip-specific "best usage" knowledge. in usb_ep_autoconfig()
229 /* ep-e, ep-f are PIO with only 64 byte fifos */ in usb_ep_autoconfig()
230 ep = find_ep(gadget, "ep-e"); in usb_ep_autoconfig()
233 ep = find_ep(gadget, "ep-f"); in usb_ep_autoconfig()
240 ep = find_ep(gadget, "ep3-bulk"); in usb_ep_autoconfig()
244 && (USB_DIR_IN & desc->bEndpointAddress)) { in usb_ep_autoconfig()
246 ep = find_ep(gadget, "ep2-bulk"); in usb_ep_autoconfig()
253 ep = find_ep(gadget, "ep3in-bulk"); in usb_ep_autoconfig()
258 ep = find_ep(gadget, "ep1-bulk"); in usb_ep_autoconfig()
264 * First try standard, common configuration: ep1in-bulk, in usb_ep_autoconfig()
265 * ep2out-bulk, ep3in-int to match other udc drivers to avoid in usb_ep_autoconfig()
269 if ((desc->bEndpointAddress & USB_DIR_IN) && in usb_ep_autoconfig()
272 else if ((desc->bEndpointAddress & USB_DIR_IN) == 0 && in usb_ep_autoconfig()
275 else if ((desc->bEndpointAddress & USB_DIR_IN) && in usb_ep_autoconfig()
286 list_for_each_entry(ep, &gadget->ep_list, ep_list) { in usb_ep_autoconfig()
296 * usb_ep_autoconfig_reset - reset endpoint autoconfig state
301 * state such as ep->driver_data and the record of assigned endpoints
308 list_for_each_entry(ep, &gadget->ep_list, ep_list) { in usb_ep_autoconfig_reset()
309 ep->driver_data = NULL; in usb_ep_autoconfig_reset()