]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: ath12k: Move Wi-Fi 7 MHI configuration to dedicated file
authorKiran Venkatappa <quic_kiranv@quicinc.com>
Tue, 12 Aug 2025 17:09:30 +0000 (22:39 +0530)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Wed, 20 Aug 2025 21:39:03 +0000 (14:39 -0700)
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>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Link: https://patch.msgid.link/20250812-ath12k-mod-v1-4-8c9b0eb9335d@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/Makefile
drivers/net/wireless/ath/ath12k/hw.c
drivers/net/wireless/ath/ath12k/mhi.c
drivers/net/wireless/ath/ath12k/mhi.h
drivers/net/wireless/ath/ath12k/mhi_wifi7.c [new file with mode: 0644]
drivers/net/wireless/ath/ath12k/mhi_wifi7.h [new file with mode: 0644]

index ee075ee68bb834e3f3605b13a5fee6afff0ba763..fb968884f6560ed8dfeabba0e0a1562a98576313 100644 (file)
@@ -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 \
index df1b4439adc798dc0dfb7d8604874a4fcb77663b..ad372feaef28be9149f86008453409dad5c5d4f7 100644 (file)
@@ -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,
index 08f44baf182a5e34651e8c117fe279942f8ad8f4..1f680f6e65d30ac5fd98ad59df90eb9e629746dd 100644 (file)
 #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;
index 7358b8477536a636743f4fd16d37500a8d458ab1..5e1363650a9a75ff4770e0cb64b6986ca2c5e8a7 100644 (file)
@@ -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 (file)
index 0000000..be74df1
--- /dev/null
@@ -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 (file)
index 0000000..8417a2b
--- /dev/null
@@ -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 */