wl18xx.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /*
  2. * This file is part of wl18xx
  3. *
  4. * Copyright (C) 2011 Texas Instruments Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * version 2 as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  18. * 02110-1301 USA
  19. *
  20. */
  21. #ifndef __WL18XX_PRIV_H__
  22. #define __WL18XX_PRIV_H__
  23. #include "conf.h"
  24. /* minimum FW required for driver */
  25. #define WL18XX_CHIP_VER 8
  26. #define WL18XX_IFTYPE_VER 9
  27. #define WL18XX_MAJOR_VER WLCORE_FW_VER_IGNORE
  28. #define WL18XX_SUBTYPE_VER WLCORE_FW_VER_IGNORE
  29. #define WL18XX_MINOR_VER 11
  30. #define WL18XX_CMD_MAX_SIZE 740
  31. #define WL18XX_AGGR_BUFFER_SIZE (13 * PAGE_SIZE)
  32. #define WL18XX_NUM_TX_DESCRIPTORS 32
  33. #define WL18XX_NUM_RX_DESCRIPTORS 32
  34. #define WL18XX_NUM_MAC_ADDRESSES 2
  35. #define WL18XX_RX_BA_MAX_SESSIONS 13
  36. #define WL18XX_MAX_AP_STATIONS 10
  37. #define WL18XX_MAX_LINKS 16
  38. struct wl18xx_priv {
  39. /* buffer for sending commands to FW */
  40. u8 cmd_buf[WL18XX_CMD_MAX_SIZE];
  41. struct wl18xx_priv_conf conf;
  42. /* Index of last released Tx desc in FW */
  43. u8 last_fw_rls_idx;
  44. /* number of keys requiring extra spare mem-blocks */
  45. int extra_spare_key_count;
  46. };
  47. #define WL18XX_FW_MAX_TX_STATUS_DESC 33
  48. struct wl18xx_fw_status_priv {
  49. /*
  50. * Index in released_tx_desc for first byte that holds
  51. * released tx host desc
  52. */
  53. u8 fw_release_idx;
  54. /*
  55. * Array of host Tx descriptors, where fw_release_idx
  56. * indicated the first released idx.
  57. */
  58. u8 released_tx_desc[WL18XX_FW_MAX_TX_STATUS_DESC];
  59. /* A bitmap representing the currently suspended links. The suspend
  60. * is short lived, for multi-channel Tx requirements.
  61. */
  62. __le32 link_suspend_bitmap;
  63. /* packet threshold for an "almost empty" AC,
  64. * for Tx schedulng purposes
  65. */
  66. u8 tx_ac_threshold;
  67. /* number of packets to queue up for a link in PS */
  68. u8 tx_ps_threshold;
  69. /* number of packet to queue up for a suspended link */
  70. u8 tx_suspend_threshold;
  71. /* Should have less than this number of packets in queue of a slow
  72. * link to qualify as high priority link
  73. */
  74. u8 tx_slow_link_prio_threshold;
  75. /* Should have less than this number of packets in queue of a fast
  76. * link to qualify as high priority link
  77. */
  78. u8 tx_fast_link_prio_threshold;
  79. /* Should have less than this number of packets in queue of a slow
  80. * link before we stop queuing up packets for it.
  81. */
  82. u8 tx_slow_stop_threshold;
  83. /* Should have less than this number of packets in queue of a fast
  84. * link before we stop queuing up packets for it.
  85. */
  86. u8 tx_fast_stop_threshold;
  87. u8 padding[3];
  88. };
  89. struct wl18xx_fw_packet_counters {
  90. /* Cumulative counter of released packets per AC */
  91. u8 tx_released_pkts[NUM_TX_QUEUES];
  92. /* Cumulative counter of freed packets per HLID */
  93. u8 tx_lnk_free_pkts[WL18XX_MAX_LINKS];
  94. /* Cumulative counter of released Voice memory blocks */
  95. u8 tx_voice_released_blks;
  96. /* Tx rate of the last transmitted packet */
  97. u8 tx_last_rate;
  98. u8 padding[2];
  99. } __packed;
  100. /* FW status registers */
  101. struct wl18xx_fw_status {
  102. __le32 intr;
  103. u8 fw_rx_counter;
  104. u8 drv_rx_counter;
  105. u8 reserved;
  106. u8 tx_results_counter;
  107. __le32 rx_pkt_descs[WL18XX_NUM_RX_DESCRIPTORS];
  108. __le32 fw_localtime;
  109. /*
  110. * A bitmap (where each bit represents a single HLID)
  111. * to indicate if the station is in PS mode.
  112. */
  113. __le32 link_ps_bitmap;
  114. /*
  115. * A bitmap (where each bit represents a single HLID) to indicate
  116. * if the station is in Fast mode
  117. */
  118. __le32 link_fast_bitmap;
  119. /* Cumulative counter of total released mem blocks since FW-reset */
  120. __le32 total_released_blks;
  121. /* Size (in Memory Blocks) of TX pool */
  122. __le32 tx_total;
  123. struct wl18xx_fw_packet_counters counters;
  124. __le32 log_start_addr;
  125. /* Private status to be used by the lower drivers */
  126. struct wl18xx_fw_status_priv priv;
  127. } __packed;
  128. #define WL18XX_PHY_VERSION_MAX_LEN 20
  129. struct wl18xx_static_data_priv {
  130. char phy_version[WL18XX_PHY_VERSION_MAX_LEN];
  131. };
  132. struct wl18xx_clk_cfg {
  133. u32 n;
  134. u32 m;
  135. u32 p;
  136. u32 q;
  137. bool swallow;
  138. };
  139. enum {
  140. CLOCK_CONFIG_16_2_M = 1,
  141. CLOCK_CONFIG_16_368_M,
  142. CLOCK_CONFIG_16_8_M,
  143. CLOCK_CONFIG_19_2_M,
  144. CLOCK_CONFIG_26_M,
  145. CLOCK_CONFIG_32_736_M,
  146. CLOCK_CONFIG_33_6_M,
  147. CLOCK_CONFIG_38_468_M,
  148. CLOCK_CONFIG_52_M,
  149. NUM_CLOCK_CONFIGS,
  150. };
  151. #endif /* __WL18XX_PRIV_H__ */