Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb xhci: shrink port reset delay
details: https://anonhg.NetBSD.org/src/rev/c888bb849bd7
branches: trunk
changeset: 1024126:c888bb849bd7
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Oct 10 20:10:12 2021 +0000
description:
xhci: shrink port reset delay
Instead of waiting for USB_PORT_ROOT_RESET_DELAY (250ms) before checking
the port reset status, poll the PORTSC register and return early if the
reset has completed.
diffstat:
sys/dev/usb/xhci.c | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
diffs (45 lines):
diff -r a921d66703c6 -r c888bb849bd7 sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c Sun Oct 10 19:17:31 2021 +0000
+++ b/sys/dev/usb/xhci.c Sun Oct 10 20:10:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xhci.c,v 1.148 2021/08/17 22:00:32 andvar Exp $ */
+/* $NetBSD: xhci.c,v 1.149 2021/10/10 20:10:12 jmcneill Exp $ */
/*
* Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.148 2021/08/17 22:00:32 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.149 2021/10/10 20:10:12 jmcneill Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -4121,18 +4121,17 @@
/* XXX suspend */
break;
case UHF_PORT_RESET:
- v &= ~(XHCI_PS_PED | XHCI_PS_PR);
xhci_op_write_4(sc, port, v | XHCI_PS_PR);
/* Wait for reset to complete. */
- usb_delay_ms(&sc->sc_bus, USB_PORT_ROOT_RESET_DELAY);
- if (sc->sc_dying) {
- return -1;
- }
- v = xhci_op_read_4(sc, port);
- if (v & XHCI_PS_PR) {
- xhci_op_write_4(sc, port, v & ~XHCI_PS_PR);
+ for (i = 0; i < USB_PORT_ROOT_RESET_DELAY / 10; i++) {
+ if (sc->sc_dying) {
+ return -1;
+ }
+ v = xhci_op_read_4(sc, port);
+ if ((v & XHCI_PS_PR) == 0) {
+ break;
+ }
usb_delay_ms(&sc->sc_bus, 10);
- /* XXX */
}
break;
case UHF_PORT_POWER:
Home |
Main Index |
Thread Index |
Old Index