]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: ath12k: Remove HAL define dependencies from shared AHB code
authorKiran Venkatappa <quic_kiranv@quicinc.com>
Tue, 12 Aug 2025 17:09:39 +0000 (22:39 +0530)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Wed, 20 Aug 2025 21:39:05 +0000 (14:39 -0700)
Eliminate HAL-specific defines from the shared AHB implementation.
Store the WFSS register base-already available in hw_params via the
ce_remap structure-in the AHB context and access it directly.
Add the CMEM offset to the ce_remap structure and use it consistently in
shared code. Improve modularity by removing hardware abstraction layer
dependencies from common code paths and enable cleaner separation of
target-specific logic

Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1

Signed-off-by: Kiran Venkatappa <quic_kiranv@quicinc.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Link: https://patch.msgid.link/20250812-ath12k-mod-v1-13-8c9b0eb9335d@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/ahb.c
drivers/net/wireless/ath/ath12k/ce.h
drivers/net/wireless/ath/ath12k/core.h
drivers/net/wireless/ath/ath12k/wifi7/hw.c

index 41ef5170556e9255337b26ec3565ab25f50adc65..efb0ef609dcfab307b942798b901fb7f2b85e7d7 100644 (file)
@@ -123,7 +123,7 @@ enum ext_irq_num {
 
 static u32 ath12k_ahb_read32(struct ath12k_base *ab, u32 offset)
 {
-       if (ab->ce_remap && offset < HAL_SEQ_WCSS_CMEM_OFFSET)
+       if (ab->ce_remap && offset < ab->cmem_offset)
                return ioread32(ab->mem_ce + offset);
        return ioread32(ab->mem + offset);
 }
@@ -131,7 +131,7 @@ static u32 ath12k_ahb_read32(struct ath12k_base *ab, u32 offset)
 static void ath12k_ahb_write32(struct ath12k_base *ab, u32 offset,
                               u32 value)
 {
-       if (ab->ce_remap && offset < HAL_SEQ_WCSS_CMEM_OFFSET)
+       if (ab->ce_remap && offset < ab->cmem_offset)
                iowrite32(value, ab->mem_ce + offset);
        else
                iowrite32(value, ab->mem + offset);
@@ -928,7 +928,8 @@ static int ath12k_ahb_resource_init(struct ath12k_base *ab)
                        goto err_mem_unmap;
                }
                ab->ce_remap = true;
-               ab->ce_remap_base_addr = HAL_IPQ5332_CE_WFSS_REG_BASE;
+               ab->cmem_offset = ce_remap->cmem_offset;
+               ab->ce_remap_base_addr = ce_remap->base;
        }
 
        ab_ahb->xo_clk = devm_clk_get(ab->dev, "xo");
index f44ce2244bcfdb60d505d51096ed70b3965952c9..38f986ea1cd2bf6e7739ca939a3db66644c4ac77 100644 (file)
@@ -85,6 +85,7 @@ struct ce_ie_addr {
 struct ce_remap {
        u32 base;
        u32 size;
+       u32 cmem_offset;
 };
 
 struct ce_attr {
index fa04aaa836fcba9d647b2127651cb366046e2e73..3c4a8f834b70ffe1005e761aabbb966c30cb8ff0 100644 (file)
@@ -1060,6 +1060,7 @@ struct ath12k_base {
 
        void __iomem *mem_ce;
        u32 ce_remap_base_addr;
+       u32 cmem_offset;
        bool ce_remap;
 
        struct {
index 9995eccd32d39f69191f0308b67d35ed3501ebf9..82b4f5b9f570076e3ca64dec7b866e1d88787789 100644 (file)
@@ -695,6 +695,7 @@ static const struct ce_ie_addr ath12k_wifi7_ce_ie_addr_ipq5332 = {
 static const struct ce_remap ath12k_wifi7_ce_remap_ipq5332 = {
        .base = HAL_IPQ5332_CE_WFSS_REG_BASE,
        .size = HAL_IPQ5332_CE_SIZE,
+       .cmem_offset = HAL_SEQ_WCSS_CMEM_OFFSET,
 };
 
 static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {