usb: xhci: Rewrite xhci_create_usb3_bos_desc()
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Thu, 11 Mar 2021 03:43:28 +0000 (19:43 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 23 Mar 2021 15:52:35 +0000 (16:52 +0100)
commiteb02aaf21f29ea8706ab3ebdb41cb33a090b3bfc
tree1bdebd43507e5e8e8ad0cf7712f2c7c2fb6e4a7e
parent64364bc912c01b33bba6c22e3ccb849bfca96398
usb: xhci: Rewrite xhci_create_usb3_bos_desc()

The current xhci_create_usb3_bos_desc() uses a static bos u8 array and
various magic numbers and offsets making it difficult to extend support
for USB 3.2. Let's rewrite this entire function to support dual-lane in
USB 3.2.

The hub driver matches the port speed ID from the extended port status
to the SSID of the sublink speed attributes to detect if the device
supports SuperSpeed Plus. Currently we don't provide the default gen1x2
and gen2x2 sublink speed capability descriptor for USB 3.2 roothub. The
USB stack depends on this to detect and match the correct speed.
In addition, if the xHCI host provides Protocol Speed ID (PSI)
capability, then make sure to convert Protocol Speed ID Mantissa and
Exponent (PSIM & PSIE) to lane speed for gen1x2 and gen2x2.

Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/19cd09b03f96346996270579fd27d38b8a6844aa.1615432770.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-hub.c