Lines Matching +full:usb +full:- +full:hub

1 /* SPDX-License-Identifier: GPL-2.0+ */
6 * Adapted for U-Boot driver model
16 #include <linux/usb/ch9.h>
45 * time for a BULK device to react - some are slow.
69 * Companion Descriptor (section 9.6.7 of usb 3.0 spec)
92 * struct usb_device - information about a USB device
94 * With driver model both UCLASS_USB (the USB controllers) and UCLASS_USB_HUB
96 * other hubs and there is always a single root hub for each controller.
98 * dev_get_parent_priv(dev), where dev is a USB device.
105 int devnum; /* Device number on USB bus */
135 * Child devices - if this is a hub device
141 int maxchild; /* Number of ports if hub */
144 /* parent hub, or NULL if this is the root hub */
149 /* slot_id - for xHCI enabled devices */
160 * You can initialize platform's USB host or device
202 * PXA25x can only act as USB device. There are drivers
203 * which works with USB CDC gadgets implementations.
211 * board-specific hardware initialization, called by
212 * usb drivers and u-boot commands
214 * @param index USB controller number
215 * @param init initializes controller as USB host or device
220 * can be used to clean up after failed USB initialization attempt
223 * @param index USB controller number for selective cleanup
250 int usb_init(void); /* initialize the USB Controller */
251 int usb_stop(void); /* stop the USB Controller */
252 int usb_detect_change(void); /* detect if a USB device has been (un)plugged */
281 /* big endian -> little endian conversion */
306 * Calling this entity a "pipe" is glorifying it. A USB pipe
309 * - device number (7 bits)
310 * - endpoint number (4 bits)
311 * - current Data0/1 state (1 bit)
312 * - direction (1 bit)
313 * - speed (2 bits)
314 * - max packet size (2 bits: 8, 16, 32 or 64)
315 * - pipe type (2 bits: control, interrupt, bulk, isochronous)
317 * That's 18 bits. Really. Nothing more. And the USB people have
324 * - max size: bits 0-1 (00 = 8, 01 = 16, 10 = 32, 11 = 64)
325 * - direction: bit 7 (0 = Host-to-Device [Out],
326 * (1 = Device-to-Host [In])
327 * - device: bits 8-14
328 * - endpoint: bits 15-18
329 * - Data0/1: bit 19
330 * - pipe type: bits 30-31 (00 = isochronous, 01 = interrupt,
340 (((dev)->devnum << 8) | ((endpoint) << 15) | \
341 (dev)->maxpacketsize)
342 #define default_pipe(dev) ((dev)->speed << 26)
371 #define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> ep) & 1)
372 #define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << ep))
373 #define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = \
374 ((dev)->toggle[out] & \
379 #define usb_endpoint_halt(dev, ep, out) ((dev)->halted[out] |= (1 << (ep)))
380 #define usb_endpoint_running(dev, ep, out) ((dev)->halted[out] &= ~(1 << (ep)))
381 #define usb_endpoint_halted(dev, ep, out) ((dev)->halted[out] & (1 << (ep)))
400 ((usb_pipeendpoint(pipe) * 2) - \
404 * struct usb_device_id - identifies USB devices for probing and hotplugging
410 * @idVendor: USB vendor ID for a device; numbers are assigned
411 * by the USB forum to its members.
412 * @idProduct: Vendor-assigned product ID.
413 * @bcdDevice_lo: Low end of range of vendor-assigned product version numbers.
419 * by the USB forum. Products may choose to implement classes,
420 * or be vendor-specific. Device classes specify behavior of all
425 * by the USB forum. Products may choose to implement classes,
426 * or be vendor-specific. Interface classes specify behavior only
431 * fixed interface numbers to differentiate between vendor-specific
440 * and provide it to the USB core through their usb_driver structure.
470 /* Used for vendor-specific interface matches */
495 * struct usb_driver_entry - Matches a driver to its usb_device_ids
508 * USB_DEVICE - macro used to describe a specific usb device
509 * @vend: the 16 bit USB Vendor ID
510 * @prod: the 16 bit USB Product ID
527 * Hub Stuff
540 * Hub Device descriptor
541 * USB Hub class device protocols
543 #define USB_HUB_PR_FS 0 /* Full speed hub */
544 #define USB_HUB_PR_HS_NO_TT 0 /* Hi-speed hub without TT */
545 #define USB_HUB_PR_HS_SINGLE_TT 1 /* Hi-speed hub with single TT */
546 #define USB_HUB_PR_HS_MULTI_TT 2 /* Hi-speed hub with multiple TT */
547 #define USB_HUB_PR_SS 3 /* Super speed hub */
555 /* Hub descriptor */
566 /* add 1 bit for hub status change; round to bytes */
586 int overcurrent_count[USB_MAXCHILDREN]; /* Over-current counter */
587 int hub_depth; /* USB 3.0 hub depth */
593 * struct usb_platdata - Platform data about a USB controller
595 * Given a USB controller (UCLASS_USB) dev this is dev_get_platdata(dev)
602 * struct usb_dev_platdata - Platform data about a USB device
604 * Given a USB device dev this structure is dev_get_parent_platdata(dev).
608 * @devnum: Device address on the USB bus
609 * @udev: usb-uclass internal use only do NOT use
618 * to get the usb descriptors before the driver is known, to the
627 /* NULL-terminated list of descriptor pointers */
634 * struct usb_bus_priv - information about the USB controller
636 * Given a USB controller (UCLASS_USB) 'dev', this is
645 * @companion: True if this is a companion controller to another USB
655 * struct usb_emul_platdata - platform data about the USB emulator
657 * Given a USB emulator (UCLASS_USB_EMUL) 'dev', this is
660 * @port1: USB emulator device port number on the parent hub
667 * struct dm_usb_ops - USB controller operations
669 * This defines the operations supoorted on a USB controller. Common
672 * @bus: USB bus (i.e. controller), which is in UCLASS_USB.
673 * @udev: USB device parent data. Controllers are not expected to need
681 * DMA-aligned.
686 * control() - Send a control message
696 * bulk() - Send a bulk message
703 * interrupt() - Send an interrupt message
714 * create_int_queue() - Create and queue interrupt packets
716 * Create and queue @queuesize number of interrupt usb packets of
732 * poll_int_queue() - Poll an interrupt queue for completed packets
747 * destroy_int_queue() - Destroy an interrupt queue
753 * @return 0 if OK, -ve on error
759 * alloc_device() - Allocate a new device context (XHCI)
769 * reset_root_port() - Reset usb root port
774 * update_hub_device() - Update HCD's internal representation of hub
776 * After a hub descriptor is fetched, notify HCD so that its internal
777 * representation of this hub can be updated (xHCI)
782 * get_max_xfer_size() - Get HCD's maximum transfer bytes
785 * in a USB transfer. USB class driver needs to be aware of this.
790 #define usb_get_ops(dev) ((struct dm_usb_ops *)(dev)->driver->ops)
791 #define usb_get_emul_ops(dev) ((struct dm_usb_ops *)(dev)->driver->ops)
794 * usb_get_dev_index() - look up a device index number
797 * in U-Boot device addresses are allocated starting at 1 with no gaps.
802 * @bus: USB bus to check
809 * usb_setup_device() - set up a device ready for use
811 * @dev: USB device pointer. This need not be a real device - it is
812 * common for it to just be a local variable with its ->dev
813 * member (i.e. @dev->dev) set to the parent device and
814 * dev->portnr set to the port number on the hub (1=first)
818 * @return 0 if OK, -ve on error */
823 * usb_hub_is_root_hub() - Test whether a hub device is root hub or not
825 * @hub: USB hub device to test
826 * @return: true if the hub device is root hub, false otherwise.
828 bool usb_hub_is_root_hub(struct udevice *hub);
831 * usb_hub_scan() - Scan a hub and find its devices
833 * @hub: Hub device to scan
835 int usb_hub_scan(struct udevice *hub);
838 * usb_scan_device() - Scan a device on a bus
841 * be enumerated. This may be either the root hub (@parent is a bus) or a
842 * normal device (@parent is a hub)
845 * @port: Hub port number (numbered from 1)
846 * @speed: USB speed to use for this device
848 * @return 0 if OK, -ve on error
854 * usb_get_bus() - Find the bus for a device
861 * the USB stack
866 * usb_select_config() - Set up a device ready for use
871 * This re-reads the device and configuration descriptors and sets the
879 * usb_child_pre_probe() - Pre-probe function for USB devices
881 * This is called on all children of hubs and USB controllers (i.e. UCLASS_USB
887 * device is accessible on the USB bus.
889 * This function is for use only by the internal USB stack.
898 * usb_setup_ehci_gadget() - Set up a USB device as a gadget
900 * TODO(sjg@chromium.org): Tidy this up when USB gadgets can use driver model
902 * This provides a way to tell a controller to start up as a USB device
908 * usb_stor_reset() - Prepare to scan USB storage devices
910 * Empty the list of USB storage devices in preparation for scanning them.
911 * This must be called before a USB scan.
927 * usb_find_usb2_hub_address_port() - Get hub address and port for TT setting
929 * Searches for the first HS hub above the given device. If a
930 * HS hub is found, the hub address and the port the device is
939 * usb_alloc_new_device() - Allocate a new device
942 * is a device pointer, but with legacy USB this pointer is
943 * driver-specific.
944 * @return 0 if OK, -ENOSPC if we have found out of room for new devices
949 * usb_free_device() - Free a partially-inited device
961 * usb_update_hub_device() - Update HCD's internal representation of hub
963 * After a hub descriptor is fetched, notify HCD so that its internal
964 * representation of this hub can be updated.
966 * @dev: Hub device
967 * @return 0 if OK, -ve on error
972 * usb_get_max_xfer_size() - Get HCD's maximum transfer bytes
975 * in a USB transfer. USB class driver needs to be aware of this.
977 * @dev: USB device
979 * @return 0 if OK, -ve on error
984 * usb_emul_setup_device() - Set up a new USB device emulation
987 * the USB emulation uclass about the features of the emulator.
990 * @strings: List of USB string descriptors, terminated by a NULL
992 * @desc_list: List of points or USB descriptors, terminated by NULL.
995 * @return 0 if OK, -ENOSYS if not implemented, other -ve on error
1001 * usb_emul_control() - Send a control packet to an emulator
1004 * @udev: USB device (which the emulator is causing to appear)
1006 * @return 0 if OK, -ve on error
1013 * usb_emul_bulk() - Send a bulk packet to an emulator
1016 * @udev: USB device (which the emulator is causing to appear)
1018 * @return 0 if OK, -ve on error
1024 * usb_emul_int() - Send an interrupt packet to an emulator
1027 * @udev: USB device (which the emulator is causing to appear)
1029 * @return 0 if OK, -ve on error
1035 * usb_emul_find() - Find an emulator for a particular device
1039 * @bus: USB bus (controller)
1041 * @port1: Describes port number on the parent hub
1043 * @return 0 if found, -ve on error
1049 * usb_emul_find_for_dev() - Find an emulator for a particular device
1051 * @dev: USB device to check
1053 * @return 0 if found, -ve on error
1058 * usb_emul_find_descriptor() - Find a USB descriptor of a particular device
1060 * @ptr: a pointer to a list of USB descriptor pointers
1061 * @type: type of USB descriptor to find
1063 * @return a pointer to the USB descriptor found, NULL if not found
1069 * usb_show_tree() - show the USB device tree
1071 * This shows a list of active USB devices along with basic information about