1/* SPDX-License-Identifier: BSD-3-Clause-Clear */
2/*
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2022-2025, Qualcomm Innovation Center, Inc. All rights reserved.
5 */
6#ifndef ATH12K_AHB_H
7#define ATH12K_AHB_H
8
9#include <linux/clk.h>
10#include <linux/remoteproc/qcom_rproc.h>
11#include "core.h"
12
13#define ATH12K_AHB_RECOVERY_TIMEOUT (3 * HZ)
14
15#define ATH12K_AHB_SMP2P_SMEM_MSG GENMASK(15, 0)
16#define ATH12K_AHB_SMP2P_SMEM_SEQ_NO GENMASK(31, 16)
17#define ATH12K_AHB_SMP2P_SMEM_VALUE_MASK 0xFFFFFFFF
18#define ATH12K_PCI_CE_WAKE_IRQ 2
19#define ATH12K_PCI_IRQ_CE0_OFFSET 3
20#define ATH12K_ROOTPD_READY_TIMEOUT (5 * HZ)
21#define ATH12K_RPROC_AFTER_POWERUP QCOM_SSR_AFTER_POWERUP
22#define ATH12K_AHB_FW_PREFIX "q6_fw"
23#define ATH12K_AHB_FW_SUFFIX ".mdt"
24#define ATH12K_AHB_FW2 "iu_fw.mdt"
25#define ATH12K_AHB_UPD_SWID 0x12
26#define ATH12K_USERPD_SPAWN_TIMEOUT (5 * HZ)
27#define ATH12K_USERPD_READY_TIMEOUT (10 * HZ)
28#define ATH12K_USERPD_STOP_TIMEOUT (5 * HZ)
29#define ATH12K_USERPD_ID_MASK GENMASK(9, 8)
30#define ATH12K_USERPD_FW_NAME_LEN 35
31
32enum ath12k_ahb_smp2p_msg_id {
33 ATH12K_AHB_POWER_SAVE_ENTER = 1,
34 ATH12K_AHB_POWER_SAVE_EXIT,
35};
36
37enum ath12k_ahb_userpd_irq {
38 ATH12K_USERPD_SPAWN_IRQ,
39 ATH12K_USERPD_READY_IRQ,
40 ATH12K_USERPD_STOP_ACK_IRQ,
41 ATH12K_USERPD_MAX_IRQ,
42};
43
44struct ath12k_base;
45
46struct ath12k_ahb {
47 struct ath12k_base *ab;
48 struct rproc *tgt_rproc;
49 struct clk *xo_clk;
50 struct completion rootpd_ready;
51 struct notifier_block root_pd_nb;
52 void *root_pd_notifier;
53 struct qcom_smem_state *spawn_state;
54 struct qcom_smem_state *stop_state;
55 struct completion userpd_spawned;
56 struct completion userpd_ready;
57 struct completion userpd_stopped;
58 u32 userpd_id;
59 u32 spawn_bit;
60 u32 stop_bit;
61 int userpd_irq_num[ATH12K_USERPD_MAX_IRQ];
62};
63
64static inline struct ath12k_ahb *ath12k_ab_to_ahb(struct ath12k_base *ab)
65{
66 return (struct ath12k_ahb *)ab->drv_priv;
67}
68
69#ifdef CONFIG_ATH12K_AHB
70int ath12k_ahb_init(void);
71void ath12k_ahb_exit(void);
72#else
73static inline int ath12k_ahb_init(void)
74{
75 return 0;
76}
77
78static inline void ath12k_ahb_exit(void) {};
79#endif
80#endif
81

source code of linux/drivers/net/wireless/ath/ath12k/ahb.h