wifi: ath12k: Remove HAL defines from shared PCI code

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>
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-12-8c9b0eb9335d@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
This commit is contained in:
Kiran Venkatappa 2025-08-12 22:39:38 +05:30 committed by Jeff Johnson
parent bce3b73d1c
commit 6cbd171805
3 changed files with 21 additions and 4 deletions

View File

@ -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

View File

@ -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)

View File

@ -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)