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 "hw.h"
10 #include "ce.h"
11 #include "qmi.h"
12 
13 struct ath10k_snoc_drv_priv {
14 	enum ath10k_hw_rev hw_rev;
15 	u64 dma_mask;
16 	u32 msa_size;
17 };
18 
19 struct snoc_state {
20 	u32 pipe_cfg_addr;
21 	u32 svc_to_pipe_map;
22 };
23 
24 struct ath10k_snoc_pipe {
25 	struct ath10k_ce_pipe *ce_hdl;
26 	u8 pipe_num;
27 	struct ath10k *hif_ce_state;
28 	size_t buf_sz;
29 	/* protect ce info */
30 	spinlock_t pipe_lock;
31 	struct ath10k_snoc *ar_snoc;
32 };
33 
34 struct ath10k_snoc_target_info {
35 	u32 target_version;
36 	u32 target_type;
37 	u32 target_revision;
38 	u32 soc_version;
39 };
40 
41 struct ath10k_snoc_ce_irq {
42 	u32 irq_line;
43 };
44 
45 enum ath10k_snoc_flags {
46 	ATH10K_SNOC_FLAG_REGISTERED,
47 	ATH10K_SNOC_FLAG_UNREGISTERING,
48 	ATH10K_SNOC_FLAG_RECOVERY,
49 	ATH10K_SNOC_FLAG_8BIT_HOST_CAP_QUIRK,
50 };
51 
52 struct clk_bulk_data;
53 struct regulator_bulk_data;
54 
55 struct ath10k_snoc {
56 	struct platform_device *dev;
57 	struct ath10k *ar;
58 	unsigned int use_tz;
59 	struct ath10k_firmware {
60 		struct device *dev;
61 		dma_addr_t fw_start_addr;
62 		struct iommu_domain *iommu_domain;
63 		size_t mapped_mem_size;
64 	} fw;
65 	void __iomem *mem;
66 	dma_addr_t mem_pa;
67 	struct ath10k_snoc_target_info target_info;
68 	size_t mem_len;
69 	struct ath10k_snoc_pipe pipe_info[CE_COUNT_MAX];
70 	struct ath10k_snoc_ce_irq ce_irqs[CE_COUNT_MAX];
71 	struct ath10k_ce ce;
72 	struct timer_list rx_post_retry;
73 	struct regulator_bulk_data *vregs;
74 	size_t num_vregs;
75 	struct clk_bulk_data *clks;
76 	size_t num_clks;
77 	struct ath10k_qmi *qmi;
78 	unsigned long flags;
79 	bool xo_cal_supported;
80 	u32 xo_cal_data;
81 };
82 
83 static inline struct ath10k_snoc *ath10k_snoc_priv(struct ath10k *ar)
84 {
85 	return (struct ath10k_snoc *)ar->drv_priv;
86 }
87 
88 int ath10k_snoc_fw_indication(struct ath10k *ar, u64 type);
89 void ath10k_snoc_fw_crashed_dump(struct ath10k *ar);
90 
91 #endif /* _SNOC_H_ */
92