Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9d6c1dc4 authored by Arend van Spriel's avatar Arend van Spriel Committed by Kalle Valo
Browse files

brcmfmac: add dedicated debug level for firmware console logging



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: default avatarHante Meuleman <meuleman@broadcom.com>
Reviewed-by: default avatarFranky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: default avatarPontus Fuchs <pontusf@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 291da87b
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -37,6 +37,7 @@
#define BRCMF_SDIO_VAL		0x00020000
#define BRCMF_SDIO_VAL		0x00020000
#define BRCMF_MSGBUF_VAL	0x00040000
#define BRCMF_MSGBUF_VAL	0x00040000
#define BRCMF_PCIE_VAL		0x00080000
#define BRCMF_PCIE_VAL		0x00080000
#define BRCMF_FWCON_VAL		0x00100000


/* set default print format */
/* set default print format */
#undef pr_fmt
#undef pr_fmt
@@ -78,6 +79,7 @@ do { \
#define BRCMF_GLOM_ON()		(brcmf_msg_level & BRCMF_GLOM_VAL)
#define BRCMF_GLOM_ON()		(brcmf_msg_level & BRCMF_GLOM_VAL)
#define BRCMF_EVENT_ON()	(brcmf_msg_level & BRCMF_EVENT_VAL)
#define BRCMF_EVENT_ON()	(brcmf_msg_level & BRCMF_EVENT_VAL)
#define BRCMF_FIL_ON()		(brcmf_msg_level & BRCMF_FIL_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) */
#else /* defined(DEBUG) || defined(CONFIG_BRCM_TRACING) */


@@ -90,6 +92,7 @@ do { \
#define BRCMF_GLOM_ON()		0
#define BRCMF_GLOM_ON()		0
#define BRCMF_EVENT_ON()	0
#define BRCMF_EVENT_ON()	0
#define BRCMF_FIL_ON()		0
#define BRCMF_FIL_ON()		0
#define BRCMF_FWCON_ON()	0


#endif /* defined(DEBUG) || defined(CONFIG_BRCM_TRACING) */
#endif /* defined(DEBUG) || defined(CONFIG_BRCM_TRACING) */


+5 −2
Original line number Original line Diff line number Diff line
@@ -644,7 +644,7 @@ static void brcmf_pcie_bus_console_init(struct brcmf_pciedev_info *devinfo)
	addr = console->base_addr + BRCMF_CONSOLE_BUFSIZE_OFFSET;
	addr = console->base_addr + BRCMF_CONSOLE_BUFSIZE_OFFSET;
	console->bufsize = brcmf_pcie_read_tcm32(devinfo, addr);
	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);
		  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;
	u8 ch;
	u32 newidx;
	u32 newidx;


	if (!BRCMF_FWCON_ON())
		return;

	console = &devinfo->shared.console;
	console = &devinfo->shared.console;
	addr = console->base_addr + BRCMF_CONSOLE_WRITEIDX_OFFSET;
	addr = console->base_addr + BRCMF_CONSOLE_WRITEIDX_OFFSET;
	newidx = brcmf_pcie_read_tcm32(devinfo, addr);
	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') {
		if (ch == '\n') {
			console->log_str[console->log_idx] = 0;
			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;
			console->log_idx = 0;
		}
		}
	}
	}
+4 −1
Original line number Original line Diff line number Diff line
@@ -123,6 +123,7 @@ struct rte_console {


#define BRCMF_FIRSTREAD	(1 << 6)
#define BRCMF_FIRSTREAD	(1 << 6)


#define BRCMF_CONSOLE	10	/* watchdog interval to poll console */


/* SBSDIO_DEVICE_CTL */
/* SBSDIO_DEVICE_CTL */


@@ -3204,6 +3205,8 @@ static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus)
	if (IS_ERR_OR_NULL(dentry))
	if (IS_ERR_OR_NULL(dentry))
		return;
		return;


	bus->console_interval = BRCMF_CONSOLE;

	brcmf_debugfs_add_entry(drvr, "forensics", brcmf_sdio_forensic_read);
	brcmf_debugfs_add_entry(drvr, "forensics", brcmf_sdio_forensic_read);
	brcmf_debugfs_add_entry(drvr, "counters",
	brcmf_debugfs_add_entry(drvr, "counters",
				brcmf_debugfs_sdio_count_read);
				brcmf_debugfs_sdio_count_read);
@@ -3613,7 +3616,7 @@ static void brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus)
	}
	}
#ifdef DEBUG
#ifdef DEBUG
	/* Poll for console output periodically */
	/* 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_interval != 0) {
		bus->console.count += BRCMF_WD_POLL_MS;
		bus->console.count += BRCMF_WD_POLL_MS;
		if (bus->console.count >= bus->console_interval) {
		if (bus->console.count >= bus->console_interval) {