Luciano Coelho | b2ba99f | 2011-11-20 23:32:10 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of wlcore |
| 3 | * |
| 4 | * Copyright (C) 2011 Texas Instruments Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * version 2 as published by the Free Software Foundation. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 18 | * 02110-1301 USA |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | #ifndef __WLCORE_H__ |
| 23 | #define __WLCORE_H__ |
| 24 | |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 25 | #include <linux/platform_device.h> |
| 26 | |
Luciano Coelho | 8388569 | 2012-05-10 12:13:42 +0300 | [diff] [blame] | 27 | #include "wlcore_i.h" |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 28 | #include "event.h" |
Luciano Coelho | 7140df6 | 2012-05-10 12:14:10 +0300 | [diff] [blame] | 29 | #include "boot.h" |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 30 | |
Arik Nemtsov | 72b0624 | 2011-12-07 21:21:51 +0200 | [diff] [blame] | 31 | /* The maximum number of Tx descriptors in all chip families */ |
| 32 | #define WLCORE_MAX_TX_DESCRIPTORS 32 |
| 33 | |
Arik Nemtsov | f4afbed | 2012-08-02 20:37:21 +0300 | [diff] [blame] | 34 | /* |
| 35 | * We always allocate this number of mac addresses. If we don't |
| 36 | * have enough allocated addresses, the LAA bit is used |
| 37 | */ |
| 38 | #define WLCORE_NUM_MAC_ADDRESSES 3 |
| 39 | |
Victor Goldenshtein | 583f816 | 2012-11-27 08:44:55 +0200 | [diff] [blame] | 40 | /* wl12xx/wl18xx maximum transmission power (in dBm) */ |
| 41 | #define WLCORE_MAX_TXPWR 25 |
| 42 | |
Arik Nemtsov | cd70f6a | 2011-12-12 12:11:43 +0200 | [diff] [blame] | 43 | /* forward declaration */ |
| 44 | struct wl1271_tx_hw_descr; |
| 45 | enum wl_rx_buf_align; |
Arik Nemtsov | 169da04 | 2012-05-10 12:13:28 +0300 | [diff] [blame] | 46 | struct wl1271_rx_descriptor; |
Arik Nemtsov | 4158149 | 2011-12-12 12:18:17 +0200 | [diff] [blame] | 47 | |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 48 | struct wlcore_ops { |
Ido Yariv | 3992eb2 | 2012-09-02 12:29:27 +0300 | [diff] [blame] | 49 | int (*setup)(struct wl1271 *wl); |
Luciano Coelho | 6f7dd16 | 2011-11-29 16:27:31 +0200 | [diff] [blame] | 50 | int (*identify_chip)(struct wl1271 *wl); |
Luciano Coelho | 80cd661 | 2011-12-06 22:24:57 +0200 | [diff] [blame] | 51 | int (*identify_fw)(struct wl1271 *wl); |
Luciano Coelho | dd5512e | 2012-04-11 11:03:14 +0300 | [diff] [blame] | 52 | int (*boot)(struct wl1271 *wl); |
Luciano Coelho | c331b34 | 2012-05-10 12:13:49 +0300 | [diff] [blame] | 53 | int (*plt_init)(struct wl1271 *wl); |
Ido Yariv | eb96f84 | 2012-06-18 13:21:55 +0300 | [diff] [blame] | 54 | int (*trigger_cmd)(struct wl1271 *wl, int cmd_box_addr, |
| 55 | void *buf, size_t len); |
Ido Yariv | b0f0ad3 | 2012-06-20 00:48:23 +0300 | [diff] [blame] | 56 | int (*ack_event)(struct wl1271 *wl); |
Eliad Peller | c50a282 | 2012-11-22 18:06:19 +0200 | [diff] [blame] | 57 | int (*wait_for_event)(struct wl1271 *wl, enum wlcore_wait_event event, |
| 58 | bool *timeout); |
| 59 | int (*process_mailbox_events)(struct wl1271 *wl); |
Arik Nemtsov | b3b4b4b | 2011-12-12 11:41:44 +0200 | [diff] [blame] | 60 | u32 (*calc_tx_blocks)(struct wl1271 *wl, u32 len, u32 spare_blks); |
Arik Nemtsov | 4a3b97ee | 2011-12-12 11:44:27 +0200 | [diff] [blame] | 61 | void (*set_tx_desc_blocks)(struct wl1271 *wl, |
| 62 | struct wl1271_tx_hw_descr *desc, |
| 63 | u32 blks, u32 spare_blks); |
Arik Nemtsov | 6f266e9 | 2011-12-12 11:47:09 +0200 | [diff] [blame] | 64 | void (*set_tx_desc_data_len)(struct wl1271 *wl, |
| 65 | struct wl1271_tx_hw_descr *desc, |
| 66 | struct sk_buff *skb); |
Arik Nemtsov | cd70f6a | 2011-12-12 12:11:43 +0200 | [diff] [blame] | 67 | enum wl_rx_buf_align (*get_rx_buf_align)(struct wl1271 *wl, |
| 68 | u32 rx_desc); |
Ido Yariv | eb96f84 | 2012-06-18 13:21:55 +0300 | [diff] [blame] | 69 | int (*prepare_read)(struct wl1271 *wl, u32 rx_desc, u32 len); |
Arik Nemtsov | 4158149 | 2011-12-12 12:18:17 +0200 | [diff] [blame] | 70 | u32 (*get_rx_packet_len)(struct wl1271 *wl, void *rx_data, |
| 71 | u32 data_len); |
Ido Yariv | 045b9b5 | 2012-06-18 12:31:16 +0300 | [diff] [blame] | 72 | int (*tx_delayed_compl)(struct wl1271 *wl); |
Arik Nemtsov | 53d67a5 | 2011-12-12 11:32:37 +0200 | [diff] [blame] | 73 | void (*tx_immediate_compl)(struct wl1271 *wl); |
Luciano Coelho | 9d68d1e | 2011-12-02 00:47:45 +0200 | [diff] [blame] | 74 | int (*hw_init)(struct wl1271 *wl); |
Arik Nemtsov | 8a9affc | 2011-12-13 12:15:09 +0200 | [diff] [blame] | 75 | int (*init_vif)(struct wl1271 *wl, struct wl12xx_vif *wlvif); |
Eliad Peller | 75fb4df | 2014-02-10 13:47:21 +0200 | [diff] [blame] | 76 | void (*convert_fw_status)(struct wl1271 *wl, void *raw_fw_status, |
| 77 | struct wl_fw_status *fw_status); |
Arik Nemtsov | fa7930a | 2011-12-13 13:18:17 +0200 | [diff] [blame] | 78 | u32 (*sta_get_ap_rate_mask)(struct wl1271 *wl, |
| 79 | struct wl12xx_vif *wlvif); |
Ido Yariv | 6134323 | 2012-06-18 15:50:21 +0300 | [diff] [blame] | 80 | int (*get_pg_ver)(struct wl1271 *wl, s8 *ver); |
| 81 | int (*get_mac)(struct wl1271 *wl); |
Arik Nemtsov | 2fc28de | 2012-05-10 12:13:27 +0300 | [diff] [blame] | 82 | void (*set_tx_desc_csum)(struct wl1271 *wl, |
| 83 | struct wl1271_tx_hw_descr *desc, |
| 84 | struct sk_buff *skb); |
Arik Nemtsov | 169da04 | 2012-05-10 12:13:28 +0300 | [diff] [blame] | 85 | void (*set_rx_csum)(struct wl1271 *wl, |
| 86 | struct wl1271_rx_descriptor *desc, |
| 87 | struct sk_buff *skb); |
Arik Nemtsov | ebc7e57 | 2012-05-10 12:13:34 +0300 | [diff] [blame] | 88 | u32 (*ap_get_mimo_wide_rate_mask)(struct wl1271 *wl, |
| 89 | struct wl12xx_vif *wlvif); |
Luciano Coelho | 4987257 | 2012-05-10 12:14:06 +0300 | [diff] [blame] | 90 | int (*debugfs_init)(struct wl1271 *wl, struct dentry *rootdir); |
Luciano Coelho | 7140df6 | 2012-05-10 12:14:10 +0300 | [diff] [blame] | 91 | int (*handle_static_data)(struct wl1271 *wl, |
| 92 | struct wl1271_static_data *static_data); |
Eliad Peller | 78e2806 | 2012-11-22 18:06:15 +0200 | [diff] [blame] | 93 | int (*scan_start)(struct wl1271 *wl, struct wl12xx_vif *wlvif, |
| 94 | struct cfg80211_scan_request *req); |
| 95 | int (*scan_stop)(struct wl1271 *wl, struct wl12xx_vif *wlvif); |
Eliad Peller | 78e2806 | 2012-11-22 18:06:15 +0200 | [diff] [blame] | 96 | int (*sched_scan_start)(struct wl1271 *wl, struct wl12xx_vif *wlvif, |
| 97 | struct cfg80211_sched_scan_request *req, |
David Spinadel | 633e271 | 2014-02-06 16:15:23 +0200 | [diff] [blame] | 98 | struct ieee80211_scan_ies *ies); |
Eliad Peller | 78e2806 | 2012-11-22 18:06:15 +0200 | [diff] [blame] | 99 | void (*sched_scan_stop)(struct wl1271 *wl, struct wl12xx_vif *wlvif); |
Arik Nemtsov | 32bb2c0 | 2012-05-18 07:46:37 +0300 | [diff] [blame] | 100 | int (*get_spare_blocks)(struct wl1271 *wl, bool is_gem); |
Arik Nemtsov | a1c597f | 2012-05-18 07:46:40 +0300 | [diff] [blame] | 101 | int (*set_key)(struct wl1271 *wl, enum set_key_cmd cmd, |
| 102 | struct ieee80211_vif *vif, |
| 103 | struct ieee80211_sta *sta, |
| 104 | struct ieee80211_key_conf *key_conf); |
Eliad Peller | fcab189 | 2012-11-22 18:06:18 +0200 | [diff] [blame] | 105 | int (*channel_switch)(struct wl1271 *wl, |
| 106 | struct wl12xx_vif *wlvif, |
| 107 | struct ieee80211_channel_switch *ch_switch); |
Ido Reis | 9fccc82 | 2012-05-13 14:53:40 +0300 | [diff] [blame] | 108 | u32 (*pre_pkt_send)(struct wl1271 *wl, u32 buf_offset, u32 last_len); |
Eliad Peller | 7d3b29e | 2014-12-29 08:24:03 +0200 | [diff] [blame] | 109 | void (*sta_rc_update)(struct wl1271 *wl, struct wl12xx_vif *wlvif); |
Eliad Peller | 530abe1 | 2012-11-28 11:42:31 +0200 | [diff] [blame] | 110 | int (*set_peer_cap)(struct wl1271 *wl, |
| 111 | struct ieee80211_sta_ht_cap *ht_cap, |
| 112 | bool allow_ht_operation, |
| 113 | u32 rate_set, u8 hlid); |
Igal Chernobelsky | c83cb80 | 2013-09-09 12:24:38 +0300 | [diff] [blame] | 114 | u32 (*convert_hwaddr)(struct wl1271 *wl, u32 hwaddr); |
Arik Nemtsov | f1626fd | 2012-11-28 11:42:40 +0200 | [diff] [blame] | 115 | bool (*lnk_high_prio)(struct wl1271 *wl, u8 hlid, |
| 116 | struct wl1271_link *lnk); |
| 117 | bool (*lnk_low_prio)(struct wl1271 *wl, u8 hlid, |
| 118 | struct wl1271_link *lnk); |
Ram Amrani | 6d5a748 | 2014-12-29 08:24:04 +0200 | [diff] [blame] | 119 | int (*interrupt_notify)(struct wl1271 *wl, bool action); |
| 120 | int (*rx_ba_filter)(struct wl1271 *wl, bool action); |
Kobi L | e2f1e50 | 2014-12-29 08:24:06 +0200 | [diff] [blame] | 121 | int (*ap_sleep)(struct wl1271 *wl); |
Eliad Peller | ccb1df9 | 2014-07-11 03:01:31 +0300 | [diff] [blame] | 122 | int (*smart_config_start)(struct wl1271 *wl, u32 group_bitmap); |
| 123 | int (*smart_config_stop)(struct wl1271 *wl); |
| 124 | int (*smart_config_set_group_key)(struct wl1271 *wl, u16 group_id, |
| 125 | u8 key_len, u8 *key); |
Eliad Peller | 750e9d1 | 2014-12-29 08:24:07 +0200 | [diff] [blame] | 126 | int (*set_cac)(struct wl1271 *wl, struct wl12xx_vif *wlvif, |
| 127 | bool start); |
Eliad Peller | 830513a | 2014-12-29 08:24:10 +0200 | [diff] [blame] | 128 | int (*dfs_master_restart)(struct wl1271 *wl, struct wl12xx_vif *wlvif); |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 129 | }; |
| 130 | |
Luciano Coelho | 25a43d7 | 2011-11-21 20:37:14 +0200 | [diff] [blame] | 131 | enum wlcore_partitions { |
| 132 | PART_DOWN, |
| 133 | PART_WORK, |
| 134 | PART_BOOT, |
| 135 | PART_DRPW, |
| 136 | PART_TOP_PRCM_ELP_SOC, |
| 137 | PART_PHY_INIT, |
| 138 | |
| 139 | PART_TABLE_LEN, |
| 140 | }; |
| 141 | |
| 142 | struct wlcore_partition { |
| 143 | u32 size; |
| 144 | u32 start; |
| 145 | }; |
| 146 | |
| 147 | struct wlcore_partition_set { |
| 148 | struct wlcore_partition mem; |
| 149 | struct wlcore_partition reg; |
| 150 | struct wlcore_partition mem2; |
| 151 | struct wlcore_partition mem3; |
| 152 | }; |
| 153 | |
Luciano Coelho | 0078213 | 2011-11-29 13:38:37 +0200 | [diff] [blame] | 154 | enum wlcore_registers { |
| 155 | /* register addresses, used with partition translation */ |
| 156 | REG_ECPU_CONTROL, |
| 157 | REG_INTERRUPT_NO_CLEAR, |
| 158 | REG_INTERRUPT_ACK, |
| 159 | REG_COMMAND_MAILBOX_PTR, |
| 160 | REG_EVENT_MAILBOX_PTR, |
| 161 | REG_INTERRUPT_TRIG, |
| 162 | REG_INTERRUPT_MASK, |
| 163 | REG_PC_ON_RECOVERY, |
| 164 | REG_CHIP_ID_B, |
| 165 | REG_CMD_MBOX_ADDRESS, |
| 166 | |
| 167 | /* data access memory addresses, used with partition translation */ |
| 168 | REG_SLV_MEM_DATA, |
| 169 | REG_SLV_REG_DATA, |
| 170 | |
| 171 | /* raw data access memory addresses */ |
| 172 | REG_RAW_FW_STATUS_ADDR, |
| 173 | |
| 174 | REG_TABLE_LEN, |
| 175 | }; |
| 176 | |
Luciano Coelho | 4987257 | 2012-05-10 12:14:06 +0300 | [diff] [blame] | 177 | struct wl1271_stats { |
| 178 | void *fw_stats; |
| 179 | unsigned long fw_stats_update; |
| 180 | size_t fw_stats_len; |
| 181 | |
| 182 | unsigned int retry_count; |
| 183 | unsigned int excessive_retries; |
| 184 | }; |
| 185 | |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 186 | struct wl1271 { |
Ido Yariv | 6f8d6b2 | 2012-09-02 01:32:47 +0300 | [diff] [blame] | 187 | bool initialized; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 188 | struct ieee80211_hw *hw; |
| 189 | bool mac80211_registered; |
| 190 | |
| 191 | struct device *dev; |
Ido Yariv | 3992eb2 | 2012-09-02 12:29:27 +0300 | [diff] [blame] | 192 | struct platform_device *pdev; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 193 | |
| 194 | void *if_priv; |
| 195 | |
| 196 | struct wl1271_if_operations *if_ops; |
| 197 | |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 198 | int irq; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 199 | |
Luciano Coelho | 6f921fa | 2015-03-18 18:38:25 +0200 | [diff] [blame] | 200 | int irq_flags; |
| 201 | |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 202 | spinlock_t wl_lock; |
| 203 | |
Ido Yariv | 4cc5338 | 2012-07-24 19:18:49 +0300 | [diff] [blame] | 204 | enum wlcore_state state; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 205 | enum wl12xx_fw_type fw_type; |
| 206 | bool plt; |
Yair Shapira | 7019c80 | 2012-07-11 18:48:04 +0300 | [diff] [blame] | 207 | enum plt_mode plt_mode; |
Yair Shapira | ff32431 | 2012-07-11 18:48:06 +0300 | [diff] [blame] | 208 | u8 fem_manuf; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 209 | u8 last_vif_count; |
| 210 | struct mutex mutex; |
| 211 | |
| 212 | unsigned long flags; |
| 213 | |
Luciano Coelho | 25a43d7 | 2011-11-21 20:37:14 +0200 | [diff] [blame] | 214 | struct wlcore_partition_set curr_part; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 215 | |
| 216 | struct wl1271_chip chip; |
| 217 | |
| 218 | int cmd_box_addr; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 219 | |
| 220 | u8 *fw; |
| 221 | size_t fw_len; |
| 222 | void *nvs; |
| 223 | size_t nvs_len; |
| 224 | |
| 225 | s8 hw_pg_ver; |
| 226 | |
| 227 | /* address read from the fuse ROM */ |
| 228 | u32 fuse_oui_addr; |
| 229 | u32 fuse_nic_addr; |
| 230 | |
| 231 | /* we have up to 2 MAC addresses */ |
Arik Nemtsov | f4afbed | 2012-08-02 20:37:21 +0300 | [diff] [blame] | 232 | struct mac_address addresses[WLCORE_NUM_MAC_ADDRESSES]; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 233 | int channel; |
| 234 | u8 system_hlid; |
| 235 | |
Eliad Peller | da08fdf | 2014-02-10 13:47:22 +0200 | [diff] [blame] | 236 | unsigned long links_map[BITS_TO_LONGS(WLCORE_MAX_LINKS)]; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 237 | unsigned long roles_map[BITS_TO_LONGS(WL12XX_MAX_ROLES)]; |
| 238 | unsigned long roc_map[BITS_TO_LONGS(WL12XX_MAX_ROLES)]; |
| 239 | unsigned long rate_policies_map[ |
| 240 | BITS_TO_LONGS(WL12XX_MAX_RATE_POLICIES)]; |
Eliad Peller | 001e39a | 2012-08-16 13:52:47 +0300 | [diff] [blame] | 241 | unsigned long klv_templates_map[ |
| 242 | BITS_TO_LONGS(WLCORE_MAX_KLV_TEMPLATES)]; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 243 | |
Eliad Peller | da08fdf | 2014-02-10 13:47:22 +0200 | [diff] [blame] | 244 | u8 session_ids[WLCORE_MAX_LINKS]; |
Eliad Peller | 978cd3a | 2012-11-22 18:06:21 +0200 | [diff] [blame] | 245 | |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 246 | struct list_head wlvif_list; |
| 247 | |
| 248 | u8 sta_count; |
| 249 | u8 ap_count; |
| 250 | |
| 251 | struct wl1271_acx_mem_map *target_mem_map; |
| 252 | |
| 253 | /* Accounting for allocated / available TX blocks on HW */ |
| 254 | u32 tx_blocks_freed; |
| 255 | u32 tx_blocks_available; |
| 256 | u32 tx_allocated_blocks; |
| 257 | u32 tx_results_count; |
| 258 | |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 259 | /* Accounting for allocated / available Tx packets in HW */ |
| 260 | u32 tx_pkts_freed[NUM_TX_QUEUES]; |
| 261 | u32 tx_allocated_pkts[NUM_TX_QUEUES]; |
| 262 | |
| 263 | /* Transmitted TX packets counter for chipset interface */ |
| 264 | u32 tx_packets_count; |
| 265 | |
| 266 | /* Time-offset between host and chipset clocks */ |
| 267 | s64 time_offset; |
| 268 | |
| 269 | /* Frames scheduled for transmission, not handled yet */ |
| 270 | int tx_queue_count[NUM_TX_QUEUES]; |
Arik Nemtsov | 1c33db7 | 2012-11-30 00:48:03 +0200 | [diff] [blame] | 271 | unsigned long queue_stop_reasons[ |
| 272 | NUM_TX_QUEUES * WLCORE_NUM_MAC_ADDRESSES]; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 273 | |
| 274 | /* Frames received, not handled yet by mac80211 */ |
| 275 | struct sk_buff_head deferred_rx_queue; |
| 276 | |
| 277 | /* Frames sent, not returned yet to mac80211 */ |
| 278 | struct sk_buff_head deferred_tx_queue; |
| 279 | |
| 280 | struct work_struct tx_work; |
| 281 | struct workqueue_struct *freezable_wq; |
| 282 | |
| 283 | /* Pending TX frames */ |
Arik Nemtsov | 72b0624 | 2011-12-07 21:21:51 +0200 | [diff] [blame] | 284 | unsigned long tx_frames_map[BITS_TO_LONGS(WLCORE_MAX_TX_DESCRIPTORS)]; |
| 285 | struct sk_buff *tx_frames[WLCORE_MAX_TX_DESCRIPTORS]; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 286 | int tx_frames_cnt; |
| 287 | |
| 288 | /* FW Rx counter */ |
| 289 | u32 rx_counter; |
| 290 | |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 291 | /* Intermediate buffer, used for packet aggregation */ |
| 292 | u8 *aggr_buf; |
Igal Chernobelsky | 26a309c | 2012-07-29 18:21:12 +0300 | [diff] [blame] | 293 | u32 aggr_buf_size; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 294 | |
| 295 | /* Reusable dummy packet template */ |
| 296 | struct sk_buff *dummy_packet; |
| 297 | |
| 298 | /* Network stack work */ |
| 299 | struct work_struct netstack_work; |
| 300 | |
| 301 | /* FW log buffer */ |
| 302 | u8 *fwlog; |
| 303 | |
| 304 | /* Number of valid bytes in the FW log buffer */ |
| 305 | ssize_t fwlog_size; |
| 306 | |
Igal Chernobelsky | c83cb80 | 2013-09-09 12:24:38 +0300 | [diff] [blame] | 307 | /* FW log end marker */ |
| 308 | u32 fwlog_end; |
| 309 | |
| 310 | /* FW memory block size */ |
| 311 | u32 fw_mem_block_size; |
| 312 | |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 313 | /* Hardware recovery work */ |
| 314 | struct work_struct recovery_work; |
Yoni Divinsky | afbe371 | 2012-05-16 11:34:18 +0300 | [diff] [blame] | 315 | bool watchdog_recovery; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 316 | |
Victor Goldenshtein | 6b70e7e | 2012-11-25 18:26:59 +0200 | [diff] [blame] | 317 | /* Reg domain last configuration */ |
Guodong Xu | 32677b2 | 2015-09-18 20:37:27 +0800 | [diff] [blame] | 318 | u32 reg_ch_conf_last[2] __aligned(8); |
Victor Goldenshtein | 6b70e7e | 2012-11-25 18:26:59 +0200 | [diff] [blame] | 319 | /* Reg domain pending configuration */ |
| 320 | u32 reg_ch_conf_pending[2]; |
| 321 | |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 322 | /* Pointer that holds DMA-friendly block for the mailbox */ |
Eliad Peller | c50a282 | 2012-11-22 18:06:19 +0200 | [diff] [blame] | 323 | void *mbox; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 324 | |
| 325 | /* The mbox event mask */ |
| 326 | u32 event_mask; |
Eliad Peller | 71e996b | 2013-09-09 12:24:34 +0300 | [diff] [blame] | 327 | /* events to unmask only when ap interface is up */ |
| 328 | u32 ap_event_mask; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 329 | |
| 330 | /* Mailbox pointers */ |
Eliad Peller | c50a282 | 2012-11-22 18:06:19 +0200 | [diff] [blame] | 331 | u32 mbox_size; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 332 | u32 mbox_ptr[2]; |
| 333 | |
| 334 | /* Are we currently scanning */ |
Eliad Peller | c50a282 | 2012-11-22 18:06:19 +0200 | [diff] [blame] | 335 | struct wl12xx_vif *scan_wlvif; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 336 | struct wl1271_scan scan; |
| 337 | struct delayed_work scan_complete_work; |
| 338 | |
Eliad Peller | dabf37d | 2012-11-20 13:20:03 +0200 | [diff] [blame] | 339 | struct ieee80211_vif *roc_vif; |
| 340 | struct delayed_work roc_complete_work; |
Bartosz.Markowski@tieto.com | 5f561f6 | 2012-04-26 10:35:07 +0300 | [diff] [blame] | 341 | |
Eliad Peller | 1019975 | 2012-11-22 18:06:23 +0200 | [diff] [blame] | 342 | struct wl12xx_vif *sched_vif; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 343 | |
| 344 | /* The current band */ |
Johannes Berg | 57fbcce | 2016-04-12 15:56:15 +0200 | [diff] [blame] | 345 | enum nl80211_band band; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 346 | |
| 347 | struct completion *elp_compl; |
| 348 | struct delayed_work elp_work; |
| 349 | |
| 350 | /* in dBm */ |
| 351 | int power_level; |
| 352 | |
| 353 | struct wl1271_stats stats; |
| 354 | |
Ido Yariv | 2e07d02 | 2012-11-28 11:42:49 +0200 | [diff] [blame] | 355 | __le32 *buffer_32; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 356 | u32 buffer_cmd; |
| 357 | u32 buffer_busyword[WL1271_BUSY_WORD_CNT]; |
| 358 | |
Eliad Peller | 75fb4df | 2014-02-10 13:47:21 +0200 | [diff] [blame] | 359 | void *raw_fw_status; |
| 360 | struct wl_fw_status *fw_status; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 361 | struct wl1271_tx_hw_res_if *tx_res_if; |
| 362 | |
| 363 | /* Current chipset configuration */ |
Luciano Coelho | e87288f | 2011-12-05 16:12:54 +0200 | [diff] [blame] | 364 | struct wlcore_conf conf; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 365 | |
| 366 | bool sg_enabled; |
| 367 | |
| 368 | bool enable_11a; |
| 369 | |
Luciano Coelho | c108c90 | 2012-11-26 18:05:49 +0200 | [diff] [blame] | 370 | int recovery_count; |
| 371 | |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 372 | /* Most recently reported noise in dBm */ |
| 373 | s8 noise; |
| 374 | |
| 375 | /* bands supported by this instance of wl12xx */ |
Arik Nemtsov | 091185d | 2012-07-03 09:11:03 +0300 | [diff] [blame] | 376 | struct ieee80211_supported_band bands[WLCORE_NUM_BANDS]; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 377 | |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 378 | /* |
| 379 | * wowlan trigger was configured during suspend. |
| 380 | * (currently, only "ANY" trigger is supported) |
| 381 | */ |
| 382 | bool wow_enabled; |
| 383 | bool irq_wake_enabled; |
| 384 | |
| 385 | /* |
| 386 | * AP-mode - links indexed by HLID. The global and broadcast links |
| 387 | * are always active. |
| 388 | */ |
Eliad Peller | da08fdf | 2014-02-10 13:47:22 +0200 | [diff] [blame] | 389 | struct wl1271_link links[WLCORE_MAX_LINKS]; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 390 | |
Arik Nemtsov | 9a10096 | 2012-11-28 11:42:42 +0200 | [diff] [blame] | 391 | /* number of currently active links */ |
| 392 | int active_link_count; |
| 393 | |
Arik Nemtsov | 0e81047 | 2012-11-27 08:45:00 +0200 | [diff] [blame] | 394 | /* Fast/slow links bitmap according to FW */ |
Eliad Peller | 5e74b3a | 2014-07-11 03:01:39 +0300 | [diff] [blame] | 395 | unsigned long fw_fast_lnk_map; |
Arik Nemtsov | 0e81047 | 2012-11-27 08:45:00 +0200 | [diff] [blame] | 396 | |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 397 | /* AP-mode - a bitmap of links currently in PS mode according to FW */ |
Eliad Peller | 5e74b3a | 2014-07-11 03:01:39 +0300 | [diff] [blame] | 398 | unsigned long ap_fw_ps_map; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 399 | |
| 400 | /* AP-mode - a bitmap of links currently in PS mode in mac80211 */ |
| 401 | unsigned long ap_ps_map; |
| 402 | |
| 403 | /* Quirks of specific hardware revisions */ |
| 404 | unsigned int quirks; |
| 405 | |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 406 | /* number of currently active RX BA sessions */ |
| 407 | int ba_rx_session_count; |
| 408 | |
Igal Chernobelsky | d21553f | 2013-03-12 17:19:35 +0200 | [diff] [blame] | 409 | /* Maximum number of supported RX BA sessions */ |
| 410 | int ba_rx_session_count_max; |
| 411 | |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 412 | /* AP-mode - number of currently connected stations */ |
| 413 | int active_sta_count; |
| 414 | |
Arik Nemtsov | bc566f9 | 2014-02-10 13:47:28 +0200 | [diff] [blame] | 415 | /* Flag determining whether AP should broadcast OFDM-only rates */ |
| 416 | bool ofdm_only_ap; |
| 417 | |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 418 | /* last wlvif we transmitted from */ |
| 419 | struct wl12xx_vif *last_wlvif; |
| 420 | |
| 421 | /* work to fire when Tx is stuck */ |
| 422 | struct delayed_work tx_watchdog_work; |
| 423 | |
| 424 | struct wlcore_ops *ops; |
Luciano Coelho | 25a43d7 | 2011-11-21 20:37:14 +0200 | [diff] [blame] | 425 | /* pointer to the lower driver partition table */ |
| 426 | const struct wlcore_partition_set *ptable; |
Luciano Coelho | 0078213 | 2011-11-29 13:38:37 +0200 | [diff] [blame] | 427 | /* pointer to the lower driver register table */ |
| 428 | const int *rtable; |
Luciano Coelho | 6f7dd16 | 2011-11-29 16:27:31 +0200 | [diff] [blame] | 429 | /* name of the firmwares to load - for PLT, single role, multi-role */ |
| 430 | const char *plt_fw_name; |
| 431 | const char *sr_fw_name; |
| 432 | const char *mr_fw_name; |
Arik Nemtsov | 96e0c68 | 2011-12-07 21:09:03 +0200 | [diff] [blame] | 433 | |
Eliad Peller | 78e2806 | 2012-11-22 18:06:15 +0200 | [diff] [blame] | 434 | u8 scan_templ_id_2_4; |
| 435 | u8 scan_templ_id_5; |
| 436 | u8 sched_scan_templ_id_2_4; |
| 437 | u8 sched_scan_templ_id_5; |
Eliad Peller | 0a1c720 | 2012-11-22 18:06:16 +0200 | [diff] [blame] | 438 | u8 max_channels_5; |
Eliad Peller | 78e2806 | 2012-11-22 18:06:15 +0200 | [diff] [blame] | 439 | |
Arik Nemtsov | 96e0c68 | 2011-12-07 21:09:03 +0200 | [diff] [blame] | 440 | /* per-chip-family private structure */ |
| 441 | void *priv; |
Arik Nemtsov | 72b0624 | 2011-12-07 21:21:51 +0200 | [diff] [blame] | 442 | |
| 443 | /* number of TX descriptors the HW supports. */ |
| 444 | u32 num_tx_desc; |
Arik Nemtsov | 0afd04e | 2012-05-10 12:13:54 +0300 | [diff] [blame] | 445 | /* number of RX descriptors the HW supports. */ |
| 446 | u32 num_rx_desc; |
Eliad Peller | da08fdf | 2014-02-10 13:47:22 +0200 | [diff] [blame] | 447 | /* number of links the HW supports */ |
| 448 | u8 num_links; |
Eliad Peller | 32f0fd5 | 2014-02-10 13:47:23 +0200 | [diff] [blame] | 449 | /* max stations a single AP can support */ |
| 450 | u8 max_ap_stations; |
Arik Nemtsov | 3edab30 | 2011-12-07 23:38:47 +0200 | [diff] [blame] | 451 | |
Arik Nemtsov | 43a8bc5 | 2011-12-08 00:43:48 +0200 | [diff] [blame] | 452 | /* translate HW Tx rates to standard rate-indices */ |
| 453 | const u8 **band_rate_to_idx; |
| 454 | |
| 455 | /* size of table for HW rates that can be received from chip */ |
| 456 | u8 hw_tx_rate_tbl_size; |
| 457 | |
| 458 | /* this HW rate and below are considered HT rates for this chip */ |
| 459 | u8 hw_min_ht_rate; |
Arik Nemtsov | 4a589a6 | 2011-12-13 13:20:44 +0200 | [diff] [blame] | 460 | |
| 461 | /* HW HT (11n) capabilities */ |
Arik Nemtsov | 091185d | 2012-07-03 09:11:03 +0300 | [diff] [blame] | 462 | struct ieee80211_sta_ht_cap ht_cap[WLCORE_NUM_BANDS]; |
Arik Nemtsov | 6bac40a | 2011-12-12 12:08:25 +0200 | [diff] [blame] | 463 | |
Guy Mishol | 1cd91b2 | 2014-12-29 08:24:12 +0200 | [diff] [blame] | 464 | /* the current dfs region */ |
| 465 | enum nl80211_dfs_regions dfs_region; |
Eliad Peller | 8cf77e1 | 2016-03-07 00:28:09 +0200 | [diff] [blame] | 466 | bool radar_debug_mode; |
Guy Mishol | 1cd91b2 | 2014-12-29 08:24:12 +0200 | [diff] [blame] | 467 | |
Arik Nemtsov | 6bac40a | 2011-12-12 12:08:25 +0200 | [diff] [blame] | 468 | /* size of the private FW status data */ |
Eliad Peller | 75fb4df | 2014-02-10 13:47:21 +0200 | [diff] [blame] | 469 | size_t fw_status_len; |
Arik Nemtsov | 6bac40a | 2011-12-12 12:08:25 +0200 | [diff] [blame] | 470 | size_t fw_status_priv_len; |
Eyal Shapira | dbe0a8c | 2012-03-14 06:32:09 +0200 | [diff] [blame] | 471 | |
| 472 | /* RX Data filter rule state - enabled/disabled */ |
Nadim Zubidat | 02d0727 | 2014-02-10 13:47:17 +0200 | [diff] [blame] | 473 | unsigned long rx_filter_enabled[BITS_TO_LONGS(WL1271_MAX_RX_FILTERS)]; |
Arik Nemtsov | 83d08d3 | 2012-05-10 12:13:30 +0300 | [diff] [blame] | 474 | |
Luciano Coelho | 7140df6 | 2012-05-10 12:14:10 +0300 | [diff] [blame] | 475 | /* size of the private static data */ |
| 476 | size_t static_data_priv_len; |
| 477 | |
Arik Nemtsov | 83d08d3 | 2012-05-10 12:13:30 +0300 | [diff] [blame] | 478 | /* the current channel type */ |
| 479 | enum nl80211_channel_type channel_type; |
Arik Nemtsov | 2c38849 | 2012-05-18 07:46:39 +0300 | [diff] [blame] | 480 | |
| 481 | /* mutex for protecting the tx_flush function */ |
| 482 | struct mutex flush_mutex; |
Luciano Coelho | 26b5858 | 2012-02-28 19:13:28 +0200 | [diff] [blame] | 483 | |
| 484 | /* sleep auth value currently configured to FW */ |
| 485 | int sleep_auth; |
Arik Nemtsov | 4a1ccce | 2012-06-25 17:46:40 +0300 | [diff] [blame] | 486 | |
Arik Nemtsov | f4afbed | 2012-08-02 20:37:21 +0300 | [diff] [blame] | 487 | /* the number of allocated MAC addresses in this chip */ |
| 488 | int num_mac_addr; |
| 489 | |
Luciano Coelho | 8675f9a | 2012-11-27 15:52:00 +0200 | [diff] [blame] | 490 | /* minimum FW version required for the driver to work in single-role */ |
| 491 | unsigned int min_sr_fw_ver[NUM_FW_VER]; |
| 492 | |
| 493 | /* minimum FW version required for the driver to work in multi-role */ |
| 494 | unsigned int min_mr_fw_ver[NUM_FW_VER]; |
Ido Yariv | 6f8d6b2 | 2012-09-02 01:32:47 +0300 | [diff] [blame] | 495 | |
| 496 | struct completion nvs_loading_complete; |
Arik Nemtsov | de40750 | 2012-11-26 18:05:44 +0200 | [diff] [blame] | 497 | |
Eliad Peller | abf0b24 | 2014-02-10 13:47:24 +0200 | [diff] [blame] | 498 | /* interface combinations supported by the hw */ |
| 499 | const struct ieee80211_iface_combination *iface_combinations; |
| 500 | u8 n_iface_combinations; |
Guy Mishol | d1c5409 | 2015-07-27 09:46:02 +0300 | [diff] [blame] | 501 | |
| 502 | /* dynamic fw traces */ |
| 503 | u32 dynamic_fw_traces; |
Luciano Coelho | c31be25 | 2011-11-21 19:25:24 +0200 | [diff] [blame] | 504 | }; |
Luciano Coelho | ffeb501 | 2011-11-21 18:55:51 +0200 | [diff] [blame] | 505 | |
Bill Pemberton | b74324d | 2012-12-03 09:56:42 -0500 | [diff] [blame] | 506 | int wlcore_probe(struct wl1271 *wl, struct platform_device *pdev); |
| 507 | int wlcore_remove(struct platform_device *pdev); |
Eliad Peller | c50a282 | 2012-11-22 18:06:19 +0200 | [diff] [blame] | 508 | struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size, u32 aggr_buf_size, |
| 509 | u32 mbox_size); |
Luciano Coelho | ffeb501 | 2011-11-21 18:55:51 +0200 | [diff] [blame] | 510 | int wlcore_free_hw(struct wl1271 *wl); |
Arik Nemtsov | a1c597f | 2012-05-18 07:46:40 +0300 | [diff] [blame] | 511 | int wlcore_set_key(struct wl1271 *wl, enum set_key_cmd cmd, |
| 512 | struct ieee80211_vif *vif, |
| 513 | struct ieee80211_sta *sta, |
| 514 | struct ieee80211_key_conf *key_conf); |
Victor Goldenshtein | 6b70e7e | 2012-11-25 18:26:59 +0200 | [diff] [blame] | 515 | void wlcore_regdomain_config(struct wl1271 *wl); |
Arik Nemtsov | 187e52c | 2013-09-17 18:41:20 +0300 | [diff] [blame] | 516 | void wlcore_update_inconn_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif, |
| 517 | struct wl1271_station *wl_sta, bool in_conn); |
Luciano Coelho | ffeb501 | 2011-11-21 18:55:51 +0200 | [diff] [blame] | 518 | |
Arik Nemtsov | fa2adfc | 2012-06-13 19:09:25 +0300 | [diff] [blame] | 519 | static inline void |
Johannes Berg | 57fbcce | 2016-04-12 15:56:15 +0200 | [diff] [blame] | 520 | wlcore_set_ht_cap(struct wl1271 *wl, enum nl80211_band band, |
Arik Nemtsov | fa2adfc | 2012-06-13 19:09:25 +0300 | [diff] [blame] | 521 | struct ieee80211_sta_ht_cap *ht_cap) |
| 522 | { |
| 523 | memcpy(&wl->ht_cap[band], ht_cap, sizeof(*ht_cap)); |
| 524 | } |
| 525 | |
Luciano Coelho | af4e94c | 2012-11-27 15:51:58 +0200 | [diff] [blame] | 526 | /* Tell wlcore not to care about this element when checking the version */ |
| 527 | #define WLCORE_FW_VER_IGNORE -1 |
| 528 | |
Arik Nemtsov | 4a1ccce | 2012-06-25 17:46:40 +0300 | [diff] [blame] | 529 | static inline void |
| 530 | wlcore_set_min_fw_ver(struct wl1271 *wl, unsigned int chip, |
Luciano Coelho | 8675f9a | 2012-11-27 15:52:00 +0200 | [diff] [blame] | 531 | unsigned int iftype_sr, unsigned int major_sr, |
| 532 | unsigned int subtype_sr, unsigned int minor_sr, |
| 533 | unsigned int iftype_mr, unsigned int major_mr, |
| 534 | unsigned int subtype_mr, unsigned int minor_mr) |
Arik Nemtsov | 4a1ccce | 2012-06-25 17:46:40 +0300 | [diff] [blame] | 535 | { |
Luciano Coelho | 8675f9a | 2012-11-27 15:52:00 +0200 | [diff] [blame] | 536 | wl->min_sr_fw_ver[FW_VER_CHIP] = chip; |
| 537 | wl->min_sr_fw_ver[FW_VER_IF_TYPE] = iftype_sr; |
| 538 | wl->min_sr_fw_ver[FW_VER_MAJOR] = major_sr; |
| 539 | wl->min_sr_fw_ver[FW_VER_SUBTYPE] = subtype_sr; |
| 540 | wl->min_sr_fw_ver[FW_VER_MINOR] = minor_sr; |
| 541 | |
| 542 | wl->min_mr_fw_ver[FW_VER_CHIP] = chip; |
| 543 | wl->min_mr_fw_ver[FW_VER_IF_TYPE] = iftype_mr; |
| 544 | wl->min_mr_fw_ver[FW_VER_MAJOR] = major_mr; |
| 545 | wl->min_mr_fw_ver[FW_VER_SUBTYPE] = subtype_mr; |
| 546 | wl->min_mr_fw_ver[FW_VER_MINOR] = minor_mr; |
Arik Nemtsov | 4a1ccce | 2012-06-25 17:46:40 +0300 | [diff] [blame] | 547 | } |
| 548 | |
Luciano Coelho | 0078213 | 2011-11-29 13:38:37 +0200 | [diff] [blame] | 549 | /* Firmware image load chunk size */ |
| 550 | #define CHUNK_SIZE 16384 |
| 551 | |
Luciano Coelho | 6f7dd16 | 2011-11-29 16:27:31 +0200 | [diff] [blame] | 552 | /* Quirks */ |
| 553 | |
| 554 | /* Each RX/TX transaction requires an end-of-transaction transfer */ |
| 555 | #define WLCORE_QUIRK_END_OF_TRANSACTION BIT(0) |
| 556 | |
Eliad Peller | 18eab43 | 2012-11-20 13:20:02 +0200 | [diff] [blame] | 557 | /* the first start_role(sta) sometimes doesn't work on wl12xx */ |
| 558 | #define WLCORE_QUIRK_START_STA_FAILS BIT(1) |
| 559 | |
Luciano Coelho | 6f7dd16 | 2011-11-29 16:27:31 +0200 | [diff] [blame] | 560 | /* wl127x and SPI don't support SDIO block size alignment */ |
Arik Nemtsov | f83985bb | 2011-12-13 12:11:26 +0200 | [diff] [blame] | 561 | #define WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN BIT(2) |
Luciano Coelho | 6f7dd16 | 2011-11-29 16:27:31 +0200 | [diff] [blame] | 562 | |
Arik Nemtsov | 5766435 | 2011-12-12 12:09:12 +0200 | [diff] [blame] | 563 | /* means aggregated Rx packets are aligned to a SDIO block */ |
| 564 | #define WLCORE_QUIRK_RX_BLOCKSIZE_ALIGN BIT(3) |
| 565 | |
Luciano Coelho | 6f7dd16 | 2011-11-29 16:27:31 +0200 | [diff] [blame] | 566 | /* Older firmwares did not implement the FW logger over bus feature */ |
| 567 | #define WLCORE_QUIRK_FWLOG_NOT_IMPLEMENTED BIT(4) |
| 568 | |
Luciano Coelho | d203e59 | 2011-11-30 12:30:01 +0200 | [diff] [blame] | 569 | /* Older firmwares use an old NVS format */ |
| 570 | #define WLCORE_QUIRK_LEGACY_NVS BIT(5) |
| 571 | |
Ido Reis | 9fccc82 | 2012-05-13 14:53:40 +0300 | [diff] [blame] | 572 | /* pad only the last frame in the aggregate buffer */ |
| 573 | #define WLCORE_QUIRK_TX_PAD_LAST_FRAME BIT(7) |
| 574 | |
Arik Nemtsov | 2c0133a | 2012-05-18 07:46:36 +0300 | [diff] [blame] | 575 | /* extra header space is required for TKIP */ |
| 576 | #define WLCORE_QUIRK_TKIP_HEADER_SPACE BIT(8) |
| 577 | |
Victor Goldenshtein | 01b3c0e | 2012-06-14 09:47:40 +0300 | [diff] [blame] | 578 | /* Some firmwares not support sched scans while connected */ |
| 579 | #define WLCORE_QUIRK_NO_SCHED_SCAN_WHILE_CONN BIT(9) |
| 580 | |
Yoni Divinsky | 3df74f4 | 2012-06-27 13:01:44 +0300 | [diff] [blame] | 581 | /* separate probe response templates for one-shot and sched scans */ |
| 582 | #define WLCORE_QUIRK_DUAL_PROBE_TMPL BIT(10) |
| 583 | |
Victor Goldenshtein | 6b70e7e | 2012-11-25 18:26:59 +0200 | [diff] [blame] | 584 | /* Firmware requires reg domain configuration for active calibration */ |
| 585 | #define WLCORE_QUIRK_REGDOMAIN_CONF BIT(11) |
| 586 | |
Arik Nemtsov | 3ea186d | 2012-11-30 00:50:06 +0200 | [diff] [blame] | 587 | /* The FW only support a zero session id for AP */ |
| 588 | #define WLCORE_QUIRK_AP_ZERO_SESSION_ID BIT(12) |
Luciano Coelho | 0078213 | 2011-11-29 13:38:37 +0200 | [diff] [blame] | 589 | |
| 590 | /* TODO: move all these common registers and values elsewhere */ |
| 591 | #define HW_ACCESS_ELP_CTRL_REG 0x1FFFC |
| 592 | |
| 593 | /* ELP register commands */ |
| 594 | #define ELPCTRL_WAKE_UP 0x1 |
| 595 | #define ELPCTRL_WAKE_UP_WLAN_READY 0x5 |
| 596 | #define ELPCTRL_SLEEP 0x0 |
| 597 | /* ELP WLAN_READY bit */ |
| 598 | #define ELPCTRL_WLAN_READY 0x2 |
| 599 | |
| 600 | /************************************************************************* |
| 601 | |
| 602 | Interrupt Trigger Register (Host -> WiLink) |
| 603 | |
| 604 | **************************************************************************/ |
| 605 | |
| 606 | /* Hardware to Embedded CPU Interrupts - first 32-bit register set */ |
| 607 | |
| 608 | /* |
Luciano Coelho | 0078213 | 2011-11-29 13:38:37 +0200 | [diff] [blame] | 609 | * The host sets this bit to inform the Wlan |
| 610 | * FW that a TX packet is in the XFER |
| 611 | * Buffer #0. |
| 612 | */ |
| 613 | #define INTR_TRIG_TX_PROC0 BIT(2) |
| 614 | |
| 615 | /* |
| 616 | * The host sets this bit to inform the FW |
| 617 | * that it read a packet from RX XFER |
| 618 | * Buffer #0. |
| 619 | */ |
| 620 | #define INTR_TRIG_RX_PROC0 BIT(3) |
| 621 | |
| 622 | #define INTR_TRIG_DEBUG_ACK BIT(4) |
| 623 | |
| 624 | #define INTR_TRIG_STATE_CHANGED BIT(5) |
| 625 | |
| 626 | /* Hardware to Embedded CPU Interrupts - second 32-bit register set */ |
| 627 | |
| 628 | /* |
| 629 | * The host sets this bit to inform the FW |
| 630 | * that it read a packet from RX XFER |
| 631 | * Buffer #1. |
| 632 | */ |
| 633 | #define INTR_TRIG_RX_PROC1 BIT(17) |
| 634 | |
| 635 | /* |
| 636 | * The host sets this bit to inform the Wlan |
| 637 | * hardware that a TX packet is in the XFER |
| 638 | * Buffer #1. |
| 639 | */ |
| 640 | #define INTR_TRIG_TX_PROC1 BIT(18) |
| 641 | |
| 642 | #define ACX_SLV_SOFT_RESET_BIT BIT(1) |
| 643 | #define SOFT_RESET_MAX_TIME 1000000 |
| 644 | #define SOFT_RESET_STALL_TIME 1000 |
| 645 | |
| 646 | #define ECPU_CONTROL_HALT 0x00000101 |
Luciano Coelho | b2ba99f | 2011-11-20 23:32:10 +0200 | [diff] [blame] | 647 | |
Luciano Coelho | 6f7dd16 | 2011-11-29 16:27:31 +0200 | [diff] [blame] | 648 | #define WELP_ARM_COMMAND_VAL 0x4 |
| 649 | |
Luciano Coelho | b2ba99f | 2011-11-20 23:32:10 +0200 | [diff] [blame] | 650 | #endif /* __WLCORE_H__ */ |