wlan-ap-Telecominfraproject/feeds/ipq95xx/mac80211/patches/qca/764-ath12k-Add-the-cold-boot-calibration-support.patch
John Crispin 144c5d00f4 ipq95xx/mac80211: update to ATH12.3-CS
Signed-off-by: John Crispin <john@phrozen.org>
2024-02-28 18:56:21 +01:00

90 lines
3.5 KiB
Diff

From aeda9eed1f7800a01651e76b5521abcb4878c599 Mon Sep 17 00:00:00 2001
From: Sivashankari Madhavan <quic_sivamadh@quicinc.com>
Date: Thu, 16 Mar 2023 15:34:39 +0530
Subject: [PATCH] ath12k: Add the cold boot calibration support
While enabling the cold boot calibration faced a firmware crash issue.
From the triage, the caldb mem chunk address differed from QCN9274 and
IPQ5332. Due to this, in bootup system referring to the invalid memory
address.
Now adds the changes to support the cold boot calibration and caldb
memory parsing for AHB.
Signed-off-by: Sivashankari Madhavan <quic_sivamadh@quicinc.com>
---
drivers/net/wireless/ath/ath12k/hw.c | 2 +-
drivers/net/wireless/ath/ath12k/qmi.c | 40 +++++++++++++++++++++++----
2 files changed, 35 insertions(+), 7 deletions(-)
Index: backports-20220822-5.4.213-ef7197996efe/drivers/net/wireless/ath/ath12k/hw.c
===================================================================
--- backports-20220822-5.4.213-ef7197996efe.orig/drivers/net/wireless/ath/ath12k/hw.c
+++ backports-20220822-5.4.213-ef7197996efe/drivers/net/wireless/ath/ath12k/hw.c
@@ -1674,7 +1674,7 @@ static const struct ath12k_hw_params ath
.supports_monitor = true,
.idle_ps = false,
- .cold_boot_calib = false,
+ .cold_boot_calib = true,
.download_calib = true,
.supports_suspend = false,
.tcl_ring_retry = true,
Index: backports-20220822-5.4.213-ef7197996efe/drivers/net/wireless/ath/ath12k/qmi.c
===================================================================
--- backports-20220822-5.4.213-ef7197996efe.orig/drivers/net/wireless/ath/ath12k/qmi.c
+++ backports-20220822-5.4.213-ef7197996efe/drivers/net/wireless/ath/ath12k/qmi.c
@@ -3977,7 +3977,9 @@ static int ath12k_qmi_assign_target_mem_
struct resource res;
int host_ddr_sz, mlo_ddr_sz, sz, mlo_sz = 0;
int i, idx, mlo_idx, ret;
- unsigned int bdf_location[MAX_TGT_MEM_MODES];
+ unsigned int bdf_location[MAX_TGT_MEM_MODES],
+ caldb_location[MAX_TGT_MEM_MODES],
+ caldb_size[1];
sz = ab->host_ddr_fixed_mem_off;
hremote_node = of_parse_phandle(dev->of_node, "memory-region", 0);
@@ -4057,11 +4059,36 @@ skip_mlo_mem_init:
break;
case CALDB_MEM_REGION_TYPE:
if (ath12k_cold_boot_cal &&
- ab->hw_params->cold_boot_calib) {
- ab->qmi.target_mem[idx].v.ioaddr =
- ioremap(ab->qmi.target_mem[idx].paddr,
- ab->qmi.target_mem[i].size);
- sz += ab->qmi.target_mem[i].size;
+ ab->hw_params->cold_boot_calib) {
+ if (ab->hif.bus == ATH12K_BUS_AHB) {
+ if (of_property_read_u32_array(dev->of_node,
+ "qcom,caldb-addr", caldb_location,
+ ARRAY_SIZE(caldb_location))) {
+ ath12k_err(ab, "CALDB_MEM_REGION Not defined in device_tree\n");
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if (of_property_read_u32_array(dev->of_node,
+ "qcom,caldb-size", caldb_size,
+ ARRAY_SIZE(caldb_size))) {
+ ath12k_err(ab, "CALDB_SIZE Not defined in device_tree\n");
+ ret = -EINVAL;
+ goto out;
+ }
+
+ ab->qmi.target_mem[idx].paddr = caldb_location[0];
+ ab->qmi.target_mem[i].size = caldb_size[0];
+
+ ab->qmi.target_mem[idx].v.ioaddr =
+ ioremap(ab->qmi.target_mem[idx].paddr,
+ ab->qmi.target_mem[i].size);
+ } else {
+ ab->qmi.target_mem[idx].v.ioaddr =
+ ioremap(ab->qmi.target_mem[idx].paddr,
+ ab->qmi.target_mem[i].size);
+ sz += ab->qmi.target_mem[i].size;
+ }
} else {
ab->qmi.target_mem[idx].paddr = 0;
ab->qmi.target_mem[idx].v.ioaddr = NULL;