From: mpi Date: Mon, 5 Jan 2015 12:38:16 +0000 (+0000) Subject: Prevent a race condition upon resume by adding a supplementary delay. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3d32aa6738d01e53390f5e25f92a698c95de62d1;p=openbsd Prevent a race condition upon resume by adding a supplementary delay. This is a workaround needed at least by Renesas controllers. I didn't find any documentation about this issue and I guess other open source xHCI implementations do not see this race because they do much more work upon resume. Thanks to Remi Locherer for reporting this issue on bugs@. --- diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c index b2f4a3c473e..f79f4b48144 100644 --- a/sys/dev/usb/xhci.c +++ b/sys/dev/usb/xhci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xhci.c,v 1.51 2015/01/04 20:10:08 mpi Exp $ */ +/* $OpenBSD: xhci.c,v 1.52 2015/01/05 12:38:16 mpi Exp $ */ /* * Copyright (c) 2014 Martin Pieuchot @@ -515,6 +515,10 @@ xhci_activate(struct device *self, int act) xhci_reset(sc); xhci_ring_reset(sc, &sc->sc_cmd_ring); xhci_ring_reset(sc, &sc->sc_evt_ring); + + /* Renesas controllers, at least, need more time to resume. */ + usb_delay_ms(&sc->sc_bus, USB_RESUME_WAIT); + xhci_config(sc); sc->sc_bus.use_polling--;