Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Preserve any configuration data that may have be...
details: https://anonhg.NetBSD.org/src/rev/88b53b4b2eb6
branches: trunk
changeset: 580595:88b53b4b2eb6
user: augustss <augustss%NetBSD.org@localhost>
date: Sun May 01 01:03:11 2005 +0000
description:
Preserve any configuration data that may have been set by SMM/BIOS over
chip reset.
>From OpenBSD.
diffstat:
sys/dev/usb/ohci.c | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diffs (99 lines):
diff -r 90b8ceeb2a35 -r 88b53b4b2eb6 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c Sun May 01 00:45:55 2005 +0000
+++ b/sys/dev/usb/ohci.c Sun May 01 01:03:11 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ohci.c,v 1.160 2005/05/01 00:45:55 augustss Exp $ */
+/* $NetBSD: ohci.c,v 1.161 2005/05/01 01:03:11 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */
/*
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.160 2005/05/01 00:45:55 augustss Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.161 2005/05/01 01:03:11 augustss Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -653,7 +653,7 @@
ohci_soft_ed_t *sed, *psed;
usbd_status err;
int i;
- u_int32_t s, ctl, ival, hcr, fm, per, rev, desca;
+ u_int32_t s, ctl, rwc, ival, hcr, fm, per, rev, desca, descb;
DPRINTF(("ohci_init: start\n"));
#if defined(__OpenBSD__)
@@ -758,8 +758,14 @@
}
#endif
+ /* Preserve values programmed by SMM/BIOS but lost over reset. */
+ ctl = OREAD4(sc, OHCI_CONTROL);
+ rwc = ctl & OHCI_RWC;
+ fm = OREAD4(sc, OHCI_FM_INTERVAL);
+ desca = OREAD4(sc, OHCI_RH_DESCRIPTOR_A);
+ descb = OREAD4(sc, OHCI_RH_DESCRIPTOR_B);
+
/* Determine in what context we are running. */
- ctl = OREAD4(sc, OHCI_CONTROL);
if (ctl & OHCI_IR) {
/* SMM active, request change */
DPRINTF(("ohci_init: SMM active, request owner change\n"));
@@ -776,7 +782,7 @@
if ((ctl & OHCI_IR) == 0) {
printf("%s: SMM does not respond, resetting\n",
USBDEVNAME(sc->sc_bus.bdev));
- OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET);
+ OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET | rwc);
goto reset;
}
#if 0
@@ -785,7 +791,7 @@
/* BIOS started controller. */
DPRINTF(("ohci_init: BIOS active\n"));
if ((ctl & OHCI_HCFS_MASK) != OHCI_HCFS_OPERATIONAL) {
- OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_OPERATIONAL);
+ OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_OPERATIONAL | rwc);
usb_delay_ms(&sc->sc_bus, USB_RESUME_DELAY);
}
#endif
@@ -801,11 +807,10 @@
* without it some controllers do not start.
*/
DPRINTF(("%s: resetting\n", USBDEVNAME(sc->sc_bus.bdev)));
- OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET);
+ OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET | rwc);
usb_delay_ms(&sc->sc_bus, USB_BUS_RESET_DELAY);
/* We now own the host controller and the bus has been reset. */
- ival = OHCI_GET_IVAL(OREAD4(sc, OHCI_FM_INTERVAL));
OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_HCR); /* Reset HC */
/* Nominal time for a reset is 10 us. */
@@ -838,7 +843,7 @@
ctl = OREAD4(sc, OHCI_CONTROL);
ctl &= ~(OHCI_CBSR_MASK | OHCI_LES | OHCI_HCFS_MASK | OHCI_IR);
ctl |= OHCI_PLE | OHCI_IE | OHCI_CLE | OHCI_BLE |
- OHCI_RATIO_1_4 | OHCI_HCFS_OPERATIONAL;
+ OHCI_RATIO_1_4 | OHCI_HCFS_OPERATIONAL | rwc;
/* And finally start it! */
OWRITE4(sc, OHCI_CONTROL, ctl);
@@ -847,6 +852,7 @@
* registers that should be set earlier, but that the
* controller ignores when in the SUSPEND state.
*/
+ ival = OHCI_GET_IVAL(fm);
fm = (OREAD4(sc, OHCI_FM_INTERVAL) & OHCI_FIT) ^ OHCI_FIT;
fm |= OHCI_FSMPS(ival) | ival;
OWRITE4(sc, OHCI_FM_INTERVAL, fm);
@@ -854,7 +860,6 @@
OWRITE4(sc, OHCI_PERIODIC_START, per);
/* 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, OHCI_ENABLE_POWER_DELAY);
Home |
Main Index |
Thread Index |
Old Index