Module Name:    src
Committed By:   skrll
Date:           Sat Jan 19 14:07:37 UTC 2013

Modified Files:
        src/sys/dev/usb: dwc_otg.c dwc_otgvar.h

Log Message:
Don't count bit0 events in gintsts. bit 0 tells us which mode we're in
0 = device, 1 = host


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/usb/dwc_otg.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/usb/dwc_otgvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/dwc_otg.c
diff -u src/sys/dev/usb/dwc_otg.c:1.25 src/sys/dev/usb/dwc_otg.c:1.26
--- src/sys/dev/usb/dwc_otg.c:1.25	Sat Jan 19 07:41:51 2013
+++ src/sys/dev/usb/dwc_otg.c	Sat Jan 19 14:07:37 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc_otg.c,v 1.25 2013/01/19 07:41:51 skrll Exp $	*/
+/*	$NetBSD: dwc_otg.c,v 1.26 2013/01/19 14:07:37 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012 Hans Petter Selasky. All rights reserved.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc_otg.c,v 1.25 2013/01/19 07:41:51 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_otg.c,v 1.26 2013/01/19 14:07:37 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -3389,8 +3389,8 @@ dwc_otg_interrupt(struct dwc_otg_softc *
 	status = DWC_OTG_READ_4(sc, DOTG_GINTSTS);
 	DWC_OTG_WRITE_4(sc, DOTG_GINTSTS, status);
 
-	for (size_t i = 0; i < 32; i++) {
-		if (status & (1<<i)) {
+	for (size_t i = DWC_OTG_INTRBITF; i < DWC_OTG_NINTRBITS; i++) {
+		if (status & (1 << i)) {
 			DOTG_EVCNT_INCR(sc->sc_ev_intr_bit[i]);
 		}
 	}
@@ -4119,8 +4119,11 @@ dwc_otg_device_done(usbd_xfer_handle xfe
 	usb_schedsoftintr(&sc->sc_bus);
 }
 
+/*
+ * curmode is a mode indication bit 0 = device, 1 = host
+ */
 static const char * const intnames[32] = {
-	"curmod",	"modemis",	"otgint",	"sof",
+	"curmode",	"modemis",	"otgint",	"sof",
 	"rxflvl",	"nptxfemp",	"ginnakeff",	"goutnakeff",
 	"ulpickint",	"i2cint",	"erlysusp",	"usbsusp",
 	"usbrst",	"enumdone",	"isooutdrop",	"eopf",
@@ -4185,7 +4188,7 @@ dwc_otg_init(struct dwc_otg_softc *sc)
 	evcnt_attach_dynamic(&sc->sc_ev_xferpoolput, EVCNT_TYPE_MISC,
 	    NULL, xname, "xfer pool put");
 
-	for (size_t i = 0; i < 32; i++) {
+	for (size_t i = DWC_OTG_INTRBITF; i < DWC_OTG_NINTRBITS; i++) {
 		evcnt_attach_dynamic(&sc->sc_ev_intr_bit[i], EVCNT_TYPE_INTR,
 		    NULL, xname, intnames[i]);
 	}	

Index: src/sys/dev/usb/dwc_otgvar.h
diff -u src/sys/dev/usb/dwc_otgvar.h:1.5 src/sys/dev/usb/dwc_otgvar.h:1.6
--- src/sys/dev/usb/dwc_otgvar.h:1.5	Sun Jan 13 15:21:47 2013
+++ src/sys/dev/usb/dwc_otgvar.h	Sat Jan 19 14:07:37 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc_otgvar.h,v 1.5 2013/01/13 15:21:47 skrll Exp $ */
+/*	$NetBSD: dwc_otgvar.h,v 1.6 2013/01/19 14:07:37 skrll Exp $ */
 
 /* $FreeBSD: src/sys/dev/usb/controller/dwc_otg.h,v 1.12 2012/09/27 15:23:38 hselasky Exp $ */
 /*-
@@ -40,6 +40,16 @@
 #define	DWC_OTG_MAX_ENDPOINTS 16
 #define	DWC_OTG_HOST_TIMER_RATE 10 /* ms */
 
+#define DOTG_COUNTERS
+#ifdef DOTG_COUNTERS
+/*
+ * curmode (bit 0)is a mode indication bit 0 = device, 1 = host
+ */
+#define	DWC_OTG_INTRBITF	1
+#define	DWC_OTG_INTRBITL	31
+#define	DWC_OTG_NINTRBITS	32
+#endif
+
 struct dwc_otg_td;
 struct dwc_otg_softc;
 
@@ -202,9 +212,8 @@ typedef struct dwc_otg_softc {
 	pool_cache_t sc_xferpool;
 	
 #ifdef DOTG_COUNTERS
-
 	struct evcnt sc_ev_intr;
-	struct evcnt sc_ev_intr_bit[32];
+	struct evcnt sc_ev_intr_bit[DWC_OTG_NINTRBITS];
 
 	struct evcnt sc_ev_soft_intr;
 	struct evcnt sc_ev_work;

Reply via email to