ath11k: cold boot calibration support
PATCH v2 1/1 ath11k: cold boot calibration support
From: Govindaraj Saminathan <[email protected]>
cold boot calibration is the process to calibrate all the channels during the boot-up to avoid the calibration delay during the channel change.
During the boot-up, firmware started with mode “cold_boot_calibration” Firmware calibrate all channels and generate CalDb(DDR). Subsequent WIFI ON will reuse the same CalDb.
Firmware restarted with Mission mode to continue the normal operation.
caldb memory address send to firmware through the QMI message.Firmware use this address to store the caldb data and use it until next reboot.
This will give the improvement during the channel change. But it is increasing the boot-up time(up to 15sec depend on number of radios). So if the user want to reduce the boot-up time and accepting for channel change delay, user can disable this feature using the module param cold_boot_cal =0.
---
v2:
- Fixed compilations warnings
--- drivers/net/wireless/ath/ath11k/ahb.c | 26 ++++++++++++++ drivers/net/wireless/ath/ath11k/core.c | 1 + drivers/net/wireless/ath/ath11k/core.h | 5 +++ drivers/net/wireless/ath/ath11k/qmi.c | 66 ++++++++++++++++++++++++++++++---- drivers/net/wireless/ath/ath11k/qmi.h | 3 ++ 5 files changed, 94 insertions(+), 7 deletions(-)
drivers/net/wireless/ath/ath11k/ahb.c +26 -0
@@ -638,6 +638,30 @@ static void ath11k_ahb_power_down(struct ath11k_base *ab)rproc_shutdown (ab->tgt_rproc); } +static int ath11k_ahb_fwreset_from_cold_boot (struct ath11k_base *ab) +{ +int timeout; + +if (ath11k_cold_boot_cal ==0 || ab->qmi.cal_done) +return 0 ; + +ath11k_dbg (ab,ATH11K_DBG_AHB ,"wait for cold boot done\n" ); + timeout =wait_event_timeout (ab->qmi.cold_boot_waitq, + (ab->qmi.cal_done ==1 ), +ATH11K_COLD_BOOT_FW_RESET_DELAY ); +if (timeout <=0 ) { +ath11k_warn (ab,"Coldboot Calibration timed out\n" ); +return -ETIMEDOUT ; + } + +/* reset the firmware */ +ath11k_ahb_power_down (ab); +ath11k_ahb_power_up (ab); + +ath11k_dbg (ab,ATH11K_DBG_AHB ,"exit wait for cold boot done\n" ); +return 0 ; +} +static void ath11k_ahb_init_qmi_ce_config (struct ath11k_base *ab) {struct ath11k_qmi_ce_cfg *cfg = &ab->qmi.ce_cfg;
@@ -964,6 +988,8 @@ static int ath11k_ahb_probe(struct platform_device *pdev) goto err_ce_free; } +ath11k_ahb_fwreset_from_cold_boot (ab); +return 0 ; err_ce_free:
drivers/net/wireless/ath/ath11k/core.c +1 -0
@@ -801,6 +801,7 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,INIT_LIST_HEAD (&ab->peers);init_waitqueue_head (&ab->peer_mapping_wq);init_waitqueue_head (&ab->wmi_ab.tx_credits_wq); +init_waitqueue_head (&ab->qmi.cold_boot_waitq);INIT_WORK (&ab->restart_work, ath11k_core_restart);timer_setup (&ab->rx_replenish_retry, ath11k_ce_rx_replenish_retry,0 ); ab->dev = dev;
drivers/net/wireless/ath/ath11k/core.h +5 -0
@@ -98,8 +98,13 @@ enum ath11k_firmware_mode {/* factory tests etc */ ATH11K_FIRMWARE_MODE_FTM , + +/* Cold boot calibration */ + ATH11K_FIRMWARE_MODE_COLD_BOOT = 7, }; +extern bool ath11k_cold_boot_cal; +#define ATH11K_IRQ_NUM_MAX 52#define ATH11K_EXT_IRQ_GRP_NUM_MAX 11#define ATH11K_EXT_IRQ_NUM_MAX 16
drivers/net/wireless/ath/ath11k/qmi.c +59 -7
100 lines not on this page · raw message
drivers/net/wireless/ath/ath11k/qmi.h +3 -0
@@ -12,6 +12,7 @@#define ATH11K_HOST_VERSION_STRING "WIN"#define ATH11K_QMI_WLANFW_TIMEOUT_MS 5000#define ATH11K_QMI_MAX_BDF_FILE_NAME_SIZE 64 +#define ATH11K_QMI_CALDB_ADDRESS 0x4BA00000#define ATH11K_QMI_BDF_MAX_SIZE (256 * 1024)#define ATH11K_QMI_CALDATA_OFFSET (128 * 1024)#define ATH11K_QMI_WLANFW_MAX_BUILD_ID_LEN_V01 128
@@ -31,6 +32,7 @@#define QMI_WLANFW_MAX_DATA_SIZE_V01 6144#define ATH11K_FIRMWARE_MODE_OFF 4#define ATH11K_QMI_TARGET_MEM_MODE_DEFAULT 0 +#define ATH11K_COLD_BOOT_FW_RESET_DELAY (40 * HZ)struct ath11k_base ;
@@ -110,6 +112,7 @@ struct ath11k_qmi {u32 target_mem_mode;u8 cal_done;struct target_info target; +wait_queue_head_t cold_boot_waitq; };#define QMI_WLANFW_HOST_CAP_REQ_MSG_V01_MAX_LEN 189
Signature · 1 line
2.7.4
Quoted 19 lines · Sowmiya Sree Elavalagan
From: Govindaraj Saminathan <[email protected]>
cold boot calibration is the process to calibrate all the channels during the boot-up to avoid the calibration delay during the channel change.
During the boot-up, firmware started with mode “cold_boot_calibration” Firmware calibrate all channels and generate CalDb(DDR). Subsequent WIFI ON will reuse the same CalDb.
Firmware restarted with Mission mode to continue the normal operation.caldb memory address send to firmware through the QMI message.Firmware use this address to store the caldb data and use it until next reboot.
This will give the improvement during the channel change. But it is increasing the boot-up time(up to 15sec depend on number of radios). So if the user want to reduce the boot-up time and accepting for channel change delay, user can disable this feature using the module param
cold_boot_cal=0.
Quoted 3 lines
Signed-off-by Govindaraj Saminathan <[email protected]>Co-developed-by Sowmiya Sree Elavalagan <[email protected]>Signed-off-by Sowmiya Sree Elavalagan <[email protected]>
Fails to apply, please rebase:
error: patch failed: drivers/net/wireless/ath/ath11k/core.h:98
error: drivers/net/wireless/ath/ath11k/core.h: patch does not apply
error: patch failed: drivers/net/wireless/ath/ath11k/qmi.c:9
error: drivers/net/wireless/ath/ath11k/qmi.c: patch does not apply
error: patch failed: drivers/net/wireless/ath/ath11k/qmi.h:110
error: drivers/net/wireless/ath/ath11k/qmi.h: patch does not apply stg import: Diff does not apply cleanly
Patch set to Changes Requested.
Signature · 9 lines
https://patchwork.kernel.org/patch/11656087/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches -- ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Quoted 19 lines · Sowmiya Sree Elavalagan
From: Govindaraj Saminathan <[email protected]>
cold boot calibration is the process to calibrate all the channels during the boot-up to avoid the calibration delay during the channel change.
During the boot-up, firmware started with mode “cold_boot_calibration” Firmware calibrate all channels and generate CalDb(DDR). Subsequent WIFI ON will reuse the same CalDb.
Firmware restarted with Mission mode to continue the normal operation.caldb memory address send to firmware through the QMI message.Firmware use this address to store the caldb data and use it until next reboot.
This will give the improvement during the channel change. But it is increasing the boot-up time(up to 15sec depend on number of radios). So if the user want to reduce the boot-up time and accepting for channel change delay, user can disable this feature using the module param
cold_boot_cal=0.
Quoted 3 lines
Signed-off-by Govindaraj Saminathan <[email protected]>Co-developed-by Sowmiya Sree Elavalagan <[email protected]>Signed-off-by Sowmiya Sree Elavalagan <[email protected]>
Fails to apply, please rebase:
error: patch failed: drivers/net/wireless/ath/ath11k/core.h:98
error: drivers/net/wireless/ath/ath11k/core.h: patch does not apply
error: patch failed: drivers/net/wireless/ath/ath11k/qmi.c:9
error: drivers/net/wireless/ath/ath11k/qmi.c: patch does not apply
error: patch failed: drivers/net/wireless/ath/ath11k/qmi.h:110
error: drivers/net/wireless/ath/ath11k/qmi.h: patch does not apply stg import: Diff does not apply cleanly
Patch set to Changes Requested.
Signature · 3 lines
https://patchwork.kernel.org/patch/11656087/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Quoted 19 lines · Sowmiya Sree Elavalagan
From: Govindaraj Saminathan <[email protected]>
cold boot calibration is the process to calibrate all the channels during the boot-up to avoid the calibration delay during the channel change.
During the boot-up, firmware started with mode “cold_boot_calibration” Firmware calibrate all channels and generate CalDb(DDR). Subsequent WIFI ON will reuse the same CalDb.
Firmware restarted with Mission mode to continue the normal operation.caldb memory address send to firmware through the QMI message.Firmware use this address to store the caldb data and use it until next reboot.
This will give the improvement during the channel change. But it is increasing the boot-up time(up to 15sec depend on number of radios). So if the user want to reduce the boot-up time and accepting for channel change delay, user can disable this feature using the module param
cold_boot_cal=0.
Quoted 3 lines
Signed-off-by Govindaraj Saminathan <[email protected]>Co-developed-by Sowmiya Sree Elavalagan <[email protected]>Signed-off-by Sowmiya Sree Elavalagan <[email protected]>
Please add a Tested-on tag.
What hardware does support this feature? I guess QCA6390 does not? So I wonder should we only enable this on hardware which we know supports this? For the rest we would just give a warning and not enable the feature. And to do that we would have a boolean for each hardware in hw_params.
drivers/net/wireless/ath/ath11k/qmi.c int ath11k_qmi_firmware_start(struct ath11k_base *ab, · line 2138
Quoted 12 lines
drivers/net/wireless/ath/ath11k/qmi.c +12
-0+static int ath11k_qmi_process_coldboot_calibration (struct ath11k_base *ab) +{ +int timeout; +int ret; + + ret =ath11k_qmi_wlanfw_mode_send (ab,ATH11K_FIRMWARE_MODE_COLD_BOOT ); +if (ret <0 ) { +ath11k_warn (ab,"qmi failed to send wlan fw mode:%d\n" , ret); +return ret; + } + +ath11k_warn (ab,"Coldboot calibration wait started\n" );
This should be a debug message.
drivers/net/wireless/ath/ath11k/qmi.c int ath11k_qmi_firmware_start(struct ath11k_base *ab, · line 2148
Quoted 9 lines
drivers/net/wireless/ath/ath11k/qmi.c +9
-0+ timeout =wait_event_timeout (ab->qmi.cold_boot_waitq, + (ab->qmi.cal_done ==1 ), +ATH11K_COLD_BOOT_FW_RESET_DELAY ); +if (timeout <=0 ) { +ath11k_warn (ab,"Coldboot Calibration timed out\n" ); +return -ETIMEDOUT ; + } + +ath11k_warn (ab,"Coldboot calibration wait ended\n" );
And this too.
Signature · 6 lines
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches -- ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Quoted 19 lines · Sowmiya Sree Elavalagan
From: Govindaraj Saminathan <[email protected]>
cold boot calibration is the process to calibrate all the channels during the boot-up to avoid the calibration delay during the channel change.
During the boot-up, firmware started with mode “cold_boot_calibration” Firmware calibrate all channels and generate CalDb(DDR). Subsequent WIFI ON will reuse the same CalDb.
Firmware restarted with Mission mode to continue the normal operation.caldb memory address send to firmware through the QMI message.Firmware use this address to store the caldb data and use it until next reboot.
This will give the improvement during the channel change. But it is increasing the boot-up time(up to 15sec depend on number of radios). So if the user want to reduce the boot-up time and accepting for channel change delay, user can disable this feature using the module param
cold_boot_cal=0.
Quoted 3 lines
Signed-off-by Govindaraj Saminathan <[email protected]>Co-developed-by Sowmiya Sree Elavalagan <[email protected]>Signed-off-by Sowmiya Sree Elavalagan <[email protected]>
Please add a Tested-on tag.
What hardware does support this feature? I guess QCA6390 does not? So I wonder should we only enable this on hardware which we know supports this? For the rest we would just give a warning and not enable the feature. And to do that we would have a boolean for each hardware in hw_params.
drivers/net/wireless/ath/ath11k/qmi.c int ath11k_qmi_firmware_start(struct ath11k_base *ab, · line 2138
Quoted 12 lines
drivers/net/wireless/ath/ath11k/qmi.c +12
-0+static int ath11k_qmi_process_coldboot_calibration (struct ath11k_base *ab) +{ +int timeout; +int ret; + + ret =ath11k_qmi_wlanfw_mode_send (ab,ATH11K_FIRMWARE_MODE_COLD_BOOT ); +if (ret <0 ) { +ath11k_warn (ab,"qmi failed to send wlan fw mode:%d\n" , ret); +return ret; + } + +ath11k_warn (ab,"Coldboot calibration wait started\n" );
This should be a debug message.
drivers/net/wireless/ath/ath11k/qmi.c int ath11k_qmi_firmware_start(struct ath11k_base *ab, · line 2148
Quoted 9 lines
drivers/net/wireless/ath/ath11k/qmi.c +9
-0+ timeout =wait_event_timeout (ab->qmi.cold_boot_waitq, + (ab->qmi.cal_done ==1 ), +ATH11K_COLD_BOOT_FW_RESET_DELAY ); +if (timeout <=0 ) { +ath11k_warn (ab,"Coldboot Calibration timed out\n" ); +return -ETIMEDOUT ; + } + +ath11k_warn (ab,"Coldboot calibration wait ended\n" );
And this too.
Signature · 1 line
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches