Commit 8e100354 authored by Vasanthakumar Thiagarajan's avatar Vasanthakumar Thiagarajan Committed by Kalle Valo

ath10k: fix cycle counter wraparound handling for QCA4019

In QCA4019, cycle counter wraparound is not tied to rx
clear counter. Each counter would wraparound individually
and after wraparound the respective counter will be reset
to 0x7fffffff while other counter still running unaffected.
Define a new wraparound type for this behaviour and handle
it separately so that rx clear counter wraparound is also
handled just like cycle counter. With this type of
wraparound we can accurately compute and report channel
active/busy time when any of the counter overflows.

Fixes: ee9ca147 ("ath10k: Fix survey reporting with QCA4019")
Signed-off-by: default avatarVasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 26c19760
...@@ -246,7 +246,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -246,7 +246,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.name = "qca4019 hw1.0", .name = "qca4019 hw1.0",
.patch_load_addr = QCA4019_HW_1_0_PATCH_LOAD_ADDR, .patch_load_addr = QCA4019_HW_1_0_PATCH_LOAD_ADDR,
.uart_pin = 7, .uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
.otp_exe_param = 0x0010000, .otp_exe_param = 0x0010000,
.continuous_frag_desc = true, .continuous_frag_desc = true,
.cck_rate_map_rev2 = true, .cck_rate_map_rev2 = true,
......
...@@ -179,19 +179,35 @@ void ath10k_hw_fill_survey_time(struct ath10k *ar, struct survey_info *survey, ...@@ -179,19 +179,35 @@ void ath10k_hw_fill_survey_time(struct ath10k *ar, struct survey_info *survey,
u32 cc, u32 rcc, u32 cc_prev, u32 rcc_prev) u32 cc, u32 rcc, u32 cc_prev, u32 rcc_prev)
{ {
u32 cc_fix = 0; u32 cc_fix = 0;
u32 rcc_fix = 0;
enum ath10k_hw_cc_wraparound_type wraparound_type; enum ath10k_hw_cc_wraparound_type wraparound_type;
survey->filled |= SURVEY_INFO_TIME | survey->filled |= SURVEY_INFO_TIME |
SURVEY_INFO_TIME_BUSY; SURVEY_INFO_TIME_BUSY;
wraparound_type = ar->hw_params.cc_wraparound_type; wraparound_type = ar->hw_params.cc_wraparound_type;
if (wraparound_type == ATH10K_HW_CC_WRAP_SHIFTED_ALL && cc < cc_prev) {
cc_fix = 0x7fffffff; if (cc < cc_prev || rcc < rcc_prev) {
survey->filled &= ~SURVEY_INFO_TIME_BUSY; switch (wraparound_type) {
case ATH10K_HW_CC_WRAP_SHIFTED_ALL:
if (cc < cc_prev) {
cc_fix = 0x7fffffff;
survey->filled &= ~SURVEY_INFO_TIME_BUSY;
}
break;
case ATH10K_HW_CC_WRAP_SHIFTED_EACH:
if (cc < cc_prev)
cc_fix = 0x7fffffff;
else
rcc_fix = 0x7fffffff;
break;
case ATH10K_HW_CC_WRAP_DISABLED:
break;
}
} }
cc -= cc_prev - cc_fix; cc -= cc_prev - cc_fix;
rcc -= rcc_prev; rcc -= rcc_prev - rcc_fix;
survey->time = CCNT_TO_MSEC(ar, cc); survey->time = CCNT_TO_MSEC(ar, cc);
survey->time_busy = CCNT_TO_MSEC(ar, rcc); survey->time_busy = CCNT_TO_MSEC(ar, rcc);
......
...@@ -360,6 +360,15 @@ enum ath10k_hw_cc_wraparound_type { ...@@ -360,6 +360,15 @@ enum ath10k_hw_cc_wraparound_type {
* by 2 so they never wraparound themselves. * by 2 so they never wraparound themselves.
*/ */
ATH10K_HW_CC_WRAP_SHIFTED_ALL = 1, ATH10K_HW_CC_WRAP_SHIFTED_ALL = 1,
/* Each hw counter wrapsaround independently. When the
* counter overflows the repestive counter is right shifted
* by 1, i.e reset to 0x7fffffff, and other counters will be
* running unaffected. In this type of wraparound, it should
* be possible to report accurate Rx busy time unlike the
* first type.
*/
ATH10K_HW_CC_WRAP_SHIFTED_EACH = 2,
}; };
/* Target specific defines for MAIN firmware */ /* Target specific defines for MAIN firmware */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment