brcmfmac: add dedicated debug level for firmware console logging
authorArend van Spriel <arend@broadcom.com>
Wed, 26 Aug 2015 20:15:01 +0000 (22:15 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 29 Sep 2015 07:28:44 +0000 (10:28 +0300)
Both PCIe and SDIO devices have the possibility to log the firmware
console output in kernel log. For PCIe it is logged when PCIE debug
level is enabled. For SDIO it is logged when user specifies a non-zero
console interval through debugfs. This patch tries to make it a
bit more consistent. The firmware console output is only logged when
FWCON debug level is enabled.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Pontus Fuchs <pontusf@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/brcm80211/brcmfmac/debug.h
drivers/net/wireless/brcm80211/brcmfmac/pcie.c
drivers/net/wireless/brcm80211/brcmfmac/sdio.c

index eb0b8c47479d1f7acaadd1ca2f129e2fa07dbe2c..48648ca44ba8e4d017a6c93f3af4a43b802490a3 100644 (file)
@@ -37,6 +37,7 @@
 #define BRCMF_SDIO_VAL         0x00020000
 #define BRCMF_MSGBUF_VAL       0x00040000
 #define BRCMF_PCIE_VAL         0x00080000
+#define BRCMF_FWCON_VAL                0x00100000
 
 /* set default print format */
 #undef pr_fmt
@@ -78,6 +79,7 @@ do {                                                          \
 #define BRCMF_GLOM_ON()                (brcmf_msg_level & BRCMF_GLOM_VAL)
 #define BRCMF_EVENT_ON()       (brcmf_msg_level & BRCMF_EVENT_VAL)
 #define BRCMF_FIL_ON()         (brcmf_msg_level & BRCMF_FIL_VAL)
+#define BRCMF_FWCON_ON()       (brcmf_msg_level & BRCMF_FWCON_VAL)
 
 #else /* defined(DEBUG) || defined(CONFIG_BRCM_TRACING) */
 
@@ -90,6 +92,7 @@ do {                                                          \
 #define BRCMF_GLOM_ON()                0
 #define BRCMF_EVENT_ON()       0
 #define BRCMF_FIL_ON()         0
+#define BRCMF_FWCON_ON()       0
 
 #endif /* defined(DEBUG) || defined(CONFIG_BRCM_TRACING) */
 
index 3a98c4306d1d603c8aa4098510956cad4b0df542..e75d04e89ac2149c30ea34062eb658586b4f1a1e 100644 (file)
@@ -644,7 +644,7 @@ static void brcmf_pcie_bus_console_init(struct brcmf_pciedev_info *devinfo)
        addr = console->base_addr + BRCMF_CONSOLE_BUFSIZE_OFFSET;
        console->bufsize = brcmf_pcie_read_tcm32(devinfo, addr);
 
-       brcmf_dbg(PCIE, "Console: base %x, buf %x, size %d\n",
+       brcmf_dbg(FWCON, "Console: base %x, buf %x, size %d\n",
                  console->base_addr, console->buf_addr, console->bufsize);
 }
 
@@ -656,6 +656,9 @@ static void brcmf_pcie_bus_console_read(struct brcmf_pciedev_info *devinfo)
        u8 ch;
        u32 newidx;
 
+       if (!BRCMF_FWCON_ON())
+               return;
+
        console = &devinfo->shared.console;
        addr = console->base_addr + BRCMF_CONSOLE_WRITEIDX_OFFSET;
        newidx = brcmf_pcie_read_tcm32(devinfo, addr);
@@ -677,7 +680,7 @@ static void brcmf_pcie_bus_console_read(struct brcmf_pciedev_info *devinfo)
                }
                if (ch == '\n') {
                        console->log_str[console->log_idx] = 0;
-                       brcmf_dbg(PCIE, "CONSOLE: %s", console->log_str);
+                       pr_debug("CONSOLE: %s", console->log_str);
                        console->log_idx = 0;
                }
        }
index f990e3d0e696e7f76b4ef501853eb6c5b7ff2831..e41bf441410b3ec09f8dd9cf7f64ce0a5ea76a3c 100644 (file)
@@ -123,6 +123,7 @@ struct rte_console {
 
 #define BRCMF_FIRSTREAD        (1 << 6)
 
+#define BRCMF_CONSOLE  10      /* watchdog interval to poll console */
 
 /* SBSDIO_DEVICE_CTL */
 
@@ -3204,6 +3205,8 @@ static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus)
        if (IS_ERR_OR_NULL(dentry))
                return;
 
+       bus->console_interval = BRCMF_CONSOLE;
+
        brcmf_debugfs_add_entry(drvr, "forensics", brcmf_sdio_forensic_read);
        brcmf_debugfs_add_entry(drvr, "counters",
                                brcmf_debugfs_sdio_count_read);
@@ -3613,7 +3616,7 @@ static void brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus)
        }
 #ifdef DEBUG
        /* Poll for console output periodically */
-       if (bus->sdiodev->state == BRCMF_SDIOD_DATA &&
+       if (bus->sdiodev->state == BRCMF_SDIOD_DATA && BRCMF_FWCON_ON() &&
            bus->console_interval != 0) {
                bus->console.count += BRCMF_WD_POLL_MS;
                if (bus->console.count >= bus->console_interval) {