xref: /openbmc/linux/drivers/net/wireless/ti/wl12xx/acx.h (revision 3213486f)
1 /*
2  * This file is part of wl12xx
3  *
4  * Copyright (C) 1998-2009, 2011 Texas Instruments. All rights reserved.
5  * Copyright (C) 2008-2010 Nokia Corporation
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * version 2 as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19  * 02110-1301 USA
20  *
21  */
22 
23 #ifndef __WL12XX_ACX_H__
24 #define __WL12XX_ACX_H__
25 
26 #include "../wlcore/wlcore.h"
27 #include "../wlcore/acx.h"
28 
29 #define WL12XX_ACX_ALL_EVENTS_VECTOR	(WL1271_ACX_INTR_WATCHDOG      | \
30 					WL1271_ACX_INTR_INIT_COMPLETE | \
31 					WL1271_ACX_INTR_EVENT_A       | \
32 					WL1271_ACX_INTR_EVENT_B       | \
33 					WL1271_ACX_INTR_CMD_COMPLETE  | \
34 					WL1271_ACX_INTR_HW_AVAILABLE  | \
35 					WL1271_ACX_INTR_DATA)
36 
37 #define WL12XX_INTR_MASK		(WL1271_ACX_INTR_WATCHDOG      | \
38 					WL1271_ACX_INTR_EVENT_A       | \
39 					WL1271_ACX_INTR_EVENT_B       | \
40 					WL1271_ACX_INTR_HW_AVAILABLE  | \
41 					WL1271_ACX_INTR_DATA)
42 
43 struct wl1271_acx_host_config_bitmap {
44 	struct acx_header header;
45 
46 	__le32 host_cfg_bitmap;
47 } __packed;
48 
49 struct wl12xx_acx_tx_statistics {
50 	__le32 internal_desc_overflow;
51 }  __packed;
52 
53 struct wl12xx_acx_rx_statistics {
54 	__le32 out_of_mem;
55 	__le32 hdr_overflow;
56 	__le32 hw_stuck;
57 	__le32 dropped;
58 	__le32 fcs_err;
59 	__le32 xfr_hint_trig;
60 	__le32 path_reset;
61 	__le32 reset_counter;
62 } __packed;
63 
64 struct wl12xx_acx_dma_statistics {
65 	__le32 rx_requested;
66 	__le32 rx_errors;
67 	__le32 tx_requested;
68 	__le32 tx_errors;
69 }  __packed;
70 
71 struct wl12xx_acx_isr_statistics {
72 	/* host command complete */
73 	__le32 cmd_cmplt;
74 
75 	/* fiqisr() */
76 	__le32 fiqs;
77 
78 	/* (INT_STS_ND & INT_TRIG_RX_HEADER) */
79 	__le32 rx_headers;
80 
81 	/* (INT_STS_ND & INT_TRIG_RX_CMPLT) */
82 	__le32 rx_completes;
83 
84 	/* (INT_STS_ND & INT_TRIG_NO_RX_BUF) */
85 	__le32 rx_mem_overflow;
86 
87 	/* (INT_STS_ND & INT_TRIG_S_RX_RDY) */
88 	__le32 rx_rdys;
89 
90 	/* irqisr() */
91 	__le32 irqs;
92 
93 	/* (INT_STS_ND & INT_TRIG_TX_PROC) */
94 	__le32 tx_procs;
95 
96 	/* (INT_STS_ND & INT_TRIG_DECRYPT_DONE) */
97 	__le32 decrypt_done;
98 
99 	/* (INT_STS_ND & INT_TRIG_DMA0) */
100 	__le32 dma0_done;
101 
102 	/* (INT_STS_ND & INT_TRIG_DMA1) */
103 	__le32 dma1_done;
104 
105 	/* (INT_STS_ND & INT_TRIG_TX_EXC_CMPLT) */
106 	__le32 tx_exch_complete;
107 
108 	/* (INT_STS_ND & INT_TRIG_COMMAND) */
109 	__le32 commands;
110 
111 	/* (INT_STS_ND & INT_TRIG_RX_PROC) */
112 	__le32 rx_procs;
113 
114 	/* (INT_STS_ND & INT_TRIG_PM_802) */
115 	__le32 hw_pm_mode_changes;
116 
117 	/* (INT_STS_ND & INT_TRIG_ACKNOWLEDGE) */
118 	__le32 host_acknowledges;
119 
120 	/* (INT_STS_ND & INT_TRIG_PM_PCI) */
121 	__le32 pci_pm;
122 
123 	/* (INT_STS_ND & INT_TRIG_ACM_WAKEUP) */
124 	__le32 wakeups;
125 
126 	/* (INT_STS_ND & INT_TRIG_LOW_RSSI) */
127 	__le32 low_rssi;
128 } __packed;
129 
130 struct wl12xx_acx_wep_statistics {
131 	/* WEP address keys configured */
132 	__le32 addr_key_count;
133 
134 	/* default keys configured */
135 	__le32 default_key_count;
136 
137 	__le32 reserved;
138 
139 	/* number of times that WEP key not found on lookup */
140 	__le32 key_not_found;
141 
142 	/* number of times that WEP key decryption failed */
143 	__le32 decrypt_fail;
144 
145 	/* WEP packets decrypted */
146 	__le32 packets;
147 
148 	/* WEP decrypt interrupts */
149 	__le32 interrupt;
150 } __packed;
151 
152 #define ACX_MISSED_BEACONS_SPREAD 10
153 
154 struct wl12xx_acx_pwr_statistics {
155 	/* the amount of enters into power save mode (both PD & ELP) */
156 	__le32 ps_enter;
157 
158 	/* the amount of enters into ELP mode */
159 	__le32 elp_enter;
160 
161 	/* the amount of missing beacon interrupts to the host */
162 	__le32 missing_bcns;
163 
164 	/* the amount of wake on host-access times */
165 	__le32 wake_on_host;
166 
167 	/* the amount of wake on timer-expire */
168 	__le32 wake_on_timer_exp;
169 
170 	/* the number of packets that were transmitted with PS bit set */
171 	__le32 tx_with_ps;
172 
173 	/* the number of packets that were transmitted with PS bit clear */
174 	__le32 tx_without_ps;
175 
176 	/* the number of received beacons */
177 	__le32 rcvd_beacons;
178 
179 	/* the number of entering into PowerOn (power save off) */
180 	__le32 power_save_off;
181 
182 	/* the number of entries into power save mode */
183 	__le16 enable_ps;
184 
185 	/*
186 	 * the number of exits from power save, not including failed PS
187 	 * transitions
188 	 */
189 	__le16 disable_ps;
190 
191 	/*
192 	 * the number of times the TSF counter was adjusted because
193 	 * of drift
194 	 */
195 	__le32 fix_tsf_ps;
196 
197 	/* Gives statistics about the spread continuous missed beacons.
198 	 * The 16 LSB are dedicated for the PS mode.
199 	 * The 16 MSB are dedicated for the PS mode.
200 	 * cont_miss_bcns_spread[0] - single missed beacon.
201 	 * cont_miss_bcns_spread[1] - two continuous missed beacons.
202 	 * cont_miss_bcns_spread[2] - three continuous missed beacons.
203 	 * ...
204 	 * cont_miss_bcns_spread[9] - ten and more continuous missed beacons.
205 	*/
206 	__le32 cont_miss_bcns_spread[ACX_MISSED_BEACONS_SPREAD];
207 
208 	/* the number of beacons in awake mode */
209 	__le32 rcvd_awake_beacons;
210 } __packed;
211 
212 struct wl12xx_acx_mic_statistics {
213 	__le32 rx_pkts;
214 	__le32 calc_failure;
215 } __packed;
216 
217 struct wl12xx_acx_aes_statistics {
218 	__le32 encrypt_fail;
219 	__le32 decrypt_fail;
220 	__le32 encrypt_packets;
221 	__le32 decrypt_packets;
222 	__le32 encrypt_interrupt;
223 	__le32 decrypt_interrupt;
224 } __packed;
225 
226 struct wl12xx_acx_event_statistics {
227 	__le32 heart_beat;
228 	__le32 calibration;
229 	__le32 rx_mismatch;
230 	__le32 rx_mem_empty;
231 	__le32 rx_pool;
232 	__le32 oom_late;
233 	__le32 phy_transmit_error;
234 	__le32 tx_stuck;
235 } __packed;
236 
237 struct wl12xx_acx_ps_statistics {
238 	__le32 pspoll_timeouts;
239 	__le32 upsd_timeouts;
240 	__le32 upsd_max_sptime;
241 	__le32 upsd_max_apturn;
242 	__le32 pspoll_max_apturn;
243 	__le32 pspoll_utilization;
244 	__le32 upsd_utilization;
245 } __packed;
246 
247 struct wl12xx_acx_rxpipe_statistics {
248 	__le32 rx_prep_beacon_drop;
249 	__le32 descr_host_int_trig_rx_data;
250 	__le32 beacon_buffer_thres_host_int_trig_rx_data;
251 	__le32 missed_beacon_host_int_trig_rx_data;
252 	__le32 tx_xfr_host_int_trig_rx_data;
253 } __packed;
254 
255 struct wl12xx_acx_statistics {
256 	struct acx_header header;
257 
258 	struct wl12xx_acx_tx_statistics tx;
259 	struct wl12xx_acx_rx_statistics rx;
260 	struct wl12xx_acx_dma_statistics dma;
261 	struct wl12xx_acx_isr_statistics isr;
262 	struct wl12xx_acx_wep_statistics wep;
263 	struct wl12xx_acx_pwr_statistics pwr;
264 	struct wl12xx_acx_aes_statistics aes;
265 	struct wl12xx_acx_mic_statistics mic;
266 	struct wl12xx_acx_event_statistics event;
267 	struct wl12xx_acx_ps_statistics ps;
268 	struct wl12xx_acx_rxpipe_statistics rxpipe;
269 } __packed;
270 
271 int wl1271_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap);
272 
273 #endif /* __WL12XX_ACX_H__ */
274