From 824dde8652815aa67b4e2bf2d8a9455a8ef82b8f Mon Sep 17 00:00:00 2001 From: Ziyang Huang Date: Thu, 29 Jun 2023 06:12:45 +0000 Subject: [PATCH] wifi: ath11k: Support setting bdf-addr and caldb-addr via DT Signed-off-by: Ziyang Huang --- drivers/net/wireless/ath/ath11k/qmi.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) --- a/drivers/net/wireless/ath/ath11k/qmi.c +++ b/drivers/net/wireless/ath/ath11k/qmi.c @@ -2030,6 +2030,7 @@ static int ath11k_qmi_assign_target_mem_ struct device_node *hremote_node = NULL; struct resource res; u32 host_ddr_sz; + u32 addr; int i, idx, ret; for (i = 0, idx = 0; i < ab->qmi.mem_seg_count; i++) { @@ -2069,7 +2070,9 @@ static int ath11k_qmi_assign_target_mem_ idx++; break; case BDF_MEM_REGION_TYPE: - ab->qmi.target_mem[idx].paddr = ab->hw_params.bdf_addr; + if(of_property_read_u32(dev->of_node, "qcom,bdf-addr", &addr)) + addr = ab->hw_params.bdf_addr; + ab->qmi.target_mem[idx].paddr = addr; ab->qmi.target_mem[idx].vaddr = NULL; ab->qmi.target_mem[idx].size = ab->qmi.target_mem[i].size; ab->qmi.target_mem[idx].type = ab->qmi.target_mem[i].type; @@ -2091,8 +2094,9 @@ static int ath11k_qmi_assign_target_mem_ if (!ab->qmi.target_mem[idx].iaddr) return -EIO; } else { - ab->qmi.target_mem[idx].paddr = - ATH11K_QMI_CALDB_ADDRESS; + if(of_property_read_u32(dev->of_node, "qcom,caldb-addr", &addr)) + addr = ATH11K_QMI_CALDB_ADDRESS; + ab->qmi.target_mem[idx].paddr = addr; } } else { ab->qmi.target_mem[idx].paddr = 0; @@ -2297,6 +2301,7 @@ static int ath11k_qmi_load_file_target_m struct qmi_wlanfw_bdf_download_resp_msg_v01 resp; struct qmi_txn txn; const u8 *temp = data; + u32 addr; void __iomem *bdf_addr = NULL; int ret = 0; u32 remaining = len; @@ -2308,7 +2313,9 @@ static int ath11k_qmi_load_file_target_m memset(&resp, 0, sizeof(resp)); if (ab->hw_params.fixed_bdf_addr) { - bdf_addr = ioremap(ab->hw_params.bdf_addr, ab->hw_params.fw.board_size); + if(of_property_read_u32(ab->dev->of_node, "qcom,bdf-addr", &addr)) + addr = ab->hw_params.bdf_addr; + bdf_addr = ioremap(addr, ab->hw_params.fw.board_size); if (!bdf_addr) { ath11k_warn(ab, "qmi ioremap error for bdf_addr\n"); ret = -EIO;