mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-18 09:51:26 +00:00
106 lines
3.8 KiB
Diff
106 lines
3.8 KiB
Diff
From b1b771b665e2eba1369c3f7896b7236e8c03886d Mon Sep 17 00:00:00 2001
|
|
From: Anilkumar Kolli <akolli@codeaurora.org>
|
|
Date: Wed, 23 Sep 2020 22:20:58 +0530
|
|
Subject: [PATCH] ath11k: use reserved memory from bootargs
|
|
|
|
QCN9000 FW uses HOST DDR memory.
|
|
For x86 reserve memory using memmap=60M$0x70000000
|
|
|
|
Identify the 60MB continuous memory with in 32bit address space
|
|
and reserve through kernel cmd line parameters.
|
|
|
|
when the FW request for the DDR HOST memory, send the reserved
|
|
address space offset and size in QMI.
|
|
|
|
Signed-off-by: Anilkumar Kolli <akolli@codeaurora.org>
|
|
---
|
|
drivers/net/wireless/ath/ath11k/core.c | 5 +++++
|
|
drivers/net/wireless/ath/ath11k/qmi.c | 29 +++++++++++++++++++++++++----
|
|
drivers/net/wireless/ath/ath11k/qmi.h | 1 +
|
|
3 files changed, 31 insertions(+), 4 deletions(-)
|
|
|
|
--- a/drivers/net/wireless/ath/ath11k/core.c
|
|
+++ b/drivers/net/wireless/ath/ath11k/core.c
|
|
@@ -31,6 +31,11 @@ MODULE_PARM_DESC(nss_offload, "Enable NS
|
|
|
|
struct ath11k_base *ath11k_soc;
|
|
|
|
+unsigned int ath11k_host_ddr_addr;
|
|
+EXPORT_SYMBOL(ath11k_host_ddr_addr);
|
|
+module_param_named(host_ddr_addr, ath11k_host_ddr_addr, uint, 0644);
|
|
+MODULE_PARM_DESC(host_ddr_addr, "host ddr addr for FW");
|
|
+
|
|
extern unsigned int ath11k_frame_mode;
|
|
|
|
static const struct ath11k_hw_params ath11k_hw_params[] = {
|
|
--- a/drivers/net/wireless/ath/ath11k/qmi.c
|
|
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
|
|
@@ -2345,6 +2345,9 @@ static int ath11k_qmi_alloc_target_mem_c
|
|
return 0;
|
|
}
|
|
|
|
+#define ATH11K_HOST_DDR_CALDB_OFFSET 0x3000000
|
|
+#define ATH11K_HOST_DDR_QDSS_OFFSET 0x400000
|
|
+
|
|
static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab)
|
|
{
|
|
struct device *dev = ab->dev;
|
|
@@ -2354,7 +2357,15 @@ static int ath11k_qmi_assign_target_mem_
|
|
for (i = 0, idx = 0; i < ab->qmi.mem_seg_count; i++) {
|
|
switch (ab->qmi.target_mem[i].type) {
|
|
case HOST_DDR_REGION_TYPE:
|
|
- if (of_property_read_u32(dev->of_node, "base-addr", &addr)) {
|
|
+ /* This is HACK
|
|
+ * QCN9000 Firmware needs contiguous 60MB HOST DDR memory
|
|
+ * use reserve memory from bootargs x86
|
|
+ * HACK reserve memory using memmap=60M$0x70000000
|
|
+ */
|
|
+
|
|
+ if (ath11k_host_ddr_addr) {
|
|
+ addr = ath11k_host_ddr_addr;
|
|
+ } else if (of_property_read_u32(dev->of_node, "base-addr", &addr)) {
|
|
ath11k_warn(ab, "qmi fail to get base-addr in dt\n");
|
|
return -EINVAL;
|
|
}
|
|
@@ -2378,7 +2389,10 @@ static int ath11k_qmi_assign_target_mem_
|
|
if (ab->qmi.target_mem[i].size > ab->hw_params.fw.cal_size)
|
|
ath11k_warn(ab, "qmi mem size is low to load caldata\n");
|
|
|
|
- if (of_property_read_u32(dev->of_node, "qcom,caldb-addr", &addr))
|
|
+ if (ath11k_host_ddr_addr) {
|
|
+ addr = ath11k_host_ddr_addr +
|
|
+ ATH11K_HOST_DDR_CALDB_OFFSET;
|
|
+ } else if (of_property_read_u32(dev->of_node, "qcom,caldb-addr", &addr))
|
|
ath11k_warn(ab, "qmi fail to get caldb-addr in dt\n");
|
|
|
|
if (ab->bus_params.fixed_bdf_addr && ab->enable_cold_boot_cal) {
|
|
@@ -2409,10 +2423,16 @@ static int ath11k_qmi_assign_target_mem_
|
|
|
|
ab->qmi.target_mem[idx].size = ab->qmi.target_mem[i].size;
|
|
ab->qmi.target_mem[idx].type = ab->qmi.target_mem[i].type;
|
|
- if (of_property_read_u32(dev->of_node, "m3-dump-addr", &addr))
|
|
+
|
|
+ if (ath11k_host_ddr_addr) {
|
|
+ addr = ath11k_host_ddr_addr +
|
|
+ ATH11K_HOST_DDR_CALDB_OFFSET +
|
|
+ ATH11K_HOST_DDR_QDSS_OFFSET;
|
|
+ } else if (of_property_read_u32(dev->of_node, "m3-dump-addr", &addr)) {
|
|
ab->qmi.target_mem[idx].paddr = ab->hw_params.m3_addr;
|
|
- else
|
|
+ } else {
|
|
ab->qmi.target_mem[idx].paddr = (phys_addr_t)addr;
|
|
+ }
|
|
|
|
ab->qmi.target_mem[idx].vaddr =
|
|
ioremap(ab->qmi.target_mem[idx].paddr,
|
|
--- a/drivers/net/wireless/ath/ath11k/qmi.h
|
|
+++ b/drivers/net/wireless/ath/ath11k/qmi.h
|
|
@@ -48,6 +48,7 @@
|
|
#define ATH11K_COLD_BOOT_FW_RESET_DELAY (60 * HZ)
|
|
|
|
struct ath11k_base;
|
|
+extern unsigned int ath11k_host_ddr_addr;
|
|
|
|
enum ath11k_target_mem_mode {
|
|
ATH11K_QMI_TARGET_MEM_MODE_DEFAULT = 0,
|