17 #define USB_HUB_RECIP_PORT ( 3 << 0 ) 34 #define USB_HUB_DESCRIPTOR 41 49 #define USB_HUB_DESCRIPTOR_ENHANCED 42 70 #define USB_HUB_PORT_CONNECTION 0 73 #define USB_HUB_PORT_ENABLE 1 76 #define USB_HUB_PORT_RESET 4 79 #define USB_HUB_PORT_POWER 8 82 #define USB_HUB_PORT_LOW_SPEED 9 85 #define USB_HUB_PORT_HIGH_SPEED 10 88 #define USB_HUB_C_PORT_CONNECTION 16 91 #define USB_HUB_C_PORT_ENABLE 17 94 #define USB_HUB_C_PORT_SUSPEND 18 97 #define USB_HUB_C_PORT_OVER_CURRENT 19 100 #define USB_HUB_C_PORT_RESET 20 103 #define USB_HUB_C_PORT_LINK_STATE 25 106 #define USB_HUB_C_PORT_CONFIG_ERROR 26 109 #define USB_HUB_C_FEATURE( bit ) ( 16 + (bit) ) 112 #define USB_HUB_FEATURES \ 113 ( ( 1 << USB_HUB_C_PORT_CONNECTION ) | \ 114 ( 1 << USB_HUB_C_PORT_ENABLE ) | \ 115 ( 1 << USB_HUB_C_PORT_SUSPEND ) | \ 116 ( 1 << USB_HUB_C_PORT_OVER_CURRENT ) | \ 117 ( 1 << USB_HUB_C_PORT_RESET ) ) 120 #define USB_HUB_FEATURES_ENHANCED \ 121 ( ( 1 << USB_HUB_C_PORT_CONNECTION ) | \ 122 ( 1 << USB_HUB_C_PORT_OVER_CURRENT ) | \ 123 ( 1 << USB_HUB_C_PORT_RESET ) | \ 124 ( 1 << USB_HUB_C_PORT_LINK_STATE ) | \ 125 ( 1 << USB_HUB_C_PORT_CONFIG_ERROR ) ) 128 #define USB_HUB_SET_HUB_DEPTH \ 129 ( USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_DEVICE | \ 130 USB_REQUEST_TYPE ( 12 ) ) 133 #define USB_HUB_CLEAR_TT_BUFFER \ 134 ( USB_DIR_OUT | USB_TYPE_CLASS | USB_HUB_RECIP_PORT | \ 135 USB_REQUEST_TYPE ( 8 ) ) 153 len = ( enhanced ?
sizeof (
data->enhanced ) :
sizeof (
data->basic ) );
234 unsigned int endpoint,
unsigned int attributes,
235 unsigned int tt_port ) {
248 #define USB_HUB_TT_SINGLE 1 270 #define USB_HUB_SLOW_START 0x0001 273 #define USB_HUB_SLOW_START_DELAY_MS 500 279 #define USB_HUB_INTR_FILL 4 285 #define USB_HUB_ENABLE_MAX_WAIT_MS 100
struct usb_hub_descriptor_basic basic
Basic USB hub descriptor.
#define USB_HUB_SET_HUB_DEPTH
Set hub depth.
An enhanced USB hub descriptor.
static int usb_hub_get_descriptor(struct usb_device *usb, int enhanced, union usb_hub_descriptor *data)
Get hub descriptor.
struct usb_descriptor_header header
Descriptor header.
unsigned int features
Features.
#define USB_ENDPOINT_ATTR_TYPE_MASK
Endpoint attribute transfer type mask.
#define USB_HUB_DESCRIPTOR
A basic USB hub descriptor.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
struct usb_endpoint intr
Interrupt endpoint.
uint64_t desc
Microcode descriptor list physical address.
#define USB_ENDPOINT_MAX
Maximum endpoint number.
static int usb_hub_clear_tt_buffer(struct usb_device *usb, unsigned int device, unsigned int endpoint, unsigned int attributes, unsigned int tt_port)
Clear transaction translator buffer.
struct usb_hub_descriptor_enhanced enhanced
Enhanced hub descriptor.
uint8_t ports
Number of ports.
static int usb_hub_get_port_status(struct usb_device *usb, unsigned int port, struct usb_hub_port_status *status)
Get port status.
uint8_t delay
Power-on delay (in 2ms intervals.
struct usb_device * usb
USB device.
struct process refill
Interrupt endpoint refill process.
int usb_control(struct usb_device *usb, unsigned int request, unsigned int value, unsigned int index, void *data, size_t len)
Issue USB control transaction.
uint8_t current
Controller current (in mA)
static int usb_hub_set_hub_depth(struct usb_device *usb, unsigned int depth)
Set hub depth.
uint16_t characteristics
Characteristics.
A basic USB hub descriptor.
static int usb_clear_feature(struct usb_device *usb, unsigned int type, unsigned int feature, unsigned int index)
Clear feature.
#define USB_HUB_DESCRIPTOR_ENHANCED
An enhanced USB hub descriptor.
#define USB_HUB_RECIP_PORT
Request recipient is a port.
pseudo_bit_t value[0x00020]
#define USB_TYPE_CLASS
Class-specific request type.
struct usb_hub * hub
USB hub.
static int usb_hub_clear_port_feature(struct usb_device *usb, unsigned int port, unsigned int feature, unsigned int index)
Clear port feature.
uint8_t latency
Header decode latency.
static int usb_set_feature(struct usb_device *usb, unsigned int type, unsigned int feature, unsigned int index)
Set feature.
#define USB_ENDPOINT_IN
Endpoint direction is in.
uint16_t removable
Removable device bitmask.
uint16_t delay
Maximum delay.
#define USB_HUB_CLEAR_TT_BUFFER
Clear transaction translator buffer.
uint16_t changed
Changed status.
Universal Serial Bus (USB)
static int usb_get_status(struct usb_device *usb, unsigned int type, unsigned int index, void *data, size_t len)
Get status.
uint8_t data[48]
Additional event data.
static int usb_hub_set_port_feature(struct usb_device *usb, unsigned int port, unsigned int feature, unsigned int index)
Set port feature.
static int usb_get_descriptor(struct usb_device *usb, unsigned int type, unsigned int desc, unsigned int index, unsigned int language, struct usb_descriptor_header *data, size_t len)
Get USB descriptor.
struct usb_hub_descriptor_basic basic
Basic hub descriptor.
uint16_t current
Current status.
#define NULL
NULL pointer (VOID *)
struct usb_descriptor_header header
Descriptor header.