mac80211: brcmfmac: firmware halt and scan cleanup
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / 303-v4.15-0001-brcmfmac-handle-FWHALT-mailbox-indication.patch
1 From 2fd3877b5bb7d39782c3205a1dcda02023b8514a Mon Sep 17 00:00:00 2001
2 From: Arend Van Spriel <arend.vanspriel@broadcom.com>
3 Date: Wed, 8 Nov 2017 14:36:31 +0100
4 Subject: [PATCH] brcmfmac: handle FWHALT mailbox indication
5
6 The firmware uses a mailbox to communicate to the host what is going
7 on. In the driver we validate the bit received. Various people seen
8 the following message:
9
10 brcmfmac: brcmf_sdio_hostmail: Unknown mailbox data content: 0x40012
11
12 Bit 4 is cause of this message, but this actually indicates the firmware
13 has halted. Handle this bit by giving a more meaningful error message.
14
15 Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
16 Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
17 Reviewed-by: Franky Lin <franky.lin@broadcom.com>
18 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
19 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
20 ---
21 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 14 ++++++++++----
22 1 file changed, 10 insertions(+), 4 deletions(-)
23
24 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
25 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
26 @@ -260,10 +260,11 @@ struct rte_console {
27 #define I_HMB_HOST_INT I_HMB_SW3 /* Miscellaneous Interrupt */
28
29 /* tohostmailboxdata */
30 -#define HMB_DATA_NAKHANDLED 1 /* retransmit NAK'd frame */
31 -#define HMB_DATA_DEVREADY 2 /* talk to host after enable */
32 -#define HMB_DATA_FC 4 /* per prio flowcontrol update flag */
33 -#define HMB_DATA_FWREADY 8 /* fw ready for protocol activity */
34 +#define HMB_DATA_NAKHANDLED 0x0001 /* retransmit NAK'd frame */
35 +#define HMB_DATA_DEVREADY 0x0002 /* talk to host after enable */
36 +#define HMB_DATA_FC 0x0004 /* per prio flowcontrol update flag */
37 +#define HMB_DATA_FWREADY 0x0008 /* fw ready for protocol activity */
38 +#define HMB_DATA_FWHALT 0x0010 /* firmware halted */
39
40 #define HMB_DATA_FCDATA_MASK 0xff000000
41 #define HMB_DATA_FCDATA_SHIFT 24
42 @@ -1094,6 +1095,10 @@ static u32 brcmf_sdio_hostmail(struct br
43 offsetof(struct sdpcmd_regs, tosbmailbox));
44 bus->sdcnt.f1regdata += 2;
45
46 + /* dongle indicates the firmware has halted/crashed */
47 + if (hmb_data & HMB_DATA_FWHALT)
48 + brcmf_err("mailbox indicates firmware halted\n");
49 +
50 /* Dongle recomposed rx frames, accept them again */
51 if (hmb_data & HMB_DATA_NAKHANDLED) {
52 brcmf_dbg(SDIO, "Dongle reports NAK handled, expect rtx of %d\n",
53 @@ -1151,6 +1156,7 @@ static u32 brcmf_sdio_hostmail(struct br
54 HMB_DATA_NAKHANDLED |
55 HMB_DATA_FC |
56 HMB_DATA_FWREADY |
57 + HMB_DATA_FWHALT |
58 HMB_DATA_FCDATA_MASK | HMB_DATA_VERSION_MASK))
59 brcmf_err("Unknown mailbox data content: 0x%02x\n",
60 hmb_data);