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
61 * @streams: number of USB-3 streams allocated on the endpoint
80 /* host-side wrapper for one interface setting's parsed descriptors */
179 * struct usb_interface - what usb device drivers talk to
190 * function of the driver, after it has been assigned a minor
195 * @ep_devs_created: endpoint child pseudo-devices exist
197 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
199 * @needs_altsetting0: flag set when a set-interface request for altsetting 0
200 * has been deferred.
201 * @needs_binding: flag set when the driver should be re-probed or unbound
232 * All standards-conformant USB devices that use isochronous endpoints
233 * will use them in non-default settings.
277 return dev_get_drvdata(&intf->dev); in usb_get_intfdata()
281 * usb_set_intfdata() - associate driver-specific data with an interface
286 * driver-specific data with an interface.
288 * Note that there is generally no need to clear the driver-data pointer even
289 * if some drivers do so for historical or implementation-specific reasons.
293 dev_set_drvdata(&intf->dev, data); in usb_set_intfdata()
337 * struct usb_interface_cache - long-term representation of a device interface
340 * @altsetting: variable-length array of interface structures, one for
348 * providing support for the /sys/kernel/debug/usb/devices pseudo-file.
354 /* variable-length array of alternate settings for this interface,
364 * struct usb_host_config - representation of a device's configuration
383 * for example, a dual-speed device would have separate configurations for
384 * full-speed and high-speed operation. The number of configurations
390 * are supposed to be numbered from 0 to desc.bNumInterfaces-1, but a lot
437 __usb_get_extra_descriptor((ifpoint)->extra, \
438 (ifpoint)->extralen, \
441 /* ----------------------------------------------------------------------- */
462 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */
472 * round-robin allocation */
489 unsigned resuming_ports; /* bit array: resuming root-hub ports */
492 struct mon_bus *mon_bus; /* non-null when associated */
493 int monitored; /* non-zero when monitored */
499 /* ----------------------------------------------------------------------- */
539 * PEL and SEL are USB 3.0 Link PM latencies for device-initiated LPM exit.
540 * MEL is the USB 3.0 Link PM latency for host-initiated LPM exit.
552 * Maximum exit latency for a device-initiated LPM transition to bring
562 * receive the data packet. Basically, SEL should be the worse-case
576 * struct usb_device - kernel's representation of a USB device
582 * @rx_lanes: number of rx lanes in use, USB 3.2 adds dual-lane support
583 * @tx_lanes: number of tx lanes in use, USB 3.2 adds dual-lane support
585 * @tt: Transaction Translator info; used with low/full speed dev, highspeed hub
607 * @authorized: policy has said we can use it;
611 * FIXME -- complete doc
636 * @u1_params: exit latencies for USB3 U1 LPM state, and hub-initiated timeout.
637 * @u2_params: exit latencies for USB3 U2 LPM state, and hub-initiated timeout.
643 * parent->hub_delay + wHubDelay + tTPTransmissionDelay (40ns)
648 * Usbcore drivers should not set usbdev->state directly. Instead use
737 return to_usb_device(intf->dev.parent); in __intf_to_usbdev()
741 return to_usb_device((const struct device *)intf->dev.parent); in __intf_to_usbdev_const()
755 * usb_hub_for_each_child - iterate over all child devices on the hub
762 port1 <= hdev->maxchild; \
767 #define usb_lock_device(udev) device_lock(&(udev)->dev)
768 #define usb_unlock_device(udev) device_unlock(&(udev)->dev)
769 #define usb_lock_device_interruptible(udev) device_lock_interruptible(&(udev)->dev)
770 #define usb_trylock_device(udev) device_trylock(&(udev)->dev)
808 pm_runtime_mark_last_busy(&udev->dev); in usb_mark_last_busy()
848 if (udev->speed < USB_SPEED_SUPER || !udev->bos || !udev->bos->ss_cap) in usb_device_supports_ltm()
850 return udev->bos->ss_cap->bmAttributes & USB_LTM_SUPPORT; in usb_device_supports_ltm()
855 return udev && udev->bus && udev->bus->no_sg_constraint; in usb_device_no_sg_constraint()
859 /*-------------------------------------------------------------------------*/
874 /* used these for multi-interface device registration */
879 * usb_interface_claimed - returns true iff an interface is claimed
893 return (iface->dev.driver != NULL); in usb_interface_claimed()
926 * usb_make_path - returns stable device path in the usb tree
937 * reconfigured, by re-cabling a tree of USB devices or by moving USB host
940 * neither does rebooting or re-enumerating. These are more useful identifiers
953 actual = snprintf(buf, size, "usb-%s-%s", dev->bus->bus_name, in usb_make_path()
954 dev->devpath); in usb_make_path()
955 return (actual >= (int)size) ? -1 : actual; in usb_make_path()
958 /*-------------------------------------------------------------------------*/
976 * USB_DEVICE - macro used to describe a specific usb device
988 * USB_DEVICE_VER - describe a specific usb device with a version range
1005 * USB_DEVICE_INTERFACE_CLASS - describe a usb device with a specific interface class
1021 * USB_DEVICE_INTERFACE_PROTOCOL - describe a usb device with a specific interface protocol
1037 * USB_DEVICE_INTERFACE_NUMBER - describe a usb device with a specific interface number
1053 * USB_DEVICE_INFO - macro used to describe a class of usb devices
1068 * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces
1083 * USB_DEVICE_AND_INTERFACE_INFO - describe a specific usb device with a class of usb interfaces
1094 * vendor specific bDeviceClass values, but standards-compliant interfaces.
1106 * USB_VENDOR_AND_INTERFACE_INFO - describe a specific usb vendor with a class of usb interfaces
1116 * vendor specific bDeviceClass values, but standards-compliant interfaces.
1126 /* ----------------------------------------------------------------------- */
1147 * struct usb_driver - identifies USB interface driver to usbcore
1152 * usb_set_intfdata() to associate driver-specific data with the
1155 * return -ENODEV, if genuine IO errors occurred, an appropriate
1158 * because its device has been (or is being) disconnected or the
1168 * Instead, let the resume or reset-resume routine recover from
1171 * @reset_resume: Called when the suspended device has been reset instead
1174 * reset. This routine must not return until the driver has no active
1178 * has been reset
1186 * @driver: The driver-model core driver structure.
1195 * occurs. Device-initiated USB 3.0 link PM will still be allowed.
1243 * struct usb_device_driver - identifies USB device driver to usbcore
1249 * to associate driver-specific data with the device. If unwilling
1252 * because it has been (or is being) disconnected or the driver's
1256 * @choose_configuration: If non-NULL, called instead of the default
1261 * @driver: The driver-model core driver structure.
1295 * struct usb_class_driver - identifies a USB driver that wants to use the USB major number
1327 * module_usb_driver() - Helper macro for registering a USB driver
1349 /* ----------------------------------------------------------------------- */
1356 * urb->transfer_flags:
1361 #define URB_ISO_ASAP 0x0002 /* iso-only; use the first unexpired
1363 #define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */
1365 #define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt
1374 #define URB_DMA_MAP_SINGLE 0x00010000 /* Non-scatter-gather mapping */
1375 #define URB_DMA_MAP_PAGE 0x00020000 /* HCD-unsupported S-G */
1376 #define URB_DMA_MAP_SG 0x00040000 /* HCD-supported S-G */
1377 #define URB_MAP_LOCAL 0x00080000 /* HCD-local-memory mapping */
1379 #define URB_SETUP_MAP_LOCAL 0x00200000 /* HCD-local setup packet */
1380 #define URB_DMA_SG_COMBINED 0x00400000 /* S-G entries were combined */
1403 INIT_LIST_HEAD(&anchor->urb_list); in init_usb_anchor()
1404 init_waitqueue_head(&anchor->wait); in init_usb_anchor()
1405 spin_lock_init(&anchor->lock); in init_usb_anchor()
1411 * struct urb - USB Request Block
1428 * @status: This is read in non-iso completion functions to get the
1431 * each frame is in the fields of the iso_frame-desc.
1456 * @actual_length: This is read in non-iso completion functions, and
1475 * request-specific driver context.
1501 * the device driver is DMA-aware. For example, a device driver might
1534 * to poll for transfers. After the URB has been submitted, the interval
1548 * preceding URB, if that slot has not already expired. If the slot has
1556 * transfer was scheduled. Ranges for frame counter values are HC-specific
1574 * unlinked URBs, and status for all non-ISO transfers. It should not
1580 * When the completion callback is invoked for non-isochronous URBs, the
1610 int status; /* (return) non-ISO status */
1632 /* ----------------------------------------------------------------------- */
1635 * usb_fill_control_urb - initializes a control urb
1668 urb->dev = dev; in usb_fill_control_urb()
1669 urb->pipe = pipe; in usb_fill_control_urb()
1670 urb->setup_packet = setup_packet; in usb_fill_control_urb()
1671 urb->transfer_buffer = transfer_buffer; in usb_fill_control_urb()
1672 urb->transfer_buffer_length = buffer_length; in usb_fill_control_urb()
1673 urb->complete = complete_fn; in usb_fill_control_urb()
1674 urb->context = context; in usb_fill_control_urb()
1678 * usb_fill_bulk_urb - macro to help initialize a bulk urb
1702 urb->dev = dev; in usb_fill_bulk_urb()
1703 urb->pipe = pipe; in usb_fill_bulk_urb()
1704 urb->transfer_buffer = transfer_buffer; in usb_fill_bulk_urb()
1705 urb->transfer_buffer_length = buffer_length; in usb_fill_bulk_urb()
1706 urb->complete = complete_fn; in usb_fill_bulk_urb()
1707 urb->context = context; in usb_fill_bulk_urb()
1711 * usb_fill_int_urb - macro to help initialize a interrupt urb
1743 urb->dev = dev; in usb_fill_int_urb()
1744 urb->pipe = pipe; in usb_fill_int_urb()
1745 urb->transfer_buffer = transfer_buffer; in usb_fill_int_urb()
1746 urb->transfer_buffer_length = buffer_length; in usb_fill_int_urb()
1747 urb->complete = complete_fn; in usb_fill_int_urb()
1748 urb->context = context; in usb_fill_int_urb()
1750 if (dev->speed == USB_SPEED_HIGH || dev->speed >= USB_SPEED_SUPER) { in usb_fill_int_urb()
1754 urb->interval = 1 << (interval - 1); in usb_fill_int_urb()
1756 urb->interval = interval; in usb_fill_int_urb()
1759 urb->start_frame = -1; in usb_fill_int_urb()
1790 * usb_urb_dir_in - check if an URB describes an IN transfer
1793 * Return: 1 if @urb describes an IN transfer (device-to-host),
1798 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_IN; in usb_urb_dir_in()
1802 * usb_urb_dir_out - check if an URB describes an OUT transfer
1805 * Return: 1 if @urb describes an OUT transfer (host-to-device),
1810 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; in usb_urb_dir_out()
1821 /*-------------------------------------------------------------------*
1823 *-------------------------------------------------------------------*/
1889 * struct usb_sg_request - support for scatter/gather I/O
1938 /* ----------------------------------------------------------------------- */
1941 * For various legacy reasons, Linux has a small cookie that's paired with
1946 * - direction: bit 7 (0 = Host-to-Device [Out],
1947 * 1 = Device-to-Host [In] ...
1949 * - device address: bits 8-14 ... bit positions known to uhci-hcd
1950 * - endpoint: bits 15-18 ... bit positions known to uhci-hcd
1951 * - pipe type: bits 30-31 (00 = isochronous, 01 = interrupt,
1979 return (dev->devnum << 8) | (endpoint << 15); in __create_pipe()
2004 eps = usb_pipein(pipe) ? dev->ep_in : dev->ep_out; in usb_pipe_endpoint()
2016 return usb_endpoint_maxp(&ep->desc); in usb_maxpacket()
2024 case -ENOMEM: in usb_translate_errors()
2025 case -ENODEV: in usb_translate_errors()
2026 case -EOPNOTSUPP: in usb_translate_errors()
2029 return -EIO; in usb_translate_errors()