/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * This file holds Hub protocol constants and data structures that are * defined in chapter 11 (Hub Specification) of the USB 2.0 specification. * * It is used/shared between the USB core, the HCDs and couple of other USB * drivers.
*/
#ifndef __LINUX_CH11_H #define __LINUX_CH11_H
#include <linux/types.h> /* __u8 etc */
/* This is arbitrary. * From USB 2.0 spec Table 11-13, offset 7, a hub can * have up to 255 ports. The most yet reported is 10. * Upcoming hardware might raise that limit. * Because the arrays need to add a bit for hub status data, we * use 31, so plus one evens out to four bytes.
*/ #define USB_MAXCHILDREN 31
/* See USB 3.1 spec Table 10-5 */ #define USB_SS_MAXPORTS 15
/* * Port status type for GetPortStatus requests added in USB 3.1 * See USB 3.1 spec Table 10-12
*/ #define HUB_PORT_STATUS 0 #define HUB_PORT_PD_STATUS 1 #define HUB_EXT_PORT_STATUS 2
/* * Hub class requests * See USB 2.0 spec Table 11-16
*/ #define HUB_CLEAR_TT_BUFFER 8 #define HUB_RESET_TT 9 #define HUB_GET_TT_STATE 10 #define HUB_STOP_TT 11
/* * Hub class additional requests defined by USB 3.0 spec * See USB 3.0 spec Table 10-6
*/ #define HUB_SET_DEPTH 12 #define HUB_GET_PORT_ERR_COUNT 13
/* * Hub Class feature numbers * See USB 2.0 spec Table 11-17
*/ #define C_HUB_LOCAL_POWER 0 #define C_HUB_OVER_CURRENT 1
/* USB 3.0 hub remote wake mask bits, see table 10-14 */ #define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8) #define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9) #define USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT (1 << 10)
/* * Hub Status and Hub Change results * See USB 2.0 spec Table 11-19 and Table 11-20 * USB 3.1 extends the port status request and may return 4 additional bytes. * See USB 3.1 spec section 10.16.2.6 Table 10-12 and 10-15
*/ struct usb_port_status {
__le16 wPortStatus;
__le16 wPortChange;
__le32 dwExtPortStatus;
} __attribute__ ((packed));
/* * wPortStatus bit field * See USB 2.0 spec Table 11-21
*/ #define USB_PORT_STAT_CONNECTION 0x0001 #define USB_PORT_STAT_ENABLE 0x0002 #define USB_PORT_STAT_SUSPEND 0x0004 #define USB_PORT_STAT_OVERCURRENT 0x0008 #define USB_PORT_STAT_RESET 0x0010 #define USB_PORT_STAT_L1 0x0020 /* bits 6 to 7 are reserved */ #define USB_PORT_STAT_POWER 0x0100 #define USB_PORT_STAT_LOW_SPEED 0x0200 #define USB_PORT_STAT_HIGH_SPEED 0x0400 #define USB_PORT_STAT_TEST 0x0800 #define USB_PORT_STAT_INDICATOR 0x1000 /* bits 13 to 15 are reserved */
/* * Additions to wPortStatus bit field from USB 3.0 * See USB 3.0 spec Table 10-10
*/ #define USB_PORT_STAT_LINK_STATE 0x01e0 #define USB_SS_PORT_STAT_POWER 0x0200 #define USB_SS_PORT_STAT_SPEED 0x1c00 #define USB_PORT_STAT_SPEED_5GBPS 0x0000 /* Valid only if port is enabled */ /* Bits that are the same from USB 2.0 */ #define USB_SS_PORT_STAT_MASK (USB_PORT_STAT_CONNECTION | \
USB_PORT_STAT_ENABLE | \
USB_PORT_STAT_OVERCURRENT | \
USB_PORT_STAT_RESET)
/* * wHubCharacteristics (masks) * See USB 2.0 spec Table 11-13, offset 3
*/ #define HUB_CHAR_LPSM 0x0003 /* Logical Power Switching Mode mask */ #define HUB_CHAR_COMMON_LPSM 0x0000 /* All ports power control at once */ #define HUB_CHAR_INDV_PORT_LPSM 0x0001 /* per-port power control */ #define HUB_CHAR_NO_LPSM 0x0002 /* no power switching */
#define HUB_CHAR_COMPOUND 0x0004 /* hub is part of a compound device */
/* * Hub Status & Hub Change bit masks * See USB 2.0 spec Table 11-19 and Table 11-20 * Bits 0 and 1 for wHubStatus and wHubChange * Bits 2 to 15 are reserved for both
*/ #define HUB_STATUS_LOCAL_POWER 0x0001 #define HUB_STATUS_OVERCURRENT 0x0002 #define HUB_CHANGE_LOCAL_POWER 0x0001 #define HUB_CHANGE_OVERCURRENT 0x0002
/* * Hub descriptor * See USB 2.0 spec Table 11-13
*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.