brcmfmac: add a function designated for handling firmware fails
authorRafał Miłecki <rafal@milecki.pl>
Tue, 26 Feb 2019 13:11:18 +0000 (14:11 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 4 Apr 2019 10:00:12 +0000 (13:00 +0300)
This improves handling PCIe firmware halts by printing a clear error
message and replaces a similar code in the SDIO bus support.

It will also allow further improvements like trying to recover from a
firmware crash.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c

index 3d441c5c745ccf30dddf7a38e36fe8a62617d958..801106583ae7deeb6c5c6914be51b33f23b88998 100644 (file)
@@ -262,6 +262,8 @@ void brcmf_detach(struct device *dev);
 void brcmf_dev_reset(struct device *dev);
 /* Request from bus module to initiate a coredump */
 void brcmf_dev_coredump(struct device *dev);
+/* Indication that firmware has halted or crashed */
+void brcmf_fw_crashed(struct device *dev);
 
 /* Configure the "global" bus state used by upper layers */
 void brcmf_bus_change_state(struct brcmf_bus *bus, enum brcmf_bus_state state);
index 4fbe8791f674959029bf27530c41a49299ba3886..7f4d9356b79e97a62725357745f7d870c90b4fea 100644 (file)
@@ -1273,6 +1273,16 @@ void brcmf_dev_coredump(struct device *dev)
                brcmf_dbg(TRACE, "failed to create coredump\n");
 }
 
+void brcmf_fw_crashed(struct device *dev)
+{
+       struct brcmf_bus *bus_if = dev_get_drvdata(dev);
+       struct brcmf_pub *drvr = bus_if->drvr;
+
+       bphy_err(drvr, "Firmware has halted or crashed\n");
+
+       brcmf_dev_coredump(dev);
+}
+
 void brcmf_detach(struct device *dev)
 {
        s32 i;
index 58a6bc37935878db7669ffed776719fc0ecf1e87..6781d39ab1d23af8ca5d6dffaaca57750ff7dbe1 100644 (file)
@@ -730,7 +730,7 @@ static void brcmf_pcie_handle_mb_data(struct brcmf_pciedev_info *devinfo)
        }
        if (dtoh_mb_data & BRCMF_D2H_DEV_FWHALT) {
                brcmf_dbg(PCIE, "D2H_MB_DATA: FW HALT\n");
-               brcmf_dev_coredump(&devinfo->pdev->dev);
+               brcmf_fw_crashed(&devinfo->pdev->dev);
        }
 }
 
index 4d104ab80fd8ec9bf7c68583c46cca7f2962fe39..a06af0cd4a7f4a63215ed29024dfd94638102632 100644 (file)
@@ -1090,8 +1090,8 @@ static u32 brcmf_sdio_hostmail(struct brcmf_sdio *bus)
 
        /* dongle indicates the firmware has halted/crashed */
        if (hmb_data & HMB_DATA_FWHALT) {
-               brcmf_err("mailbox indicates firmware halted\n");
-               brcmf_dev_coredump(&sdiod->func1->dev);
+               brcmf_dbg(SDIO, "mailbox indicates firmware halted\n");
+               brcmf_fw_crashed(&sdiod->func1->dev);
        }
 
        /* Dongle recomposed rx frames, accept them again */