Add QCN9575 PCI window register constants (WINDOW_VALUE_MASK [25:19], WINDOW_STATIC_MASK [31:7], CE_WINDOW_MASK [13:7], UMAC_WINDOW_MASK [20:14]) and a Wi-Fi 8 reg_base instance (ath12k_wifi8_reg_base) for per-device window selection. Implement ath12k_wifi8_pci_probe() to configure QCN9575-specific PCI settings: MSI vector layout (3 MHI, 5 CE, 8 DP vectors), static window mapping, window register address (0x3278), and hardware revision. Call ath12k_wifi8_hw_init() at the end of probe to complete hardware initialization. Define the Wi-Fi 8 PCI driver struct with the probe callback, and register it with ath12k_pci_register_driver() in ath12k_wifi8_pci_init(). This series only adds Wi-Fi 8 platform scaffolding; QCN9575's CP, DP, and MAC datapath support will be posted as a follow-up series. QCN9575_DEVICE_ID is intentionally left out of ath12k_wifi8_pci_id_table for now, so no physical device can match and probe until that follow-up series lands. The id_table entry will be added in the final patch of that series, once QCN9575 is actually functional. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3 Signed-off-by: Madhavan Ganesan --- drivers/net/wireless/ath/ath12k/hal.h | 2 + drivers/net/wireless/ath/ath12k/wifi7/hal.h | 2 - drivers/net/wireless/ath/ath12k/wifi8/hal.h | 1 + drivers/net/wireless/ath/ath12k/wifi8/pci.c | 89 ++++++++++++++++++++++++++++- 4 files changed, 91 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/hal.h b/drivers/net/wireless/ath/ath12k/hal.h index 9e88bdf4a93b..b30a8039b2ec 100644 --- a/drivers/net/wireless/ath/ath12k/hal.h +++ b/drivers/net/wireless/ath/ath12k/hal.h @@ -11,6 +11,8 @@ struct ath12k_base; +#define HAL_CE_WFSS_CE_REG_BASE 0x01b80000 + #define HAL_DESC_REO_NON_QOS_TID 16 #define HAL_INVALID_PEERID 0x3fff diff --git a/drivers/net/wireless/ath/ath12k/wifi7/hal.h b/drivers/net/wireless/ath/ath12k/wifi7/hal.h index 19e02bb16ff2..fe880b0befcb 100644 --- a/drivers/net/wireless/ath/ath12k/wifi7/hal.h +++ b/drivers/net/wireless/ath/ath12k/wifi7/hal.h @@ -31,8 +31,6 @@ ((hal)->regs->umac_ce1_dest_reg_base) #define HAL_SEQ_WCSS_UMAC_WBM_REG 0x00a34000 -#define HAL_CE_WFSS_CE_REG_BASE 0x01b80000 - #define HAL_TCL_SW_CONFIG_BANK_ADDR 0x00a4408c /* SW2TCL(x) R0 ring configuration address */ diff --git a/drivers/net/wireless/ath/ath12k/wifi8/hal.h b/drivers/net/wireless/ath/ath12k/wifi8/hal.h index c99521abdcb3..89fa9a7f3fd9 100644 --- a/drivers/net/wireless/ath/ath12k/wifi8/hal.h +++ b/drivers/net/wireless/ath/ath12k/wifi8/hal.h @@ -11,6 +11,7 @@ #include "hal_desc.h" /* WCSS Relative address */ +#define HAL_SEQ_WCSS_UMAC_OFFSET 0xf00000 #define HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(hal) \ ((hal)->regs->umac_ce0_src_reg_base) #define HAL_SEQ_WCSS_UMAC_CE0_DST_REG(hal) \ diff --git a/drivers/net/wireless/ath/ath12k/wifi8/pci.c b/drivers/net/wireless/ath/ath12k/wifi8/pci.c index 3975081d167b..fd0489f8333f 100644 --- a/drivers/net/wireless/ath/ath12k/wifi8/pci.c +++ b/drivers/net/wireless/ath/ath12k/wifi8/pci.c @@ -5,14 +5,101 @@ #include +#include "../core.h" +#include "../hal.h" +#include "../hif.h" +#include "../mhi.h" +#include "../pci.h" +#include "hal.h" +#include "hw.h" +#include "mhi.h" #include "pci.h" +#define QCN9575_DEVICE_ID 0x1113 +#define WINDOW_REG_ADDRESS 0x3278 + +#define WINDOW_VALUE_MASK GENMASK(25, 19) +#define WINDOW_STATIC_MASK GENMASK(31, 7) +#define CE_WINDOW_MASK GENMASK(13, 7) +#define UMAC_WINDOW_MASK GENMASK(20, 14) + +static const struct pci_device_id ath12k_wifi8_pci_id_table[] = { + {} +}; + +MODULE_DEVICE_TABLE(pci, ath12k_wifi8_pci_id_table); + +static const struct ath12k_pci_ops ath12k_wifi8_pci_ops_qcn9575 = { + .wakeup = NULL, + .release = NULL, +}; + +static int ath12k_wifi8_pci_probe(struct pci_dev *pdev, + const struct pci_device_id *pci_dev) +{ + struct ath12k_pci *ab_pci; + struct ath12k_base *ab; + int ret; + + ab = pci_get_drvdata(pdev); + ab_pci = ath12k_pci_priv(ab); + + switch (pci_dev->device) { + case QCN9575_DEVICE_ID: + ab->msi.config = &ath12k_msi_config[ATH12K_MSI_CONFIG_PCI]; + ab->static_window_map = true; + ab_pci->pci_ops = &ath12k_wifi8_pci_ops_qcn9575; + ab_pci->window_reg_addr = WINDOW_REG_ADDRESS; + ab->hw_rev = ATH12K_HW_QCN9575_HW20; + ab->target_mem_mode = ath12k_core_get_memory_mode(ab); + break; + + default: + dev_err(&pdev->dev, "Unknown Wi-Fi 8 PCI device found: 0x%x\n", + pci_dev->device); + return -EOPNOTSUPP; + } + + ret = ath12k_wifi8_hw_init(ab); + if (ret) { + dev_err(&pdev->dev, "Wi-Fi 8 hw_init failed: %d\n", ret); + return ret; + } + + return 0; +} + +static const struct ath12k_pci_reg_base ath12k_wifi8_reg_base = { + .umac_base = HAL_SEQ_WCSS_UMAC_OFFSET, + .ce_reg_base = HAL_CE_WFSS_CE_REG_BASE, + .window_value_mask = WINDOW_VALUE_MASK, + .window_static_mask = WINDOW_STATIC_MASK, + .ce_window_mask = CE_WINDOW_MASK, + .umac_window_mask = UMAC_WINDOW_MASK, +}; + +static struct ath12k_pci_driver ath12k_wifi8_pci_driver = { + .name = "ath12k_wifi8_pci", + .id_table = ath12k_wifi8_pci_id_table, + .ops.probe = ath12k_wifi8_pci_probe, + .reg_base = &ath12k_wifi8_reg_base, +}; + int ath12k_wifi8_pci_init(void) { - /* Wi-Fi 8 PCI driver registration will be added in follow-up patches. */ + int ret; + + ret = ath12k_pci_register_driver(ATH12K_DEVICE_FAMILY_WIFI8, + &ath12k_wifi8_pci_driver); + if (ret) { + pr_err("Failed to register ath12k Wi-Fi 8 driver: %d\n", ret); + return ret; + } + return 0; } void ath12k_wifi8_pci_exit(void) { + ath12k_pci_unregister_driver(ATH12K_DEVICE_FAMILY_WIFI8); } -- 2.34.1