xref: /freebsd/sys/contrib/dev/athk/ath10k/snoc.h (revision 4d846d260e2b9a3d4d0a701462568268cbfe7a5b)
1 /* SPDX-License-Identifier: ISC */
2 /*
3  * Copyright (c) 2018 The Linux Foundation. All rights reserved.
4  */
5 
6 #ifndef _SNOC_H_
7 #define _SNOC_H_
8 
9 #include <linux/notifier.h>
10 
11 #include "hw.h"
12 #include "ce.h"
13 #include "qmi.h"
14 
15 struct ath10k_snoc_drv_priv {
16 	enum ath10k_hw_rev hw_rev;
17 	u64 dma_mask;
18 	u32 msa_size;
19 };
20 
21 struct snoc_state {
22 	u32 pipe_cfg_addr;
23 	u32 svc_to_pipe_map;
24 };
25 
26 struct ath10k_snoc_pipe {
27 	struct ath10k_ce_pipe *ce_hdl;
28 	u8 pipe_num;
29 	struct ath10k *hif_ce_state;
30 	size_t buf_sz;
31 	/* protect ce info */
32 	spinlock_t pipe_lock;
33 	struct ath10k_snoc *ar_snoc;
34 };
35 
36 struct ath10k_snoc_target_info {
37 	u32 target_version;
38 	u32 target_type;
39 	u32 target_revision;
40 	u32 soc_version;
41 };
42 
43 struct ath10k_snoc_ce_irq {
44 	u32 irq_line;
45 };
46 
47 enum ath10k_snoc_flags {
48 	ATH10K_SNOC_FLAG_REGISTERED,
49 	ATH10K_SNOC_FLAG_UNREGISTERING,
50 	ATH10K_SNOC_FLAG_MODEM_STOPPED,
51 	ATH10K_SNOC_FLAG_RECOVERY,
52 	ATH10K_SNOC_FLAG_8BIT_HOST_CAP_QUIRK,
53 };
54 
55 struct clk_bulk_data;
56 struct regulator_bulk_data;
57 
58 struct ath10k_snoc {
59 	struct platform_device *dev;
60 	struct ath10k *ar;
61 	unsigned int use_tz;
62 	struct ath10k_firmware {
63 		struct device *dev;
64 		dma_addr_t fw_start_addr;
65 		struct iommu_domain *iommu_domain;
66 		size_t mapped_mem_size;
67 	} fw;
68 	void __iomem *mem;
69 	dma_addr_t mem_pa;
70 	struct ath10k_snoc_target_info target_info;
71 	size_t mem_len;
72 	struct ath10k_snoc_pipe pipe_info[CE_COUNT_MAX];
73 	struct ath10k_snoc_ce_irq ce_irqs[CE_COUNT_MAX];
74 	struct ath10k_ce ce;
75 	struct timer_list rx_post_retry;
76 	struct regulator_bulk_data *vregs;
77 	size_t num_vregs;
78 	struct clk_bulk_data *clks;
79 	size_t num_clks;
80 	struct ath10k_qmi *qmi;
81 	struct notifier_block nb;
82 	void *notifier;
83 	unsigned long flags;
84 	bool xo_cal_supported;
85 	u32 xo_cal_data;
86 	DECLARE_BITMAP(pending_ce_irqs, CE_COUNT_MAX);
87 };
88 
89 static inline struct ath10k_snoc *ath10k_snoc_priv(struct ath10k *ar)
90 {
91 	return (struct ath10k_snoc *)ar->drv_priv;
92 }
93 
94 int ath10k_snoc_fw_indication(struct ath10k *ar, u64 type);
95 void ath10k_snoc_fw_crashed_dump(struct ath10k *ar);
96 
97 #endif /* _SNOC_H_ */
98