d050dc29b4fe9bb641d0f4d4a2c3105e73433a1c
[oweals/openwrt.git] /
1 From b8248236e92790ac635caeb4156e46ea2417e037 Mon Sep 17 00:00:00 2001
2 From: Franky Lin <franky.lin@broadcom.com>
3 Date: Wed, 16 May 2018 14:12:03 +0200
4 Subject: [PATCH] brcmfmac: trigger memory dump on SDIO firmware halt message
5
6 Attempt to dump dongle memory for debug upon receiving firmware halt
7 message through dongle to host mail box interrupt.
8
9 Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
10 Signed-off-by: Franky Lin <franky.lin@broadcom.com>
11 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
12 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
13 [rmilecki: add sdiod variable and use func[1]]
14 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
15 ---
16  drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 4 +++-
17  1 file changed, 3 insertions(+), 1 deletion(-)
18
19 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
20 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
21 @@ -1078,6 +1078,7 @@ static void brcmf_sdio_get_console_addr(
22  
23  static u32 brcmf_sdio_hostmail(struct brcmf_sdio *bus)
24  {
25 +       struct brcmf_sdio_dev *sdiod = bus->sdiodev;
26         u32 intstatus = 0;
27         u32 hmb_data;
28         u8 fcbits;
29 @@ -1095,8 +1096,10 @@ static u32 brcmf_sdio_hostmail(struct br
30         bus->sdcnt.f1regdata += 2;
31  
32         /* dongle indicates the firmware has halted/crashed */
33 -       if (hmb_data & HMB_DATA_FWHALT)
34 +       if (hmb_data & HMB_DATA_FWHALT) {
35                 brcmf_err("mailbox indicates firmware halted\n");
36 +               brcmf_dev_coredump(&sdiod->func[1]->dev);
37 +       }
38  
39         /* Dongle recomposed rx frames, accept them again */
40         if (hmb_data & HMB_DATA_NAKHANDLED) {