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