Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Fiddle with over-current protect when turning on...



details:   https://anonhg.NetBSD.org/src/rev/f5637bbd7a91
branches:  trunk
changeset: 481475:f5637bbd7a91
user:      augustss <augustss%NetBSD.org@localhost>
date:      Mon Jan 31 20:17:25 2000 +0000

description:
Fiddle with over-current protect when turning on port power to make
things work for some OHCI controllers.

diffstat:

 sys/dev/usb/ohci.c    |  11 ++++++++---
 sys/dev/usb/ohcireg.h |   5 ++++-
 2 files changed, 12 insertions(+), 4 deletions(-)

diffs (51 lines):

diff -r 8876cb0e2b97 -r f5637bbd7a91 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Mon Jan 31 20:13:07 2000 +0000
+++ b/sys/dev/usb/ohci.c        Mon Jan 31 20:17:25 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.67 2000/01/28 13:32:55 augustss Exp $       */
+/*     $NetBSD: ohci.c,v 1.68 2000/01/31 20:17:25 augustss Exp $       */
 /*     $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $       */
 
 /*
@@ -595,7 +595,7 @@
        ohci_soft_ed_t *sed, *psed;
        usbd_status err;
        int i;
-       u_int32_t s, ctl, ival, hcr, fm, per, rev;
+       u_int32_t s, ctl, ival, hcr, fm, per, rev, desca;
 
        DPRINTF(("ohci_init: start\n"));
 #if defined(__OpenBSD__)
@@ -769,7 +769,12 @@
        per = OHCI_PERIODIC(ival); /* 90% periodic */
        OWRITE4(sc, OHCI_PERIODIC_START, per);
 
-       OWRITE4(sc, OHCI_RH_STATUS, OHCI_LPSC); /* Enable port power */
+       /* Fiddle the No OverCurrent Protection bit to avoid chip bug. */
+       desca = OREAD4(sc, OHCI_RH_DESCRIPTOR_A);
+       OWRITE4(sc, OHCI_RH_DESCRIPTOR_A, desca | OHCI_NOCP);
+       OWRITE4(sc, OHCI_RH_STATUS, OHCI_LPSC); /* Enable port power */
+       usb_delay_ms(&sc->sc_bus, 5);
+       OWRITE4(sc, OHCI_RH_DESCRIPTOR_A, desca);
 
        sc->sc_noport = OHCI_GET_NDP(OREAD4(sc, OHCI_RH_DESCRIPTOR_A));
 
diff -r 8876cb0e2b97 -r f5637bbd7a91 sys/dev/usb/ohcireg.h
--- a/sys/dev/usb/ohcireg.h     Mon Jan 31 20:13:07 2000 +0000
+++ b/sys/dev/usb/ohcireg.h     Mon Jan 31 20:17:25 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohcireg.h,v 1.12 2000/01/28 00:11:38 augustss Exp $    */
+/*     $NetBSD: ohcireg.h,v 1.13 2000/01/31 20:17:26 augustss Exp $    */
 /*     $FreeBSD: src/sys/dev/usb/ohcireg.h,v 1.8 1999/11/17 22:33:40 n_hibma Exp $     */
 
 
@@ -110,6 +110,9 @@
 #define  OHCI_GET_NDP(s)       ((s) & 0xff)
 #define  OHCI_PSM              0x0100     /* Power Switching Mode */
 #define  OHCI_NPS              0x0200     /* No Power Switching */
+#define  OHCI_DT               0x0400     /* Device Type */
+#define  OHCI_OCPM             0x0800     /* Overcurrent Protection Mode */
+#define  OHCI_NOCP             0x1000     /* No Overcurrent Protection */
 #define  OHCI_GET_POTPGT(s)    ((s) >> 24)
 #define OHCI_RH_DESCRIPTOR_B   0x4c
 #define OHCI_RH_STATUS         0x50



Home | Main Index | Thread Index | Old Index