Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 1 | /* |
Nirav Shah | fb79af8 | 2018-03-12 18:10:33 +0530 | [diff] [blame] | 2 | * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 3 | * |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 19 | #ifndef __PLD_PCIE_H__ |
| 20 | #define __PLD_PCIE_H__ |
| 21 | |
Yuanyuan Liu | 16a5562 | 2016-09-14 16:15:59 -0700 | [diff] [blame] | 22 | #ifdef CONFIG_PLD_PCIE_CNSS |
Yue Ma | e6a7a32 | 2016-08-31 11:09:23 -0700 | [diff] [blame] | 23 | #include <net/cnss2.h> |
| 24 | #endif |
Yuanyuan Liu | f7aea12 | 2016-05-25 16:39:40 -0700 | [diff] [blame] | 25 | #include "pld_internal.h" |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 26 | |
Qun Zhang | 4a83a46 | 2018-09-11 16:28:51 +0800 | [diff] [blame] | 27 | #ifdef MULTI_IF_NAME |
| 28 | #define PREFIX MULTI_IF_NAME "/" |
| 29 | #else |
| 30 | #define PREFIX "" |
| 31 | #endif |
| 32 | |
Nirav Shah | fb79af8 | 2018-03-12 18:10:33 +0530 | [diff] [blame] | 33 | #ifndef HIF_PCI |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 34 | static inline int pld_pcie_register_driver(void) |
| 35 | { |
| 36 | return 0; |
| 37 | } |
| 38 | |
| 39 | static inline void pld_pcie_unregister_driver(void) |
| 40 | { |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 41 | } |
| 42 | |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 43 | static inline int pld_pcie_get_ce_id(struct device *dev, int irq) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 44 | { |
| 45 | return 0; |
| 46 | } |
| 47 | #else |
| 48 | int pld_pcie_register_driver(void); |
| 49 | void pld_pcie_unregister_driver(void); |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 50 | int pld_pcie_get_ce_id(struct device *dev, int irq); |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 51 | #endif |
| 52 | |
Yue Ma | 0804752 | 2016-11-08 18:53:26 -0800 | [diff] [blame] | 53 | #ifndef CONFIG_PLD_PCIE_CNSS |
| 54 | static inline int pld_pcie_wlan_enable(struct device *dev, |
| 55 | struct pld_wlan_enable_cfg *config, |
| 56 | enum pld_driver_mode mode, |
| 57 | const char *host_version) |
| 58 | { |
| 59 | return 0; |
| 60 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 61 | |
Yue Ma | 0804752 | 2016-11-08 18:53:26 -0800 | [diff] [blame] | 62 | static inline int pld_pcie_wlan_disable(struct device *dev, |
| 63 | enum pld_driver_mode mode) |
| 64 | { |
| 65 | return 0; |
| 66 | } |
| 67 | #else |
| 68 | int pld_pcie_wlan_enable(struct device *dev, struct pld_wlan_enable_cfg *config, |
| 69 | enum pld_driver_mode mode, const char *host_version); |
| 70 | int pld_pcie_wlan_disable(struct device *dev, enum pld_driver_mode mode); |
| 71 | #endif |
| 72 | |
Nirav Shah | 74be384 | 2018-06-26 19:17:25 +0530 | [diff] [blame] | 73 | #if defined(CONFIG_PLD_PCIE_CNSS) |
Yuanyuan Liu | 81982b9 | 2017-04-13 14:25:19 -0700 | [diff] [blame] | 74 | static inline int pld_pcie_set_fw_log_mode(struct device *dev, u8 fw_log_mode) |
| 75 | { |
| 76 | return cnss_set_fw_log_mode(dev, fw_log_mode); |
| 77 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 78 | |
| 79 | static inline void pld_pcie_intr_notify_q6(struct device *dev) |
Yuanyuan Liu | 81982b9 | 2017-04-13 14:25:19 -0700 | [diff] [blame] | 80 | { |
| 81 | } |
| 82 | #else |
| 83 | static inline int pld_pcie_set_fw_log_mode(struct device *dev, u8 fw_log_mode) |
| 84 | { |
| 85 | return 0; |
| 86 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 87 | |
| 88 | static inline void pld_pcie_intr_notify_q6(struct device *dev) |
Yuanyuan Liu | 81982b9 | 2017-04-13 14:25:19 -0700 | [diff] [blame] | 89 | { |
| 90 | } |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 91 | #endif |
| 92 | |
Yuanyuan Liu | 11f526a | 2016-05-18 10:22:07 -0700 | [diff] [blame] | 93 | #if (!defined(CONFIG_PLD_PCIE_CNSS)) || (!defined(CONFIG_CNSS_SECURE_FW)) |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 94 | static inline int pld_pcie_get_sha_hash(struct device *dev, const u8 *data, |
Yuanyuan Liu | 59f81e0 | 2016-05-19 16:17:38 -0700 | [diff] [blame] | 95 | u32 data_len, u8 *hash_idx, u8 *out) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 96 | { |
| 97 | return 0; |
| 98 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 99 | |
| 100 | static inline void *pld_pcie_get_fw_ptr(struct device *dev) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 101 | { |
| 102 | return NULL; |
| 103 | } |
Yuanyuan Liu | 59f81e0 | 2016-05-19 16:17:38 -0700 | [diff] [blame] | 104 | #else |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 105 | static inline int pld_pcie_get_sha_hash(struct device *dev, const u8 *data, |
Yuanyuan Liu | 16a5562 | 2016-09-14 16:15:59 -0700 | [diff] [blame] | 106 | u32 data_len, u8 *hash_idx, u8 *out) |
| 107 | { |
| 108 | return cnss_get_sha_hash(data, data_len, hash_idx, out); |
| 109 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 110 | |
| 111 | static inline void *pld_pcie_get_fw_ptr(struct device *dev) |
Yuanyuan Liu | 16a5562 | 2016-09-14 16:15:59 -0700 | [diff] [blame] | 112 | { |
| 113 | return cnss_get_fw_ptr(); |
| 114 | } |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 115 | #endif |
| 116 | |
Yuanyuan Liu | 11f526a | 2016-05-18 10:22:07 -0700 | [diff] [blame] | 117 | #if (!defined(CONFIG_PLD_PCIE_CNSS)) || (!defined(CONFIG_PCI_MSM)) |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 118 | static inline int pld_pcie_wlan_pm_control(struct device *dev, bool vote) |
Yuanyuan Liu | 466ccb7 | 2016-04-21 15:13:22 -0700 | [diff] [blame] | 119 | { |
| 120 | return 0; |
| 121 | } |
Yuanyuan Liu | 59f81e0 | 2016-05-19 16:17:38 -0700 | [diff] [blame] | 122 | #else |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 123 | static inline int pld_pcie_wlan_pm_control(struct device *dev, bool vote) |
| 124 | { |
| 125 | return cnss_wlan_pm_control(dev, vote); |
| 126 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 127 | #endif |
Yuanyuan Liu | 466ccb7 | 2016-04-21 15:13:22 -0700 | [diff] [blame] | 128 | |
Yuanyuan Liu | 11f526a | 2016-05-18 10:22:07 -0700 | [diff] [blame] | 129 | #ifndef CONFIG_PLD_PCIE_CNSS |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 130 | static inline int |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 131 | pld_pcie_get_fw_files_for_target(struct device *dev, |
| 132 | struct pld_fw_files *pfw_files, |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 133 | u32 target_type, u32 target_version) |
| 134 | { |
Yuanyuan Liu | 6a313dc | 2016-05-10 14:19:10 -0700 | [diff] [blame] | 135 | pld_get_default_fw_files(pfw_files); |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 136 | return 0; |
| 137 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 138 | |
Yuanyuan Liu | 10fc3d3 | 2017-01-12 15:32:06 -0800 | [diff] [blame] | 139 | static inline void pld_pcie_link_down(struct device *dev) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 140 | { |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 141 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 142 | |
Yue Ma | 9c0e480 | 2018-09-11 15:34:06 -0700 | [diff] [blame] | 143 | static inline int pld_pcie_is_fw_down(struct device *dev) |
| 144 | { |
| 145 | return 0; |
| 146 | } |
| 147 | |
Yue Ma | 6dbbb18 | 2017-04-26 17:06:05 -0700 | [diff] [blame] | 148 | static inline int pld_pcie_athdiag_read(struct device *dev, uint32_t offset, |
| 149 | uint32_t memtype, uint32_t datalen, |
| 150 | uint8_t *output) |
| 151 | { |
| 152 | return 0; |
| 153 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 154 | |
Yue Ma | 6dbbb18 | 2017-04-26 17:06:05 -0700 | [diff] [blame] | 155 | static inline int pld_pcie_athdiag_write(struct device *dev, uint32_t offset, |
| 156 | uint32_t memtype, uint32_t datalen, |
| 157 | uint8_t *input) |
| 158 | { |
| 159 | return 0; |
| 160 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 161 | |
| 162 | static inline void |
| 163 | pld_pcie_schedule_recovery_work(struct device *dev, |
| 164 | enum pld_recovery_reason reason) |
Yuanyuan Liu | 0e0aa93 | 2016-05-12 10:17:58 -0700 | [diff] [blame] | 165 | { |
Yuanyuan Liu | 0e0aa93 | 2016-05-12 10:17:58 -0700 | [diff] [blame] | 166 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 167 | |
| 168 | static inline void *pld_pcie_get_virt_ramdump_mem(struct device *dev, |
| 169 | unsigned long *size) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 170 | { |
| 171 | return NULL; |
| 172 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 173 | |
| 174 | static inline void pld_pcie_device_crashed(struct device *dev) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 175 | { |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 176 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 177 | |
Yuanyuan Liu | 10fc3d3 | 2017-01-12 15:32:06 -0800 | [diff] [blame] | 178 | static inline void pld_pcie_device_self_recovery(struct device *dev, |
| 179 | enum pld_recovery_reason reason) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 180 | { |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 181 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 182 | |
| 183 | static inline void pld_pcie_request_pm_qos(struct device *dev, u32 qos_val) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 184 | { |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 185 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 186 | |
| 187 | static inline void pld_pcie_remove_pm_qos(struct device *dev) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 188 | { |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 189 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 190 | |
| 191 | static inline int pld_pcie_request_bus_bandwidth(struct device *dev, |
| 192 | int bandwidth) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 193 | { |
| 194 | return 0; |
| 195 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 196 | |
| 197 | static inline int pld_pcie_get_platform_cap(struct device *dev, |
| 198 | struct pld_platform_cap *cap) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 199 | { |
| 200 | return 0; |
| 201 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 202 | |
Yue Ma | cd24386 | 2016-11-04 19:21:16 -0700 | [diff] [blame] | 203 | static inline int pld_pcie_get_soc_info(struct device *dev, |
| 204 | struct pld_soc_info *info) |
| 205 | { |
| 206 | return 0; |
| 207 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 208 | |
Yue Ma | 5ff417c | 2017-10-30 11:13:12 -0700 | [diff] [blame] | 209 | static inline int pld_pcie_auto_suspend(struct device *dev) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 210 | { |
| 211 | return 0; |
| 212 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 213 | |
| 214 | static inline int pld_pcie_auto_resume(struct device *dev) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 215 | { |
| 216 | return 0; |
| 217 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 218 | |
Yue Ma | fb3b78d | 2018-08-08 11:51:21 -0700 | [diff] [blame^] | 219 | static inline int pld_pcie_force_wake_request(struct device *dev) |
| 220 | { |
| 221 | return 0; |
| 222 | } |
| 223 | |
| 224 | static inline int pld_pcie_is_device_awake(struct device *dev) |
| 225 | { |
| 226 | return true; |
| 227 | } |
| 228 | |
| 229 | static inline int pld_pcie_force_wake_release(struct device *dev) |
| 230 | { |
| 231 | return 0; |
| 232 | } |
| 233 | |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 234 | static inline void pld_pcie_lock_pm_sem(struct device *dev) |
Yuanyuan Liu | 44c4477 | 2016-04-11 11:11:27 -0700 | [diff] [blame] | 235 | { |
Yuanyuan Liu | 44c4477 | 2016-04-11 11:11:27 -0700 | [diff] [blame] | 236 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 237 | |
| 238 | static inline void pld_pcie_release_pm_sem(struct device *dev) |
Yuanyuan Liu | 44c4477 | 2016-04-11 11:11:27 -0700 | [diff] [blame] | 239 | { |
Yuanyuan Liu | 44c4477 | 2016-04-11 11:11:27 -0700 | [diff] [blame] | 240 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 241 | |
Arun Khandavalli | 1496fcb | 2016-07-25 16:53:00 +0530 | [diff] [blame] | 242 | static inline int pld_pcie_power_on(struct device *dev) |
| 243 | { |
| 244 | return 0; |
| 245 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 246 | |
Arun Khandavalli | 1496fcb | 2016-07-25 16:53:00 +0530 | [diff] [blame] | 247 | static inline int pld_pcie_power_off(struct device *dev) |
| 248 | { |
| 249 | return 0; |
| 250 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 251 | |
Yue Ma | 63d360a | 2017-06-20 17:00:35 -0700 | [diff] [blame] | 252 | static inline int pld_pcie_force_assert_target(struct device *dev) |
| 253 | { |
| 254 | return -EINVAL; |
| 255 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 256 | |
Yue Ma | fd418ea | 2016-11-21 16:47:13 -0800 | [diff] [blame] | 257 | static inline int pld_pcie_get_user_msi_assignment(struct device *dev, |
| 258 | char *user_name, |
| 259 | int *num_vectors, |
| 260 | uint32_t *user_base_data, |
| 261 | uint32_t *base_vector) |
| 262 | { |
| 263 | return 0; |
| 264 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 265 | |
Yue Ma | fd418ea | 2016-11-21 16:47:13 -0800 | [diff] [blame] | 266 | static inline int pld_pcie_get_msi_irq(struct device *dev, unsigned int vector) |
| 267 | { |
| 268 | return 0; |
| 269 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 270 | |
Yue Ma | fd418ea | 2016-11-21 16:47:13 -0800 | [diff] [blame] | 271 | static inline void pld_pcie_get_msi_address(struct device *dev, |
| 272 | uint32_t *msi_addr_low, |
| 273 | uint32_t *msi_addr_high) |
| 274 | { |
| 275 | return; |
| 276 | } |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 277 | #else |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 278 | int pld_pcie_get_fw_files_for_target(struct device *dev, |
| 279 | struct pld_fw_files *pfw_files, |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 280 | u32 target_type, u32 target_version); |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 281 | int pld_pcie_get_platform_cap(struct device *dev, struct pld_platform_cap *cap); |
Yue Ma | cd24386 | 2016-11-04 19:21:16 -0700 | [diff] [blame] | 282 | int pld_pcie_get_soc_info(struct device *dev, struct pld_soc_info *info); |
Yuanyuan Liu | 10fc3d3 | 2017-01-12 15:32:06 -0800 | [diff] [blame] | 283 | void pld_pcie_schedule_recovery_work(struct device *dev, |
| 284 | enum pld_recovery_reason reason); |
| 285 | void pld_pcie_device_self_recovery(struct device *dev, |
| 286 | enum pld_recovery_reason reason); |
Komal Seelam | 355b147 | 2016-09-02 14:36:21 +0530 | [diff] [blame] | 287 | |
Yuanyuan Liu | 10fc3d3 | 2017-01-12 15:32:06 -0800 | [diff] [blame] | 288 | static inline void pld_pcie_link_down(struct device *dev) |
Yuanyuan Liu | 16a5562 | 2016-09-14 16:15:59 -0700 | [diff] [blame] | 289 | { |
Yuanyuan Liu | 10fc3d3 | 2017-01-12 15:32:06 -0800 | [diff] [blame] | 290 | cnss_pci_link_down(dev); |
Yuanyuan Liu | 16a5562 | 2016-09-14 16:15:59 -0700 | [diff] [blame] | 291 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 292 | |
Yue Ma | 9c0e480 | 2018-09-11 15:34:06 -0700 | [diff] [blame] | 293 | static inline int pld_pcie_is_fw_down(struct device *dev) |
| 294 | { |
| 295 | return cnss_pci_is_device_down(dev); |
| 296 | } |
| 297 | |
Yue Ma | 6dbbb18 | 2017-04-26 17:06:05 -0700 | [diff] [blame] | 298 | static inline int pld_pcie_athdiag_read(struct device *dev, uint32_t offset, |
| 299 | uint32_t memtype, uint32_t datalen, |
| 300 | uint8_t *output) |
| 301 | { |
| 302 | return cnss_athdiag_read(dev, offset, memtype, datalen, output); |
| 303 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 304 | |
Yue Ma | 6dbbb18 | 2017-04-26 17:06:05 -0700 | [diff] [blame] | 305 | static inline int pld_pcie_athdiag_write(struct device *dev, uint32_t offset, |
| 306 | uint32_t memtype, uint32_t datalen, |
| 307 | uint8_t *input) |
| 308 | { |
| 309 | return cnss_athdiag_write(dev, offset, memtype, datalen, input); |
| 310 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 311 | |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 312 | static inline void *pld_pcie_get_virt_ramdump_mem(struct device *dev, |
| 313 | unsigned long *size) |
| 314 | { |
| 315 | return cnss_get_virt_ramdump_mem(dev, size); |
| 316 | } |
| 317 | |
| 318 | static inline void pld_pcie_device_crashed(struct device *dev) |
| 319 | { |
| 320 | cnss_device_crashed(dev); |
| 321 | } |
| 322 | |
| 323 | static inline void pld_pcie_request_pm_qos(struct device *dev, u32 qos_val) |
| 324 | { |
| 325 | cnss_request_pm_qos(dev, qos_val); |
| 326 | } |
| 327 | |
| 328 | static inline void pld_pcie_remove_pm_qos(struct device *dev) |
| 329 | { |
| 330 | cnss_remove_pm_qos(dev); |
| 331 | } |
| 332 | |
| 333 | static inline int pld_pcie_request_bus_bandwidth(struct device *dev, |
| 334 | int bandwidth) |
| 335 | { |
| 336 | return cnss_request_bus_bandwidth(dev, bandwidth); |
| 337 | } |
| 338 | |
| 339 | static inline int pld_pcie_auto_suspend(struct device *dev) |
| 340 | { |
| 341 | return cnss_auto_suspend(dev); |
| 342 | } |
| 343 | |
| 344 | static inline int pld_pcie_auto_resume(struct device *dev) |
| 345 | { |
| 346 | return cnss_auto_resume(dev); |
| 347 | } |
| 348 | |
Yue Ma | fb3b78d | 2018-08-08 11:51:21 -0700 | [diff] [blame^] | 349 | static inline int pld_pcie_force_wake_request(struct device *dev) |
| 350 | { |
| 351 | return cnss_pci_force_wake_request(dev); |
| 352 | } |
| 353 | |
| 354 | static inline int pld_pcie_is_device_awake(struct device *dev) |
| 355 | { |
| 356 | return cnss_pci_is_device_awake(dev); |
| 357 | } |
| 358 | |
| 359 | static inline int pld_pcie_force_wake_release(struct device *dev) |
| 360 | { |
| 361 | return cnss_pci_force_wake_release(dev); |
| 362 | } |
| 363 | |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 364 | static inline void pld_pcie_lock_pm_sem(struct device *dev) |
| 365 | { |
| 366 | cnss_lock_pm_sem(dev); |
| 367 | } |
| 368 | |
| 369 | static inline void pld_pcie_release_pm_sem(struct device *dev) |
| 370 | { |
| 371 | cnss_release_pm_sem(dev); |
| 372 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 373 | |
Yuanyuan Liu | 16a5562 | 2016-09-14 16:15:59 -0700 | [diff] [blame] | 374 | static inline int pld_pcie_power_on(struct device *dev) |
| 375 | { |
| 376 | return cnss_power_up(dev); |
| 377 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 378 | |
Yuanyuan Liu | 16a5562 | 2016-09-14 16:15:59 -0700 | [diff] [blame] | 379 | static inline int pld_pcie_power_off(struct device *dev) |
| 380 | { |
| 381 | return cnss_power_down(dev); |
| 382 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 383 | |
Yue Ma | 63d360a | 2017-06-20 17:00:35 -0700 | [diff] [blame] | 384 | static inline int pld_pcie_force_assert_target(struct device *dev) |
| 385 | { |
| 386 | return cnss_force_fw_assert(dev); |
| 387 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 388 | |
Yue Ma | fd418ea | 2016-11-21 16:47:13 -0800 | [diff] [blame] | 389 | static inline int pld_pcie_get_user_msi_assignment(struct device *dev, |
| 390 | char *user_name, |
| 391 | int *num_vectors, |
| 392 | uint32_t *user_base_data, |
| 393 | uint32_t *base_vector) |
| 394 | { |
| 395 | return cnss_get_user_msi_assignment(dev, user_name, num_vectors, |
| 396 | user_base_data, base_vector); |
| 397 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 398 | |
Yue Ma | fd418ea | 2016-11-21 16:47:13 -0800 | [diff] [blame] | 399 | static inline int pld_pcie_get_msi_irq(struct device *dev, unsigned int vector) |
| 400 | { |
| 401 | return cnss_get_msi_irq(dev, vector); |
| 402 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 403 | |
Yue Ma | fd418ea | 2016-11-21 16:47:13 -0800 | [diff] [blame] | 404 | static inline void pld_pcie_get_msi_address(struct device *dev, |
| 405 | uint32_t *msi_addr_low, |
| 406 | uint32_t *msi_addr_high) |
| 407 | { |
| 408 | cnss_get_msi_address(dev, msi_addr_low, msi_addr_high); |
| 409 | } |
Komal Seelam | 355b147 | 2016-09-02 14:36:21 +0530 | [diff] [blame] | 410 | #endif |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 411 | #endif |