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
6 ath11k is really memory intensive for devices with less that 1GB of RAM,
7 so lets allow saving a significant amount of memory by setting the FW to
8 Mode-1 via DTS for devices that need it.
10 However the drawback is reduced number of VDEV-s and peers which is a
13 Mode-2 allows for further reduction, but it has further restrictions.
15 While we are here, lets add a print to be able to easily determine what
16 FW memory mode is being used.
18 Signed-off-by: Robert Marko <robimarko@gmail.com>
20 drivers/net/wireless/ath/ath11k/core.c | 28 ++++++++++++++++++++++++--
21 1 file changed, 26 insertions(+), 2 deletions(-)
23 --- a/drivers/net/wireless/ath/ath11k/core.c
24 +++ b/drivers/net/wireless/ath/ath11k/core.c
25 @@ -32,7 +32,7 @@ module_param_named(frame_mode, ath11k_fr
26 MODULE_PARM_DESC(frame_mode,
27 "Datapath frame mode (0: raw, 1: native wifi (default), 2: ethernet)");
29 -static const struct ath11k_hw_params ath11k_hw_params[] = {
30 +static struct ath11k_hw_params ath11k_hw_params[] = {
32 .hw_rev = ATH11K_HW_IPQ8074,
33 .name = "ipq8074 hw2.0",
34 @@ -1911,7 +1911,8 @@ static void ath11k_core_reset(struct wor
35 static int ath11k_init_hw_params(struct ath11k_base *ab)
37 const struct ath11k_hw_params *hw_params = NULL;
42 for (i = 0; i < ARRAY_SIZE(ath11k_hw_params); i++) {
43 hw_params = &ath11k_hw_params[i];
44 @@ -1927,7 +1928,30 @@ static int ath11k_init_hw_params(struct
46 ab->hw_params = *hw_params;
48 + ret = of_property_read_u32(ab->dev->of_node,
49 + "qcom,ath11k-fw-memory-mode",
52 + if (fw_mem_mode == 0) {
53 + ab->hw_params.fw_mem_mode = 0;
54 + ab->hw_params.num_vdevs = 16 + 1;
55 + ab->hw_params.num_peers = 512;
57 + else if (fw_mem_mode == 1) {
58 + ab->hw_params.fw_mem_mode = 1;
59 + ab->hw_params.num_vdevs = 8;
60 + ab->hw_params.num_peers = 128;
61 + } else if (fw_mem_mode == 2) {
62 + ab->hw_params.fw_mem_mode = 2;
63 + ab->hw_params.num_vdevs = 8;
64 + ab->hw_params.num_peers = 128;
65 + ab->hw_params.cold_boot_calib = false;
67 + ath11k_info(ab, "Unsupported FW memory mode: %u\n", fw_mem_mode);
70 ath11k_info(ab, "%s\n", ab->hw_params.name);
71 + ath11k_info(ab, "FW memory mode: %d\n", ab->hw_params.fw_mem_mode);