Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Detect USB 3.1.
details: https://anonhg.NetBSD.org/src/rev/7256b9c56b91
branches: trunk
changeset: 833519:7256b9c56b91
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Fri Jun 29 17:48:24 2018 +0000
description:
Detect USB 3.1.
diffstat:
sys/arch/arm/nvidia/tegra_xusb.c | 27 +++++++++++++++++++++++++--
sys/dev/fdt/dwc3_fdt.c | 5 +++--
sys/dev/pci/xhci_pci.c | 28 +++++++++++++++++++++++++---
sys/dev/usb/usb.c | 8 ++++++--
sys/dev/usb/usbdivar.h | 5 +++--
sys/dev/usb/xhci.c | 5 ++---
sys/dev/usb/xhcireg.h | 3 ++-
7 files changed, 66 insertions(+), 15 deletions(-)
diffs (228 lines):
diff -r 917c588b472e -r 7256b9c56b91 sys/arch/arm/nvidia/tegra_xusb.c
--- a/sys/arch/arm/nvidia/tegra_xusb.c Fri Jun 29 12:34:13 2018 +0000
+++ b/sys/arch/arm/nvidia/tegra_xusb.c Fri Jun 29 17:48:24 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_xusb.c,v 1.12 2017/09/26 16:12:45 jmcneill Exp $ */
+/* $NetBSD: tegra_xusb.c,v 1.13 2018/06/29 17:48:24 msaitoh Exp $ */
/*
* Copyright (c) 2016 Jonathan A. Kollasch
@@ -30,7 +30,7 @@
#include "opt_tegra.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_xusb.c,v 1.12 2017/09/26 16:12:45 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_xusb.c,v 1.13 2018/06/29 17:48:24 msaitoh Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -417,6 +417,29 @@
val = csb_read_4(psc, XUSB_CSB_FALCON_CPUCTL_REG);
DPRINTF(sc->sc_dev, "XUSB_FALC_CPUCTL 0x%x\n", val);
+ val = bus_space_read_4(bst, psc->sc_bsh_fpci, PCI_USBREV)
+ & PCI_USBREV_MASK;
+ switch (val) {
+ case PCI_USBREV_3_0:
+ sc->sc_bus.ub_revision = USBREV_3_0;
+ break;
+ case PCI_USBREV_3_1:
+ sc->sc_bus.ub_revision = USBREV_3_1;
+ break;
+ default:
+ if (val < PCI_USBREV_3_0) {
+ aprint_error_dev(self, "Unknown revision (%02x)\n",
+ usbrev);
+ sc->sc_bus.ub_revision = USBREV_UNKNOWN;
+ } else {
+ /* Default to the latest revision */
+ aprint_normal_dev(self,
+ "Unknown revision (%02x). Set to 3.1.\n", usbrev);
+ sc->sc_bus.ub_revision = USBREV_3_1;
+ }
+ break;
+ }
+
error = xhci_init(sc);
if (error) {
aprint_error_dev(self, "init failed, error=%d\n", error);
diff -r 917c588b472e -r 7256b9c56b91 sys/dev/fdt/dwc3_fdt.c
--- a/sys/dev/fdt/dwc3_fdt.c Fri Jun 29 12:34:13 2018 +0000
+++ b/sys/dev/fdt/dwc3_fdt.c Fri Jun 29 17:48:24 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc3_fdt.c,v 1.2 2018/06/21 10:45:25 jmcneill Exp $ */
+/* $NetBSD: dwc3_fdt.c,v 1.3 2018/06/29 17:48:24 msaitoh Exp $ */
/*-
* Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.2 2018/06/21 10:45:25 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.3 2018/06/29 17:48:24 msaitoh Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -268,6 +268,7 @@
}
aprint_normal_dev(self, "interrupting on %s\n", intrstr);
+ sc->sc_bus.ub_revision = USBREV_3_0;
error = xhci_init(sc);
if (error) {
aprint_error_dev(self, "init failed, error = %d\n", error);
diff -r 917c588b472e -r 7256b9c56b91 sys/dev/pci/xhci_pci.c
--- a/sys/dev/pci/xhci_pci.c Fri Jun 29 12:34:13 2018 +0000
+++ b/sys/dev/pci/xhci_pci.c Fri Jun 29 17:48:24 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xhci_pci.c,v 1.12 2018/04/09 16:21:10 jakllsch Exp $ */
+/* $NetBSD: xhci_pci.c,v 1.13 2018/06/29 17:48:24 msaitoh Exp $ */
/* OpenBSD: xhci_pci.c,v 1.4 2014/07/12 17:38:51 yuo Exp */
/*
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.12 2018/04/09 16:21:10 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.13 2018/06/29 17:48:24 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_xhci_pci.h"
@@ -125,7 +125,7 @@
const pcitag_t tag = pa->pa_tag;
pci_intr_type_t intr_type;
char const *intrstr;
- pcireg_t csr, memtype;
+ pcireg_t csr, memtype, usbrev;
int err;
uint32_t hccparams;
char intrbuf[PCI_INTRSTR_LEN];
@@ -217,6 +217,28 @@
}
aprint_normal_dev(self, "interrupting at %s\n", intrstr);
+ usbrev = pci_conf_read(pc, tag, PCI_USBREV) & PCI_USBREV_MASK;
+ switch (usbrev) {
+ case PCI_USBREV_3_0:
+ sc->sc_bus.ub_revision = USBREV_3_0;
+ break;
+ case PCI_USBREV_3_1:
+ sc->sc_bus.ub_revision = USBREV_3_1;
+ break;
+ default:
+ if (usbrev < PCI_USBREV_3_0) {
+ aprint_error_dev(self, "Unknown revision (%02x)\n",
+ usbrev);
+ sc->sc_bus.ub_revision = USBREV_UNKNOWN;
+ } else {
+ /* Default to the latest revision */
+ aprint_normal_dev(self,
+ "Unknown revision (%02x). Set to 3.1.\n", usbrev);
+ sc->sc_bus.ub_revision = USBREV_3_1;
+ }
+ break;
+ }
+
/* Intel chipset requires SuperSpeed enable and USB2 port routing */
switch (PCI_VENDOR(pa->pa_id)) {
case PCI_VENDOR_INTEL:
diff -r 917c588b472e -r 7256b9c56b91 sys/dev/usb/usb.c
--- a/sys/dev/usb/usb.c Fri Jun 29 12:34:13 2018 +0000
+++ b/sys/dev/usb/usb.c Fri Jun 29 17:48:24 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb.c,v 1.168 2017/10/28 00:37:12 pgoyette Exp $ */
+/* $NetBSD: usb.c,v 1.169 2018/06/29 17:48:24 msaitoh Exp $ */
/*
* Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.168 2017/10/28 00:37:12 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.169 2018/06/29 17:48:24 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -245,6 +245,7 @@
case USBREV_1_1:
case USBREV_2_0:
case USBREV_3_0:
+ case USBREV_3_1:
break;
default:
aprint_error(", not supported\n");
@@ -332,6 +333,9 @@
case USBREV_3_0:
speed = USB_SPEED_SUPER;
break;
+ case USBREV_3_1:
+ speed = USB_SPEED_SUPER_PLUS;
+ break;
default:
panic("usb_doattach");
}
diff -r 917c588b472e -r 7256b9c56b91 sys/dev/usb/usbdivar.h
--- a/sys/dev/usb/usbdivar.h Fri Jun 29 12:34:13 2018 +0000
+++ b/sys/dev/usb/usbdivar.h Fri Jun 29 17:48:24 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdivar.h,v 1.115 2018/04/19 21:50:09 christos Exp $ */
+/* $NetBSD: usbdivar.h,v 1.116 2018/06/29 17:48:24 msaitoh Exp $ */
/*
* Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -153,7 +153,8 @@
#define USBREV_1_1 3
#define USBREV_2_0 4
#define USBREV_3_0 5
-#define USBREV_STR { "unknown", "pre 1.0", "1.0", "1.1", "2.0", "3.0" }
+#define USBREV_3_1 6
+#define USBREV_STR { "unknown", "pre 1.0", "1.0", "1.1", "2.0", "3.0", "3.1" }
const struct usbd_bus_methods
*ub_methods;
diff -r 917c588b472e -r 7256b9c56b91 sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c Fri Jun 29 12:34:13 2018 +0000
+++ b/sys/dev/usb/xhci.c Fri Jun 29 17:48:24 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xhci.c,v 1.92 2018/05/14 00:26:02 jakllsch Exp $ */
+/* $NetBSD: xhci.c,v 1.93 2018/06/29 17:48:24 msaitoh Exp $ */
/*
* Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.92 2018/05/14 00:26:02 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.93 2018/06/29 17:48:24 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -911,7 +911,6 @@
/* Set up the bus struct for the usb 3 and usb 2 buses */
sc->sc_bus.ub_methods = &xhci_bus_methods;
sc->sc_bus.ub_pipesize = sizeof(struct xhci_pipe);
- sc->sc_bus.ub_revision = USBREV_3_0;
sc->sc_bus.ub_usedma = true;
sc->sc_bus.ub_hcpriv = sc;
diff -r 917c588b472e -r 7256b9c56b91 sys/dev/usb/xhcireg.h
--- a/sys/dev/usb/xhcireg.h Fri Jun 29 12:34:13 2018 +0000
+++ b/sys/dev/usb/xhcireg.h Fri Jun 29 17:48:24 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xhcireg.h,v 1.10 2018/04/23 19:55:00 jdolecek Exp $ */
+/* $NetBSD: xhcireg.h,v 1.11 2018/06/29 17:48:24 msaitoh Exp $ */
/*-
* Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
@@ -35,6 +35,7 @@
#define PCI_USBREV 0x60 /* RO USB protocol revision */
#define PCI_USBREV_MASK 0xFF
#define PCI_USBREV_3_0 0x30 /* USB 3.0 */
+#define PCI_USBREV_3_1 0x31 /* USB 3.1 */
#define PCI_XHCI_FLADJ 0x61 /* RW frame length adjust */
Home |
Main Index |
Thread Index |
Old Index