hif_main.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. * Copyright (c) 2013-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. /*
  27. * NB: Inappropriate references to "HTC" are used in this (and other)
  28. * HIF implementations. HTC is typically the calling layer, but it
  29. * theoretically could be some alternative.
  30. */
  31. /*
  32. * This holds all state needed to process a pending send/recv interrupt.
  33. * The information is saved here as soon as the interrupt occurs (thus
  34. * allowing the underlying CE to re-use the ring descriptor). The
  35. * information here is eventually processed by a completion processing
  36. * thread.
  37. */
  38. #ifndef __HIF_MAIN_H__
  39. #define __HIF_MAIN_H__
  40. #include <cdf_atomic.h> /* cdf_atomic_read */
  41. #include "cdf_lock.h"
  42. #include "cepci.h"
  43. #include "hif.h"
  44. #define HIF_MIN_SLEEP_INACTIVITY_TIME_MS 50
  45. #define HIF_SLEEP_INACTIVITY_TIMER_PERIOD_MS 60
  46. /*
  47. * This macro implementation is exposed for efficiency only.
  48. * The implementation may change and callers should
  49. * consider the targid to be a completely opaque handle.
  50. */
  51. #define TARGID_TO_PCI_ADDR(targid) (*((A_target_id_t *)(targid)))
  52. A_target_id_t hif_get_target_id(struct ol_softc *scn);
  53. bool hif_target_forced_awake(struct ol_softc *scn);
  54. #ifdef QCA_WIFI_3_0
  55. #define DISABLE_L1SS_STATES 1
  56. #endif
  57. #ifdef CONFIG_SLUB_DEBUG_ON
  58. #define MAX_NUM_OF_RECEIVES 100 /* Maximum number of Rx buf to process before*
  59. * break out in SLUB debug builds */
  60. #elif defined(FEATURE_NAPI)
  61. #define MAX_NUM_OF_RECEIVES HIF_NAPI_MAX_RECEIVES
  62. #else /* no SLUBS, no NAPI */
  63. /* Maximum number of Rx buf to process before break out */
  64. #define MAX_NUM_OF_RECEIVES 1000
  65. #endif /* SLUB_DEBUG_ON / FEATURE_NAPI */
  66. #ifdef QCA_WIFI_3_0_ADRASTEA
  67. #define ADRASTEA_BU 1
  68. #else
  69. #define ADRASTEA_BU 0
  70. #endif
  71. #ifdef QCA_WIFI_3_0
  72. #define HAS_FW_INDICATOR 0
  73. #else
  74. #define HAS_FW_INDICATOR 1
  75. #endif
  76. #define AR9888_DEVICE_ID (0x003c)
  77. #define AR6320_DEVICE_ID (0x003e)
  78. #define AR6320_FW_1_1 (0x11)
  79. #define AR6320_FW_1_3 (0x13)
  80. #define AR6320_FW_2_0 (0x20)
  81. #define AR6320_FW_3_0 (0x30)
  82. #define AR6320_FW_3_2 (0x32)
  83. #define ADRASTEA_DEVICE_ID (0xabcd)
  84. #define ADRASTEA_DEVICE_ID_P2_E12 (0x7021)
  85. #if (defined(QVIT))
  86. #define QCA6180_DEVICE_ID (0xabcd)
  87. #else
  88. #define QCA6180_DEVICE_ID (0x041)
  89. #endif
  90. A_target_id_t hif_get_target_id(struct ol_softc *scn);
  91. void hif_dump_pipe_debug_count(struct ol_softc *scn);
  92. bool hif_max_num_receives_reached(unsigned int count);
  93. int hif_config_ce(hif_handle_t hif_hdl);
  94. int athdiag_procfs_init(void *scn);
  95. void athdiag_procfs_remove(void);
  96. /* routine to modify the initial buffer count to be allocated on an os
  97. * platform basis. Platform owner will need to modify this as needed
  98. */
  99. cdf_size_t init_buffer_count(cdf_size_t maxSize);
  100. irqreturn_t hif_fw_interrupt_handler(int irq, void *arg);
  101. int hif_get_target_type(struct ol_softc *ol_sc, struct device *dev,
  102. void *bdev, const hif_bus_id *bid, uint32_t *hif_type,
  103. uint32_t *target_type);
  104. int hif_get_device_type(uint32_t device_id,
  105. uint32_t revision_id,
  106. uint32_t *hif_type, uint32_t *target_type);
  107. /*These functions are exposed to HDD*/
  108. int hif_init_cdf_ctx(void *ol_sc);
  109. void hif_deinit_cdf_ctx(void *ol_sc);
  110. bool hif_targ_is_awake(struct ol_softc *scn, void *__iomem *mem);
  111. void hif_nointrs(struct ol_softc *scn);
  112. void hif_bus_close(struct ol_softc *ol_sc);
  113. CDF_STATUS hif_bus_open(struct ol_softc *ol_sc,
  114. enum ath_hal_bus_type bus_type);
  115. CDF_STATUS hif_enable_bus(struct ol_softc *ol_sc, struct device *dev,
  116. void *bdev, const hif_bus_id *bid, enum hif_enable_type type);
  117. void hif_disable_bus(void *bdev);
  118. void hif_bus_prevent_linkdown(struct ol_softc *scn, bool flag);
  119. int hif_bus_get_context_size(void);
  120. #endif /* __HIF_MAIN_H__ */