usb: Support USB 3.1 extended port status request

usb 3.1 extend the hub get-port-status request by adding different
request types. the new request types return 4 additional bytes called
extended port status, these bytes are returned after the regular
portstatus and portchange values.

The extended port status contains a speed ID for the currently used
sublink speed. A table of supported Speed IDs with details about the link
is provided by the hub in the device descriptor BOS SuperSpeedPlus
device capability Sublink Speed Attributes.

Support this new request. Ask for the extended port status after port
reset if hub supports USB 3.1. If link is running at SuperSpeedPlus
set the device speed to USB_SPEED_SUPER_PLUS

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Mathias Nyman 2015-12-10 09:59:29 +02:00 committed by Greg Kroah-Hartman
parent 9508e3b7a7
commit 0cdd49a1d1
4 changed files with 96 additions and 10 deletions

View file

@ -29,6 +29,14 @@
#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
/*
* 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
@ -97,10 +105,13 @@
/*
* 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));
/*
@ -172,6 +183,16 @@ struct usb_port_status {
#define USB_PORT_STAT_C_LINK_STATE 0x0040
#define USB_PORT_STAT_C_CONFIG_ERROR 0x0080
/*
* USB 3.1 dwExtPortStatus field masks
* See USB 3.1 spec 10.16.2.6.3 Table 10-15
*/
#define USB_EXT_PORT_STAT_RX_SPEED_ID 0x0000000f
#define USB_EXT_PORT_STAT_TX_SPEED_ID 0x000000f0
#define USB_EXT_PORT_STAT_RX_LANES 0x00000f00
#define USB_EXT_PORT_STAT_TX_LANES 0x0000f000
/*
* wHubCharacteristics (masks)
* See USB 2.0 spec Table 11-13, offset 3