summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/controller/ohci.c
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2009-10-26 21:47:16 +0000
committerthompsa <thompsa@FreeBSD.org>2009-10-26 21:47:16 +0000
commite7629ee2bb8183368e57023949d649f501ab1e3a (patch)
tree26d1a93a0f4d08ef8f9a568d58099f7c70932e45 /sys/dev/usb/controller/ohci.c
parent8f17b6fdd9def8c843751b1b5f7eb581d17a8a56 (diff)
downloadFreeBSD-src-e7629ee2bb8183368e57023949d649f501ab1e3a.zip
FreeBSD-src-e7629ee2bb8183368e57023949d649f501ab1e3a.tar.gz
Revert r198500 for now, this will break situations when
hw.pci.usb_early_takeover is set to zero and the SMM release is never done. Pointed out by: marcel
Diffstat (limited to 'sys/dev/usb/controller/ohci.c')
-rw-r--r--sys/dev/usb/controller/ohci.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/sys/dev/usb/controller/ohci.c b/sys/dev/usb/controller/ohci.c
index 2ced676..637b639 100644
--- a/sys/dev/usb/controller/ohci.c
+++ b/sys/dev/usb/controller/ohci.c
@@ -175,6 +175,30 @@ ohci_controller_init(ohci_softc_t *sc)
uint32_t per;
uint32_t desca;
+ /* Determine in what context we are running. */
+ ctl = OREAD4(sc, OHCI_CONTROL);
+ if (ctl & OHCI_IR) {
+ /* SMM active, request change */
+ DPRINTF("SMM active, request owner change\n");
+ OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_OCR);
+ for (i = 0; (i < 100) && (ctl & OHCI_IR); i++) {
+ usb_pause_mtx(NULL, hz / 1000);
+ ctl = OREAD4(sc, OHCI_CONTROL);
+ }
+ if (ctl & OHCI_IR) {
+ device_printf(sc->sc_bus.bdev,
+ "SMM does not respond, resetting\n");
+ OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET);
+ goto reset;
+ }
+ } else {
+ DPRINTF("cold started\n");
+reset:
+ /* controller was cold started */
+ usb_pause_mtx(NULL,
+ USB_MS_TO_TICKS(USB_BUS_RESET_DELAY));
+ }
+
/*
* This reset should not be necessary according to the OHCI spec, but
* without it some controllers do not start.
OpenPOWER on IntegriCloud