pld_common.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. /*
  2. * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
  3. *
  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. #ifndef __PLD_COMMON_H__
  19. #define __PLD_COMMON_H__
  20. #ifdef CONFIG_PLD_STUB
  21. /**
  22. * struct pld_ce_tgt_pipe_cfg - copy engine target pipe configuration
  23. * @pipe_num: pipe number
  24. * @pipe_dir: pipe direction
  25. * @nentries: number of entries
  26. * @nbytes_max: max number of bytes
  27. * @flags: flags
  28. * @reserved: reserved
  29. *
  30. * pld_ce_tgt_pipe_cfg is used to store copy engine target pipe
  31. * configuration.
  32. */
  33. struct pld_ce_tgt_pipe_cfg {
  34. u32 pipe_num;
  35. u32 pipe_dir;
  36. u32 nentries;
  37. u32 nbytes_max;
  38. u32 flags;
  39. u32 reserved;
  40. };
  41. /**
  42. * struct pld_ce_svc_pipe_cfg - copy engine service pipe configuration
  43. * @service_id: service ID
  44. * @pipe_dir: pipe direction
  45. * @pipe_num: pipe number
  46. *
  47. * pld_ce_svc_pipe_cfg is used to store copy engine service pipe
  48. * configuration.
  49. */
  50. struct pld_ce_svc_pipe_cfg {
  51. u32 service_id;
  52. u32 pipe_dir;
  53. u32 pipe_num;
  54. };
  55. /**
  56. * struct pld_shadow_reg_cfg - shadow register configuration
  57. * @ce_id: copy engine ID
  58. * @reg_offset: register offset
  59. *
  60. * pld_shadow_reg_cfg is used to store shadow register configuration.
  61. */
  62. struct pld_shadow_reg_cfg {
  63. u16 ce_id;
  64. u16 reg_offset;
  65. };
  66. /**
  67. * struct pld_shadow_reg_v2_cfg - shadow register version 2 configuration
  68. * @addr: shadow register physical address
  69. *
  70. * pld_shadow_reg_v2_cfg is used to store shadow register version 2
  71. * configuration.
  72. */
  73. struct pld_shadow_reg_v2_cfg {
  74. u32 addr;
  75. };
  76. /**
  77. * struct pld_wlan_enable_cfg - WLAN FW configuration
  78. * @num_ce_tgt_cfg: number of CE target configuration
  79. * @ce_tgt_cfg: CE target configuration
  80. * @num_ce_svc_pipe_cfg: number of CE service configuration
  81. * @ce_svc_cfg: CE service configuration
  82. * @num_shadow_reg_cfg: number of shadow register configuration
  83. * @shadow_reg_cfg: shadow register configuration
  84. * @num_shadow_reg_v2_cfg: number of shadow register version 2 configuration
  85. * @shadow_reg_v2_cfg: shadow register version 2 configuration
  86. *
  87. * pld_wlan_enable_cfg stores WLAN FW configurations. It will be
  88. * passed to WLAN FW when WLAN host driver calls wlan_enable.
  89. */
  90. struct pld_wlan_enable_cfg {
  91. u32 num_ce_tgt_cfg;
  92. struct pld_ce_tgt_pipe_cfg *ce_tgt_cfg;
  93. u32 num_ce_svc_pipe_cfg;
  94. struct pld_ce_svc_pipe_cfg *ce_svc_cfg;
  95. u32 num_shadow_reg_cfg;
  96. struct pld_shadow_reg_cfg *shadow_reg_cfg;
  97. u32 num_shadow_reg_v2_cfg;
  98. struct pld_shadow_reg_v2_cfg *shadow_reg_v2_cfg;
  99. };
  100. /**
  101. * enum pld_driver_mode - WLAN host driver mode
  102. * @PLD_MISSION: mission mode
  103. * @PLD_FTM: FTM mode
  104. * @PLD_EPPING: EPPING mode
  105. * @PLD_WALTEST: WAL test mode, FW standalone test mode
  106. * @PLD_OFF: OFF mode
  107. */
  108. enum pld_driver_mode {
  109. PLD_MISSION,
  110. PLD_FTM,
  111. PLD_EPPING,
  112. PLD_WALTEST,
  113. PLD_OFF
  114. };
  115. #define PLD_MAX_TIMESTAMP_LEN 32
  116. /**
  117. * struct pld_soc_info - SOC information
  118. * @v_addr: virtual address of preallocated memory
  119. * @p_addr: physical address of preallcoated memory
  120. * @chip_id: chip ID
  121. * @chip_family: chip family
  122. * @board_id: board ID
  123. * @soc_id: SOC ID
  124. * @fw_version: FW version
  125. * @fw_build_timestamp: FW build timestamp
  126. *
  127. * pld_soc_info is used to store WLAN SOC information.
  128. */
  129. struct pld_soc_info {
  130. void __iomem *v_addr;
  131. phys_addr_t p_addr;
  132. u32 chip_id;
  133. u32 chip_family;
  134. u32 board_id;
  135. u32 soc_id;
  136. u32 fw_version;
  137. char fw_build_timestamp[PLD_MAX_TIMESTAMP_LEN + 1];
  138. };
  139. /**
  140. * enum pld_runtime_request - PM runtime request
  141. * @PLD_PM_RUNTIME_GET: pm_runtime_get
  142. * @PLD_PM_RUNTIME_PUT: pm_runtime_put
  143. * @PLD_PM_RUNTIME_MARK_LAST_BUSY: pm_runtime_mark_last_busy
  144. * @PLD_PM_RUNTIME_RESUME: pm_runtime_resume
  145. * @PLD_PM_RUNTIME_PUT_NOIDLE: pm_runtime_put_noidle
  146. * @PLD_PM_REQUEST_RESUME: pm_request_resume
  147. * @PLD_PM_RUNTIME_PUT_AUTO: pm_runtime_put_auto
  148. */
  149. enum pld_runtime_request {
  150. PLD_PM_RUNTIME_GET,
  151. PLD_PM_RUNTIME_PUT,
  152. PLD_PM_RUNTIME_MARK_LAST_BUSY,
  153. PLD_PM_RUNTIME_RESUME,
  154. PLD_PM_RUNTIME_PUT_NOIDLE,
  155. PLD_PM_REQUEST_RESUME,
  156. PLD_PM_RUNTIME_PUT_AUTO,
  157. };
  158. static inline int pld_wlan_enable(struct device *dev,
  159. struct pld_wlan_enable_cfg *config,
  160. enum pld_driver_mode mode,
  161. const char *host_version)
  162. {
  163. return 0;
  164. }
  165. static inline int pld_wlan_disable(struct device *dev,
  166. enum pld_driver_mode mode)
  167. {
  168. return 0;
  169. }
  170. static inline void pld_is_pci_link_down(struct device *dev)
  171. {
  172. return;
  173. }
  174. static inline int pld_wlan_pm_control(struct device *dev, bool vote)
  175. {
  176. return 0;
  177. }
  178. static inline void pld_intr_notify_q6(struct device *dev)
  179. {
  180. return;
  181. }
  182. static inline int pld_get_user_msi_assignment(struct device *dev,
  183. char *user_name, int *num_vectors,
  184. uint32_t *user_base_data, uint32_t *base_vector)
  185. {
  186. return -EINVAL;
  187. }
  188. /* should not be called if pld_get_user_msi_assignment returns error */
  189. static inline int pld_get_msi_irq(struct device *dev, unsigned int vector)
  190. {
  191. return -EINVAL;
  192. }
  193. /* should not be called if pld_get_user_msi_assignment returns error */
  194. static inline void pld_get_msi_address(struct device *dev,
  195. uint32_t *msi_addr_low,
  196. uint32_t *msi_addr_high)
  197. {
  198. return;
  199. }
  200. static inline int pld_ce_request_irq(struct device *dev, unsigned int ce_id,
  201. irqreturn_t (*handler)(int, void *),
  202. unsigned long flags, const char *name,
  203. void *ctx)
  204. {
  205. return 0;
  206. }
  207. static inline int pld_ce_free_irq(struct device *dev,
  208. unsigned int ce_id, void *ctx)
  209. {
  210. return 0;
  211. }
  212. static inline int pld_get_soc_info(struct device *dev,
  213. struct pld_soc_info *info)
  214. {
  215. return 0;
  216. }
  217. static inline int pld_get_ce_id(struct device *dev, int irq)
  218. {
  219. return 0;
  220. }
  221. static inline int pld_pm_runtime_request(struct device *dev,
  222. enum pld_runtime_request request)
  223. {
  224. return 0;
  225. }
  226. static inline void pld_runtime_init(struct device *dev, int auto_delay)
  227. {
  228. return;
  229. }
  230. static inline void pld_runtime_exit(struct device *dev)
  231. {
  232. return;
  233. }
  234. static inline int pld_athdiag_read(struct device *dev,
  235. uint32_t offset, uint32_t memtype,
  236. uint32_t datalen, uint8_t *output)
  237. {
  238. return 0;
  239. }
  240. static inline int pld_athdiag_write(struct device *dev,
  241. uint32_t offset, uint32_t memtype,
  242. uint32_t datalen, uint8_t *input)
  243. {
  244. return 0;
  245. }
  246. #endif
  247. #endif