wl18xx.h 4.1 KB

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