From: Anilkumar Kolli <[email protected]>
QCA99X0, QCA9888, QCA9984 supports calibration data in
either OTP or DT/pre-cal file. Current ath10k supports
Calibration data from OTP only.
If caldata is loaded from DT/pre-cal file, fetching board id
and applying calibration parameters like tx power gets failed.
error log:
[ 15.733663] ath10k_pci 0000:01:00.0: failed to fetch board file: -2
[ 15.741474] ath10k_pci 0000:01:00.0: could not probe fw (-2)
This patch adds calibration data support from DT/pre-cal
file. Below parameters are used to get board id and
applying calibration parameters from cal data.
EEPROM[OTP] FLASH[DT/pre-cal file]
Cal param 0x700 0x10000
Board id 0x10 0x8000
Tested on QCA9888 with pre-cal file.
Signed-off-by: Anilkumar Kolli <[email protected]>
---
drivers/net/wireless/ath/ath10k/bmi.h | 2 ++
drivers/net/wireless/ath/ath10k/core.c | 16 +++++++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/bmi.h b/drivers/net/wireless/ath/ath10k/bmi.h
index 0342073ed397..9834f351807e 100644
--- a/drivers/net/wireless/ath/ath10k/bmi.h
+++ b/drivers/net/wireless/ath/ath10k/bmi.h
@@ -83,6 +83,8 @@ enum bmi_cmd_id {
#define BMI_NVRAM_SEG_NAME_SZ 16
#define BMI_PARAM_GET_EEPROM_BOARD_ID 0x10
+#define BMI_PARAM_GET_FLASH_BOARD_ID 0x8000
+#define BMI_PARAM_FLASH_SECTION_ALL 0x10000
#define ATH10K_BMI_BOARD_ID_FROM_OTP_MASK 0x7c00
#define ATH10K_BMI_BOARD_ID_FROM_OTP_LSB 10
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index eea111d704c5..fb859a0c197a 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -691,7 +691,7 @@ static int ath10k_core_get_board_id_from_otp(struct ath10k *ar)
{
u32 result, address;
u8 board_id, chip_id;
- int ret;
+ int ret, bmi_board_id_param;
address = ar->hw_params.patch_load_addr;
@@ -715,8 +715,13 @@ static int ath10k_core_get_board_id_from_otp(struct ath10k *ar)
return ret;
}
- ret = ath10k_bmi_execute(ar, address, BMI_PARAM_GET_EEPROM_BOARD_ID,
- &result);
+ if (ar->cal_mode == ATH10K_PRE_CAL_MODE_DT ||
+ ar->cal_mode == ATH10K_PRE_CAL_MODE_FILE)
+ bmi_board_id_param = BMI_PARAM_GET_FLASH_BOARD_ID;
+ else
+ bmi_board_id_param = BMI_PARAM_GET_EEPROM_BOARD_ID;
+
+ ret = ath10k_bmi_execute(ar, address, bmi_board_id_param, &result);
if (ret) {
ath10k_err(ar, "could not execute otp for board id check: %d\n",
ret);
@@ -845,6 +850,11 @@ static int ath10k_download_and_run_otp(struct ath10k *ar)
return ret;
}
+ /* As of now pre-cal is valid for 10_4 variants */
+ if (ar->cal_mode == ATH10K_PRE_CAL_MODE_DT ||
+ ar->cal_mode == ATH10K_PRE_CAL_MODE_FILE)
+ bmi_otp_exe_param = BMI_PARAM_FLASH_SECTION_ALL;
+
ret = ath10k_bmi_execute(ar, address, bmi_otp_exe_param, &result);
if (ret) {
ath10k_err(ar, "could not execute otp (%d)\n", ret);
--
1.7.9.5
[email protected] wrote:
> QCA99X0, QCA9888, QCA9984 supports calibration data in
> either OTP or DT/pre-cal file. Current ath10k supports
> Calibration data from OTP only.
>
> If caldata is loaded from DT/pre-cal file, fetching board id
> and applying calibration parameters like tx power gets failed.
>
> error log:
> [ 15.733663] ath10k_pci 0000:01:00.0: failed to fetch board file: -2
> [ 15.741474] ath10k_pci 0000:01:00.0: could not probe fw (-2)
>
> This patch adds calibration data support from DT/pre-cal
> file. Below parameters are used to get board id and
> applying calibration parameters from cal data.
>
> EEPROM[OTP] FLASH[DT/pre-cal file]
> Cal param 0x700 0x10000
> Board id 0x10 0x8000
>
> Tested on QCA9888 with pre-cal file.
>
> Signed-off-by: Anilkumar Kolli <[email protected]>
> Signed-off-by: Kalle Valo <[email protected]>
Patch applied to ath-next branch of ath.git, thanks.
a9f5f287fa1d ath10k: add BMI parameters to fix calibration from DT/pre-cal
--
https://patchwork.kernel.org/patch/9748097/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
On Freitag, 8. Dezember 2017 18:05:38 CET [email protected] wrote:
> On 2017-12-08 17:42, Sven Eckelmann wrote:
> > On Donnerstag, 25. Mai 2017 16:21:23 CET [email protected] wrote:
> >> From: Anilkumar Kolli <[email protected]>
> >>
> >> QCA99X0, QCA9888, QCA9984 supports calibration data in
> >> either OTP or DT/pre-cal file. Current ath10k supports
> >> Calibration data from OTP only.
[...]
> > Just tried this on an QCA9984 which doesn't seem to have the
> > calibration data in the PCI EEPROM.
> >
> > [ 71.728929] ath10k_pci 0000:01:00.0: qca9984/qca9994 hw1.0
> > target 0x01000000 chip_id 0x00000000 sub 168c:cafe
> > [ 71.732926] ath10k_pci 0000:01:00.0: kconfig debug 1 debugfs 1
> > tracing 0 dfs 1 testmode 1
> > [ 71.752282] ath10k_pci 0000:01:00.0: firmware ver
> > 10.4-ct-9984-fW-009-dfa0083 api 5 features peer-flow-ctrl crc32
> > 7198d117
> > [ 73.805730] ath10k_pci 0000:01:00.0: unable to read from the
> > device
> > [ 73.805769] ath10k_pci 0000:01:00.0: could not execute otp for
> > board id check: -110
> >
>
> 'ATH10K driver <-> 10.4 firmware' expects cal data to be either in
> EEPROM or pre-cal-file or DT.
> Hope the error is observed when there is no cal data loaded.
The problem happens when pre-cal data file is loaded using the userspace
helper on the QCA9984. I was only able to use the device when I (for a test)
used the pre-cal data as cal-data (file).
The EEPROM on the on the PCI device doesn't seem to be populated with a valid
pre-cal data. I've already tested it with a QCA9984 device which had pre-cal
data in the PCI device's EEPROM and this worked fine (without cal file and
without pre-cal file).
> > It works when I use the pre-cal data as calibration data. The checksum
> > in the
> > pre-cal seems to be correct. Also the pre-cal data from 0:ART for the
> > 2.4GHz
> > and 5GHz QCA4019 seem to work perfectly fine.
> >
>
> Do you mean this patch works for only QCA4019 and not working for
> QCA9984 ?
Worked fine for QCA4019 and QCA9888 - but I had no luck with QCA9984. The
error shown above it the only thing I get.
Kind regards,
Sven
On 2017-12-08 17:42, Sven Eckelmann wrote:
> On Donnerstag, 25. Mai 2017 16:21:23 CET [email protected] wrote:
>> From: Anilkumar Kolli <[email protected]>
>>
>> QCA99X0, QCA9888, QCA9984 supports calibration data in
>> either OTP or DT/pre-cal file. Current ath10k supports
>> Calibration data from OTP only.
>>
>> If caldata is loaded from DT/pre-cal file, fetching board id
>> and applying calibration parameters like tx power gets failed.
>>
>> error log:
>> [ 15.733663] ath10k_pci 0000:01:00.0: failed to fetch board file: -2
>> [ 15.741474] ath10k_pci 0000:01:00.0: could not probe fw (-2)
>>
>> This patch adds calibration data support from DT/pre-cal
>> file. Below parameters are used to get board id and
>> applying calibration parameters from cal data.
>>
>> EEPROM[OTP] FLASH[DT/pre-cal file]
>> Cal param 0x700 0x10000
>> Board id 0x10 0x8000
>>
>> Tested on QCA9888 with pre-cal file.
>>
>> Signed-off-by: Anilkumar Kolli <[email protected]>
>> ---
>> drivers/net/wireless/ath/ath10k/bmi.h | 2 ++
>> drivers/net/wireless/ath/ath10k/core.c | 16 +++++++++++++---
>> 2 files changed, 15 insertions(+), 3 deletions(-)
>
> Just tried this on an QCA9984 which doesn't seem to have the
> calibration data in the PCI EEPROM.
>
> [ 71.728929] ath10k_pci 0000:01:00.0: qca9984/qca9994 hw1.0
> target 0x01000000 chip_id 0x00000000 sub 168c:cafe
> [ 71.732926] ath10k_pci 0000:01:00.0: kconfig debug 1 debugfs 1
> tracing 0 dfs 1 testmode 1
> [ 71.752282] ath10k_pci 0000:01:00.0: firmware ver
> 10.4-ct-9984-fW-009-dfa0083 api 5 features peer-flow-ctrl crc32
> 7198d117
> [ 73.805730] ath10k_pci 0000:01:00.0: unable to read from the
> device
> [ 73.805769] ath10k_pci 0000:01:00.0: could not execute otp for
> board id check: -110
>
'ATH10K driver <-> 10.4 firmware' expects cal data to be either in
EEPROM or pre-cal-file or DT.
Hope the error is observed when there is no cal data loaded.
> It works when I use the pre-cal data as calibration data. The checksum
> in the
> pre-cal seems to be correct. Also the pre-cal data from 0:ART for the
> 2.4GHz
> and 5GHz QCA4019 seem to work perfectly fine.
>
Do you mean this patch works for only QCA4019 and not working for
QCA9984 ?
> Anything which I could have missed or what I could test? Btw. I've also
> tested
> the non-ct firmware (aka the official one from QCA).
>
Thanks,
Anil.
On 2017-12-08 19:10, Sven Eckelmann wrote:
> On Freitag, 8. Dezember 2017 18:05:38 CET [email protected] wrote:
>> On 2017-12-08 17:42, Sven Eckelmann wrote:
>> > On Donnerstag, 25. Mai 2017 16:21:23 CET [email protected] wrote:
>> >> From: Anilkumar Kolli <[email protected]>
>> >>
>> >> QCA99X0, QCA9888, QCA9984 supports calibration data in
>> >> either OTP or DT/pre-cal file. Current ath10k supports
>> >> Calibration data from OTP only.
> [...]
>> > Just tried this on an QCA9984 which doesn't seem to have the
>> > calibration data in the PCI EEPROM.
>> >
>> > [ 71.728929] ath10k_pci 0000:01:00.0: qca9984/qca9994 hw1.0
>> > target 0x01000000 chip_id 0x00000000 sub 168c:cafe
>> > [ 71.732926] ath10k_pci 0000:01:00.0: kconfig debug 1 debugfs 1
>> > tracing 0 dfs 1 testmode 1
>> > [ 71.752282] ath10k_pci 0000:01:00.0: firmware ver
>> > 10.4-ct-9984-fW-009-dfa0083 api 5 features peer-flow-ctrl crc32
>> > 7198d117
>> > [ 73.805730] ath10k_pci 0000:01:00.0: unable to read from the
>> > device
>> > [ 73.805769] ath10k_pci 0000:01:00.0: could not execute otp for
>> > board id check: -110
>> >
>>
>> 'ATH10K driver <-> 10.4 firmware' expects cal data to be either in
>> EEPROM or pre-cal-file or DT.
>> Hope the error is observed when there is no cal data loaded.
>
> The problem happens when pre-cal data file is loaded using the
> userspace
> helper on the QCA9984. I was only able to use the device when I (for a
> test)
> used the pre-cal data as cal-data (file).
>
> The EEPROM on the on the PCI device doesn't seem to be populated with a
> valid
> pre-cal data. I've already tested it with a QCA9984 device which had
> pre-cal
> data in the PCI device's EEPROM and this worked fine (without cal file
> and
> without pre-cal file).
>
>> > It works when I use the pre-cal data as calibration data. The checksum
>> > in the
>> > pre-cal seems to be correct. Also the pre-cal data from 0:ART for the
>> > 2.4GHz
>> > and 5GHz QCA4019 seem to work perfectly fine.
>> >
>>
>> Do you mean this patch works for only QCA4019 and not working for
>> QCA9984 ?
>
> Worked fine for QCA4019 and QCA9888 - but I had no luck with QCA9984.
> The
> error shown above it the only thing I get.
>
I tested this on QCA9984 and it worked with below config,
pre-cal file location: /lib/firmware/ath10k/pre-cal-pci-0000:01:00.0.bin
FW:
https://github.com/kvalo/ath10k-firmware/raw/master/QCA9984/hw1.0/firmware-5.bin_10.4-3.2-00072
BDF:
https://github.com/kvalo/ath10k-firmware/raw/master/QCA9984/hw1.0/board-2.bin
Logs:
ath10k_pci 0000:01:00.0: found calibration file
ath10k/pre-cal-pci-0000:01:00.0.bin
ath10k_pci 0000:01:00.0: found fw version 10.4-3.2-00072
ath10k_pci 0000:01:00.0: boot cal file downloaded
ath10k_pci 0000:01:00.0: boot using calibration mode pre-cal-file
ath10k_pci 0000:01:00.0: boot upload otp to 0x1234 len 8919 for board id
bmi execute address 0x1234 param 0x8000
ath10k_pci 0000:01:00.0: bmi execute result 0x2800
ath10k_pci 0000:01:00.0: boot get otp board id result 0x00002800
board_id 10 chip_id 0
ath10k_pci 0000:01:00.0: boot using board name
'bus=pci,bmi-chip-id=0,bmi-board-id=10'
ath10k_pci 0000:01:00.0: Firmware loaded from user helper succesfully
ath10k_pci 0000:01:00.0: boot fw request
'ath10k/QCA9984/hw1.0/board-2.bin': 0
Kindly try with the latest firmware from Kalle's git mentioned above.
Thanks
Anil.
On Donnerstag, 25. Mai 2017 16:21:23 CET [email protected] wrote:
> From: Anilkumar Kolli <[email protected]>
>
> QCA99X0, QCA9888, QCA9984 supports calibration data in
> either OTP or DT/pre-cal file. Current ath10k supports
> Calibration data from OTP only.
>
> If caldata is loaded from DT/pre-cal file, fetching board id
> and applying calibration parameters like tx power gets failed.
>
> error log:
> [ 15.733663] ath10k_pci 0000:01:00.0: failed to fetch board file: -2
> [ 15.741474] ath10k_pci 0000:01:00.0: could not probe fw (-2)
>
> This patch adds calibration data support from DT/pre-cal
> file. Below parameters are used to get board id and
> applying calibration parameters from cal data.
>
> EEPROM[OTP] FLASH[DT/pre-cal file]
> Cal param 0x700 0x10000
> Board id 0x10 0x8000
>
> Tested on QCA9888 with pre-cal file.
>
> Signed-off-by: Anilkumar Kolli <[email protected]>
> ---
> drivers/net/wireless/ath/ath10k/bmi.h | 2 ++
> drivers/net/wireless/ath/ath10k/core.c | 16 +++++++++++++---
> 2 files changed, 15 insertions(+), 3 deletions(-)
Just tried this on an QCA9984 which doesn't seem to have the calibration data in the PCI EEPROM.
[ 71.728929] ath10k_pci 0000:01:00.0: qca9984/qca9994 hw1.0 target 0x01000000 chip_id 0x00000000 sub 168c:cafe
[ 71.732926] ath10k_pci 0000:01:00.0: kconfig debug 1 debugfs 1 tracing 0 dfs 1 testmode 1
[ 71.752282] ath10k_pci 0000:01:00.0: firmware ver 10.4-ct-9984-fW-009-dfa0083 api 5 features peer-flow-ctrl crc32 7198d117
[ 73.805730] ath10k_pci 0000:01:00.0: unable to read from the device
[ 73.805769] ath10k_pci 0000:01:00.0: could not execute otp for board id check: -110
It works when I use the pre-cal data as calibration data. The checksum in the
pre-cal seems to be correct. Also the pre-cal data from 0:ART for the 2.4GHz
and 5GHz QCA4019 seem to work perfectly fine.
Anything which I could have missed or what I could test? Btw. I've also tested
the non-ct firmware (aka the official one from QCA).
Kind
On Montag, 11. Dezember 2017 18:50:09 CET [email protected] wrote:
[...]
> >> > Just tried this on an QCA9984 which doesn't seem to have the
> >> > calibration data in the PCI EEPROM.
> >> >
> >> > [ 71.728929] ath10k_pci 0000:01:00.0: qca9984/qca9994 hw1.0
> >> > target 0x01000000 chip_id 0x00000000 sub 168c:cafe
> >> > [ 71.732926] ath10k_pci 0000:01:00.0: kconfig debug 1 debugfs 1
> >> > tracing 0 dfs 1 testmode 1
> >> > [ 71.752282] ath10k_pci 0000:01:00.0: firmware ver
> >> > 10.4-ct-9984-fW-009-dfa0083 api 5 features peer-flow-ctrl crc32
> >> > 7198d117
> >> > [ 73.805730] ath10k_pci 0000:01:00.0: unable to read from the
> >> > device
> >> > [ 73.805769] ath10k_pci 0000:01:00.0: could not execute otp for
> >> > board id check: -110
[...]
>
> I tested this on QCA9984 and it worked with below config,
[...]
>
> Kindly try with the latest firmware from Kalle's git mentioned above.
This didn't change the behavior. It was actually the OTP timeout problem on
the QCA9984 which Ben Greear fixed [1]. Luckily, LEDE added this patch with
your patch [2]
Kind regards,
Sven
[1] https://git.lede-project.org/?p=source.git;a=blob;f=package/kernel/mac80211/patches/327-ath10k-increase-BMI-timeout.patch;h=c9f493bcd8fe29afe1e08dc31b6370507b95fc72;hb=025cb640cdf27f7c68fc1d89d0698605daa06c43
[2] https://git.lede-project.org/?p=source.git;a=commit;h=025cb640cdf27f7c68fc1d89d0698605daa06c43