sunxi: improve A20 Lime2 upload speed
[openwrt/staging/lynxis.git] / package / kernel / mac80211 / patches / 329-ath10k-add-BMI-parameters-to-fix-calibration-from-DT.patch
1 From: Anilkumar Kolli <akolli@qti.qualcomm.com>
2 Date: Wed, 31 May 2017 14:21:27 +0300
3 Subject: [PATCH] ath10k: add BMI parameters to fix calibration from
4 DT/pre-cal
5
6 QCA99X0, QCA9888, QCA9984 supports calibration data in
7 either OTP or DT/pre-cal file. Current ath10k supports
8 Calibration data from OTP only.
9
10 If caldata is loaded from DT/pre-cal file, fetching board id
11 and applying calibration parameters like tx power gets failed.
12
13 error log:
14 [ 15.733663] ath10k_pci 0000:01:00.0: failed to fetch board file: -2
15 [ 15.741474] ath10k_pci 0000:01:00.0: could not probe fw (-2)
16
17 This patch adds calibration data support from DT/pre-cal
18 file. Below parameters are used to get board id and
19 applying calibration parameters from cal data.
20
21 EEPROM[OTP] FLASH[DT/pre-cal file]
22 Cal param 0x700 0x10000
23 Board id 0x10 0x8000
24
25 Tested on QCA9888 with pre-cal file.
26
27 Signed-off-by: Anilkumar Kolli <akolli@qti.qualcomm.com>
28 Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
29 ---
30
31 --- a/drivers/net/wireless/ath/ath10k/bmi.h
32 +++ b/drivers/net/wireless/ath/ath10k/bmi.h
33 @@ -83,6 +83,8 @@ enum bmi_cmd_id {
34 #define BMI_NVRAM_SEG_NAME_SZ 16
35
36 #define BMI_PARAM_GET_EEPROM_BOARD_ID 0x10
37 +#define BMI_PARAM_GET_FLASH_BOARD_ID 0x8000
38 +#define BMI_PARAM_FLASH_SECTION_ALL 0x10000
39
40 #define ATH10K_BMI_BOARD_ID_FROM_OTP_MASK 0x7c00
41 #define ATH10K_BMI_BOARD_ID_FROM_OTP_LSB 10
42 --- a/drivers/net/wireless/ath/ath10k/core.c
43 +++ b/drivers/net/wireless/ath/ath10k/core.c
44 @@ -657,7 +657,7 @@ static int ath10k_core_get_board_id_from
45 {
46 u32 result, address;
47 u8 board_id, chip_id;
48 - int ret;
49 + int ret, bmi_board_id_param;
50
51 address = ar->hw_params.patch_load_addr;
52
53 @@ -681,8 +681,13 @@ static int ath10k_core_get_board_id_from
54 return ret;
55 }
56
57 - ret = ath10k_bmi_execute(ar, address, BMI_PARAM_GET_EEPROM_BOARD_ID,
58 - &result);
59 + if (ar->cal_mode == ATH10K_PRE_CAL_MODE_DT ||
60 + ar->cal_mode == ATH10K_PRE_CAL_MODE_FILE)
61 + bmi_board_id_param = BMI_PARAM_GET_FLASH_BOARD_ID;
62 + else
63 + bmi_board_id_param = BMI_PARAM_GET_EEPROM_BOARD_ID;
64 +
65 + ret = ath10k_bmi_execute(ar, address, bmi_board_id_param, &result);
66 if (ret) {
67 ath10k_err(ar, "could not execute otp for board id check: %d\n",
68 ret);
69 @@ -810,6 +815,11 @@ static int ath10k_download_and_run_otp(s
70 return ret;
71 }
72
73 + /* As of now pre-cal is valid for 10_4 variants */
74 + if (ar->cal_mode == ATH10K_PRE_CAL_MODE_DT ||
75 + ar->cal_mode == ATH10K_PRE_CAL_MODE_FILE)
76 + bmi_otp_exe_param = BMI_PARAM_FLASH_SECTION_ALL;
77 +
78 ret = ath10k_bmi_execute(ar, address, bmi_otp_exe_param, &result);
79 if (ret) {
80 ath10k_err(ar, "could not execute otp (%d)\n", ret);