git: a11ac66f1c0e - stable/13 - xhci(4): Properly define all basic USB port speeds.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 10 May 2022 08:06:33 UTC
The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=a11ac66f1c0ec4c31f30dd9030c664449ab65b49 commit a11ac66f1c0ec4c31f30dd9030c664449ab65b49 Author: Hans Petter Selasky <hselasky@FreeBSD.org> AuthorDate: 2022-05-03 20:19:35 +0000 Commit: Hans Petter Selasky <hselasky@FreeBSD.org> CommitDate: 2022-05-10 08:05:29 +0000 xhci(4): Properly define all basic USB port speeds. Sponsored by: NVIDIA Networking (cherry picked from commit d730333c80fe8bc60770d093cbf12f473a065ca4) --- sys/dev/usb/controller/xhci.c | 8 ++++---- sys/dev/usb/controller/xhcireg.h | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c index aa8ea280eb8b..cdc73aa13bc8 100644 --- a/sys/dev/usb/controller/xhci.c +++ b/sys/dev/usb/controller/xhci.c @@ -3530,13 +3530,13 @@ xhci_roothub_exec(struct usb_device *udev, i = UPS_PORT_LINK_STATE_SET(XHCI_PS_PLS_GET(v)); switch (XHCI_PS_SPEED_GET(v)) { - case 3: + case XHCI_PS_SPEED_HIGH: i |= UPS_HIGH_SPEED; break; - case 2: + case XHCI_PS_SPEED_LOW: i |= UPS_LOW_SPEED; break; - case 1: + case XHCI_PS_SPEED_FULL: /* FULL speed */ break; default: @@ -3637,7 +3637,7 @@ xhci_roothub_exec(struct usb_device *udev, case UHF_PORT_SUSPEND: DPRINTFN(6, "suspend port %u (LPM=%u)\n", index, i); j = XHCI_PS_SPEED_GET(v); - if ((j < 1) || (j > 3)) { + if (j == 0 || j >= XHCI_PS_SPEED_SS) { /* non-supported speed */ err = USB_ERR_IOERROR; goto done; diff --git a/sys/dev/usb/controller/xhcireg.h b/sys/dev/usb/controller/xhcireg.h index b49bc09a8e7a..38acffaca050 100644 --- a/sys/dev/usb/controller/xhcireg.h +++ b/sys/dev/usb/controller/xhcireg.h @@ -124,6 +124,10 @@ #define XHCI_PS_PLS_SET(x) (((x) & 0xF) << 5) /* RW - port link state */ #define XHCI_PS_PP 0x00000200 /* RW - port power */ #define XHCI_PS_SPEED_GET(x) (((x) >> 10) & 0xF) /* RO - port speed */ +#define XHCI_PS_SPEED_FULL 0x1 /* Full Speed USB */ +#define XHCI_PS_SPEED_LOW 0x2 /* Low Speed USB */ +#define XHCI_PS_SPEED_HIGH 0x3 /* High Speed USB */ +#define XHCI_PS_SPEED_SS 0x4 /* Super Speed USB */ #define XHCI_PS_PIC_GET(x) (((x) >> 14) & 0x3) /* RW - port indicator */ #define XHCI_PS_PIC_SET(x) (((x) & 0x3) << 14) /* RW - port indicator */ #define XHCI_PS_LWS 0x00010000 /* RW - port link state write strobe */