Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/nick-nhusb]: src/sys/dev/usb Do the following slightly differently to th...



details:   https://anonhg.NetBSD.org/src/rev/7521cfc4d321
branches:  nick-nhusb
changeset: 334283:7521cfc4d321
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Oct 24 08:24:15 2015 +0000

description:
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.

diffstat:

 sys/dev/usb/xhci.c    |  9 +++++----
 sys/dev/usb/xhcireg.h |  6 +++++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diffs (64 lines):

diff -r 4221a0004507 -r 7521cfc4d321 sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c        Thu Oct 22 12:07:48 2015 +0000
+++ b/sys/dev/usb/xhci.c        Sat Oct 24 08:24:15 2015 +0000
@@ -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 @@
                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_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_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);
diff -r 4221a0004507 -r 7521cfc4d321 sys/dev/usb/xhcireg.h
--- a/sys/dev/usb/xhcireg.h     Thu Oct 22 12:07:48 2015 +0000
+++ b/sys/dev/usb/xhcireg.h     Sat Oct 24 08:24:15 2015 +0000
@@ -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 */



Home | Main Index | Thread Index | Old Index