diff mbox series

[v4,9/9] brcmfmac: pcie: Read the console on init and shutdown

Message ID 20220131160713.245637-10-marcan@marcan.st (mailing list archive)
State Accepted
Commit b4bb8469e90ec75c0ce81fcf6a9c3abd2f18e005
Delegated to: Kalle Valo
Headers show
Series misc brcmfmac fixes (M1/T2 series spin-off) | expand

Commit Message

Hector Martin Jan. 31, 2022, 4:07 p.m. UTC
This allows us to get console messages if the firmware crashed during
early init, or if an operation failed and we're about to shut down.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Hector Martin <marcan@marcan.st>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Andy Shevchenko Jan. 31, 2022, 4:25 p.m. UTC | #1
On Mon, Jan 31, 2022 at 6:08 PM Hector Martin <marcan@marcan.st> wrote:
>
> This allows us to get console messages if the firmware crashed during
> early init, or if an operation failed and we're about to shut down.

fails

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> Signed-off-by: Hector Martin <marcan@marcan.st>
> ---
>  drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> index 3ff4997e1c97..4fe341376a16 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> @@ -744,6 +744,8 @@ static void brcmf_pcie_bus_console_read(struct brcmf_pciedev_info *devinfo,
>                 return;
>
>         console = &devinfo->shared.console;
> +       if (!console->base_addr)
> +               return;
>         addr = console->base_addr + BRCMF_CONSOLE_WRITEIDX_OFFSET;
>         newidx = brcmf_pcie_read_tcm32(devinfo, addr);
>         while (newidx != console->read_idx) {
> @@ -1520,6 +1522,7 @@ brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo,
>                   shared->max_rxbufpost, shared->rx_dataoffset);
>
>         brcmf_pcie_bus_console_init(devinfo);
> +       brcmf_pcie_bus_console_read(devinfo, false);
>
>         return 0;
>  }
> @@ -1959,6 +1962,7 @@ brcmf_pcie_remove(struct pci_dev *pdev)
>                 return;
>
>         devinfo = bus->bus_priv.pcie->devinfo;
> +       brcmf_pcie_bus_console_read(devinfo, false);
>
>         devinfo->state = BRCMFMAC_PCIE_STATE_DOWN;
>         if (devinfo->ci)
> --
> 2.33.0
>
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
index 3ff4997e1c97..4fe341376a16 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -744,6 +744,8 @@  static void brcmf_pcie_bus_console_read(struct brcmf_pciedev_info *devinfo,
 		return;
 
 	console = &devinfo->shared.console;
+	if (!console->base_addr)
+		return;
 	addr = console->base_addr + BRCMF_CONSOLE_WRITEIDX_OFFSET;
 	newidx = brcmf_pcie_read_tcm32(devinfo, addr);
 	while (newidx != console->read_idx) {
@@ -1520,6 +1522,7 @@  brcmf_pcie_init_share_ram_info(struct brcmf_pciedev_info *devinfo,
 		  shared->max_rxbufpost, shared->rx_dataoffset);
 
 	brcmf_pcie_bus_console_init(devinfo);
+	brcmf_pcie_bus_console_read(devinfo, false);
 
 	return 0;
 }
@@ -1959,6 +1962,7 @@  brcmf_pcie_remove(struct pci_dev *pdev)
 		return;
 
 	devinfo = bus->bus_priv.pcie->devinfo;
+	brcmf_pcie_bus_console_read(devinfo, false);
 
 	devinfo->state = BRCMFMAC_PCIE_STATE_DOWN;
 	if (devinfo->ci)