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

This commit is contained in:
augustss 2001-11-20 16:08:10 +00:00
parent ba119b4fb0
commit e5353fd3b5
4 changed files with 19 additions and 15 deletions

View File

@ -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 @@ Check 7.1.7.3
*/
#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 @@ ehci_root_ctrl_start(usbd_xfer_handle xfer)
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) {

View File

@ -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 @@ ohci_root_ctrl_start(usbd_xfer_handle xfer)
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;
}

View File

@ -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 @@ uhci_root_ctrl_start(usbd_xfer_handle xfer)
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);

View File

@ -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 @@ typedef struct {
#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 @@ typedef struct {
#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 @@ typedef struct {
#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 */