Debian Codegraph @

drivers/net/wireless/ti/wl18xx/wl18xx.h

raw
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
8 #ifndef __WL18XX_PRIV_H__
9 #define __WL18XX_PRIV_H__
10
11 #include "conf.h"
12
13 /* minimum FW required for driver */
14 #define WL18XX_CHIP_VER 8
15 #define WL18XX_IFTYPE_VER 9
16 #define WL18XX_MAJOR_VER 0
17 #define WL18XX_SUBTYPE_VER WLCORE_FW_VER_IGNORE
18 #define WL18XX_MINOR_VER 58
19
20 #define WL18XX_CMD_MAX_SIZE 740
21
22 #define WL18XX_AGGR_BUFFER_SIZE (13 * PAGE_SIZE)
23
24 #define WL18XX_NUM_TX_DESCRIPTORS 32
25 #define WL18XX_NUM_RX_DESCRIPTORS 32
26
27 #define WL18XX_NUM_MAC_ADDRESSES 2
28
29 #define WL18XX_RX_BA_MAX_SESSIONS 13
30
31 #define WL18XX_MAX_AP_STATIONS 10
32 #define WL18XX_MAX_LINKS 16
33
34 struct wl18xx_priv {
35 /* buffer for sending commands to FW */
36 u8 cmd_buf[WL18XX_CMD_MAX_SIZE];
37
38 struct wl18xx_priv_conf conf;
39
40 /* Index of last released Tx desc in FW */
41 u8 last_fw_rls_idx;
42
43 /* number of keys requiring extra spare mem-blocks */
44 int extra_spare_key_count;
45 };
46
47 #define WL18XX_FW_MAX_TX_STATUS_DESC 33
48
49 struct wl18xx_fw_status_priv {
50 /*
51 * Index in released_tx_desc for first byte that holds
52 * released tx host desc
53 */
54 u8 fw_release_idx;
55
56 /*
57 * Array of host Tx descriptors, where fw_release_idx
58 * indicated the first released idx.
59 */
60 u8 released_tx_desc[WL18XX_FW_MAX_TX_STATUS_DESC];
61
62 /* A bitmap representing the currently suspended links. The suspend
63 * is short lived, for multi-channel Tx requirements.
64 */
65 __le32 link_suspend_bitmap;
66
67 /* packet threshold for an "almost empty" AC,
68 * for Tx schedulng purposes
69 */
70 u8 tx_ac_threshold;
71
72 /* number of packets to queue up for a link in PS */
73 u8 tx_ps_threshold;
74
75 /* number of packet to queue up for a suspended link */
76 u8 tx_suspend_threshold;
77
78 /* Should have less than this number of packets in queue of a slow
79 * link to qualify as high priority link
80 */
81 u8 tx_slow_link_prio_threshold;
82
83 /* Should have less than this number of packets in queue of a fast
84 * link to qualify as high priority link
85 */
86 u8 tx_fast_link_prio_threshold;
87
88 /* Should have less than this number of packets in queue of a slow
89 * link before we stop queuing up packets for it.
90 */
91 u8 tx_slow_stop_threshold;
92
93 /* Should have less than this number of packets in queue of a fast
94 * link before we stop queuing up packets for it.
95 */
96 u8 tx_fast_stop_threshold;
97
98 u8 padding[3];
99 };
100
101 struct wl18xx_fw_packet_counters {
102 /* Cumulative counter of released packets per AC */
103 u8 tx_released_pkts[NUM_TX_QUEUES];
104
105 /* Cumulative counter of freed packets per HLID */
106 u8 tx_lnk_free_pkts[WL18XX_MAX_LINKS];
107
108 /* Cumulative counter of released Voice memory blocks */
109 u8 tx_voice_released_blks;
110
111 /* Tx rate of the last transmitted packet */
112 u8 tx_last_rate;
113
114 /* Tx rate or Tx rate estimate pre-calculated by fw in mbps units */
115 u8 tx_last_rate_mbps;
116
117 /* hlid for which the rates were reported */
118 u8 hlid;
119 } __packed;
120
121 /* FW status registers */
122 struct wl18xx_fw_status {
123 __le32 intr;
124 u8 fw_rx_counter;
125 u8 drv_rx_counter;
126 u8 reserved;
127 u8 tx_results_counter;
128 __le32 rx_pkt_descs[WL18XX_NUM_RX_DESCRIPTORS];
129
130 __le32 fw_localtime;
131
132 /*
133 * A bitmap (where each bit represents a single HLID)
134 * to indicate if the station is in PS mode.
135 */
136 __le32 link_ps_bitmap;
137
138 /*
139 * A bitmap (where each bit represents a single HLID) to indicate
140 * if the station is in Fast mode
141 */
142 __le32 link_fast_bitmap;
143
144 /* Cumulative counter of total released mem blocks since FW-reset */
145 __le32 total_released_blks;
146
147 /* Size (in Memory Blocks) of TX pool */
148 __le32 tx_total;
149
150 struct wl18xx_fw_packet_counters counters;
151
152 __le32 log_start_addr;
153
154 /* Private status to be used by the lower drivers */
155 struct wl18xx_fw_status_priv priv;
156 } __packed;
157
158 struct wl18xx_fw_packet_counters_8_9_1 {
159 /* Cumulative counter of released packets per AC */
160 u8 tx_released_pkts[NUM_TX_QUEUES];
161
162 /* Cumulative counter of freed packets per HLID */
163 u8 tx_lnk_free_pkts[WL18XX_MAX_LINKS];
164
165 /* PN16 of last TKIP/AES seq-num per HLID */
166 __le16 tx_lnk_sec_pn16[WL18XX_MAX_LINKS];
167
168 /* Cumulative counter of released Voice memory blocks */
169 u8 tx_voice_released_blks;
170
171 /* Tx rate of the last transmitted packet */
172 u8 tx_last_rate;
173
174 /* Tx rate or Tx rate estimate pre-calculated by fw in mbps units */
175 u8 tx_last_rate_mbps;
176
177 /* hlid for which the rates were reported */
178 u8 hlid;
179 } __packed;
180
181 /* FW status registers */
182 struct wl18xx_fw_status_8_9_1 {
183 __le32 intr;
184 u8 fw_rx_counter;
185 u8 drv_rx_counter;
186 u8 reserved;
187 u8 tx_results_counter;
188 __le32 rx_pkt_descs[WL18XX_NUM_RX_DESCRIPTORS];
189
190 __le32 fw_localtime;
191
192 /*
193 * A bitmap (where each bit represents a single HLID)
194 * to indicate if the station is in PS mode.
195 */
196 __le32 link_ps_bitmap;
197
198 /*
199 * A bitmap (where each bit represents a single HLID) to indicate
200 * if the station is in Fast mode
201 */
202 __le32 link_fast_bitmap;
203
204 /* Cumulative counter of total released mem blocks since FW-reset */
205 __le32 total_released_blks;
206
207 /* Size (in Memory Blocks) of TX pool */
208 __le32 tx_total;
209
210 struct wl18xx_fw_packet_counters_8_9_1 counters;
211
212 __le32 log_start_addr;
213
214 /* Private status to be used by the lower drivers */
215 struct wl18xx_fw_status_priv priv;
216 } __packed;
217
218 #define WL18XX_PHY_VERSION_MAX_LEN 20
219
220 struct wl18xx_static_data_priv {
221 char phy_version[WL18XX_PHY_VERSION_MAX_LEN];
222 };
223
224 struct wl18xx_clk_cfg {
225 u32 n;
226 u32 m;
227 u32 p;
228 u32 q;
229 bool swallow;
230 };
231
232 enum {
233 CLOCK_CONFIG_16_2_M = 1,
234 CLOCK_CONFIG_16_368_M,
235 CLOCK_CONFIG_16_8_M,
236 CLOCK_CONFIG_19_2_M,
237 CLOCK_CONFIG_26_M,
238 CLOCK_CONFIG_32_736_M,
239 CLOCK_CONFIG_33_6_M,
240 CLOCK_CONFIG_38_468_M,
241 CLOCK_CONFIG_52_M,
242
243 NUM_CLOCK_CONFIGS,
244 };
245
246 #endif /* __WL18XX_PRIV_H__ */