Module Name: src
Committed By: skrll
Date: Sat Oct 24 08:24:16 UTC 2015
Modified Files:
src/sys/dev/usb [nick-nhusb]: xhci.c xhcireg.h
Log Message:
Do the following slightly differently to the diff from t-hash
+ Fix the bug that port feature UHF_PORT_{U1,U2}_TIMEOUT
were never set.
PS_SPEED bits were always cleared.
+ Fix the bug of logic inversion whether port speed is SS
when setting feature UHF_PORT_{U1,U2}_TIMEOUT.
To generate a diff of this commit:
cvs rdiff -u -r1.28.2.44 -r1.28.2.45 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.2.2.4 -r1.2.2.5 src/sys/dev/usb/xhcireg.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.28.2.44 src/sys/dev/usb/xhci.c:1.28.2.45
--- src/sys/dev/usb/xhci.c:1.28.2.44 Wed Oct 21 21:36:08 2015
+++ src/sys/dev/usb/xhci.c Sat Oct 24 08:24:15 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: xhci.c,v 1.28.2.44 2015/10/21 21:36:08 skrll Exp $ */
+/* $NetBSD: xhci.c,v 1.28.2.45 2015/10/24 08:24:15 skrll Exp $ */
/*
* Copyright (c) 2013 Jonathan A. Kollasch
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.28.2.44 2015/10/21 21:36:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.28.2.45 2015/10/24 08:24:15 skrll Exp $");
#include "opt_usb.h"
@@ -2987,6 +2987,7 @@ xhci_roothub_ctrl(struct usbd_bus *bus,
port = XHCI_PORTSC(index);
v = xhci_op_read_4(sc, port);
DPRINTFN(4, "portsc=0x%08x", v, 0, 0, 0);
+ uint32_t v0 = v;
v &= ~XHCI_PS_CLEAR;
switch (value) {
case UHF_PORT_ENABLE:
@@ -3018,7 +3019,7 @@ xhci_roothub_ctrl(struct usbd_bus *bus,
xhci_op_write_4(sc, port, v | XHCI_PS_PRC);
break;
case UHF_PORT_U1_TIMEOUT:
- if (USB_IS_SS(xhci_xspeed2speed(XHCI_PS_SPEED_GET(v)))){
+ if (XHCI_PS_SPEED_GET(v0) != XHCI_PS_SPEED_SS) {
return -1;
}
port = XHCI_PORTPMSC(index);
@@ -3028,7 +3029,7 @@ xhci_roothub_ctrl(struct usbd_bus *bus,
xhci_op_write_4(sc, port, v);
break;
case UHF_PORT_U2_TIMEOUT:
- if (USB_IS_SS(xhci_xspeed2speed(XHCI_PS_SPEED_GET(v)))){
+ if (XHCI_PS_SPEED_GET(v0) != XHCI_PS_SPEED_SS) {
return -1;
}
port = XHCI_PORTPMSC(index);
Index: src/sys/dev/usb/xhcireg.h
diff -u src/sys/dev/usb/xhcireg.h:1.2.2.4 src/sys/dev/usb/xhcireg.h:1.2.2.5
--- src/sys/dev/usb/xhcireg.h:1.2.2.4 Wed Sep 23 13:44:58 2015
+++ src/sys/dev/usb/xhcireg.h Sat Oct 24 08:24:15 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: xhcireg.h,v 1.2.2.4 2015/09/23 13:44:58 skrll Exp $ */
+/* $NetBSD: xhcireg.h,v 1.2.2.5 2015/10/24 08:24:15 skrll Exp $ */
/* $FreeBSD$ */
/*-
@@ -142,6 +142,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_FS 1
+#define XHCI_PS_SPEED_LS 2
+#define XHCI_PS_SPEED_HS 3
+#define XHCI_PS_SPEED_SS 4
#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 */