Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Support the OHCI in the NS "SUPERIO" chip as found i...



details:   https://anonhg.NetBSD.org/src/rev/407e3912a9c8
branches:  trunk
changeset: 326408:407e3912a9c8
user:      skrll <skrll%NetBSD.org@localhost>
date:      Tue Jan 28 17:24:42 2014 +0000

description:
Support the OHCI in the NS "SUPERIO" chip as found in hppa machines by
twiddling the same bits as Linux.

diffstat:

 sys/dev/pci/ohci_pci.c |  10 ++++++++--
 sys/dev/usb/ohci.c     |  16 ++++++++++++++--
 sys/dev/usb/ohcireg.h  |   3 ++-
 sys/dev/usb/ohcivar.h  |   5 ++++-
 4 files changed, 28 insertions(+), 6 deletions(-)

diffs (111 lines):

diff -r 128ce60c55ce -r 407e3912a9c8 sys/dev/pci/ohci_pci.c
--- a/sys/dev/pci/ohci_pci.c    Tue Jan 28 16:45:25 2014 +0000
+++ b/sys/dev/pci/ohci_pci.c    Tue Jan 28 17:24:42 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci_pci.c,v 1.50 2012/06/10 06:15:53 mrg Exp $        */
+/*     $NetBSD: ohci_pci.c,v 1.51 2014/01/28 17:24:42 skrll Exp $      */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci_pci.c,v 1.50 2012/06/10 06:15:53 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci_pci.c,v 1.51 2014/01/28 17:24:42 skrll Exp $");
 
 #include "ehci.h"
 
@@ -45,6 +45,7 @@
 #include <sys/bus.h>
 
 #include <dev/pci/pcivar.h>
+#include <dev/pci/pcidevs.h>
 #include <dev/pci/usb_pci.h>
 
 #include <dev/usb/usb.h>
@@ -94,6 +95,11 @@
        sc->sc.sc_dev = self;
        sc->sc.sc_bus.hci_private = sc;
 
+       if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_NS &&
+           PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_NS_USB) {
+               sc->sc.sc_flags = OHCIF_SUPERIO;
+       }
+
        pci_aprint_devinfo(pa, "USB Controller");
 
        /* check if memory space access is enabled */
diff -r 128ce60c55ce -r 407e3912a9c8 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Tue Jan 28 16:45:25 2014 +0000
+++ b/sys/dev/usb/ohci.c        Tue Jan 28 17:24:42 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.248 2013/12/16 10:04:20 skrll Exp $ */
+/*     $NetBSD: ohci.c,v 1.249 2014/01/28 17:24:42 skrll Exp $ */
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.248 2013/12/16 10:04:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.249 2014/01/28 17:24:42 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -859,6 +859,18 @@
        per = OHCI_PERIODIC(ival); /* 90% periodic */
        OWRITE4(sc, OHCI_PERIODIC_START, per);
 
+       if (sc->sc_flags & OHCIF_SUPERIO) {
+               /* no overcurrent protection */
+               desca |= OHCI_NOCP;
+               /*
+                * Clear NoPowerSwitching and PowerOnToPowerGoodTime meaning
+                * that
+                *  - ports are always power switched
+                *  - don't wait for powered root hub port
+                */
+               desca &= ~(__SHIFTIN(0xff, OHCI_POTPGT_MASK) | OHCI_NPS);
+       }
+
        /* Fiddle the No OverCurrent Protection bit to avoid chip bug. */
        OWRITE4(sc, OHCI_RH_DESCRIPTOR_A, desca | OHCI_NOCP);
        OWRITE4(sc, OHCI_RH_STATUS, OHCI_LPSC); /* Enable port power */
diff -r 128ce60c55ce -r 407e3912a9c8 sys/dev/usb/ohcireg.h
--- a/sys/dev/usb/ohcireg.h     Tue Jan 28 16:45:25 2014 +0000
+++ b/sys/dev/usb/ohcireg.h     Tue Jan 28 17:24:42 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohcireg.h,v 1.23 2008/04/28 20:23:59 martin Exp $      */
+/*     $NetBSD: ohcireg.h,v 1.24 2014/01/28 17:24:42 skrll Exp $       */
 /*     $FreeBSD: src/sys/dev/usb/ohcireg.h,v 1.8 1999/11/17 22:33:40 n_hibma Exp $     */
 
 
@@ -107,6 +107,7 @@
 #define  OHCI_OCPM             0x0800     /* Overcurrent Protection Mode */
 #define  OHCI_NOCP             0x1000     /* No Overcurrent Protection */
 #define  OHCI_GET_POTPGT(s)    ((s) >> 24)
+#define  OHCI_POTPGT_MASK      0xff000000
 #define OHCI_RH_DESCRIPTOR_B   0x4c
 #define OHCI_RH_STATUS         0x50
 #define  OHCI_LPS              0x00000001 /* Local Power Status */
diff -r 128ce60c55ce -r 407e3912a9c8 sys/dev/usb/ohcivar.h
--- a/sys/dev/usb/ohcivar.h     Tue Jan 28 16:45:25 2014 +0000
+++ b/sys/dev/usb/ohcivar.h     Tue Jan 28 17:24:42 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohcivar.h,v 1.54 2013/01/29 00:00:15 christos Exp $    */
+/*     $NetBSD: ohcivar.h,v 1.55 2014/01/28 17:24:42 skrll Exp $       */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -117,6 +117,9 @@
 #define        OHCI_BIG_ENDIAN         1       /* big endian OHCI? never seen it */
 #define        OHCI_HOST_ENDIAN        2       /* if OHCI always matches CPU */
 
+       int sc_flags;
+#define OHCIF_SUPERIO          0x0001
+
        char sc_softwake;
        kcondvar_t sc_softwake_cv;
 



Home | Main Index | Thread Index | Old Index