icnss_stub.c 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. /*
  2. * Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. #ifdef HIF_PCI
  27. #include "icnss_stub.h"
  28. #include "hif_io32.h"
  29. #include <hif.h>
  30. #include "regtable.h"
  31. #include "hif_debug.h"
  32. #include "qdf_status.h"
  33. #ifndef CONFIG_WIN
  34. #include "qwlan_version.h"
  35. #endif
  36. #ifdef CONFIG_CNSS
  37. #include <net/cnss.h>
  38. #endif
  39. /**
  40. * struct icnss_stub_entry
  41. *
  42. * @irq_handler: irq_handler
  43. * @data: data
  44. * @name: name
  45. * @ce_id: ce_id
  46. */
  47. struct icnss_stub_entry {
  48. irqreturn_t (*irq_handler)(int, void *);
  49. void *data;
  50. const char *name;
  51. int ce_id;
  52. };
  53. /**
  54. * struct icnss_stub_context
  55. *
  56. * @stub: icnss_stub_entry
  57. * @regged_irq: regged_irq
  58. */
  59. struct icnss_stub_context {
  60. struct icnss_stub_entry stub[ICNSS_MAX_IRQ_REGISTRATIONS];
  61. uint32_t regged_irq;
  62. };
  63. #ifndef QCA_WIFI_3_0_ADRASTEA
  64. /**
  65. * icnss_wlan_enable() - icnss_wlan_enable
  66. * @config: ce configuration information
  67. * @mode: driver_mode
  68. * @host_version: version string to send to the fw
  69. *
  70. * Return: int
  71. */
  72. int icnss_wlan_enable(struct icnss_wlan_enable_cfg *config,
  73. enum icnss_driver_mode mode, const char *host_version)
  74. {
  75. return 0;
  76. }
  77. /**
  78. * icnss_wlan_disable() - icnss_wlan_disable
  79. * @mode: driver_mode
  80. *
  81. * Return: int
  82. */
  83. int icnss_wlan_disable(enum icnss_driver_mode mode)
  84. {
  85. return 0;
  86. }
  87. /**
  88. * icnss_set_fw_debug_mode() - icnss_set_fw_debug_mode
  89. * @mode: fw debug mode, 0 for QXDM, 1 for WMI
  90. *
  91. * Return: int
  92. */
  93. int icnss_set_fw_debug_mode(bool mode)
  94. {
  95. return 0;
  96. }
  97. #else
  98. /**
  99. * icnss_wlan_enable(): call the platform driver to enable wlan
  100. * @config: ce configuration information
  101. * @mode: driver_mode
  102. * @host_version: version string to send to the fw
  103. *
  104. * This function passes the con_mode and CE configuration to
  105. * platform driver to enable wlan.
  106. * cnss_wlan_enable has been hacked to do a qmi handshake with fw.
  107. * this is not needed for rome.
  108. *
  109. * Return: 0 on success, error number otherwise.
  110. */
  111. int icnss_wlan_enable(struct icnss_wlan_enable_cfg *config,
  112. enum icnss_driver_mode mode, const char *host_version)
  113. {
  114. struct cnss_wlan_enable_cfg cfg;
  115. enum cnss_driver_mode cnss_mode;
  116. cfg.num_ce_tgt_cfg = config->num_ce_tgt_cfg;
  117. cfg.ce_tgt_cfg = (struct cnss_ce_tgt_pipe_cfg *)
  118. config->ce_tgt_cfg;
  119. cfg.num_ce_svc_pipe_cfg = config->num_ce_svc_pipe_cfg;
  120. cfg.ce_svc_cfg = (struct cnss_ce_svc_pipe_cfg *)
  121. config->ce_svc_cfg;
  122. cfg.num_shadow_reg_cfg = config->num_shadow_reg_cfg;
  123. cfg.shadow_reg_cfg = (struct cnss_shadow_reg_cfg *)
  124. config->shadow_reg_cfg;
  125. switch (mode) {
  126. case ICNSS_FTM:
  127. cnss_mode = CNSS_FTM;
  128. break;
  129. case ICNSS_EPPING:
  130. cnss_mode = CNSS_EPPING;
  131. break;
  132. default:
  133. cnss_mode = CNSS_MISSION;
  134. break;
  135. }
  136. return cnss_wlan_enable(&cfg, cnss_mode, host_version);
  137. }
  138. /**
  139. * icnss_wlan_disable(): call the platform driver to disable wlan
  140. *
  141. * This function passes the con_mode to platform driver to disable wlan.
  142. * cnss_wlan_disable has been hacked to do a qmi handshake with fw.
  143. * this is not needed for rome.
  144. *
  145. * Return: void
  146. */
  147. int icnss_wlan_disable(enum icnss_driver_mode con_mode)
  148. {
  149. enum cnss_driver_mode mode;
  150. switch (con_mode) {
  151. case ICNSS_FTM:
  152. mode = CNSS_FTM;
  153. break;
  154. case ICNSS_EPPING:
  155. mode = CNSS_EPPING;
  156. break;
  157. default:
  158. mode = CNSS_MISSION;
  159. break;
  160. }
  161. cnss_wlan_disable(mode);
  162. return 0;
  163. }
  164. /**
  165. * icnss_set_fw_debug_mode() - call the platform driver to set fw
  166. * debug mode
  167. * @mode: fw debug mode, 0 for QXDM, 1 for WMI
  168. *
  169. * This function passes the fw debug mode to platform driver.
  170. * cnss_set_fw_debug_mode has been hacked to do a qmi handshake with fw.
  171. * This is not needed for rome.
  172. *
  173. * Return: int
  174. */
  175. int icnss_set_fw_debug_mode(bool mode)
  176. {
  177. return cnss_set_fw_debug_mode(mode);
  178. }
  179. #endif
  180. /**
  181. * icnss_ce_request_irq() - register an irq handler
  182. * @ce_id: ce_id
  183. * @handler: handler
  184. * @flags: flags to pass to the kernel api
  185. * @name: name
  186. * @context: context to pass to the irq handler
  187. *
  188. * Return: integer status
  189. */
  190. int icnss_ce_request_irq(int ce_id,
  191. irqreturn_t (*handler)(int, void *),
  192. unsigned long flags, const char *name,
  193. void *context)
  194. {
  195. return 0;
  196. }
  197. /**
  198. * icnss_ce_free_irq() - icnss_unregister_irq
  199. * @ce_id: the ce_id that the irq belongs to
  200. * @context: context with witch the irq was requested.
  201. * Return: integer status
  202. */
  203. int icnss_ce_free_irq(int ce_id, void *context)
  204. {
  205. return 0;
  206. }
  207. int icnss_get_ce_id(int irq)
  208. {
  209. pr_err("icnss: icnss not valid for pci %d\n", irq);
  210. return -EINVAL;
  211. }
  212. #endif /* HIF_PCI */