blob: cca6060dbf30cfb11b8bf1153565837173615d39 [file] [log] [blame]
Kalle Valo5e3dd152013-06-12 20:52:10 +03001/*
2 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2013 Qualcomm Atheros, Inc.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#ifndef _CORE_H_
19#define _CORE_H_
20
21#include <linux/completion.h>
22#include <linux/if_ether.h>
23#include <linux/types.h>
24#include <linux/pci.h>
25
Michal Kazioredb82362013-07-05 16:15:14 +030026#include "htt.h"
Kalle Valo5e3dd152013-06-12 20:52:10 +030027#include "htc.h"
28#include "hw.h"
29#include "targaddrs.h"
30#include "wmi.h"
31#include "../ath.h"
32#include "../regd.h"
Janusz Dziedzic9702c682013-11-20 09:59:41 +020033#include "../dfs_pattern_detector.h"
Simon Wunderlich855aed12014-08-02 09:12:54 +030034#include "spectral.h"
Kalle Valo5e3dd152013-06-12 20:52:10 +030035
36#define MS(_v, _f) (((_v) & _f##_MASK) >> _f##_LSB)
37#define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK)
38#define WO(_f) ((_f##_OFFSET) >> 2)
39
40#define ATH10K_SCAN_ID 0
41#define WMI_READY_TIMEOUT (5 * HZ)
42#define ATH10K_FLUSH_TIMEOUT_HZ (5*HZ)
Michal Kazior2e1dea42013-07-31 10:32:40 +020043#define ATH10K_NUM_CHANS 38
Kalle Valo5e3dd152013-06-12 20:52:10 +030044
45/* Antenna noise floor */
46#define ATH10K_DEFAULT_NOISE_FLOOR -95
47
Bartosz Markowski71098612013-11-14 09:01:15 +010048#define ATH10K_MAX_NUM_MGMT_PENDING 128
Bartosz Markowski5e00d312013-09-26 17:47:12 +020049
Kalle Valo5a13e762014-01-20 11:01:46 +020050/* number of failed packets */
51#define ATH10K_KICKOUT_THRESHOLD 50
52
53/*
54 * Use insanely high numbers to make sure that the firmware implementation
55 * won't start, we have the same functionality already in hostapd. Unit
56 * is seconds.
57 */
58#define ATH10K_KEEPALIVE_MIN_IDLE 3747
59#define ATH10K_KEEPALIVE_MAX_IDLE 3895
60#define ATH10K_KEEPALIVE_MAX_UNRESPONSIVE 3900
61
Kalle Valo5e3dd152013-06-12 20:52:10 +030062struct ath10k;
63
Kalle Valo5e3dd152013-06-12 20:52:10 +030064struct ath10k_skb_cb {
65 dma_addr_t paddr;
Bartosz Markowski5e00d312013-09-26 17:47:12 +020066 u8 vdev_id;
Kalle Valo5e3dd152013-06-12 20:52:10 +030067
68 struct {
Kalle Valo5e3dd152013-06-12 20:52:10 +030069 u8 tid;
70 bool is_offchan;
Michal Kaziora16942e2014-02-27 18:50:04 +020071 struct ath10k_htt_txbuf *txbuf;
72 u32 txbuf_paddr;
Kalle Valo5e3dd152013-06-12 20:52:10 +030073 } __packed htt;
Michal Kazior748afc42014-01-23 12:48:21 +010074
75 struct {
76 bool dtim_zero;
77 bool deliver_cab;
78 } bcn;
Kalle Valo5e3dd152013-06-12 20:52:10 +030079} __packed;
80
81static inline struct ath10k_skb_cb *ATH10K_SKB_CB(struct sk_buff *skb)
82{
83 BUILD_BUG_ON(sizeof(struct ath10k_skb_cb) >
84 IEEE80211_TX_INFO_DRIVER_DATA_SIZE);
85 return (struct ath10k_skb_cb *)&IEEE80211_SKB_CB(skb)->driver_data;
86}
87
Kalle Valo5e3dd152013-06-12 20:52:10 +030088static inline u32 host_interest_item_address(u32 item_offset)
89{
90 return QCA988X_HOST_INTEREST_ADDRESS + item_offset;
91}
92
93struct ath10k_bmi {
94 bool done_sent;
95};
96
Bartosz Markowskib3effe62013-09-26 17:47:11 +020097#define ATH10K_MAX_MEM_REQS 16
98
99struct ath10k_mem_chunk {
100 void *vaddr;
101 dma_addr_t paddr;
102 u32 len;
103 u32 req_id;
104};
105
Kalle Valo5e3dd152013-06-12 20:52:10 +0300106struct ath10k_wmi {
107 enum ath10k_htc_ep_id eid;
108 struct completion service_ready;
109 struct completion unified_ready;
Michal Kaziorbe8b3942013-09-13 14:16:54 +0200110 wait_queue_head_t tx_credits_wq;
Bartosz Markowskice428702013-09-26 17:47:05 +0200111 struct wmi_cmd_map *cmd;
Bartosz Markowski6d1506e2013-09-26 17:47:15 +0200112 struct wmi_vdev_param_map *vdev_param;
Bartosz Markowski226a3392013-09-26 17:47:16 +0200113 struct wmi_pdev_param_map *pdev_param;
Bartosz Markowskib3effe62013-09-26 17:47:11 +0200114
115 u32 num_mem_chunks;
116 struct ath10k_mem_chunk mem_chunks[ATH10K_MAX_MEM_REQS];
Kalle Valo5e3dd152013-06-12 20:52:10 +0300117};
118
119struct ath10k_peer_stat {
120 u8 peer_macaddr[ETH_ALEN];
121 u32 peer_rssi;
122 u32 peer_tx_rate;
Ben Greear23c3aae2014-03-28 14:35:15 +0200123 u32 peer_rx_rate; /* 10x only */
Kalle Valo5e3dd152013-06-12 20:52:10 +0300124};
125
126struct ath10k_target_stats {
127 /* PDEV stats */
128 s32 ch_noise_floor;
129 u32 tx_frame_count;
130 u32 rx_frame_count;
131 u32 rx_clear_count;
132 u32 cycle_count;
133 u32 phy_err_count;
134 u32 chan_tx_power;
Chun-Yeow Yeoh52e346d2014-03-28 14:35:16 +0200135 u32 ack_rx_bad;
136 u32 rts_bad;
137 u32 rts_good;
138 u32 fcs_bad;
139 u32 no_beacons;
140 u32 mib_int_count;
Kalle Valo5e3dd152013-06-12 20:52:10 +0300141
142 /* PDEV TX stats */
143 s32 comp_queued;
144 s32 comp_delivered;
145 s32 msdu_enqued;
146 s32 mpdu_enqued;
147 s32 wmm_drop;
148 s32 local_enqued;
149 s32 local_freed;
150 s32 hw_queued;
151 s32 hw_reaped;
152 s32 underrun;
153 s32 tx_abort;
154 s32 mpdus_requed;
155 u32 tx_ko;
156 u32 data_rc;
157 u32 self_triggers;
158 u32 sw_retry_failure;
159 u32 illgl_rate_phy_err;
160 u32 pdev_cont_xretry;
161 u32 pdev_tx_timeout;
162 u32 pdev_resets;
163 u32 phy_underrun;
164 u32 txop_ovf;
165
166 /* PDEV RX stats */
167 s32 mid_ppdu_route_change;
168 s32 status_rcvd;
169 s32 r0_frags;
170 s32 r1_frags;
171 s32 r2_frags;
172 s32 r3_frags;
173 s32 htt_msdus;
174 s32 htt_mpdus;
175 s32 loc_msdus;
176 s32 loc_mpdus;
177 s32 oversize_amsdu;
178 s32 phy_errs;
179 s32 phy_err_drop;
180 s32 mpdu_errs;
181
182 /* VDEV STATS */
183
184 /* PEER STATS */
185 u8 peers;
186 struct ath10k_peer_stat peer_stat[TARGET_NUM_PEERS];
187
188 /* TODO: Beacon filter stats */
189
190};
191
Janusz Dziedzic9702c682013-11-20 09:59:41 +0200192struct ath10k_dfs_stats {
193 u32 phy_errors;
194 u32 pulses_total;
195 u32 pulses_detected;
196 u32 pulses_discarded;
197 u32 radar_detected;
198};
199
Kalle Valo5e3dd152013-06-12 20:52:10 +0300200#define ATH10K_MAX_NUM_PEER_IDS (1 << 11) /* htt rx_desc limit */
201
202struct ath10k_peer {
203 struct list_head list;
204 int vdev_id;
205 u8 addr[ETH_ALEN];
206 DECLARE_BITMAP(peer_ids, ATH10K_MAX_NUM_PEER_IDS);
207 struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1];
208};
209
Michal Kazior9797feb2014-02-14 14:49:48 +0100210struct ath10k_sta {
211 struct ath10k_vif *arvif;
212
213 /* the following are protected by ar->data_lock */
214 u32 changed; /* IEEE80211_RC_* */
215 u32 bw;
216 u32 nss;
217 u32 smps;
218
219 struct work_struct update_wk;
220};
221
Kalle Valo5e3dd152013-06-12 20:52:10 +0300222#define ATH10K_VDEV_SETUP_TIMEOUT_HZ (5*HZ)
223
224struct ath10k_vif {
Michal Kazior05791192013-10-16 15:44:45 +0300225 struct list_head list;
226
Kalle Valo5e3dd152013-06-12 20:52:10 +0300227 u32 vdev_id;
228 enum wmi_vdev_type vdev_type;
229 enum wmi_vdev_subtype vdev_subtype;
230 u32 beacon_interval;
231 u32 dtim_period;
Michal Kaziored543882013-09-13 14:16:56 +0200232 struct sk_buff *beacon;
Michal Kazior748afc42014-01-23 12:48:21 +0100233 /* protected by data_lock */
234 bool beacon_sent;
Kalle Valo5e3dd152013-06-12 20:52:10 +0300235
236 struct ath10k *ar;
237 struct ieee80211_vif *vif;
238
Michal Kaziorc930f742014-01-23 11:38:25 +0100239 bool is_started;
240 bool is_up;
Simon Wunderlich855aed12014-08-02 09:12:54 +0300241 bool spectral_enabled;
Michal Kaziorc930f742014-01-23 11:38:25 +0100242 u32 aid;
243 u8 bssid[ETH_ALEN];
244
Michal Kaziorcc4827b2013-10-16 15:44:45 +0300245 struct work_struct wep_key_work;
Kalle Valo5e3dd152013-06-12 20:52:10 +0300246 struct ieee80211_key_conf *wep_keys[WMI_MAX_KEY_INDEX + 1];
Michal Kaziorcc4827b2013-10-16 15:44:45 +0300247 u8 def_wep_key_idx;
248 u8 def_wep_key_newidx;
Kalle Valo5e3dd152013-06-12 20:52:10 +0300249
250 u16 tx_seq_no;
251
252 union {
253 struct {
Kalle Valo5e3dd152013-06-12 20:52:10 +0300254 u32 uapsd;
255 } sta;
256 struct {
257 /* 127 stations; wmi limit */
258 u8 tim_bitmap[16];
259 u8 tim_len;
260 u32 ssid_len;
261 u8 ssid[IEEE80211_MAX_SSID_LEN];
262 bool hidden_ssid;
263 /* P2P_IE with NoA attribute for P2P_GO case */
264 u32 noa_len;
265 u8 *noa_data;
266 } ap;
Kalle Valo5e3dd152013-06-12 20:52:10 +0300267 } u;
Janusz Dziedzic51ab1a02014-01-08 09:08:33 +0100268
269 u8 fixed_rate;
270 u8 fixed_nss;
Janusz Dziedzic9f81f722014-01-17 20:04:14 +0100271 u8 force_sgi;
Marek Kwaczynskie81bd102014-03-11 12:58:00 +0200272 bool use_cts_prot;
273 int num_legacy_stations;
Kalle Valo5e3dd152013-06-12 20:52:10 +0300274};
275
276struct ath10k_vif_iter {
277 u32 vdev_id;
278 struct ath10k_vif *arvif;
279};
280
281struct ath10k_debug {
282 struct dentry *debugfs_phy;
283
284 struct ath10k_target_stats target_stats;
Michal Kaziorcff990c2014-08-04 09:18:33 +0300285 DECLARE_BITMAP(wmi_service_bitmap, WMI_SERVICE_BM_SIZE);
Kalle Valo5e3dd152013-06-12 20:52:10 +0300286
287 struct completion event_stats_compl;
Kalle Valoa3d135e2013-09-03 11:44:10 +0300288
289 unsigned long htt_stats_mask;
290 struct delayed_work htt_stats_dwork;
Janusz Dziedzic9702c682013-11-20 09:59:41 +0200291 struct ath10k_dfs_stats dfs_stats;
292 struct ath_dfs_pool_stats dfs_pool_stats;
Kalle Valof118a3e2014-01-03 12:59:31 +0200293
294 u32 fw_dbglog_mask;
Janusz Dziedzicd3856232014-06-02 21:19:46 +0300295
296 u8 htt_max_amsdu;
297 u8 htt_max_ampdu;
Kalle Valo5e3dd152013-06-12 20:52:10 +0300298};
299
Michal Kaziorf7843d72013-07-16 09:38:52 +0200300enum ath10k_state {
301 ATH10K_STATE_OFF = 0,
302 ATH10K_STATE_ON,
Michal Kazioraffd3212013-07-16 09:54:35 +0200303
304 /* When doing firmware recovery the device is first powered down.
305 * mac80211 is supposed to call in to start() hook later on. It is
306 * however possible that driver unloading and firmware crash overlap.
307 * mac80211 can wait on conf_mutex in stop() while the device is
308 * stopped in ath10k_core_restart() work holding conf_mutex. The state
309 * RESTARTED means that the device is up and mac80211 has started hw
310 * reconfiguration. Once mac80211 is done with the reconfiguration we
311 * set the state to STATE_ON in restart_complete(). */
312 ATH10K_STATE_RESTARTING,
313 ATH10K_STATE_RESTARTED,
314
315 /* The device has crashed while restarting hw. This state is like ON
316 * but commands are blocked in HTC and -ECOMM response is given. This
317 * prevents completion timeouts and makes the driver more responsive to
318 * userspace commands. This is also prevents recursive recovery. */
319 ATH10K_STATE_WEDGED,
Michal Kaziorf7843d72013-07-16 09:38:52 +0200320};
321
Michal Kazior0d9b0432013-08-09 10:13:33 +0200322enum ath10k_fw_features {
323 /* wmi_mgmt_rx_hdr contains extra RSSI information */
324 ATH10K_FW_FEATURE_EXT_WMI_MGMT_RX = 0,
325
Bartosz Markowskice428702013-09-26 17:47:05 +0200326 /* firmware from 10X branch */
327 ATH10K_FW_FEATURE_WMI_10X = 1,
328
Bartosz Markowski5e00d312013-09-26 17:47:12 +0200329 /* firmware support tx frame management over WMI, otherwise it's HTT */
330 ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX = 2,
331
Bartosz Markowskid3541812013-12-10 16:20:40 +0100332 /* Firmware does not support P2P */
333 ATH10K_FW_FEATURE_NO_P2P = 3,
334
Michal Kazior24c88f72014-07-25 13:32:17 +0200335 /* Firmware 10.2 feature bit. The ATH10K_FW_FEATURE_WMI_10X feature bit
336 * is required to be set as well.
337 */
338 ATH10K_FW_FEATURE_WMI_10_2 = 4,
339
Michal Kazior0d9b0432013-08-09 10:13:33 +0200340 /* keep last */
341 ATH10K_FW_FEATURE_COUNT,
342};
343
Marek Puzyniake8a50f82013-11-20 09:59:47 +0200344enum ath10k_dev_flags {
345 /* Indicates that ath10k device is during CAC phase of DFS */
346 ATH10K_CAC_RUNNING,
Kalle Valo650b91f2013-11-20 10:00:49 +0200347 ATH10K_FLAG_FIRST_BOOT_DONE,
Michal Kazior6782cb62014-05-23 12:28:47 +0200348 ATH10K_FLAG_CORE_REGISTERED,
Marek Puzyniake8a50f82013-11-20 09:59:47 +0200349};
350
Michal Kazior5c81c7f2014-08-05 14:54:44 +0200351enum ath10k_scan_state {
352 ATH10K_SCAN_IDLE,
353 ATH10K_SCAN_STARTING,
354 ATH10K_SCAN_RUNNING,
355 ATH10K_SCAN_ABORTING,
356};
357
358static inline const char *ath10k_scan_state_str(enum ath10k_scan_state state)
359{
360 switch (state) {
361 case ATH10K_SCAN_IDLE:
362 return "idle";
363 case ATH10K_SCAN_STARTING:
364 return "starting";
365 case ATH10K_SCAN_RUNNING:
366 return "running";
367 case ATH10K_SCAN_ABORTING:
368 return "aborting";
369 }
370
371 return "unknown";
372}
373
Kalle Valo5e3dd152013-06-12 20:52:10 +0300374struct ath10k {
375 struct ath_common ath_common;
376 struct ieee80211_hw *hw;
377 struct device *dev;
378 u8 mac_addr[ETH_ALEN];
379
Kalle Valoe01ae682013-09-01 11:22:14 +0300380 u32 chip_id;
Kalle Valo5e3dd152013-06-12 20:52:10 +0300381 u32 target_version;
382 u8 fw_version_major;
383 u32 fw_version_minor;
384 u16 fw_version_release;
385 u16 fw_version_build;
386 u32 phy_capability;
387 u32 hw_min_tx_power;
388 u32 hw_max_tx_power;
389 u32 ht_cap_info;
390 u32 vht_cap_info;
Michal Kazior8865bee42013-07-24 12:36:46 +0200391 u32 num_rf_chains;
Kalle Valo5e3dd152013-06-12 20:52:10 +0300392
Michal Kazior0d9b0432013-08-09 10:13:33 +0200393 DECLARE_BITMAP(fw_features, ATH10K_FW_FEATURE_COUNT);
394
Kalle Valo5e3dd152013-06-12 20:52:10 +0300395 struct targetdef *targetdef;
396 struct hostdef *hostdef;
397
398 bool p2p;
399
400 struct {
Kalle Valo5e3dd152013-06-12 20:52:10 +0300401 const struct ath10k_hif_ops *ops;
402 } hif;
403
Marek Puzyniak9042e172014-02-10 17:14:23 +0100404 struct completion target_suspend;
Kalle Valo5e3dd152013-06-12 20:52:10 +0300405
406 struct ath10k_bmi bmi;
Michal Kazioredb82362013-07-05 16:15:14 +0300407 struct ath10k_wmi wmi;
Michal Kaziorcd003fa2013-07-05 16:15:13 +0300408 struct ath10k_htc htc;
Michal Kazioredb82362013-07-05 16:15:14 +0300409 struct ath10k_htt htt;
Kalle Valo5e3dd152013-06-12 20:52:10 +0300410
411 struct ath10k_hw_params {
412 u32 id;
413 const char *name;
414 u32 patch_load_addr;
415
416 struct ath10k_hw_params_fw {
417 const char *dir;
418 const char *fw;
419 const char *otp;
420 const char *board;
421 } fw;
422 } hw_params;
423
Kalle Valo36527912013-09-27 19:54:55 +0300424 const struct firmware *board;
Kalle Valo958df3a2013-09-27 19:55:01 +0300425 const void *board_data;
426 size_t board_len;
427
Michal Kazior29385052013-07-16 09:38:58 +0200428 const struct firmware *otp;
Kalle Valo958df3a2013-09-27 19:55:01 +0300429 const void *otp_data;
430 size_t otp_len;
431
Michal Kazior29385052013-07-16 09:38:58 +0200432 const struct firmware *firmware;
Kalle Valo958df3a2013-09-27 19:55:01 +0300433 const void *firmware_data;
434 size_t firmware_len;
Michal Kazior29385052013-07-16 09:38:58 +0200435
Kalle Valo1a222432013-09-27 19:55:07 +0300436 int fw_api;
437
Kalle Valo5e3dd152013-06-12 20:52:10 +0300438 struct {
439 struct completion started;
440 struct completion completed;
441 struct completion on_channel;
Michal Kazior5c81c7f2014-08-05 14:54:44 +0200442 struct delayed_work timeout;
443 enum ath10k_scan_state state;
Kalle Valo5e3dd152013-06-12 20:52:10 +0300444 bool is_roc;
Kalle Valo5e3dd152013-06-12 20:52:10 +0300445 int vdev_id;
446 int roc_freq;
447 } scan;
448
449 struct {
450 struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
451 } mac;
452
453 /* should never be NULL; needed for regular htt rx */
454 struct ieee80211_channel *rx_channel;
455
456 /* valid during scan; needed for mgmt rx during scan */
457 struct ieee80211_channel *scan_channel;
458
Michal Kaziorc930f742014-01-23 11:38:25 +0100459 /* current operating channel definition */
460 struct cfg80211_chan_def chandef;
461
Kalle Valo5e3dd152013-06-12 20:52:10 +0300462 int free_vdev_map;
Michal Kazior1bbc0972014-04-08 09:45:47 +0300463 bool promisc;
464 bool monitor;
Kalle Valo5e3dd152013-06-12 20:52:10 +0300465 int monitor_vdev_id;
Michal Kazior1bbc0972014-04-08 09:45:47 +0300466 bool monitor_started;
Kalle Valo5e3dd152013-06-12 20:52:10 +0300467 unsigned int filter_flags;
Marek Puzyniake8a50f82013-11-20 09:59:47 +0200468 unsigned long dev_flags;
Marek Puzyniak7d9b40b2013-11-20 10:00:28 +0200469 u32 dfs_block_radar_events;
Kalle Valo5e3dd152013-06-12 20:52:10 +0300470
Michal Kaziord6500972014-04-08 09:56:09 +0300471 /* protected by conf_mutex */
472 bool radar_enabled;
473 int num_started_vdevs;
474
Ben Greear46acf7b2014-05-16 17:15:38 +0300475 /* Protected by conf-mutex */
476 u8 supp_tx_chainmask;
477 u8 supp_rx_chainmask;
478 u8 cfg_tx_chainmask;
479 u8 cfg_rx_chainmask;
480
Kalle Valo5e3dd152013-06-12 20:52:10 +0300481 struct wmi_pdev_set_wmm_params_arg wmm_params;
482 struct completion install_key_done;
483
484 struct completion vdev_setup_done;
485
486 struct workqueue_struct *workqueue;
487
488 /* prevents concurrent FW reconfiguration */
489 struct mutex conf_mutex;
490
491 /* protects shared structure data */
492 spinlock_t data_lock;
493
Michal Kazior05791192013-10-16 15:44:45 +0300494 struct list_head arvifs;
Kalle Valo5e3dd152013-06-12 20:52:10 +0300495 struct list_head peers;
496 wait_queue_head_t peer_mapping_wq;
497
Bartosz Markowski0e759f32014-01-02 14:38:33 +0100498 /* number of created peers; protected by data_lock */
499 int num_peers;
500
Kalle Valo5e3dd152013-06-12 20:52:10 +0300501 struct work_struct offchan_tx_work;
502 struct sk_buff_head offchan_tx_queue;
503 struct completion offchan_tx_completed;
504 struct sk_buff *offchan_tx_skb;
505
Bartosz Markowski5e00d312013-09-26 17:47:12 +0200506 struct work_struct wmi_mgmt_tx_work;
507 struct sk_buff_head wmi_mgmt_tx_queue;
508
Michal Kaziorf7843d72013-07-16 09:38:52 +0200509 enum ath10k_state state;
510
Michal Kazior6782cb62014-05-23 12:28:47 +0200511 struct work_struct register_work;
Michal Kazioraffd3212013-07-16 09:54:35 +0200512 struct work_struct restart_work;
513
Michal Kazior2e1dea42013-07-31 10:32:40 +0200514 /* cycle count is reported twice for each visited channel during scan.
515 * access protected by data_lock */
516 u32 survey_last_rx_clear_count;
517 u32 survey_last_cycle_count;
518 struct survey_info survey[ATH10K_NUM_CHANS];
519
Janusz Dziedzic9702c682013-11-20 09:59:41 +0200520 struct dfs_pattern_detector *dfs_detector;
521
Kalle Valo5e3dd152013-06-12 20:52:10 +0300522#ifdef CONFIG_ATH10K_DEBUGFS
523 struct ath10k_debug debug;
524#endif
Simon Wunderlich855aed12014-08-02 09:12:54 +0300525
526 struct {
527 /* relay(fs) channel for spectral scan */
528 struct rchan *rfs_chan_spec_scan;
529
530 /* spectral_mode and spec_config are protected by conf_mutex */
531 enum ath10k_spectral_mode mode;
532 struct ath10k_spec_scan config;
533 } spectral;
Michal Kaziore7b54192014-08-07 11:03:27 +0200534
535 /* must be last */
536 u8 drv_priv[0] __aligned(sizeof(void *));
Kalle Valo5e3dd152013-06-12 20:52:10 +0300537};
538
Michal Kaziore7b54192014-08-07 11:03:27 +0200539struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev,
Kalle Valo5e3dd152013-06-12 20:52:10 +0300540 const struct ath10k_hif_ops *hif_ops);
541void ath10k_core_destroy(struct ath10k *ar);
542
Michal Kaziordd30a362013-07-16 09:38:51 +0200543int ath10k_core_start(struct ath10k *ar);
Marek Puzyniak00f54822014-02-10 17:14:24 +0100544int ath10k_wait_for_suspend(struct ath10k *ar, u32 suspend_opt);
Michal Kaziordd30a362013-07-16 09:38:51 +0200545void ath10k_core_stop(struct ath10k *ar);
Kalle Valoe01ae682013-09-01 11:22:14 +0300546int ath10k_core_register(struct ath10k *ar, u32 chip_id);
Kalle Valo5e3dd152013-06-12 20:52:10 +0300547void ath10k_core_unregister(struct ath10k *ar);
548
Kalle Valo5e3dd152013-06-12 20:52:10 +0300549#endif /* _CORE_H_ */