Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic improve intr reg debugging



details:   https://anonhg.NetBSD.org/src/rev/6807581b04c0
branches:  trunk
changeset: 335620:6807581b04c0
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Jan 17 19:10:18 2015 +0000

description:
improve intr reg debugging

diffstat:

 sys/dev/ic/dwc_mmc.c     |  27 ++++++++++++++++++++-------
 sys/dev/ic/dwc_mmc_reg.h |  23 ++++++++++++++++++++++-
 2 files changed, 42 insertions(+), 8 deletions(-)

diffs (113 lines):

diff -r 84ced1345df8 -r 6807581b04c0 sys/dev/ic/dwc_mmc.c
--- a/sys/dev/ic/dwc_mmc.c      Sat Jan 17 17:48:41 2015 +0000
+++ b/sys/dev/ic/dwc_mmc.c      Sat Jan 17 19:10:18 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc.c,v 1.4 2014/12/30 12:36:06 jmcneill Exp $ */
+/* $NetBSD: dwc_mmc.c,v 1.5 2015/01/17 19:10:18 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_dwc_mmc.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.4 2014/12/30 12:36:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.5 2015/01/17 19:10:18 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -67,6 +67,11 @@
 static int     dwc_mmc_pio_transfer(struct dwc_mmc_softc *,
                                     struct sdmmc_command *);
 
+#ifdef DWC_MMC_DEBUG
+static void    dwc_mmc_print_rint(struct dwc_mmc_softc *, const char *,
+                                  uint32_t);
+#endif
+
 void           dwc_mmc_dump_regs(void);
 
 static struct sdmmc_chip_functions dwc_mmc_chip_functions = {
@@ -142,7 +147,7 @@
        MMC_WRITE(sc, DWC_MMC_MINTSTS_REG, mint);
 
 #ifdef DWC_MMC_DEBUG
-       device_printf(sc->sc_dev, "mint %#x rint %#x\n", mint, rint);
+       dwc_mmc_print_rint(sc, "irq", rint);
 #endif
 
        if (rint & DWC_MMC_INT_CARDDET) {
@@ -489,8 +494,7 @@
            DWC_MMC_INT_ERROR|DWC_MMC_INT_CD, hz * 10);
        if (cmd->c_error == 0 && (sc->sc_intr_rint & DWC_MMC_INT_ERROR)) {
 #ifdef DWC_MMC_DEBUG
-               device_printf(sc->sc_dev, "%s: rint %#x\n", __func__,
-                   sc->sc_intr_rint);
+               dwc_mmc_print_rint(sc, "exec1", sc->sc_intr_rint);
 #endif
                if (sc->sc_intr_rint & DWC_MMC_INT_RTO) {
                        cmd->c_error = ETIMEDOUT;
@@ -509,8 +513,7 @@
                if (cmd->c_error == 0 &&
                    (sc->sc_intr_rint & DWC_MMC_INT_ERROR)) {
 #ifdef DWC_MMC_DEBUG
-                       device_printf(sc->sc_dev, "%s: rint2 %#x\n", __func__,
-                           sc->sc_intr_rint);
+                       dwc_mmc_print_rint(sc, "exec2", sc->sc_intr_rint);
 #endif
                        cmd->c_error = ETIMEDOUT;
                }
@@ -558,6 +561,16 @@
 {
 }
 
+#ifdef DWC_MMC_DEBUG
+static void
+dwc_mmc_print_rint(struct dwc_mmc_softc *sc, const char *tag, uint32_t rint)
+{
+       char buf[128];
+       snprintb(buf, sizeof(buf), DWC_MMC_INT_BITS, rint);
+       device_printf(sc->sc_dev, "[%s] rint %s\n", tag, buf);
+}
+#endif
+
 void
 dwc_mmc_dump_regs(void)
 {
diff -r 84ced1345df8 -r 6807581b04c0 sys/dev/ic/dwc_mmc_reg.h
--- a/sys/dev/ic/dwc_mmc_reg.h  Sat Jan 17 17:48:41 2015 +0000
+++ b/sys/dev/ic/dwc_mmc_reg.h  Sat Jan 17 19:10:18 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc_reg.h,v 1.2 2014/12/27 19:18:04 jmcneill Exp $ */
+/* $NetBSD: dwc_mmc_reg.h,v 1.3 2015/01/17 19:10:18 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -113,6 +113,27 @@
         DWC_MMC_INT_RTO | DWC_MMC_INT_DRTO | DWC_MMC_INT_HTO | \
         DWC_MMC_INT_HLE | DWC_MMC_INT_SBE | DWC_MMC_INT_EBE)
 
+#define DWC_MMC_INT_BITS       \
+       "\20"                   \
+       "\x18"  "SDIO_INT"      \
+       "\x10"  "NEW_INT"       \
+       "\x0f"  "EBE"           \
+       "\x0e"  "ACD"           \
+       "\x0d"  "SBE"           \
+       "\x0c"  "HLE"           \
+       "\x0b"  "FRUN"          \
+       "\x0a"  "HTO"           \
+       "\x09"  "DRTO"          \
+       "\x08"  "RTO"           \
+       "\x07"  "DCRC"          \
+       "\x06"  "RCRC"          \
+       "\x05"  "RXDR"          \
+       "\x04"  "TXDR"          \
+       "\x03"  "DTO"           \
+       "\x02"  "CD"            \
+       "\x01"  "RE"            \
+       "\x00"  "CARDDET"
+
 #define DWC_MMC_CMD_START_CMD                  __BIT(31)
 #define DWC_MMC_CMD_USE_HOLD_REG               __BIT(29)
 #define DWC_MMC_CMD_VOLT_SWITCH                        __BIT(28)



Home | Main Index | Thread Index | Old Index