Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Remove magic numbers from xhci_hc_reset. From t...
details: https://anonhg.NetBSD.org/src/rev/02b2ba5ada30
branches: trunk
changeset: 345075:02b2ba5ada30
user: skrll <skrll%NetBSD.org@localhost>
date: Fri May 06 10:24:06 2016 +0000
description:
Remove magic numbers from xhci_hc_reset. From t-hash.
diffstat:
sys/dev/usb/xhci.c | 16 ++++++++--------
sys/dev/usb/xhcireg.h | 5 ++++-
2 files changed, 12 insertions(+), 9 deletions(-)
diffs (83 lines):
diff -r 35d9ede0c994 -r 02b2ba5ada30 sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c Fri May 06 10:19:40 2016 +0000
+++ b/sys/dev/usb/xhci.c Fri May 06 10:24:06 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xhci.c,v 1.41 2016/04/30 15:03:55 skrll Exp $ */
+/* $NetBSD: xhci.c,v 1.42 2016/05/06 10:24:06 skrll Exp $ */
/*
* Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.41 2016/04/30 15:03:55 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.42 2016/05/06 10:24:06 skrll Exp $");
#include "opt_usb.h"
@@ -603,13 +603,13 @@
int i;
/* Check controller not ready */
- for (i = 0; i < 100; i++) {
+ for (i = 0; i < XHCI_WAIT_CNR; i++) {
usbsts = xhci_op_read_4(sc, XHCI_USBSTS);
if ((usbsts & XHCI_STS_CNR) == 0)
break;
usb_delay_ms(&sc->sc_bus, 1);
}
- if (i >= 100) {
+ if (i >= XHCI_WAIT_CNR) {
aprint_error_dev(sc->sc_dev, "controller not ready timeout\n");
return EIO;
}
@@ -622,25 +622,25 @@
/* Reset controller */
usbcmd = XHCI_CMD_HCRST;
xhci_op_write_4(sc, XHCI_USBCMD, usbcmd);
- for (i = 0; i < 100; i++) {
+ for (i = 0; i < XHCI_WAIT_HCRST; i++) {
usbcmd = xhci_op_read_4(sc, XHCI_USBCMD);
if ((usbcmd & XHCI_CMD_HCRST) == 0)
break;
usb_delay_ms(&sc->sc_bus, 1);
}
- if (i >= 100) {
+ if (i >= XHCI_WAIT_HCRST) {
aprint_error_dev(sc->sc_dev, "host controller reset timeout\n");
return EIO;
}
/* Check controller not ready */
- for (i = 0; i < 100; i++) {
+ for (i = 0; i < XHCI_WAIT_CNR; i++) {
usbsts = xhci_op_read_4(sc, XHCI_USBSTS);
if ((usbsts & XHCI_STS_CNR) == 0)
break;
usb_delay_ms(&sc->sc_bus, 1);
}
- if (i >= 100) {
+ if (i >= XHCI_WAIT_CNR) {
aprint_error_dev(sc->sc_dev,
"controller not ready timeout after reset\n");
return EIO;
diff -r 35d9ede0c994 -r 02b2ba5ada30 sys/dev/usb/xhcireg.h
--- a/sys/dev/usb/xhcireg.h Fri May 06 10:19:40 2016 +0000
+++ b/sys/dev/usb/xhcireg.h Fri May 06 10:24:06 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xhcireg.h,v 1.5 2016/04/23 10:15:32 skrll Exp $ */
+/* $NetBSD: xhcireg.h,v 1.6 2016/05/06 10:24:06 skrll Exp $ */
/*-
* Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
@@ -97,6 +97,9 @@
#define XHCI_CMD_EWE 0x00000400 /* RW Enable Wrap Event */
#define XHCI_CMD_EU3S 0x00000800 /* RW Enable U3 MFINDEX Stop */
+#define XHCI_WAIT_CNR 100 /* in 1ms */
+#define XHCI_WAIT_HCRST 100 /* in 1ms */
+
#define XHCI_USBSTS 0x04 /* XHCI status */
#define XHCI_STS_HCH 0x00000001 /* RO - Host Controller Halted */
#define XHCI_STS_HSE 0x00000004 /* RW - Host System Error */
Home |
Main Index |
Thread Index |
Old Index