Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 1 | /* |
Yu Wang | 7d866f6 | 2019-03-13 17:55:44 +0800 | [diff] [blame^] | 2 | * Copyright (c) 2016-2019 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 | |
Yu Wang | 7d866f6 | 2019-03-13 17:55:44 +0800 | [diff] [blame^] | 27 | #ifdef DYNAMIC_SINGLE_CHIP |
| 28 | #define PREFIX DYNAMIC_SINGLE_CHIP "/" |
| 29 | #else |
| 30 | |
Qun Zhang | 4a83a46 | 2018-09-11 16:28:51 +0800 | [diff] [blame] | 31 | #ifdef MULTI_IF_NAME |
| 32 | #define PREFIX MULTI_IF_NAME "/" |
| 33 | #else |
| 34 | #define PREFIX "" |
| 35 | #endif |
| 36 | |
Yu Wang | 7d866f6 | 2019-03-13 17:55:44 +0800 | [diff] [blame^] | 37 | #endif |
| 38 | |
Nirav Shah | fb79af8 | 2018-03-12 18:10:33 +0530 | [diff] [blame] | 39 | #ifndef HIF_PCI |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 40 | static inline int pld_pcie_register_driver(void) |
| 41 | { |
| 42 | return 0; |
| 43 | } |
| 44 | |
| 45 | static inline void pld_pcie_unregister_driver(void) |
| 46 | { |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 47 | } |
| 48 | |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 49 | 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] | 50 | { |
| 51 | return 0; |
| 52 | } |
| 53 | #else |
| 54 | int pld_pcie_register_driver(void); |
| 55 | void pld_pcie_unregister_driver(void); |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 56 | int pld_pcie_get_ce_id(struct device *dev, int irq); |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 57 | #endif |
| 58 | |
Yue Ma | 0804752 | 2016-11-08 18:53:26 -0800 | [diff] [blame] | 59 | #ifndef CONFIG_PLD_PCIE_CNSS |
| 60 | static inline int pld_pcie_wlan_enable(struct device *dev, |
| 61 | struct pld_wlan_enable_cfg *config, |
| 62 | enum pld_driver_mode mode, |
| 63 | const char *host_version) |
| 64 | { |
| 65 | return 0; |
| 66 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 67 | |
Yue Ma | 0804752 | 2016-11-08 18:53:26 -0800 | [diff] [blame] | 68 | static inline int pld_pcie_wlan_disable(struct device *dev, |
| 69 | enum pld_driver_mode mode) |
| 70 | { |
| 71 | return 0; |
| 72 | } |
| 73 | #else |
| 74 | int pld_pcie_wlan_enable(struct device *dev, struct pld_wlan_enable_cfg *config, |
| 75 | enum pld_driver_mode mode, const char *host_version); |
| 76 | int pld_pcie_wlan_disable(struct device *dev, enum pld_driver_mode mode); |
| 77 | #endif |
| 78 | |
Nirav Shah | 74be384 | 2018-06-26 19:17:25 +0530 | [diff] [blame] | 79 | #if defined(CONFIG_PLD_PCIE_CNSS) |
Yuanyuan Liu | 81982b9 | 2017-04-13 14:25:19 -0700 | [diff] [blame] | 80 | static inline int pld_pcie_set_fw_log_mode(struct device *dev, u8 fw_log_mode) |
| 81 | { |
| 82 | return cnss_set_fw_log_mode(dev, fw_log_mode); |
| 83 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 84 | |
| 85 | static inline void pld_pcie_intr_notify_q6(struct device *dev) |
Yuanyuan Liu | 81982b9 | 2017-04-13 14:25:19 -0700 | [diff] [blame] | 86 | { |
| 87 | } |
| 88 | #else |
| 89 | static inline int pld_pcie_set_fw_log_mode(struct device *dev, u8 fw_log_mode) |
| 90 | { |
| 91 | return 0; |
| 92 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 93 | |
| 94 | static inline void pld_pcie_intr_notify_q6(struct device *dev) |
Yuanyuan Liu | 81982b9 | 2017-04-13 14:25:19 -0700 | [diff] [blame] | 95 | { |
| 96 | } |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 97 | #endif |
| 98 | |
Yuanyuan Liu | 11f526a | 2016-05-18 10:22:07 -0700 | [diff] [blame] | 99 | #if (!defined(CONFIG_PLD_PCIE_CNSS)) || (!defined(CONFIG_CNSS_SECURE_FW)) |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 100 | 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] | 101 | u32 data_len, u8 *hash_idx, u8 *out) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 102 | { |
| 103 | return 0; |
| 104 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 105 | |
| 106 | static inline void *pld_pcie_get_fw_ptr(struct device *dev) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 107 | { |
| 108 | return NULL; |
| 109 | } |
Yuanyuan Liu | 59f81e0 | 2016-05-19 16:17:38 -0700 | [diff] [blame] | 110 | #else |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 111 | 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] | 112 | u32 data_len, u8 *hash_idx, u8 *out) |
| 113 | { |
| 114 | return cnss_get_sha_hash(data, data_len, hash_idx, out); |
| 115 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 116 | |
| 117 | static inline void *pld_pcie_get_fw_ptr(struct device *dev) |
Yuanyuan Liu | 16a5562 | 2016-09-14 16:15:59 -0700 | [diff] [blame] | 118 | { |
| 119 | return cnss_get_fw_ptr(); |
| 120 | } |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 121 | #endif |
| 122 | |
Yuanyuan Liu | 11f526a | 2016-05-18 10:22:07 -0700 | [diff] [blame] | 123 | #if (!defined(CONFIG_PLD_PCIE_CNSS)) || (!defined(CONFIG_PCI_MSM)) |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 124 | 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] | 125 | { |
| 126 | return 0; |
| 127 | } |
Yuanyuan Liu | 59f81e0 | 2016-05-19 16:17:38 -0700 | [diff] [blame] | 128 | #else |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 129 | static inline int pld_pcie_wlan_pm_control(struct device *dev, bool vote) |
| 130 | { |
| 131 | return cnss_wlan_pm_control(dev, vote); |
| 132 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 133 | #endif |
Yuanyuan Liu | 466ccb7 | 2016-04-21 15:13:22 -0700 | [diff] [blame] | 134 | |
Yuanyuan Liu | 11f526a | 2016-05-18 10:22:07 -0700 | [diff] [blame] | 135 | #ifndef CONFIG_PLD_PCIE_CNSS |
Frank Liu | d462d9c | 2018-07-27 14:43:26 +0800 | [diff] [blame] | 136 | static inline void *pld_pcie_smmu_get_mapping(struct device *dev) |
| 137 | { |
| 138 | return NULL; |
| 139 | } |
| 140 | |
| 141 | static inline int |
| 142 | pld_pcie_smmu_map(struct device *dev, |
| 143 | phys_addr_t paddr, uint32_t *iova_addr, size_t size) |
| 144 | { |
| 145 | return 0; |
| 146 | } |
| 147 | |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 148 | static inline int |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 149 | pld_pcie_get_fw_files_for_target(struct device *dev, |
| 150 | struct pld_fw_files *pfw_files, |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 151 | u32 target_type, u32 target_version) |
| 152 | { |
Yuanyuan Liu | 6a313dc | 2016-05-10 14:19:10 -0700 | [diff] [blame] | 153 | pld_get_default_fw_files(pfw_files); |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 154 | return 0; |
| 155 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 156 | |
Yuanyuan Liu | 10fc3d3 | 2017-01-12 15:32:06 -0800 | [diff] [blame] | 157 | static inline void pld_pcie_link_down(struct device *dev) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 158 | { |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 159 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 160 | |
Yue Ma | 9c0e480 | 2018-09-11 15:34:06 -0700 | [diff] [blame] | 161 | static inline int pld_pcie_is_fw_down(struct device *dev) |
| 162 | { |
| 163 | return 0; |
| 164 | } |
| 165 | |
Yue Ma | 6dbbb18 | 2017-04-26 17:06:05 -0700 | [diff] [blame] | 166 | static inline int pld_pcie_athdiag_read(struct device *dev, uint32_t offset, |
| 167 | uint32_t memtype, uint32_t datalen, |
| 168 | uint8_t *output) |
| 169 | { |
| 170 | return 0; |
| 171 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 172 | |
Yue Ma | 6dbbb18 | 2017-04-26 17:06:05 -0700 | [diff] [blame] | 173 | static inline int pld_pcie_athdiag_write(struct device *dev, uint32_t offset, |
| 174 | uint32_t memtype, uint32_t datalen, |
| 175 | uint8_t *input) |
| 176 | { |
| 177 | return 0; |
| 178 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 179 | |
| 180 | static inline void |
| 181 | pld_pcie_schedule_recovery_work(struct device *dev, |
| 182 | enum pld_recovery_reason reason) |
Yuanyuan Liu | 0e0aa93 | 2016-05-12 10:17:58 -0700 | [diff] [blame] | 183 | { |
Yuanyuan Liu | 0e0aa93 | 2016-05-12 10:17:58 -0700 | [diff] [blame] | 184 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 185 | |
| 186 | static inline void *pld_pcie_get_virt_ramdump_mem(struct device *dev, |
| 187 | unsigned long *size) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 188 | { |
Yu Ouyang | 58648a5 | 2018-11-01 11:18:15 +0800 | [diff] [blame] | 189 | size_t length = 0; |
| 190 | int flags = GFP_KERNEL; |
| 191 | |
| 192 | length = TOTAL_DUMP_SIZE; |
| 193 | |
| 194 | if (!size) |
| 195 | return NULL; |
| 196 | |
| 197 | *size = (unsigned long)length; |
| 198 | |
| 199 | if (in_interrupt() || irqs_disabled() || in_atomic()) |
| 200 | flags = GFP_ATOMIC; |
| 201 | |
| 202 | return kzalloc(length, flags); |
| 203 | } |
| 204 | |
| 205 | static inline void pld_pcie_release_virt_ramdump_mem(void *address) |
| 206 | { |
| 207 | kfree(address); |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 208 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 209 | |
| 210 | static inline void pld_pcie_device_crashed(struct device *dev) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 211 | { |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 212 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 213 | |
Yuanyuan Liu | 10fc3d3 | 2017-01-12 15:32:06 -0800 | [diff] [blame] | 214 | static inline void pld_pcie_device_self_recovery(struct device *dev, |
| 215 | enum pld_recovery_reason reason) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 216 | { |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 217 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 218 | |
| 219 | 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] | 220 | { |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 221 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 222 | |
| 223 | static inline void pld_pcie_remove_pm_qos(struct device *dev) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 224 | { |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 225 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 226 | |
| 227 | static inline int pld_pcie_request_bus_bandwidth(struct device *dev, |
| 228 | int bandwidth) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 229 | { |
| 230 | return 0; |
| 231 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 232 | |
| 233 | static inline int pld_pcie_get_platform_cap(struct device *dev, |
| 234 | struct pld_platform_cap *cap) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 235 | { |
| 236 | return 0; |
| 237 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 238 | |
Yue Ma | cd24386 | 2016-11-04 19:21:16 -0700 | [diff] [blame] | 239 | static inline int pld_pcie_get_soc_info(struct device *dev, |
| 240 | struct pld_soc_info *info) |
| 241 | { |
| 242 | return 0; |
| 243 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 244 | |
Yue Ma | 5ff417c | 2017-10-30 11:13:12 -0700 | [diff] [blame] | 245 | static inline int pld_pcie_auto_suspend(struct device *dev) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 246 | { |
| 247 | return 0; |
| 248 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 249 | |
| 250 | static inline int pld_pcie_auto_resume(struct device *dev) |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 251 | { |
| 252 | return 0; |
| 253 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 254 | |
Yue Ma | fb3b78d | 2018-08-08 11:51:21 -0700 | [diff] [blame] | 255 | static inline int pld_pcie_force_wake_request(struct device *dev) |
| 256 | { |
| 257 | return 0; |
| 258 | } |
| 259 | |
| 260 | static inline int pld_pcie_is_device_awake(struct device *dev) |
| 261 | { |
| 262 | return true; |
| 263 | } |
| 264 | |
| 265 | static inline int pld_pcie_force_wake_release(struct device *dev) |
| 266 | { |
| 267 | return 0; |
| 268 | } |
| 269 | |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 270 | static inline void pld_pcie_lock_pm_sem(struct device *dev) |
Yuanyuan Liu | 44c4477 | 2016-04-11 11:11:27 -0700 | [diff] [blame] | 271 | { |
Yuanyuan Liu | 44c4477 | 2016-04-11 11:11:27 -0700 | [diff] [blame] | 272 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 273 | |
| 274 | static inline void pld_pcie_release_pm_sem(struct device *dev) |
Yuanyuan Liu | 44c4477 | 2016-04-11 11:11:27 -0700 | [diff] [blame] | 275 | { |
Yuanyuan Liu | 44c4477 | 2016-04-11 11:11:27 -0700 | [diff] [blame] | 276 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 277 | |
Arun Khandavalli | 1496fcb | 2016-07-25 16:53:00 +0530 | [diff] [blame] | 278 | static inline int pld_pcie_power_on(struct device *dev) |
| 279 | { |
| 280 | return 0; |
| 281 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 282 | |
Arun Khandavalli | 1496fcb | 2016-07-25 16:53:00 +0530 | [diff] [blame] | 283 | static inline int pld_pcie_power_off(struct device *dev) |
| 284 | { |
| 285 | return 0; |
| 286 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 287 | |
Yue Ma | 63d360a | 2017-06-20 17:00:35 -0700 | [diff] [blame] | 288 | static inline int pld_pcie_force_assert_target(struct device *dev) |
| 289 | { |
| 290 | return -EINVAL; |
| 291 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 292 | |
Yuanyuan Liu | 3ab5531 | 2018-12-03 15:41:02 -0800 | [diff] [blame] | 293 | static inline int pld_pcie_collect_rddm(struct device *dev) |
| 294 | { |
| 295 | return 0; |
| 296 | } |
| 297 | |
Yue Ma | fd418ea | 2016-11-21 16:47:13 -0800 | [diff] [blame] | 298 | static inline int pld_pcie_get_user_msi_assignment(struct device *dev, |
| 299 | char *user_name, |
| 300 | int *num_vectors, |
| 301 | uint32_t *user_base_data, |
| 302 | uint32_t *base_vector) |
| 303 | { |
Yu Ouyang | 781f1b5 | 2018-12-27 15:24:07 +0800 | [diff] [blame] | 304 | return -EINVAL; |
Yue Ma | fd418ea | 2016-11-21 16:47:13 -0800 | [diff] [blame] | 305 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 306 | |
Yue Ma | fd418ea | 2016-11-21 16:47:13 -0800 | [diff] [blame] | 307 | static inline int pld_pcie_get_msi_irq(struct device *dev, unsigned int vector) |
| 308 | { |
| 309 | return 0; |
| 310 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 311 | |
Yue Ma | fd418ea | 2016-11-21 16:47:13 -0800 | [diff] [blame] | 312 | static inline void pld_pcie_get_msi_address(struct device *dev, |
| 313 | uint32_t *msi_addr_low, |
| 314 | uint32_t *msi_addr_high) |
| 315 | { |
| 316 | return; |
| 317 | } |
Yu Ouyang | 58648a5 | 2018-11-01 11:18:15 +0800 | [diff] [blame] | 318 | |
| 319 | static inline bool pld_pcie_platform_driver_support(void) |
| 320 | { |
| 321 | return false; |
| 322 | } |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 323 | #else |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 324 | int pld_pcie_get_fw_files_for_target(struct device *dev, |
| 325 | struct pld_fw_files *pfw_files, |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 326 | u32 target_type, u32 target_version); |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 327 | 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] | 328 | 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] | 329 | void pld_pcie_schedule_recovery_work(struct device *dev, |
| 330 | enum pld_recovery_reason reason); |
| 331 | void pld_pcie_device_self_recovery(struct device *dev, |
| 332 | enum pld_recovery_reason reason); |
Yuanyuan Liu | 3ab5531 | 2018-12-03 15:41:02 -0800 | [diff] [blame] | 333 | static inline int pld_pcie_collect_rddm(struct device *dev) |
| 334 | { |
| 335 | return cnss_force_collect_rddm(dev); |
| 336 | } |
Komal Seelam | 355b147 | 2016-09-02 14:36:21 +0530 | [diff] [blame] | 337 | |
Frank Liu | d462d9c | 2018-07-27 14:43:26 +0800 | [diff] [blame] | 338 | static inline void *pld_pcie_smmu_get_mapping(struct device *dev) |
| 339 | { |
| 340 | return cnss_smmu_get_mapping(dev); |
| 341 | } |
| 342 | |
| 343 | static inline int |
| 344 | pld_pcie_smmu_map(struct device *dev, |
| 345 | phys_addr_t paddr, uint32_t *iova_addr, size_t size) |
| 346 | { |
| 347 | return cnss_smmu_map(dev, paddr, iova_addr, size); |
| 348 | } |
| 349 | |
Yuanyuan Liu | 10fc3d3 | 2017-01-12 15:32:06 -0800 | [diff] [blame] | 350 | static inline void pld_pcie_link_down(struct device *dev) |
Yuanyuan Liu | 16a5562 | 2016-09-14 16:15:59 -0700 | [diff] [blame] | 351 | { |
Yuanyuan Liu | 10fc3d3 | 2017-01-12 15:32:06 -0800 | [diff] [blame] | 352 | cnss_pci_link_down(dev); |
Yuanyuan Liu | 16a5562 | 2016-09-14 16:15:59 -0700 | [diff] [blame] | 353 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 354 | |
Yue Ma | 9c0e480 | 2018-09-11 15:34:06 -0700 | [diff] [blame] | 355 | static inline int pld_pcie_is_fw_down(struct device *dev) |
| 356 | { |
| 357 | return cnss_pci_is_device_down(dev); |
| 358 | } |
| 359 | |
Yue Ma | 6dbbb18 | 2017-04-26 17:06:05 -0700 | [diff] [blame] | 360 | static inline int pld_pcie_athdiag_read(struct device *dev, uint32_t offset, |
| 361 | uint32_t memtype, uint32_t datalen, |
| 362 | uint8_t *output) |
| 363 | { |
| 364 | return cnss_athdiag_read(dev, offset, memtype, datalen, output); |
| 365 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 366 | |
Yue Ma | 6dbbb18 | 2017-04-26 17:06:05 -0700 | [diff] [blame] | 367 | static inline int pld_pcie_athdiag_write(struct device *dev, uint32_t offset, |
| 368 | uint32_t memtype, uint32_t datalen, |
| 369 | uint8_t *input) |
| 370 | { |
| 371 | return cnss_athdiag_write(dev, offset, memtype, datalen, input); |
| 372 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 373 | |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 374 | static inline void *pld_pcie_get_virt_ramdump_mem(struct device *dev, |
| 375 | unsigned long *size) |
| 376 | { |
| 377 | return cnss_get_virt_ramdump_mem(dev, size); |
| 378 | } |
| 379 | |
Yu Ouyang | 58648a5 | 2018-11-01 11:18:15 +0800 | [diff] [blame] | 380 | static inline void pld_pcie_release_virt_ramdump_mem(void *address) |
| 381 | { |
| 382 | } |
| 383 | |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 384 | static inline void pld_pcie_device_crashed(struct device *dev) |
| 385 | { |
| 386 | cnss_device_crashed(dev); |
| 387 | } |
| 388 | |
| 389 | static inline void pld_pcie_request_pm_qos(struct device *dev, u32 qos_val) |
| 390 | { |
| 391 | cnss_request_pm_qos(dev, qos_val); |
| 392 | } |
| 393 | |
| 394 | static inline void pld_pcie_remove_pm_qos(struct device *dev) |
| 395 | { |
| 396 | cnss_remove_pm_qos(dev); |
| 397 | } |
| 398 | |
| 399 | static inline int pld_pcie_request_bus_bandwidth(struct device *dev, |
| 400 | int bandwidth) |
| 401 | { |
| 402 | return cnss_request_bus_bandwidth(dev, bandwidth); |
| 403 | } |
| 404 | |
| 405 | static inline int pld_pcie_auto_suspend(struct device *dev) |
| 406 | { |
| 407 | return cnss_auto_suspend(dev); |
| 408 | } |
| 409 | |
| 410 | static inline int pld_pcie_auto_resume(struct device *dev) |
| 411 | { |
| 412 | return cnss_auto_resume(dev); |
| 413 | } |
| 414 | |
Yue Ma | fb3b78d | 2018-08-08 11:51:21 -0700 | [diff] [blame] | 415 | static inline int pld_pcie_force_wake_request(struct device *dev) |
| 416 | { |
| 417 | return cnss_pci_force_wake_request(dev); |
| 418 | } |
| 419 | |
| 420 | static inline int pld_pcie_is_device_awake(struct device *dev) |
| 421 | { |
| 422 | return cnss_pci_is_device_awake(dev); |
| 423 | } |
| 424 | |
| 425 | static inline int pld_pcie_force_wake_release(struct device *dev) |
| 426 | { |
| 427 | return cnss_pci_force_wake_release(dev); |
| 428 | } |
| 429 | |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 430 | static inline void pld_pcie_lock_pm_sem(struct device *dev) |
| 431 | { |
| 432 | cnss_lock_pm_sem(dev); |
| 433 | } |
| 434 | |
| 435 | static inline void pld_pcie_release_pm_sem(struct device *dev) |
| 436 | { |
| 437 | cnss_release_pm_sem(dev); |
| 438 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 439 | |
Yuanyuan Liu | 16a5562 | 2016-09-14 16:15:59 -0700 | [diff] [blame] | 440 | static inline int pld_pcie_power_on(struct device *dev) |
| 441 | { |
| 442 | return cnss_power_up(dev); |
| 443 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 444 | |
Yuanyuan Liu | 16a5562 | 2016-09-14 16:15:59 -0700 | [diff] [blame] | 445 | static inline int pld_pcie_power_off(struct device *dev) |
| 446 | { |
| 447 | return cnss_power_down(dev); |
| 448 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 449 | |
Yue Ma | 63d360a | 2017-06-20 17:00:35 -0700 | [diff] [blame] | 450 | static inline int pld_pcie_force_assert_target(struct device *dev) |
| 451 | { |
| 452 | return cnss_force_fw_assert(dev); |
| 453 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 454 | |
Yue Ma | fd418ea | 2016-11-21 16:47:13 -0800 | [diff] [blame] | 455 | static inline int pld_pcie_get_user_msi_assignment(struct device *dev, |
| 456 | char *user_name, |
| 457 | int *num_vectors, |
| 458 | uint32_t *user_base_data, |
| 459 | uint32_t *base_vector) |
| 460 | { |
| 461 | return cnss_get_user_msi_assignment(dev, user_name, num_vectors, |
| 462 | user_base_data, base_vector); |
| 463 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 464 | |
Yue Ma | fd418ea | 2016-11-21 16:47:13 -0800 | [diff] [blame] | 465 | static inline int pld_pcie_get_msi_irq(struct device *dev, unsigned int vector) |
| 466 | { |
| 467 | return cnss_get_msi_irq(dev, vector); |
| 468 | } |
Yue Ma | 85761e6 | 2017-10-30 11:13:45 -0700 | [diff] [blame] | 469 | |
Yue Ma | fd418ea | 2016-11-21 16:47:13 -0800 | [diff] [blame] | 470 | static inline void pld_pcie_get_msi_address(struct device *dev, |
| 471 | uint32_t *msi_addr_low, |
| 472 | uint32_t *msi_addr_high) |
| 473 | { |
| 474 | cnss_get_msi_address(dev, msi_addr_low, msi_addr_high); |
| 475 | } |
Yu Ouyang | 58648a5 | 2018-11-01 11:18:15 +0800 | [diff] [blame] | 476 | |
| 477 | static inline bool pld_pcie_platform_driver_support(void) |
| 478 | { |
| 479 | return true; |
| 480 | } |
Komal Seelam | 355b147 | 2016-09-02 14:36:21 +0530 | [diff] [blame] | 481 | #endif |
Yuanyuan Liu | d9f7a36 | 2016-01-22 14:27:12 -0800 | [diff] [blame] | 482 | #endif |