Module Name: src Committed By: jmcneill Date: Sat Jan 17 19:10:18 UTC 2015
Modified Files: src/sys/dev/ic: dwc_mmc.c dwc_mmc_reg.h Log Message: improve intr reg debugging To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/dwc_mmc.c cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/dwc_mmc_reg.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/ic/dwc_mmc.c diff -u src/sys/dev/ic/dwc_mmc.c:1.4 src/sys/dev/ic/dwc_mmc.c:1.5 --- src/sys/dev/ic/dwc_mmc.c:1.4 Tue Dec 30 12:36:06 2014 +++ src/sys/dev/ic/dwc_mmc.c Sat Jan 17 19:10:18 2015 @@ -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 <jmcne...@invisible.ca> @@ -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_wait(struct dwc_m 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 @@ dwc_mmc_intr(void *priv) 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_exec_command(sdmmc_chipset_handl 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 @@ dwc_mmc_exec_command(sdmmc_chipset_handl 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 @@ dwc_mmc_card_intr_ack(sdmmc_chipset_hand { } +#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) { Index: src/sys/dev/ic/dwc_mmc_reg.h diff -u src/sys/dev/ic/dwc_mmc_reg.h:1.2 src/sys/dev/ic/dwc_mmc_reg.h:1.3 --- src/sys/dev/ic/dwc_mmc_reg.h:1.2 Sat Dec 27 19:18:04 2014 +++ src/sys/dev/ic/dwc_mmc_reg.h Sat Jan 17 19:10:18 2015 @@ -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 <jmcne...@invisible.ca> @@ -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)