329-ath10k-add-BMI-parameters-to-fix-calibration-from-DT.patch 2.6 KB

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