Lines Matching +full:has +full:- +full:transaction +full:- +full:translator

1 /* SPDX-License-Identifier: GPL-2.0 */
14 #include <linux/errno.h> /* for -ENODEV */
29 /*-------------------------------------------------------------------------*/
32 * Host-side wrappers for standard USB descriptors ... these are parsed
36 * - devices have one (usually) or more configs;
37 * - configs have one (often) or more interfaces;
38 * - interfaces have one (usually) or more settings;
39 * - each interface setting has zero or (usually) more endpoints.
40 * - a SuperSpeed endpoint has a companion descriptor
44 * Devices may also have class-specific or vendor-specific descriptors.
50 * struct usb_host_endpoint - host-side endpoint descriptor and queue
62 * @streams: number of USB-3 streams allocated on the endpoint
82 /* host-side wrapper for one interface setting's parsed descriptors */
181 * struct usb_interface - what usb device drivers talk to
192 * function of the driver, after it has been assigned a minor
197 * @ep_devs_created: endpoint child pseudo-devices exist
199 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
201 * @needs_altsetting0: flag set when a set-interface request for altsetting 0
202 * has been deferred.
203 * @needs_binding: flag set when the driver should be re-probed or unbound
234 * All standards-conformant USB devices that use isochronous endpoints
235 * will use them in non-default settings.
279 return dev_get_drvdata(&intf->dev); in usb_get_intfdata()
283 * usb_set_intfdata() - associate driver-specific data with an interface
288 * driver-specific data with an interface.
290 * Note that there is generally no need to clear the driver-data pointer even
291 * if some drivers do so for historical or implementation-specific reasons.
295 dev_set_drvdata(&intf->dev, data); in usb_set_intfdata()
339 * struct usb_interface_cache - long-term representation of a device interface
342 * @altsetting: variable-length array of interface structures, one for
350 * providing support for the /sys/kernel/debug/usb/devices pseudo-file.
356 /* variable-length array of alternate settings for this interface,
366 * struct usb_host_config - representation of a device's configuration
385 * for example, a dual-speed device would have separate configurations for
386 * full-speed and high-speed operation. The number of configurations
392 * are supposed to be numbered from 0 to desc.bNumInterfaces-1, but a lot
439 __usb_get_extra_descriptor((ifpoint)->extra, \
440 (ifpoint)->extralen, \
443 /* ----------------------------------------------------------------------- */
459 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */
469 * round-robin allocation */
486 unsigned resuming_ports; /* bit array: resuming root-hub ports */
489 struct mon_bus *mon_bus; /* non-null when associated */
490 int monitored; /* non-zero when monitored */
496 /* ----------------------------------------------------------------------- */
542 * PEL and SEL are USB 3.0 Link PM latencies for device-initiated LPM exit.
543 * MEL is the USB 3.0 Link PM latency for host-initiated LPM exit.
555 * Maximum exit latency for a device-initiated LPM transition to bring
565 * receive the data packet. Basically, SEL should be the worse-case
579 * struct usb_device - kernel's representation of a USB device
585 * @rx_lanes: number of rx lanes in use, USB 3.2 adds dual-lane support
586 * @tx_lanes: number of tx lanes in use, USB 3.2 adds dual-lane support
588 * @tt: Transaction Translator info; used with low/full speed dev, highspeed hub
610 * @authorized: policy has said we can use it;
614 * FIXME -- complete doc
640 * @u1_params: exit latencies for USB3 U1 LPM state, and hub-initiated timeout.
641 * @u2_params: exit latencies for USB3 U2 LPM state, and hub-initiated timeout.
647 * parent->hub_delay + wHubDelay + tTPTransmissionDelay (40ns)
652 * Usbcore drivers should not set usbdev->state directly. Instead use
742 return to_usb_device(intf->dev.parent); in __intf_to_usbdev()
746 return to_usb_device((const struct device *)intf->dev.parent); in __intf_to_usbdev_const()
760 * usb_hub_for_each_child - iterate over all child devices on the hub
767 port1 <= hdev->maxchild; \
772 #define usb_lock_device(udev) device_lock(&(udev)->dev)
773 #define usb_unlock_device(udev) device_unlock(&(udev)->dev)
774 #define usb_lock_device_interruptible(udev) device_lock_interruptible(&(udev)->dev)
775 #define usb_trylock_device(udev) device_trylock(&(udev)->dev)
813 pm_runtime_mark_last_busy(&udev->dev); in usb_mark_last_busy()
853 if (udev->speed < USB_SPEED_SUPER || !udev->bos || !udev->bos->ss_cap) in usb_device_supports_ltm()
855 return udev->bos->ss_cap->bmAttributes & USB_LTM_SUPPORT; in usb_device_supports_ltm()
860 return udev && udev->bus && udev->bus->no_sg_constraint; in usb_device_no_sg_constraint()
864 /*-------------------------------------------------------------------------*/
879 /* used these for multi-interface device registration */
884 * usb_interface_claimed - returns true iff an interface is claimed
898 return (iface->dev.driver != NULL); in usb_interface_claimed()
931 * usb_make_path - returns stable device path in the usb tree
942 * reconfigured, by re-cabling a tree of USB devices or by moving USB host
945 * neither does rebooting or re-enumerating. These are more useful identifiers
958 actual = snprintf(buf, size, "usb-%s-%s", dev->bus->bus_name, in usb_make_path()
959 dev->devpath); in usb_make_path()
960 return (actual >= (int)size) ? -1 : actual; in usb_make_path()
963 /*-------------------------------------------------------------------------*/
981 * USB_DEVICE - macro used to describe a specific usb device
993 * USB_DEVICE_VER - describe a specific usb device with a version range
1010 * USB_DEVICE_INTERFACE_CLASS - describe a usb device with a specific interface class
1026 * USB_DEVICE_INTERFACE_PROTOCOL - describe a usb device with a specific interface protocol
1042 * USB_DEVICE_INTERFACE_NUMBER - describe a usb device with a specific interface number
1058 * USB_DEVICE_INFO - macro used to describe a class of usb devices
1073 * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces
1088 * USB_DEVICE_AND_INTERFACE_INFO - describe a specific usb device with a class of usb interfaces
1099 * vendor specific bDeviceClass values, but standards-compliant interfaces.
1111 * USB_VENDOR_AND_INTERFACE_INFO - describe a specific usb vendor with a class of usb interfaces
1121 * vendor specific bDeviceClass values, but standards-compliant interfaces.
1131 /* ----------------------------------------------------------------------- */
1152 * struct usb_driver - identifies USB interface driver to usbcore
1157 * usb_set_intfdata() to associate driver-specific data with the
1160 * return -ENODEV, if genuine IO errors occurred, an appropriate
1163 * because its device has been (or is being) disconnected or the
1173 * Instead, let the resume or reset-resume routine recover from
1176 * @reset_resume: Called when the suspended device has been reset instead
1179 * reset. This routine must not return until the driver has no active
1183 * has been reset
1184 * @shutdown: Called at shut-down time to quiesce the device.
1192 * @driver: The driver-model core driver structure.
1201 * occurs. Device-initiated USB 3.0 link PM will still be allowed.
1251 * struct usb_device_driver - identifies USB device driver to usbcore
1257 * to associate driver-specific data with the device. If unwilling
1260 * because it has been (or is being) disconnected or the driver's
1264 * @choose_configuration: If non-NULL, called instead of the default
1269 * @driver: The driver-model core driver structure.
1302 * struct usb_class_driver - identifies a USB driver that wants to use the USB major number
1334 * module_usb_driver() - Helper macro for registering a USB driver
1356 /* ----------------------------------------------------------------------- */
1363 * urb->transfer_flags:
1368 #define URB_ISO_ASAP 0x0002 /* iso-only; use the first unexpired
1370 #define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */
1372 #define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt
1381 #define URB_DMA_MAP_SINGLE 0x00010000 /* Non-scatter-gather mapping */
1382 #define URB_DMA_MAP_PAGE 0x00020000 /* HCD-unsupported S-G */
1383 #define URB_DMA_MAP_SG 0x00040000 /* HCD-supported S-G */
1384 #define URB_MAP_LOCAL 0x00080000 /* HCD-local-memory mapping */
1386 #define URB_SETUP_MAP_LOCAL 0x00200000 /* HCD-local setup packet */
1387 #define URB_DMA_SG_COMBINED 0x00400000 /* S-G entries were combined */
1410 INIT_LIST_HEAD(&anchor->urb_list); in init_usb_anchor()
1411 init_waitqueue_head(&anchor->wait); in init_usb_anchor()
1412 spin_lock_init(&anchor->lock); in init_usb_anchor()
1418 * struct urb - USB Request Block
1435 * @status: This is read in non-iso completion functions to get the
1438 * each frame is in the fields of the iso_frame-desc.
1463 * @actual_length: This is read in non-iso completion functions, and
1482 * request-specific driver context.
1508 * the device driver is DMA-aware. For example, a device driver might
1541 * to poll for transfers. After the URB has been submitted, the interval
1555 * preceding URB, if that slot has not already expired. If the slot has
1563 * transfer was scheduled. Ranges for frame counter values are HC-specific
1581 * unlinked URBs, and status for all non-ISO transfers. It should not
1587 * When the completion callback is invoked for non-isochronous URBs, the
1617 int status; /* (return) non-ISO status */
1639 /* ----------------------------------------------------------------------- */
1642 * usb_fill_control_urb - initializes a control urb
1675 urb->dev = dev; in usb_fill_control_urb()
1676 urb->pipe = pipe; in usb_fill_control_urb()
1677 urb->setup_packet = setup_packet; in usb_fill_control_urb()
1678 urb->transfer_buffer = transfer_buffer; in usb_fill_control_urb()
1679 urb->transfer_buffer_length = buffer_length; in usb_fill_control_urb()
1680 urb->complete = complete_fn; in usb_fill_control_urb()
1681 urb->context = context; in usb_fill_control_urb()
1685 * usb_fill_bulk_urb - macro to help initialize a bulk urb
1709 urb->dev = dev; in usb_fill_bulk_urb()
1710 urb->pipe = pipe; in usb_fill_bulk_urb()
1711 urb->transfer_buffer = transfer_buffer; in usb_fill_bulk_urb()
1712 urb->transfer_buffer_length = buffer_length; in usb_fill_bulk_urb()
1713 urb->complete = complete_fn; in usb_fill_bulk_urb()
1714 urb->context = context; in usb_fill_bulk_urb()
1718 * usb_fill_int_urb - macro to help initialize a interrupt urb
1750 urb->dev = dev; in usb_fill_int_urb()
1751 urb->pipe = pipe; in usb_fill_int_urb()
1752 urb->transfer_buffer = transfer_buffer; in usb_fill_int_urb()
1753 urb->transfer_buffer_length = buffer_length; in usb_fill_int_urb()
1754 urb->complete = complete_fn; in usb_fill_int_urb()
1755 urb->context = context; in usb_fill_int_urb()
1757 if (dev->speed == USB_SPEED_HIGH || dev->speed >= USB_SPEED_SUPER) { in usb_fill_int_urb()
1761 urb->interval = 1 << (interval - 1); in usb_fill_int_urb()
1763 urb->interval = interval; in usb_fill_int_urb()
1766 urb->start_frame = -1; in usb_fill_int_urb()
1797 * usb_urb_dir_in - check if an URB describes an IN transfer
1800 * Return: 1 if @urb describes an IN transfer (device-to-host),
1805 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_IN; in usb_urb_dir_in()
1809 * usb_urb_dir_out - check if an URB describes an OUT transfer
1812 * Return: 1 if @urb describes an OUT transfer (host-to-device),
1817 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; in usb_urb_dir_out()
1828 /*-------------------------------------------------------------------*
1830 *-------------------------------------------------------------------*/
1896 * struct usb_sg_request - support for scatter/gather I/O
1945 /* ----------------------------------------------------------------------- */
1948 * For various legacy reasons, Linux has a small cookie that's paired with
1953 * - direction: bit 7 (0 = Host-to-Device [Out],
1954 * 1 = Device-to-Host [In] ...
1956 * - device address: bits 8-14 ... bit positions known to uhci-hcd
1957 * - endpoint: bits 15-18 ... bit positions known to uhci-hcd
1958 * - pipe type: bits 30-31 (00 = isochronous, 01 = interrupt,
1986 return (dev->devnum << 8) | (endpoint << 15); in __create_pipe()
2011 eps = usb_pipein(pipe) ? dev->ep_in : dev->ep_out; in usb_pipe_endpoint()
2023 return usb_endpoint_maxp(&ep->desc); in usb_maxpacket()
2031 case -ENOMEM: in usb_translate_errors()
2032 case -ENODEV: in usb_translate_errors()
2033 case -EOPNOTSUPP: in usb_translate_errors()
2036 return -EIO; in usb_translate_errors()