Luciano Coelho | 274c66c | 2012-05-10 12:13:13 +0300 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of wl18xx |
| 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 __WL18XX_PRIV_H__ |
| 23 | #define __WL18XX_PRIV_H__ |
| 24 | |
Luciano Coelho | 23ee9bf | 2012-05-10 12:13:29 +0300 | [diff] [blame] | 25 | #include "conf.h" |
Luciano Coelho | 274c66c | 2012-05-10 12:13:13 +0300 | [diff] [blame] | 26 | |
Arik Nemtsov | 4a1ccce | 2012-06-25 17:46:40 +0300 | [diff] [blame] | 27 | /* minimum FW required for driver */ |
| 28 | #define WL18XX_CHIP_VER 8 |
Eliad Peller | 750e9d1 | 2014-12-29 08:24:07 +0200 | [diff] [blame] | 29 | #define WL18XX_IFTYPE_VER 9 |
Luciano Coelho | 2f24456 | 2012-11-27 15:52:01 +0200 | [diff] [blame] | 30 | #define WL18XX_MAJOR_VER WLCORE_FW_VER_IGNORE |
| 31 | #define WL18XX_SUBTYPE_VER WLCORE_FW_VER_IGNORE |
Eliad Peller | 750e9d1 | 2014-12-29 08:24:07 +0200 | [diff] [blame] | 32 | #define WL18XX_MINOR_VER 11 |
Arik Nemtsov | 4a1ccce | 2012-06-25 17:46:40 +0300 | [diff] [blame] | 33 | |
Luciano Coelho | 274c66c | 2012-05-10 12:13:13 +0300 | [diff] [blame] | 34 | #define WL18XX_CMD_MAX_SIZE 740 |
| 35 | |
Igal Chernobelsky | 26a309c | 2012-07-29 18:21:12 +0300 | [diff] [blame] | 36 | #define WL18XX_AGGR_BUFFER_SIZE (13 * PAGE_SIZE) |
| 37 | |
Igal Chernobelsky | f1c434d | 2012-07-31 14:48:46 +0300 | [diff] [blame] | 38 | #define WL18XX_NUM_TX_DESCRIPTORS 32 |
| 39 | #define WL18XX_NUM_RX_DESCRIPTORS 32 |
| 40 | |
Arik Nemtsov | 1631020 | 2014-07-11 03:01:37 +0300 | [diff] [blame] | 41 | #define WL18XX_NUM_MAC_ADDRESSES 2 |
Arik Nemtsov | f4afbed | 2012-08-02 20:37:21 +0300 | [diff] [blame] | 42 | |
Eliad Peller | 028e724 | 2014-02-10 13:47:25 +0200 | [diff] [blame] | 43 | #define WL18XX_RX_BA_MAX_SESSIONS 13 |
Igal Chernobelsky | d21553f | 2013-03-12 17:19:35 +0200 | [diff] [blame] | 44 | |
Eliad Peller | 028e724 | 2014-02-10 13:47:25 +0200 | [diff] [blame] | 45 | #define WL18XX_MAX_AP_STATIONS 10 |
| 46 | #define WL18XX_MAX_LINKS 16 |
Eliad Peller | da08fdf | 2014-02-10 13:47:22 +0200 | [diff] [blame] | 47 | |
Luciano Coelho | 274c66c | 2012-05-10 12:13:13 +0300 | [diff] [blame] | 48 | struct wl18xx_priv { |
| 49 | /* buffer for sending commands to FW */ |
| 50 | u8 cmd_buf[WL18XX_CMD_MAX_SIZE]; |
Arik Nemtsov | 872b345 | 2012-05-10 12:13:25 +0300 | [diff] [blame] | 51 | |
Luciano Coelho | 23ee9bf | 2012-05-10 12:13:29 +0300 | [diff] [blame] | 52 | struct wl18xx_priv_conf conf; |
| 53 | |
Arik Nemtsov | 872b345 | 2012-05-10 12:13:25 +0300 | [diff] [blame] | 54 | /* Index of last released Tx desc in FW */ |
| 55 | u8 last_fw_rls_idx; |
Luciano Coelho | a9c130d | 2012-05-10 12:13:37 +0300 | [diff] [blame] | 56 | |
Arik Nemtsov | 2fd8a3b | 2012-11-28 11:42:48 +0200 | [diff] [blame] | 57 | /* number of keys requiring extra spare mem-blocks */ |
| 58 | int extra_spare_key_count; |
Luciano Coelho | 274c66c | 2012-05-10 12:13:13 +0300 | [diff] [blame] | 59 | }; |
| 60 | |
Arik Nemtsov | 1fab39d | 2012-05-10 12:13:21 +0300 | [diff] [blame] | 61 | #define WL18XX_FW_MAX_TX_STATUS_DESC 33 |
| 62 | |
| 63 | struct wl18xx_fw_status_priv { |
| 64 | /* |
| 65 | * Index in released_tx_desc for first byte that holds |
| 66 | * released tx host desc |
| 67 | */ |
| 68 | u8 fw_release_idx; |
| 69 | |
| 70 | /* |
| 71 | * Array of host Tx descriptors, where fw_release_idx |
| 72 | * indicated the first released idx. |
| 73 | */ |
| 74 | u8 released_tx_desc[WL18XX_FW_MAX_TX_STATUS_DESC]; |
| 75 | |
Arik Nemtsov | f1626fd | 2012-11-28 11:42:40 +0200 | [diff] [blame] | 76 | /* A bitmap representing the currently suspended links. The suspend |
| 77 | * is short lived, for multi-channel Tx requirements. |
| 78 | */ |
| 79 | __le32 link_suspend_bitmap; |
| 80 | |
| 81 | /* packet threshold for an "almost empty" AC, |
| 82 | * for Tx schedulng purposes |
| 83 | */ |
| 84 | u8 tx_ac_threshold; |
| 85 | |
| 86 | /* number of packets to queue up for a link in PS */ |
| 87 | u8 tx_ps_threshold; |
| 88 | |
| 89 | /* number of packet to queue up for a suspended link */ |
| 90 | u8 tx_suspend_threshold; |
| 91 | |
| 92 | /* Should have less than this number of packets in queue of a slow |
| 93 | * link to qualify as high priority link |
| 94 | */ |
| 95 | u8 tx_slow_link_prio_threshold; |
| 96 | |
| 97 | /* Should have less than this number of packets in queue of a fast |
| 98 | * link to qualify as high priority link |
| 99 | */ |
| 100 | u8 tx_fast_link_prio_threshold; |
| 101 | |
| 102 | /* Should have less than this number of packets in queue of a slow |
| 103 | * link before we stop queuing up packets for it. |
| 104 | */ |
| 105 | u8 tx_slow_stop_threshold; |
| 106 | |
| 107 | /* Should have less than this number of packets in queue of a fast |
| 108 | * link before we stop queuing up packets for it. |
| 109 | */ |
| 110 | u8 tx_fast_stop_threshold; |
| 111 | |
| 112 | u8 padding[3]; |
Arik Nemtsov | 1fab39d | 2012-05-10 12:13:21 +0300 | [diff] [blame] | 113 | }; |
| 114 | |
Eliad Peller | 75fb4df | 2014-02-10 13:47:21 +0200 | [diff] [blame] | 115 | struct wl18xx_fw_packet_counters { |
| 116 | /* Cumulative counter of released packets per AC */ |
| 117 | u8 tx_released_pkts[NUM_TX_QUEUES]; |
| 118 | |
| 119 | /* Cumulative counter of freed packets per HLID */ |
Eliad Peller | da08fdf | 2014-02-10 13:47:22 +0200 | [diff] [blame] | 120 | u8 tx_lnk_free_pkts[WL18XX_MAX_LINKS]; |
Eliad Peller | 75fb4df | 2014-02-10 13:47:21 +0200 | [diff] [blame] | 121 | |
| 122 | /* Cumulative counter of released Voice memory blocks */ |
| 123 | u8 tx_voice_released_blks; |
| 124 | |
| 125 | /* Tx rate of the last transmitted packet */ |
| 126 | u8 tx_last_rate; |
| 127 | |
| 128 | u8 padding[2]; |
| 129 | } __packed; |
| 130 | |
| 131 | /* FW status registers */ |
| 132 | struct wl18xx_fw_status { |
| 133 | __le32 intr; |
| 134 | u8 fw_rx_counter; |
| 135 | u8 drv_rx_counter; |
| 136 | u8 reserved; |
| 137 | u8 tx_results_counter; |
| 138 | __le32 rx_pkt_descs[WL18XX_NUM_RX_DESCRIPTORS]; |
| 139 | |
| 140 | __le32 fw_localtime; |
| 141 | |
| 142 | /* |
| 143 | * A bitmap (where each bit represents a single HLID) |
| 144 | * to indicate if the station is in PS mode. |
| 145 | */ |
| 146 | __le32 link_ps_bitmap; |
| 147 | |
| 148 | /* |
| 149 | * A bitmap (where each bit represents a single HLID) to indicate |
| 150 | * if the station is in Fast mode |
| 151 | */ |
| 152 | __le32 link_fast_bitmap; |
| 153 | |
| 154 | /* Cumulative counter of total released mem blocks since FW-reset */ |
| 155 | __le32 total_released_blks; |
| 156 | |
| 157 | /* Size (in Memory Blocks) of TX pool */ |
| 158 | __le32 tx_total; |
| 159 | |
| 160 | struct wl18xx_fw_packet_counters counters; |
| 161 | |
| 162 | __le32 log_start_addr; |
| 163 | |
| 164 | /* Private status to be used by the lower drivers */ |
| 165 | struct wl18xx_fw_status_priv priv; |
| 166 | } __packed; |
| 167 | |
Luciano Coelho | 283e8c4 | 2012-05-10 12:14:11 +0300 | [diff] [blame] | 168 | #define WL18XX_PHY_VERSION_MAX_LEN 20 |
| 169 | |
| 170 | struct wl18xx_static_data_priv { |
| 171 | char phy_version[WL18XX_PHY_VERSION_MAX_LEN]; |
| 172 | }; |
| 173 | |
Luciano Coelho | be65202 | 2012-05-10 12:13:41 +0300 | [diff] [blame] | 174 | struct wl18xx_clk_cfg { |
| 175 | u32 n; |
| 176 | u32 m; |
| 177 | u32 p; |
| 178 | u32 q; |
| 179 | bool swallow; |
| 180 | }; |
| 181 | |
| 182 | enum { |
| 183 | CLOCK_CONFIG_16_2_M = 1, |
| 184 | CLOCK_CONFIG_16_368_M, |
| 185 | CLOCK_CONFIG_16_8_M, |
| 186 | CLOCK_CONFIG_19_2_M, |
| 187 | CLOCK_CONFIG_26_M, |
| 188 | CLOCK_CONFIG_32_736_M, |
| 189 | CLOCK_CONFIG_33_6_M, |
| 190 | CLOCK_CONFIG_38_468_M, |
| 191 | CLOCK_CONFIG_52_M, |
| 192 | |
| 193 | NUM_CLOCK_CONFIGS, |
| 194 | }; |
| 195 | |
Luciano Coelho | 274c66c | 2012-05-10 12:13:13 +0300 | [diff] [blame] | 196 | #endif /* __WL18XX_PRIV_H__ */ |