| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: ISC */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2005-2011 Atheros Communications Inc. |
|---|
| 3 | 4 | * 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. |
|---|
| 16 | 5 | */ |
|---|
| 17 | 6 | |
|---|
| 18 | 7 | #ifndef _BMI_H_ |
|---|
| .. | .. |
|---|
| 56 | 45 | sizeof(u32) + \ |
|---|
| 57 | 46 | sizeof(u32)) |
|---|
| 58 | 47 | |
|---|
| 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 | + |
|---|
| 59 | 57 | /* BMI Commands */ |
|---|
| 60 | 58 | |
|---|
| 61 | 59 | enum bmi_cmd_id { |
|---|
| .. | .. |
|---|
| 86 | 84 | #define BMI_PARAM_GET_FLASH_BOARD_ID 0x8000 |
|---|
| 87 | 85 | #define BMI_PARAM_FLASH_SECTION_ALL 0x10000 |
|---|
| 88 | 86 | |
|---|
| 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 | + |
|---|
| 89 | 91 | #define ATH10K_BMI_BOARD_ID_FROM_OTP_MASK 0x7c00 |
|---|
| 90 | 92 | #define ATH10K_BMI_BOARD_ID_FROM_OTP_LSB 10 |
|---|
| 91 | 93 | |
|---|
| .. | .. |
|---|
| 93 | 95 | #define ATH10K_BMI_CHIP_ID_FROM_OTP_LSB 15 |
|---|
| 94 | 96 | |
|---|
| 95 | 97 | #define ATH10K_BMI_BOARD_ID_STATUS_MASK 0xff |
|---|
| 98 | +#define ATH10K_BMI_EBOARD_ID_STATUS_MASK 0xff |
|---|
| 96 | 99 | |
|---|
| 97 | 100 | struct bmi_cmd { |
|---|
| 98 | 101 | __le32 id; /* enum bmi_cmd_id */ |
|---|
| .. | .. |
|---|
| 190 | 193 | u32 type; |
|---|
| 191 | 194 | }; |
|---|
| 192 | 195 | |
|---|
| 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 | + |
|---|
| 193 | 225 | /* in jiffies */ |
|---|
| 194 | 226 | #define BMI_COMMUNICATION_TIMEOUT_HZ (3 * HZ) |
|---|
| 195 | 227 | |
|---|
| .. | .. |
|---|
| 235 | 267 | int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 param, u32 *result); |
|---|
| 236 | 268 | int ath10k_bmi_lz_stream_start(struct ath10k *ar, u32 address); |
|---|
| 237 | 269 | int ath10k_bmi_lz_data(struct ath10k *ar, const void *buffer, u32 length); |
|---|
| 270 | + |
|---|
| 238 | 271 | int ath10k_bmi_fast_download(struct ath10k *ar, u32 address, |
|---|
| 239 | 272 | const void *buffer, u32 length); |
|---|
| 240 | 273 | int ath10k_bmi_read_soc_reg(struct ath10k *ar, u32 address, u32 *reg_val); |
|---|
| 241 | 274 | 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 | + |
|---|
| 242 | 277 | #endif /* _BMI_H_ */ |
|---|