forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/net/wireless/ath/ath10k/hif.h
....@@ -1,18 +1,7 @@
1
+/* SPDX-License-Identifier: ISC */
12 /*
23 * Copyright (c) 2005-2011 Atheros Communications Inc.
34 * Copyright (c) 2011-2015,2017 Qualcomm Atheros, Inc.
4
- *
5
- * Permission to use, copy, modify, and/or distribute this software for any
6
- * purpose with or without fee is hereby granted, provided that the above
7
- * copyright notice and this permission notice appear in all copies.
8
- *
9
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
165 */
176
187 #ifndef _HIF_H_
....@@ -22,6 +11,12 @@
2211 #include "core.h"
2312 #include "bmi.h"
2413 #include "debug.h"
14
+
15
+/* Types of fw logging mode */
16
+enum ath_dbg_mode {
17
+ ATH10K_ENABLE_FW_LOG_DIAG,
18
+ ATH10K_ENABLE_FW_LOG_CE,
19
+};
2520
2621 struct ath10k_hif_sg_item {
2722 u16 transfer_id;
....@@ -59,6 +54,10 @@
5954 */
6055 void (*stop)(struct ath10k *ar);
6156
57
+ int (*start_post)(struct ath10k *ar);
58
+
59
+ int (*get_htt_tx_complete)(struct ath10k *ar);
60
+
6261 int (*map_service_to_pipe)(struct ath10k *ar, u16 service_id,
6362 u8 *ul_pipe, u8 *dl_pipe);
6463
....@@ -81,7 +80,7 @@
8180 void (*write32)(struct ath10k *ar, u32 address, u32 value);
8281
8382 /* Power up the device and enter BMI transfer mode for FW download */
84
- int (*power_up)(struct ath10k *ar);
83
+ int (*power_up)(struct ath10k *ar, enum ath10k_firmware_mode fw_mode);
8584
8685 /* Power down the device and free up resources. stop() must be called
8786 * before this if start() was called earlier
....@@ -97,6 +96,7 @@
9796
9897 int (*get_target_info)(struct ath10k *ar,
9998 struct bmi_target_info *target_info);
99
+ int (*set_target_log_mode)(struct ath10k *ar, u8 fw_log_mode);
100100 };
101101
102102 static inline int ath10k_hif_tx_sg(struct ath10k *ar, u8 pipe_id,
....@@ -139,6 +139,20 @@
139139 return ar->hif.ops->stop(ar);
140140 }
141141
142
+static inline int ath10k_hif_start_post(struct ath10k *ar)
143
+{
144
+ if (ar->hif.ops->start_post)
145
+ return ar->hif.ops->start_post(ar);
146
+ return 0;
147
+}
148
+
149
+static inline int ath10k_hif_get_htt_tx_complete(struct ath10k *ar)
150
+{
151
+ if (ar->hif.ops->get_htt_tx_complete)
152
+ return ar->hif.ops->get_htt_tx_complete(ar);
153
+ return 0;
154
+}
155
+
142156 static inline int ath10k_hif_map_service_to_pipe(struct ath10k *ar,
143157 u16 service_id,
144158 u8 *ul_pipe, u8 *dl_pipe)
....@@ -156,7 +170,8 @@
156170 static inline void ath10k_hif_send_complete_check(struct ath10k *ar,
157171 u8 pipe_id, int force)
158172 {
159
- ar->hif.ops->send_complete_check(ar, pipe_id, force);
173
+ if (ar->hif.ops->send_complete_check)
174
+ ar->hif.ops->send_complete_check(ar, pipe_id, force);
160175 }
161176
162177 static inline u16 ath10k_hif_get_free_queue_number(struct ath10k *ar,
....@@ -165,9 +180,10 @@
165180 return ar->hif.ops->get_free_queue_number(ar, pipe_id);
166181 }
167182
168
-static inline int ath10k_hif_power_up(struct ath10k *ar)
183
+static inline int ath10k_hif_power_up(struct ath10k *ar,
184
+ enum ath10k_firmware_mode fw_mode)
169185 {
170
- return ar->hif.ops->power_up(ar);
186
+ return ar->hif.ops->power_up(ar, fw_mode);
171187 }
172188
173189 static inline void ath10k_hif_power_down(struct ath10k *ar)
....@@ -231,4 +247,12 @@
231247 return ar->hif.ops->get_target_info(ar, tgt_info);
232248 }
233249
250
+static inline int ath10k_hif_set_target_log_mode(struct ath10k *ar,
251
+ u8 fw_log_mode)
252
+{
253
+ if (!ar->hif.ops->set_target_log_mode)
254
+ return -EOPNOTSUPP;
255
+
256
+ return ar->hif.ops->set_target_log_mode(ar, fw_log_mode);
257
+}
234258 #endif /* _HIF_H_ */