Commit fc71ff75 authored by Andiry Xu's avatar Andiry Xu Committed by Greg Kroah-Hartman

xHCI: Check host USB2 LPM capability

Check the host's USB2 LPM capability.

USB2 software LPM support is optional for xHCI 0.96 hosts. xHCI 1.0 hosts
should support software LPM, and may support hardware LPM.
Signed-off-by: default avatarAndiry Xu <andiry.xu@amd.com>
Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 6fd45621
...@@ -65,6 +65,12 @@ ...@@ -65,6 +65,12 @@
/* bits 1:2, 5:12, and 17:19 need to be preserved; bits 21:28 should be zero */ /* bits 1:2, 5:12, and 17:19 need to be preserved; bits 21:28 should be zero */
#define XHCI_LEGACY_DISABLE_SMI ((0x3 << 1) + (0xff << 5) + (0x7 << 17)) #define XHCI_LEGACY_DISABLE_SMI ((0x3 << 1) + (0xff << 5) + (0x7 << 17))
/* USB 2.0 xHCI 0.96 L1C capability - section 7.2.2.1.3.2 */
#define XHCI_L1C (1 << 16)
/* USB 2.0 xHCI 1.0 hardware LMP capability - section 7.2.2.1.3.2 */
#define XHCI_HLC (1 << 19)
/* command register values to disable interrupts and halt the HC */ /* command register values to disable interrupts and halt the HC */
/* start/stop HC execution - do not write unless HC is halted*/ /* start/stop HC execution - do not write unless HC is halted*/
#define XHCI_CMD_RUN (1 << 0) #define XHCI_CMD_RUN (1 << 0)
......
...@@ -1959,6 +1959,23 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports, ...@@ -1959,6 +1959,23 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports,
if (port_offset == 0 || (port_offset + port_count - 1) > num_ports) if (port_offset == 0 || (port_offset + port_count - 1) > num_ports)
/* WTF? "Valid values are ‘1’ to MaxPorts" */ /* WTF? "Valid values are ‘1’ to MaxPorts" */
return; return;
/* Check the host's USB2 LPM capability */
if ((xhci->hci_version == 0x96) && (major_revision != 0x03) &&
(temp & XHCI_L1C)) {
xhci_dbg(xhci, "xHCI 0.96: support USB2 software lpm\n");
xhci->sw_lpm_support = 1;
}
if ((xhci->hci_version >= 0x100) && (major_revision != 0x03)) {
xhci_dbg(xhci, "xHCI 1.0: support USB2 software lpm\n");
xhci->sw_lpm_support = 1;
if (temp & XHCI_HLC) {
xhci_dbg(xhci, "xHCI 1.0: support USB2 hardware lpm\n");
xhci->hw_lpm_support = 1;
}
}
port_offset--; port_offset--;
for (i = port_offset; i < (port_offset + port_count); i++) { for (i = port_offset; i < (port_offset + port_count); i++) {
/* Duplicate entry. Ignore the port if the revisions differ. */ /* Duplicate entry. Ignore the port if the revisions differ. */
......
...@@ -1459,6 +1459,10 @@ struct xhci_hcd { ...@@ -1459,6 +1459,10 @@ struct xhci_hcd {
/* Array of pointers to USB 2.0 PORTSC registers */ /* Array of pointers to USB 2.0 PORTSC registers */
__le32 __iomem **usb2_ports; __le32 __iomem **usb2_ports;
unsigned int num_usb2_ports; unsigned int num_usb2_ports;
/* support xHCI 0.96 spec USB2 software LPM */
unsigned sw_lpm_support:1;
/* support xHCI 1.0 spec USB2 hardware LPM */
unsigned hw_lpm_support:1;
}; };
/* convert between an HCD pointer and the corresponding EHCI_HCD */ /* convert between an HCD pointer and the corresponding EHCI_HCD */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment