Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
0d6dbcf
wifi: ath: revert tip 3 commits prepare sync to 6.19-rc6 ath
Feb 2, 2026
8325004
wifi: ath12k: Remove struct wmi_bcn_send_from_host_cmd
jeff-t-johnson Oct 10, 2025
023195c
wifi: ath12k: track dropped MSDU buffer type packets in REO exception…
Sep 30, 2025
f02342d
wifi: ath12k: Defer vdev bring-up until CSA finalize to avoid stale b…
Sep 24, 2025
6a6d03e
wifi: ath12k: Fix NSS value update in ext_rx_stats
Oct 7, 2025
9e6c852
wifi: ath12k: Add MODULE_FIRMWARE() entries
tiwai Oct 3, 2025
6158c03
wifi: ath12k: add support for BSS color change
WeiZhang-stone Oct 17, 2025
e8a56d4
wifi: ath12k: Assert base_lock is held before allocating REO update e…
Oct 21, 2025
a85935b
wifi: ath12k: generalize GI and LTF fixed rate functions
Oct 24, 2025
b5628d5
wifi: ath12k: add EHT rate handling to existing set rate functions
Oct 24, 2025
b616112
wifi: ath12k: Add EHT MCS/NSS rates to Peer Assoc
Oct 24, 2025
7f9b064
wifi: ath12k: Add EHT fixed GI/LTF
Oct 24, 2025
cf30386
wifi: ath12k: add EHT rates to ath12k_mac_op_set_bitrate_mask()
Oct 24, 2025
c024551
wifi: ath12k: Set EHT fixed rates for associated STAs
Oct 24, 2025
30ed339
wifi: ath12k: Make firmware stats reset caller-driven
Oct 31, 2025
768e908
wifi: ath12k: Fix timeout error during beacon stats retrieval
Oct 31, 2025
7ce0f24
wifi: ath12k: Restructure PCI code to common and Wi-Fi 7 specific logic
Aug 12, 2025
c61cad4
wifi: ath12k: Move Copy Engine configuration to Wi-Fi 7 specific file
Aug 12, 2025
b942967
wifi: ath12k: Move Wi-Fi 7 WMI configuration to dedicated file
Aug 12, 2025
5d0e2c0
wifi: ath12k: Move Wi-Fi 7 MHI configuration to dedicated file
Aug 12, 2025
451f0fc
wifi: ath12k: Rename hw.c to Wi-Fi 7 specific implementation file
Aug 12, 2025
1706b99
wifi: ath12k: Rename ahb_hif_ops to reflect generic usage
Aug 12, 2025
2ed4c4a
wifi: ath12k: Restructure ahb.c into common and Wi-Fi 7 specific modules
Aug 12, 2025
7f06649
wifi: ath12k: Move Wi-Fi 7 specific init routines to dedicated file
Aug 12, 2025
af5446b
wifi: ath12k: Move hw_init invocation to target-specific probe
Aug 12, 2025
a47166c
wifi: ath12k: Modularize driver into common and Wi-Fi 7 specific comp…
Aug 12, 2025
3e42761
wifi: ath12k: Rename ath12k_* symbols to ath12k_wifi7_* for clarity
Aug 12, 2025
88e0bed
wifi: ath12k: Remove HAL defines from shared PCI code
Aug 12, 2025
0d1f584
wifi: ath12k: Remove HAL define dependencies from shared AHB code
Aug 12, 2025
82c0276
wifi: ath12k: Move hal_tx and hal_rx to wifi7 directory
Aug 28, 2025
9e4edb1
wifi: ath12k: Move hal_tx.h file to wifi7 directory
Aug 28, 2025
5d03ade
wifi: ath12k: Move hal_rx.h file to wifi7 directory
Aug 28, 2025
be61011
wifi: ath12k: Move HAL Rx wrapper APIs to dp_rx.h
Aug 28, 2025
0f45e39
wifi: ath12k: Move Rx error related functions to wifi7 directory
Aug 28, 2025
abd1ca9
wifi: ath12k: Move hal_desc.h file to wifi7 directory
Aug 28, 2025
ea97b13
wifi: ath12k: Move rx_desc.h file to wifi7 directory
Aug 28, 2025
adc25eb
wifi: ath12k: Move rxdma ring config functions to wifi7 directory
Aug 28, 2025
dc49387
wifi: ath12k: Move rx error and defrag functions to wifi7 directory
Aug 28, 2025
6a59939
wifi: ath12k: Move regular msdu processing functions to wifi7 directory
Aug 28, 2025
b8fe6fb
wifi: ath12k: Move srng processing to wifi7 directory
Aug 28, 2025
b617f20
wifi: ath12k: Separate arch specific part of RX APIs
Aug 28, 2025
0d28b24
wifi: ath12k: Move arch specific REO functions to wifi7 directory
Aug 28, 2025
59f133f
wifi: ath12k: Move arch specific rx tid and related functions to wifi…
Aug 28, 2025
816add6
wifi: ath12k: Move arch specific tx APIs to wifi7 directory
Aug 28, 2025
51f3ecb
wifi: ath12k: Move ath12k_dp_tx and related APIs to wifi7 directory
Aug 28, 2025
2267e1e
wifi: ath12k: Move HTT code in dp.h to newly introduced files
Aug 28, 2025
4c13938
wifi: ath12k: Move HTT Rx specific code to newly introduced files
Aug 28, 2025
29ee271
wifi: ath12k: Move HTT Tx specific code to newly introduced files
Aug 28, 2025
91abd6f
wifi: ath12k: Move HTT specific code from dp.c to newly introduced files
Aug 28, 2025
aaf92ba
wifi: ath12k: Remove non-compact TLV support from QCN
Sep 10, 2025
4ee188d
wifi: ath12k: Move the hal APIs to hardware specific files
Sep 10, 2025
15e2108
wifi: ath12k: unify HAL ops naming across chips
Sep 10, 2025
e37144f
wifi: ath12k: Replace ops with direct calls for rxdma ring mask
Sep 10, 2025
9c2a0f2
wifi: ath12k: Move hal_rx_ops callbacks to hal_ops
Sep 10, 2025
7359cb3
wifi: ath12k: Add new infra for the rx path
Sep 10, 2025
1431e16
wifi: ath12k: Remove hal_rx_ops and merge into hal_ops
Sep 10, 2025
df4e836
wifi: ath12k: Change the API prefixes to ath12k_wifi7 in tx/rx
Sep 10, 2025
b128bc0
wifi: ath12k: Convert ath12k_dp member in ath12k_base to pointer
Sep 30, 2025
e605837
wifi: ath12k: Support arch-specific DP device allocation
Sep 30, 2025
3bad243
wifi: ath12k: Rearrange DP fields in ath12k_hw_group struct
Sep 30, 2025
1b8e79a
wifi: ath12k: Add framework for hardware specific ieee80211_ops regis…
Sep 30, 2025
9a9de85
wifi: ath12k: Add framework for hardware specific DP interrupt handler
Sep 30, 2025
0a3942b
wifi: ath12k: Refactor ath12k_vif structure
Sep 30, 2025
9cf2e26
wifi: ath12k: Refactor data path pdev struct
Oct 7, 2025
2a10a47
wifi: ath12k: Rearrange PPDU radio stats
Oct 7, 2025
1701dfc
wifi: ath12k: Move srng config and hal_ops to hw specific hal files
Oct 9, 2025
a4c59cf
wifi: ath12k: Initialize desc_size through hal_init
Oct 9, 2025
50c0a0a
wifi: ath12k: Initialize hal_ops through hal_init
Oct 9, 2025
f4395c6
wifi: ath12k: Move wbm_rbm_map to hw specific hal files
Oct 9, 2025
6f335e0
wifi: ath12k: Move hal_params and regs to hal from hw
Oct 9, 2025
3b37c10
wifi: ath12k: Add direct HAL pointer in ath12k_dp
Oct 9, 2025
910c14d
wifi: ath12k: Use hal handle instead of ab handle
Oct 9, 2025
6e49862
wifi: ath12k: Move HAL CE setup and SRNG related APIs to wifi7 directory
Oct 9, 2025
6c834be
wifi: ath12k: Move HAL SRNG shadow config and get ring id APIs to wif…
Oct 9, 2025
5e4a7dd
wifi: ath12k: Move HAL CE desc related APIs to wifi7 directory
Oct 9, 2025
026d41f
wifi: ath12k: Move HAL CE status and set link desc addr APIs to wifi7…
Oct 9, 2025
5fc8e7b
wifi: ath12k: Move HAL Tx, REO and link idle setup related APIs to wi…
Oct 9, 2025
c219ede
wifi: ath12k: Move HAL REO and Rx buf related APIs to wifi7 directory
Oct 9, 2025
5d868dd
wifi: ath12k: Move HAL Cookie Conversion and RBM related APIs to wifi…
Oct 9, 2025
dd2617a
wifi: ath12k: Segregate the common and wifi7 specific structures
Oct 9, 2025
fb1bb0b
wifi: ath12k: Remove the unused ring inits in wcn
Oct 9, 2025
e9426da
wifi: ath12k: Rename hal_ops to ops
Oct 9, 2025
ebde216
wifi: ath12k: Drop hal_ prefix from hardware register names
Oct 9, 2025
7b08977
wifi: ath12k: Move DP related functions from peer.c to dp_peer.c file
Oct 24, 2025
91a25a4
wifi: ath12k: Rename ath12k_peer to ath12k_dp_link_peer
Oct 24, 2025
9fe19ab
wifi: ath12k: Add hash table for ath12k_link_sta in ath12k_base
Oct 24, 2025
b657370
wifi: ath12k: Move ath12k_dp_link_peer list from ath12k_base to ath12…
Oct 24, 2025
d91a897
wifi: ath12k: Add hash table for ath12k_dp_link_peer
Oct 24, 2025
ca870d6
wifi: ath12k: Define ath12k_dp_peer structure & APIs for create & delete
Oct 24, 2025
cb6161a
wifi: ath12k: Attach and detach ath12k_dp_link_peer to ath12k_dp_peer
Oct 24, 2025
1248a9c
wifi: ath12k: Use ath12k_dp_peer in per packet Tx & Rx paths
Oct 24, 2025
bc80a49
wifi: ath12k: Add lockdep warn for RCU
Oct 24, 2025
4133074
wifi: ath12k: Add callbacks in arch_ops for rx APIs
Nov 3, 2025
befc851
wifi: ath12k: Move DP device stats to ath12k_dp
Nov 3, 2025
e2ffecd
wifi: ath12k: Move DP specific link stats to DP link peer
Nov 3, 2025
2bf207d
wifi: ath12k: Add helper to free DP link peer
Nov 3, 2025
d611b30
wifi: ath12k: Move ieee80211_ops callback to the arch specific module
Nov 3, 2025
cf72c30
wifi: ath12k: Remove the wifi7 header inclusions in common code
Nov 3, 2025
d1ccf6a
wifi: ath12k: Move ath12k_dp_rx_frags_cleanup API to Wi-Fi 7
Nov 3, 2025
373b0f9
wifi: ath12k: Move ath12k_dp_rx_get_peer_id API to Wi-Fi 7
Nov 3, 2025
0969e89
wifi: ath12k: Remove arch-specific HAL dependencies from common DP
Nov 3, 2025
a509d62
wifi: ath12k: Build all the files in wifi7 directory into ath12k_wifi…
Nov 3, 2025
7fdcf5b
wifi: ath12k: Use dp objects in performance critical paths
Nov 3, 2025
b1a8531
wifi: ath12k: Replace lock/unlock with guard()
Nov 3, 2025
9ec6f63
wifi: ath12k: Move monitor ring processing to Wi-Fi 7 module
Nov 10, 2025
502df9d
wifi: ath12k: Move monitor status processing to Wi-Fi 7 module
Nov 10, 2025
6fc1849
wifi: ath12k: Move MPDU pop functionality to Wi-Fi 7 module
Nov 10, 2025
93a2c7a
wifi: ath12k: Move RX status TLV parsing to Wi-Fi 7 module
Nov 10, 2025
1b00404
wifi: ath12k: Move TX monitor functionality to Wi-Fi 7 module
Nov 10, 2025
0b3a472
wifi: ath12k: Move HT/VHT SIG processing to Wi-Fi 7 module
Nov 10, 2025
f0d2f6c
wifi: ath12k: Move HE SIG processing to Wi-Fi 7 module
Nov 10, 2025
1fa15cc
wifi: ath12k: Move EHT SIG processing to Wi-Fi 7 module
Nov 10, 2025
483ac66
wifi: ath12k: Move remaining SIG TLV parsing to Wi-Fi 7 module
Nov 10, 2025
98e8acf
wifi: ath12k: Move MU user processing to Wi-Fi 7 module
Nov 10, 2025
7ae76a0
wifi: ath12k: Move MSDU END TLV processing to Wi-Fi 7 module
Nov 10, 2025
b6a5511
wifi: ath12k: Remove Wi-Fi 7 header dependencies from common ath12k m…
Nov 10, 2025
4a3f016
wifi: ath12k: add the missing RCU lock in ath12k_dp_tx_free_txbuf()
Nov 19, 2025
f1284b2
wifi: ath12k: move firmware stats request outside of atomic context
Nov 19, 2025
5c68b5d
wifi: ath12k: Skip DP peer creation for scan vdev
Dec 7, 2025
9c49669
Merge branch 'ath12k-ng' into ath-next
jeff-t-johnson Jan 30, 2026
13b3141
wifi: ath12k: remove redundant pci_set_drvdata() call
adminchev Nov 27, 2025
2b07468
wifi: ath12k: clean up on error in ath12k_dp_setup()
Dec 18, 2025
3acf0b8
wifi: ath12k: do WoW offloads only on primary link
Nov 3, 2025
f0479d4
wifi: ath12k: refactor PCI window register access
Jan 12, 2026
59bf86c
wifi: ath12k: refactor REO CMD ring handling
Jan 12, 2026
e5fff5c
wifi: ath12k: refactor REO status ring handling
Jan 12, 2026
f90a9bf
wifi: ath12k: fix preferred hardware mode calculation
Jan 12, 2026
30de816
wifi: ath12k: refactor 320 MHz bandwidth support parsing
Jan 12, 2026
2ae9e53
wifi: ath12k: fix mac phy capability parsing
Jan 12, 2026
372b417
wifi: ath12k: add hardware registers for QCC2072
Jan 12, 2026
8e0e770
wifi: ath12k: add hardware parameters for QCC2072
Jan 12, 2026
9a9cb62
wifi: ath12k: support LPASS_SHARED target memory type
Jan 12, 2026
61b7543
wifi: ath12k: support downloading auxiliary ucode image for QCC2072
Jan 12, 2026
f66a6a6
wifi: ath12k: add HAL descriptor and ops for QCC2072
Jan 12, 2026
c13b7b5
wifi: ath12k: add hardware ops support for QCC2072
Jan 12, 2026
8e1f52e
wifi: ath12k: handle REO CMD ring for QCC2072
Jan 12, 2026
a6f0e83
wifi: ath12k: handle REO status ring for QCC2072
Jan 12, 2026
90bacc6
wifi: ath12k: limit number of channels per WMI command
Jan 12, 2026
837ea67
wifi: ath12k: send peer meta data version to firmware
Jan 12, 2026
d22bc91
wifi: ath12k: fix PCIE_LOCAL_REG_QRTR_NODE_ID definition for QCC2072
miaoqing-quic Jan 12, 2026
3bf286b
wifi: ath12k: enable QCC2072 support
Jan 12, 2026
4bf1bf0
wifi: ath12k: Fix wrong P2P device link id issue
MilanoPipo Jan 8, 2026
ad69d95
wifi: ath12k: Fix scan state stuck in ABORTING
MilanoPipo Dec 25, 2025
50bddbe
mhi: host: Add support for loading dual ELF image format
qianyu-qcom Dec 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions drivers/bus/mhi/host/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,9 +584,12 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl)
* device transitioning into MHI READY state
*/
if (fw_load_type == MHI_FW_LOAD_FBC) {
dev_dbg(dev, "standard_elf_image:%s\n",
(mhi_cntrl->standard_elf_image ? "True" : "False"));
if (mhi_cntrl->standard_elf_image) {
/*
* Some FW combine two separate ELF images (SBL + WLAN FW) in a single
* file. Hence, check for the existence of the second ELF header after
* SBL. If present, load the second image separately.
*/
if (!memcmp(fw_data + mhi_cntrl->sbl_size, ELFMAG, SELFMAG)) {
fw_data += mhi_cntrl->sbl_size;
fw_sz -= mhi_cntrl->sbl_size;
}
Expand Down
8 changes: 5 additions & 3 deletions drivers/net/wireless/ath/ath12k/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
obj-$(CONFIG_ATH12K) += ath12k.o
ath12k-y += core.o \
hal.o \
hal_tx.o \
hal_rx.o \
wmi.o \
mac.o \
reg.o \
Expand All @@ -12,18 +10,22 @@ ath12k-y += core.o \
dp.o \
dp_tx.o \
dp_rx.o \
dp_htt.o \
dp_peer.o \
debug.o \
ce.o \
peer.o \
dbring.o \
hw.o \
mhi.o \
pci.o \
dp_mon.o \
fw.o \
p2p.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
Expand Down
165 changes: 113 additions & 52 deletions drivers/net/wireless/ath/ath12k/ahb.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear
/*
* Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2025 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
*/

#include <linux/dma-mapping.h>
Expand All @@ -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"};
Expand Down Expand Up @@ -130,15 +123,15 @@ 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);
}

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);
Expand Down Expand Up @@ -531,9 +524,10 @@ static int ath12k_ahb_ext_grp_napi_poll(struct napi_struct *napi, int budget)
struct ath12k_ext_irq_grp,
napi);
struct ath12k_base *ab = irq_grp->ab;
struct ath12k_dp *dp = ath12k_ab_to_dp(ab);
int work_done;

work_done = ath12k_dp_service_srng(ab, irq_grp, budget);
work_done = ath12k_dp_service_srng(dp, irq_grp, budget);
if (work_done < budget) {
napi_complete_done(napi, work_done);
ath12k_ahb_ext_grp_enable(irq_grp);
Expand Down Expand Up @@ -563,12 +557,10 @@ static int ath12k_ahb_config_ext_irq(struct ath12k_base *ab)
{
const struct ath12k_hw_ring_mask *ring_mask;
struct ath12k_ext_irq_grp *irq_grp;
const struct hal_ops *hal_ops;
int i, j, irq, irq_idx, ret;
u32 num_irq;

ring_mask = ab->hw_params->ring_mask;
hal_ops = ab->hw_params->hal_ops;
for (i = 0; i < ATH12K_EXT_IRQ_GRP_NUM_MAX; i++) {
irq_grp = &ab->ext_irq_grp[i];
num_irq = 0;
Expand All @@ -588,7 +580,7 @@ static int ath12k_ahb_config_ext_irq(struct ath12k_base *ab)
* tcl_to_wbm_rbm_map point to the same ring number.
*/
if (ring_mask->tx[i] &
BIT(hal_ops->tcl_to_wbm_rbm_map[j].wbm_ring_num)) {
BIT(ab->hal.tcl_to_wbm_rbm_map[j].wbm_ring_num)) {
irq_grp->irqs[num_irq++] =
wbm2host_tx_completions_ring1 - j;
}
Expand Down Expand Up @@ -698,7 +690,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,
Expand Down Expand Up @@ -935,7 +927,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");
Expand Down Expand Up @@ -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));
Expand All @@ -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_ipq5332;
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
Expand Down Expand Up @@ -1065,14 +1086,26 @@ static int ath12k_ahb_probe(struct platform_device *pdev)
goto err_rproc_deconfigure;
}

/* Invoke arch_init here so that arch-specific init operations
* can utilize already initialized ab fields, such as HAL SRNGs.
*/
ret = ab_ahb->device_family_ops->arch_init(ab);
if (ret) {
ath12k_err(ab, "AHB arch_init failed %d\n", ret);
goto err_rproc_deconfigure;
}

ret = ath12k_core_init(ab);
if (ret) {
ath12k_err(ab, "failed to init core: %d\n", ret);
goto err_rproc_deconfigure;
goto err_deinit_arch;
}

return 0;

err_deinit_arch:
ab_ahb->device_family_ops->arch_deinit(ab);

err_rproc_deconfigure:
ath12k_ahb_deconfigure_rproc(ab);

Expand Down Expand Up @@ -1111,11 +1144,13 @@ static void ath12k_ahb_remove_prepare(struct ath12k_base *ab)
static void ath12k_ahb_free_resources(struct ath12k_base *ab)
{
struct platform_device *pdev = ab->pdev;
struct ath12k_ahb *ab_ahb = ath12k_ab_to_ahb(ab);

ath12k_hal_srng_deinit(ab);
ath12k_ce_free_pipes(ab);
ath12k_ahb_resource_deinit(ab);
ath12k_ahb_deconfigure_rproc(ab);
ab_ahb->device_family_ops->arch_deinit(ab);
ath12k_core_free(ab);
platform_set_drvdata(pdev, NULL);
}
Expand All @@ -1136,21 +1171,47 @@ 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 ||
!driver->ops.arch_init || !driver->ops.arch_deinit)
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);
}
EXPORT_SYMBOL(ath12k_ahb_register_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;
}
EXPORT_SYMBOL(ath12k_ahb_unregister_driver);
Loading