]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ath10k: add support for firmware crash recovery on SDIO chip
authorWen Gong <wgong@codeaurora.org>
Wed, 22 May 2019 06:32:56 +0000 (14:32 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 25 Jun 2019 12:52:30 +0000 (15:52 +0300)
The command to simulate firmware crash:
echo soft > /sys/kernel/debug/ieee80211/phy0/ath10k/simulate_fw_crash

It will send WMI_FORCE_FW_HANG_ASSERT to firmware, then it will trigger
CPU interrupt status register for SDIO chip, ath10k driver need to
configure it while enable SDIO interrupt, otherwise ath10k driver will
not get the assert error info.

After this change, it will success for simulate firmware crash.

Tested with QCA6174 SDIO with firmware
WLAN.RMH.4.4.1-00007-QCARMSWP-1.

Signed-off-by: Wen Gong <wgong@codeaurora.org>
Tested-by: Claire Chang <tientzu@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/ath10k/hw.h
drivers/net/wireless/ath/ath10k/sdio.c

index 248cfb4e53c321c9a954e0614f50626f906e1c36..d2d4af9c673b4b54d05f6c91afe010220513c7ab 100644 (file)
@@ -1101,6 +1101,7 @@ ath10k_is_rssi_enable(struct ath10k_hw_params *hw,
 #define MBOX_CPU_INT_STATUS_ENABLE_ADDRESS     0x00000819
 #define MBOX_CPU_INT_STATUS_ENABLE_BIT_LSB     0
 #define MBOX_CPU_INT_STATUS_ENABLE_BIT_MASK    0x000000ff
+#define MBOX_CPU_STATUS_ENABLE_ASSERT_MASK 0x00000001
 #define MBOX_ERROR_STATUS_ENABLE_ADDRESS       0x0000081a
 #define MBOX_ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB  1
 #define MBOX_ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK 0x00000002
index 9bbd5b54b8cadefd75873f136483d5dd44c56b57..8d0f3525c1d93f54aaed1a1f3d00d9cbccc5b39d 100644 (file)
@@ -855,6 +855,10 @@ static int ath10k_sdio_mbox_proc_cpu_intr(struct ath10k *ar)
 
 out:
        mutex_unlock(&irq_data->mtx);
+       if (cpu_int_status & MBOX_CPU_STATUS_ENABLE_ASSERT_MASK) {
+               ath10k_err(ar, "firmware crashed!\n");
+               queue_work(ar->workqueue, &ar->restart_work);
+       }
        return ret;
 }
 
@@ -1500,8 +1504,10 @@ static int ath10k_sdio_hif_enable_intrs(struct ath10k *ar)
        regs->int_status_en |=
                FIELD_PREP(MBOX_INT_STATUS_ENABLE_MBOX_DATA_MASK, 1);
 
-       /* Set up the CPU Interrupt status Register */
-       regs->cpu_int_status_en = 0;
+       /* Set up the CPU Interrupt Status Register, enable CPU sourced interrupt #0
+        * #0 is used for report assertion from target
+        */
+       regs->cpu_int_status_en = FIELD_PREP(MBOX_CPU_STATUS_ENABLE_ASSERT_MASK, 1);
 
        /* Set up the Error Interrupt status Register */
        regs->err_int_status_en =