]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: ath12k: Move hw_init invocation to target-specific probe
authorKiran Venkatappa <quic_kiranv@quicinc.com>
Tue, 12 Aug 2025 17:09:35 +0000 (22:39 +0530)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Wed, 20 Aug 2025 21:39:04 +0000 (14:39 -0700)
Relocate hw_init call from the shared probe path to target-specific
probe implementations. Handle Wi-Fi 7 initialization entirely within
its corresponding target-specific file.
Improve modularity by decoupling hardware-dependent initialization from
common probe logic. Support broader effort to separate shared and
target-specific code paths.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
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-9-8c9b0eb9335d@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/ahb_wifi7.c
drivers/net/wireless/ath/ath12k/core.c
drivers/net/wireless/ath/ath12k/hw.h
drivers/net/wireless/ath/ath12k/hw_wifi7.c
drivers/net/wireless/ath/ath12k/hw_wifi7.h [new file with mode: 0644]
drivers/net/wireless/ath/ath12k/pci_wifi7.c

index 7a869722b77e639781fed45835872c38a50b8cfc..ff4f041bafbc452ec9c70c3d9f1ce648b43a26c7 100644 (file)
@@ -11,6 +11,7 @@
 #include "ahb_wifi7.h"
 #include "debug.h"
 #include "hif.h"
+#include "hw_wifi7.h"
 
 static const struct of_device_id ath12k_wifi7_ahb_of_match[] = {
        { .compatible = "qcom,ipq5332-wifi",
@@ -26,6 +27,7 @@ static int ath12k_wifi7_ahb_probe(struct platform_device *pdev)
        struct ath12k_ahb *ab_ahb;
        enum ath12k_hw_rev hw_rev;
        struct ath12k_base *ab;
+       int ret;
 
        ab = platform_get_drvdata(pdev);
        ab_ahb = ath12k_ab_to_ahb(ab);
@@ -42,6 +44,12 @@ static int ath12k_wifi7_ahb_probe(struct platform_device *pdev)
        ab->target_mem_mode = ATH12K_QMI_MEMORY_MODE_DEFAULT;
        ab->hw_rev = hw_rev;
 
+       ret = ath12k_wifi7_hw_init(ab);
+       if (ret) {
+               ath12k_err(ab, "WiFi-7 hw_init for AHB failed: %d\n", ret);
+               return ret;
+       }
+
        return 0;
 }
 
index b1a26027de3f8d83a7823fba94cc0ef1df38c7b7..8b6fb6a1593a322ceee86ecbd23c87ab9b72394b 100644 (file)
@@ -1744,13 +1744,6 @@ enum ath12k_qmi_mem_mode ath12k_core_get_memory_mode(struct ath12k_base *ab)
 int ath12k_core_pre_init(struct ath12k_base *ab)
 {
        const struct ath12k_mem_profile_based_param *param;
-       int ret;
-
-       ret = ath12k_hw_init(ab);
-       if (ret) {
-               ath12k_err(ab, "failed to init hw params: %d\n", ret);
-               return ret;
-       }
 
        param = &ath12k_mem_profile_based_param[ab->target_mem_mode];
        ab->profile_param = param;
index 8ce11c3e6d5c21b2affef8cbe4b0b867e678faae..35d6900720feeef6d736df38dcc17402db6d5f8b 100644 (file)
@@ -377,6 +377,4 @@ static inline const char *ath12k_bd_ie_type_str(enum ath12k_bd_ie_type type)
        return "unknown";
 }
 
-int ath12k_hw_init(struct ath12k_base *ab);
-
 #endif
index f6177f8e032d98774b4a041ecfe97187b55ed259..5f5d3c57b288c1ce9023a14e40cd2f12c9adc13f 100644 (file)
@@ -13,6 +13,7 @@
 #include "ce.h"
 #include "ce_wifi7.h"
 #include "hw.h"
+#include "hw_wifi7.h"
 #include "mhi.h"
 #include "dp_rx.h"
 #include "peer.h"
@@ -1030,7 +1031,7 @@ static const struct ath12k_hw_params ath12k_hw_params[] = {
        },
 };
 
-int ath12k_hw_init(struct ath12k_base *ab)
+int ath12k_wifi7_hw_init(struct ath12k_base *ab)
 {
        const struct ath12k_hw_params *hw_params = NULL;
        int i;
diff --git a/drivers/net/wireless/ath/ath12k/hw_wifi7.h b/drivers/net/wireless/ath/ath12k/hw_wifi7.h
new file mode 100644 (file)
index 0000000..643b6fd
--- /dev/null
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: BSD-3-Clause-Clear */
+/*
+ * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#ifndef ATH12K_WIFI7_HW_H
+#define ATH12K_WIFI7_HW_H
+
+struct ath12k_base;
+int ath12k_wifi7_hw_init(struct ath12k_base *ab);
+
+#endif /* ATH12K_WIFI7_HW_H */
index 8c7718153534ca0f30d33ef954d6c542ae70154a..a680cd9a04e33af1340393429773aea497461412 100644 (file)
@@ -11,6 +11,7 @@
 #include "core.h"
 #include "hif.h"
 #include "mhi.h"
+#include "hw_wifi7.h"
 
 #define QCN9274_DEVICE_ID              0x1109
 #define WCN7850_DEVICE_ID              0x1107
@@ -84,6 +85,7 @@ static int ath12k_wifi7_pci_probe(struct pci_dev *pdev,
        u32 soc_hw_version_major, soc_hw_version_minor;
        struct ath12k_pci *ab_pci;
        struct ath12k_base *ab;
+       int ret;
 
        ab = pci_get_drvdata(pdev);
        if (!ab)
@@ -143,6 +145,12 @@ static int ath12k_wifi7_pci_probe(struct pci_dev *pdev,
                return -EOPNOTSUPP;
        }
 
+       ret = ath12k_wifi7_hw_init(ab);
+       if (ret) {
+               dev_err(&pdev->dev, "WiFi-7 hw_init for PCI failed: %d\n", ret);
+               return ret;
+       }
+
        return 0;
 }