forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/net/wireless/ath/ath10k/bmi.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 _BMI_H_
....@@ -56,6 +45,15 @@
5645 sizeof(u32) + \
5746 sizeof(u32))
5847
48
+/* Maximum data size used for large BMI transfers */
49
+#define BMI_MAX_LARGE_DATA_SIZE 2048
50
+
51
+/* len = cmd + addr + length */
52
+#define BMI_MAX_LARGE_CMDBUF_SIZE (BMI_MAX_LARGE_DATA_SIZE + \
53
+ sizeof(u32) + \
54
+ sizeof(u32) + \
55
+ sizeof(u32))
56
+
5957 /* BMI Commands */
6058
6159 enum bmi_cmd_id {
....@@ -86,6 +84,10 @@
8684 #define BMI_PARAM_GET_FLASH_BOARD_ID 0x8000
8785 #define BMI_PARAM_FLASH_SECTION_ALL 0x10000
8886
87
+/* Dual-band Extended Board ID */
88
+#define BMI_PARAM_GET_EXT_BOARD_ID 0x40000
89
+#define ATH10K_BMI_EXT_BOARD_ID_SUPPORT 0x40000
90
+
8991 #define ATH10K_BMI_BOARD_ID_FROM_OTP_MASK 0x7c00
9092 #define ATH10K_BMI_BOARD_ID_FROM_OTP_LSB 10
9193
....@@ -93,6 +95,7 @@
9395 #define ATH10K_BMI_CHIP_ID_FROM_OTP_LSB 15
9496
9597 #define ATH10K_BMI_BOARD_ID_STATUS_MASK 0xff
98
+#define ATH10K_BMI_EBOARD_ID_STATUS_MASK 0xff
9699
97100 struct bmi_cmd {
98101 __le32 id; /* enum bmi_cmd_id */
....@@ -190,6 +193,35 @@
190193 u32 type;
191194 };
192195
196
+struct bmi_segmented_file_header {
197
+ __le32 magic_num;
198
+ __le32 file_flags;
199
+ u8 data[];
200
+};
201
+
202
+struct bmi_segmented_metadata {
203
+ __le32 addr;
204
+ __le32 length;
205
+ u8 data[];
206
+};
207
+
208
+#define BMI_SGMTFILE_MAGIC_NUM 0x544d4753 /* "SGMT" */
209
+#define BMI_SGMTFILE_FLAG_COMPRESS 1
210
+
211
+/* Special values for bmi_segmented_metadata.length (all have high bit set) */
212
+
213
+/* end of segmented data */
214
+#define BMI_SGMTFILE_DONE 0xffffffff
215
+
216
+/* Board Data segment */
217
+#define BMI_SGMTFILE_BDDATA 0xfffffffe
218
+
219
+/* set beginning address */
220
+#define BMI_SGMTFILE_BEGINADDR 0xfffffffd
221
+
222
+/* immediate function execution */
223
+#define BMI_SGMTFILE_EXEC 0xfffffffc
224
+
193225 /* in jiffies */
194226 #define BMI_COMMUNICATION_TIMEOUT_HZ (3 * HZ)
195227
....@@ -235,8 +267,11 @@
235267 int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 param, u32 *result);
236268 int ath10k_bmi_lz_stream_start(struct ath10k *ar, u32 address);
237269 int ath10k_bmi_lz_data(struct ath10k *ar, const void *buffer, u32 length);
270
+
238271 int ath10k_bmi_fast_download(struct ath10k *ar, u32 address,
239272 const void *buffer, u32 length);
240273 int ath10k_bmi_read_soc_reg(struct ath10k *ar, u32 address, u32 *reg_val);
241274 int ath10k_bmi_write_soc_reg(struct ath10k *ar, u32 address, u32 reg_val);
275
+int ath10k_bmi_set_start(struct ath10k *ar, u32 address);
276
+
242277 #endif /* _BMI_H_ */