pld_common.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. /*
  2. * Copyright (c) 2016 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_wlan_enable_cfg - WLAN FW configuration
  68. * @num_ce_tgt_cfg: number of CE target configuration
  69. * @ce_tgt_cfg: CE target configuration
  70. * @num_ce_svc_pipe_cfg: number of CE service configuration
  71. * @ce_svc_cfg: CE service configuration
  72. * @num_shadow_reg_cfg: number of shadow register configuration
  73. * @shadow_reg_cfg: shadow register configuration
  74. *
  75. * pld_wlan_enable_cfg stores WLAN FW configurations. It will be
  76. * passed to WLAN FW when WLAN host driver calls wlan_enable.
  77. */
  78. struct pld_wlan_enable_cfg {
  79. u32 num_ce_tgt_cfg;
  80. struct pld_ce_tgt_pipe_cfg *ce_tgt_cfg;
  81. u32 num_ce_svc_pipe_cfg;
  82. struct pld_ce_svc_pipe_cfg *ce_svc_cfg;
  83. u32 num_shadow_reg_cfg;
  84. struct pld_shadow_reg_cfg *shadow_reg_cfg;
  85. };
  86. /**
  87. * enum pld_driver_mode - WLAN host driver mode
  88. * @PLD_MISSION: mission mode
  89. * @PLD_FTM: FTM mode
  90. * @PLD_EPPING: EPPING mode
  91. * @PLD_WALTEST: WAL test mode, FW standalone test mode
  92. * @PLD_OFF: OFF mode
  93. */
  94. enum pld_driver_mode {
  95. PLD_MISSION,
  96. PLD_FTM,
  97. PLD_EPPING,
  98. PLD_WALTEST,
  99. PLD_OFF
  100. };
  101. #define PLD_MAX_TIMESTAMP_LEN 32
  102. /**
  103. * struct pld_soc_info - SOC information
  104. * @v_addr: virtual address of preallocated memory
  105. * @p_addr: physical address of preallcoated memory
  106. * @chip_id: chip ID
  107. * @chip_family: chip family
  108. * @board_id: board ID
  109. * @soc_id: SOC ID
  110. * @fw_version: FW version
  111. * @fw_build_timestamp: FW build timestamp
  112. *
  113. * pld_soc_info is used to store WLAN SOC information.
  114. */
  115. struct pld_soc_info {
  116. void __iomem *v_addr;
  117. phys_addr_t p_addr;
  118. u32 chip_id;
  119. u32 chip_family;
  120. u32 board_id;
  121. u32 soc_id;
  122. u32 fw_version;
  123. char fw_build_timestamp[PLD_MAX_TIMESTAMP_LEN + 1];
  124. };
  125. /**
  126. * enum pld_runtime_request - PM runtime request
  127. * @PLD_PM_RUNTIME_GET: pm_runtime_get
  128. * @PLD_PM_RUNTIME_PUT: pm_runtime_put
  129. * @PLD_PM_RUNTIME_MARK_LAST_BUSY: pm_runtime_mark_last_busy
  130. * @PLD_PM_RUNTIME_RESUME: pm_runtime_resume
  131. * @PLD_PM_RUNTIME_PUT_NOIDLE: pm_runtime_put_noidle
  132. * @PLD_PM_REQUEST_RESUME: pm_request_resume
  133. * @PLD_PM_RUNTIME_PUT_AUTO: pm_runtime_put_auto
  134. */
  135. enum pld_runtime_request {
  136. PLD_PM_RUNTIME_GET,
  137. PLD_PM_RUNTIME_PUT,
  138. PLD_PM_RUNTIME_MARK_LAST_BUSY,
  139. PLD_PM_RUNTIME_RESUME,
  140. PLD_PM_RUNTIME_PUT_NOIDLE,
  141. PLD_PM_REQUEST_RESUME,
  142. PLD_PM_RUNTIME_PUT_AUTO,
  143. };
  144. static inline int pld_wlan_enable(struct device *dev,
  145. struct pld_wlan_enable_cfg *config,
  146. enum pld_driver_mode mode,
  147. const char *host_version)
  148. {
  149. return 0;
  150. }
  151. static inline int pld_wlan_disable(struct device *dev,
  152. enum pld_driver_mode mode)
  153. {
  154. return 0;
  155. }
  156. static inline void pld_is_pci_link_down(struct device *dev)
  157. {
  158. return;
  159. }
  160. static inline int pld_wlan_pm_control(struct device *dev, bool vote)
  161. {
  162. return 0;
  163. }
  164. static inline void pld_intr_notify_q6(struct device *dev)
  165. {
  166. return;
  167. }
  168. static inline int pld_get_user_msi_assignment(struct device *dev,
  169. char *user_name, int *num_vectors,
  170. uint32_t *user_base_data, uint32_t *base_vector)
  171. {
  172. return -EINVAL;
  173. }
  174. /* should not be called if pld_get_user_msi_assignment returns error */
  175. static inline int pld_get_msi_irq(struct device *dev, unsigned int vector)
  176. {
  177. return -EINVAL;
  178. }
  179. /* should not be called if pld_get_user_msi_assignment returns error */
  180. static inline void pld_get_msi_address(struct device *dev,
  181. uint32_t *msi_addr_low,
  182. uint32_t *msi_addr_high)
  183. {
  184. return;
  185. }
  186. static inline int pld_ce_request_irq(struct device *dev, unsigned int ce_id,
  187. irqreturn_t (*handler)(int, void *),
  188. unsigned long flags, const char *name,
  189. void *ctx)
  190. {
  191. return 0;
  192. }
  193. static inline int pld_ce_free_irq(struct device *dev,
  194. unsigned int ce_id, void *ctx)
  195. {
  196. return 0;
  197. }
  198. static inline int pld_get_soc_info(struct device *dev,
  199. struct pld_soc_info *info)
  200. {
  201. return 0;
  202. }
  203. static inline int pld_get_ce_id(struct device *dev, int irq)
  204. {
  205. return 0;
  206. }
  207. static inline int pld_pm_runtime_request(struct device *dev,
  208. enum pld_runtime_request request)
  209. {
  210. return 0;
  211. }
  212. static inline void pld_runtime_init(struct device *dev, int auto_delay)
  213. {
  214. return;
  215. }
  216. static inline void pld_runtime_exit(struct device *dev)
  217. {
  218. return;
  219. }
  220. static inline int pld_athdiag_read(struct device *dev,
  221. uint32_t offset, uint32_t memtype,
  222. uint32_t datalen, uint8_t *output)
  223. {
  224. return 0;
  225. }
  226. static inline int pld_athdiag_write(struct device *dev,
  227. uint32_t offset, uint32_t memtype,
  228. uint32_t datalen, uint8_t *input)
  229. {
  230. return 0;
  231. }
  232. #endif
  233. #endif