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
193a98b
UPSTREAM: wifi: ath12k: Remove struct wmi_bcn_send_from_host_cmd
jeff-t-johnson Oct 10, 2025
e0b89ad
UPSTREAM: wifi: ath12k: track dropped MSDU buffer type packets in REO…
Sep 30, 2025
72d3aea
UPSTREAM: wifi: ath12k: Defer vdev bring-up until CSA finalize to avo…
Sep 24, 2025
77f1062
UPSTREAM: wifi: ath12k: Fix NSS value update in ext_rx_stats
Oct 7, 2025
6593f4b
UPSTREAM: wifi: ath12k: Add MODULE_FIRMWARE() entries
tiwai Oct 3, 2025
c1cfcb0
UPSTREAM: wifi: ath12k: add support for BSS color change
WeiZhang-stone Oct 17, 2025
2dcfe8e
UPSTREAM: wifi: ath12k: Assert base_lock is held before allocating RE…
Oct 21, 2025
3576d4b
UPSTREAM: wifi: ath12k: generalize GI and LTF fixed rate functions
Oct 24, 2025
aa6db26
UPSTREAM: wifi: ath12k: add EHT rate handling to existing set rate fu…
Oct 24, 2025
1d5142e
UPSTREAM: wifi: ath12k: Add EHT MCS/NSS rates to Peer Assoc
Oct 24, 2025
fea58b9
UPSTREAM: wifi: ath12k: Add EHT fixed GI/LTF
Oct 24, 2025
92ea402
UPSTREAM: wifi: ath12k: add EHT rates to ath12k_mac_op_set_bitrate_ma…
Oct 24, 2025
2e8f0bb
UPSTREAM: wifi: ath12k: Set EHT fixed rates for associated STAs
Oct 24, 2025
8dcf779
UPSTREAM: wifi: ath12k: Make firmware stats reset caller-driven
Oct 31, 2025
86d8b7d
UPSTREAM: wifi: ath12k: Fix timeout error during beacon stats retrieval
Oct 31, 2025
211c5cb
UPSTREAM: wifi: ath12k: Restructure PCI code to common and Wi-Fi 7 sp…
Aug 12, 2025
b5420c3
UPSTREAM: wifi: ath12k: Move Copy Engine configuration to Wi-Fi 7 spe…
Aug 12, 2025
4f57fa6
UPSTREAM: wifi: ath12k: Move Wi-Fi 7 WMI configuration to dedicated file
Aug 12, 2025
7c7f690
UPSTREAM: wifi: ath12k: Move Wi-Fi 7 MHI configuration to dedicated file
Aug 12, 2025
4e38fde
UPSTREAM: wifi: ath12k: Rename hw.c to Wi-Fi 7 specific implementatio…
Aug 12, 2025
483d1de
UPSTREAM: wifi: ath12k: Rename ahb_hif_ops to reflect generic usage
Aug 12, 2025
6c868bd
UPSTREAM: wifi: ath12k: Restructure ahb.c into common and Wi-Fi 7 spe…
Aug 12, 2025
a3ffcf5
UPSTREAM: wifi: ath12k: Move Wi-Fi 7 specific init routines to dedica…
Aug 12, 2025
2dacd28
UPSTREAM: wifi: ath12k: Move hw_init invocation to target-specific probe
Aug 12, 2025
92d4513
UPSTREAM: wifi: ath12k: Modularize driver into common and Wi-Fi 7 spe…
Aug 12, 2025
f757e12
UPSTREAM: wifi: ath12k: Rename ath12k_* symbols to ath12k_wifi7_* for…
Aug 12, 2025
ccfb476
UPSTREAM: wifi: ath12k: Remove HAL defines from shared PCI code
Aug 12, 2025
8ef9721
UPSTREAM: wifi: ath12k: Remove HAL define dependencies from shared AH…
Aug 12, 2025
b82d0c4
UPSTREAM: wifi: ath12k: Move hal_tx and hal_rx to wifi7 directory
Aug 28, 2025
2c6a6de
UPSTREAM: wifi: ath12k: Move hal_tx.h file to wifi7 directory
Aug 28, 2025
145bb1d
UPSTREAM: wifi: ath12k: Move hal_rx.h file to wifi7 directory
Aug 28, 2025
aebffc8
UPSTREAM: wifi: ath12k: Move HAL Rx wrapper APIs to dp_rx.h
Aug 28, 2025
afdf160
UPSTREAM: wifi: ath12k: Move Rx error related functions to wifi7 dire…
Aug 28, 2025
12d6771
UPSTREAM: wifi: ath12k: Move hal_desc.h file to wifi7 directory
Aug 28, 2025
b8b4a8a
UPSTREAM: wifi: ath12k: Move rx_desc.h file to wifi7 directory
Aug 28, 2025
7500c1e
UPSTREAM: wifi: ath12k: Move rxdma ring config functions to wifi7 dir…
Aug 28, 2025
2851d7c
UPSTREAM: wifi: ath12k: Move rx error and defrag functions to wifi7 d…
Aug 28, 2025
4fe3e22
UPSTREAM: wifi: ath12k: Move regular msdu processing functions to wif…
Aug 28, 2025
a7f760e
UPSTREAM: wifi: ath12k: Move srng processing to wifi7 directory
Aug 28, 2025
face49a
UPSTREAM: wifi: ath12k: Separate arch specific part of RX APIs
Aug 28, 2025
84bc062
UPSTREAM: wifi: ath12k: Move arch specific REO functions to wifi7 dir…
Aug 28, 2025
6f014d8
UPSTREAM: wifi: ath12k: Move arch specific rx tid and related functio…
Aug 28, 2025
e72db08
UPSTREAM: wifi: ath12k: Move arch specific tx APIs to wifi7 directory
Aug 28, 2025
9247026
UPSTREAM: wifi: ath12k: Move ath12k_dp_tx and related APIs to wifi7 d…
Aug 28, 2025
4ec5189
UPSTREAM: wifi: ath12k: Move HTT code in dp.h to newly introduced files
Aug 28, 2025
6b61bb7
UPSTREAM: wifi: ath12k: Move HTT Rx specific code to newly introduced…
Aug 28, 2025
bd24b34
UPSTREAM: wifi: ath12k: Move HTT Tx specific code to newly introduced…
Aug 28, 2025
2027695
UPSTREAM: wifi: ath12k: Move HTT specific code from dp.c to newly int…
Aug 28, 2025
9c01c69
UPSTREAM: wifi: ath12k: Remove non-compact TLV support from QCN
Sep 10, 2025
3d1bb8b
UPSTREAM: wifi: ath12k: Move the hal APIs to hardware specific files
Sep 10, 2025
4350d55
UPSTREAM: wifi: ath12k: unify HAL ops naming across chips
Sep 10, 2025
5096e62
UPSTREAM: wifi: ath12k: Replace ops with direct calls for rxdma ring …
Sep 10, 2025
a18b070
UPSTREAM: wifi: ath12k: Move hal_rx_ops callbacks to hal_ops
Sep 10, 2025
65e6c56
UPSTREAM: wifi: ath12k: Add new infra for the rx path
Sep 10, 2025
675ff59
UPSTREAM: wifi: ath12k: Remove hal_rx_ops and merge into hal_ops
Sep 10, 2025
bf83354
UPSTREAM: wifi: ath12k: Change the API prefixes to ath12k_wifi7 in tx/rx
Sep 10, 2025
1c222a3
UPSTREAM: wifi: ath12k: Convert ath12k_dp member in ath12k_base to po…
Sep 30, 2025
8a9a7e0
UPSTREAM: wifi: ath12k: Support arch-specific DP device allocation
Sep 30, 2025
619d03c
UPSTREAM: wifi: ath12k: Rearrange DP fields in ath12k_hw_group struct
Sep 30, 2025
b1d0103
UPSTREAM: wifi: ath12k: Add framework for hardware specific ieee80211…
Sep 30, 2025
0b6b1cc
UPSTREAM: wifi: ath12k: Add framework for hardware specific DP interr…
Sep 30, 2025
6ee792c
UPSTREAM: wifi: ath12k: Refactor ath12k_vif structure
Sep 30, 2025
20d0d8a
UPSTREAM: wifi: ath12k: Refactor data path pdev struct
Oct 7, 2025
a557ad5
UPSTREAM: wifi: ath12k: Rearrange PPDU radio stats
Oct 7, 2025
9e16ebd
UPSTREAM: wifi: ath12k: Move srng config and hal_ops to hw specific h…
Oct 9, 2025
32be02d
UPSTREAM: wifi: ath12k: Initialize desc_size through hal_init
Oct 9, 2025
aa93875
UPSTREAM: wifi: ath12k: Initialize hal_ops through hal_init
Oct 9, 2025
ab8b39a
UPSTREAM: wifi: ath12k: Move wbm_rbm_map to hw specific hal files
Oct 9, 2025
adee335
UPSTREAM: wifi: ath12k: Move hal_params and regs to hal from hw
Oct 9, 2025
f3d4c57
UPSTREAM: wifi: ath12k: Add direct HAL pointer in ath12k_dp
Oct 9, 2025
de02cf8
UPSTREAM: wifi: ath12k: Use hal handle instead of ab handle
Oct 9, 2025
3c7cebc
UPSTREAM: wifi: ath12k: Move HAL CE setup and SRNG related APIs to wi…
Oct 9, 2025
9231464
UPSTREAM: wifi: ath12k: Move HAL SRNG shadow config and get ring id A…
Oct 9, 2025
c4646c8
UPSTREAM: wifi: ath12k: Move HAL CE desc related APIs to wifi7 directory
Oct 9, 2025
924e4dd
UPSTREAM: wifi: ath12k: Move HAL CE status and set link desc addr API…
Oct 9, 2025
51423e1
UPSTREAM: wifi: ath12k: Move HAL Tx, REO and link idle setup related …
Oct 9, 2025
27d5c16
UPSTREAM: wifi: ath12k: Move HAL REO and Rx buf related APIs to wifi7…
Oct 9, 2025
cdedfed
UPSTREAM: wifi: ath12k: Move HAL Cookie Conversion and RBM related AP…
Oct 9, 2025
5913dc6
UPSTREAM: wifi: ath12k: Segregate the common and wifi7 specific struc…
Oct 9, 2025
4cf8991
UPSTREAM: wifi: ath12k: Remove the unused ring inits in wcn
Oct 9, 2025
82bcfe9
UPSTREAM: wifi: ath12k: Rename hal_ops to ops
Oct 9, 2025
dbefc5f
UPSTREAM: wifi: ath12k: Drop hal_ prefix from hardware register names
Oct 9, 2025
abb5073
UPSTREAM: wifi: ath12k: Move DP related functions from peer.c to dp_p…
Oct 24, 2025
3de1897
UPSTREAM: wifi: ath12k: Rename ath12k_peer to ath12k_dp_link_peer
Oct 24, 2025
f7e3fd5
UPSTREAM: wifi: ath12k: Add hash table for ath12k_link_sta in ath12k_…
Oct 24, 2025
d38699f
UPSTREAM: wifi: ath12k: Move ath12k_dp_link_peer list from ath12k_bas…
Oct 24, 2025
5577c25
UPSTREAM: wifi: ath12k: Add hash table for ath12k_dp_link_peer
Oct 24, 2025
c197974
UPSTREAM: wifi: ath12k: Define ath12k_dp_peer structure & APIs for cr…
Oct 24, 2025
cc14eda
UPSTREAM: wifi: ath12k: Attach and detach ath12k_dp_link_peer to ath1…
Oct 24, 2025
42b2974
UPSTREAM: wifi: ath12k: Use ath12k_dp_peer in per packet Tx & Rx paths
Oct 24, 2025
8b09f94
UPSTREAM: wifi: ath12k: Add lockdep warn for RCU
Oct 24, 2025
da1c45e
UPSTREAM: wifi: ath12k: Add callbacks in arch_ops for rx APIs
Nov 3, 2025
cd4f258
UPSTREAM: wifi: ath12k: Move DP device stats to ath12k_dp
Nov 3, 2025
abc4b50
UPSTREAM: wifi: ath12k: Move DP specific link stats to DP link peer
Nov 3, 2025
623d6f5
UPSTREAM: wifi: ath12k: Add helper to free DP link peer
Nov 3, 2025
4b877e0
UPSTREAM: wifi: ath12k: Move ieee80211_ops callback to the arch speci…
Nov 3, 2025
07cf3fb
UPSTREAM: wifi: ath12k: Remove the wifi7 header inclusions in common …
Nov 3, 2025
7e487a0
UPSTREAM: wifi: ath12k: Move ath12k_dp_rx_frags_cleanup API to Wi-Fi 7
Nov 3, 2025
fabed49
UPSTREAM: wifi: ath12k: Move ath12k_dp_rx_get_peer_id API to Wi-Fi 7
Nov 3, 2025
a0382af
UPSTREAM: wifi: ath12k: Remove arch-specific HAL dependencies from co…
Nov 3, 2025
42bca71
UPSTREAM: wifi: ath12k: Build all the files in wifi7 directory into a…
Nov 3, 2025
420b945
UPSTREAM: wifi: ath12k: Use dp objects in performance critical paths
Nov 3, 2025
f8c9666
UPSTREAM: wifi: ath12k: Replace lock/unlock with guard()
Nov 3, 2025
ae31697
UPSTREAM: wifi: ath12k: Move monitor ring processing to Wi-Fi 7 module
Nov 10, 2025
3d7558c
UPSTREAM: wifi: ath12k: Move monitor status processing to Wi-Fi 7 module
Nov 10, 2025
b72cc64
UPSTREAM: wifi: ath12k: Move MPDU pop functionality to Wi-Fi 7 module
Nov 10, 2025
1be2ba2
UPSTREAM: wifi: ath12k: Move RX status TLV parsing to Wi-Fi 7 module
Nov 10, 2025
986af21
UPSTREAM: wifi: ath12k: Move TX monitor functionality to Wi-Fi 7 module
Nov 10, 2025
349d6ba
UPSTREAM: wifi: ath12k: Move HT/VHT SIG processing to Wi-Fi 7 module
Nov 10, 2025
1b77595
UPSTREAM: wifi: ath12k: Move HE SIG processing to Wi-Fi 7 module
Nov 10, 2025
c44c4a2
UPSTREAM: wifi: ath12k: Move EHT SIG processing to Wi-Fi 7 module
Nov 10, 2025
6a1ccf6
UPSTREAM: wifi: ath12k: Move remaining SIG TLV parsing to Wi-Fi 7 module
Nov 10, 2025
f6a5aa8
UPSTREAM: wifi: ath12k: Move MU user processing to Wi-Fi 7 module
Nov 10, 2025
ab2d931
UPSTREAM: wifi: ath12k: Move MSDU END TLV processing to Wi-Fi 7 module
Nov 10, 2025
900604e
UPSTREAM: wifi: ath12k: Remove Wi-Fi 7 header dependencies from commo…
Nov 10, 2025
b569e64
UPSTREAM: wifi: ath12k: add the missing RCU lock in ath12k_dp_tx_free…
Nov 19, 2025
816e3c8
UPSTREAM: wifi: ath12k: move firmware stats request outside of atomic…
Nov 19, 2025
5599506
UPSTREAM: wifi: ath12k: Skip DP peer creation for scan vdev
Dec 7, 2025
dca03ff
UPSTREAM: Merge branch 'ath12k-ng' into ath-next
jeff-t-johnson Jan 30, 2026
7aedfc7
UPSTREAM: wifi: ath12k: remove redundant pci_set_drvdata() call
adminchev Nov 27, 2025
f2d0d24
UPSTREAM: wifi: ath12k: clean up on error in ath12k_dp_setup()
Dec 18, 2025
eab1f4c
UPSTREAM: wifi: ath12k: do WoW offloads only on primary link
Nov 3, 2025
d18441b
UPSTREAM: wifi: ath12k: refactor PCI window register access
Jan 12, 2026
58e3d84
UPSTREAM: wifi: ath12k: refactor REO CMD ring handling
Jan 12, 2026
f095bd2
UPSTREAM: wifi: ath12k: refactor REO status ring handling
Jan 12, 2026
da5f479
UPSTREAM: wifi: ath12k: fix preferred hardware mode calculation
Jan 12, 2026
c73634f
UPSTREAM: wifi: ath12k: refactor 320 MHz bandwidth support parsing
Jan 12, 2026
73268bb
UPSTREAM: wifi: ath12k: fix mac phy capability parsing
Jan 12, 2026
de9be65
UPSTREAM: wifi: ath12k: add hardware registers for QCC2072
Jan 12, 2026
c96451d
UPSTREAM: wifi: ath12k: add hardware parameters for QCC2072
Jan 12, 2026
5b30f96
UPSTREAM: wifi: ath12k: support LPASS_SHARED target memory type
Jan 12, 2026
83dca9a
UPSTREAM: wifi: ath12k: support downloading auxiliary ucode image for…
Jan 12, 2026
7fd6da7
UPSTREAM: wifi: ath12k: add HAL descriptor and ops for QCC2072
Jan 12, 2026
4c60f71
UPSTREAM: wifi: ath12k: add hardware ops support for QCC2072
Jan 12, 2026
b800d95
UPSTREAM: wifi: ath12k: handle REO CMD ring for QCC2072
Jan 12, 2026
920be38
UPSTREAM: wifi: ath12k: handle REO status ring for QCC2072
Jan 12, 2026
f10fff3
UPSTREAM: wifi: ath12k: limit number of channels per WMI command
Jan 12, 2026
8826cf4
UPSTREAM: wifi: ath12k: send peer meta data version to firmware
Jan 12, 2026
3bebd74
UPSTREAM: wifi: ath12k: fix PCIE_LOCAL_REG_QRTR_NODE_ID definition fo…
miaoqing-quic Jan 12, 2026
7640795
UPSTREAM: wifi: ath12k: enable QCC2072 support
Jan 12, 2026
d9fb4f7
UPSTREAM: wifi: ath12k: Fix wrong P2P device link id issue
MilanoPipo Jan 8, 2026
7094437
UPSTREAM: wifi: ath12k: Fix scan state stuck in ABORTING
MilanoPipo Dec 25, 2025
7f4a4e1
UPSTREAM: 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