| .. | .. |
|---|
| 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 _HIF_H_ |
|---|
| .. | .. |
|---|
| 22 | 11 | #include "core.h" |
|---|
| 23 | 12 | #include "bmi.h" |
|---|
| 24 | 13 | #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 | +}; |
|---|
| 25 | 20 | |
|---|
| 26 | 21 | struct ath10k_hif_sg_item { |
|---|
| 27 | 22 | u16 transfer_id; |
|---|
| .. | .. |
|---|
| 59 | 54 | */ |
|---|
| 60 | 55 | void (*stop)(struct ath10k *ar); |
|---|
| 61 | 56 | |
|---|
| 57 | + int (*start_post)(struct ath10k *ar); |
|---|
| 58 | + |
|---|
| 59 | + int (*get_htt_tx_complete)(struct ath10k *ar); |
|---|
| 60 | + |
|---|
| 62 | 61 | int (*map_service_to_pipe)(struct ath10k *ar, u16 service_id, |
|---|
| 63 | 62 | u8 *ul_pipe, u8 *dl_pipe); |
|---|
| 64 | 63 | |
|---|
| .. | .. |
|---|
| 81 | 80 | void (*write32)(struct ath10k *ar, u32 address, u32 value); |
|---|
| 82 | 81 | |
|---|
| 83 | 82 | /* 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); |
|---|
| 85 | 84 | |
|---|
| 86 | 85 | /* Power down the device and free up resources. stop() must be called |
|---|
| 87 | 86 | * before this if start() was called earlier |
|---|
| .. | .. |
|---|
| 97 | 96 | |
|---|
| 98 | 97 | int (*get_target_info)(struct ath10k *ar, |
|---|
| 99 | 98 | struct bmi_target_info *target_info); |
|---|
| 99 | + int (*set_target_log_mode)(struct ath10k *ar, u8 fw_log_mode); |
|---|
| 100 | 100 | }; |
|---|
| 101 | 101 | |
|---|
| 102 | 102 | static inline int ath10k_hif_tx_sg(struct ath10k *ar, u8 pipe_id, |
|---|
| .. | .. |
|---|
| 139 | 139 | return ar->hif.ops->stop(ar); |
|---|
| 140 | 140 | } |
|---|
| 141 | 141 | |
|---|
| 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 | + |
|---|
| 142 | 156 | static inline int ath10k_hif_map_service_to_pipe(struct ath10k *ar, |
|---|
| 143 | 157 | u16 service_id, |
|---|
| 144 | 158 | u8 *ul_pipe, u8 *dl_pipe) |
|---|
| .. | .. |
|---|
| 156 | 170 | static inline void ath10k_hif_send_complete_check(struct ath10k *ar, |
|---|
| 157 | 171 | u8 pipe_id, int force) |
|---|
| 158 | 172 | { |
|---|
| 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); |
|---|
| 160 | 175 | } |
|---|
| 161 | 176 | |
|---|
| 162 | 177 | static inline u16 ath10k_hif_get_free_queue_number(struct ath10k *ar, |
|---|
| .. | .. |
|---|
| 165 | 180 | return ar->hif.ops->get_free_queue_number(ar, pipe_id); |
|---|
| 166 | 181 | } |
|---|
| 167 | 182 | |
|---|
| 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) |
|---|
| 169 | 185 | { |
|---|
| 170 | | - return ar->hif.ops->power_up(ar); |
|---|
| 186 | + return ar->hif.ops->power_up(ar, fw_mode); |
|---|
| 171 | 187 | } |
|---|
| 172 | 188 | |
|---|
| 173 | 189 | static inline void ath10k_hif_power_down(struct ath10k *ar) |
|---|
| .. | .. |
|---|
| 231 | 247 | return ar->hif.ops->get_target_info(ar, tgt_info); |
|---|
| 232 | 248 | } |
|---|
| 233 | 249 | |
|---|
| 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 | +} |
|---|
| 234 | 258 | #endif /* _HIF_H_ */ |
|---|