903-ath11k-support-setting-FW-memory-mode-via-DT.patch 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. From fb1c40c225cbc413d82c872dd8c8af3469b2b921 Mon Sep 17 00:00:00 2001
  2. From: Robert Marko <robimarko@gmail.com>
  3. Date: Fri, 16 Dec 2022 17:17:52 +0100
  4. Subject: [PATCH] ath11k: support setting FW memory mode via DT
  5. ath11k is really memory intensive for devices with less that 1GB of RAM,
  6. so lets allow saving a significant amount of memory by setting the FW to
  7. Mode-1 via DTS for devices that need it.
  8. However the drawback is reduced number of VDEV-s and peers which is a
  9. reasonable tradeoff.
  10. Mode-2 allows for further reduction, but it has further restrictions.
  11. While we are here, lets add a print to be able to easily determine what
  12. FW memory mode is being used.
  13. Signed-off-by: Robert Marko <robimarko@gmail.com>
  14. ---
  15. drivers/net/wireless/ath/ath11k/core.c | 28 ++++++++++++++++++++++++--
  16. 1 file changed, 26 insertions(+), 2 deletions(-)
  17. --- a/drivers/net/wireless/ath/ath11k/core.c
  18. +++ b/drivers/net/wireless/ath/ath11k/core.c
  19. @@ -36,7 +36,7 @@ bool ath11k_ftm_mode;
  20. module_param_named(ftm_mode, ath11k_ftm_mode, bool, 0444);
  21. MODULE_PARM_DESC(ftm_mode, "Boots up in factory test mode");
  22. -static const struct ath11k_hw_params ath11k_hw_params[] = {
  23. +static struct ath11k_hw_params ath11k_hw_params[] = {
  24. {
  25. .hw_rev = ATH11K_HW_IPQ8074,
  26. .name = "ipq8074 hw2.0",
  27. @@ -1953,7 +1953,8 @@ static void ath11k_core_reset(struct wor
  28. static int ath11k_init_hw_params(struct ath11k_base *ab)
  29. {
  30. const struct ath11k_hw_params *hw_params = NULL;
  31. - int i;
  32. + u32 fw_mem_mode;
  33. + int i, ret;
  34. for (i = 0; i < ARRAY_SIZE(ath11k_hw_params); i++) {
  35. hw_params = &ath11k_hw_params[i];
  36. @@ -1969,7 +1970,30 @@ static int ath11k_init_hw_params(struct
  37. ab->hw_params = *hw_params;
  38. + ret = of_property_read_u32(ab->dev->of_node,
  39. + "qcom,ath11k-fw-memory-mode",
  40. + &fw_mem_mode);
  41. + if (!ret) {
  42. + if (fw_mem_mode == 0) {
  43. + ab->hw_params.fw_mem_mode = 0;
  44. + ab->hw_params.num_vdevs = 16 + 1;
  45. + ab->hw_params.num_peers = 512;
  46. + }
  47. + else if (fw_mem_mode == 1) {
  48. + ab->hw_params.fw_mem_mode = 1;
  49. + ab->hw_params.num_vdevs = 8;
  50. + ab->hw_params.num_peers = 128;
  51. + } else if (fw_mem_mode == 2) {
  52. + ab->hw_params.fw_mem_mode = 2;
  53. + ab->hw_params.num_vdevs = 8;
  54. + ab->hw_params.num_peers = 128;
  55. + ab->hw_params.cold_boot_calib = false;
  56. + } else
  57. + ath11k_info(ab, "Unsupported FW memory mode: %u\n", fw_mem_mode);
  58. + }
  59. +
  60. ath11k_info(ab, "%s\n", ab->hw_params.name);
  61. + ath11k_info(ab, "FW memory mode: %d\n", ab->hw_params.fw_mem_mode);
  62. return 0;
  63. }