linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes
@ 2025-08-12 17:09 Kiran Venkatappa
  2025-08-12 17:09 ` [PATCH ath12k-ng 01/13] wifi: ath12k: Restructure PCI code to common and Wi-Fi 7 specific logic Kiran Venkatappa
                   ` (15 more replies)
  0 siblings, 16 replies; 25+ messages in thread
From: Kiran Venkatappa @ 2025-08-12 17:09 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless

Current ath drivers have separate implementations for different
classes of devices. For example, ath11k supports WiFi-6 devices,
while ath12k supports Wi-Fi 7 devices. However, there is significant
common functionality across these generations due to shared firmware
and hardware architecture. In the existing driver code, this leverage
is achieved through code duplication. As a result, when a new driver
is introduced, many features are missed, and new additions require
porting across different generation drivers.

To improve reuse and maintainability, ath12k should be split into common
and device-specific modules. Common code can be shared across multiple
architectures, enabling better leverage for future hardware generations.
generation drivers.

Firmware interfaces and core initialization sequences are typically common
across different device families. In contrast, hardware register offsets, copy
engine mappings, and HAL configurations are usually hardware-specific.

Common components include:
      - mac80211 interface: Control path operations are mostly common across
        different ATH hardware and will be shared as much as possible.
      - Firmware interface (WMI, HTT, HTC, QMI): Firmware messaging and
        sequences are common and maintained with backward/forward compatibility
        using TLVs.
      - Datapath: Data path files are also separated similarly. More information
        will be provided in later patches.
      - Core initialization, reset, and recovery sequences: These will be part
        of the shared code.

Device-specific code includes:
      - Hardware capabilities, configurations, HAL, and other
        architecture-specific logic.

The original ath12k.ko is split into these two modules as depicted below.

                                      +-----------------+
                                      |                 |
                                      |   ath12k.ko     |
                                      |    (common)     |
    +---------------+                 |                 |
    |               |                 +-----------------+
    |   ath12k.ko   | ===========>
    |               |                 +------------------+
    +---------------+                 |                  |
                                      | ath12k_wifi7.ko  |
                                      | (wifi7 family)   |
                                      |                  |
                                      +------------------+

The ath12k.ko module will serve as the common component, while ath12k_wifi7.ko
will be the architecture-specific module for WiFi-7 devices.

After this modular separation, adding support for a new device will
primarily involve implementing device-specific code, while reusing the
majority of the shared common components.

---
Kiran Venkatappa (13):
      wifi: ath12k: Restructure PCI code to common and Wi-Fi 7 specific logic
      wifi: ath12k: Move Copy Engine configuration to Wi-Fi 7 specific file
      wifi: ath12k: Move Wi-Fi 7 WMI configuration to dedicated file
      wifi: ath12k: Move Wi-Fi 7 MHI configuration to dedicated file
      wifi: ath12k: Rename hw.c to Wi-Fi 7 specific implementation file
      wifi: ath12k: Rename ahb_hif_ops to reflect generic usage
      wifi: ath12k: Restructure ahb.c into common and Wi-Fi 7 specific modules
      wifi: ath12k: Move Wi-Fi 7 specific init routines to dedicated file
      wifi: ath12k: Move hw_init invocation to target-specific probe
      wifi: ath12k: Modularize driver into common and Wi-Fi 7 specific components
      wifi: ath12k: Rename ath12k_* symbols to ath12k_wifi7_* for clarity
      wifi: ath12k: Remove HAL defines from shared PCI code
      wifi: ath12k: Remove HAL define dependencies from shared AHB code
 
 drivers/net/wireless/ath/ath12k/Makefile         |   4 +-
 drivers/net/wireless/ath/ath12k/ahb.c            | 139 ++--
 drivers/net/wireless/ath/ath12k/ahb.h            |  27 +-
 drivers/net/wireless/ath/ath12k/ce.c             | 301 -------
 drivers/net/wireless/ath/ath12k/ce.h             |   5 +-
 drivers/net/wireless/ath/ath12k/core.c           |  38 +-
 drivers/net/wireless/ath/ath12k/core.h           |   7 +
 drivers/net/wireless/ath/ath12k/debug.c          |   4 +
 drivers/net/wireless/ath/ath12k/dp_rx.c          |   3 +
 drivers/net/wireless/ath/ath12k/hal.c            |   4 +
 drivers/net/wireless/ath/ath12k/htc.c            |   2 +
 drivers/net/wireless/ath/ath12k/hw.h             |   2 -
 drivers/net/wireless/ath/ath12k/mhi.c            | 130 ---
 drivers/net/wireless/ath/ath12k/mhi.h            |   4 +-
 drivers/net/wireless/ath/ath12k/pci.c            | 215 ++---
 drivers/net/wireless/ath/ath12k/pci.h            |  28 +-
 drivers/net/wireless/ath/ath12k/peer.c           |   2 +
 drivers/net/wireless/ath/ath12k/wifi7/Makefile   |  10 +
 drivers/net/wireless/ath/ath12k/wifi7/ahb.c      |  71 ++
 drivers/net/wireless/ath/ath12k/wifi7/ahb.h      |  20 +
 drivers/net/wireless/ath/ath12k/wifi7/ce.c       | 973 +++++++++++++++++++++++
 drivers/net/wireless/ath/ath12k/wifi7/ce.h       |  22 +
 drivers/net/wireless/ath/ath12k/wifi7/core.c     |  44 +
 drivers/net/wireless/ath/ath12k/{ => wifi7}/hw.c | 798 +++----------------
 drivers/net/wireless/ath/ath12k/wifi7/hw.h       |  13 +
 drivers/net/wireless/ath/ath12k/wifi7/mhi.c      | 138 ++++
 drivers/net/wireless/ath/ath12k/wifi7/mhi.h      |  11 +
 drivers/net/wireless/ath/ath12k/wifi7/pci.c      | 188 +++++
 drivers/net/wireless/ath/ath12k/wifi7/pci.h      |  12 +
 drivers/net/wireless/ath/ath12k/wifi7/wmi.c      | 105 +++
 drivers/net/wireless/ath/ath12k/wifi7/wmi.h      |  15 +
 drivers/net/wireless/ath/ath12k/wmi.c            |  97 ---
 drivers/net/wireless/ath/ath12k/wmi.h            |   4 -
 33 files changed, 1956 insertions(+), 1480 deletions(-)
---
base-commit: d9104cec3e8fe4b458b74709853231385779001f
change-id: 20250812-ath12k-mod-bd00156df202


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH ath12k-ng 01/13] wifi: ath12k: Restructure PCI code to common and Wi-Fi 7 specific logic
  2025-08-12 17:09 [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Kiran Venkatappa
@ 2025-08-12 17:09 ` Kiran Venkatappa
  2025-08-12 17:09 ` [PATCH ath12k-ng 02/13] wifi: ath12k: Move Copy Engine configuration to Wi-Fi 7 specific file Kiran Venkatappa
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Kiran Venkatappa @ 2025-08-12 17:09 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless

Refactor pci.c to split common and hardware family specific components.
Retain shared logic such as probe and initialization sequences in common
pci.c to support reuse across device families and move Wi-Fi 7 specific
initialization and configuration to a new pci_wifi7.c file. Register
device specific routines via callbacks to keep the common PCI code
generic and extensible for future hardware families.
This improves maintainability and prepare the codebase for additional
device family support.

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

Signed-off-by: Kiran Venkatappa <quic_kiranv@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/Makefile    |   1 +
 drivers/net/wireless/ath/ath12k/core.c      |   5 +-
 drivers/net/wireless/ath/ath12k/core.h      |   6 +
 drivers/net/wireless/ath/ath12k/pci.c       | 200 ++++++++++------------------
 drivers/net/wireless/ath/ath12k/pci.h       |  21 ++-
 drivers/net/wireless/ath/ath12k/pci_wifi7.c | 173 ++++++++++++++++++++++++
 drivers/net/wireless/ath/ath12k/pci_wifi7.h |  12 ++
 7 files changed, 278 insertions(+), 140 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/Makefile b/drivers/net/wireless/ath/ath12k/Makefile
index d95ee525a6cd06c13755e7f396151373244e0c39..1a26e00627b0a3d631ddfa62ef70a9b29b426a3f 100644
--- a/drivers/net/wireless/ath/ath12k/Makefile
+++ b/drivers/net/wireless/ath/ath12k/Makefile
@@ -19,6 +19,7 @@ ath12k-y += core.o \
 	    hw.o \
 	    mhi.o \
 	    pci.o \
+	    pci_wifi7.o \
 	    dp_mon.o \
 	    fw.o \
 	    p2p.o
diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
index 5d494c5cdc0da3189640751b8d191fa939ac3ff5..b723d7d28cdac48934d621338d6a623781c86b73 100644
--- a/drivers/net/wireless/ath/ath12k/core.c
+++ b/drivers/net/wireless/ath/ath12k/core.c
@@ -22,6 +22,7 @@
 #include "hif.h"
 #include "pci.h"
 #include "wow.h"
+#include "pci_wifi7.h"
 
 static int ahb_err, pci_err;
 unsigned int ath12k_debug_mask;
@@ -2287,7 +2288,7 @@ static int ath12k_init(void)
 	if (ahb_err)
 		pr_warn("Failed to initialize ath12k AHB device: %d\n", ahb_err);
 
-	pci_err = ath12k_pci_init();
+	pci_err = ath12k_wifi7_pci_init();
 	if (pci_err)
 		pr_warn("Failed to initialize ath12k PCI device: %d\n", pci_err);
 
@@ -2298,7 +2299,7 @@ static int ath12k_init(void)
 static void ath12k_exit(void)
 {
 	if (!pci_err)
-		ath12k_pci_exit();
+		ath12k_wifi7_pci_exit();
 
 	if (!ahb_err)
 		ath12k_ahb_exit();
diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
index 519f826f56c8ebb871997777261dbd1f2e5482de..fa04aaa836fcba9d647b2127651cb366046e2e73 100644
--- a/drivers/net/wireless/ath/ath12k/core.h
+++ b/drivers/net/wireless/ath/ath12k/core.h
@@ -1028,6 +1028,12 @@ struct ath12k_mem_profile_based_param {
 	struct ath12k_dp_profile_params dp_params;
 };
 
+enum ath12k_device_family {
+	ATH12K_DEVICE_FAMILY_START,
+	ATH12K_DEVICE_FAMILY_WIFI7 = ATH12K_DEVICE_FAMILY_START,
+	ATH12K_DEVICE_FAMILY_MAX,
+};
+
 /* Master structure to hold the hw data which may be used in core module */
 struct ath12k_base {
 	enum ath12k_hw_rev hw_rev;
diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c
index c729d5526c753d2b7b7542b6f2a145e71b335a43..93e2189ec68704598ce401ed4fe4f5981fc3cece 100644
--- a/drivers/net/wireless/ath/ath12k/pci.c
+++ b/drivers/net/wireless/ath/ath12k/pci.c
@@ -28,44 +28,17 @@
 #define WINDOW_RANGE_MASK		GENMASK(18, 0)
 #define WINDOW_STATIC_MASK		GENMASK(31, 6)
 
-#define TCSR_SOC_HW_VERSION		0x1B00000
-#define TCSR_SOC_HW_VERSION_MAJOR_MASK	GENMASK(11, 8)
-#define TCSR_SOC_HW_VERSION_MINOR_MASK	GENMASK(7, 4)
-
 /* BAR0 + 4k is always accessible, and no
  * need to force wakeup.
  * 4K - 32 = 0xFE0
  */
 #define ACCESS_ALWAYS_OFF 0xFE0
 
-#define QCN9274_DEVICE_ID		0x1109
-#define WCN7850_DEVICE_ID		0x1107
-
 #define PCIE_LOCAL_REG_QRTR_NODE_ID	0x1E03164
 #define DOMAIN_NUMBER_MASK		GENMASK(7, 4)
 #define BUS_NUMBER_MASK			GENMASK(3, 0)
 
-static const struct pci_device_id ath12k_pci_id_table[] = {
-	{ PCI_VDEVICE(QCOM, QCN9274_DEVICE_ID) },
-	{ PCI_VDEVICE(QCOM, WCN7850_DEVICE_ID) },
-	{}
-};
-
-MODULE_DEVICE_TABLE(pci, ath12k_pci_id_table);
-
-/* TODO: revisit IRQ mapping for new SRNG's */
-static const struct ath12k_msi_config ath12k_msi_config[] = {
-	{
-		.total_vectors = 16,
-		.total_users = 3,
-		.users = (struct ath12k_msi_user[]) {
-			{ .name = "MHI", .num_vectors = 3, .base_vector = 0 },
-			{ .name = "CE", .num_vectors = 5, .base_vector = 3 },
-			{ .name = "DP", .num_vectors = 8, .base_vector = 8 },
-		},
-	},
-};
-
+static struct ath12k_pci_driver *ath12k_pci_family_drivers[ATH12K_DEVICE_FAMILY_MAX];
 static const struct ath12k_msi_config msi_config_one_msi = {
 	.total_vectors = 1,
 	.total_users = 4,
@@ -136,30 +109,6 @@ static const char *irq_name[ATH12K_IRQ_NUM_MAX] = {
 	"tcl2host-status-ring",
 };
 
-static int ath12k_pci_bus_wake_up(struct ath12k_base *ab)
-{
-	struct ath12k_pci *ab_pci = ath12k_pci_priv(ab);
-
-	return mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev);
-}
-
-static void ath12k_pci_bus_release(struct ath12k_base *ab)
-{
-	struct ath12k_pci *ab_pci = ath12k_pci_priv(ab);
-
-	mhi_device_put(ab_pci->mhi_ctrl->mhi_dev);
-}
-
-static const struct ath12k_pci_ops ath12k_pci_ops_qcn9274 = {
-	.wakeup = NULL,
-	.release = NULL,
-};
-
-static const struct ath12k_pci_ops ath12k_pci_ops_wcn7850 = {
-	.wakeup = ath12k_pci_bus_wake_up,
-	.release = ath12k_pci_bus_release,
-};
-
 static void ath12k_pci_select_window(struct ath12k_pci *ab_pci, u32 offset)
 {
 	struct ath12k_base *ab = ab_pci->ab;
@@ -1531,28 +1480,34 @@ static const struct ath12k_hif_ops ath12k_pci_hif_ops = {
 #endif
 };
 
-static
-void ath12k_pci_read_hw_version(struct ath12k_base *ab, u32 *major, u32 *minor)
+static enum ath12k_device_family
+ath12k_get_device_family(const struct pci_device_id *pci_dev)
 {
-	u32 soc_hw_version;
+	enum ath12k_device_family device_family_id;
+	const struct pci_device_id *id;
 
-	soc_hw_version = ath12k_pci_read32(ab, TCSR_SOC_HW_VERSION);
-	*major = FIELD_GET(TCSR_SOC_HW_VERSION_MAJOR_MASK,
-			   soc_hw_version);
-	*minor = FIELD_GET(TCSR_SOC_HW_VERSION_MINOR_MASK,
-			   soc_hw_version);
+	for (device_family_id = ATH12K_DEVICE_FAMILY_START;
+	     device_family_id < ATH12K_DEVICE_FAMILY_MAX; device_family_id++) {
+		if (!ath12k_pci_family_drivers[device_family_id])
+			continue;
+
+		id = ath12k_pci_family_drivers[device_family_id]->id_table;
+		while (id->device) {
+			if (id->device == pci_dev->device)
+				return device_family_id;
+			id += 1;
+		}
+	}
 
-	ath12k_dbg(ab, ATH12K_DBG_PCI,
-		   "pci tcsr_soc_hw_version major %d minor %d\n",
-		    *major, *minor);
+	return ATH12K_DEVICE_FAMILY_MAX;
 }
 
 static int ath12k_pci_probe(struct pci_dev *pdev,
 			    const struct pci_device_id *pci_dev)
 {
-	struct ath12k_base *ab;
+	enum ath12k_device_family device_id;
 	struct ath12k_pci *ab_pci;
-	u32 soc_hw_version_major, soc_hw_version_minor;
+	struct ath12k_base *ab;
 	int ret;
 
 	ab = ath12k_core_alloc(&pdev->dev, sizeof(*ab_pci), ATH12K_BUS_PCI);
@@ -1587,56 +1542,24 @@ static int ath12k_pci_probe(struct pci_dev *pdev,
 	ab->id.subsystem_vendor = pdev->subsystem_vendor;
 	ab->id.subsystem_device = pdev->subsystem_device;
 
-	switch (pci_dev->device) {
-	case QCN9274_DEVICE_ID:
-		ab_pci->msi_config = &ath12k_msi_config[0];
-		ab->static_window_map = true;
-		ab_pci->pci_ops = &ath12k_pci_ops_qcn9274;
-		ab->hal_rx_ops = &hal_rx_qcn9274_ops;
-		ath12k_pci_read_hw_version(ab, &soc_hw_version_major,
-					   &soc_hw_version_minor);
-		ab->target_mem_mode = ath12k_core_get_memory_mode(ab);
-		switch (soc_hw_version_major) {
-		case ATH12K_PCI_SOC_HW_VERSION_2:
-			ab->hw_rev = ATH12K_HW_QCN9274_HW20;
-			break;
-		case ATH12K_PCI_SOC_HW_VERSION_1:
-			ab->hw_rev = ATH12K_HW_QCN9274_HW10;
-			break;
-		default:
-			dev_err(&pdev->dev,
-				"Unknown hardware version found for QCN9274: 0x%x\n",
-				soc_hw_version_major);
-			ret = -EOPNOTSUPP;
-			goto err_pci_free_region;
-		}
-		break;
-	case WCN7850_DEVICE_ID:
-		ab->id.bdf_search = ATH12K_BDF_SEARCH_BUS_AND_BOARD;
-		ab_pci->msi_config = &ath12k_msi_config[0];
-		ab->static_window_map = false;
-		ab_pci->pci_ops = &ath12k_pci_ops_wcn7850;
-		ab->hal_rx_ops = &hal_rx_wcn7850_ops;
-		ath12k_pci_read_hw_version(ab, &soc_hw_version_major,
-					   &soc_hw_version_minor);
-		ab->target_mem_mode = ATH12K_QMI_MEMORY_MODE_DEFAULT;
-		switch (soc_hw_version_major) {
-		case ATH12K_PCI_SOC_HW_VERSION_2:
-			ab->hw_rev = ATH12K_HW_WCN7850_HW20;
-			break;
-		default:
-			dev_err(&pdev->dev,
-				"Unknown hardware version found for WCN7850: 0x%x\n",
-				soc_hw_version_major);
-			ret = -EOPNOTSUPP;
-			goto err_pci_free_region;
-		}
-		break;
+	device_id = ath12k_get_device_family(pci_dev);
+	if (device_id >= ATH12K_DEVICE_FAMILY_MAX) {
+		ath12k_err(ab, "failed to get device family id\n");
+		ret = -EINVAL;
+		goto err_pci_free_region;
+	}
+
+	ath12k_dbg(ab, ATH12K_DBG_PCI, "PCI device family id: %d\n", device_id);
+
+	ab_pci->device_family_ops = &ath12k_pci_family_drivers[device_id]->ops;
 
-	default:
-		dev_err(&pdev->dev, "Unknown PCI device found: 0x%x\n",
-			pci_dev->device);
-		ret = -EOPNOTSUPP;
+	/* Call device specific probe. This is the callback that can
+	 * be used to override any ops in future
+	 * probe is validated for NULL during registration.
+	 */
+	ret = ab_pci->device_family_ops->probe(pdev, pci_dev);
+	if (ret) {
+		ath12k_err(ab, "failed to probe device: %d\n", ret);
 		goto err_pci_free_region;
 	}
 
@@ -1844,30 +1767,41 @@ static const struct dev_pm_ops __maybe_unused ath12k_pci_pm_ops = {
 				     ath12k_pci_pm_resume_early)
 };
 
-static struct pci_driver ath12k_pci_driver = {
-	.name = "ath12k_pci",
-	.id_table = ath12k_pci_id_table,
-	.probe = ath12k_pci_probe,
-	.remove = ath12k_pci_remove,
-	.shutdown = ath12k_pci_shutdown,
-	.driver.pm = &ath12k_pci_pm_ops,
-};
-
-int ath12k_pci_init(void)
+int ath12k_pci_register_driver(const enum ath12k_device_family device_id,
+			       struct ath12k_pci_driver *driver)
 {
-	int ret;
+	struct pci_driver *pci_driver;
 
-	ret = pci_register_driver(&ath12k_pci_driver);
-	if (ret) {
-		pr_err("failed to register ath12k pci driver: %d\n",
-		       ret);
-		return ret;
+	if (device_id >= ATH12K_DEVICE_FAMILY_MAX)
+		return -EINVAL;
+
+	if (!driver || !driver->ops.probe)
+		return -EINVAL;
+
+	if (ath12k_pci_family_drivers[device_id]) {
+		pr_err("Driver already registered for %d\n", device_id);
+		return -EALREADY;
 	}
 
-	return 0;
+	ath12k_pci_family_drivers[device_id] = driver;
+
+	pci_driver = &ath12k_pci_family_drivers[device_id]->driver;
+	pci_driver->name = driver->name;
+	pci_driver->id_table = driver->id_table;
+	pci_driver->probe = ath12k_pci_probe;
+	pci_driver->remove = ath12k_pci_remove;
+	pci_driver->shutdown = ath12k_pci_shutdown;
+	pci_driver->driver.pm = &ath12k_pci_pm_ops;
+
+	return pci_register_driver(pci_driver);
 }
 
-void ath12k_pci_exit(void)
+void ath12k_pci_unregister_driver(const enum ath12k_device_family device_id)
 {
-	pci_unregister_driver(&ath12k_pci_driver);
+	if (device_id >= ATH12K_DEVICE_FAMILY_MAX ||
+	    !ath12k_pci_family_drivers[device_id])
+		return;
+
+	pci_unregister_driver(&ath12k_pci_family_drivers[device_id]->driver);
+	ath12k_pci_family_drivers[device_id] = NULL;
 }
diff --git a/drivers/net/wireless/ath/ath12k/pci.h b/drivers/net/wireless/ath/ath12k/pci.h
index d1ec8aad7f6c3b6f5cbdf8ce57a4106733686521..1b7ecc329a017cafa84780f3f6e634163ead59bb 100644
--- a/drivers/net/wireless/ath/ath12k/pci.h
+++ b/drivers/net/wireless/ath/ath12k/pci.h
@@ -7,6 +7,7 @@
 #define ATH12K_PCI_H
 
 #include <linux/mhi.h>
+#include <linux/pci.h>
 
 #include "core.h"
 
@@ -70,9 +71,6 @@
 #define QRTR_PCI_DOMAIN_NR_MASK		GENMASK(7, 4)
 #define QRTR_PCI_BUS_NUMBER_MASK	GENMASK(3, 0)
 
-#define ATH12K_PCI_SOC_HW_VERSION_1	1
-#define ATH12K_PCI_SOC_HW_VERSION_2	2
-
 struct ath12k_msi_user {
 	const char *name;
 	int num_vectors;
@@ -97,6 +95,10 @@ struct ath12k_pci_ops {
 	void (*release)(struct ath12k_base *ab);
 };
 
+struct ath12k_pci_device_family_ops {
+	int (*probe)(struct pci_dev *pdev, const struct pci_device_id *pci_dev);
+};
+
 struct ath12k_pci {
 	struct pci_dev *pdev;
 	struct ath12k_base *ab;
@@ -119,6 +121,14 @@ struct ath12k_pci {
 	const struct ath12k_pci_ops *pci_ops;
 	u32 qmi_instance;
 	u64 dma_mask;
+	const struct ath12k_pci_device_family_ops *device_family_ops;
+};
+
+struct ath12k_pci_driver {
+	const char *name;
+	const struct pci_device_id *id_table;
+	struct ath12k_pci_device_family_ops ops;
+	struct pci_driver driver;
 };
 
 static inline struct ath12k_pci *ath12k_pci_priv(struct ath12k_base *ab)
@@ -148,6 +158,7 @@ void ath12k_pci_stop(struct ath12k_base *ab);
 int ath12k_pci_start(struct ath12k_base *ab);
 int ath12k_pci_power_up(struct ath12k_base *ab);
 void ath12k_pci_power_down(struct ath12k_base *ab, bool is_suspend);
-int ath12k_pci_init(void);
-void ath12k_pci_exit(void);
+int ath12k_pci_register_driver(const enum ath12k_device_family device_id,
+			       struct ath12k_pci_driver *driver);
+void ath12k_pci_unregister_driver(const enum ath12k_device_family device_id);
 #endif /* ATH12K_PCI_H */
diff --git a/drivers/net/wireless/ath/ath12k/pci_wifi7.c b/drivers/net/wireless/ath/ath12k/pci_wifi7.c
new file mode 100644
index 0000000000000000000000000000000000000000..8c7718153534ca0f30d33ef954d6c542ae70154a
--- /dev/null
+++ b/drivers/net/wireless/ath/ath12k/pci_wifi7.c
@@ -0,0 +1,173 @@
+// SPDX-License-Identifier: BSD-3-Clause-Clear
+/*
+ * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#include <linux/pci.h>
+
+#include "pci.h"
+#include "pci_wifi7.h"
+#include "core.h"
+#include "hif.h"
+#include "mhi.h"
+
+#define QCN9274_DEVICE_ID		0x1109
+#define WCN7850_DEVICE_ID		0x1107
+
+#define ATH12K_PCI_W7_SOC_HW_VERSION_1	1
+#define ATH12K_PCI_W7_SOC_HW_VERSION_2	2
+
+#define TCSR_SOC_HW_VERSION		0x1B00000
+#define TCSR_SOC_HW_VERSION_MAJOR_MASK	GENMASK(11, 8)
+#define TCSR_SOC_HW_VERSION_MINOR_MASK	GENMASK(7, 4)
+
+static const struct pci_device_id ath12k_wifi7_pci_id_table[] = {
+	{ PCI_VDEVICE(QCOM, QCN9274_DEVICE_ID) },
+	{ PCI_VDEVICE(QCOM, WCN7850_DEVICE_ID) },
+	{}
+};
+
+MODULE_DEVICE_TABLE(pci, ath12k_wifi7_pci_id_table);
+
+/* TODO: revisit IRQ mapping for new SRNG's */
+static const struct ath12k_msi_config ath12k_wifi7_msi_config[] = {
+	{
+		.total_vectors = 16,
+		.total_users = 3,
+		.users = (struct ath12k_msi_user[]) {
+			{ .name = "MHI", .num_vectors = 3, .base_vector = 0 },
+			{ .name = "CE", .num_vectors = 5, .base_vector = 3 },
+			{ .name = "DP", .num_vectors = 8, .base_vector = 8 },
+		},
+	},
+};
+
+static const struct ath12k_pci_ops ath12k_pci_ops_qcn9274 = {
+	.wakeup = NULL,
+	.release = NULL,
+};
+
+static int ath12k_wifi7_pci_bus_wake_up(struct ath12k_base *ab)
+{
+	struct ath12k_pci *ab_pci = ath12k_pci_priv(ab);
+
+	return mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev);
+}
+
+static void ath12k_wifi7_pci_bus_release(struct ath12k_base *ab)
+{
+	struct ath12k_pci *ab_pci = ath12k_pci_priv(ab);
+
+	mhi_device_put(ab_pci->mhi_ctrl->mhi_dev);
+}
+
+static const struct ath12k_pci_ops ath12k_pci_ops_wcn7850 = {
+	.wakeup = ath12k_wifi7_pci_bus_wake_up,
+	.release = ath12k_wifi7_pci_bus_release,
+};
+
+static
+void ath12k_wifi7_pci_read_hw_version(struct ath12k_base *ab,
+				      u32 *major, u32 *minor)
+{
+	u32 soc_hw_version;
+
+	soc_hw_version = ath12k_pci_read32(ab, TCSR_SOC_HW_VERSION);
+	*major = u32_get_bits(soc_hw_version, TCSR_SOC_HW_VERSION_MAJOR_MASK);
+	*minor = u32_get_bits(soc_hw_version, TCSR_SOC_HW_VERSION_MINOR_MASK);
+}
+
+static int ath12k_wifi7_pci_probe(struct pci_dev *pdev,
+				  const struct pci_device_id *pci_dev)
+{
+	u32 soc_hw_version_major, soc_hw_version_minor;
+	struct ath12k_pci *ab_pci;
+	struct ath12k_base *ab;
+
+	ab = pci_get_drvdata(pdev);
+	if (!ab)
+		return -EINVAL;
+
+	ab_pci = ath12k_pci_priv(ab);
+	if (!ab_pci)
+		return -EINVAL;
+
+	switch (pci_dev->device) {
+	case QCN9274_DEVICE_ID:
+		ab_pci->msi_config = &ath12k_wifi7_msi_config[0];
+		ab->static_window_map = true;
+		ab_pci->pci_ops = &ath12k_pci_ops_qcn9274;
+		ab->hal_rx_ops = &hal_rx_qcn9274_ops;
+		ath12k_wifi7_pci_read_hw_version(ab, &soc_hw_version_major,
+						 &soc_hw_version_minor);
+		ab->target_mem_mode = ath12k_core_get_memory_mode(ab);
+		switch (soc_hw_version_major) {
+		case ATH12K_PCI_W7_SOC_HW_VERSION_2:
+			ab->hw_rev = ATH12K_HW_QCN9274_HW20;
+			break;
+		case ATH12K_PCI_W7_SOC_HW_VERSION_1:
+			ab->hw_rev = ATH12K_HW_QCN9274_HW10;
+			break;
+		default:
+			dev_err(&pdev->dev,
+				"Unknown hardware version found for QCN9274: 0x%x\n",
+				soc_hw_version_major);
+			return -EOPNOTSUPP;
+		}
+		break;
+	case WCN7850_DEVICE_ID:
+		ab->id.bdf_search = ATH12K_BDF_SEARCH_BUS_AND_BOARD;
+		ab_pci->msi_config = &ath12k_wifi7_msi_config[0];
+		ab->static_window_map = false;
+		ab_pci->pci_ops = &ath12k_pci_ops_wcn7850;
+		ab->hal_rx_ops = &hal_rx_wcn7850_ops;
+		ath12k_wifi7_pci_read_hw_version(ab, &soc_hw_version_major,
+						 &soc_hw_version_minor);
+		ab->target_mem_mode = ATH12K_QMI_MEMORY_MODE_DEFAULT;
+		switch (soc_hw_version_major) {
+		case ATH12K_PCI_W7_SOC_HW_VERSION_2:
+			ab->hw_rev = ATH12K_HW_WCN7850_HW20;
+			break;
+		default:
+			dev_err(&pdev->dev,
+				"Unknown hardware version found for WCN7850: 0x%x\n",
+				soc_hw_version_major);
+			return -EOPNOTSUPP;
+		}
+		break;
+
+	default:
+		dev_err(&pdev->dev, "Unknown Wi-Fi 7 PCI device found: 0x%x\n",
+			pci_dev->device);
+		return -EOPNOTSUPP;
+	}
+
+	return 0;
+}
+
+static struct ath12k_pci_driver ath12k_pci_wifi7_driver = {
+	.name = "ath12k_wifi7_pci",
+	.id_table = ath12k_wifi7_pci_id_table,
+	.ops.probe = ath12k_wifi7_pci_probe,
+};
+
+int ath12k_wifi7_pci_init(void)
+{
+	int ret;
+
+	ret = ath12k_pci_register_driver(ATH12K_DEVICE_FAMILY_WIFI7,
+					 &ath12k_pci_wifi7_driver);
+	if (ret) {
+		pr_err("Failed to register ath12k Wi-Fi 7 driver: %d\n",
+		       ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+void ath12k_wifi7_pci_exit(void)
+{
+	ath12k_pci_unregister_driver(ATH12K_DEVICE_FAMILY_WIFI7);
+}
diff --git a/drivers/net/wireless/ath/ath12k/pci_wifi7.h b/drivers/net/wireless/ath/ath12k/pci_wifi7.h
new file mode 100644
index 0000000000000000000000000000000000000000..662a8bab0ce7fa8c6d0c440333a7c23e649bdf6e
--- /dev/null
+++ b/drivers/net/wireless/ath/ath12k/pci_wifi7.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: BSD-3-Clause-Clear */
+/*
+ * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+#ifndef ATH12K_PCI_WIFI7_H
+#define ATH12K_PCI_WIFI7_H
+
+int ath12k_wifi7_pci_init(void);
+void ath12k_wifi7_pci_exit(void);
+
+#endif /* ATH12K_PCI_WIFI7_H */

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH ath12k-ng 02/13] wifi: ath12k: Move Copy Engine configuration to Wi-Fi 7 specific file
  2025-08-12 17:09 [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Kiran Venkatappa
  2025-08-12 17:09 ` [PATCH ath12k-ng 01/13] wifi: ath12k: Restructure PCI code to common and Wi-Fi 7 specific logic Kiran Venkatappa
@ 2025-08-12 17:09 ` Kiran Venkatappa
  2025-08-12 17:09 ` [PATCH ath12k-ng 03/13] wifi: ath12k: Move Wi-Fi 7 WMI configuration to dedicated file Kiran Venkatappa
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Kiran Venkatappa @ 2025-08-12 17:09 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless

Relocate Copy Engine (CE) assignment logic from ce.c to a new ce_wifi7.c
file to consolidate Wi-Fi 7 specific CE configuration in one place.
Move CE service map and target configuration from hw.c to ce_wifi7.c.

This reorganization improves code clarity and modularity by isolating
device-specific logic. It is part of a broader effort to separate
common and hardware-specific code into distinct modules.

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

Signed-off-by: Kiran Venkatappa <quic_kiranv@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/Makefile   |   1 +
 drivers/net/wireless/ath/ath12k/ce.c       | 301 ---------
 drivers/net/wireless/ath/ath12k/ce.h       |   4 -
 drivers/net/wireless/ath/ath12k/ce_wifi7.c | 970 +++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath12k/ce_wifi7.h |  22 +
 drivers/net/wireless/ath/ath12k/hw.c       | 629 +------------------
 6 files changed, 994 insertions(+), 933 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/Makefile b/drivers/net/wireless/ath/ath12k/Makefile
index 1a26e00627b0a3d631ddfa62ef70a9b29b426a3f..e4776887c939ab0d11307e8f616f3728ed39ce71 100644
--- a/drivers/net/wireless/ath/ath12k/Makefile
+++ b/drivers/net/wireless/ath/ath12k/Makefile
@@ -14,6 +14,7 @@ ath12k-y += core.o \
 	    dp_rx.o \
 	    debug.o \
 	    ce.o \
+	    ce_wifi7.o \
 	    peer.o \
 	    dbring.o \
 	    hw.o \
diff --git a/drivers/net/wireless/ath/ath12k/ce.c b/drivers/net/wireless/ath/ath12k/ce.c
index f93a419abf65ec6e9b31e22c78c8c2cdd7bdbc76..6e380b773f05627ddc76541af845f4969a0f206a 100644
--- a/drivers/net/wireless/ath/ath12k/ce.c
+++ b/drivers/net/wireless/ath/ath12k/ce.c
@@ -8,307 +8,6 @@
 #include "debug.h"
 #include "hif.h"
 
-const struct ce_attr ath12k_host_ce_config_qcn9274[] = {
-	/* CE0: host->target HTC control and raw streams */
-	{
-		.flags = CE_ATTR_FLAGS,
-		.src_nentries = 16,
-		.src_sz_max = 2048,
-		.dest_nentries = 0,
-	},
-
-	/* CE1: target->host HTT + HTC control */
-	{
-		.flags = CE_ATTR_FLAGS,
-		.src_nentries = 0,
-		.src_sz_max = 2048,
-		.dest_nentries = 512,
-		.recv_cb = ath12k_htc_rx_completion_handler,
-	},
-
-	/* CE2: target->host WMI */
-	{
-		.flags = CE_ATTR_FLAGS,
-		.src_nentries = 0,
-		.src_sz_max = 2048,
-		.dest_nentries = 128,
-		.recv_cb = ath12k_htc_rx_completion_handler,
-	},
-
-	/* CE3: host->target WMI (mac0) */
-	{
-		.flags = CE_ATTR_FLAGS,
-		.src_nentries = 32,
-		.src_sz_max = 2048,
-		.dest_nentries = 0,
-	},
-
-	/* CE4: host->target HTT */
-	{
-		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
-		.src_nentries = 2048,
-		.src_sz_max = 256,
-		.dest_nentries = 0,
-	},
-
-	/* CE5: target->host pktlog */
-	{
-		.flags = CE_ATTR_FLAGS,
-		.src_nentries = 0,
-		.src_sz_max = 2048,
-		.dest_nentries = 512,
-		.recv_cb = ath12k_dp_htt_htc_t2h_msg_handler,
-	},
-
-	/* CE6: target autonomous hif_memcpy */
-	{
-		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
-		.src_nentries = 0,
-		.src_sz_max = 0,
-		.dest_nentries = 0,
-	},
-
-	/* CE7: host->target WMI (mac1) */
-	{
-		.flags = CE_ATTR_FLAGS,
-		.src_nentries = 32,
-		.src_sz_max = 2048,
-		.dest_nentries = 0,
-	},
-
-	/* CE8: target autonomous hif_memcpy */
-	{
-		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
-		.src_nentries = 0,
-		.src_sz_max = 0,
-		.dest_nentries = 0,
-	},
-
-	/* CE9: MHI */
-	{
-		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
-		.src_nentries = 0,
-		.src_sz_max = 0,
-		.dest_nentries = 0,
-	},
-
-	/* CE10: MHI */
-	{
-		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
-		.src_nentries = 0,
-		.src_sz_max = 0,
-		.dest_nentries = 0,
-	},
-
-	/* CE11: MHI */
-	{
-		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
-		.src_nentries = 0,
-		.src_sz_max = 0,
-		.dest_nentries = 0,
-	},
-
-	/* CE12: CV Prefetch */
-	{
-		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
-		.src_nentries = 0,
-		.src_sz_max = 0,
-		.dest_nentries = 0,
-	},
-
-	/* CE13: CV Prefetch */
-	{
-		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
-		.src_nentries = 0,
-		.src_sz_max = 0,
-		.dest_nentries = 0,
-	},
-
-	/* CE14: target->host dbg log */
-	{
-		.flags = CE_ATTR_FLAGS,
-		.src_nentries = 0,
-		.src_sz_max = 2048,
-		.dest_nentries = 512,
-		.recv_cb = ath12k_htc_rx_completion_handler,
-	},
-
-	/* CE15: reserved for future use */
-	{
-		.flags = (CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
-		.src_nentries = 0,
-		.src_sz_max = 0,
-		.dest_nentries = 0,
-	},
-};
-
-const struct ce_attr ath12k_host_ce_config_wcn7850[] = {
-	/* CE0: host->target HTC control and raw streams */
-	{
-		.flags = CE_ATTR_FLAGS,
-		.src_nentries = 16,
-		.src_sz_max = 2048,
-		.dest_nentries = 0,
-	},
-
-	/* CE1: target->host HTT + HTC control */
-	{
-		.flags = CE_ATTR_FLAGS,
-		.src_nentries = 0,
-		.src_sz_max = 2048,
-		.dest_nentries = 512,
-		.recv_cb = ath12k_htc_rx_completion_handler,
-	},
-
-	/* CE2: target->host WMI */
-	{
-		.flags = CE_ATTR_FLAGS,
-		.src_nentries = 0,
-		.src_sz_max = 2048,
-		.dest_nentries = 64,
-		.recv_cb = ath12k_htc_rx_completion_handler,
-	},
-
-	/* CE3: host->target WMI (mac0) */
-	{
-		.flags = CE_ATTR_FLAGS,
-		.src_nentries = 32,
-		.src_sz_max = 2048,
-		.dest_nentries = 0,
-	},
-
-	/* CE4: host->target HTT */
-	{
-		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
-		.src_nentries = 2048,
-		.src_sz_max = 256,
-		.dest_nentries = 0,
-	},
-
-	/* CE5: target->host pktlog */
-	{
-		.flags = CE_ATTR_FLAGS,
-		.src_nentries = 0,
-		.src_sz_max = 0,
-		.dest_nentries = 0,
-	},
-
-	/* CE6: target autonomous hif_memcpy */
-	{
-		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
-		.src_nentries = 0,
-		.src_sz_max = 0,
-		.dest_nentries = 0,
-	},
-
-	/* CE7: host->target WMI (mac1) */
-	{
-		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
-		.src_nentries = 0,
-		.src_sz_max = 2048,
-		.dest_nentries = 0,
-	},
-
-	/* CE8: target autonomous hif_memcpy */
-	{
-		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
-		.src_nentries = 0,
-		.src_sz_max = 0,
-		.dest_nentries = 0,
-	},
-
-};
-
-const struct ce_attr ath12k_host_ce_config_ipq5332[] = {
-	/* CE0: host->target HTC control and raw streams */
-	{
-		.flags = CE_ATTR_FLAGS,
-		.src_nentries = 16,
-		.src_sz_max = 2048,
-		.dest_nentries = 0,
-	},
-	/* CE1: target->host HTT + HTC control */
-	{
-		.flags = CE_ATTR_FLAGS,
-		.src_nentries = 0,
-		.src_sz_max = 2048,
-		.dest_nentries = 512,
-		.recv_cb = ath12k_htc_rx_completion_handler,
-	},
-	/* CE2: target->host WMI */
-	{
-		.flags = CE_ATTR_FLAGS,
-		.src_nentries = 0,
-		.src_sz_max = 2048,
-		.dest_nentries = 128,
-		.recv_cb = ath12k_htc_rx_completion_handler,
-	},
-	/* CE3: host->target WMI */
-	{
-		.flags = CE_ATTR_FLAGS,
-		.src_nentries = 32,
-		.src_sz_max = 2048,
-		.dest_nentries = 0,
-	},
-	/* CE4: host->target HTT */
-	{
-		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
-		.src_nentries = 2048,
-		.src_sz_max = 256,
-		.dest_nentries = 0,
-	},
-	/* CE5: target -> host PKTLOG */
-	{
-		.flags = CE_ATTR_FLAGS,
-		.src_nentries = 0,
-		.src_sz_max = 2048,
-		.dest_nentries = 512,
-		.recv_cb = ath12k_dp_htt_htc_t2h_msg_handler,
-	},
-	/* CE6: Target autonomous HIF_memcpy */
-	{
-		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
-		.src_nentries = 0,
-		.src_sz_max = 0,
-		.dest_nentries = 0,
-	},
-	/* CE7: CV Prefetch */
-	{
-		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
-		.src_nentries = 0,
-		.src_sz_max = 0,
-		.dest_nentries = 0,
-	},
-	/* CE8: Target HIF memcpy (Generic HIF memcypy) */
-	{
-		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
-		.src_nentries = 0,
-		.src_sz_max = 0,
-		.dest_nentries = 0,
-	},
-	/* CE9: WMI logging/CFR/Spectral/Radar */
-	{
-		.flags = CE_ATTR_FLAGS,
-		.src_nentries = 0,
-		.src_sz_max = 2048,
-		.dest_nentries = 128,
-	},
-	/* CE10: Unused */
-	{
-		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
-		.src_nentries = 0,
-		.src_sz_max = 0,
-		.dest_nentries = 0,
-	},
-	/* CE11: Unused */
-	{
-		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
-		.src_nentries = 0,
-		.src_sz_max = 0,
-		.dest_nentries = 0,
-	},
-};
-
 static int ath12k_ce_rx_buf_enqueue_pipe(struct ath12k_ce_pipe *pipe,
 					 struct sk_buff *skb, dma_addr_t paddr)
 {
diff --git a/drivers/net/wireless/ath/ath12k/ce.h b/drivers/net/wireless/ath/ath12k/ce.h
index 57f75899ee03d63479698011fc081936677f8698..f44ce2244bcfdb60d505d51096ed70b3965952c9 100644
--- a/drivers/net/wireless/ath/ath12k/ce.h
+++ b/drivers/net/wireless/ath/ath12k/ce.h
@@ -173,10 +173,6 @@ struct ath12k_ce {
 	struct ath12k_hp_update_timer hp_timer[CE_COUNT_MAX];
 };
 
-extern const struct ce_attr ath12k_host_ce_config_qcn9274[];
-extern const struct ce_attr ath12k_host_ce_config_wcn7850[];
-extern const struct ce_attr ath12k_host_ce_config_ipq5332[];
-
 void ath12k_ce_cleanup_pipes(struct ath12k_base *ab);
 void ath12k_ce_rx_replenish_retry(struct timer_list *t);
 void ath12k_ce_per_engine_service(struct ath12k_base *ab, u16 ce_id);
diff --git a/drivers/net/wireless/ath/ath12k/ce_wifi7.c b/drivers/net/wireless/ath/ath12k/ce_wifi7.c
new file mode 100644
index 0000000000000000000000000000000000000000..cf27259d15a0e85c30268c12f935ad3b7985a22f
--- /dev/null
+++ b/drivers/net/wireless/ath/ath12k/ce_wifi7.c
@@ -0,0 +1,970 @@
+// 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.
+ */
+
+#include <linux/types.h>
+#include <linux/bitops.h>
+#include <linux/bitfield.h>
+
+#include "core.h"
+#include "ce.h"
+#include "ce_wifi7.h"
+#include "dp_rx.h"
+
+/* Copy Engine (CE) configs for QCN9274 */
+/* Target firmware's Copy Engine configuration. */
+const struct ce_pipe_config ath12k_target_ce_config_wlan_qcn9274[] = {
+	/* CE0: host->target HTC control and raw streams */
+	{
+		.pipenum = __cpu_to_le32(0),
+		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE1: target->host HTT + HTC control */
+	{
+		.pipenum = __cpu_to_le32(1),
+		.pipedir = __cpu_to_le32(PIPEDIR_IN),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE2: target->host WMI */
+	{
+		.pipenum = __cpu_to_le32(2),
+		.pipedir = __cpu_to_le32(PIPEDIR_IN),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE3: host->target WMI (mac0) */
+	{
+		.pipenum = __cpu_to_le32(3),
+		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE4: host->target HTT */
+	{
+		.pipenum = __cpu_to_le32(4),
+		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
+		.nentries = __cpu_to_le32(256),
+		.nbytes_max = __cpu_to_le32(256),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE5: target->host Pktlog */
+	{
+		.pipenum = __cpu_to_le32(5),
+		.pipedir = __cpu_to_le32(PIPEDIR_IN),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE6: Reserved for target autonomous hif_memcpy */
+	{
+		.pipenum = __cpu_to_le32(6),
+		.pipedir = __cpu_to_le32(PIPEDIR_INOUT),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(16384),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE7: host->target WMI (mac1) */
+	{
+		.pipenum = __cpu_to_le32(7),
+		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE8: Reserved for target autonomous hif_memcpy */
+	{
+		.pipenum = __cpu_to_le32(8),
+		.pipedir = __cpu_to_le32(PIPEDIR_INOUT),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(16384),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE9, 10 and 11: Reserved for MHI */
+
+	/* CE12: Target CV prefetch */
+	{
+		.pipenum = __cpu_to_le32(12),
+		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE13: Target CV prefetch */
+	{
+		.pipenum = __cpu_to_le32(13),
+		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE14: WMI logging/CFR/Spectral/Radar */
+	{
+		.pipenum = __cpu_to_le32(14),
+		.pipedir = __cpu_to_le32(PIPEDIR_IN),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE15: Reserved */
+};
+
+/* Map from service/endpoint to Copy Engine.
+ * This table is derived from the CE_PCI TABLE, above.
+ * It is passed to the Target at startup for use by firmware.
+ * Pipe direction:
+ *      PIPEDIR_OUT = UL = host -> target
+ *      PIPEDIR_IN = DL = target -> host
+ */
+const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_qcn9274[] = {
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(3),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(2),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(3),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(2),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(3),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(2),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(3),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(2),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(3),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(2),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(0),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(1),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(0),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(1),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(4),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(1),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_MAC1),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(7),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_MAC1),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(2),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_PKT_LOG),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(5),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_DIAG),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(14),
+	},
+
+	/* (Additions here) */
+
+	{ /* must be last */
+		__cpu_to_le32(0),
+		__cpu_to_le32(0),
+		__cpu_to_le32(0),
+	},
+};
+
+const struct ce_attr ath12k_host_ce_config_qcn9274[] = {
+	/* CE0: host->target HTC control and raw streams */
+	{
+		.flags = CE_ATTR_FLAGS,
+		.src_nentries = 16,
+		.src_sz_max = 2048,
+		.dest_nentries = 0,
+	},
+
+	/* CE1: target->host HTT + HTC control */
+	{
+		.flags = CE_ATTR_FLAGS,
+		.src_nentries = 0,
+		.src_sz_max = 2048,
+		.dest_nentries = 512,
+		.recv_cb = ath12k_htc_rx_completion_handler,
+	},
+
+	/* CE2: target->host WMI */
+	{
+		.flags = CE_ATTR_FLAGS,
+		.src_nentries = 0,
+		.src_sz_max = 2048,
+		.dest_nentries = 128,
+		.recv_cb = ath12k_htc_rx_completion_handler,
+	},
+
+	/* CE3: host->target WMI (mac0) */
+	{
+		.flags = CE_ATTR_FLAGS,
+		.src_nentries = 32,
+		.src_sz_max = 2048,
+		.dest_nentries = 0,
+	},
+
+	/* CE4: host->target HTT */
+	{
+		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
+		.src_nentries = 2048,
+		.src_sz_max = 256,
+		.dest_nentries = 0,
+	},
+
+	/* CE5: target->host pktlog */
+	{
+		.flags = CE_ATTR_FLAGS,
+		.src_nentries = 0,
+		.src_sz_max = 2048,
+		.dest_nentries = 512,
+		.recv_cb = ath12k_dp_htt_htc_t2h_msg_handler,
+	},
+
+	/* CE6: target autonomous hif_memcpy */
+	{
+		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
+		.src_nentries = 0,
+		.src_sz_max = 0,
+		.dest_nentries = 0,
+	},
+
+	/* CE7: host->target WMI (mac1) */
+	{
+		.flags = CE_ATTR_FLAGS,
+		.src_nentries = 32,
+		.src_sz_max = 2048,
+		.dest_nentries = 0,
+	},
+
+	/* CE8: target autonomous hif_memcpy */
+	{
+		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
+		.src_nentries = 0,
+		.src_sz_max = 0,
+		.dest_nentries = 0,
+	},
+
+	/* CE9: MHI */
+	{
+		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
+		.src_nentries = 0,
+		.src_sz_max = 0,
+		.dest_nentries = 0,
+	},
+
+	/* CE10: MHI */
+	{
+		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
+		.src_nentries = 0,
+		.src_sz_max = 0,
+		.dest_nentries = 0,
+	},
+
+	/* CE11: MHI */
+	{
+		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
+		.src_nentries = 0,
+		.src_sz_max = 0,
+		.dest_nentries = 0,
+	},
+
+	/* CE12: CV Prefetch */
+	{
+		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
+		.src_nentries = 0,
+		.src_sz_max = 0,
+		.dest_nentries = 0,
+	},
+
+	/* CE13: CV Prefetch */
+	{
+		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
+		.src_nentries = 0,
+		.src_sz_max = 0,
+		.dest_nentries = 0,
+	},
+
+	/* CE14: target->host dbg log */
+	{
+		.flags = CE_ATTR_FLAGS,
+		.src_nentries = 0,
+		.src_sz_max = 2048,
+		.dest_nentries = 512,
+		.recv_cb = ath12k_htc_rx_completion_handler,
+	},
+
+	/* CE15: reserved for future use */
+	{
+		.flags = (CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
+		.src_nentries = 0,
+		.src_sz_max = 0,
+		.dest_nentries = 0,
+	},
+};
+
+/* Copy Engine (CE) configs for WCN7850 */
+/* Target firmware's Copy Engine configuration. */
+const struct ce_pipe_config ath12k_target_ce_config_wlan_wcn7850[] = {
+	/* CE0: host->target HTC control and raw streams */
+	{
+		.pipenum = __cpu_to_le32(0),
+		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE1: target->host HTT + HTC control */
+	{
+		.pipenum = __cpu_to_le32(1),
+		.pipedir = __cpu_to_le32(PIPEDIR_IN),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE2: target->host WMI */
+	{
+		.pipenum = __cpu_to_le32(2),
+		.pipedir = __cpu_to_le32(PIPEDIR_IN),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE3: host->target WMI */
+	{
+		.pipenum = __cpu_to_le32(3),
+		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE4: host->target HTT */
+	{
+		.pipenum = __cpu_to_le32(4),
+		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
+		.nentries = __cpu_to_le32(256),
+		.nbytes_max = __cpu_to_le32(256),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE5: target->host Pktlog */
+	{
+		.pipenum = __cpu_to_le32(5),
+		.pipedir = __cpu_to_le32(PIPEDIR_IN),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE6: Reserved for target autonomous hif_memcpy */
+	{
+		.pipenum = __cpu_to_le32(6),
+		.pipedir = __cpu_to_le32(PIPEDIR_INOUT),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(16384),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE7 used only by Host */
+	{
+		.pipenum = __cpu_to_le32(7),
+		.pipedir = __cpu_to_le32(PIPEDIR_INOUT_H2H),
+		.nentries = __cpu_to_le32(0),
+		.nbytes_max = __cpu_to_le32(0),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE8 target->host used only by IPA */
+	{
+		.pipenum = __cpu_to_le32(8),
+		.pipedir = __cpu_to_le32(PIPEDIR_INOUT),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(16384),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+	/* CE 9, 10, 11 are used by MHI driver */
+};
+
+const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_wcn7850[] = {
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(3),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(2),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(3),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(2),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(3),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(2),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(3),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(2),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(3),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(2),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(0),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(2),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(4),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(1),
+	},
+
+	/* (Additions here) */
+
+	{ /* must be last */
+		__cpu_to_le32(0),
+		__cpu_to_le32(0),
+		__cpu_to_le32(0),
+	},
+};
+
+const struct ce_attr ath12k_host_ce_config_wcn7850[] = {
+	/* CE0: host->target HTC control and raw streams */
+	{
+		.flags = CE_ATTR_FLAGS,
+		.src_nentries = 16,
+		.src_sz_max = 2048,
+		.dest_nentries = 0,
+	},
+
+	/* CE1: target->host HTT + HTC control */
+	{
+		.flags = CE_ATTR_FLAGS,
+		.src_nentries = 0,
+		.src_sz_max = 2048,
+		.dest_nentries = 512,
+		.recv_cb = ath12k_htc_rx_completion_handler,
+	},
+
+	/* CE2: target->host WMI */
+	{
+		.flags = CE_ATTR_FLAGS,
+		.src_nentries = 0,
+		.src_sz_max = 2048,
+		.dest_nentries = 64,
+		.recv_cb = ath12k_htc_rx_completion_handler,
+	},
+
+	/* CE3: host->target WMI (mac0) */
+	{
+		.flags = CE_ATTR_FLAGS,
+		.src_nentries = 32,
+		.src_sz_max = 2048,
+		.dest_nentries = 0,
+	},
+
+	/* CE4: host->target HTT */
+	{
+		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
+		.src_nentries = 2048,
+		.src_sz_max = 256,
+		.dest_nentries = 0,
+	},
+
+	/* CE5: target->host pktlog */
+	{
+		.flags = CE_ATTR_FLAGS,
+		.src_nentries = 0,
+		.src_sz_max = 0,
+		.dest_nentries = 0,
+	},
+
+	/* CE6: target autonomous hif_memcpy */
+	{
+		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
+		.src_nentries = 0,
+		.src_sz_max = 0,
+		.dest_nentries = 0,
+	},
+
+	/* CE7: host->target WMI (mac1) */
+	{
+		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
+		.src_nentries = 0,
+		.src_sz_max = 2048,
+		.dest_nentries = 0,
+	},
+
+	/* CE8: target autonomous hif_memcpy */
+	{
+		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
+		.src_nentries = 0,
+		.src_sz_max = 0,
+		.dest_nentries = 0,
+	},
+};
+
+/* Copy Engine (CE) configs for IPQ5332 */
+/* Target firmware's Copy Engine configuration. */
+const struct ce_pipe_config ath12k_target_ce_config_wlan_ipq5332[] = {
+	/* CE0: host->target HTC control and raw streams */
+	{
+		.pipenum = __cpu_to_le32(0),
+		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE1: target->host HTT */
+	{
+		.pipenum = __cpu_to_le32(1),
+		.pipedir = __cpu_to_le32(PIPEDIR_IN),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE2: target->host WMI  + HTC control */
+	{
+		.pipenum = __cpu_to_le32(2),
+		.pipedir = __cpu_to_le32(PIPEDIR_IN),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE3: host->target WMI */
+	{
+		.pipenum = __cpu_to_le32(3),
+		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE4: host->target HTT */
+	{
+		.pipenum = __cpu_to_le32(4),
+		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
+		.nentries = __cpu_to_le32(256),
+		.nbytes_max = __cpu_to_le32(256),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE5: Target -> host PKTLOG */
+	{
+		.pipenum = __cpu_to_le32(5),
+		.pipedir = __cpu_to_le32(PIPEDIR_IN),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE6: Reserved for target autonomous HIF_memcpy */
+	{
+		.pipenum = __cpu_to_le32(6),
+		.pipedir = __cpu_to_le32(PIPEDIR_INOUT),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(16384),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE7: Reserved for CV Prefetch */
+	{
+		.pipenum = __cpu_to_le32(7),
+		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE8: Reserved for target generic HIF memcpy */
+	{
+		.pipenum = __cpu_to_le32(8),
+		.pipedir = __cpu_to_le32(PIPEDIR_INOUT),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(16384),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE9: WMI logging/CFR/Spectral/Radar/ */
+	{
+		.pipenum = __cpu_to_le32(9),
+		.pipedir = __cpu_to_le32(PIPEDIR_IN),
+		.nentries = __cpu_to_le32(32),
+		.nbytes_max = __cpu_to_le32(2048),
+		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
+		.reserved = __cpu_to_le32(0),
+	},
+
+	/* CE10: Unused TBD */
+	{
+		.pipenum = __cpu_to_le32(10),
+		.pipedir = __cpu_to_le32(PIPEDIR_NONE),
+		.nentries = __cpu_to_le32(0),
+		.nbytes_max = __cpu_to_le32(0),
+		.flags = __cpu_to_le32(0),
+		.reserved = __cpu_to_le32(0),
+	},
+	/* CE11: Unused TBD */
+	{
+		.pipenum = __cpu_to_le32(11),
+		.pipedir = __cpu_to_le32(PIPEDIR_NONE),
+		.nentries = __cpu_to_le32(0),
+		.nbytes_max = __cpu_to_le32(0),
+		.flags = __cpu_to_le32(0),
+		.reserved = __cpu_to_le32(0),
+	},
+};
+
+const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_ipq5332[] = {
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(3),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(2),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(3),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(2),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(3),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(2),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(3),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(2),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(3),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(2),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(0),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(1),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(0),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(1),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
+		__cpu_to_le32(PIPEDIR_OUT),
+		__cpu_to_le32(4),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(1),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_PKT_LOG),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(5),
+	},
+	{
+		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_DIAG),
+		__cpu_to_le32(PIPEDIR_IN),
+		__cpu_to_le32(9),
+	},
+	/* (Additions here) */
+
+	{ /* must be last */
+		__cpu_to_le32(0),
+		__cpu_to_le32(0),
+		__cpu_to_le32(0),
+	},
+};
+
+const struct ce_attr ath12k_host_ce_config_ipq5332[] = {
+	/* CE0: host->target HTC control and raw streams */
+	{
+		.flags = CE_ATTR_FLAGS,
+		.src_nentries = 16,
+		.src_sz_max = 2048,
+		.dest_nentries = 0,
+	},
+
+	/* CE1: target->host HTT + HTC control */
+	{
+		.flags = CE_ATTR_FLAGS,
+		.src_nentries = 0,
+		.src_sz_max = 2048,
+		.dest_nentries = 512,
+		.recv_cb = ath12k_htc_rx_completion_handler,
+	},
+
+	/* CE2: target->host WMI */
+	{
+		.flags = CE_ATTR_FLAGS,
+		.src_nentries = 0,
+		.src_sz_max = 2048,
+		.dest_nentries = 128,
+		.recv_cb = ath12k_htc_rx_completion_handler,
+	},
+
+	/* CE3: host->target WMI */
+	{
+		.flags = CE_ATTR_FLAGS,
+		.src_nentries = 32,
+		.src_sz_max = 2048,
+		.dest_nentries = 0,
+	},
+
+	/* CE4: host->target HTT */
+	{
+		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
+		.src_nentries = 2048,
+		.src_sz_max = 256,
+		.dest_nentries = 0,
+	},
+
+	/* CE5: target -> host PKTLOG */
+	{
+		.flags = CE_ATTR_FLAGS,
+		.src_nentries = 0,
+		.src_sz_max = 2048,
+		.dest_nentries = 512,
+		.recv_cb = ath12k_dp_htt_htc_t2h_msg_handler,
+	},
+
+	/* CE6: Target autonomous HIF_memcpy */
+	{
+		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
+		.src_nentries = 0,
+		.src_sz_max = 0,
+		.dest_nentries = 0,
+	},
+
+	/* CE7: CV Prefetch */
+	{
+		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
+		.src_nentries = 0,
+		.src_sz_max = 0,
+		.dest_nentries = 0,
+	},
+
+	/* CE8: Target HIF memcpy (Generic HIF memcypy) */
+	{
+		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
+		.src_nentries = 0,
+		.src_sz_max = 0,
+		.dest_nentries = 0,
+	},
+
+	/* CE9: WMI logging/CFR/Spectral/Radar */
+	{
+		.flags = CE_ATTR_FLAGS,
+		.src_nentries = 0,
+		.src_sz_max = 2048,
+		.dest_nentries = 128,
+	},
+
+	/* CE10: Unused */
+	{
+		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
+		.src_nentries = 0,
+		.src_sz_max = 0,
+		.dest_nentries = 0,
+	},
+
+	/* CE11: Unused */
+	{
+		.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
+		.src_nentries = 0,
+		.src_sz_max = 0,
+		.dest_nentries = 0,
+	},
+};
diff --git a/drivers/net/wireless/ath/ath12k/ce_wifi7.h b/drivers/net/wireless/ath/ath12k/ce_wifi7.h
new file mode 100644
index 0000000000000000000000000000000000000000..1e211e8c246729897f66c3e468e96ff7dd15e6fd
--- /dev/null
+++ b/drivers/net/wireless/ath/ath12k/ce_wifi7.h
@@ -0,0 +1,22 @@
+/* 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_CE_H
+#define ATH12K_WIFI7_CE_H
+
+extern const struct ce_pipe_config ath12k_target_ce_config_wlan_qcn9274[];
+extern const struct ce_pipe_config ath12k_target_ce_config_wlan_wcn7850[];
+extern const struct ce_pipe_config ath12k_target_ce_config_wlan_ipq5332[];
+
+extern const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_qcn9274[];
+extern const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_wcn7850[];
+extern const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_ipq5332[];
+
+extern const struct ce_attr ath12k_host_ce_config_qcn9274[];
+extern const struct ce_attr ath12k_host_ce_config_wcn7850[];
+extern const struct ce_attr ath12k_host_ce_config_ipq5332[];
+
+#endif /* ATH12K_WIFI7_CE_H */
diff --git a/drivers/net/wireless/ath/ath12k/hw.c b/drivers/net/wireless/ath/ath12k/hw.c
index 6791ae1d64e50feb96df9add0d8b5f2f76b425e4..dd60e27cc499648e4c6ec95d0a56ec06f4c7c6ae 100644
--- a/drivers/net/wireless/ath/ath12k/hw.c
+++ b/drivers/net/wireless/ath/ath12k/hw.c
@@ -11,6 +11,7 @@
 #include "debug.h"
 #include "core.h"
 #include "ce.h"
+#include "ce_wifi7.h"
 #include "hw.h"
 #include "mhi.h"
 #include "dp_rx.h"
@@ -177,634 +178,6 @@ static const struct ath12k_hw_ops wcn7850_ops = {
 #define ATH12K_RX_MON_STATUS_RING_MASK_1 0x2
 #define ATH12K_RX_MON_STATUS_RING_MASK_2 0x4
 
-/* Target firmware's Copy Engine configuration. */
-static const struct ce_pipe_config ath12k_target_ce_config_wlan_qcn9274[] = {
-	/* CE0: host->target HTC control and raw streams */
-	{
-		.pipenum = __cpu_to_le32(0),
-		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE1: target->host HTT + HTC control */
-	{
-		.pipenum = __cpu_to_le32(1),
-		.pipedir = __cpu_to_le32(PIPEDIR_IN),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE2: target->host WMI */
-	{
-		.pipenum = __cpu_to_le32(2),
-		.pipedir = __cpu_to_le32(PIPEDIR_IN),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE3: host->target WMI (mac0) */
-	{
-		.pipenum = __cpu_to_le32(3),
-		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE4: host->target HTT */
-	{
-		.pipenum = __cpu_to_le32(4),
-		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
-		.nentries = __cpu_to_le32(256),
-		.nbytes_max = __cpu_to_le32(256),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE5: target->host Pktlog */
-	{
-		.pipenum = __cpu_to_le32(5),
-		.pipedir = __cpu_to_le32(PIPEDIR_IN),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE6: Reserved for target autonomous hif_memcpy */
-	{
-		.pipenum = __cpu_to_le32(6),
-		.pipedir = __cpu_to_le32(PIPEDIR_INOUT),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(16384),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE7: host->target WMI (mac1) */
-	{
-		.pipenum = __cpu_to_le32(7),
-		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE8: Reserved for target autonomous hif_memcpy */
-	{
-		.pipenum = __cpu_to_le32(8),
-		.pipedir = __cpu_to_le32(PIPEDIR_INOUT),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(16384),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE9, 10 and 11: Reserved for MHI */
-
-	/* CE12: Target CV prefetch */
-	{
-		.pipenum = __cpu_to_le32(12),
-		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE13: Target CV prefetch */
-	{
-		.pipenum = __cpu_to_le32(13),
-		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE14: WMI logging/CFR/Spectral/Radar */
-	{
-		.pipenum = __cpu_to_le32(14),
-		.pipedir = __cpu_to_le32(PIPEDIR_IN),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE15: Reserved */
-};
-
-/* Target firmware's Copy Engine configuration. */
-static const struct ce_pipe_config ath12k_target_ce_config_wlan_wcn7850[] = {
-	/* CE0: host->target HTC control and raw streams */
-	{
-		.pipenum = __cpu_to_le32(0),
-		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE1: target->host HTT + HTC control */
-	{
-		.pipenum = __cpu_to_le32(1),
-		.pipedir = __cpu_to_le32(PIPEDIR_IN),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE2: target->host WMI */
-	{
-		.pipenum = __cpu_to_le32(2),
-		.pipedir = __cpu_to_le32(PIPEDIR_IN),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE3: host->target WMI */
-	{
-		.pipenum = __cpu_to_le32(3),
-		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE4: host->target HTT */
-	{
-		.pipenum = __cpu_to_le32(4),
-		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
-		.nentries = __cpu_to_le32(256),
-		.nbytes_max = __cpu_to_le32(256),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE5: target->host Pktlog */
-	{
-		.pipenum = __cpu_to_le32(5),
-		.pipedir = __cpu_to_le32(PIPEDIR_IN),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE6: Reserved for target autonomous hif_memcpy */
-	{
-		.pipenum = __cpu_to_le32(6),
-		.pipedir = __cpu_to_le32(PIPEDIR_INOUT),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(16384),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE7 used only by Host */
-	{
-		.pipenum = __cpu_to_le32(7),
-		.pipedir = __cpu_to_le32(PIPEDIR_INOUT_H2H),
-		.nentries = __cpu_to_le32(0),
-		.nbytes_max = __cpu_to_le32(0),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
-		.reserved = __cpu_to_le32(0),
-	},
-
-	/* CE8 target->host used only by IPA */
-	{
-		.pipenum = __cpu_to_le32(8),
-		.pipedir = __cpu_to_le32(PIPEDIR_INOUT),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(16384),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-	/* CE 9, 10, 11 are used by MHI driver */
-};
-
-/* Map from service/endpoint to Copy Engine.
- * This table is derived from the CE_PCI TABLE, above.
- * It is passed to the Target at startup for use by firmware.
- */
-static const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_qcn9274[] = {
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
-		__cpu_to_le32(PIPEDIR_OUT),	/* out = UL = host -> target */
-		__cpu_to_le32(3),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
-		__cpu_to_le32(PIPEDIR_IN),	/* in = DL = target -> host */
-		__cpu_to_le32(2),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
-		__cpu_to_le32(PIPEDIR_OUT),	/* out = UL = host -> target */
-		__cpu_to_le32(3),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
-		__cpu_to_le32(PIPEDIR_IN),	/* in = DL = target -> host */
-		__cpu_to_le32(2),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
-		__cpu_to_le32(PIPEDIR_OUT),	/* out = UL = host -> target */
-		__cpu_to_le32(3),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
-		__cpu_to_le32(PIPEDIR_IN),	/* in = DL = target -> host */
-		__cpu_to_le32(2),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
-		__cpu_to_le32(PIPEDIR_OUT),	/* out = UL = host -> target */
-		__cpu_to_le32(3),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
-		__cpu_to_le32(PIPEDIR_IN),	/* in = DL = target -> host */
-		__cpu_to_le32(2),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
-		__cpu_to_le32(PIPEDIR_OUT),	/* out = UL = host -> target */
-		__cpu_to_le32(3),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
-		__cpu_to_le32(PIPEDIR_IN),	/* in = DL = target -> host */
-		__cpu_to_le32(2),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
-		__cpu_to_le32(PIPEDIR_OUT),	/* out = UL = host -> target */
-		__cpu_to_le32(0),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
-		__cpu_to_le32(PIPEDIR_IN),	/* in = DL = target -> host */
-		__cpu_to_le32(1),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS),
-		__cpu_to_le32(PIPEDIR_OUT),	/* out = UL = host -> target */
-		__cpu_to_le32(0),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS),
-		__cpu_to_le32(PIPEDIR_IN),	/* in = DL = target -> host */
-		__cpu_to_le32(1),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
-		__cpu_to_le32(PIPEDIR_OUT),	/* out = UL = host -> target */
-		__cpu_to_le32(4),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
-		__cpu_to_le32(PIPEDIR_IN),	/* in = DL = target -> host */
-		__cpu_to_le32(1),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_MAC1),
-		__cpu_to_le32(PIPEDIR_OUT),	/* out = UL = host -> target */
-		__cpu_to_le32(7),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_MAC1),
-		__cpu_to_le32(PIPEDIR_IN),	/* in = DL = target -> host */
-		__cpu_to_le32(2),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_PKT_LOG),
-		__cpu_to_le32(PIPEDIR_IN),	/* in = DL = target -> host */
-		__cpu_to_le32(5),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_DIAG),
-		__cpu_to_le32(PIPEDIR_IN),	/* in = DL = target -> host */
-		__cpu_to_le32(14),
-	},
-
-	/* (Additions here) */
-
-	{ /* must be last */
-		__cpu_to_le32(0),
-		__cpu_to_le32(0),
-		__cpu_to_le32(0),
-	},
-};
-
-static const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_wcn7850[] = {
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
-		__cpu_to_le32(PIPEDIR_OUT),	/* out = UL = host -> target */
-		__cpu_to_le32(3),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
-		__cpu_to_le32(PIPEDIR_IN),	/* in = DL = target -> host */
-		__cpu_to_le32(2),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
-		__cpu_to_le32(PIPEDIR_OUT),	/* out = UL = host -> target */
-		__cpu_to_le32(3),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
-		__cpu_to_le32(PIPEDIR_IN),	/* in = DL = target -> host */
-		__cpu_to_le32(2),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
-		__cpu_to_le32(PIPEDIR_OUT),	/* out = UL = host -> target */
-		__cpu_to_le32(3),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
-		__cpu_to_le32(PIPEDIR_IN),	/* in = DL = target -> host */
-		__cpu_to_le32(2),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
-		__cpu_to_le32(PIPEDIR_OUT),	/* out = UL = host -> target */
-		__cpu_to_le32(3),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
-		__cpu_to_le32(PIPEDIR_IN),	/* in = DL = target -> host */
-		__cpu_to_le32(2),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
-		__cpu_to_le32(PIPEDIR_OUT),	/* out = UL = host -> target */
-		__cpu_to_le32(3),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
-		__cpu_to_le32(PIPEDIR_IN),	/* in = DL = target -> host */
-		__cpu_to_le32(2),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
-		__cpu_to_le32(PIPEDIR_OUT),	/* out = UL = host -> target */
-		__cpu_to_le32(0),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
-		__cpu_to_le32(PIPEDIR_IN),	/* in = DL = target -> host */
-		__cpu_to_le32(2),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
-		__cpu_to_le32(PIPEDIR_OUT),	/* out = UL = host -> target */
-		__cpu_to_le32(4),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
-		__cpu_to_le32(PIPEDIR_IN),	/* in = DL = target -> host */
-		__cpu_to_le32(1),
-	},
-
-	/* (Additions here) */
-
-	{ /* must be last */
-		__cpu_to_le32(0),
-		__cpu_to_le32(0),
-		__cpu_to_le32(0),
-	},
-};
-
-static const struct ce_pipe_config ath12k_target_ce_config_wlan_ipq5332[] = {
-	/* host->target HTC control and raw streams */
-	{
-		.pipenum = __cpu_to_le32(0),
-		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-	/* target->host HTT */
-	{
-		.pipenum = __cpu_to_le32(1),
-		.pipedir = __cpu_to_le32(PIPEDIR_IN),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-	/* target->host WMI  + HTC control */
-	{
-		.pipenum = __cpu_to_le32(2),
-		.pipedir = __cpu_to_le32(PIPEDIR_IN),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-	/* host->target WMI */
-	{
-		.pipenum = __cpu_to_le32(3),
-		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-	/* host->target HTT */
-	{
-		.pipenum = __cpu_to_le32(4),
-		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
-		.nentries = __cpu_to_le32(256),
-		.nbytes_max = __cpu_to_le32(256),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
-		.reserved = __cpu_to_le32(0),
-	},
-	/* Target -> host PKTLOG */
-	{
-		.pipenum = __cpu_to_le32(5),
-		.pipedir = __cpu_to_le32(PIPEDIR_IN),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-	/* Reserved for target autonomous HIF_memcpy */
-	{
-		.pipenum = __cpu_to_le32(6),
-		.pipedir = __cpu_to_le32(PIPEDIR_INOUT),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(16384),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-	/* CE7 Reserved for CV Prefetch */
-	{
-		.pipenum = __cpu_to_le32(7),
-		.pipedir = __cpu_to_le32(PIPEDIR_OUT),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-	/* CE8 Reserved for target generic HIF memcpy */
-	{
-		.pipenum = __cpu_to_le32(8),
-		.pipedir = __cpu_to_le32(PIPEDIR_INOUT),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(16384),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-	/* CE9 WMI logging/CFR/Spectral/Radar/ */
-	{
-		.pipenum = __cpu_to_le32(9),
-		.pipedir = __cpu_to_le32(PIPEDIR_IN),
-		.nentries = __cpu_to_le32(32),
-		.nbytes_max = __cpu_to_le32(2048),
-		.flags = __cpu_to_le32(CE_ATTR_FLAGS),
-		.reserved = __cpu_to_le32(0),
-	},
-	/* Unused TBD */
-	{
-		.pipenum = __cpu_to_le32(10),
-		.pipedir = __cpu_to_le32(PIPEDIR_NONE),
-		.nentries = __cpu_to_le32(0),
-		.nbytes_max = __cpu_to_le32(0),
-		.flags = __cpu_to_le32(0),
-		.reserved = __cpu_to_le32(0),
-	},
-	/* Unused TBD */
-	{
-		.pipenum = __cpu_to_le32(11),
-		.pipedir = __cpu_to_le32(PIPEDIR_NONE),
-		.nentries = __cpu_to_le32(0),
-		.nbytes_max = __cpu_to_le32(0),
-		.flags = __cpu_to_le32(0),
-		.reserved = __cpu_to_le32(0),
-	},
-};
-
-static const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_ipq5332[] = {
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
-		__cpu_to_le32(PIPEDIR_OUT),
-		__cpu_to_le32(3),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
-		__cpu_to_le32(PIPEDIR_IN),
-		__cpu_to_le32(2),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
-		__cpu_to_le32(PIPEDIR_OUT),
-		__cpu_to_le32(3),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
-		__cpu_to_le32(PIPEDIR_IN),
-		__cpu_to_le32(2),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
-		__cpu_to_le32(PIPEDIR_OUT),
-		__cpu_to_le32(3),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
-		__cpu_to_le32(PIPEDIR_IN),
-		__cpu_to_le32(2),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
-		__cpu_to_le32(PIPEDIR_OUT),
-		__cpu_to_le32(3),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
-		__cpu_to_le32(PIPEDIR_IN),
-		__cpu_to_le32(2),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
-		__cpu_to_le32(PIPEDIR_OUT),
-		__cpu_to_le32(3),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
-		__cpu_to_le32(PIPEDIR_IN),
-		__cpu_to_le32(2),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
-		__cpu_to_le32(PIPEDIR_OUT),
-		__cpu_to_le32(0),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
-		__cpu_to_le32(PIPEDIR_IN),
-		__cpu_to_le32(1),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS),
-		__cpu_to_le32(PIPEDIR_OUT),
-		__cpu_to_le32(0),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS),
-		__cpu_to_le32(PIPEDIR_IN),
-		__cpu_to_le32(1),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
-		__cpu_to_le32(PIPEDIR_OUT),
-		__cpu_to_le32(4),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
-		__cpu_to_le32(PIPEDIR_IN),
-		__cpu_to_le32(1),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_PKT_LOG),
-		__cpu_to_le32(PIPEDIR_IN),
-		__cpu_to_le32(5),
-	},
-	{
-		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_DIAG),
-		__cpu_to_le32(PIPEDIR_IN),
-		__cpu_to_le32(9),
-	},
-	/* (Additions here) */
-
-	{ /* must be last */
-		__cpu_to_le32(0),
-		__cpu_to_le32(0),
-		__cpu_to_le32(0),
-	},
-};
-
 static const struct ath12k_hw_ring_mask ath12k_hw_ring_mask_qcn9274 = {
 	.tx  = {
 		ATH12K_TX_RING_MASK_0,

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH ath12k-ng 03/13] wifi: ath12k: Move Wi-Fi 7 WMI configuration to dedicated file
  2025-08-12 17:09 [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Kiran Venkatappa
  2025-08-12 17:09 ` [PATCH ath12k-ng 01/13] wifi: ath12k: Restructure PCI code to common and Wi-Fi 7 specific logic Kiran Venkatappa
  2025-08-12 17:09 ` [PATCH ath12k-ng 02/13] wifi: ath12k: Move Copy Engine configuration to Wi-Fi 7 specific file Kiran Venkatappa
@ 2025-08-12 17:09 ` Kiran Venkatappa
  2025-08-13  5:52   ` Krzysztof Kozlowski
  2025-08-12 17:09 ` [PATCH ath12k-ng 04/13] wifi: ath12k: Move Wi-Fi 7 MHI " Kiran Venkatappa
                   ` (12 subsequent siblings)
  15 siblings, 1 reply; 25+ messages in thread
From: Kiran Venkatappa @ 2025-08-12 17:09 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless

Relocate Wi-Fi 7 specific WMI configuration from shared codebase to a new
target-specific file. Isolate WMI settings per target to improve
modularity and maintainability.

This change is part of a broader effort to separate hardware-dependent
logic into standalone modules, paving the way for cleaner support of
multiple hardware families

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

Signed-off-by: Kiran Venkatappa <quic_kiranv@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/Makefile    |   1 +
 drivers/net/wireless/ath/ath12k/hw.c        |   1 +
 drivers/net/wireless/ath/ath12k/wmi.c       |  97 -------------------------
 drivers/net/wireless/ath/ath12k/wmi.h       |   4 --
 drivers/net/wireless/ath/ath12k/wmi_wifi7.c | 105 ++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath12k/wmi_wifi7.h |  15 ++++
 6 files changed, 122 insertions(+), 101 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/Makefile b/drivers/net/wireless/ath/ath12k/Makefile
index e4776887c939ab0d11307e8f616f3728ed39ce71..ee075ee68bb834e3f3605b13a5fee6afff0ba763 100644
--- a/drivers/net/wireless/ath/ath12k/Makefile
+++ b/drivers/net/wireless/ath/ath12k/Makefile
@@ -5,6 +5,7 @@ ath12k-y += core.o \
 	    hal_tx.o \
 	    hal_rx.o \
 	    wmi.o \
+	    wmi_wifi7.o \
 	    mac.o \
 	    reg.o \
 	    htc.o \
diff --git a/drivers/net/wireless/ath/ath12k/hw.c b/drivers/net/wireless/ath/ath12k/hw.c
index dd60e27cc499648e4c6ec95d0a56ec06f4c7c6ae..df1b4439adc798dc0dfb7d8604874a4fcb77663b 100644
--- a/drivers/net/wireless/ath/ath12k/hw.c
+++ b/drivers/net/wireless/ath/ath12k/hw.c
@@ -16,6 +16,7 @@
 #include "mhi.h"
 #include "dp_rx.h"
 #include "peer.h"
+#include "wmi_wifi7.h"
 
 static const guid_t wcn7850_uuid = GUID_INIT(0xf634f534, 0x6147, 0x11ec,
 					     0x90, 0xd6, 0x02, 0x42,
diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
index da85c28ec35568ca5c81a49e565c19cff195bac7..9869c935aee7edb5591595f0bdbf1fbe7e54b00f 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wmi.c
@@ -198,103 +198,6 @@ static __le32 ath12k_wmi_tlv_cmd_hdr(u32 cmd, u32 len)
 	return ath12k_wmi_tlv_hdr(cmd, len - TLV_HDR_SIZE);
 }
 
-void ath12k_wmi_init_qcn9274(struct ath12k_base *ab,
-			     struct ath12k_wmi_resource_config_arg *config)
-{
-	config->num_vdevs = ab->num_radios * TARGET_NUM_VDEVS(ab);
-	config->num_peers = ab->num_radios *
-		ath12k_core_get_max_peers_per_radio(ab);
-	config->num_offload_peers = TARGET_NUM_OFFLD_PEERS;
-	config->num_offload_reorder_buffs = TARGET_NUM_OFFLD_REORDER_BUFFS;
-	config->num_peer_keys = TARGET_NUM_PEER_KEYS;
-	config->ast_skid_limit = TARGET_AST_SKID_LIMIT;
-	config->tx_chain_mask = (1 << ab->target_caps.num_rf_chains) - 1;
-	config->rx_chain_mask = (1 << ab->target_caps.num_rf_chains) - 1;
-	config->rx_timeout_pri[0] = TARGET_RX_TIMEOUT_LO_PRI;
-	config->rx_timeout_pri[1] = TARGET_RX_TIMEOUT_LO_PRI;
-	config->rx_timeout_pri[2] = TARGET_RX_TIMEOUT_LO_PRI;
-	config->rx_timeout_pri[3] = TARGET_RX_TIMEOUT_HI_PRI;
-
-	if (test_bit(ATH12K_FLAG_RAW_MODE, &ab->dev_flags))
-		config->rx_decap_mode = TARGET_DECAP_MODE_RAW;
-	else
-		config->rx_decap_mode = TARGET_DECAP_MODE_NATIVE_WIFI;
-
-	config->scan_max_pending_req = TARGET_SCAN_MAX_PENDING_REQS;
-	config->bmiss_offload_max_vdev = TARGET_BMISS_OFFLOAD_MAX_VDEV;
-	config->roam_offload_max_vdev = TARGET_ROAM_OFFLOAD_MAX_VDEV;
-	config->roam_offload_max_ap_profiles = TARGET_ROAM_OFFLOAD_MAX_AP_PROFILES;
-	config->num_mcast_groups = TARGET_NUM_MCAST_GROUPS;
-	config->num_mcast_table_elems = TARGET_NUM_MCAST_TABLE_ELEMS;
-	config->mcast2ucast_mode = TARGET_MCAST2UCAST_MODE;
-	config->tx_dbg_log_size = TARGET_TX_DBG_LOG_SIZE;
-	config->num_wds_entries = TARGET_NUM_WDS_ENTRIES;
-	config->dma_burst_size = TARGET_DMA_BURST_SIZE;
-	config->rx_skip_defrag_timeout_dup_detection_check =
-		TARGET_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK;
-	config->vow_config = TARGET_VOW_CONFIG;
-	config->gtk_offload_max_vdev = TARGET_GTK_OFFLOAD_MAX_VDEV;
-	config->num_msdu_desc = TARGET_NUM_MSDU_DESC;
-	config->beacon_tx_offload_max_vdev = ab->num_radios * TARGET_MAX_BCN_OFFLD;
-	config->rx_batchmode = TARGET_RX_BATCHMODE;
-	/* Indicates host supports peer map v3 and unmap v2 support */
-	config->peer_map_unmap_version = 0x32;
-	config->twt_ap_pdev_count = ab->num_radios;
-	config->twt_ap_sta_count = 1000;
-	config->ema_max_vap_cnt = ab->num_radios;
-	config->ema_max_profile_period = TARGET_EMA_MAX_PROFILE_PERIOD;
-	config->beacon_tx_offload_max_vdev += config->ema_max_vap_cnt;
-
-	if (test_bit(WMI_TLV_SERVICE_PEER_METADATA_V1A_V1B_SUPPORT, ab->wmi_ab.svc_map))
-		config->peer_metadata_ver = ATH12K_PEER_METADATA_V1B;
-}
-
-void ath12k_wmi_init_wcn7850(struct ath12k_base *ab,
-			     struct ath12k_wmi_resource_config_arg *config)
-{
-	config->num_vdevs = 4;
-	config->num_peers = 16;
-	config->num_tids = 32;
-
-	config->num_offload_peers = 3;
-	config->num_offload_reorder_buffs = 3;
-	config->num_peer_keys = TARGET_NUM_PEER_KEYS;
-	config->ast_skid_limit = TARGET_AST_SKID_LIMIT;
-	config->tx_chain_mask = (1 << ab->target_caps.num_rf_chains) - 1;
-	config->rx_chain_mask = (1 << ab->target_caps.num_rf_chains) - 1;
-	config->rx_timeout_pri[0] = TARGET_RX_TIMEOUT_LO_PRI;
-	config->rx_timeout_pri[1] = TARGET_RX_TIMEOUT_LO_PRI;
-	config->rx_timeout_pri[2] = TARGET_RX_TIMEOUT_LO_PRI;
-	config->rx_timeout_pri[3] = TARGET_RX_TIMEOUT_HI_PRI;
-	config->rx_decap_mode = TARGET_DECAP_MODE_NATIVE_WIFI;
-	config->scan_max_pending_req = TARGET_SCAN_MAX_PENDING_REQS;
-	config->bmiss_offload_max_vdev = TARGET_BMISS_OFFLOAD_MAX_VDEV;
-	config->roam_offload_max_vdev = TARGET_ROAM_OFFLOAD_MAX_VDEV;
-	config->roam_offload_max_ap_profiles = TARGET_ROAM_OFFLOAD_MAX_AP_PROFILES;
-	config->num_mcast_groups = 0;
-	config->num_mcast_table_elems = 0;
-	config->mcast2ucast_mode = 0;
-	config->tx_dbg_log_size = TARGET_TX_DBG_LOG_SIZE;
-	config->num_wds_entries = 0;
-	config->dma_burst_size = 0;
-	config->rx_skip_defrag_timeout_dup_detection_check = 0;
-	config->vow_config = TARGET_VOW_CONFIG;
-	config->gtk_offload_max_vdev = 2;
-	config->num_msdu_desc = 0x400;
-	config->beacon_tx_offload_max_vdev = 2;
-	config->rx_batchmode = TARGET_RX_BATCHMODE;
-
-	config->peer_map_unmap_version = 0x1;
-	config->use_pdev_id = 1;
-	config->max_frag_entries = 0xa;
-	config->num_tdls_vdevs = 0x1;
-	config->num_tdls_conn_table_entries = 8;
-	config->beacon_tx_offload_max_vdev = 0x2;
-	config->num_multicast_filter_entries = 0x20;
-	config->num_wow_filters = 0x16;
-	config->num_keep_alive_pattern = 0;
-}
-
 #define PRIMAP(_hw_mode_) \
 	[_hw_mode_] = _hw_mode_##_PRI
 
diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h
index f3b0a6f57ec2b0d9f9a1b1831b04639088ded27d..833f42e6b826e59a8f54e32359b905d8752e6e42 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.h
+++ b/drivers/net/wireless/ath/ath12k/wmi.h
@@ -6283,10 +6283,6 @@ struct ath12k_wmi_rssi_dbm_conv_info_arg {
 	s8 min_nf_dbm;
 };
 
-void ath12k_wmi_init_qcn9274(struct ath12k_base *ab,
-			     struct ath12k_wmi_resource_config_arg *config);
-void ath12k_wmi_init_wcn7850(struct ath12k_base *ab,
-			     struct ath12k_wmi_resource_config_arg *config);
 int ath12k_wmi_cmd_send(struct ath12k_wmi_pdev *wmi, struct sk_buff *skb,
 			u32 cmd_id);
 struct sk_buff *ath12k_wmi_alloc_skb(struct ath12k_wmi_base *wmi_sc, u32 len);
diff --git a/drivers/net/wireless/ath/ath12k/wmi_wifi7.c b/drivers/net/wireless/ath/ath12k/wmi_wifi7.c
new file mode 100644
index 0000000000000000000000000000000000000000..f27fa56210e8332ca3c309eca9184f6cbe560c91
--- /dev/null
+++ b/drivers/net/wireless/ath/ath12k/wmi_wifi7.c
@@ -0,0 +1,105 @@
+// 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.
+ */
+
+#include "core.h"
+#include "wmi_wifi7.h"
+
+void ath12k_wmi_init_qcn9274(struct ath12k_base *ab,
+			     struct ath12k_wmi_resource_config_arg *config)
+{
+	config->num_vdevs = ab->num_radios * TARGET_NUM_VDEVS(ab);
+	config->num_peers = ab->num_radios *
+		ath12k_core_get_max_peers_per_radio(ab);
+	config->num_offload_peers = TARGET_NUM_OFFLD_PEERS;
+	config->num_offload_reorder_buffs = TARGET_NUM_OFFLD_REORDER_BUFFS;
+	config->num_peer_keys = TARGET_NUM_PEER_KEYS;
+	config->ast_skid_limit = TARGET_AST_SKID_LIMIT;
+	config->tx_chain_mask = (1 << ab->target_caps.num_rf_chains) - 1;
+	config->rx_chain_mask = (1 << ab->target_caps.num_rf_chains) - 1;
+	config->rx_timeout_pri[0] = TARGET_RX_TIMEOUT_LO_PRI;
+	config->rx_timeout_pri[1] = TARGET_RX_TIMEOUT_LO_PRI;
+	config->rx_timeout_pri[2] = TARGET_RX_TIMEOUT_LO_PRI;
+	config->rx_timeout_pri[3] = TARGET_RX_TIMEOUT_HI_PRI;
+
+	if (test_bit(ATH12K_FLAG_RAW_MODE, &ab->dev_flags))
+		config->rx_decap_mode = TARGET_DECAP_MODE_RAW;
+	else
+		config->rx_decap_mode = TARGET_DECAP_MODE_NATIVE_WIFI;
+
+	config->scan_max_pending_req = TARGET_SCAN_MAX_PENDING_REQS;
+	config->bmiss_offload_max_vdev = TARGET_BMISS_OFFLOAD_MAX_VDEV;
+	config->roam_offload_max_vdev = TARGET_ROAM_OFFLOAD_MAX_VDEV;
+	config->roam_offload_max_ap_profiles = TARGET_ROAM_OFFLOAD_MAX_AP_PROFILES;
+	config->num_mcast_groups = TARGET_NUM_MCAST_GROUPS;
+	config->num_mcast_table_elems = TARGET_NUM_MCAST_TABLE_ELEMS;
+	config->mcast2ucast_mode = TARGET_MCAST2UCAST_MODE;
+	config->tx_dbg_log_size = TARGET_TX_DBG_LOG_SIZE;
+	config->num_wds_entries = TARGET_NUM_WDS_ENTRIES;
+	config->dma_burst_size = TARGET_DMA_BURST_SIZE;
+	config->rx_skip_defrag_timeout_dup_detection_check =
+		TARGET_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK;
+	config->vow_config = TARGET_VOW_CONFIG;
+	config->gtk_offload_max_vdev = TARGET_GTK_OFFLOAD_MAX_VDEV;
+	config->num_msdu_desc = TARGET_NUM_MSDU_DESC;
+	config->beacon_tx_offload_max_vdev = ab->num_radios * TARGET_MAX_BCN_OFFLD;
+	config->rx_batchmode = TARGET_RX_BATCHMODE;
+	/* Indicates host supports peer map v3 and unmap v2 support */
+	config->peer_map_unmap_version = 0x32;
+	config->twt_ap_pdev_count = ab->num_radios;
+	config->twt_ap_sta_count = 1000;
+	config->ema_max_vap_cnt = ab->num_radios;
+	config->ema_max_profile_period = TARGET_EMA_MAX_PROFILE_PERIOD;
+	config->beacon_tx_offload_max_vdev += config->ema_max_vap_cnt;
+
+	if (test_bit(WMI_TLV_SERVICE_PEER_METADATA_V1A_V1B_SUPPORT, ab->wmi_ab.svc_map))
+		config->peer_metadata_ver = ATH12K_PEER_METADATA_V1B;
+}
+
+void ath12k_wmi_init_wcn7850(struct ath12k_base *ab,
+			     struct ath12k_wmi_resource_config_arg *config)
+{
+	config->num_vdevs = 4;
+	config->num_peers = 16;
+	config->num_tids = 32;
+
+	config->num_offload_peers = 3;
+	config->num_offload_reorder_buffs = 3;
+	config->num_peer_keys = TARGET_NUM_PEER_KEYS;
+	config->ast_skid_limit = TARGET_AST_SKID_LIMIT;
+	config->tx_chain_mask = (1 << ab->target_caps.num_rf_chains) - 1;
+	config->rx_chain_mask = (1 << ab->target_caps.num_rf_chains) - 1;
+	config->rx_timeout_pri[0] = TARGET_RX_TIMEOUT_LO_PRI;
+	config->rx_timeout_pri[1] = TARGET_RX_TIMEOUT_LO_PRI;
+	config->rx_timeout_pri[2] = TARGET_RX_TIMEOUT_LO_PRI;
+	config->rx_timeout_pri[3] = TARGET_RX_TIMEOUT_HI_PRI;
+	config->rx_decap_mode = TARGET_DECAP_MODE_NATIVE_WIFI;
+	config->scan_max_pending_req = TARGET_SCAN_MAX_PENDING_REQS;
+	config->bmiss_offload_max_vdev = TARGET_BMISS_OFFLOAD_MAX_VDEV;
+	config->roam_offload_max_vdev = TARGET_ROAM_OFFLOAD_MAX_VDEV;
+	config->roam_offload_max_ap_profiles = TARGET_ROAM_OFFLOAD_MAX_AP_PROFILES;
+	config->num_mcast_groups = 0;
+	config->num_mcast_table_elems = 0;
+	config->mcast2ucast_mode = 0;
+	config->tx_dbg_log_size = TARGET_TX_DBG_LOG_SIZE;
+	config->num_wds_entries = 0;
+	config->dma_burst_size = 0;
+	config->rx_skip_defrag_timeout_dup_detection_check = 0;
+	config->vow_config = TARGET_VOW_CONFIG;
+	config->gtk_offload_max_vdev = 2;
+	config->num_msdu_desc = 0x400;
+	config->beacon_tx_offload_max_vdev = 2;
+	config->rx_batchmode = TARGET_RX_BATCHMODE;
+
+	config->peer_map_unmap_version = 0x1;
+	config->use_pdev_id = 1;
+	config->max_frag_entries = 0xa;
+	config->num_tdls_vdevs = 0x1;
+	config->num_tdls_conn_table_entries = 8;
+	config->beacon_tx_offload_max_vdev = 0x2;
+	config->num_multicast_filter_entries = 0x20;
+	config->num_wow_filters = 0x16;
+	config->num_keep_alive_pattern = 0;
+}
diff --git a/drivers/net/wireless/ath/ath12k/wmi_wifi7.h b/drivers/net/wireless/ath/ath12k/wmi_wifi7.h
new file mode 100644
index 0000000000000000000000000000000000000000..1514e3e8d4cb65d3d95d95a1c1593a7b66abcf58
--- /dev/null
+++ b/drivers/net/wireless/ath/ath12k/wmi_wifi7.h
@@ -0,0 +1,15 @@
+/* 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_WMI_WIFI7_H
+#define ATH12K_WMI_WIFI7_H
+
+void ath12k_wmi_init_qcn9274(struct ath12k_base *ab,
+			     struct ath12k_wmi_resource_config_arg *config);
+void ath12k_wmi_init_wcn7850(struct ath12k_base *ab,
+			     struct ath12k_wmi_resource_config_arg *config);
+
+#endif

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH ath12k-ng 04/13] wifi: ath12k: Move Wi-Fi 7 MHI configuration to dedicated file
  2025-08-12 17:09 [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Kiran Venkatappa
                   ` (2 preceding siblings ...)
  2025-08-12 17:09 ` [PATCH ath12k-ng 03/13] wifi: ath12k: Move Wi-Fi 7 WMI configuration to dedicated file Kiran Venkatappa
@ 2025-08-12 17:09 ` Kiran Venkatappa
  2025-08-13  5:52   ` Krzysztof Kozlowski
  2025-08-12 17:09 ` [PATCH ath12k-ng 05/13] wifi: ath12k: Rename hw.c to Wi-Fi 7 specific implementation file Kiran Venkatappa
                   ` (11 subsequent siblings)
  15 siblings, 1 reply; 25+ messages in thread
From: Kiran Venkatappa @ 2025-08-12 17:09 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless

Relocate target-specific MHI configuration to a new mhi_wifi7.c file to
isolate Wi-Fi 7 related logic from the common codebase.
Improve modularity by separating hardware-dependent code from shared
components.
Enhance maintainability and prepare the driver for clean integration of
additional device families.

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

Signed-off-by: Kiran Venkatappa <quic_kiranv@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/Makefile    |   1 +
 drivers/net/wireless/ath/ath12k/hw.c        |   1 +
 drivers/net/wireless/ath/ath12k/mhi.c       | 130 --------------------------
 drivers/net/wireless/ath/ath12k/mhi.h       |   4 +-
 drivers/net/wireless/ath/ath12k/mhi_wifi7.c | 138 ++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath12k/mhi_wifi7.h |  11 +++
 6 files changed, 152 insertions(+), 133 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/Makefile b/drivers/net/wireless/ath/ath12k/Makefile
index ee075ee68bb834e3f3605b13a5fee6afff0ba763..fb968884f6560ed8dfeabba0e0a1562a98576313 100644
--- a/drivers/net/wireless/ath/ath12k/Makefile
+++ b/drivers/net/wireless/ath/ath12k/Makefile
@@ -20,6 +20,7 @@ ath12k-y += core.o \
 	    dbring.o \
 	    hw.o \
 	    mhi.o \
+	    mhi_wifi7.o \
 	    pci.o \
 	    pci_wifi7.o \
 	    dp_mon.o \
diff --git a/drivers/net/wireless/ath/ath12k/hw.c b/drivers/net/wireless/ath/ath12k/hw.c
index df1b4439adc798dc0dfb7d8604874a4fcb77663b..ad372feaef28be9149f86008453409dad5c5d4f7 100644
--- a/drivers/net/wireless/ath/ath12k/hw.c
+++ b/drivers/net/wireless/ath/ath12k/hw.c
@@ -17,6 +17,7 @@
 #include "dp_rx.h"
 #include "peer.h"
 #include "wmi_wifi7.h"
+#include "mhi_wifi7.h"
 
 static const guid_t wcn7850_uuid = GUID_INIT(0xf634f534, 0x6147, 0x11ec,
 					     0x90, 0xd6, 0x02, 0x42,
diff --git a/drivers/net/wireless/ath/ath12k/mhi.c b/drivers/net/wireless/ath/ath12k/mhi.c
index 08f44baf182a5e34651e8c117fe279942f8ad8f4..1f680f6e65d30ac5fd98ad59df90eb9e629746dd 100644
--- a/drivers/net/wireless/ath/ath12k/mhi.c
+++ b/drivers/net/wireless/ath/ath12k/mhi.c
@@ -18,136 +18,6 @@
 #define OTP_VALID_DUALMAC_BOARD_ID_MASK		0x1000
 #define MHI_CB_INVALID	0xff
 
-static const struct mhi_channel_config ath12k_mhi_channels_qcn9274[] = {
-	{
-		.num = 20,
-		.name = "IPCR",
-		.num_elements = 32,
-		.event_ring = 1,
-		.dir = DMA_TO_DEVICE,
-		.ee_mask = 0x4,
-		.pollcfg = 0,
-		.doorbell = MHI_DB_BRST_DISABLE,
-		.lpm_notify = false,
-		.offload_channel = false,
-		.doorbell_mode_switch = false,
-		.auto_queue = false,
-	},
-	{
-		.num = 21,
-		.name = "IPCR",
-		.num_elements = 32,
-		.event_ring = 1,
-		.dir = DMA_FROM_DEVICE,
-		.ee_mask = 0x4,
-		.pollcfg = 0,
-		.doorbell = MHI_DB_BRST_DISABLE,
-		.lpm_notify = false,
-		.offload_channel = false,
-		.doorbell_mode_switch = false,
-		.auto_queue = true,
-	},
-};
-
-static struct mhi_event_config ath12k_mhi_events_qcn9274[] = {
-	{
-		.num_elements = 32,
-		.irq_moderation_ms = 0,
-		.irq = 1,
-		.data_type = MHI_ER_CTRL,
-		.mode = MHI_DB_BRST_DISABLE,
-		.hardware_event = false,
-		.client_managed = false,
-		.offload_channel = false,
-	},
-	{
-		.num_elements = 256,
-		.irq_moderation_ms = 1,
-		.irq = 2,
-		.mode = MHI_DB_BRST_DISABLE,
-		.priority = 1,
-		.hardware_event = false,
-		.client_managed = false,
-		.offload_channel = false,
-	},
-};
-
-const struct mhi_controller_config ath12k_mhi_config_qcn9274 = {
-	.max_channels = 30,
-	.timeout_ms = 10000,
-	.use_bounce_buf = false,
-	.buf_len = 0,
-	.num_channels = ARRAY_SIZE(ath12k_mhi_channels_qcn9274),
-	.ch_cfg = ath12k_mhi_channels_qcn9274,
-	.num_events = ARRAY_SIZE(ath12k_mhi_events_qcn9274),
-	.event_cfg = ath12k_mhi_events_qcn9274,
-};
-
-static const struct mhi_channel_config ath12k_mhi_channels_wcn7850[] = {
-	{
-		.num = 20,
-		.name = "IPCR",
-		.num_elements = 64,
-		.event_ring = 1,
-		.dir = DMA_TO_DEVICE,
-		.ee_mask = 0x4,
-		.pollcfg = 0,
-		.doorbell = MHI_DB_BRST_DISABLE,
-		.lpm_notify = false,
-		.offload_channel = false,
-		.doorbell_mode_switch = false,
-		.auto_queue = false,
-	},
-	{
-		.num = 21,
-		.name = "IPCR",
-		.num_elements = 64,
-		.event_ring = 1,
-		.dir = DMA_FROM_DEVICE,
-		.ee_mask = 0x4,
-		.pollcfg = 0,
-		.doorbell = MHI_DB_BRST_DISABLE,
-		.lpm_notify = false,
-		.offload_channel = false,
-		.doorbell_mode_switch = false,
-		.auto_queue = true,
-	},
-};
-
-static struct mhi_event_config ath12k_mhi_events_wcn7850[] = {
-	{
-		.num_elements = 32,
-		.irq_moderation_ms = 0,
-		.irq = 1,
-		.mode = MHI_DB_BRST_DISABLE,
-		.data_type = MHI_ER_CTRL,
-		.hardware_event = false,
-		.client_managed = false,
-		.offload_channel = false,
-	},
-	{
-		.num_elements = 256,
-		.irq_moderation_ms = 1,
-		.irq = 2,
-		.mode = MHI_DB_BRST_DISABLE,
-		.priority = 1,
-		.hardware_event = false,
-		.client_managed = false,
-		.offload_channel = false,
-	},
-};
-
-const struct mhi_controller_config ath12k_mhi_config_wcn7850 = {
-	.max_channels = 128,
-	.timeout_ms = 2000,
-	.use_bounce_buf = false,
-	.buf_len = 8192,
-	.num_channels = ARRAY_SIZE(ath12k_mhi_channels_wcn7850),
-	.ch_cfg = ath12k_mhi_channels_wcn7850,
-	.num_events = ARRAY_SIZE(ath12k_mhi_events_wcn7850),
-	.event_cfg = ath12k_mhi_events_wcn7850,
-};
-
 void ath12k_mhi_set_mhictrl_reset(struct ath12k_base *ab)
 {
 	u32 val;
diff --git a/drivers/net/wireless/ath/ath12k/mhi.h b/drivers/net/wireless/ath/ath12k/mhi.h
index 7358b8477536a636743f4fd16d37500a8d458ab1..5e1363650a9a75ff4770e0cb64b6986ca2c5e8a7 100644
--- a/drivers/net/wireless/ath/ath12k/mhi.h
+++ b/drivers/net/wireless/ath/ath12k/mhi.h
@@ -2,6 +2,7 @@
 /*
  * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved.
  * Copyright (c) 2021-2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
  */
 #ifndef _ATH12K_MHI_H
 #define _ATH12K_MHI_H
@@ -31,9 +32,6 @@ enum ath12k_mhi_state {
 	ATH12K_MHI_RDDM_DONE,
 };
 
-extern const struct mhi_controller_config ath12k_mhi_config_qcn9274;
-extern const struct mhi_controller_config ath12k_mhi_config_wcn7850;
-
 int ath12k_mhi_start(struct ath12k_pci *ar_pci);
 void ath12k_mhi_stop(struct ath12k_pci *ar_pci, bool is_suspend);
 int ath12k_mhi_register(struct ath12k_pci *ar_pci);
diff --git a/drivers/net/wireless/ath/ath12k/mhi_wifi7.c b/drivers/net/wireless/ath/ath12k/mhi_wifi7.c
new file mode 100644
index 0000000000000000000000000000000000000000..be74df152f6f88c1c723459a1cdea21f45b0d15b
--- /dev/null
+++ b/drivers/net/wireless/ath/ath12k/mhi_wifi7.c
@@ -0,0 +1,138 @@
+// SPDX-License-Identifier: BSD-3-Clause-Clear
+/*
+ * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#include "mhi.h"
+#include "mhi_wifi7.h"
+
+static const struct mhi_channel_config ath12k_mhi_channels_qcn9274[] = {
+	{
+		.num = 20,
+		.name = "IPCR",
+		.num_elements = 32,
+		.event_ring = 1,
+		.dir = DMA_TO_DEVICE,
+		.ee_mask = 0x4,
+		.pollcfg = 0,
+		.doorbell = MHI_DB_BRST_DISABLE,
+		.lpm_notify = false,
+		.offload_channel = false,
+		.doorbell_mode_switch = false,
+		.auto_queue = false,
+	},
+	{
+		.num = 21,
+		.name = "IPCR",
+		.num_elements = 32,
+		.event_ring = 1,
+		.dir = DMA_FROM_DEVICE,
+		.ee_mask = 0x4,
+		.pollcfg = 0,
+		.doorbell = MHI_DB_BRST_DISABLE,
+		.lpm_notify = false,
+		.offload_channel = false,
+		.doorbell_mode_switch = false,
+		.auto_queue = true,
+	},
+};
+
+static struct mhi_event_config ath12k_mhi_events_qcn9274[] = {
+	{
+		.num_elements = 32,
+		.irq_moderation_ms = 0,
+		.irq = 1,
+		.data_type = MHI_ER_CTRL,
+		.mode = MHI_DB_BRST_DISABLE,
+		.hardware_event = false,
+		.client_managed = false,
+		.offload_channel = false,
+	},
+	{
+		.num_elements = 256,
+		.irq_moderation_ms = 1,
+		.irq = 2,
+		.mode = MHI_DB_BRST_DISABLE,
+		.priority = 1,
+		.hardware_event = false,
+		.client_managed = false,
+		.offload_channel = false,
+	},
+};
+
+const struct mhi_controller_config ath12k_mhi_config_qcn9274 = {
+	.max_channels = 30,
+	.timeout_ms = 10000,
+	.use_bounce_buf = false,
+	.buf_len = 0,
+	.num_channels = ARRAY_SIZE(ath12k_mhi_channels_qcn9274),
+	.ch_cfg = ath12k_mhi_channels_qcn9274,
+	.num_events = ARRAY_SIZE(ath12k_mhi_events_qcn9274),
+	.event_cfg = ath12k_mhi_events_qcn9274,
+};
+
+static const struct mhi_channel_config ath12k_mhi_channels_wcn7850[] = {
+	{
+		.num = 20,
+		.name = "IPCR",
+		.num_elements = 64,
+		.event_ring = 1,
+		.dir = DMA_TO_DEVICE,
+		.ee_mask = 0x4,
+		.pollcfg = 0,
+		.doorbell = MHI_DB_BRST_DISABLE,
+		.lpm_notify = false,
+		.offload_channel = false,
+		.doorbell_mode_switch = false,
+		.auto_queue = false,
+	},
+	{
+		.num = 21,
+		.name = "IPCR",
+		.num_elements = 64,
+		.event_ring = 1,
+		.dir = DMA_FROM_DEVICE,
+		.ee_mask = 0x4,
+		.pollcfg = 0,
+		.doorbell = MHI_DB_BRST_DISABLE,
+		.lpm_notify = false,
+		.offload_channel = false,
+		.doorbell_mode_switch = false,
+		.auto_queue = true,
+	},
+};
+
+static struct mhi_event_config ath12k_mhi_events_wcn7850[] = {
+	{
+		.num_elements = 32,
+		.irq_moderation_ms = 0,
+		.irq = 1,
+		.mode = MHI_DB_BRST_DISABLE,
+		.data_type = MHI_ER_CTRL,
+		.hardware_event = false,
+		.client_managed = false,
+		.offload_channel = false,
+	},
+	{
+		.num_elements = 256,
+		.irq_moderation_ms = 1,
+		.irq = 2,
+		.mode = MHI_DB_BRST_DISABLE,
+		.priority = 1,
+		.hardware_event = false,
+		.client_managed = false,
+		.offload_channel = false,
+	},
+};
+
+const struct mhi_controller_config ath12k_mhi_config_wcn7850 = {
+	.max_channels = 128,
+	.timeout_ms = 2000,
+	.use_bounce_buf = false,
+	.buf_len = 8192,
+	.num_channels = ARRAY_SIZE(ath12k_mhi_channels_wcn7850),
+	.ch_cfg = ath12k_mhi_channels_wcn7850,
+	.num_events = ARRAY_SIZE(ath12k_mhi_events_wcn7850),
+	.event_cfg = ath12k_mhi_events_wcn7850,
+};
diff --git a/drivers/net/wireless/ath/ath12k/mhi_wifi7.h b/drivers/net/wireless/ath/ath12k/mhi_wifi7.h
new file mode 100644
index 0000000000000000000000000000000000000000..8417a2bde0877d9a377c8dd4befc24a042f3b629
--- /dev/null
+++ b/drivers/net/wireless/ath/ath12k/mhi_wifi7.h
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: BSD-3-Clause-Clear */
+/*
+ * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#ifndef _ATH12K_WIFI7_MHI_H
+#define _ATH12K_WIFI7_MHI_H
+extern const struct mhi_controller_config ath12k_mhi_config_qcn9274;
+extern const struct mhi_controller_config ath12k_mhi_config_wcn7850;
+#endif /* _ATH12K_WIFI7_MHI_H */

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH ath12k-ng 05/13] wifi: ath12k: Rename hw.c to Wi-Fi 7 specific implementation file
  2025-08-12 17:09 [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Kiran Venkatappa
                   ` (3 preceding siblings ...)
  2025-08-12 17:09 ` [PATCH ath12k-ng 04/13] wifi: ath12k: Move Wi-Fi 7 MHI " Kiran Venkatappa
@ 2025-08-12 17:09 ` Kiran Venkatappa
  2025-08-12 17:09 ` [PATCH ath12k-ng 06/13] wifi: ath12k: Rename ahb_hif_ops to reflect generic usage Kiran Venkatappa
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Kiran Venkatappa @ 2025-08-12 17:09 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless

Rename hw.c to hw_wifi7.c to reflect its focus on Wi-Fi 7 chipset
specific configurations. Clarify the files role in containing
hardware dependent logic tailored to the Wi-Fi 7 family.

This change is part of a broader effort to modularize the codebase
by separating common and target specific components into distinct
modules for improved clarity and maintainability.

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

Signed-off-by: Kiran Venkatappa <quic_kiranv@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/Makefile             | 2 +-
 drivers/net/wireless/ath/ath12k/{hw.c => hw_wifi7.c} | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/Makefile b/drivers/net/wireless/ath/ath12k/Makefile
index fb968884f6560ed8dfeabba0e0a1562a98576313..f1105d7adafff957b8a6ee3231e03a7f6ea47ed2 100644
--- a/drivers/net/wireless/ath/ath12k/Makefile
+++ b/drivers/net/wireless/ath/ath12k/Makefile
@@ -18,7 +18,7 @@ ath12k-y += core.o \
 	    ce_wifi7.o \
 	    peer.o \
 	    dbring.o \
-	    hw.o \
+	    hw_wifi7.o \
 	    mhi.o \
 	    mhi_wifi7.o \
 	    pci.o \
diff --git a/drivers/net/wireless/ath/ath12k/hw.c b/drivers/net/wireless/ath/ath12k/hw_wifi7.c
similarity index 99%
rename from drivers/net/wireless/ath/ath12k/hw.c
rename to drivers/net/wireless/ath/ath12k/hw_wifi7.c
index ad372feaef28be9149f86008453409dad5c5d4f7..f6177f8e032d98774b4a041ecfe97187b55ed259 100644
--- a/drivers/net/wireless/ath/ath12k/hw.c
+++ b/drivers/net/wireless/ath/ath12k/hw_wifi7.c
@@ -1043,13 +1043,14 @@ int ath12k_hw_init(struct ath12k_base *ab)
 	}
 
 	if (i == ARRAY_SIZE(ath12k_hw_params)) {
-		ath12k_err(ab, "Unsupported hardware version: 0x%x\n", ab->hw_rev);
+		ath12k_err(ab, "Unsupported Wi-Fi 7 hardware version: 0x%x\n",
+			   ab->hw_rev);
 		return -EINVAL;
 	}
 
 	ab->hw_params = hw_params;
 
-	ath12k_info(ab, "Hardware name: %s\n", ab->hw_params->name);
+	ath12k_info(ab, "Wi-Fi 7 Hardware name: %s\n", ab->hw_params->name);
 
 	return 0;
 }

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH ath12k-ng 06/13] wifi: ath12k: Rename ahb_hif_ops to reflect generic usage
  2025-08-12 17:09 [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Kiran Venkatappa
                   ` (4 preceding siblings ...)
  2025-08-12 17:09 ` [PATCH ath12k-ng 05/13] wifi: ath12k: Rename hw.c to Wi-Fi 7 specific implementation file Kiran Venkatappa
@ 2025-08-12 17:09 ` Kiran Venkatappa
  2025-08-12 17:09 ` [PATCH ath12k-ng 07/13] wifi: ath12k: Restructure ahb.c into common and Wi-Fi 7 specific modules Kiran Venkatappa
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Kiran Venkatappa @ 2025-08-12 17:09 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless

Rename ahb_hif_ops structure to remove the IPQ5322 qualifier and reflect
its generic applicability across multiple targets. Clarify its role as a
container for common HIF callbacks.

This renaming is part of a broader effort to modularize the codebase
by separating common logic from device-specific implementations.

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

Signed-off-by: Kiran Venkatappa <quic_kiranv@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/ahb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/ahb.c b/drivers/net/wireless/ath/ath12k/ahb.c
index 3b983f4e3268c6fbf1546bda6677d2bf2d985d86..f512854e82e4f32328dc49eac2472027c7369dfd 100644
--- a/drivers/net/wireless/ath/ath12k/ahb.c
+++ b/drivers/net/wireless/ath/ath12k/ahb.c
@@ -698,7 +698,7 @@ static int ath12k_ahb_map_service_to_pipe(struct ath12k_base *ab, u16 service_id
 	return 0;
 }
 
-static const struct ath12k_hif_ops ath12k_ahb_hif_ops_ipq5332 = {
+static const struct ath12k_hif_ops ath12k_ahb_hif_ops = {
 	.start = ath12k_ahb_start,
 	.stop = ath12k_ahb_stop,
 	.read32 = ath12k_ahb_read32,
@@ -1011,7 +1011,7 @@ static int ath12k_ahb_probe(struct platform_device *pdev)
 	hw_rev = (enum ath12k_hw_rev)(kernel_ulong_t)of_device_get_match_data(&pdev->dev);
 	switch (hw_rev) {
 	case ATH12K_HW_IPQ5332_HW10:
-		hif_ops = &ath12k_ahb_hif_ops_ipq5332;
+		hif_ops = &ath12k_ahb_hif_ops;
 		userpd_id = ATH12K_IPQ5332_USERPD_ID;
 		break;
 	default:

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH ath12k-ng 07/13] wifi: ath12k: Restructure ahb.c into common and Wi-Fi 7 specific modules
  2025-08-12 17:09 [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Kiran Venkatappa
                   ` (5 preceding siblings ...)
  2025-08-12 17:09 ` [PATCH ath12k-ng 06/13] wifi: ath12k: Rename ahb_hif_ops to reflect generic usage Kiran Venkatappa
@ 2025-08-12 17:09 ` Kiran Venkatappa
  2025-08-12 17:09 ` [PATCH ath12k-ng 08/13] wifi: ath12k: Move Wi-Fi 7 specific init routines to dedicated file Kiran Venkatappa
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Kiran Venkatappa @ 2025-08-12 17:09 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless

Split ahb.c into a common module (ahb.c) and a Wi-Fi 7 specific module
(ahb_wifi7.c). Retain shared logic-such as probe and initialization
sequences-in ahb.c to support reuse across hardware families.
Move Wi-Fi 7 specific initialization and configuration routines to
ahb_wifi7.c and register them via callbacks.
This modular approach improves code organization and prepares the
driver for scalable support of additional hardware families.

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>
---
 drivers/net/wireless/ath/ath12k/Makefile    |   2 +-
 drivers/net/wireless/ath/ath12k/ahb.c       | 128 +++++++++++++++++++---------
 drivers/net/wireless/ath/ath12k/ahb.h       |  27 +++---
 drivers/net/wireless/ath/ath12k/ahb_wifi7.c |  63 ++++++++++++++
 drivers/net/wireless/ath/ath12k/ahb_wifi7.h |  20 +++++
 drivers/net/wireless/ath/ath12k/core.c      |   5 +-
 6 files changed, 190 insertions(+), 55 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/Makefile b/drivers/net/wireless/ath/ath12k/Makefile
index f1105d7adafff957b8a6ee3231e03a7f6ea47ed2..5c044e39633057651f80c3039f1340e791e419b4 100644
--- a/drivers/net/wireless/ath/ath12k/Makefile
+++ b/drivers/net/wireless/ath/ath12k/Makefile
@@ -27,7 +27,7 @@ ath12k-y += core.o \
 	    fw.o \
 	    p2p.o
 
-ath12k-$(CONFIG_ATH12K_AHB) += ahb.o
+ath12k-$(CONFIG_ATH12K_AHB) += ahb.o ahb_wifi7.o
 ath12k-$(CONFIG_ATH12K_DEBUGFS) += debugfs.o debugfs_htt_stats.o debugfs_sta.o
 ath12k-$(CONFIG_ACPI) += acpi.o
 ath12k-$(CONFIG_ATH12K_TRACING) += trace.o
diff --git a/drivers/net/wireless/ath/ath12k/ahb.c b/drivers/net/wireless/ath/ath12k/ahb.c
index f512854e82e4f32328dc49eac2472027c7369dfd..fc986e669bdea85cdf3dcc3d60c1f2cc9216d3e0 100644
--- a/drivers/net/wireless/ath/ath12k/ahb.c
+++ b/drivers/net/wireless/ath/ath12k/ahb.c
@@ -16,18 +16,11 @@
 #include "debug.h"
 #include "hif.h"
 
-static const struct of_device_id ath12k_ahb_of_match[] = {
-	{ .compatible = "qcom,ipq5332-wifi",
-	  .data = (void *)ATH12K_HW_IPQ5332_HW10,
-	},
-	{ }
-};
-
-MODULE_DEVICE_TABLE(of, ath12k_ahb_of_match);
-
 #define ATH12K_IRQ_CE0_OFFSET 4
 #define ATH12K_MAX_UPDS 1
 #define ATH12K_UPD_IRQ_WRD_LEN  18
+
+static struct ath12k_ahb_driver *ath12k_ahb_family_drivers[ATH12K_DEVICE_FAMILY_MAX];
 static const char ath12k_userpd_irq[][9] = {"spawn",
 				     "ready",
 				     "stop-ack"};
@@ -988,13 +981,34 @@ static void ath12k_ahb_resource_deinit(struct ath12k_base *ab)
 	ab_ahb->xo_clk = NULL;
 }
 
+static enum ath12k_device_family
+ath12k_ahb_get_device_family(const struct platform_device *pdev)
+{
+	enum ath12k_device_family device_family_id;
+	struct ath12k_ahb_driver *driver;
+	const struct of_device_id *of_id;
+
+	for (device_family_id = ATH12K_DEVICE_FAMILY_START;
+	     device_family_id < ATH12K_DEVICE_FAMILY_MAX; device_family_id++) {
+		driver = ath12k_ahb_family_drivers[device_family_id];
+		if (driver) {
+			of_id = of_match_device(driver->id_table, &pdev->dev);
+			if (of_id) {
+				/* Found the driver */
+				return device_family_id;
+			}
+		}
+	}
+
+	return ATH12K_DEVICE_FAMILY_MAX;
+}
+
 static int ath12k_ahb_probe(struct platform_device *pdev)
 {
-	struct ath12k_base *ab;
-	const struct ath12k_hif_ops *hif_ops;
+	enum ath12k_device_family device_id;
 	struct ath12k_ahb *ab_ahb;
-	enum ath12k_hw_rev hw_rev;
-	u32 addr, userpd_id;
+	struct ath12k_base *ab;
+	u32 addr;
 	int ret;
 
 	ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
@@ -1008,25 +1022,32 @@ static int ath12k_ahb_probe(struct platform_device *pdev)
 	if (!ab)
 		return -ENOMEM;
 
-	hw_rev = (enum ath12k_hw_rev)(kernel_ulong_t)of_device_get_match_data(&pdev->dev);
-	switch (hw_rev) {
-	case ATH12K_HW_IPQ5332_HW10:
-		hif_ops = &ath12k_ahb_hif_ops;
-		userpd_id = ATH12K_IPQ5332_USERPD_ID;
-		break;
-	default:
-		ret = -EOPNOTSUPP;
+	ab_ahb = ath12k_ab_to_ahb(ab);
+	ab_ahb->ab = ab;
+	ab->hif.ops = &ath12k_ahb_hif_ops;
+	ab->pdev = pdev;
+	platform_set_drvdata(pdev, ab);
+
+	device_id = ath12k_ahb_get_device_family(pdev);
+	if (device_id >= ATH12K_DEVICE_FAMILY_MAX) {
+		ath12k_err(ab, "failed to get device family: %d\n", device_id);
+		ret = -EINVAL;
 		goto err_core_free;
 	}
 
-	ab->hif.ops = hif_ops;
-	ab->pdev = pdev;
-	ab->hw_rev = hw_rev;
-	ab->target_mem_mode = ATH12K_QMI_MEMORY_MODE_DEFAULT;
-	platform_set_drvdata(pdev, ab);
-	ab_ahb = ath12k_ab_to_ahb(ab);
-	ab_ahb->ab = ab;
-	ab_ahb->userpd_id = userpd_id;
+	ath12k_dbg(ab, ATH12K_DBG_AHB, "AHB device family id: %d\n", device_id);
+
+	ab_ahb->device_family_ops = &ath12k_ahb_family_drivers[device_id]->ops;
+
+	/* Call device specific probe. This is the callback that can
+	 * be used to override any ops in future
+	 * probe is validated for NULL during registration.
+	 */
+	ret = ab_ahb->device_family_ops->probe(pdev);
+	if (ret) {
+		ath12k_err(ab, "failed to probe device: %d\n", ret);
+		goto err_core_free;
+	}
 
 	/* Set fixed_mem_region to true for platforms that support fixed memory
 	 * reservation from DT. If memory is reserved from DT for FW, ath12k driver
@@ -1136,21 +1157,44 @@ static void ath12k_ahb_remove(struct platform_device *pdev)
 	ath12k_ahb_free_resources(ab);
 }
 
-static struct platform_driver ath12k_ahb_driver = {
-	.driver         = {
-		.name   = "ath12k_ahb",
-		.of_match_table = ath12k_ahb_of_match,
-	},
-	.probe  = ath12k_ahb_probe,
-	.remove = ath12k_ahb_remove,
-};
-
-int ath12k_ahb_init(void)
+int ath12k_ahb_register_driver(const enum ath12k_device_family device_id,
+			       struct ath12k_ahb_driver *driver)
 {
-	return platform_driver_register(&ath12k_ahb_driver);
+	struct platform_driver *ahb_driver;
+
+	if (device_id >= ATH12K_DEVICE_FAMILY_MAX)
+		return -EINVAL;
+
+	if (!driver || !driver->ops.probe)
+		return -EINVAL;
+
+	if (ath12k_ahb_family_drivers[device_id]) {
+		pr_err("Driver already registered for id %d\n", device_id);
+		return -EALREADY;
+	}
+
+	ath12k_ahb_family_drivers[device_id] = driver;
+
+	ahb_driver = &ath12k_ahb_family_drivers[device_id]->driver;
+	ahb_driver->driver.name = driver->name;
+	ahb_driver->driver.of_match_table = driver->id_table;
+	ahb_driver->probe  = ath12k_ahb_probe;
+	ahb_driver->remove = ath12k_ahb_remove;
+
+	return platform_driver_register(ahb_driver);
 }
 
-void ath12k_ahb_exit(void)
+void ath12k_ahb_unregister_driver(const enum ath12k_device_family device_id)
 {
-	platform_driver_unregister(&ath12k_ahb_driver);
+	struct platform_driver *ahb_driver;
+
+	if (device_id >= ATH12K_DEVICE_FAMILY_MAX)
+		return;
+
+	if (!ath12k_ahb_family_drivers[device_id])
+		return;
+
+	ahb_driver = &ath12k_ahb_family_drivers[device_id]->driver;
+	platform_driver_unregister(ahb_driver);
+	ath12k_ahb_family_drivers[device_id] = NULL;
 }
diff --git a/drivers/net/wireless/ath/ath12k/ahb.h b/drivers/net/wireless/ath/ath12k/ahb.h
index d56244b20a6a667cf3730dc1ce38a22b0e86ffca..fce02e3af5fb406a732eb52d6854a551f6d80012 100644
--- a/drivers/net/wireless/ath/ath12k/ahb.h
+++ b/drivers/net/wireless/ath/ath12k/ahb.h
@@ -8,6 +8,7 @@
 
 #include <linux/clk.h>
 #include <linux/remoteproc/qcom_rproc.h>
+#include <linux/platform_device.h>
 #include "core.h"
 
 #define ATH12K_AHB_RECOVERY_TIMEOUT (3 * HZ)
@@ -43,6 +44,10 @@ enum ath12k_ahb_userpd_irq {
 
 struct ath12k_base;
 
+struct ath12k_ahb_device_family_ops {
+	int (*probe)(struct platform_device *pdev);
+};
+
 struct ath12k_ahb {
 	struct ath12k_base *ab;
 	struct rproc *tgt_rproc;
@@ -59,6 +64,15 @@ struct ath12k_ahb {
 	u32 spawn_bit;
 	u32 stop_bit;
 	int userpd_irq_num[ATH12K_USERPD_MAX_IRQ];
+	const struct ath12k_ahb_ops *ahb_ops;
+	const struct ath12k_ahb_device_family_ops *device_family_ops;
+};
+
+struct ath12k_ahb_driver {
+	const char *name;
+	const struct of_device_id *id_table;
+	struct ath12k_ahb_device_family_ops ops;
+	struct platform_driver driver;
 };
 
 static inline struct ath12k_ahb *ath12k_ab_to_ahb(struct ath12k_base *ab)
@@ -66,15 +80,8 @@ static inline struct ath12k_ahb *ath12k_ab_to_ahb(struct ath12k_base *ab)
 	return (struct ath12k_ahb *)ab->drv_priv;
 }
 
-#ifdef CONFIG_ATH12K_AHB
-int ath12k_ahb_init(void);
-void ath12k_ahb_exit(void);
-#else
-static inline int ath12k_ahb_init(void)
-{
-	return 0;
-}
+int ath12k_ahb_register_driver(const enum ath12k_device_family device_id,
+			       struct ath12k_ahb_driver *driver);
+void ath12k_ahb_unregister_driver(const enum ath12k_device_family device_id);
 
-static inline void ath12k_ahb_exit(void) {};
-#endif
 #endif
diff --git a/drivers/net/wireless/ath/ath12k/ahb_wifi7.c b/drivers/net/wireless/ath/ath12k/ahb_wifi7.c
new file mode 100644
index 0000000000000000000000000000000000000000..7a869722b77e639781fed45835872c38a50b8cfc
--- /dev/null
+++ b/drivers/net/wireless/ath/ath12k/ahb_wifi7.c
@@ -0,0 +1,63 @@
+// SPDX-License-Identifier: BSD-3-Clause-Clear
+/*
+ * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/soc/qcom/mdt_loader.h>
+#include "ahb.h"
+#include "ahb_wifi7.h"
+#include "debug.h"
+#include "hif.h"
+
+static const struct of_device_id ath12k_wifi7_ahb_of_match[] = {
+	{ .compatible = "qcom,ipq5332-wifi",
+	  .data = (void *)ATH12K_HW_IPQ5332_HW10,
+	},
+	{ }
+};
+
+MODULE_DEVICE_TABLE(of, ath12k_wifi7_ahb_of_match);
+
+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;
+
+	ab = platform_get_drvdata(pdev);
+	ab_ahb = ath12k_ab_to_ahb(ab);
+
+	hw_rev = (enum ath12k_hw_rev)(kernel_ulong_t)of_device_get_match_data(&pdev->dev);
+	switch (hw_rev) {
+	case ATH12K_HW_IPQ5332_HW10:
+		ab_ahb->userpd_id = ATH12K_IPQ5332_USERPD_ID;
+		break;
+	default:
+		return -EOPNOTSUPP;
+	}
+
+	ab->target_mem_mode = ATH12K_QMI_MEMORY_MODE_DEFAULT;
+	ab->hw_rev = hw_rev;
+
+	return 0;
+}
+
+static struct ath12k_ahb_driver ath12k_wifi7_ahb_driver = {
+	.name = "ath12k_wifi7_ahb",
+	.id_table = ath12k_wifi7_ahb_of_match,
+	.ops.probe = ath12k_wifi7_ahb_probe,
+};
+
+int ath12k_wifi7_ahb_init(void)
+{
+	return ath12k_ahb_register_driver(ATH12K_DEVICE_FAMILY_WIFI7,
+					  &ath12k_wifi7_ahb_driver);
+}
+
+void ath12k_wifi7_ahb_exit(void)
+{
+	ath12k_ahb_unregister_driver(ATH12K_DEVICE_FAMILY_WIFI7);
+}
diff --git a/drivers/net/wireless/ath/ath12k/ahb_wifi7.h b/drivers/net/wireless/ath/ath12k/ahb_wifi7.h
new file mode 100644
index 0000000000000000000000000000000000000000..5974c7cad69aecc8763045a70fc291e9f1c5940d
--- /dev/null
+++ b/drivers/net/wireless/ath/ath12k/ahb_wifi7.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: BSD-3-Clause-Clear */
+/*
+ * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+#ifndef ATH12K_AHB_WIFI7_H
+#define ATH12K_AHB_WIFI7_H
+
+#ifdef CONFIG_ATH12K_AHB
+int ath12k_wifi7_ahb_init(void);
+void ath12k_wifi7_ahb_exit(void);
+#else
+static inline int ath12k_wifi7_ahb_init(void)
+{
+	return 0;
+}
+
+static inline void ath12k_wifi7_ahb_exit(void) {}
+#endif
+#endif /* ATH12K_AHB_WIFI7_H */
diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
index b723d7d28cdac48934d621338d6a623781c86b73..1333422724e4e873c8a36a53cf0faf4eda82c1a4 100644
--- a/drivers/net/wireless/ath/ath12k/core.c
+++ b/drivers/net/wireless/ath/ath12k/core.c
@@ -23,6 +23,7 @@
 #include "pci.h"
 #include "wow.h"
 #include "pci_wifi7.h"
+#include "ahb_wifi7.h"
 
 static int ahb_err, pci_err;
 unsigned int ath12k_debug_mask;
@@ -2284,7 +2285,7 @@ struct ath12k_base *ath12k_core_alloc(struct device *dev, size_t priv_size,
 
 static int ath12k_init(void)
 {
-	ahb_err = ath12k_ahb_init();
+	ahb_err = ath12k_wifi7_ahb_init();
 	if (ahb_err)
 		pr_warn("Failed to initialize ath12k AHB device: %d\n", ahb_err);
 
@@ -2302,7 +2303,7 @@ static void ath12k_exit(void)
 		ath12k_wifi7_pci_exit();
 
 	if (!ahb_err)
-		ath12k_ahb_exit();
+		ath12k_wifi7_ahb_exit();
 }
 
 module_init(ath12k_init);

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH ath12k-ng 08/13] wifi: ath12k: Move Wi-Fi 7 specific init routines to dedicated file
  2025-08-12 17:09 [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Kiran Venkatappa
                   ` (6 preceding siblings ...)
  2025-08-12 17:09 ` [PATCH ath12k-ng 07/13] wifi: ath12k: Restructure ahb.c into common and Wi-Fi 7 specific modules Kiran Venkatappa
@ 2025-08-12 17:09 ` Kiran Venkatappa
  2025-08-12 17:09 ` [PATCH ath12k-ng 09/13] wifi: ath12k: Move hw_init invocation to target-specific probe Kiran Venkatappa
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Kiran Venkatappa @ 2025-08-12 17:09 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless

Move Wi-Fi 7 specific module initialization and exit routines from core.c
to a new core_wifi7.c file. Decouple these routines from common module
entry points to improve modularity.

This restructuring is part of a broader effort to modularize the
ATH12K driver by separating common logic from hardware family-specific
implementations, improving maintainability and scalability.

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>
---
 drivers/net/wireless/ath/ath12k/Makefile     |  1 +
 drivers/net/wireless/ath/ath12k/core.c       | 32 --------------------
 drivers/net/wireless/ath/ath12k/core_wifi7.c | 44 ++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 32 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/Makefile b/drivers/net/wireless/ath/ath12k/Makefile
index 5c044e39633057651f80c3039f1340e791e419b4..9c7a32930ed60eafc36fa65aa0ac001d9237eaf8 100644
--- a/drivers/net/wireless/ath/ath12k/Makefile
+++ b/drivers/net/wireless/ath/ath12k/Makefile
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause-Clear
 obj-$(CONFIG_ATH12K) += ath12k.o
 ath12k-y += core.o \
+	    core_wifi7.o \
 	    hal.o \
 	    hal_tx.o \
 	    hal_rx.o \
diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
index 1333422724e4e873c8a36a53cf0faf4eda82c1a4..b1a26027de3f8d83a7823fba94cc0ef1df38c7b7 100644
--- a/drivers/net/wireless/ath/ath12k/core.c
+++ b/drivers/net/wireless/ath/ath12k/core.c
@@ -22,10 +22,7 @@
 #include "hif.h"
 #include "pci.h"
 #include "wow.h"
-#include "pci_wifi7.h"
-#include "ahb_wifi7.h"
 
-static int ahb_err, pci_err;
 unsigned int ath12k_debug_mask;
 module_param_named(debug_mask, ath12k_debug_mask, uint, 0644);
 MODULE_PARM_DESC(debug_mask, "Debugging mask");
@@ -2282,32 +2279,3 @@ struct ath12k_base *ath12k_core_alloc(struct device *dev, size_t priv_size,
 	kfree(ab);
 	return NULL;
 }
-
-static int ath12k_init(void)
-{
-	ahb_err = ath12k_wifi7_ahb_init();
-	if (ahb_err)
-		pr_warn("Failed to initialize ath12k AHB device: %d\n", ahb_err);
-
-	pci_err = ath12k_wifi7_pci_init();
-	if (pci_err)
-		pr_warn("Failed to initialize ath12k PCI device: %d\n", pci_err);
-
-	/* If both failed, return one of the failures (arbitrary) */
-	return ahb_err && pci_err ? ahb_err : 0;
-}
-
-static void ath12k_exit(void)
-{
-	if (!pci_err)
-		ath12k_wifi7_pci_exit();
-
-	if (!ahb_err)
-		ath12k_wifi7_ahb_exit();
-}
-
-module_init(ath12k_init);
-module_exit(ath12k_exit);
-
-MODULE_DESCRIPTION("Driver support for Qualcomm Technologies 802.11be WLAN devices");
-MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drivers/net/wireless/ath/ath12k/core_wifi7.c b/drivers/net/wireless/ath/ath12k/core_wifi7.c
new file mode 100644
index 0000000000000000000000000000000000000000..85ea8904672cbca03a77e8e9a70c5b397b5e08e2
--- /dev/null
+++ b/drivers/net/wireless/ath/ath12k/core_wifi7.c
@@ -0,0 +1,44 @@
+// 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.
+ */
+
+#include <linux/module.h>
+#include "ahb.h"
+#include "pci.h"
+#include "pci_wifi7.h"
+#include "ahb_wifi7.h"
+
+static int ahb_err, pci_err;
+
+static int ath12k_wifi7_init(void)
+{
+	ahb_err = ath12k_wifi7_ahb_init();
+	if (ahb_err)
+		pr_warn("Failed to initialize ath12k Wi-Fi 7 AHB device: %d\n",
+			ahb_err);
+
+	pci_err = ath12k_wifi7_pci_init();
+	if (pci_err)
+		pr_warn("Failed to initialize ath12k Wi-Fi 7 PCI device: %d\n",
+			pci_err);
+
+	/* If both failed, return one of the failures (arbitrary) */
+	return ahb_err && pci_err ? ahb_err : 0;
+}
+
+static void ath12k_wifi7_exit(void)
+{
+	if (!pci_err)
+		ath12k_wifi7_pci_exit();
+
+	if (!ahb_err)
+		ath12k_wifi7_ahb_exit();
+}
+
+module_init(ath12k_wifi7_init);
+module_exit(ath12k_wifi7_exit);
+
+MODULE_DESCRIPTION("Driver support for Qualcomm Technologies 802.11be WLAN devices");
+MODULE_LICENSE("Dual BSD/GPL");

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH ath12k-ng 09/13] wifi: ath12k: Move hw_init invocation to target-specific probe
  2025-08-12 17:09 [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Kiran Venkatappa
                   ` (7 preceding siblings ...)
  2025-08-12 17:09 ` [PATCH ath12k-ng 08/13] wifi: ath12k: Move Wi-Fi 7 specific init routines to dedicated file Kiran Venkatappa
@ 2025-08-12 17:09 ` Kiran Venkatappa
  2025-08-12 17:09 ` [PATCH ath12k-ng 10/13] wifi: ath12k: Modularize driver into common and Wi-Fi 7 specific components Kiran Venkatappa
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Kiran Venkatappa @ 2025-08-12 17:09 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless

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>
---
 drivers/net/wireless/ath/ath12k/ahb_wifi7.c |  8 ++++++++
 drivers/net/wireless/ath/ath12k/core.c      |  7 -------
 drivers/net/wireless/ath/ath12k/hw.h        |  2 --
 drivers/net/wireless/ath/ath12k/hw_wifi7.c  |  3 ++-
 drivers/net/wireless/ath/ath12k/hw_wifi7.h  | 13 +++++++++++++
 drivers/net/wireless/ath/ath12k/pci_wifi7.c |  8 ++++++++
 6 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/ahb_wifi7.c b/drivers/net/wireless/ath/ath12k/ahb_wifi7.c
index 7a869722b77e639781fed45835872c38a50b8cfc..ff4f041bafbc452ec9c70c3d9f1ce648b43a26c7 100644
--- a/drivers/net/wireless/ath/ath12k/ahb_wifi7.c
+++ b/drivers/net/wireless/ath/ath12k/ahb_wifi7.c
@@ -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;
 }
 
diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
index b1a26027de3f8d83a7823fba94cc0ef1df38c7b7..8b6fb6a1593a322ceee86ecbd23c87ab9b72394b 100644
--- a/drivers/net/wireless/ath/ath12k/core.c
+++ b/drivers/net/wireless/ath/ath12k/core.c
@@ -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;
diff --git a/drivers/net/wireless/ath/ath12k/hw.h b/drivers/net/wireless/ath/ath12k/hw.h
index 8ce11c3e6d5c21b2affef8cbe4b0b867e678faae..35d6900720feeef6d736df38dcc17402db6d5f8b 100644
--- a/drivers/net/wireless/ath/ath12k/hw.h
+++ b/drivers/net/wireless/ath/ath12k/hw.h
@@ -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
diff --git a/drivers/net/wireless/ath/ath12k/hw_wifi7.c b/drivers/net/wireless/ath/ath12k/hw_wifi7.c
index f6177f8e032d98774b4a041ecfe97187b55ed259..5f5d3c57b288c1ce9023a14e40cd2f12c9adc13f 100644
--- a/drivers/net/wireless/ath/ath12k/hw_wifi7.c
+++ b/drivers/net/wireless/ath/ath12k/hw_wifi7.c
@@ -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
index 0000000000000000000000000000000000000000..643b6fdfdb66f0a854b305f72b0e124910067eb8
--- /dev/null
+++ b/drivers/net/wireless/ath/ath12k/hw_wifi7.h
@@ -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 */
diff --git a/drivers/net/wireless/ath/ath12k/pci_wifi7.c b/drivers/net/wireless/ath/ath12k/pci_wifi7.c
index 8c7718153534ca0f30d33ef954d6c542ae70154a..a680cd9a04e33af1340393429773aea497461412 100644
--- a/drivers/net/wireless/ath/ath12k/pci_wifi7.c
+++ b/drivers/net/wireless/ath/ath12k/pci_wifi7.c
@@ -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;
 }
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH ath12k-ng 10/13] wifi: ath12k: Modularize driver into common and Wi-Fi 7 specific components
  2025-08-12 17:09 [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Kiran Venkatappa
                   ` (8 preceding siblings ...)
  2025-08-12 17:09 ` [PATCH ath12k-ng 09/13] wifi: ath12k: Move hw_init invocation to target-specific probe Kiran Venkatappa
@ 2025-08-12 17:09 ` Kiran Venkatappa
  2025-08-12 17:09 ` [PATCH ath12k-ng 11/13] wifi: ath12k: Rename ath12k_* symbols to ath12k_wifi7_* for clarity Kiran Venkatappa
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Kiran Venkatappa @ 2025-08-12 17:09 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless

Split the ath12k driver into two kernel modules:

 - ath12k.ko for shared logic across multiple targets
 - ath12k_wifi7.ko for Wi-Fi 7 specific configuration and routines

The common module (ath12k.ko) must be loaded prior to any device-specific
module, as the latter depends on exported symbols from the former.

As part of this restructuring, Wi-Fi 7 specific files are moved into a
dedicated `wifi7/` directory and built as a separate module. Common
symbols are exported accordingly, with further adjustments planned
in upcoming patches to support architecture-dependent separation.

This modularization improves maintainability and scalability by enabling
clean separation of hardware-specific logic from the shared driver core.

                                          +-----------------+
                                          |                 |
                                          |   ath12k.ko     |
                                          |    (common)     |
        +---------------+                 |                 |
        |               |                 +-----------------+
        |   ath12k.ko   | ===========>
        |               |                 +------------------+
        +---------------+                 |                  |
                                          | ath12k_wifi7.ko  |
                                          | (wifi7 family)   |
                                          |                  |
                                          +------------------+

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>
---
 drivers/net/wireless/ath/ath12k/Makefile                 | 11 ++++-------
 drivers/net/wireless/ath/ath12k/ahb.c                    |  2 ++
 drivers/net/wireless/ath/ath12k/core.c                   |  5 +++++
 drivers/net/wireless/ath/ath12k/debug.c                  |  4 ++++
 drivers/net/wireless/ath/ath12k/dp_rx.c                  |  3 +++
 drivers/net/wireless/ath/ath12k/hal.c                    |  4 ++++
 drivers/net/wireless/ath/ath12k/htc.c                    |  2 ++
 drivers/net/wireless/ath/ath12k/pci.c                    |  3 +++
 drivers/net/wireless/ath/ath12k/peer.c                   |  2 ++
 drivers/net/wireless/ath/ath12k/wifi7/Makefile           | 10 ++++++++++
 .../net/wireless/ath/ath12k/{ahb_wifi7.c => wifi7/ahb.c} |  8 ++++----
 .../net/wireless/ath/ath12k/{ahb_wifi7.h => wifi7/ahb.h} |  0
 .../net/wireless/ath/ath12k/{ce_wifi7.c => wifi7/ce.c}   |  6 +++---
 .../net/wireless/ath/ath12k/{ce_wifi7.h => wifi7/ce.h}   |  0
 .../wireless/ath/ath12k/{core_wifi7.c => wifi7/core.c}   |  6 +++---
 .../net/wireless/ath/ath12k/{hw_wifi7.c => wifi7/hw.c}   | 16 ++++++++--------
 .../net/wireless/ath/ath12k/{hw_wifi7.h => wifi7/hw.h}   |  0
 .../net/wireless/ath/ath12k/{mhi_wifi7.c => wifi7/mhi.c} |  2 +-
 .../net/wireless/ath/ath12k/{mhi_wifi7.h => wifi7/mhi.h} |  0
 .../net/wireless/ath/ath12k/{pci_wifi7.c => wifi7/pci.c} | 10 +++++-----
 .../net/wireless/ath/ath12k/{pci_wifi7.h => wifi7/pci.h} |  0
 .../net/wireless/ath/ath12k/{wmi_wifi7.c => wifi7/wmi.c} |  4 ++--
 .../net/wireless/ath/ath12k/{wmi_wifi7.h => wifi7/wmi.h} |  0
 23 files changed, 65 insertions(+), 33 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/Makefile b/drivers/net/wireless/ath/ath12k/Makefile
index 9c7a32930ed60eafc36fa65aa0ac001d9237eaf8..8dd77729f52f5143746a6fa568d200b68f4715d6 100644
--- a/drivers/net/wireless/ath/ath12k/Makefile
+++ b/drivers/net/wireless/ath/ath12k/Makefile
@@ -1,12 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause-Clear
 obj-$(CONFIG_ATH12K) += ath12k.o
 ath12k-y += core.o \
-	    core_wifi7.o \
 	    hal.o \
 	    hal_tx.o \
 	    hal_rx.o \
 	    wmi.o \
-	    wmi_wifi7.o \
 	    mac.o \
 	    reg.o \
 	    htc.o \
@@ -16,19 +14,18 @@ ath12k-y += core.o \
 	    dp_rx.o \
 	    debug.o \
 	    ce.o \
-	    ce_wifi7.o \
 	    peer.o \
 	    dbring.o \
-	    hw_wifi7.o \
 	    mhi.o \
-	    mhi_wifi7.o \
 	    pci.o \
-	    pci_wifi7.o \
 	    dp_mon.o \
 	    fw.o \
 	    p2p.o
 
-ath12k-$(CONFIG_ATH12K_AHB) += ahb.o ahb_wifi7.o
+ath12k-$(CONFIG_ATH12K_AHB) += ahb.o
+
+obj-$(CONFIG_ATH12K) += wifi7/
+
 ath12k-$(CONFIG_ATH12K_DEBUGFS) += debugfs.o debugfs_htt_stats.o debugfs_sta.o
 ath12k-$(CONFIG_ACPI) += acpi.o
 ath12k-$(CONFIG_ATH12K_TRACING) += trace.o
diff --git a/drivers/net/wireless/ath/ath12k/ahb.c b/drivers/net/wireless/ath/ath12k/ahb.c
index fc986e669bdea85cdf3dcc3d60c1f2cc9216d3e0..41ef5170556e9255337b26ec3565ab25f50adc65 100644
--- a/drivers/net/wireless/ath/ath12k/ahb.c
+++ b/drivers/net/wireless/ath/ath12k/ahb.c
@@ -1183,6 +1183,7 @@ int ath12k_ahb_register_driver(const enum ath12k_device_family device_id,
 
 	return platform_driver_register(ahb_driver);
 }
+EXPORT_SYMBOL(ath12k_ahb_register_driver);
 
 void ath12k_ahb_unregister_driver(const enum ath12k_device_family device_id)
 {
@@ -1198,3 +1199,4 @@ void ath12k_ahb_unregister_driver(const enum ath12k_device_family device_id)
 	platform_driver_unregister(ahb_driver);
 	ath12k_ahb_family_drivers[device_id] = NULL;
 }
+EXPORT_SYMBOL(ath12k_ahb_unregister_driver);
diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
index 8b6fb6a1593a322ceee86ecbd23c87ab9b72394b..346687d1598238caadc7f9188b485189f94640de 100644
--- a/drivers/net/wireless/ath/ath12k/core.c
+++ b/drivers/net/wireless/ath/ath12k/core.c
@@ -632,6 +632,7 @@ u32 ath12k_core_get_max_peers_per_radio(struct ath12k_base *ab)
 {
 	return ath12k_core_get_max_station_per_radio(ab) + TARGET_NUM_VDEVS(ab);
 }
+EXPORT_SYMBOL(ath12k_core_get_max_peers_per_radio);
 
 struct reserved_mem *ath12k_core_get_reserved_mem(struct ath12k_base *ab,
 						  int index)
@@ -1740,6 +1741,7 @@ enum ath12k_qmi_mem_mode ath12k_core_get_memory_mode(struct ath12k_base *ab)
 
 	return ATH12K_QMI_MEMORY_MODE_DEFAULT;
 }
+EXPORT_SYMBOL(ath12k_core_get_memory_mode);
 
 int ath12k_core_pre_init(struct ath12k_base *ab)
 {
@@ -2272,3 +2274,6 @@ struct ath12k_base *ath12k_core_alloc(struct device *dev, size_t priv_size,
 	kfree(ab);
 	return NULL;
 }
+
+MODULE_DESCRIPTION("Driver support for Qualcomm Technologies WLAN devices");
+MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drivers/net/wireless/ath/ath12k/debug.c b/drivers/net/wireless/ath/ath12k/debug.c
index 5ce100cd9a9d16f7fcc2dc0a5522b341ebbff8a3..9910c60f30ced17370cbe47e4cedc9a41f62d196 100644
--- a/drivers/net/wireless/ath/ath12k/debug.c
+++ b/drivers/net/wireless/ath/ath12k/debug.c
@@ -21,6 +21,7 @@ void ath12k_info(struct ath12k_base *ab, const char *fmt, ...)
 	/* TODO: Trace the log */
 	va_end(args);
 }
+EXPORT_SYMBOL(ath12k_info);
 
 void ath12k_err(struct ath12k_base *ab, const char *fmt, ...)
 {
@@ -35,6 +36,7 @@ void ath12k_err(struct ath12k_base *ab, const char *fmt, ...)
 	/* TODO: Trace the log */
 	va_end(args);
 }
+EXPORT_SYMBOL(ath12k_err);
 
 void __ath12k_warn(struct device *dev, const char *fmt, ...)
 {
@@ -49,6 +51,7 @@ void __ath12k_warn(struct device *dev, const char *fmt, ...)
 	/* TODO: Trace the log */
 	va_end(args);
 }
+EXPORT_SYMBOL(__ath12k_warn);
 
 #ifdef CONFIG_ATH12K_DEBUG
 
@@ -72,6 +75,7 @@ void __ath12k_dbg(struct ath12k_base *ab, enum ath12k_debug_mask mask,
 
 	va_end(args);
 }
+EXPORT_SYMBOL(__ath12k_dbg);
 
 void ath12k_dbg_dump(struct ath12k_base *ab,
 		     enum ath12k_debug_mask mask,
diff --git a/drivers/net/wireless/ath/ath12k/dp_rx.c b/drivers/net/wireless/ath/ath12k/dp_rx.c
index 8ab91273592c826cdd3c39fb9157dc853b2722e5..1b1ac82871f4152e86e285c7f0002f33ee1dac58 100644
--- a/drivers/net/wireless/ath/ath12k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath12k/dp_rx.c
@@ -1901,6 +1901,7 @@ void ath12k_dp_htt_htc_t2h_msg_handler(struct ath12k_base *ab,
 
 	dev_kfree_skb_any(skb);
 }
+EXPORT_SYMBOL(ath12k_dp_htt_htc_t2h_msg_handler);
 
 static int ath12k_dp_rx_msdu_coalesce(struct ath12k *ar,
 				      struct sk_buff_head *msdu_list,
@@ -4383,6 +4384,7 @@ int ath12k_dp_rxdma_ring_sel_config_qcn9274(struct ath12k_base *ab)
 
 	return ret;
 }
+EXPORT_SYMBOL(ath12k_dp_rxdma_ring_sel_config_qcn9274);
 
 int ath12k_dp_rxdma_ring_sel_config_wcn7850(struct ath12k_base *ab)
 {
@@ -4425,6 +4427,7 @@ int ath12k_dp_rxdma_ring_sel_config_wcn7850(struct ath12k_base *ab)
 
 	return ret;
 }
+EXPORT_SYMBOL(ath12k_dp_rxdma_ring_sel_config_wcn7850);
 
 int ath12k_dp_rx_htt_setup(struct ath12k_base *ab)
 {
diff --git a/drivers/net/wireless/ath/ath12k/hal.c b/drivers/net/wireless/ath/ath12k/hal.c
index 6406fcf5d69fd67dd3d5e0e25bb7a1dd860085ac..022eea9515efd9f38ff27b5b9becdf7e451b310f 100644
--- a/drivers/net/wireless/ath/ath12k/hal.c
+++ b/drivers/net/wireless/ath/ath12k/hal.c
@@ -746,6 +746,7 @@ const struct hal_rx_ops hal_rx_qcn9274_ops = {
 	.rx_desc_get_desc_size = ath12k_hw_qcn9274_get_rx_desc_size,
 	.rx_desc_get_msdu_src_link_id = ath12k_hw_qcn9274_rx_desc_get_msdu_src_link,
 };
+EXPORT_SYMBOL(hal_rx_qcn9274_ops);
 
 static bool ath12k_hw_qcn9274_compact_rx_desc_get_first_msdu(struct hal_rx_desc *desc)
 {
@@ -1093,6 +1094,7 @@ const struct hal_ops hal_qcn9274_ops = {
 	.rxdma_ring_wmask_rx_msdu_end = ath12k_hal_qcn9274_rx_msdu_end_wmask_get,
 	.get_hal_rx_compact_ops = ath12k_hal_qcn9274_get_hal_rx_compact_ops,
 };
+EXPORT_SYMBOL(hal_qcn9274_ops);
 
 static bool ath12k_hw_wcn7850_rx_desc_get_first_msdu(struct hal_rx_desc *desc)
 {
@@ -1552,6 +1554,7 @@ const struct hal_rx_ops hal_rx_wcn7850_ops = {
 	.rx_desc_get_desc_size = ath12k_hw_wcn7850_get_rx_desc_size,
 	.rx_desc_get_msdu_src_link_id = ath12k_hw_wcn7850_rx_desc_get_msdu_src_link,
 };
+EXPORT_SYMBOL(hal_rx_wcn7850_ops);
 
 const struct hal_ops hal_wcn7850_ops = {
 	.create_srng_config = ath12k_hal_srng_create_config_wcn7850,
@@ -1560,6 +1563,7 @@ const struct hal_ops hal_wcn7850_ops = {
 	.rxdma_ring_wmask_rx_msdu_end = NULL,
 	.get_hal_rx_compact_ops = NULL,
 };
+EXPORT_SYMBOL(hal_wcn7850_ops);
 
 static int ath12k_hal_alloc_cont_rdp(struct ath12k_base *ab)
 {
diff --git a/drivers/net/wireless/ath/ath12k/htc.c b/drivers/net/wireless/ath/ath12k/htc.c
index d13616bf07f43da4711c6e37628f978d7292f3fe..fe8218a56125b22f585ee8badab976173c4219ce 100644
--- a/drivers/net/wireless/ath/ath12k/htc.c
+++ b/drivers/net/wireless/ath/ath12k/htc.c
@@ -2,6 +2,7 @@
 /*
  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
  * Copyright (c) 2021-2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
  */
 #include <linux/skbuff.h>
 #include <linux/ctype.h>
@@ -376,6 +377,7 @@ void ath12k_htc_rx_completion_handler(struct ath12k_base *ab,
 out:
 	kfree_skb(skb);
 }
+EXPORT_SYMBOL(ath12k_htc_rx_completion_handler);
 
 static void ath12k_htc_control_rx_complete(struct ath12k_base *ab,
 					   struct sk_buff *skb)
diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c
index 93e2189ec68704598ce401ed4fe4f5981fc3cece..fbe6359ec74cf121d2d08d94297585eaa423d5ad 100644
--- a/drivers/net/wireless/ath/ath12k/pci.c
+++ b/drivers/net/wireless/ath/ath12k/pci.c
@@ -1175,6 +1175,7 @@ u32 ath12k_pci_read32(struct ath12k_base *ab, u32 offset)
 		ab_pci->pci_ops->release(ab);
 	return val;
 }
+EXPORT_SYMBOL(ath12k_pci_read32);
 
 void ath12k_pci_write32(struct ath12k_base *ab, u32 offset, u32 value)
 {
@@ -1795,6 +1796,7 @@ int ath12k_pci_register_driver(const enum ath12k_device_family device_id,
 
 	return pci_register_driver(pci_driver);
 }
+EXPORT_SYMBOL(ath12k_pci_register_driver);
 
 void ath12k_pci_unregister_driver(const enum ath12k_device_family device_id)
 {
@@ -1805,3 +1807,4 @@ void ath12k_pci_unregister_driver(const enum ath12k_device_family device_id)
 	pci_unregister_driver(&ath12k_pci_family_drivers[device_id]->driver);
 	ath12k_pci_family_drivers[device_id] = NULL;
 }
+EXPORT_SYMBOL(ath12k_pci_unregister_driver);
diff --git a/drivers/net/wireless/ath/ath12k/peer.c b/drivers/net/wireless/ath/ath12k/peer.c
index f1ae9e5b5af7208e9a547b5c191b0dd3b582b295..af95324f270868c81dd7fc32830ac31ae6cc8056 100644
--- a/drivers/net/wireless/ath/ath12k/peer.c
+++ b/drivers/net/wireless/ath/ath12k/peer.c
@@ -23,6 +23,7 @@ struct ath12k_ml_peer *ath12k_peer_ml_find(struct ath12k_hw *ah, const u8 *addr)
 
 	return NULL;
 }
+EXPORT_SYMBOL(ath12k_peer_ml_find);
 
 struct ath12k_peer *ath12k_peer_find(struct ath12k_base *ab, int vdev_id,
 				     const u8 *addr)
@@ -78,6 +79,7 @@ struct ath12k_peer *ath12k_peer_find_by_addr(struct ath12k_base *ab,
 
 	return NULL;
 }
+EXPORT_SYMBOL(ath12k_peer_find_by_addr);
 
 static struct ath12k_peer *ath12k_peer_find_by_ml_id(struct ath12k_base *ab,
 						     int ml_peer_id)
diff --git a/drivers/net/wireless/ath/ath12k/wifi7/Makefile b/drivers/net/wireless/ath/ath12k/wifi7/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..872ca620a5c5031bdf39817f9833faf2d7ce629d
--- /dev/null
+++ b/drivers/net/wireless/ath/ath12k/wifi7/Makefile
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause-Clear
+obj-$(CONFIG_ATH12K) += ath12k_wifi7.o
+ath12k_wifi7-y += core.o \
+	          pci.o \
+	          wmi.o \
+	          mhi.o \
+	          ce.o \
+	          hw.o
+
+ath12k_wifi7-$(CONFIG_ATH12K_AHB) += ahb.o
diff --git a/drivers/net/wireless/ath/ath12k/ahb_wifi7.c b/drivers/net/wireless/ath/ath12k/wifi7/ahb.c
similarity index 95%
rename from drivers/net/wireless/ath/ath12k/ahb_wifi7.c
rename to drivers/net/wireless/ath/ath12k/wifi7/ahb.c
index ff4f041bafbc452ec9c70c3d9f1ce648b43a26c7..803e13207bc067889fb4c36fff109f78a0ed66bb 100644
--- a/drivers/net/wireless/ath/ath12k/ahb_wifi7.c
+++ b/drivers/net/wireless/ath/ath12k/wifi7/ahb.c
@@ -7,11 +7,11 @@
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/soc/qcom/mdt_loader.h>
+#include "../ahb.h"
 #include "ahb.h"
-#include "ahb_wifi7.h"
-#include "debug.h"
-#include "hif.h"
-#include "hw_wifi7.h"
+#include "../debug.h"
+#include "../hif.h"
+#include "hw.h"
 
 static const struct of_device_id ath12k_wifi7_ahb_of_match[] = {
 	{ .compatible = "qcom,ipq5332-wifi",
diff --git a/drivers/net/wireless/ath/ath12k/ahb_wifi7.h b/drivers/net/wireless/ath/ath12k/wifi7/ahb.h
similarity index 100%
rename from drivers/net/wireless/ath/ath12k/ahb_wifi7.h
rename to drivers/net/wireless/ath/ath12k/wifi7/ahb.h
diff --git a/drivers/net/wireless/ath/ath12k/ce_wifi7.c b/drivers/net/wireless/ath/ath12k/wifi7/ce.c
similarity index 99%
rename from drivers/net/wireless/ath/ath12k/ce_wifi7.c
rename to drivers/net/wireless/ath/ath12k/wifi7/ce.c
index cf27259d15a0e85c30268c12f935ad3b7985a22f..b4bd1136c25650f559d83242543edf571969059c 100644
--- a/drivers/net/wireless/ath/ath12k/ce_wifi7.c
+++ b/drivers/net/wireless/ath/ath12k/wifi7/ce.c
@@ -8,10 +8,10 @@
 #include <linux/bitops.h>
 #include <linux/bitfield.h>
 
-#include "core.h"
+#include "../core.h"
+#include "../ce.h"
 #include "ce.h"
-#include "ce_wifi7.h"
-#include "dp_rx.h"
+#include "../dp_rx.h"
 
 /* Copy Engine (CE) configs for QCN9274 */
 /* Target firmware's Copy Engine configuration. */
diff --git a/drivers/net/wireless/ath/ath12k/ce_wifi7.h b/drivers/net/wireless/ath/ath12k/wifi7/ce.h
similarity index 100%
rename from drivers/net/wireless/ath/ath12k/ce_wifi7.h
rename to drivers/net/wireless/ath/ath12k/wifi7/ce.h
diff --git a/drivers/net/wireless/ath/ath12k/core_wifi7.c b/drivers/net/wireless/ath/ath12k/wifi7/core.c
similarity index 95%
rename from drivers/net/wireless/ath/ath12k/core_wifi7.c
rename to drivers/net/wireless/ath/ath12k/wifi7/core.c
index 85ea8904672cbca03a77e8e9a70c5b397b5e08e2..eb882e56e5ec2865a910d8936cb892f71541d2e9 100644
--- a/drivers/net/wireless/ath/ath12k/core_wifi7.c
+++ b/drivers/net/wireless/ath/ath12k/wifi7/core.c
@@ -5,10 +5,10 @@
  */
 
 #include <linux/module.h>
-#include "ahb.h"
+#include "../ahb.h"
+#include "../pci.h"
 #include "pci.h"
-#include "pci_wifi7.h"
-#include "ahb_wifi7.h"
+#include "ahb.h"
 
 static int ahb_err, pci_err;
 
diff --git a/drivers/net/wireless/ath/ath12k/hw_wifi7.c b/drivers/net/wireless/ath/ath12k/wifi7/hw.c
similarity index 99%
rename from drivers/net/wireless/ath/ath12k/hw_wifi7.c
rename to drivers/net/wireless/ath/ath12k/wifi7/hw.c
index 5f5d3c57b288c1ce9023a14e40cd2f12c9adc13f..93f558847baed6e318f64191cb34f84d7f7586eb 100644
--- a/drivers/net/wireless/ath/ath12k/hw_wifi7.c
+++ b/drivers/net/wireless/ath/ath12k/wifi7/hw.c
@@ -8,17 +8,17 @@
 #include <linux/bitops.h>
 #include <linux/bitfield.h>
 
-#include "debug.h"
-#include "core.h"
+#include "../debug.h"
+#include "../core.h"
+#include "../ce.h"
 #include "ce.h"
-#include "ce_wifi7.h"
+#include "../hw.h"
 #include "hw.h"
-#include "hw_wifi7.h"
+#include "../mhi.h"
 #include "mhi.h"
-#include "dp_rx.h"
-#include "peer.h"
-#include "wmi_wifi7.h"
-#include "mhi_wifi7.h"
+#include "../dp_rx.h"
+#include "../peer.h"
+#include "wmi.h"
 
 static const guid_t wcn7850_uuid = GUID_INIT(0xf634f534, 0x6147, 0x11ec,
 					     0x90, 0xd6, 0x02, 0x42,
diff --git a/drivers/net/wireless/ath/ath12k/hw_wifi7.h b/drivers/net/wireless/ath/ath12k/wifi7/hw.h
similarity index 100%
rename from drivers/net/wireless/ath/ath12k/hw_wifi7.h
rename to drivers/net/wireless/ath/ath12k/wifi7/hw.h
diff --git a/drivers/net/wireless/ath/ath12k/mhi_wifi7.c b/drivers/net/wireless/ath/ath12k/wifi7/mhi.c
similarity index 99%
rename from drivers/net/wireless/ath/ath12k/mhi_wifi7.c
rename to drivers/net/wireless/ath/ath12k/wifi7/mhi.c
index be74df152f6f88c1c723459a1cdea21f45b0d15b..74d5f096453118a864ec254150b417bdba5a1d64 100644
--- a/drivers/net/wireless/ath/ath12k/mhi_wifi7.c
+++ b/drivers/net/wireless/ath/ath12k/wifi7/mhi.c
@@ -4,8 +4,8 @@
  * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
  */
 
+#include "../mhi.h"
 #include "mhi.h"
-#include "mhi_wifi7.h"
 
 static const struct mhi_channel_config ath12k_mhi_channels_qcn9274[] = {
 	{
diff --git a/drivers/net/wireless/ath/ath12k/mhi_wifi7.h b/drivers/net/wireless/ath/ath12k/wifi7/mhi.h
similarity index 100%
rename from drivers/net/wireless/ath/ath12k/mhi_wifi7.h
rename to drivers/net/wireless/ath/ath12k/wifi7/mhi.h
diff --git a/drivers/net/wireless/ath/ath12k/pci_wifi7.c b/drivers/net/wireless/ath/ath12k/wifi7/pci.c
similarity index 97%
rename from drivers/net/wireless/ath/ath12k/pci_wifi7.c
rename to drivers/net/wireless/ath/ath12k/wifi7/pci.c
index a680cd9a04e33af1340393429773aea497461412..01a0b42f0e808a7aab656b88816f2f93a8d4da5e 100644
--- a/drivers/net/wireless/ath/ath12k/pci_wifi7.c
+++ b/drivers/net/wireless/ath/ath12k/wifi7/pci.c
@@ -6,12 +6,12 @@
 
 #include <linux/pci.h>
 
+#include "../pci.h"
 #include "pci.h"
-#include "pci_wifi7.h"
-#include "core.h"
-#include "hif.h"
-#include "mhi.h"
-#include "hw_wifi7.h"
+#include "../core.h"
+#include "../hif.h"
+#include "../mhi.h"
+#include "hw.h"
 
 #define QCN9274_DEVICE_ID		0x1109
 #define WCN7850_DEVICE_ID		0x1107
diff --git a/drivers/net/wireless/ath/ath12k/pci_wifi7.h b/drivers/net/wireless/ath/ath12k/wifi7/pci.h
similarity index 100%
rename from drivers/net/wireless/ath/ath12k/pci_wifi7.h
rename to drivers/net/wireless/ath/ath12k/wifi7/pci.h
diff --git a/drivers/net/wireless/ath/ath12k/wmi_wifi7.c b/drivers/net/wireless/ath/ath12k/wifi7/wmi.c
similarity index 99%
rename from drivers/net/wireless/ath/ath12k/wmi_wifi7.c
rename to drivers/net/wireless/ath/ath12k/wifi7/wmi.c
index f27fa56210e8332ca3c309eca9184f6cbe560c91..652c353f9fc586ae05fa276ebbb99b9a65a5a7c1 100644
--- a/drivers/net/wireless/ath/ath12k/wmi_wifi7.c
+++ b/drivers/net/wireless/ath/ath12k/wifi7/wmi.c
@@ -4,8 +4,8 @@
  * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
  */
 
-#include "core.h"
-#include "wmi_wifi7.h"
+#include "../core.h"
+#include "wmi.h"
 
 void ath12k_wmi_init_qcn9274(struct ath12k_base *ab,
 			     struct ath12k_wmi_resource_config_arg *config)
diff --git a/drivers/net/wireless/ath/ath12k/wmi_wifi7.h b/drivers/net/wireless/ath/ath12k/wifi7/wmi.h
similarity index 100%
rename from drivers/net/wireless/ath/ath12k/wmi_wifi7.h
rename to drivers/net/wireless/ath/ath12k/wifi7/wmi.h

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH ath12k-ng 11/13] wifi: ath12k: Rename ath12k_* symbols to ath12k_wifi7_* for clarity
  2025-08-12 17:09 [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Kiran Venkatappa
                   ` (9 preceding siblings ...)
  2025-08-12 17:09 ` [PATCH ath12k-ng 10/13] wifi: ath12k: Modularize driver into common and Wi-Fi 7 specific components Kiran Venkatappa
@ 2025-08-12 17:09 ` Kiran Venkatappa
  2025-08-12 17:09 ` [PATCH ath12k-ng 12/13] wifi: ath12k: Remove HAL defines from shared PCI code Kiran Venkatappa
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Kiran Venkatappa @ 2025-08-12 17:09 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless

Rename functions and global definitions from ath12k_* to ath12k_wifi7_*
to reflect their association with the Wi-Fi 7 specific module.
Align symbol naming with recent relocation of components into the
ath12k/wifi7 directory.

This change improves code clarity and supports the modularization effort
that separates common and hardware-specific logic into distinct modules.

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>
---
 drivers/net/wireless/ath/ath12k/wifi7/ce.c  |  21 ++--
 drivers/net/wireless/ath/ath12k/wifi7/ce.h  |  18 ++--
 drivers/net/wireless/ath/ath12k/wifi7/hw.c  | 150 +++++++++++++++-------------
 drivers/net/wireless/ath/ath12k/wifi7/mhi.c |  28 +++---
 drivers/net/wireless/ath/ath12k/wifi7/mhi.h |   4 +-
 drivers/net/wireless/ath/ath12k/wifi7/pci.c |  13 +--
 drivers/net/wireless/ath/ath12k/wifi7/wmi.c |   8 +-
 drivers/net/wireless/ath/ath12k/wifi7/wmi.h |   8 +-
 8 files changed, 132 insertions(+), 118 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/wifi7/ce.c b/drivers/net/wireless/ath/ath12k/wifi7/ce.c
index b4bd1136c25650f559d83242543edf571969059c..952d6c39c333493ce9d341becc7cdba18337f891 100644
--- a/drivers/net/wireless/ath/ath12k/wifi7/ce.c
+++ b/drivers/net/wireless/ath/ath12k/wifi7/ce.c
@@ -15,7 +15,7 @@
 
 /* Copy Engine (CE) configs for QCN9274 */
 /* Target firmware's Copy Engine configuration. */
-const struct ce_pipe_config ath12k_target_ce_config_wlan_qcn9274[] = {
+const struct ce_pipe_config ath12k_wifi7_target_ce_config_wlan_qcn9274[] = {
 	/* CE0: host->target HTC control and raw streams */
 	{
 		.pipenum = __cpu_to_le32(0),
@@ -148,7 +148,8 @@ const struct ce_pipe_config ath12k_target_ce_config_wlan_qcn9274[] = {
  *      PIPEDIR_OUT = UL = host -> target
  *      PIPEDIR_IN = DL = target -> host
  */
-const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_qcn9274[] = {
+const struct service_to_pipe
+ath12k_wifi7_target_service_to_ce_map_wlan_qcn9274[] = {
 	{
 		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
 		__cpu_to_le32(PIPEDIR_OUT),
@@ -259,7 +260,7 @@ const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_qcn9274[] = {
 	},
 };
 
-const struct ce_attr ath12k_host_ce_config_qcn9274[] = {
+const struct ce_attr ath12k_wifi7_host_ce_config_qcn9274[] = {
 	/* CE0: host->target HTC control and raw streams */
 	{
 		.flags = CE_ATTR_FLAGS,
@@ -395,7 +396,7 @@ const struct ce_attr ath12k_host_ce_config_qcn9274[] = {
 
 /* Copy Engine (CE) configs for WCN7850 */
 /* Target firmware's Copy Engine configuration. */
-const struct ce_pipe_config ath12k_target_ce_config_wlan_wcn7850[] = {
+const struct ce_pipe_config ath12k_wifi7_target_ce_config_wlan_wcn7850[] = {
 	/* CE0: host->target HTC control and raw streams */
 	{
 		.pipenum = __cpu_to_le32(0),
@@ -488,7 +489,8 @@ const struct ce_pipe_config ath12k_target_ce_config_wlan_wcn7850[] = {
 	/* CE 9, 10, 11 are used by MHI driver */
 };
 
-const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_wcn7850[] = {
+const struct service_to_pipe
+ath12k_wifi7_target_service_to_ce_map_wlan_wcn7850[] = {
 	{
 		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
 		__cpu_to_le32(PIPEDIR_OUT),
@@ -569,7 +571,7 @@ const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_wcn7850[] = {
 	},
 };
 
-const struct ce_attr ath12k_host_ce_config_wcn7850[] = {
+const struct ce_attr ath12k_wifi7_host_ce_config_wcn7850[] = {
 	/* CE0: host->target HTC control and raw streams */
 	{
 		.flags = CE_ATTR_FLAGS,
@@ -647,7 +649,7 @@ const struct ce_attr ath12k_host_ce_config_wcn7850[] = {
 
 /* Copy Engine (CE) configs for IPQ5332 */
 /* Target firmware's Copy Engine configuration. */
-const struct ce_pipe_config ath12k_target_ce_config_wlan_ipq5332[] = {
+const struct ce_pipe_config ath12k_wifi7_target_ce_config_wlan_ipq5332[] = {
 	/* CE0: host->target HTC control and raw streams */
 	{
 		.pipenum = __cpu_to_le32(0),
@@ -768,7 +770,8 @@ const struct ce_pipe_config ath12k_target_ce_config_wlan_ipq5332[] = {
 	},
 };
 
-const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_ipq5332[] = {
+const struct service_to_pipe
+ath12k_wifi7_target_service_to_ce_map_wlan_ipq5332[] = {
 	{
 		__cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
 		__cpu_to_le32(PIPEDIR_OUT),
@@ -868,7 +871,7 @@ const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_ipq5332[] = {
 	},
 };
 
-const struct ce_attr ath12k_host_ce_config_ipq5332[] = {
+const struct ce_attr ath12k_wifi7_host_ce_config_ipq5332[] = {
 	/* CE0: host->target HTC control and raw streams */
 	{
 		.flags = CE_ATTR_FLAGS,
diff --git a/drivers/net/wireless/ath/ath12k/wifi7/ce.h b/drivers/net/wireless/ath/ath12k/wifi7/ce.h
index 1e211e8c246729897f66c3e468e96ff7dd15e6fd..369a14472913b06bebc3a03574095c3959def8c9 100644
--- a/drivers/net/wireless/ath/ath12k/wifi7/ce.h
+++ b/drivers/net/wireless/ath/ath12k/wifi7/ce.h
@@ -7,16 +7,16 @@
 #ifndef ATH12K_WIFI7_CE_H
 #define ATH12K_WIFI7_CE_H
 
-extern const struct ce_pipe_config ath12k_target_ce_config_wlan_qcn9274[];
-extern const struct ce_pipe_config ath12k_target_ce_config_wlan_wcn7850[];
-extern const struct ce_pipe_config ath12k_target_ce_config_wlan_ipq5332[];
+extern const struct ce_pipe_config ath12k_wifi7_target_ce_config_wlan_qcn9274[];
+extern const struct ce_pipe_config ath12k_wifi7_target_ce_config_wlan_wcn7850[];
+extern const struct ce_pipe_config ath12k_wifi7_target_ce_config_wlan_ipq5332[];
 
-extern const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_qcn9274[];
-extern const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_wcn7850[];
-extern const struct service_to_pipe ath12k_target_service_to_ce_map_wlan_ipq5332[];
+extern const struct service_to_pipe ath12k_wifi7_target_service_to_ce_map_wlan_qcn9274[];
+extern const struct service_to_pipe ath12k_wifi7_target_service_to_ce_map_wlan_wcn7850[];
+extern const struct service_to_pipe ath12k_wifi7_target_service_to_ce_map_wlan_ipq5332[];
 
-extern const struct ce_attr ath12k_host_ce_config_qcn9274[];
-extern const struct ce_attr ath12k_host_ce_config_wcn7850[];
-extern const struct ce_attr ath12k_host_ce_config_ipq5332[];
+extern const struct ce_attr ath12k_wifi7_host_ce_config_qcn9274[];
+extern const struct ce_attr ath12k_wifi7_host_ce_config_wcn7850[];
+extern const struct ce_attr ath12k_wifi7_host_ce_config_ipq5332[];
 
 #endif /* ATH12K_WIFI7_CE_H */
diff --git a/drivers/net/wireless/ath/ath12k/wifi7/hw.c b/drivers/net/wireless/ath/ath12k/wifi7/hw.c
index 93f558847baed6e318f64191cb34f84d7f7586eb..9995eccd32d39f69191f0308b67d35ed3501ebf9 100644
--- a/drivers/net/wireless/ath/ath12k/wifi7/hw.c
+++ b/drivers/net/wireless/ath/ath12k/wifi7/hw.c
@@ -24,29 +24,31 @@ static const guid_t wcn7850_uuid = GUID_INIT(0xf634f534, 0x6147, 0x11ec,
 					     0x90, 0xd6, 0x02, 0x42,
 					     0xac, 0x12, 0x00, 0x03);
 
-static u8 ath12k_hw_qcn9274_mac_from_pdev_id(int pdev_idx)
+static u8 ath12k_wifi7_hw_qcn9274_mac_from_pdev_id(int pdev_idx)
 {
 	return pdev_idx;
 }
 
-static int ath12k_hw_mac_id_to_pdev_id_qcn9274(const struct ath12k_hw_params *hw,
-					       int mac_id)
+static int
+ath12k_wifi7_hw_mac_id_to_pdev_id_qcn9274(const struct ath12k_hw_params *hw,
+					  int mac_id)
 {
 	return mac_id;
 }
 
-static int ath12k_hw_mac_id_to_srng_id_qcn9274(const struct ath12k_hw_params *hw,
-					       int mac_id)
+static int
+ath12k_wifi7_hw_mac_id_to_srng_id_qcn9274(const struct ath12k_hw_params *hw,
+					  int mac_id)
 {
 	return 0;
 }
 
-static u8 ath12k_hw_get_ring_selector_qcn9274(struct sk_buff *skb)
+static u8 ath12k_wifi7_hw_get_ring_selector_qcn9274(struct sk_buff *skb)
 {
 	return smp_processor_id();
 }
 
-static bool ath12k_dp_srng_is_comp_ring_qcn9274(int ring_num)
+static bool ath12k_wifi7_dp_srng_is_comp_ring_qcn9274(int ring_num)
 {
 	if (ring_num < 3 || ring_num == 4)
 		return true;
@@ -54,30 +56,33 @@ static bool ath12k_dp_srng_is_comp_ring_qcn9274(int ring_num)
 	return false;
 }
 
-static bool ath12k_is_frame_link_agnostic_qcn9274(struct ath12k_link_vif *arvif,
-						  struct ieee80211_mgmt *mgmt)
+static bool
+ath12k_wifi7_is_frame_link_agnostic_qcn9274(struct ath12k_link_vif *arvif,
+					    struct ieee80211_mgmt *mgmt)
 {
 	return ieee80211_is_action(mgmt->frame_control);
 }
 
-static int ath12k_hw_mac_id_to_pdev_id_wcn7850(const struct ath12k_hw_params *hw,
-					       int mac_id)
+static int
+ath12k_wifi7_hw_mac_id_to_pdev_id_wcn7850(const struct ath12k_hw_params *hw,
+					  int mac_id)
 {
 	return 0;
 }
 
-static int ath12k_hw_mac_id_to_srng_id_wcn7850(const struct ath12k_hw_params *hw,
-					       int mac_id)
+static int
+ath12k_wifi7_hw_mac_id_to_srng_id_wcn7850(const struct ath12k_hw_params *hw,
+					  int mac_id)
 {
 	return mac_id;
 }
 
-static u8 ath12k_hw_get_ring_selector_wcn7850(struct sk_buff *skb)
+static u8 ath12k_wifi7_hw_get_ring_selector_wcn7850(struct sk_buff *skb)
 {
 	return skb_get_queue_mapping(skb);
 }
 
-static bool ath12k_dp_srng_is_comp_ring_wcn7850(int ring_num)
+static bool ath12k_wifi7_dp_srng_is_comp_ring_wcn7850(int ring_num)
 {
 	if (ring_num == 0 || ring_num == 2 || ring_num == 4)
 		return true;
@@ -99,8 +104,9 @@ static bool ath12k_is_addba_resp_action_code(struct ieee80211_mgmt *mgmt)
 	return true;
 }
 
-static bool ath12k_is_frame_link_agnostic_wcn7850(struct ath12k_link_vif *arvif,
-						  struct ieee80211_mgmt *mgmt)
+static bool
+ath12k_wifi7_is_frame_link_agnostic_wcn7850(struct ath12k_link_vif *arvif,
+					    struct ieee80211_mgmt *mgmt)
 {
 	struct ieee80211_vif *vif = ath12k_ahvif_to_vif(arvif->ahvif);
 	struct ath12k_hw *ah = ath12k_ar_to_ah(arvif->ar);
@@ -132,23 +138,23 @@ static bool ath12k_is_frame_link_agnostic_wcn7850(struct ath12k_link_vif *arvif,
 }
 
 static const struct ath12k_hw_ops qcn9274_ops = {
-	.get_hw_mac_from_pdev_id = ath12k_hw_qcn9274_mac_from_pdev_id,
-	.mac_id_to_pdev_id = ath12k_hw_mac_id_to_pdev_id_qcn9274,
-	.mac_id_to_srng_id = ath12k_hw_mac_id_to_srng_id_qcn9274,
+	.get_hw_mac_from_pdev_id = ath12k_wifi7_hw_qcn9274_mac_from_pdev_id,
+	.mac_id_to_pdev_id = ath12k_wifi7_hw_mac_id_to_pdev_id_qcn9274,
+	.mac_id_to_srng_id = ath12k_wifi7_hw_mac_id_to_srng_id_qcn9274,
 	.rxdma_ring_sel_config = ath12k_dp_rxdma_ring_sel_config_qcn9274,
-	.get_ring_selector = ath12k_hw_get_ring_selector_qcn9274,
-	.dp_srng_is_tx_comp_ring = ath12k_dp_srng_is_comp_ring_qcn9274,
-	.is_frame_link_agnostic = ath12k_is_frame_link_agnostic_qcn9274,
+	.get_ring_selector = ath12k_wifi7_hw_get_ring_selector_qcn9274,
+	.dp_srng_is_tx_comp_ring = ath12k_wifi7_dp_srng_is_comp_ring_qcn9274,
+	.is_frame_link_agnostic = ath12k_wifi7_is_frame_link_agnostic_qcn9274,
 };
 
 static const struct ath12k_hw_ops wcn7850_ops = {
-	.get_hw_mac_from_pdev_id = ath12k_hw_qcn9274_mac_from_pdev_id,
-	.mac_id_to_pdev_id = ath12k_hw_mac_id_to_pdev_id_wcn7850,
-	.mac_id_to_srng_id = ath12k_hw_mac_id_to_srng_id_wcn7850,
+	.get_hw_mac_from_pdev_id = ath12k_wifi7_hw_qcn9274_mac_from_pdev_id,
+	.mac_id_to_pdev_id = ath12k_wifi7_hw_mac_id_to_pdev_id_wcn7850,
+	.mac_id_to_srng_id = ath12k_wifi7_hw_mac_id_to_srng_id_wcn7850,
 	.rxdma_ring_sel_config = ath12k_dp_rxdma_ring_sel_config_wcn7850,
-	.get_ring_selector = ath12k_hw_get_ring_selector_wcn7850,
-	.dp_srng_is_tx_comp_ring = ath12k_dp_srng_is_comp_ring_wcn7850,
-	.is_frame_link_agnostic = ath12k_is_frame_link_agnostic_wcn7850,
+	.get_ring_selector = ath12k_wifi7_hw_get_ring_selector_wcn7850,
+	.dp_srng_is_tx_comp_ring = ath12k_wifi7_dp_srng_is_comp_ring_wcn7850,
+	.is_frame_link_agnostic = ath12k_wifi7_is_frame_link_agnostic_wcn7850,
 };
 
 #define ATH12K_TX_RING_MASK_0 0x1
@@ -181,7 +187,7 @@ static const struct ath12k_hw_ops wcn7850_ops = {
 #define ATH12K_RX_MON_STATUS_RING_MASK_1 0x2
 #define ATH12K_RX_MON_STATUS_RING_MASK_2 0x4
 
-static const struct ath12k_hw_ring_mask ath12k_hw_ring_mask_qcn9274 = {
+static const struct ath12k_hw_ring_mask ath12k_wifi7_hw_ring_mask_qcn9274 = {
 	.tx  = {
 		ATH12K_TX_RING_MASK_0,
 		ATH12K_TX_RING_MASK_1,
@@ -223,7 +229,7 @@ static const struct ath12k_hw_ring_mask ath12k_hw_ring_mask_qcn9274 = {
 	},
 };
 
-static const struct ath12k_hw_ring_mask ath12k_hw_ring_mask_ipq5332 = {
+static const struct ath12k_hw_ring_mask ath12k_wifi7_hw_ring_mask_ipq5332 = {
 	.tx  = {
 		ATH12K_TX_RING_MASK_0,
 		ATH12K_TX_RING_MASK_1,
@@ -263,7 +269,7 @@ static const struct ath12k_hw_ring_mask ath12k_hw_ring_mask_ipq5332 = {
 	},
 };
 
-static const struct ath12k_hw_ring_mask ath12k_hw_ring_mask_wcn7850 = {
+static const struct ath12k_hw_ring_mask ath12k_wifi7_hw_ring_mask_wcn7850 = {
 	.tx  = {
 		ATH12K_TX_RING_MASK_0,
 		ATH12K_TX_RING_MASK_1,
@@ -654,7 +660,7 @@ static const struct ath12k_hw_regs wcn7850_regs = {
 	.gcc_gcc_pcie_hot_rst = 0x1e40304,
 };
 
-static const struct ath12k_hw_hal_params ath12k_hw_hal_params_qcn9274 = {
+static const struct ath12k_hw_hal_params ath12k_wifi7_hw_hal_params_qcn9274 = {
 	.rx_buf_rbm = HAL_RX_BUF_RBM_SW3_BM,
 	.wbm2sw_cc_enable = HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW0_EN |
 			    HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW1_EN |
@@ -663,7 +669,7 @@ static const struct ath12k_hw_hal_params ath12k_hw_hal_params_qcn9274 = {
 			    HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW4_EN,
 };
 
-static const struct ath12k_hw_hal_params ath12k_hw_hal_params_wcn7850 = {
+static const struct ath12k_hw_hal_params ath12k_wifi7_hw_hal_params_wcn7850 = {
 	.rx_buf_rbm = HAL_RX_BUF_RBM_SW1_BM,
 	.wbm2sw_cc_enable = HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW0_EN |
 			    HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW2_EN |
@@ -671,7 +677,7 @@ static const struct ath12k_hw_hal_params ath12k_hw_hal_params_wcn7850 = {
 			    HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW4_EN,
 };
 
-static const struct ath12k_hw_hal_params ath12k_hw_hal_params_ipq5332 = {
+static const struct ath12k_hw_hal_params ath12k_wifi7_hw_hal_params_ipq5332 = {
 	.rx_buf_rbm = HAL_RX_BUF_RBM_SW3_BM,
 	.wbm2sw_cc_enable = HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW0_EN |
 			    HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW1_EN |
@@ -680,18 +686,18 @@ static const struct ath12k_hw_hal_params ath12k_hw_hal_params_ipq5332 = {
 			    HAL_WBM_SW_COOKIE_CONV_CFG_WBM2SW4_EN,
 };
 
-static const struct ce_ie_addr ath12k_ce_ie_addr_ipq5332 = {
+static const struct ce_ie_addr ath12k_wifi7_ce_ie_addr_ipq5332 = {
 	.ie1_reg_addr = CE_HOST_IE_ADDRESS - HAL_IPQ5332_CE_WFSS_REG_BASE,
 	.ie2_reg_addr = CE_HOST_IE_2_ADDRESS - HAL_IPQ5332_CE_WFSS_REG_BASE,
 	.ie3_reg_addr = CE_HOST_IE_3_ADDRESS - HAL_IPQ5332_CE_WFSS_REG_BASE,
 };
 
-static const struct ce_remap ath12k_ce_remap_ipq5332 = {
+static const struct ce_remap ath12k_wifi7_ce_remap_ipq5332 = {
 	.base = HAL_IPQ5332_CE_WFSS_REG_BASE,
 	.size = HAL_IPQ5332_CE_SIZE,
 };
 
-static const struct ath12k_hw_params ath12k_hw_params[] = {
+static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 	{
 		.name = "qcn9274 hw1.0",
 		.hw_rev = ATH12K_HW_QCN9274_HW10,
@@ -707,17 +713,18 @@ static const struct ath12k_hw_params ath12k_hw_params[] = {
 		.internal_sleep_clock = false,
 
 		.hw_ops = &qcn9274_ops,
-		.ring_mask = &ath12k_hw_ring_mask_qcn9274,
+		.ring_mask = &ath12k_wifi7_hw_ring_mask_qcn9274,
 		.regs = &qcn9274_v1_regs,
 
-		.host_ce_config = ath12k_host_ce_config_qcn9274,
+		.host_ce_config = ath12k_wifi7_host_ce_config_qcn9274,
 		.ce_count = 16,
-		.target_ce_config = ath12k_target_ce_config_wlan_qcn9274,
+		.target_ce_config = ath12k_wifi7_target_ce_config_wlan_qcn9274,
 		.target_ce_count = 12,
-		.svc_to_ce_map = ath12k_target_service_to_ce_map_wlan_qcn9274,
+		.svc_to_ce_map =
+			ath12k_wifi7_target_service_to_ce_map_wlan_qcn9274,
 		.svc_to_ce_map_len = 18,
 
-		.hal_params = &ath12k_hw_hal_params_qcn9274,
+		.hal_params = &ath12k_wifi7_hw_hal_params_qcn9274,
 
 		.rxdma1_enable = false,
 		.num_rxdma_per_pdev = 1,
@@ -741,9 +748,9 @@ static const struct ath12k_hw_params ath12k_hw_params[] = {
 		.num_tcl_banks = 48,
 		.max_tx_ring = 4,
 
-		.mhi_config = &ath12k_mhi_config_qcn9274,
+		.mhi_config = &ath12k_wifi7_mhi_config_qcn9274,
 
-		.wmi_init = ath12k_wmi_init_qcn9274,
+		.wmi_init = ath12k_wifi7_wmi_init_qcn9274,
 
 		.hal_ops = &hal_qcn9274_ops,
 
@@ -794,17 +801,18 @@ static const struct ath12k_hw_params ath12k_hw_params[] = {
 		.internal_sleep_clock = true,
 
 		.hw_ops = &wcn7850_ops,
-		.ring_mask = &ath12k_hw_ring_mask_wcn7850,
+		.ring_mask = &ath12k_wifi7_hw_ring_mask_wcn7850,
 		.regs = &wcn7850_regs,
 
-		.host_ce_config = ath12k_host_ce_config_wcn7850,
+		.host_ce_config = ath12k_wifi7_host_ce_config_wcn7850,
 		.ce_count = 9,
-		.target_ce_config = ath12k_target_ce_config_wlan_wcn7850,
+		.target_ce_config = ath12k_wifi7_target_ce_config_wlan_wcn7850,
 		.target_ce_count = 9,
-		.svc_to_ce_map = ath12k_target_service_to_ce_map_wlan_wcn7850,
+		.svc_to_ce_map =
+			ath12k_wifi7_target_service_to_ce_map_wlan_wcn7850,
 		.svc_to_ce_map_len = 14,
 
-		.hal_params = &ath12k_hw_hal_params_wcn7850,
+		.hal_params = &ath12k_wifi7_hw_hal_params_wcn7850,
 
 		.rxdma1_enable = false,
 		.num_rxdma_per_pdev = 2,
@@ -829,9 +837,9 @@ static const struct ath12k_hw_params ath12k_hw_params[] = {
 		.num_tcl_banks = 7,
 		.max_tx_ring = 3,
 
-		.mhi_config = &ath12k_mhi_config_wcn7850,
+		.mhi_config = &ath12k_wifi7_mhi_config_wcn7850,
 
-		.wmi_init = ath12k_wmi_init_wcn7850,
+		.wmi_init = ath12k_wifi7_wmi_init_wcn7850,
 
 		.hal_ops = &hal_wcn7850_ops,
 
@@ -881,17 +889,18 @@ static const struct ath12k_hw_params ath12k_hw_params[] = {
 		.internal_sleep_clock = false,
 
 		.hw_ops = &qcn9274_ops,
-		.ring_mask = &ath12k_hw_ring_mask_qcn9274,
+		.ring_mask = &ath12k_wifi7_hw_ring_mask_qcn9274,
 		.regs = &qcn9274_v2_regs,
 
-		.host_ce_config = ath12k_host_ce_config_qcn9274,
+		.host_ce_config = ath12k_wifi7_host_ce_config_qcn9274,
 		.ce_count = 16,
-		.target_ce_config = ath12k_target_ce_config_wlan_qcn9274,
+		.target_ce_config = ath12k_wifi7_target_ce_config_wlan_qcn9274,
 		.target_ce_count = 12,
-		.svc_to_ce_map = ath12k_target_service_to_ce_map_wlan_qcn9274,
+		.svc_to_ce_map =
+			ath12k_wifi7_target_service_to_ce_map_wlan_qcn9274,
 		.svc_to_ce_map_len = 18,
 
-		.hal_params = &ath12k_hw_hal_params_qcn9274,
+		.hal_params = &ath12k_wifi7_hw_hal_params_qcn9274,
 
 		.rxdma1_enable = true,
 		.num_rxdma_per_pdev = 1,
@@ -915,9 +924,9 @@ static const struct ath12k_hw_params ath12k_hw_params[] = {
 		.num_tcl_banks = 48,
 		.max_tx_ring = 4,
 
-		.mhi_config = &ath12k_mhi_config_qcn9274,
+		.mhi_config = &ath12k_wifi7_mhi_config_qcn9274,
 
-		.wmi_init = ath12k_wmi_init_qcn9274,
+		.wmi_init = ath12k_wifi7_wmi_init_qcn9274,
 
 		.hal_ops = &hal_qcn9274_ops,
 
@@ -967,16 +976,17 @@ static const struct ath12k_hw_params ath12k_hw_params[] = {
 
 		.hw_ops = &qcn9274_ops,
 		.regs = &ipq5332_regs,
-		.ring_mask = &ath12k_hw_ring_mask_ipq5332,
+		.ring_mask = &ath12k_wifi7_hw_ring_mask_ipq5332,
 
-		.host_ce_config = ath12k_host_ce_config_ipq5332,
+		.host_ce_config = ath12k_wifi7_host_ce_config_ipq5332,
 		.ce_count = 12,
-		.target_ce_config = ath12k_target_ce_config_wlan_ipq5332,
+		.target_ce_config = ath12k_wifi7_target_ce_config_wlan_ipq5332,
 		.target_ce_count = 12,
-		.svc_to_ce_map = ath12k_target_service_to_ce_map_wlan_ipq5332,
+		.svc_to_ce_map =
+			ath12k_wifi7_target_service_to_ce_map_wlan_ipq5332,
 		.svc_to_ce_map_len = 18,
 
-		.hal_params = &ath12k_hw_hal_params_ipq5332,
+		.hal_params = &ath12k_wifi7_hw_hal_params_ipq5332,
 
 		.rxdma1_enable = false,
 		.num_rxdma_per_pdev = 1,
@@ -999,7 +1009,7 @@ static const struct ath12k_hw_params ath12k_hw_params[] = {
 		.num_tcl_banks = 48,
 		.max_tx_ring = 4,
 
-		.wmi_init = &ath12k_wmi_init_qcn9274,
+		.wmi_init = &ath12k_wifi7_wmi_init_qcn9274,
 
 		.hal_ops = &hal_qcn9274_ops,
 
@@ -1023,8 +1033,8 @@ static const struct ath12k_hw_params ath12k_hw_params[] = {
 		.iova_mask = 0,
 		.supports_aspm = false,
 
-		.ce_ie_addr = &ath12k_ce_ie_addr_ipq5332,
-		.ce_remap = &ath12k_ce_remap_ipq5332,
+		.ce_ie_addr = &ath12k_wifi7_ce_ie_addr_ipq5332,
+		.ce_remap = &ath12k_wifi7_ce_remap_ipq5332,
 		.bdf_addr_offset = 0xC00000,
 
 		.dp_primary_link_only = true,
@@ -1036,14 +1046,14 @@ int ath12k_wifi7_hw_init(struct ath12k_base *ab)
 	const struct ath12k_hw_params *hw_params = NULL;
 	int i;
 
-	for (i = 0; i < ARRAY_SIZE(ath12k_hw_params); i++) {
-		hw_params = &ath12k_hw_params[i];
+	for (i = 0; i < ARRAY_SIZE(ath12k_wifi7_hw_params); i++) {
+		hw_params = &ath12k_wifi7_hw_params[i];
 
 		if (hw_params->hw_rev == ab->hw_rev)
 			break;
 	}
 
-	if (i == ARRAY_SIZE(ath12k_hw_params)) {
+	if (i == ARRAY_SIZE(ath12k_wifi7_hw_params)) {
 		ath12k_err(ab, "Unsupported Wi-Fi 7 hardware version: 0x%x\n",
 			   ab->hw_rev);
 		return -EINVAL;
diff --git a/drivers/net/wireless/ath/ath12k/wifi7/mhi.c b/drivers/net/wireless/ath/ath12k/wifi7/mhi.c
index 74d5f096453118a864ec254150b417bdba5a1d64..b8d972659314b4052fe7d33713f2ff35ed032636 100644
--- a/drivers/net/wireless/ath/ath12k/wifi7/mhi.c
+++ b/drivers/net/wireless/ath/ath12k/wifi7/mhi.c
@@ -7,7 +7,7 @@
 #include "../mhi.h"
 #include "mhi.h"
 
-static const struct mhi_channel_config ath12k_mhi_channels_qcn9274[] = {
+static const struct mhi_channel_config ath12k_wifi7_mhi_channels_qcn9274[] = {
 	{
 		.num = 20,
 		.name = "IPCR",
@@ -38,7 +38,7 @@ static const struct mhi_channel_config ath12k_mhi_channels_qcn9274[] = {
 	},
 };
 
-static struct mhi_event_config ath12k_mhi_events_qcn9274[] = {
+static struct mhi_event_config ath12k_wifi7_mhi_events_qcn9274[] = {
 	{
 		.num_elements = 32,
 		.irq_moderation_ms = 0,
@@ -61,18 +61,18 @@ static struct mhi_event_config ath12k_mhi_events_qcn9274[] = {
 	},
 };
 
-const struct mhi_controller_config ath12k_mhi_config_qcn9274 = {
+const struct mhi_controller_config ath12k_wifi7_mhi_config_qcn9274 = {
 	.max_channels = 30,
 	.timeout_ms = 10000,
 	.use_bounce_buf = false,
 	.buf_len = 0,
-	.num_channels = ARRAY_SIZE(ath12k_mhi_channels_qcn9274),
-	.ch_cfg = ath12k_mhi_channels_qcn9274,
-	.num_events = ARRAY_SIZE(ath12k_mhi_events_qcn9274),
-	.event_cfg = ath12k_mhi_events_qcn9274,
+	.num_channels = ARRAY_SIZE(ath12k_wifi7_mhi_channels_qcn9274),
+	.ch_cfg = ath12k_wifi7_mhi_channels_qcn9274,
+	.num_events = ARRAY_SIZE(ath12k_wifi7_mhi_events_qcn9274),
+	.event_cfg = ath12k_wifi7_mhi_events_qcn9274,
 };
 
-static const struct mhi_channel_config ath12k_mhi_channels_wcn7850[] = {
+static const struct mhi_channel_config ath12k_wifi7_mhi_channels_wcn7850[] = {
 	{
 		.num = 20,
 		.name = "IPCR",
@@ -103,7 +103,7 @@ static const struct mhi_channel_config ath12k_mhi_channels_wcn7850[] = {
 	},
 };
 
-static struct mhi_event_config ath12k_mhi_events_wcn7850[] = {
+static struct mhi_event_config ath12k_wifi7_mhi_events_wcn7850[] = {
 	{
 		.num_elements = 32,
 		.irq_moderation_ms = 0,
@@ -126,13 +126,13 @@ static struct mhi_event_config ath12k_mhi_events_wcn7850[] = {
 	},
 };
 
-const struct mhi_controller_config ath12k_mhi_config_wcn7850 = {
+const struct mhi_controller_config ath12k_wifi7_mhi_config_wcn7850 = {
 	.max_channels = 128,
 	.timeout_ms = 2000,
 	.use_bounce_buf = false,
 	.buf_len = 8192,
-	.num_channels = ARRAY_SIZE(ath12k_mhi_channels_wcn7850),
-	.ch_cfg = ath12k_mhi_channels_wcn7850,
-	.num_events = ARRAY_SIZE(ath12k_mhi_events_wcn7850),
-	.event_cfg = ath12k_mhi_events_wcn7850,
+	.num_channels = ARRAY_SIZE(ath12k_wifi7_mhi_channels_wcn7850),
+	.ch_cfg = ath12k_wifi7_mhi_channels_wcn7850,
+	.num_events = ARRAY_SIZE(ath12k_wifi7_mhi_events_wcn7850),
+	.event_cfg = ath12k_wifi7_mhi_events_wcn7850,
 };
diff --git a/drivers/net/wireless/ath/ath12k/wifi7/mhi.h b/drivers/net/wireless/ath/ath12k/wifi7/mhi.h
index 8417a2bde0877d9a377c8dd4befc24a042f3b629..2e2dd3503d830ae0e63a7d78b17bee2ac908e039 100644
--- a/drivers/net/wireless/ath/ath12k/wifi7/mhi.h
+++ b/drivers/net/wireless/ath/ath12k/wifi7/mhi.h
@@ -6,6 +6,6 @@
 
 #ifndef _ATH12K_WIFI7_MHI_H
 #define _ATH12K_WIFI7_MHI_H
-extern const struct mhi_controller_config ath12k_mhi_config_qcn9274;
-extern const struct mhi_controller_config ath12k_mhi_config_wcn7850;
+extern const struct mhi_controller_config ath12k_wifi7_mhi_config_qcn9274;
+extern const struct mhi_controller_config ath12k_wifi7_mhi_config_wcn7850;
 #endif /* _ATH12K_WIFI7_MHI_H */
diff --git a/drivers/net/wireless/ath/ath12k/wifi7/pci.c b/drivers/net/wireless/ath/ath12k/wifi7/pci.c
index 01a0b42f0e808a7aab656b88816f2f93a8d4da5e..608669a83ea7561b9a464f44b8dae14500d0a1d9 100644
--- a/drivers/net/wireless/ath/ath12k/wifi7/pci.c
+++ b/drivers/net/wireless/ath/ath12k/wifi7/pci.c
@@ -12,6 +12,7 @@
 #include "../hif.h"
 #include "../mhi.h"
 #include "hw.h"
+#include "../hal.h"
 
 #define QCN9274_DEVICE_ID		0x1109
 #define WCN7850_DEVICE_ID		0x1107
@@ -44,7 +45,7 @@ static const struct ath12k_msi_config ath12k_wifi7_msi_config[] = {
 	},
 };
 
-static const struct ath12k_pci_ops ath12k_pci_ops_qcn9274 = {
+static const struct ath12k_pci_ops ath12k_wifi7_pci_ops_qcn9274 = {
 	.wakeup = NULL,
 	.release = NULL,
 };
@@ -63,7 +64,7 @@ static void ath12k_wifi7_pci_bus_release(struct ath12k_base *ab)
 	mhi_device_put(ab_pci->mhi_ctrl->mhi_dev);
 }
 
-static const struct ath12k_pci_ops ath12k_pci_ops_wcn7850 = {
+static const struct ath12k_pci_ops ath12k_wifi7_pci_ops_wcn7850 = {
 	.wakeup = ath12k_wifi7_pci_bus_wake_up,
 	.release = ath12k_wifi7_pci_bus_release,
 };
@@ -99,7 +100,7 @@ static int ath12k_wifi7_pci_probe(struct pci_dev *pdev,
 	case QCN9274_DEVICE_ID:
 		ab_pci->msi_config = &ath12k_wifi7_msi_config[0];
 		ab->static_window_map = true;
-		ab_pci->pci_ops = &ath12k_pci_ops_qcn9274;
+		ab_pci->pci_ops = &ath12k_wifi7_pci_ops_qcn9274;
 		ab->hal_rx_ops = &hal_rx_qcn9274_ops;
 		ath12k_wifi7_pci_read_hw_version(ab, &soc_hw_version_major,
 						 &soc_hw_version_minor);
@@ -122,7 +123,7 @@ static int ath12k_wifi7_pci_probe(struct pci_dev *pdev,
 		ab->id.bdf_search = ATH12K_BDF_SEARCH_BUS_AND_BOARD;
 		ab_pci->msi_config = &ath12k_wifi7_msi_config[0];
 		ab->static_window_map = false;
-		ab_pci->pci_ops = &ath12k_pci_ops_wcn7850;
+		ab_pci->pci_ops = &ath12k_wifi7_pci_ops_wcn7850;
 		ab->hal_rx_ops = &hal_rx_wcn7850_ops;
 		ath12k_wifi7_pci_read_hw_version(ab, &soc_hw_version_major,
 						 &soc_hw_version_minor);
@@ -154,7 +155,7 @@ static int ath12k_wifi7_pci_probe(struct pci_dev *pdev,
 	return 0;
 }
 
-static struct ath12k_pci_driver ath12k_pci_wifi7_driver = {
+static struct ath12k_pci_driver ath12k_wifi7_pci_driver = {
 	.name = "ath12k_wifi7_pci",
 	.id_table = ath12k_wifi7_pci_id_table,
 	.ops.probe = ath12k_wifi7_pci_probe,
@@ -165,7 +166,7 @@ int ath12k_wifi7_pci_init(void)
 	int ret;
 
 	ret = ath12k_pci_register_driver(ATH12K_DEVICE_FAMILY_WIFI7,
-					 &ath12k_pci_wifi7_driver);
+					 &ath12k_wifi7_pci_driver);
 	if (ret) {
 		pr_err("Failed to register ath12k Wi-Fi 7 driver: %d\n",
 		       ret);
diff --git a/drivers/net/wireless/ath/ath12k/wifi7/wmi.c b/drivers/net/wireless/ath/ath12k/wifi7/wmi.c
index 652c353f9fc586ae05fa276ebbb99b9a65a5a7c1..c575b44a33f3b7931eb7109ce18954a3e3382dc2 100644
--- a/drivers/net/wireless/ath/ath12k/wifi7/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wifi7/wmi.c
@@ -7,8 +7,8 @@
 #include "../core.h"
 #include "wmi.h"
 
-void ath12k_wmi_init_qcn9274(struct ath12k_base *ab,
-			     struct ath12k_wmi_resource_config_arg *config)
+void ath12k_wifi7_wmi_init_qcn9274(struct ath12k_base *ab,
+				   struct ath12k_wmi_resource_config_arg *config)
 {
 	config->num_vdevs = ab->num_radios * TARGET_NUM_VDEVS(ab);
 	config->num_peers = ab->num_radios *
@@ -58,8 +58,8 @@ void ath12k_wmi_init_qcn9274(struct ath12k_base *ab,
 		config->peer_metadata_ver = ATH12K_PEER_METADATA_V1B;
 }
 
-void ath12k_wmi_init_wcn7850(struct ath12k_base *ab,
-			     struct ath12k_wmi_resource_config_arg *config)
+void ath12k_wifi7_wmi_init_wcn7850(struct ath12k_base *ab,
+				   struct ath12k_wmi_resource_config_arg *config)
 {
 	config->num_vdevs = 4;
 	config->num_peers = 16;
diff --git a/drivers/net/wireless/ath/ath12k/wifi7/wmi.h b/drivers/net/wireless/ath/ath12k/wifi7/wmi.h
index 1514e3e8d4cb65d3d95d95a1c1593a7b66abcf58..ae74e176fa2d3f670970a2f3a661c3b6a34242aa 100644
--- a/drivers/net/wireless/ath/ath12k/wifi7/wmi.h
+++ b/drivers/net/wireless/ath/ath12k/wifi7/wmi.h
@@ -7,9 +7,9 @@
 #ifndef ATH12K_WMI_WIFI7_H
 #define ATH12K_WMI_WIFI7_H
 
-void ath12k_wmi_init_qcn9274(struct ath12k_base *ab,
-			     struct ath12k_wmi_resource_config_arg *config);
-void ath12k_wmi_init_wcn7850(struct ath12k_base *ab,
-			     struct ath12k_wmi_resource_config_arg *config);
+void ath12k_wifi7_wmi_init_qcn9274(struct ath12k_base *ab,
+				   struct ath12k_wmi_resource_config_arg *config);
+void ath12k_wifi7_wmi_init_wcn7850(struct ath12k_base *ab,
+				   struct ath12k_wmi_resource_config_arg *config);
 
 #endif

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH ath12k-ng 12/13] wifi: ath12k: Remove HAL defines from shared PCI code
  2025-08-12 17:09 [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Kiran Venkatappa
                   ` (10 preceding siblings ...)
  2025-08-12 17:09 ` [PATCH ath12k-ng 11/13] wifi: ath12k: Rename ath12k_* symbols to ath12k_wifi7_* for clarity Kiran Venkatappa
@ 2025-08-12 17:09 ` Kiran Venkatappa
  2025-08-12 17:09 ` [PATCH ath12k-ng 13/13] wifi: ath12k: Remove HAL define dependencies from shared AHB code Kiran Venkatappa
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Kiran Venkatappa @ 2025-08-12 17:09 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless

Eliminate use of HAL-specific defines in the shared PCI implementation.
Pass required register offsets during PCI registration and store them in
the PCI context structure. Access offsets directly from the context to
improve modularity and remove hardware-specific dependencies in the
common code path.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Signed-off-by: Kiran Venkatappa <quic_kiranv@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/pci.c       | 12 ++++++++----
 drivers/net/wireless/ath/ath12k/pci.h       |  7 +++++++
 drivers/net/wireless/ath/ath12k/wifi7/pci.c |  6 ++++++
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c
index fbe6359ec74cf121d2d08d94297585eaa423d5ad..72bcaab6f5420945d79bc2bf2adc8afe57b563ac 100644
--- a/drivers/net/wireless/ath/ath12k/pci.c
+++ b/drivers/net/wireless/ath/ath12k/pci.c
@@ -132,10 +132,12 @@ static void ath12k_pci_select_window(struct ath12k_pci *ab_pci, u32 offset)
 
 static void ath12k_pci_select_static_window(struct ath12k_pci *ab_pci)
 {
-	u32 umac_window = u32_get_bits(HAL_SEQ_WCSS_UMAC_OFFSET, WINDOW_VALUE_MASK);
-	u32 ce_window = u32_get_bits(HAL_CE_WFSS_CE_REG_BASE, WINDOW_VALUE_MASK);
+	u32 umac_window;
+	u32 ce_window;
 	u32 window;
 
+	umac_window = u32_get_bits(ab_pci->reg_base->umac_base, WINDOW_VALUE_MASK);
+	ce_window = u32_get_bits(ab_pci->reg_base->ce_reg_base, WINDOW_VALUE_MASK);
 	window = (umac_window << 12) | (ce_window << 6);
 
 	spin_lock_bh(&ab_pci->window_lock);
@@ -148,13 +150,14 @@ static void ath12k_pci_select_static_window(struct ath12k_pci *ab_pci)
 static u32 ath12k_pci_get_window_start(struct ath12k_base *ab,
 				       u32 offset)
 {
+	struct ath12k_pci *ab_pci = ath12k_pci_priv(ab);
 	u32 window_start;
 
 	/* If offset lies within DP register range, use 3rd window */
-	if ((offset ^ HAL_SEQ_WCSS_UMAC_OFFSET) < WINDOW_RANGE_MASK)
+	if ((offset ^ ab_pci->reg_base->umac_base) < WINDOW_RANGE_MASK)
 		window_start = 3 * WINDOW_START;
 	/* If offset lies within CE register range, use 2nd window */
-	else if ((offset ^ HAL_CE_WFSS_CE_REG_BASE) < WINDOW_RANGE_MASK)
+	else if ((offset ^ ab_pci->reg_base->ce_reg_base) < WINDOW_RANGE_MASK)
 		window_start = 2 * WINDOW_START;
 	else
 		window_start = WINDOW_START;
@@ -1553,6 +1556,7 @@ static int ath12k_pci_probe(struct pci_dev *pdev,
 	ath12k_dbg(ab, ATH12K_DBG_PCI, "PCI device family id: %d\n", device_id);
 
 	ab_pci->device_family_ops = &ath12k_pci_family_drivers[device_id]->ops;
+	ab_pci->reg_base = ath12k_pci_family_drivers[device_id]->reg_base;
 
 	/* Call device specific probe. This is the callback that can
 	 * be used to override any ops in future
diff --git a/drivers/net/wireless/ath/ath12k/pci.h b/drivers/net/wireless/ath/ath12k/pci.h
index 1b7ecc329a017cafa84780f3f6e634163ead59bb..5af33e5deacfd8acfc62afc17cb9e63d74df23d5 100644
--- a/drivers/net/wireless/ath/ath12k/pci.h
+++ b/drivers/net/wireless/ath/ath12k/pci.h
@@ -99,6 +99,11 @@ struct ath12k_pci_device_family_ops {
 	int (*probe)(struct pci_dev *pdev, const struct pci_device_id *pci_dev);
 };
 
+struct ath12k_pci_reg_base {
+	u32 umac_base;
+	u32 ce_reg_base;
+};
+
 struct ath12k_pci {
 	struct pci_dev *pdev;
 	struct ath12k_base *ab;
@@ -122,6 +127,7 @@ struct ath12k_pci {
 	u32 qmi_instance;
 	u64 dma_mask;
 	const struct ath12k_pci_device_family_ops *device_family_ops;
+	const struct ath12k_pci_reg_base *reg_base;
 };
 
 struct ath12k_pci_driver {
@@ -129,6 +135,7 @@ struct ath12k_pci_driver {
 	const struct pci_device_id *id_table;
 	struct ath12k_pci_device_family_ops ops;
 	struct pci_driver driver;
+	const struct ath12k_pci_reg_base *reg_base;
 };
 
 static inline struct ath12k_pci *ath12k_pci_priv(struct ath12k_base *ab)
diff --git a/drivers/net/wireless/ath/ath12k/wifi7/pci.c b/drivers/net/wireless/ath/ath12k/wifi7/pci.c
index 608669a83ea7561b9a464f44b8dae14500d0a1d9..9b1acf6c7aa3121a53358a72a51aa21ead572a09 100644
--- a/drivers/net/wireless/ath/ath12k/wifi7/pci.c
+++ b/drivers/net/wireless/ath/ath12k/wifi7/pci.c
@@ -155,10 +155,16 @@ static int ath12k_wifi7_pci_probe(struct pci_dev *pdev,
 	return 0;
 }
 
+static const struct ath12k_pci_reg_base ath12k_wifi7_reg_base = {
+	.umac_base = HAL_SEQ_WCSS_UMAC_OFFSET,
+	.ce_reg_base = HAL_CE_WFSS_CE_REG_BASE,
+};
+
 static struct ath12k_pci_driver ath12k_wifi7_pci_driver = {
 	.name = "ath12k_wifi7_pci",
 	.id_table = ath12k_wifi7_pci_id_table,
 	.ops.probe = ath12k_wifi7_pci_probe,
+	.reg_base = &ath12k_wifi7_reg_base,
 };
 
 int ath12k_wifi7_pci_init(void)

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH ath12k-ng 13/13] wifi: ath12k: Remove HAL define dependencies from shared AHB code
  2025-08-12 17:09 [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Kiran Venkatappa
                   ` (11 preceding siblings ...)
  2025-08-12 17:09 ` [PATCH ath12k-ng 12/13] wifi: ath12k: Remove HAL defines from shared PCI code Kiran Venkatappa
@ 2025-08-12 17:09 ` Kiran Venkatappa
  2025-08-20  4:50 ` [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Vasanthakumar Thiagarajan
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 25+ messages in thread
From: Kiran Venkatappa @ 2025-08-12 17:09 UTC (permalink / raw)
  To: ath12k; +Cc: linux-wireless

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>
---
 drivers/net/wireless/ath/ath12k/ahb.c      | 7 ++++---
 drivers/net/wireless/ath/ath12k/ce.h       | 1 +
 drivers/net/wireless/ath/ath12k/core.h     | 1 +
 drivers/net/wireless/ath/ath12k/wifi7/hw.c | 1 +
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/ahb.c b/drivers/net/wireless/ath/ath12k/ahb.c
index 41ef5170556e9255337b26ec3565ab25f50adc65..efb0ef609dcfab307b942798b901fb7f2b85e7d7 100644
--- a/drivers/net/wireless/ath/ath12k/ahb.c
+++ b/drivers/net/wireless/ath/ath12k/ahb.c
@@ -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");
diff --git a/drivers/net/wireless/ath/ath12k/ce.h b/drivers/net/wireless/ath/ath12k/ce.h
index f44ce2244bcfdb60d505d51096ed70b3965952c9..38f986ea1cd2bf6e7739ca939a3db66644c4ac77 100644
--- a/drivers/net/wireless/ath/ath12k/ce.h
+++ b/drivers/net/wireless/ath/ath12k/ce.h
@@ -85,6 +85,7 @@ struct ce_ie_addr {
 struct ce_remap {
 	u32 base;
 	u32 size;
+	u32 cmem_offset;
 };
 
 struct ce_attr {
diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
index fa04aaa836fcba9d647b2127651cb366046e2e73..3c4a8f834b70ffe1005e761aabbb966c30cb8ff0 100644
--- a/drivers/net/wireless/ath/ath12k/core.h
+++ b/drivers/net/wireless/ath/ath12k/core.h
@@ -1060,6 +1060,7 @@ struct ath12k_base {
 
 	void __iomem *mem_ce;
 	u32 ce_remap_base_addr;
+	u32 cmem_offset;
 	bool ce_remap;
 
 	struct {
diff --git a/drivers/net/wireless/ath/ath12k/wifi7/hw.c b/drivers/net/wireless/ath/ath12k/wifi7/hw.c
index 9995eccd32d39f69191f0308b67d35ed3501ebf9..82b4f5b9f570076e3ca64dec7b866e1d88787789 100644
--- a/drivers/net/wireless/ath/ath12k/wifi7/hw.c
+++ b/drivers/net/wireless/ath/ath12k/wifi7/hw.c
@@ -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[] = {

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH ath12k-ng 03/13] wifi: ath12k: Move Wi-Fi 7 WMI configuration to dedicated file
  2025-08-12 17:09 ` [PATCH ath12k-ng 03/13] wifi: ath12k: Move Wi-Fi 7 WMI configuration to dedicated file Kiran Venkatappa
@ 2025-08-13  5:52   ` Krzysztof Kozlowski
  2025-08-13 15:43     ` Jeff Johnson
  0 siblings, 1 reply; 25+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-13  5:52 UTC (permalink / raw)
  To: Kiran Venkatappa, ath12k; +Cc: linux-wireless

On 12/08/2025 19:09, Kiran Venkatappa wrote:
> +}
> diff --git a/drivers/net/wireless/ath/ath12k/wmi_wifi7.h b/drivers/net/wireless/ath/ath12k/wmi_wifi7.h
> new file mode 100644
> index 0000000000000000000000000000000000000000..1514e3e8d4cb65d3d95d95a1c1593a7b66abcf58
> --- /dev/null
> +++ b/drivers/net/wireless/ath/ath12k/wmi_wifi7.h
> @@ -0,0 +1,15 @@
> +/* 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.

Don't rewrite the copyrights. Original file had different one. GPL FAQ
also EXPLICITLY asks for date in copyrights and does not allow one
without the date.

(and before you bring internal qcom regulations, let me remind that they
do not matter. we discussed this in other thread)

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH ath12k-ng 04/13] wifi: ath12k: Move Wi-Fi 7 MHI configuration to dedicated file
  2025-08-12 17:09 ` [PATCH ath12k-ng 04/13] wifi: ath12k: Move Wi-Fi 7 MHI " Kiran Venkatappa
@ 2025-08-13  5:52   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 25+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-13  5:52 UTC (permalink / raw)
  To: Kiran Venkatappa, ath12k; +Cc: linux-wireless

On 12/08/2025 19:09, Kiran Venkatappa wrote:
> diff --git a/drivers/net/wireless/ath/ath12k/mhi_wifi7.c b/drivers/net/wireless/ath/ath12k/mhi_wifi7.c
> new file mode 100644
> index 0000000000000000000000000000000000000000..be74df152f6f88c1c723459a1cdea21f45b0d15b
> --- /dev/null
> +++ b/drivers/net/wireless/ath/ath12k/mhi_wifi7.c
> @@ -0,0 +1,138 @@
> +// SPDX-License-Identifier: BSD-3-Clause-Clear
> +/*
> + * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved.
> + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.

Stop rewriting copyrights when you move EXISTING code!

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH ath12k-ng 03/13] wifi: ath12k: Move Wi-Fi 7 WMI configuration to dedicated file
  2025-08-13  5:52   ` Krzysztof Kozlowski
@ 2025-08-13 15:43     ` Jeff Johnson
  2025-08-13 16:00       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 25+ messages in thread
From: Jeff Johnson @ 2025-08-13 15:43 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Kiran Venkatappa, ath12k; +Cc: linux-wireless

On 8/12/2025 10:52 PM, Krzysztof Kozlowski wrote:
> On 12/08/2025 19:09, Kiran Venkatappa wrote:
>> +}
>> diff --git a/drivers/net/wireless/ath/ath12k/wmi_wifi7.h b/drivers/net/wireless/ath/ath12k/wmi_wifi7.h
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..1514e3e8d4cb65d3d95d95a1c1593a7b66abcf58
>> --- /dev/null
>> +++ b/drivers/net/wireless/ath/ath12k/wmi_wifi7.h
>> @@ -0,0 +1,15 @@
>> +/* 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.
> 
> Don't rewrite the copyrights. Original file had different one. GPL FAQ
> also EXPLICITLY asks for date in copyrights and does not allow one
> without the date.
> 
> (and before you bring internal qcom regulations, let me remind that they
> do not matter. we discussed this in other thread)

Wi-Fi team wasn't party to the other thread, and this series was following the
legal guidance we were given. I'm circling with the core kernel team and the
legal team to make sure your concerns are resolved.

/jeff

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH ath12k-ng 03/13] wifi: ath12k: Move Wi-Fi 7 WMI configuration to dedicated file
  2025-08-13 15:43     ` Jeff Johnson
@ 2025-08-13 16:00       ` Krzysztof Kozlowski
  2025-08-13 16:24         ` Greg Kroah-Hartman
  0 siblings, 1 reply; 25+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-13 16:00 UTC (permalink / raw)
  To: Jeff Johnson, Kiran Venkatappa, ath12k, Greg Kroah-Hartman; +Cc: linux-wireless

On 13/08/2025 17:43, Jeff Johnson wrote:
> On 8/12/2025 10:52 PM, Krzysztof Kozlowski wrote:
>> On 12/08/2025 19:09, Kiran Venkatappa wrote:
>>> +}
>>> diff --git a/drivers/net/wireless/ath/ath12k/wmi_wifi7.h b/drivers/net/wireless/ath/ath12k/wmi_wifi7.h
>>> new file mode 100644
>>> index 0000000000000000000000000000000000000000..1514e3e8d4cb65d3d95d95a1c1593a7b66abcf58
>>> --- /dev/null
>>> +++ b/drivers/net/wireless/ath/ath12k/wmi_wifi7.h
>>> @@ -0,0 +1,15 @@
>>> +/* 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.
>>
>> Don't rewrite the copyrights. Original file had different one. GPL FAQ
>> also EXPLICITLY asks for date in copyrights and does not allow one
>> without the date.
>>
>> (and before you bring internal qcom regulations, let me remind that they
>> do not matter. we discussed this in other thread)
> 
> Wi-Fi team wasn't party to the other thread, and this series was following the
> legal guidance we were given. I'm circling with the core kernel team and the
> legal team to make sure your concerns are resolved.

+Cc Greg,

Please follow legal guidance expressed in:
https://www.gnu.org/licenses/gpl-howto.en.html#copyright-notice

and the license you agreed by signing of the patch:
LICENSES/preferred/GPL-2.0:

"Copyright (C) <year>  <name of author> "
...
"... publish on each copy an appropriate
copyright notice and disclaimer of warranty;"

Just to remind - you as author sign off your patch, not your legal team.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH ath12k-ng 03/13] wifi: ath12k: Move Wi-Fi 7 WMI configuration to dedicated file
  2025-08-13 16:00       ` Krzysztof Kozlowski
@ 2025-08-13 16:24         ` Greg Kroah-Hartman
  2025-08-13 18:06           ` Jeff Johnson
  0 siblings, 1 reply; 25+ messages in thread
From: Greg Kroah-Hartman @ 2025-08-13 16:24 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jeff Johnson, Kiran Venkatappa, ath12k, linux-wireless

On Wed, Aug 13, 2025 at 06:00:44PM +0200, Krzysztof Kozlowski wrote:
> On 13/08/2025 17:43, Jeff Johnson wrote:
> > On 8/12/2025 10:52 PM, Krzysztof Kozlowski wrote:
> >> On 12/08/2025 19:09, Kiran Venkatappa wrote:
> >>> +}
> >>> diff --git a/drivers/net/wireless/ath/ath12k/wmi_wifi7.h b/drivers/net/wireless/ath/ath12k/wmi_wifi7.h
> >>> new file mode 100644
> >>> index 0000000000000000000000000000000000000000..1514e3e8d4cb65d3d95d95a1c1593a7b66abcf58
> >>> --- /dev/null
> >>> +++ b/drivers/net/wireless/ath/ath12k/wmi_wifi7.h
> >>> @@ -0,0 +1,15 @@
> >>> +/* 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.
> >>
> >> Don't rewrite the copyrights. Original file had different one. GPL FAQ
> >> also EXPLICITLY asks for date in copyrights and does not allow one
> >> without the date.
> >>
> >> (and before you bring internal qcom regulations, let me remind that they
> >> do not matter. we discussed this in other thread)
> > 
> > Wi-Fi team wasn't party to the other thread, and this series was following the
> > legal guidance we were given. I'm circling with the core kernel team and the
> > legal team to make sure your concerns are resolved.
> 
> +Cc Greg,

Oops, I just responded to this issue elsewhere.

> Please follow legal guidance expressed in:
> https://www.gnu.org/licenses/gpl-howto.en.html#copyright-notice
> 
> and the license you agreed by signing of the patch:
> LICENSES/preferred/GPL-2.0:
> 
> "Copyright (C) <year>  <name of author> "
> ...
> "... publish on each copy an appropriate
> copyright notice and disclaimer of warranty;"

Nope, we do NOT force the FSF's legal intrepretation of copyright marks
on any company at all.  It's up to the copyright holders themselves for
how they wish to mark the copyright, if at all.

And really, Qualcomm is a company that is run by lawyers, they know what
they want to do for whatever reason that might be...

> Just to remind - you as author sign off your patch, not your legal team.

Agreed, but in some cases, I have forced legal teams to sign off on
patches, so don't rule that out :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH ath12k-ng 03/13] wifi: ath12k: Move Wi-Fi 7 WMI configuration to dedicated file
  2025-08-13 16:24         ` Greg Kroah-Hartman
@ 2025-08-13 18:06           ` Jeff Johnson
  0 siblings, 0 replies; 25+ messages in thread
From: Jeff Johnson @ 2025-08-13 18:06 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Krzysztof Kozlowski
  Cc: Kiran Venkatappa, ath12k, linux-wireless

On 8/13/2025 9:24 AM, Greg Kroah-Hartman wrote:
> On Wed, Aug 13, 2025 at 06:00:44PM +0200, Krzysztof Kozlowski wrote:
>> On 13/08/2025 17:43, Jeff Johnson wrote:
>>> On 8/12/2025 10:52 PM, Krzysztof Kozlowski wrote:
>>>> On 12/08/2025 19:09, Kiran Venkatappa wrote:
>>>>> +}
>>>>> diff --git a/drivers/net/wireless/ath/ath12k/wmi_wifi7.h b/drivers/net/wireless/ath/ath12k/wmi_wifi7.h
>>>>> new file mode 100644
>>>>> index 0000000000000000000000000000000000000000..1514e3e8d4cb65d3d95d95a1c1593a7b66abcf58
>>>>> --- /dev/null
>>>>> +++ b/drivers/net/wireless/ath/ath12k/wmi_wifi7.h
>>>>> @@ -0,0 +1,15 @@
>>>>> +/* 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.
>>>>
>>>> Don't rewrite the copyrights. Original file had different one. GPL FAQ
>>>> also EXPLICITLY asks for date in copyrights and does not allow one
>>>> without the date.
>>>>
>>>> (and before you bring internal qcom regulations, let me remind that they
>>>> do not matter. we discussed this in other thread)
>>>
>>> Wi-Fi team wasn't party to the other thread, and this series was following the
>>> legal guidance we were given. I'm circling with the core kernel team and the
>>> legal team to make sure your concerns are resolved.
>>
>> +Cc Greg,
> 
> Oops, I just responded to this issue elsewhere.
> 
>> Please follow legal guidance expressed in:
>> https://www.gnu.org/licenses/gpl-howto.en.html#copyright-notice
>>
>> and the license you agreed by signing of the patch:
>> LICENSES/preferred/GPL-2.0:
>>
>> "Copyright (C) <year>  <name of author> "
>> ...
>> "... publish on each copy an appropriate
>> copyright notice and disclaimer of warranty;"
> 
> Nope, we do NOT force the FSF's legal intrepretation of copyright marks
> on any company at all.  It's up to the copyright holders themselves for
> how they wish to mark the copyright, if at all.
> 
> And really, Qualcomm is a company that is run by lawyers, they know what
> they want to do for whatever reason that might be...
> 
>> Just to remind - you as author sign off your patch, not your legal team.
> 
> Agreed, but in some cases, I have forced legal teams to sign off on
> patches, so don't rule that out :)

Thanks for the clarification, Greg.

Just for reference, the guidance we received follows. In that guidance:
- LF means Linux Foundation, the entity to which Qualcomm assigned copyright
when open source development was being done as Code Aurora Forum (though
December 2021)
- QuIC means Qualcomm Innovation Center, the open source entity used from
December 2021 until March 2025.
- QTI means Qualcomm Technologies, Inc., the entity now being used for open
source contributions.

Guidance:
1. Should existing QuIC copyright be left alone or absorbed into the added QTI
copyright text?
Yes, all QuIC copyright years should be absorbed. Replace the QuIC copyrights
with the QTI copyright. Leave LF and other 3rd party copyrights alone.

2. When we are creating new file in open source, if it is copied/derived from
existing QUIC authored open source file, should we retain the QUIC markings?
No, the QuIC copyright years should be absorbed into the year-less QTI copyright.

3. Is there any use case where we MUST keep the QuIC copyright?
No, all projects can move to using QTI copyright.

/jeff

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes
  2025-08-12 17:09 [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Kiran Venkatappa
                   ` (12 preceding siblings ...)
  2025-08-12 17:09 ` [PATCH ath12k-ng 13/13] wifi: ath12k: Remove HAL define dependencies from shared AHB code Kiran Venkatappa
@ 2025-08-20  4:50 ` Vasanthakumar Thiagarajan
  2025-08-20  7:11 ` Baochen Qiang
  2025-08-20 21:44 ` Jeff Johnson
  15 siblings, 0 replies; 25+ messages in thread
From: Vasanthakumar Thiagarajan @ 2025-08-20  4:50 UTC (permalink / raw)
  To: Kiran Venkatappa, ath12k; +Cc: linux-wireless



On 8/12/2025 10:39 PM, Kiran Venkatappa wrote:
> Current ath drivers have separate implementations for different
> classes of devices. For example, ath11k supports WiFi-6 devices,
> while ath12k supports Wi-Fi 7 devices. However, there is significant
> common functionality across these generations due to shared firmware
> and hardware architecture. In the existing driver code, this leverage
> is achieved through code duplication. As a result, when a new driver
> is introduced, many features are missed, and new additions require
> porting across different generation drivers.
> 
> To improve reuse and maintainability, ath12k should be split into common
> and device-specific modules. Common code can be shared across multiple
> architectures, enabling better leverage for future hardware generations.
> generation drivers.
> 
> Firmware interfaces and core initialization sequences are typically common
> across different device families. In contrast, hardware register offsets, copy
> engine mappings, and HAL configurations are usually hardware-specific.
> 
> Common components include:
>        - mac80211 interface: Control path operations are mostly common across
>          different ATH hardware and will be shared as much as possible.
>        - Firmware interface (WMI, HTT, HTC, QMI): Firmware messaging and
>          sequences are common and maintained with backward/forward compatibility
>          using TLVs.
>        - Datapath: Data path files are also separated similarly. More information
>          will be provided in later patches.
>        - Core initialization, reset, and recovery sequences: These will be part
>          of the shared code.
> 
> Device-specific code includes:
>        - Hardware capabilities, configurations, HAL, and other
>          architecture-specific logic.
> 
> The original ath12k.ko is split into these two modules as depicted below.
> 
>                                        +-----------------+
>                                        |                 |
>                                        |   ath12k.ko     |
>                                        |    (common)     |
>      +---------------+                 |                 |
>      |               |                 +-----------------+
>      |   ath12k.ko   | ===========>
>      |               |                 +------------------+
>      +---------------+                 |                  |
>                                        | ath12k_wifi7.ko  |
>                                        | (wifi7 family)   |
>                                        |                  |
>                                        +------------------+
> 
> The ath12k.ko module will serve as the common component, while ath12k_wifi7.ko
> will be the architecture-specific module for WiFi-7 devices.
> 
> After this modular separation, adding support for a new device will
> primarily involve implementing device-specific code, while reusing the
> majority of the shared common components.
> 
> ---
> Kiran Venkatappa (13):
>        wifi: ath12k: Restructure PCI code to common and Wi-Fi 7 specific logic
>        wifi: ath12k: Move Copy Engine configuration to Wi-Fi 7 specific file
>        wifi: ath12k: Move Wi-Fi 7 WMI configuration to dedicated file
>        wifi: ath12k: Move Wi-Fi 7 MHI configuration to dedicated file
>        wifi: ath12k: Rename hw.c to Wi-Fi 7 specific implementation file
>        wifi: ath12k: Rename ahb_hif_ops to reflect generic usage
>        wifi: ath12k: Restructure ahb.c into common and Wi-Fi 7 specific modules
>        wifi: ath12k: Move Wi-Fi 7 specific init routines to dedicated file
>        wifi: ath12k: Move hw_init invocation to target-specific probe
>        wifi: ath12k: Modularize driver into common and Wi-Fi 7 specific components
>        wifi: ath12k: Rename ath12k_* symbols to ath12k_wifi7_* for clarity
>        wifi: ath12k: Remove HAL defines from shared PCI code
>        wifi: ath12k: Remove HAL define dependencies from shared AHB code
>   
>   drivers/net/wireless/ath/ath12k/Makefile         |   4 +-
>   drivers/net/wireless/ath/ath12k/ahb.c            | 139 ++--
>   drivers/net/wireless/ath/ath12k/ahb.h            |  27 +-
>   drivers/net/wireless/ath/ath12k/ce.c             | 301 -------
>   drivers/net/wireless/ath/ath12k/ce.h             |   5 +-
>   drivers/net/wireless/ath/ath12k/core.c           |  38 +-
>   drivers/net/wireless/ath/ath12k/core.h           |   7 +
>   drivers/net/wireless/ath/ath12k/debug.c          |   4 +
>   drivers/net/wireless/ath/ath12k/dp_rx.c          |   3 +
>   drivers/net/wireless/ath/ath12k/hal.c            |   4 +
>   drivers/net/wireless/ath/ath12k/htc.c            |   2 +
>   drivers/net/wireless/ath/ath12k/hw.h             |   2 -
>   drivers/net/wireless/ath/ath12k/mhi.c            | 130 ---
>   drivers/net/wireless/ath/ath12k/mhi.h            |   4 +-
>   drivers/net/wireless/ath/ath12k/pci.c            | 215 ++---
>   drivers/net/wireless/ath/ath12k/pci.h            |  28 +-
>   drivers/net/wireless/ath/ath12k/peer.c           |   2 +
>   drivers/net/wireless/ath/ath12k/wifi7/Makefile   |  10 +
>   drivers/net/wireless/ath/ath12k/wifi7/ahb.c      |  71 ++
>   drivers/net/wireless/ath/ath12k/wifi7/ahb.h      |  20 +
>   drivers/net/wireless/ath/ath12k/wifi7/ce.c       | 973 +++++++++++++++++++++++
>   drivers/net/wireless/ath/ath12k/wifi7/ce.h       |  22 +
>   drivers/net/wireless/ath/ath12k/wifi7/core.c     |  44 +
>   drivers/net/wireless/ath/ath12k/{ => wifi7}/hw.c | 798 +++----------------
>   drivers/net/wireless/ath/ath12k/wifi7/hw.h       |  13 +
>   drivers/net/wireless/ath/ath12k/wifi7/mhi.c      | 138 ++++
>   drivers/net/wireless/ath/ath12k/wifi7/mhi.h      |  11 +
>   drivers/net/wireless/ath/ath12k/wifi7/pci.c      | 188 +++++
>   drivers/net/wireless/ath/ath12k/wifi7/pci.h      |  12 +
>   drivers/net/wireless/ath/ath12k/wifi7/wmi.c      | 105 +++
>   drivers/net/wireless/ath/ath12k/wifi7/wmi.h      |  15 +
>   drivers/net/wireless/ath/ath12k/wmi.c            |  97 ---
>   drivers/net/wireless/ath/ath12k/wmi.h            |   4 -
>   33 files changed, 1956 insertions(+), 1480 deletions(-)

Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes
  2025-08-12 17:09 [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Kiran Venkatappa
                   ` (13 preceding siblings ...)
  2025-08-20  4:50 ` [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Vasanthakumar Thiagarajan
@ 2025-08-20  7:11 ` Baochen Qiang
  2025-08-20 20:57   ` Jeff Johnson
  2025-08-20 21:44 ` Jeff Johnson
  15 siblings, 1 reply; 25+ messages in thread
From: Baochen Qiang @ 2025-08-20  7:11 UTC (permalink / raw)
  To: Kiran Venkatappa, ath12k; +Cc: linux-wireless



On 8/13/2025 1:09 AM, Kiran Venkatappa wrote:
> Current ath drivers have separate implementations for different
> classes of devices. For example, ath11k supports WiFi-6 devices,
> while ath12k supports Wi-Fi 7 devices. However, there is significant
> common functionality across these generations due to shared firmware
> and hardware architecture. In the existing driver code, this leverage
> is achieved through code duplication. As a result, when a new driver
> is introduced, many features are missed, and new additions require
> porting across different generation drivers.
> 
> To improve reuse and maintainability, ath12k should be split into common
> and device-specific modules. Common code can be shared across multiple
> architectures, enabling better leverage for future hardware generations.
> generation drivers.
> 
> Firmware interfaces and core initialization sequences are typically common
> across different device families. In contrast, hardware register offsets, copy
> engine mappings, and HAL configurations are usually hardware-specific.
> 
> Common components include:
>       - mac80211 interface: Control path operations are mostly common across
>         different ATH hardware and will be shared as much as possible.
>       - Firmware interface (WMI, HTT, HTC, QMI): Firmware messaging and
>         sequences are common and maintained with backward/forward compatibility
>         using TLVs.
>       - Datapath: Data path files are also separated similarly. More information
>         will be provided in later patches.
>       - Core initialization, reset, and recovery sequences: These will be part
>         of the shared code.
> 
> Device-specific code includes:
>       - Hardware capabilities, configurations, HAL, and other
>         architecture-specific logic.
> 
> The original ath12k.ko is split into these two modules as depicted below.
> 
>                                       +-----------------+
>                                       |                 |
>                                       |   ath12k.ko     |
>                                       |    (common)     |
>     +---------------+                 |                 |
>     |               |                 +-----------------+
>     |   ath12k.ko   | ===========>
>     |               |                 +------------------+
>     +---------------+                 |                  |
>                                       | ath12k_wifi7.ko  |
>                                       | (wifi7 family)   |
>                                       |                  |
>                                       +------------------+
> 
> The ath12k.ko module will serve as the common component, while ath12k_wifi7.ko
> will be the architecture-specific module for WiFi-7 devices.
> 
> After this modular separation, adding support for a new device will
> primarily involve implementing device-specific code, while reusing the
> majority of the shared common components.
> 
> ---
> Kiran Venkatappa (13):
>       wifi: ath12k: Restructure PCI code to common and Wi-Fi 7 specific logic
>       wifi: ath12k: Move Copy Engine configuration to Wi-Fi 7 specific file
>       wifi: ath12k: Move Wi-Fi 7 WMI configuration to dedicated file
>       wifi: ath12k: Move Wi-Fi 7 MHI configuration to dedicated file
>       wifi: ath12k: Rename hw.c to Wi-Fi 7 specific implementation file
>       wifi: ath12k: Rename ahb_hif_ops to reflect generic usage
>       wifi: ath12k: Restructure ahb.c into common and Wi-Fi 7 specific modules
>       wifi: ath12k: Move Wi-Fi 7 specific init routines to dedicated file
>       wifi: ath12k: Move hw_init invocation to target-specific probe
>       wifi: ath12k: Modularize driver into common and Wi-Fi 7 specific components
>       wifi: ath12k: Rename ath12k_* symbols to ath12k_wifi7_* for clarity
>       wifi: ath12k: Remove HAL defines from shared PCI code
>       wifi: ath12k: Remove HAL define dependencies from shared AHB code
>  
>  drivers/net/wireless/ath/ath12k/Makefile         |   4 +-
>  drivers/net/wireless/ath/ath12k/ahb.c            | 139 ++--
>  drivers/net/wireless/ath/ath12k/ahb.h            |  27 +-
>  drivers/net/wireless/ath/ath12k/ce.c             | 301 -------
>  drivers/net/wireless/ath/ath12k/ce.h             |   5 +-
>  drivers/net/wireless/ath/ath12k/core.c           |  38 +-
>  drivers/net/wireless/ath/ath12k/core.h           |   7 +
>  drivers/net/wireless/ath/ath12k/debug.c          |   4 +
>  drivers/net/wireless/ath/ath12k/dp_rx.c          |   3 +
>  drivers/net/wireless/ath/ath12k/hal.c            |   4 +
>  drivers/net/wireless/ath/ath12k/htc.c            |   2 +
>  drivers/net/wireless/ath/ath12k/hw.h             |   2 -
>  drivers/net/wireless/ath/ath12k/mhi.c            | 130 ---
>  drivers/net/wireless/ath/ath12k/mhi.h            |   4 +-
>  drivers/net/wireless/ath/ath12k/pci.c            | 215 ++---
>  drivers/net/wireless/ath/ath12k/pci.h            |  28 +-
>  drivers/net/wireless/ath/ath12k/peer.c           |   2 +
>  drivers/net/wireless/ath/ath12k/wifi7/Makefile   |  10 +
>  drivers/net/wireless/ath/ath12k/wifi7/ahb.c      |  71 ++
>  drivers/net/wireless/ath/ath12k/wifi7/ahb.h      |  20 +
>  drivers/net/wireless/ath/ath12k/wifi7/ce.c       | 973 +++++++++++++++++++++++
>  drivers/net/wireless/ath/ath12k/wifi7/ce.h       |  22 +
>  drivers/net/wireless/ath/ath12k/wifi7/core.c     |  44 +
>  drivers/net/wireless/ath/ath12k/{ => wifi7}/hw.c | 798 +++----------------
>  drivers/net/wireless/ath/ath12k/wifi7/hw.h       |  13 +
>  drivers/net/wireless/ath/ath12k/wifi7/mhi.c      | 138 ++++
>  drivers/net/wireless/ath/ath12k/wifi7/mhi.h      |  11 +
>  drivers/net/wireless/ath/ath12k/wifi7/pci.c      | 188 +++++
>  drivers/net/wireless/ath/ath12k/wifi7/pci.h      |  12 +
>  drivers/net/wireless/ath/ath12k/wifi7/wmi.c      | 105 +++
>  drivers/net/wireless/ath/ath12k/wifi7/wmi.h      |  15 +
>  drivers/net/wireless/ath/ath12k/wmi.c            |  97 ---
>  drivers/net/wireless/ath/ath12k/wmi.h            |   4 -
>  33 files changed, 1956 insertions(+), 1480 deletions(-)
> ---
> base-commit: d9104cec3e8fe4b458b74709853231385779001f
> change-id: 20250812-ath12k-mod-bd00156df202
> 

Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>>


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes
  2025-08-20  7:11 ` Baochen Qiang
@ 2025-08-20 20:57   ` Jeff Johnson
  2025-08-21  1:46     ` Baochen Qiang
  0 siblings, 1 reply; 25+ messages in thread
From: Jeff Johnson @ 2025-08-20 20:57 UTC (permalink / raw)
  To: Baochen Qiang, Kiran Venkatappa, ath12k; +Cc: linux-wireless

On 8/20/2025 12:11 AM, Baochen Qiang wrote:
> 
> 
> On 8/13/2025 1:09 AM, Kiran Venkatappa wrote:
>> Current ath drivers have separate implementations for different
>> classes of devices. For example, ath11k supports WiFi-6 devices,
>> while ath12k supports Wi-Fi 7 devices. However, there is significant
>> common functionality across these generations due to shared firmware
>> and hardware architecture. In the existing driver code, this leverage
>> is achieved through code duplication. As a result, when a new driver
>> is introduced, many features are missed, and new additions require
>> porting across different generation drivers.
>>
>> To improve reuse and maintainability, ath12k should be split into common
>> and device-specific modules. Common code can be shared across multiple
>> architectures, enabling better leverage for future hardware generations.
>> generation drivers.
>>
>> Firmware interfaces and core initialization sequences are typically common
>> across different device families. In contrast, hardware register offsets, copy
>> engine mappings, and HAL configurations are usually hardware-specific.
>>
>> Common components include:
>>       - mac80211 interface: Control path operations are mostly common across
>>         different ATH hardware and will be shared as much as possible.
>>       - Firmware interface (WMI, HTT, HTC, QMI): Firmware messaging and
>>         sequences are common and maintained with backward/forward compatibility
>>         using TLVs.
>>       - Datapath: Data path files are also separated similarly. More information
>>         will be provided in later patches.
>>       - Core initialization, reset, and recovery sequences: These will be part
>>         of the shared code.
>>
>> Device-specific code includes:
>>       - Hardware capabilities, configurations, HAL, and other
>>         architecture-specific logic.
>>
>> The original ath12k.ko is split into these two modules as depicted below.
>>
>>                                       +-----------------+
>>                                       |                 |
>>                                       |   ath12k.ko     |
>>                                       |    (common)     |
>>     +---------------+                 |                 |
>>     |               |                 +-----------------+
>>     |   ath12k.ko   | ===========>
>>     |               |                 +------------------+
>>     +---------------+                 |                  |
>>                                       | ath12k_wifi7.ko  |
>>                                       | (wifi7 family)   |
>>                                       |                  |
>>                                       +------------------+
>>
>> The ath12k.ko module will serve as the common component, while ath12k_wifi7.ko
>> will be the architecture-specific module for WiFi-7 devices.
>>
>> After this modular separation, adding support for a new device will
>> primarily involve implementing device-specific code, while reusing the
>> majority of the shared common components.
>>
>> ---
>> Kiran Venkatappa (13):
>>       wifi: ath12k: Restructure PCI code to common and Wi-Fi 7 specific logic
>>       wifi: ath12k: Move Copy Engine configuration to Wi-Fi 7 specific file
>>       wifi: ath12k: Move Wi-Fi 7 WMI configuration to dedicated file
>>       wifi: ath12k: Move Wi-Fi 7 MHI configuration to dedicated file
>>       wifi: ath12k: Rename hw.c to Wi-Fi 7 specific implementation file
>>       wifi: ath12k: Rename ahb_hif_ops to reflect generic usage
>>       wifi: ath12k: Restructure ahb.c into common and Wi-Fi 7 specific modules
>>       wifi: ath12k: Move Wi-Fi 7 specific init routines to dedicated file
>>       wifi: ath12k: Move hw_init invocation to target-specific probe
>>       wifi: ath12k: Modularize driver into common and Wi-Fi 7 specific components
>>       wifi: ath12k: Rename ath12k_* symbols to ath12k_wifi7_* for clarity
>>       wifi: ath12k: Remove HAL defines from shared PCI code
>>       wifi: ath12k: Remove HAL define dependencies from shared AHB code
>>  
>>  drivers/net/wireless/ath/ath12k/Makefile         |   4 +-
>>  drivers/net/wireless/ath/ath12k/ahb.c            | 139 ++--
>>  drivers/net/wireless/ath/ath12k/ahb.h            |  27 +-
>>  drivers/net/wireless/ath/ath12k/ce.c             | 301 -------
>>  drivers/net/wireless/ath/ath12k/ce.h             |   5 +-
>>  drivers/net/wireless/ath/ath12k/core.c           |  38 +-
>>  drivers/net/wireless/ath/ath12k/core.h           |   7 +
>>  drivers/net/wireless/ath/ath12k/debug.c          |   4 +
>>  drivers/net/wireless/ath/ath12k/dp_rx.c          |   3 +
>>  drivers/net/wireless/ath/ath12k/hal.c            |   4 +
>>  drivers/net/wireless/ath/ath12k/htc.c            |   2 +
>>  drivers/net/wireless/ath/ath12k/hw.h             |   2 -
>>  drivers/net/wireless/ath/ath12k/mhi.c            | 130 ---
>>  drivers/net/wireless/ath/ath12k/mhi.h            |   4 +-
>>  drivers/net/wireless/ath/ath12k/pci.c            | 215 ++---
>>  drivers/net/wireless/ath/ath12k/pci.h            |  28 +-
>>  drivers/net/wireless/ath/ath12k/peer.c           |   2 +
>>  drivers/net/wireless/ath/ath12k/wifi7/Makefile   |  10 +
>>  drivers/net/wireless/ath/ath12k/wifi7/ahb.c      |  71 ++
>>  drivers/net/wireless/ath/ath12k/wifi7/ahb.h      |  20 +
>>  drivers/net/wireless/ath/ath12k/wifi7/ce.c       | 973 +++++++++++++++++++++++
>>  drivers/net/wireless/ath/ath12k/wifi7/ce.h       |  22 +
>>  drivers/net/wireless/ath/ath12k/wifi7/core.c     |  44 +
>>  drivers/net/wireless/ath/ath12k/{ => wifi7}/hw.c | 798 +++----------------
>>  drivers/net/wireless/ath/ath12k/wifi7/hw.h       |  13 +
>>  drivers/net/wireless/ath/ath12k/wifi7/mhi.c      | 138 ++++
>>  drivers/net/wireless/ath/ath12k/wifi7/mhi.h      |  11 +
>>  drivers/net/wireless/ath/ath12k/wifi7/pci.c      | 188 +++++
>>  drivers/net/wireless/ath/ath12k/wifi7/pci.h      |  12 +
>>  drivers/net/wireless/ath/ath12k/wifi7/wmi.c      | 105 +++
>>  drivers/net/wireless/ath/ath12k/wifi7/wmi.h      |  15 +
>>  drivers/net/wireless/ath/ath12k/wmi.c            |  97 ---
>>  drivers/net/wireless/ath/ath12k/wmi.h            |   4 -
>>  33 files changed, 1956 insertions(+), 1480 deletions(-)
>> ---
>> base-commit: d9104cec3e8fe4b458b74709853231385779001f
>> change-id: 20250812-ath12k-mod-bd00156df202
>>
> 
> Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>>

I dropped the extra ">" when applying to the patches in 'pending'

/jeff

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes
  2025-08-12 17:09 [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Kiran Venkatappa
                   ` (14 preceding siblings ...)
  2025-08-20  7:11 ` Baochen Qiang
@ 2025-08-20 21:44 ` Jeff Johnson
  15 siblings, 0 replies; 25+ messages in thread
From: Jeff Johnson @ 2025-08-20 21:44 UTC (permalink / raw)
  To: ath12k, Kiran Venkatappa; +Cc: linux-wireless


On Tue, 12 Aug 2025 22:39:26 +0530, Kiran Venkatappa wrote:
> Current ath drivers have separate implementations for different
> classes of devices. For example, ath11k supports WiFi-6 devices,
> while ath12k supports Wi-Fi 7 devices. However, there is significant
> common functionality across these generations due to shared firmware
> and hardware architecture. In the existing driver code, this leverage
> is achieved through code duplication. As a result, when a new driver
> is introduced, many features are missed, and new additions require
> porting across different generation drivers.
> 
> [...]

Applied, thanks!

[01/13] wifi: ath12k: Restructure PCI code to common and Wi-Fi 7 specific logic
        commit: f844982696f57d72e45f94608278f678a0f67b26
[02/13] wifi: ath12k: Move Copy Engine configuration to Wi-Fi 7 specific file
        commit: 5e545696a398ae39f4c0c747a8ba0c7073037d1b
[03/13] wifi: ath12k: Move Wi-Fi 7 WMI configuration to dedicated file
        commit: d650b777858f38dbbd5bd2cb43c97eb261e95f9d
[04/13] wifi: ath12k: Move Wi-Fi 7 MHI configuration to dedicated file
        commit: 7f54938fc5253a89b962fc137ea725e3e3405757
[05/13] wifi: ath12k: Rename hw.c to Wi-Fi 7 specific implementation file
        commit: 3f8d0eb8037b199e84c41c6ba687104ccbf076f3
[06/13] wifi: ath12k: Rename ahb_hif_ops to reflect generic usage
        commit: bca2b24d9dd98c06b61f6e15789b652b98ff7c87
[07/13] wifi: ath12k: Restructure ahb.c into common and Wi-Fi 7 specific modules
        commit: db2929711d705ed244f0f5a41441a6103ecc785c
[08/13] wifi: ath12k: Move Wi-Fi 7 specific init routines to dedicated file
        commit: 387b587a861cf7864df93c99c123877d28100bb3
[09/13] wifi: ath12k: Move hw_init invocation to target-specific probe
        commit: 83cd89a9556a48d31d706f67854873cadbf80c0e
[10/13] wifi: ath12k: Modularize driver into common and Wi-Fi 7 specific components
        commit: a72027045263f8261b47fc28e7b6da7571d8cbb5
[11/13] wifi: ath12k: Rename ath12k_* symbols to ath12k_wifi7_* for clarity
        commit: bce3b73d1ca744fc1c9cb92eec37b0dd209ae9a1
[12/13] wifi: ath12k: Remove HAL defines from shared PCI code
        commit: 6cbd171805be7443bbfdb8ff0a646348180eee35
[13/13] wifi: ath12k: Remove HAL define dependencies from shared AHB code
        commit: 0e487f03c6e5d8dd5b076b8b061e50e736ab2196

Best regards,
-- 
Jeff Johnson <jeff.johnson@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes
  2025-08-20 20:57   ` Jeff Johnson
@ 2025-08-21  1:46     ` Baochen Qiang
  0 siblings, 0 replies; 25+ messages in thread
From: Baochen Qiang @ 2025-08-21  1:46 UTC (permalink / raw)
  To: Jeff Johnson, Kiran Venkatappa, ath12k; +Cc: linux-wireless



On 8/21/2025 4:57 AM, Jeff Johnson wrote:
> On 8/20/2025 12:11 AM, Baochen Qiang wrote:
>>
>>
>> On 8/13/2025 1:09 AM, Kiran Venkatappa wrote:
>>> Current ath drivers have separate implementations for different
>>> classes of devices. For example, ath11k supports WiFi-6 devices,
>>> while ath12k supports Wi-Fi 7 devices. However, there is significant
>>> common functionality across these generations due to shared firmware
>>> and hardware architecture. In the existing driver code, this leverage
>>> is achieved through code duplication. As a result, when a new driver
>>> is introduced, many features are missed, and new additions require
>>> porting across different generation drivers.
>>>
>>> To improve reuse and maintainability, ath12k should be split into common
>>> and device-specific modules. Common code can be shared across multiple
>>> architectures, enabling better leverage for future hardware generations.
>>> generation drivers.
>>>
>>> Firmware interfaces and core initialization sequences are typically common
>>> across different device families. In contrast, hardware register offsets, copy
>>> engine mappings, and HAL configurations are usually hardware-specific.
>>>
>>> Common components include:
>>>       - mac80211 interface: Control path operations are mostly common across
>>>         different ATH hardware and will be shared as much as possible.
>>>       - Firmware interface (WMI, HTT, HTC, QMI): Firmware messaging and
>>>         sequences are common and maintained with backward/forward compatibility
>>>         using TLVs.
>>>       - Datapath: Data path files are also separated similarly. More information
>>>         will be provided in later patches.
>>>       - Core initialization, reset, and recovery sequences: These will be part
>>>         of the shared code.
>>>
>>> Device-specific code includes:
>>>       - Hardware capabilities, configurations, HAL, and other
>>>         architecture-specific logic.
>>>
>>> The original ath12k.ko is split into these two modules as depicted below.
>>>
>>>                                       +-----------------+
>>>                                       |                 |
>>>                                       |   ath12k.ko     |
>>>                                       |    (common)     |
>>>     +---------------+                 |                 |
>>>     |               |                 +-----------------+
>>>     |   ath12k.ko   | ===========>
>>>     |               |                 +------------------+
>>>     +---------------+                 |                  |
>>>                                       | ath12k_wifi7.ko  |
>>>                                       | (wifi7 family)   |
>>>                                       |                  |
>>>                                       +------------------+
>>>
>>> The ath12k.ko module will serve as the common component, while ath12k_wifi7.ko
>>> will be the architecture-specific module for WiFi-7 devices.
>>>
>>> After this modular separation, adding support for a new device will
>>> primarily involve implementing device-specific code, while reusing the
>>> majority of the shared common components.
>>>
>>> ---
>>> Kiran Venkatappa (13):
>>>       wifi: ath12k: Restructure PCI code to common and Wi-Fi 7 specific logic
>>>       wifi: ath12k: Move Copy Engine configuration to Wi-Fi 7 specific file
>>>       wifi: ath12k: Move Wi-Fi 7 WMI configuration to dedicated file
>>>       wifi: ath12k: Move Wi-Fi 7 MHI configuration to dedicated file
>>>       wifi: ath12k: Rename hw.c to Wi-Fi 7 specific implementation file
>>>       wifi: ath12k: Rename ahb_hif_ops to reflect generic usage
>>>       wifi: ath12k: Restructure ahb.c into common and Wi-Fi 7 specific modules
>>>       wifi: ath12k: Move Wi-Fi 7 specific init routines to dedicated file
>>>       wifi: ath12k: Move hw_init invocation to target-specific probe
>>>       wifi: ath12k: Modularize driver into common and Wi-Fi 7 specific components
>>>       wifi: ath12k: Rename ath12k_* symbols to ath12k_wifi7_* for clarity
>>>       wifi: ath12k: Remove HAL defines from shared PCI code
>>>       wifi: ath12k: Remove HAL define dependencies from shared AHB code
>>>  
>>>  drivers/net/wireless/ath/ath12k/Makefile         |   4 +-
>>>  drivers/net/wireless/ath/ath12k/ahb.c            | 139 ++--
>>>  drivers/net/wireless/ath/ath12k/ahb.h            |  27 +-
>>>  drivers/net/wireless/ath/ath12k/ce.c             | 301 -------
>>>  drivers/net/wireless/ath/ath12k/ce.h             |   5 +-
>>>  drivers/net/wireless/ath/ath12k/core.c           |  38 +-
>>>  drivers/net/wireless/ath/ath12k/core.h           |   7 +
>>>  drivers/net/wireless/ath/ath12k/debug.c          |   4 +
>>>  drivers/net/wireless/ath/ath12k/dp_rx.c          |   3 +
>>>  drivers/net/wireless/ath/ath12k/hal.c            |   4 +
>>>  drivers/net/wireless/ath/ath12k/htc.c            |   2 +
>>>  drivers/net/wireless/ath/ath12k/hw.h             |   2 -
>>>  drivers/net/wireless/ath/ath12k/mhi.c            | 130 ---
>>>  drivers/net/wireless/ath/ath12k/mhi.h            |   4 +-
>>>  drivers/net/wireless/ath/ath12k/pci.c            | 215 ++---
>>>  drivers/net/wireless/ath/ath12k/pci.h            |  28 +-
>>>  drivers/net/wireless/ath/ath12k/peer.c           |   2 +
>>>  drivers/net/wireless/ath/ath12k/wifi7/Makefile   |  10 +
>>>  drivers/net/wireless/ath/ath12k/wifi7/ahb.c      |  71 ++
>>>  drivers/net/wireless/ath/ath12k/wifi7/ahb.h      |  20 +
>>>  drivers/net/wireless/ath/ath12k/wifi7/ce.c       | 973 +++++++++++++++++++++++
>>>  drivers/net/wireless/ath/ath12k/wifi7/ce.h       |  22 +
>>>  drivers/net/wireless/ath/ath12k/wifi7/core.c     |  44 +
>>>  drivers/net/wireless/ath/ath12k/{ => wifi7}/hw.c | 798 +++----------------
>>>  drivers/net/wireless/ath/ath12k/wifi7/hw.h       |  13 +
>>>  drivers/net/wireless/ath/ath12k/wifi7/mhi.c      | 138 ++++
>>>  drivers/net/wireless/ath/ath12k/wifi7/mhi.h      |  11 +
>>>  drivers/net/wireless/ath/ath12k/wifi7/pci.c      | 188 +++++
>>>  drivers/net/wireless/ath/ath12k/wifi7/pci.h      |  12 +
>>>  drivers/net/wireless/ath/ath12k/wifi7/wmi.c      | 105 +++
>>>  drivers/net/wireless/ath/ath12k/wifi7/wmi.h      |  15 +
>>>  drivers/net/wireless/ath/ath12k/wmi.c            |  97 ---
>>>  drivers/net/wireless/ath/ath12k/wmi.h            |   4 -
>>>  33 files changed, 1956 insertions(+), 1480 deletions(-)
>>> ---
>>> base-commit: d9104cec3e8fe4b458b74709853231385779001f
>>> change-id: 20250812-ath12k-mod-bd00156df202
>>>
>>
>> Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>>
> 
> I dropped the extra ">" when applying to the patches in 'pending'

My bad! Didn't notice that, Thanks!

> 
> /jeff


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2025-08-21  1:46 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-12 17:09 [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Kiran Venkatappa
2025-08-12 17:09 ` [PATCH ath12k-ng 01/13] wifi: ath12k: Restructure PCI code to common and Wi-Fi 7 specific logic Kiran Venkatappa
2025-08-12 17:09 ` [PATCH ath12k-ng 02/13] wifi: ath12k: Move Copy Engine configuration to Wi-Fi 7 specific file Kiran Venkatappa
2025-08-12 17:09 ` [PATCH ath12k-ng 03/13] wifi: ath12k: Move Wi-Fi 7 WMI configuration to dedicated file Kiran Venkatappa
2025-08-13  5:52   ` Krzysztof Kozlowski
2025-08-13 15:43     ` Jeff Johnson
2025-08-13 16:00       ` Krzysztof Kozlowski
2025-08-13 16:24         ` Greg Kroah-Hartman
2025-08-13 18:06           ` Jeff Johnson
2025-08-12 17:09 ` [PATCH ath12k-ng 04/13] wifi: ath12k: Move Wi-Fi 7 MHI " Kiran Venkatappa
2025-08-13  5:52   ` Krzysztof Kozlowski
2025-08-12 17:09 ` [PATCH ath12k-ng 05/13] wifi: ath12k: Rename hw.c to Wi-Fi 7 specific implementation file Kiran Venkatappa
2025-08-12 17:09 ` [PATCH ath12k-ng 06/13] wifi: ath12k: Rename ahb_hif_ops to reflect generic usage Kiran Venkatappa
2025-08-12 17:09 ` [PATCH ath12k-ng 07/13] wifi: ath12k: Restructure ahb.c into common and Wi-Fi 7 specific modules Kiran Venkatappa
2025-08-12 17:09 ` [PATCH ath12k-ng 08/13] wifi: ath12k: Move Wi-Fi 7 specific init routines to dedicated file Kiran Venkatappa
2025-08-12 17:09 ` [PATCH ath12k-ng 09/13] wifi: ath12k: Move hw_init invocation to target-specific probe Kiran Venkatappa
2025-08-12 17:09 ` [PATCH ath12k-ng 10/13] wifi: ath12k: Modularize driver into common and Wi-Fi 7 specific components Kiran Venkatappa
2025-08-12 17:09 ` [PATCH ath12k-ng 11/13] wifi: ath12k: Rename ath12k_* symbols to ath12k_wifi7_* for clarity Kiran Venkatappa
2025-08-12 17:09 ` [PATCH ath12k-ng 12/13] wifi: ath12k: Remove HAL defines from shared PCI code Kiran Venkatappa
2025-08-12 17:09 ` [PATCH ath12k-ng 13/13] wifi: ath12k: Remove HAL define dependencies from shared AHB code Kiran Venkatappa
2025-08-20  4:50 ` [PATCH ath12k-ng 00/13] wifi: ath12k: Ath12k modularization changes Vasanthakumar Thiagarajan
2025-08-20  7:11 ` Baochen Qiang
2025-08-20 20:57   ` Jeff Johnson
2025-08-21  1:46     ` Baochen Qiang
2025-08-20 21:44 ` Jeff Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).