Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Use longer reset for root hubs (as told in the s...



details:   https://anonhg.NetBSD.org/src/rev/b9a467ee5351
branches:  trunk
changeset: 517861:b9a467ee5351
user:      augustss <augustss%NetBSD.org@localhost>
date:      Tue Nov 20 16:08:10 2001 +0000

description:
Use longer reset for root hubs (as told in the spec).

diffstat:

 sys/dev/usb/ehci.c |  10 ++++------
 sys/dev/usb/ohci.c |   9 +++++----
 sys/dev/usb/uhci.c |   6 +++---
 sys/dev/usb/usb.h  |   9 +++++++--
 4 files changed, 19 insertions(+), 15 deletions(-)

diffs (134 lines):

diff -r 3326878d0712 -r b9a467ee5351 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Tue Nov 20 16:07:59 2001 +0000
+++ b/sys/dev/usb/ehci.c        Tue Nov 20 16:08:10 2001 +0000
@@ -1,11 +1,9 @@
 /* TODO
 Add intrinfo.
-USB 2 reset is 50 ms?
-Frame lengths of control and bulk are 64, 512?
 Indicator light bit.
 Check 7.1.7.3
 */
-/*     $NetBSD: ehci.c,v 1.12 2001/11/20 14:28:44 augustss Exp $       */
+/*     $NetBSD: ehci.c,v 1.13 2001/11/20 16:08:10 augustss Exp $       */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -54,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.12 2001/11/20 14:28:44 augustss Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.13 2001/11/20 16:08:10 augustss Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1427,11 +1425,11 @@
                        v &= ~ (EHCI_PS_PE | EHCI_PS_PR);
                        EOWRITE4(sc, port, v | EHCI_PS_PR);
                        /* Wait for reset to complete. */
-                       usb_delay_ms(&sc->sc_bus, USB_PORT_RESET_DELAY * 2);
+                       usb_delay_ms(&sc->sc_bus, USB_PORT_ROOT_RESET_DELAY);
                        /* Terminate reset sequence. */
                        EOWRITE4(sc, port, v);
                        /* Wait for HC to complete reset. */
-                       usb_delay_ms(&sc->sc_bus, EHCI_PORT_RESET_COMPLETE * 2);
+                       usb_delay_ms(&sc->sc_bus, EHCI_PORT_RESET_COMPLETE);
                        v = EOREAD4(sc, port);
                        DPRINTF(("ehci after reset, status=0x%08x\n", v));
                        if (v & EHCI_PS_PR) {
diff -r 3326878d0712 -r b9a467ee5351 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Tue Nov 20 16:07:59 2001 +0000
+++ b/sys/dev/usb/ohci.c        Tue Nov 20 16:08:10 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.109 2001/11/20 13:48:32 augustss Exp $      */
+/*     $NetBSD: ohci.c,v 1.110 2001/11/20 16:08:10 augustss Exp $      */
 /*     $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $       */
 
 /*
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.109 2001/11/20 13:48:32 augustss Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.110 2001/11/20 16:08:10 augustss Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2508,8 +2508,9 @@
                        DPRINTFN(5,("ohci_root_ctrl_transfer: reset port %d\n",
                                    index));
                        OWRITE4(sc, port, UPS_RESET);
-                       for (i = 0; i < 10; i++) {
-                               usb_delay_ms(&sc->sc_bus, 10); /* XXX */
+                       for (i = 0; i < 5; i++) {
+                               usb_delay_ms(&sc->sc_bus,
+                                            USB_PORT_ROOT_RESET_DELAY);
                                if ((OREAD4(sc, port) & UPS_RESET) == 0)
                                        break;
                        }
diff -r 3326878d0712 -r b9a467ee5351 sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c        Tue Nov 20 16:07:59 2001 +0000
+++ b/sys/dev/usb/uhci.c        Tue Nov 20 16:08:10 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhci.c,v 1.144 2001/11/20 13:48:32 augustss Exp $      */
+/*     $NetBSD: uhci.c,v 1.145 2001/11/20 16:08:10 augustss Exp $      */
 /*     $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $       */
 
 /*
@@ -49,7 +49,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.144 2001/11/20 13:48:32 augustss Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.145 2001/11/20 16:08:10 augustss Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -3220,7 +3220,7 @@
                case UHF_PORT_RESET:
                        x = URWMASK(UREAD2(sc, port));
                        UWRITE2(sc, port, x | UHCI_PORTSC_PR);
-                       usb_delay_ms(&sc->sc_bus, 50); /*XXX USB v1.1 7.1.7.3 */
+                       usb_delay_ms(&sc->sc_bus, USB_PORT_ROOT_RESET_DELAY);
                        UWRITE2(sc, port, x & ~UHCI_PORTSC_PR);
                        delay(100);
                        x = UREAD2(sc, port);
diff -r 3326878d0712 -r b9a467ee5351 sys/dev/usb/usb.h
--- a/sys/dev/usb/usb.h Tue Nov 20 16:07:59 2001 +0000
+++ b/sys/dev/usb/usb.h Tue Nov 20 16:08:10 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb.h,v 1.55 2001/11/20 13:46:09 augustss Exp $        */
+/*     $NetBSD: usb.h,v 1.56 2001/11/20 16:08:10 augustss Exp $        */
 /*     $FreeBSD: src/sys/dev/usb/usb.h,v 1.14 1999/11/17 22:33:46 n_hibma Exp $        */
 
 /*
@@ -180,6 +180,9 @@
 
 #define USB_MAX_IPACKET                8 /* maximum size of the initial packet */
 
+#define USB_2_MAX_CTRL_PACKET  64
+#define USB_2_MAX_BULK_PACKET  512
+
 typedef struct {
        uByte           bLength;
        uByte           bDescriptorType;
@@ -468,6 +471,7 @@
 #if 0
 /* These are the values from the spec. */
 #define USB_PORT_RESET_DELAY   10  /* ms */
+#define USB_PORT_ROOT_RESET_DELAY 50  /* ms */
 #define USB_PORT_RESET_SETTLE  10  /* ms */
 #define USB_PORT_POWERUP_DELAY 100 /* ms */
 #define USB_SET_ADDRESS_SETTLE 2   /* ms */
@@ -478,8 +482,9 @@
 #else
 /* Allow for marginal (i.e. non-conforming) devices. */
 #define USB_PORT_RESET_DELAY   50  /* ms */
+#define USB_PORT_ROOT_RESET_DELAY 250  /* ms */
 #define USB_PORT_RESET_RECOVERY        50  /* ms */
-#define USB_PORT_POWERUP_DELAY 200 /* ms */
+#define USB_PORT_POWERUP_DELAY 300 /* ms */
 #define USB_SET_ADDRESS_SETTLE 10  /* ms */
 #define USB_RESUME_DELAY       (50*5)  /* ms */
 #define USB_RESUME_WAIT                50  /* ms */



Home | Main Index | Thread Index | Old Index