Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Fix up device mode vs host mode register naming ...



details:   https://anonhg.NetBSD.org/src/rev/62f92f2b2466
branches:  trunk
changeset: 784423:62f92f2b2466
user:      skrll <skrll%NetBSD.org@localhost>
date:      Mon Jan 28 08:19:33 2013 +0000

description:
Fix up device mode vs host mode register naming confusion.

No functional change.

diffstat:

 sys/dev/usb/dwc_otg.c    |  22 +++++++++++-----------
 sys/dev/usb/dwc_otgreg.h |  34 ++++++++++++++++++----------------
 2 files changed, 29 insertions(+), 27 deletions(-)

diffs (145 lines):

diff -r 8b84fb1b4ca1 -r 62f92f2b2466 sys/dev/usb/dwc_otg.c
--- a/sys/dev/usb/dwc_otg.c     Mon Jan 28 08:03:13 2013 +0000
+++ b/sys/dev/usb/dwc_otg.c     Mon Jan 28 08:19:33 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dwc_otg.c,v 1.38 2013/01/23 03:32:39 jmcneill Exp $    */
+/*     $NetBSD: dwc_otg.c,v 1.39 2013/01/28 08:19:33 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.38 2013/01/23 03:32:39 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_otg.c,v 1.39 2013/01/28 08:19:33 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2223,7 +2223,7 @@
 
                /* ack any pending messages */
                if (sc->sc_last_rx_status != 0 &&
-                   GRXSTSRD_CHNUM_GET(sc->sc_last_rx_status) == td->channel) {
+                   GRXSTSRH_CHNUM_GET(sc->sc_last_rx_status) == td->channel) {
                        /* get rid of message */
                        dwc_otg_common_rx_ack(sc);
                }
@@ -2335,7 +2335,7 @@
 
        /* ack any pending messages */
        if (sc->sc_last_rx_status != 0 &&
-           GRXSTSRD_CHNUM_GET(sc->sc_last_rx_status) == x) {
+           GRXSTSRH_CHNUM_GET(sc->sc_last_rx_status) == x) {
                dwc_otg_common_rx_ack(sc);
        }
 
@@ -2622,10 +2622,10 @@
        if (sc->sc_last_rx_status == 0)
                goto check_state;
 
-       if (GRXSTSRD_CHNUM_GET(sc->sc_last_rx_status) != td->channel)
+       if (GRXSTSRH_CHNUM_GET(sc->sc_last_rx_status) != td->channel)
                goto check_state;
 
-       switch (sc->sc_last_rx_status & GRXSTSRD_PKTSTS_MASK) {
+       switch (sc->sc_last_rx_status & GRXSTSRH_PKTSTS_MASK) {
        case GRXSTSRH_IN_DATA:
 
                DPRINTF("DATA ST=%d STATUS=0x%08x\n",
@@ -2643,7 +2643,7 @@
                td->toggle ^= 1;
 
                /* get the packet byte count */
-               count = GRXSTSRD_BCNT_GET(sc->sc_last_rx_status);
+               count = GRXSTSRH_BCNT_GET(sc->sc_last_rx_status);
 
                /* verify the packet byte count */
                if (count != td->max_packet_size) {
@@ -3277,13 +3277,13 @@
 
                        /* non-data messages we simply skip */
                        if (temp != GRXSTSRD_STP_DATA &&
-                           temp != GRXSTSRD_OUT_DATA) {
+                           temp != GRXSTSRH_IN_DATA) {
                                dwc_otg_common_rx_ack(sc);
                                goto repeat;
                        }
 
-                       bcnt = GRXSTSRD_BCNT_GET(sc->sc_last_rx_status);
-                       ep_no = GRXSTSRD_CHNUM_GET(sc->sc_last_rx_status);
+                       bcnt = GRXSTSRH_BCNT_GET(sc->sc_last_rx_status);
+                       ep_no = GRXSTSRH_CHNUM_GET(sc->sc_last_rx_status);
 
                        /* receive data, if any */
                        if (bcnt != 0) {
@@ -3317,7 +3317,7 @@
        } else {
                uint8_t ep_no;
 
-               ep_no = GRXSTSRD_CHNUM_GET(sc->sc_last_rx_status);
+               ep_no = GRXSTSRH_CHNUM_GET(sc->sc_last_rx_status);
                DPRINTF("%s: ep_no %d\n", __func__, ep_no);
 
                /* check if we should dump the data */
diff -r 8b84fb1b4ca1 -r 62f92f2b2466 sys/dev/usb/dwc_otgreg.h
--- a/sys/dev/usb/dwc_otgreg.h  Mon Jan 28 08:03:13 2013 +0000
+++ b/sys/dev/usb/dwc_otgreg.h  Mon Jan 28 08:19:33 2013 +0000
@@ -263,11 +263,17 @@
 /* Core Receive Status Queue Read Register (Host mode) */
 #define        GRXSTSRH_PKTSTS_MASK            0x001e0000
 #define        GRXSTSRH_PKTSTS_SHIFT           17
+#define         GRXSTSRH_IN_DATA               (2<<17)
+#define         GRXSTSRH_IN_COMPLETE           (3<<17)
+#define         GRXSTSRH_DT_ERROR              (5<<17)
+#define         GRXSTSRH_HALTED                (7<<17)
 #define        GRXSTSRH_DPID_MASK              0x00018000
 #define        GRXSTSRH_DPID_SHIFT             15
 #define        GRXSTSRH_BCNT_MASK              0x00007ff0
+#define        GRXSTSRH_BCNT_GET(x)            (((x) >> 4) & 0x7FF)
 #define        GRXSTSRH_BCNT_SHIFT             4
 #define        GRXSTSRH_CHNUM_MASK             0x0000000f
+#define        GRXSTSRH_CHNUM_GET(x)           ((x) & 15)
 #define        GRXSTSRH_CHNUM_SHIFT            0
 
 /* Core Receive Status Queue Read Register (Device mode) */
@@ -276,27 +282,23 @@
 #define        GRXSTSRD_FN_SHIFT               21
 #define        GRXSTSRD_PKTSTS_MASK            0x001e0000
 #define        GRXSTSRD_PKTSTS_SHIFT           17
-#define        GRXSTSRH_IN_DATA                (2<<17)
-#define        GRXSTSRH_IN_COMPLETE            (3<<17)
-#define        GRXSTSRH_DT_ERROR               (5<<17)
-#define        GRXSTSRH_HALTED                 (7<<17)
-#define        GRXSTSRD_GLOB_OUT_NAK           (1<<17)
-#define        GRXSTSRD_OUT_DATA               (2<<17)
-#define        GRXSTSRD_OUT_COMPLETE           (3<<17)
-#define        GRXSTSRD_STP_COMPLETE           (4<<17)
-#define        GRXSTSRD_STP_DATA               (6<<17)
+#define         GRXSTSRD_GLOB_OUT_NAK          (1<<17)
+#define         GRXSTSRD_OUT_DATA              (2<<17)
+#define         GRXSTSRD_OUT_COMPLETE          (3<<17)
+#define         GRXSTSRD_STP_COMPLETE          (4<<17)
+#define         GRXSTSRD_STP_DATA              (6<<17)
 #define        GRXSTSRD_DPID_MASK              0x00018000
 #define        GRXSTSRD_DPID_SHIFT             15
-#define        GRXSTSRD_DPID_DATA0             (0<<15)
-#define        GRXSTSRD_DPID_DATA1             (2<<15)
-#define        GRXSTSRD_DPID_DATA2             (1<<15)
-#define        GRXSTSRD_DPID_MDATA             (3<<15)
+#define         GRXSTSRD_DPID_DATA0            (0<<15)
+#define         GRXSTSRD_DPID_DATA1            (2<<15)
+#define         GRXSTSRD_DPID_DATA2            (1<<15)
+#define         GRXSTSRD_DPID_MDATA            (3<<15)
 #define        GRXSTSRD_BCNT_MASK              0x00007ff0
 #define        GRXSTSRD_BCNT_GET(x)            (((x) >> 4) & 0x7FF)
 #define        GRXSTSRD_BCNT_SHIFT             4
-#define        GRXSTSRD_CHNUM_MASK             0x0000000f
-#define        GRXSTSRD_CHNUM_GET(x)           ((x) & 15)
-#define        GRXSTSRD_CHNUM_SHIFT            0
+#define        GRXSTSRD_EPNUM_MASK             0x0000000f
+#define        GRXSTSRD_EPNUM_GET(x)           ((x) & 15)
+#define        GRXSTSRD_EPNUM_SHIFT            0
 
 /* Core Receive FIFO Size Register */
 #define        GRXFSIZ_RXFDEP_MASK             0x0000ffff



Home | Main Index | Thread Index | Old Index