wifi: ath11k: Add cold boot calibration support on WCN6750
authorManikanta Pubbisetty <quic_mpubbise@quicinc.com>
Wed, 31 Aug 2022 06:04:20 +0000 (09:04 +0300)
committerKalle Valo <quic_kvalo@quicinc.com>
Thu, 1 Sep 2022 16:14:05 +0000 (19:14 +0300)
Add cold boot calibration support on WCN6750. Unlike other
chipsets where firmware(FW)  is restarted after cold boot
calibration is completed, it is recommended not to restart
the firmware for WCN6750.

For WCN6750, FW sends both CAL_DONE & FW_READY QMI indication
to the driver after cold boot calibration is completed.

QMI message flow for WCN6750 with cold boot support:
FW_INIT_DONE to HOST -> CALIBRATION Mode to FW -> CAL_DONE to Host ->
FW_READY to Host -> MODE_ON to FW

QMI message flow for other chipsets with cold boot support:
FW_INIT_DONE to Host -> CALIBRATION Mode to FW -> FW_READY to Host ->
Trigger FW restart -> FW_INIT_DONE to HOST -> MODE_ON to FW

QMI message flow for chipsets without cold boot support:
FW_INIT_DONE to Host -> MODE_ON to FW

Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1

Signed-off-by: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20220720134909.15626-3-quic_mpubbise@quicinc.com
drivers/net/wireless/ath/ath11k/ahb.c
drivers/net/wireless/ath/ath11k/core.c
drivers/net/wireless/ath/ath11k/hw.h
drivers/net/wireless/ath/ath11k/qmi.c

index 911eee9646a454291727e1cb86c9ada60fe0aa49..29c40c6be5dfdf353cec3e6202acc7f9228ec46e 100644 (file)
@@ -406,7 +406,8 @@ static int ath11k_ahb_fwreset_from_cold_boot(struct ath11k_base *ab)
        int timeout;
 
        if (ath11k_cold_boot_cal == 0 || ab->qmi.cal_done ||
-           ab->hw_params.cold_boot_calib == 0)
+           ab->hw_params.cold_boot_calib == 0 ||
+           ab->hw_params.cbcal_restart_fw == 0)
                return 0;
 
        ath11k_dbg(ab, ATH11K_DBG_AHB, "wait for cold boot done\n");
index 9df6aaae8a44398c8556a5624ee9f0bf32fd2682..0f5ae370a7274aeb3f374671030d719f56f66f15 100644 (file)
@@ -81,6 +81,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
                .idle_ps = false,
                .supports_sta_ps = false,
                .cold_boot_calib = true,
+               .cbcal_restart_fw = true,
                .fw_mem_mode = 0,
                .num_vdevs = 16 + 1,
                .num_peers = 512,
@@ -152,6 +153,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
                .idle_ps = false,
                .supports_sta_ps = false,
                .cold_boot_calib = true,
+               .cbcal_restart_fw = true,
                .fw_mem_mode = 0,
                .num_vdevs = 16 + 1,
                .num_peers = 512,
@@ -222,6 +224,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
                .idle_ps = true,
                .supports_sta_ps = true,
                .cold_boot_calib = false,
+               .cbcal_restart_fw = false,
                .fw_mem_mode = 0,
                .num_vdevs = 16 + 1,
                .num_peers = 512,
@@ -292,6 +295,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
                .idle_ps = false,
                .supports_sta_ps = false,
                .cold_boot_calib = false,
+               .cbcal_restart_fw = false,
                .fw_mem_mode = 2,
                .num_vdevs = 8,
                .num_peers = 128,
@@ -362,6 +366,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
                .idle_ps = true,
                .supports_sta_ps = true,
                .cold_boot_calib = false,
+               .cbcal_restart_fw = false,
                .fw_mem_mode = 0,
                .num_vdevs = 16 + 1,
                .num_peers = 512,
@@ -431,6 +436,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
                .idle_ps = true,
                .supports_sta_ps = true,
                .cold_boot_calib = false,
+               .cbcal_restart_fw = false,
                .fw_mem_mode = 0,
                .num_vdevs = 16 + 1,
                .num_peers = 512,
@@ -499,7 +505,8 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
                .supports_shadow_regs = true,
                .idle_ps = true,
                .supports_sta_ps = true,
-               .cold_boot_calib = false,
+               .cold_boot_calib = true,
+               .cbcal_restart_fw = false,
                .fw_mem_mode = 0,
                .num_vdevs = 16 + 1,
                .num_peers = 512,
index bb5ac940e4709194889c87a1c6d65d139660fd55..05e93ebd758cd40523f00abad882c9aa4a76df54 100644 (file)
@@ -175,6 +175,7 @@ struct ath11k_hw_params {
        bool idle_ps;
        bool supports_sta_ps;
        bool cold_boot_calib;
+       bool cbcal_restart_fw;
        int fw_mem_mode;
        u32 num_vdevs;
        u32 num_peers;
index e6ced8597e1d6efffca41805725aeed39a8045ac..2be45683260c4971009cea806405de19bce2dc64 100644 (file)
@@ -3014,8 +3014,10 @@ static void ath11k_qmi_msg_fw_ready_cb(struct qmi_handle *qmi_hdl,
 
        ath11k_dbg(ab, ATH11K_DBG_QMI, "qmi firmware ready\n");
 
-       ab->qmi.cal_done = 1;
-       wake_up(&ab->qmi.cold_boot_waitq);
+       if (!ab->qmi.cal_done) {
+               ab->qmi.cal_done = 1;
+               wake_up(&ab->qmi.cold_boot_waitq);
+       }
 
        ath11k_qmi_driver_event_post(qmi, ATH11K_QMI_EVENT_FW_READY, NULL);
 }
@@ -3029,6 +3031,8 @@ static void ath11k_qmi_msg_cold_boot_cal_done_cb(struct qmi_handle *qmi_hdl,
                                              struct ath11k_qmi, handle);
        struct ath11k_base *ab = qmi->ab;
 
+       ab->qmi.cal_done = 1;
+       wake_up(&ab->qmi.cold_boot_waitq);
        ath11k_dbg(ab, ATH11K_DBG_QMI, "qmi cold boot calibration done\n");
 }
 
@@ -3200,6 +3204,20 @@ static void ath11k_qmi_driver_event_work(struct work_struct *work)
 
                        break;
                case ATH11K_QMI_EVENT_FW_READY:
+                       /* For targets requiring a FW restart upon cold
+                        * boot completion, there is no need to process
+                        * FW ready; such targets will receive FW init
+                        * done message after FW restart.
+                        */
+                       if (ab->hw_params.cbcal_restart_fw)
+                               break;
+
+                       clear_bit(ATH11K_FLAG_CRASH_FLUSH,
+                                 &ab->dev_flags);
+                       clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
+                       ath11k_core_qmi_firmware_ready(ab);
+                       set_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags);
+
                        break;
                case ATH11K_QMI_EVENT_COLD_BOOT_CAL_DONE:
                        break;