| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  * Copyright (c) 2008 Atheros Communications Inc. | 
 | 3 |  * | 
 | 4 |  * Permission to use, copy, modify, and/or distribute this software for any | 
 | 5 |  * purpose with or without fee is hereby granted, provided that the above | 
 | 6 |  * copyright notice and this permission notice appear in all copies. | 
 | 7 |  * | 
 | 8 |  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 
 | 9 |  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 
 | 10 |  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 
 | 11 |  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 
 | 12 |  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 
 | 13 |  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 
 | 14 |  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 
 | 15 |  */ | 
 | 16 |  | 
 | 17 | #ifndef HW_H | 
 | 18 | #define HW_H | 
 | 19 |  | 
 | 20 | #include <linux/if_ether.h> | 
 | 21 | #include <linux/delay.h> | 
 | 22 |  | 
 | 23 | struct ar5416_desc { | 
 | 24 | 	u32 ds_link; | 
 | 25 | 	u32 ds_data; | 
 | 26 | 	u32 ds_ctl0; | 
 | 27 | 	u32 ds_ctl1; | 
 | 28 | 	union { | 
 | 29 | 		struct { | 
 | 30 | 			u32 ctl2; | 
 | 31 | 			u32 ctl3; | 
 | 32 | 			u32 ctl4; | 
 | 33 | 			u32 ctl5; | 
 | 34 | 			u32 ctl6; | 
 | 35 | 			u32 ctl7; | 
 | 36 | 			u32 ctl8; | 
 | 37 | 			u32 ctl9; | 
 | 38 | 			u32 ctl10; | 
 | 39 | 			u32 ctl11; | 
 | 40 | 			u32 status0; | 
 | 41 | 			u32 status1; | 
 | 42 | 			u32 status2; | 
 | 43 | 			u32 status3; | 
 | 44 | 			u32 status4; | 
 | 45 | 			u32 status5; | 
 | 46 | 			u32 status6; | 
 | 47 | 			u32 status7; | 
 | 48 | 			u32 status8; | 
 | 49 | 			u32 status9; | 
 | 50 | 		} tx; | 
 | 51 | 		struct { | 
 | 52 | 			u32 status0; | 
 | 53 | 			u32 status1; | 
 | 54 | 			u32 status2; | 
 | 55 | 			u32 status3; | 
 | 56 | 			u32 status4; | 
 | 57 | 			u32 status5; | 
 | 58 | 			u32 status6; | 
 | 59 | 			u32 status7; | 
 | 60 | 			u32 status8; | 
 | 61 | 		} rx; | 
 | 62 | 	} u; | 
 | 63 | } __packed; | 
 | 64 |  | 
 | 65 | #define AR5416DESC(_ds)         ((struct ar5416_desc *)(_ds)) | 
 | 66 | #define AR5416DESC_CONST(_ds)   ((const struct ar5416_desc *)(_ds)) | 
 | 67 |  | 
 | 68 | #define ds_ctl2     u.tx.ctl2 | 
 | 69 | #define ds_ctl3     u.tx.ctl3 | 
 | 70 | #define ds_ctl4     u.tx.ctl4 | 
 | 71 | #define ds_ctl5     u.tx.ctl5 | 
 | 72 | #define ds_ctl6     u.tx.ctl6 | 
 | 73 | #define ds_ctl7     u.tx.ctl7 | 
 | 74 | #define ds_ctl8     u.tx.ctl8 | 
 | 75 | #define ds_ctl9     u.tx.ctl9 | 
 | 76 | #define ds_ctl10    u.tx.ctl10 | 
 | 77 | #define ds_ctl11    u.tx.ctl11 | 
 | 78 |  | 
 | 79 | #define ds_txstatus0    u.tx.status0 | 
 | 80 | #define ds_txstatus1    u.tx.status1 | 
 | 81 | #define ds_txstatus2    u.tx.status2 | 
 | 82 | #define ds_txstatus3    u.tx.status3 | 
 | 83 | #define ds_txstatus4    u.tx.status4 | 
 | 84 | #define ds_txstatus5    u.tx.status5 | 
 | 85 | #define ds_txstatus6    u.tx.status6 | 
 | 86 | #define ds_txstatus7    u.tx.status7 | 
 | 87 | #define ds_txstatus8    u.tx.status8 | 
 | 88 | #define ds_txstatus9    u.tx.status9 | 
 | 89 |  | 
 | 90 | #define ds_rxstatus0    u.rx.status0 | 
 | 91 | #define ds_rxstatus1    u.rx.status1 | 
 | 92 | #define ds_rxstatus2    u.rx.status2 | 
 | 93 | #define ds_rxstatus3    u.rx.status3 | 
 | 94 | #define ds_rxstatus4    u.rx.status4 | 
 | 95 | #define ds_rxstatus5    u.rx.status5 | 
 | 96 | #define ds_rxstatus6    u.rx.status6 | 
 | 97 | #define ds_rxstatus7    u.rx.status7 | 
 | 98 | #define ds_rxstatus8    u.rx.status8 | 
 | 99 |  | 
 | 100 | #define AR_FrameLen         0x00000fff | 
 | 101 | #define AR_VirtMoreFrag     0x00001000 | 
 | 102 | #define AR_TxCtlRsvd00      0x0000e000 | 
 | 103 | #define AR_XmitPower        0x003f0000 | 
 | 104 | #define AR_XmitPower_S      16 | 
 | 105 | #define AR_RTSEnable        0x00400000 | 
 | 106 | #define AR_VEOL             0x00800000 | 
 | 107 | #define AR_ClrDestMask      0x01000000 | 
 | 108 | #define AR_TxCtlRsvd01      0x1e000000 | 
 | 109 | #define AR_TxIntrReq        0x20000000 | 
 | 110 | #define AR_DestIdxValid     0x40000000 | 
 | 111 | #define AR_CTSEnable        0x80000000 | 
 | 112 |  | 
 | 113 | #define AR_BufLen           0x00000fff | 
 | 114 | #define AR_TxMore           0x00001000 | 
 | 115 | #define AR_DestIdx          0x000fe000 | 
 | 116 | #define AR_DestIdx_S        13 | 
 | 117 | #define AR_FrameType        0x00f00000 | 
 | 118 | #define AR_FrameType_S      20 | 
 | 119 | #define AR_NoAck            0x01000000 | 
 | 120 | #define AR_InsertTS         0x02000000 | 
 | 121 | #define AR_CorruptFCS       0x04000000 | 
 | 122 | #define AR_ExtOnly          0x08000000 | 
 | 123 | #define AR_ExtAndCtl        0x10000000 | 
 | 124 | #define AR_MoreAggr         0x20000000 | 
 | 125 | #define AR_IsAggr           0x40000000 | 
 | 126 |  | 
 | 127 | #define AR_BurstDur         0x00007fff | 
 | 128 | #define AR_BurstDur_S       0 | 
 | 129 | #define AR_DurUpdateEna     0x00008000 | 
 | 130 | #define AR_XmitDataTries0   0x000f0000 | 
 | 131 | #define AR_XmitDataTries0_S 16 | 
 | 132 | #define AR_XmitDataTries1   0x00f00000 | 
 | 133 | #define AR_XmitDataTries1_S 20 | 
 | 134 | #define AR_XmitDataTries2   0x0f000000 | 
 | 135 | #define AR_XmitDataTries2_S 24 | 
 | 136 | #define AR_XmitDataTries3   0xf0000000 | 
 | 137 | #define AR_XmitDataTries3_S 28 | 
 | 138 |  | 
 | 139 | #define AR_XmitRate0        0x000000ff | 
 | 140 | #define AR_XmitRate0_S      0 | 
 | 141 | #define AR_XmitRate1        0x0000ff00 | 
 | 142 | #define AR_XmitRate1_S      8 | 
 | 143 | #define AR_XmitRate2        0x00ff0000 | 
 | 144 | #define AR_XmitRate2_S      16 | 
 | 145 | #define AR_XmitRate3        0xff000000 | 
 | 146 | #define AR_XmitRate3_S      24 | 
 | 147 |  | 
 | 148 | #define AR_PacketDur0       0x00007fff | 
 | 149 | #define AR_PacketDur0_S     0 | 
 | 150 | #define AR_RTSCTSQual0      0x00008000 | 
 | 151 | #define AR_PacketDur1       0x7fff0000 | 
 | 152 | #define AR_PacketDur1_S     16 | 
 | 153 | #define AR_RTSCTSQual1      0x80000000 | 
 | 154 |  | 
 | 155 | #define AR_PacketDur2       0x00007fff | 
 | 156 | #define AR_PacketDur2_S     0 | 
 | 157 | #define AR_RTSCTSQual2      0x00008000 | 
 | 158 | #define AR_PacketDur3       0x7fff0000 | 
 | 159 | #define AR_PacketDur3_S     16 | 
 | 160 | #define AR_RTSCTSQual3      0x80000000 | 
 | 161 |  | 
 | 162 | #define AR_AggrLen          0x0000ffff | 
 | 163 | #define AR_AggrLen_S        0 | 
 | 164 | #define AR_TxCtlRsvd60      0x00030000 | 
 | 165 | #define AR_PadDelim         0x03fc0000 | 
 | 166 | #define AR_PadDelim_S       18 | 
 | 167 | #define AR_EncrType         0x0c000000 | 
 | 168 | #define AR_EncrType_S       26 | 
 | 169 | #define AR_TxCtlRsvd61      0xf0000000 | 
 | 170 |  | 
 | 171 | #define AR_2040_0           0x00000001 | 
 | 172 | #define AR_GI0              0x00000002 | 
 | 173 | #define AR_ChainSel0        0x0000001c | 
 | 174 | #define AR_ChainSel0_S      2 | 
 | 175 | #define AR_2040_1           0x00000020 | 
 | 176 | #define AR_GI1              0x00000040 | 
 | 177 | #define AR_ChainSel1        0x00000380 | 
 | 178 | #define AR_ChainSel1_S      7 | 
 | 179 | #define AR_2040_2           0x00000400 | 
 | 180 | #define AR_GI2              0x00000800 | 
 | 181 | #define AR_ChainSel2        0x00007000 | 
 | 182 | #define AR_ChainSel2_S      12 | 
 | 183 | #define AR_2040_3           0x00008000 | 
 | 184 | #define AR_GI3              0x00010000 | 
 | 185 | #define AR_ChainSel3        0x000e0000 | 
 | 186 | #define AR_ChainSel3_S      17 | 
 | 187 | #define AR_RTSCTSRate       0x0ff00000 | 
 | 188 | #define AR_RTSCTSRate_S     20 | 
 | 189 | #define AR_TxCtlRsvd70      0xf0000000 | 
 | 190 |  | 
 | 191 | #define AR_TxRSSIAnt00      0x000000ff | 
 | 192 | #define AR_TxRSSIAnt00_S    0 | 
 | 193 | #define AR_TxRSSIAnt01      0x0000ff00 | 
 | 194 | #define AR_TxRSSIAnt01_S    8 | 
 | 195 | #define AR_TxRSSIAnt02      0x00ff0000 | 
 | 196 | #define AR_TxRSSIAnt02_S    16 | 
 | 197 | #define AR_TxStatusRsvd00   0x3f000000 | 
 | 198 | #define AR_TxBaStatus       0x40000000 | 
 | 199 | #define AR_TxStatusRsvd01   0x80000000 | 
 | 200 |  | 
 | 201 | #define AR_FrmXmitOK            0x00000001 | 
 | 202 | #define AR_ExcessiveRetries     0x00000002 | 
 | 203 | #define AR_FIFOUnderrun         0x00000004 | 
 | 204 | #define AR_Filtered             0x00000008 | 
 | 205 | #define AR_RTSFailCnt           0x000000f0 | 
 | 206 | #define AR_RTSFailCnt_S         4 | 
 | 207 | #define AR_DataFailCnt          0x00000f00 | 
 | 208 | #define AR_DataFailCnt_S        8 | 
 | 209 | #define AR_VirtRetryCnt         0x0000f000 | 
 | 210 | #define AR_VirtRetryCnt_S       12 | 
 | 211 | #define AR_TxDelimUnderrun      0x00010000 | 
 | 212 | #define AR_TxDataUnderrun       0x00020000 | 
 | 213 | #define AR_DescCfgErr           0x00040000 | 
 | 214 | #define AR_TxTimerExpired       0x00080000 | 
 | 215 | #define AR_TxStatusRsvd10       0xfff00000 | 
 | 216 |  | 
 | 217 | #define AR_SendTimestamp    ds_txstatus2 | 
 | 218 | #define AR_BaBitmapLow      ds_txstatus3 | 
 | 219 | #define AR_BaBitmapHigh     ds_txstatus4 | 
 | 220 |  | 
 | 221 | #define AR_TxRSSIAnt10      0x000000ff | 
 | 222 | #define AR_TxRSSIAnt10_S    0 | 
 | 223 | #define AR_TxRSSIAnt11      0x0000ff00 | 
 | 224 | #define AR_TxRSSIAnt11_S    8 | 
 | 225 | #define AR_TxRSSIAnt12      0x00ff0000 | 
 | 226 | #define AR_TxRSSIAnt12_S    16 | 
 | 227 | #define AR_TxRSSICombined   0xff000000 | 
 | 228 | #define AR_TxRSSICombined_S 24 | 
 | 229 |  | 
 | 230 | #define AR_TxEVM0           ds_txstatus5 | 
 | 231 | #define AR_TxEVM1           ds_txstatus6 | 
 | 232 | #define AR_TxEVM2           ds_txstatus7 | 
 | 233 |  | 
 | 234 | #define AR_TxDone           0x00000001 | 
 | 235 | #define AR_SeqNum           0x00001ffe | 
 | 236 | #define AR_SeqNum_S         1 | 
 | 237 | #define AR_TxStatusRsvd80   0x0001e000 | 
 | 238 | #define AR_TxOpExceeded     0x00020000 | 
 | 239 | #define AR_TxStatusRsvd81   0x001c0000 | 
 | 240 | #define AR_FinalTxIdx       0x00600000 | 
 | 241 | #define AR_FinalTxIdx_S     21 | 
 | 242 | #define AR_TxStatusRsvd82   0x01800000 | 
 | 243 | #define AR_PowerMgmt        0x02000000 | 
 | 244 | #define AR_TxStatusRsvd83   0xfc000000 | 
 | 245 |  | 
 | 246 | #define AR_RxCTLRsvd00  0xffffffff | 
 | 247 |  | 
 | 248 | #define AR_BufLen       0x00000fff | 
 | 249 | #define AR_RxCtlRsvd00  0x00001000 | 
 | 250 | #define AR_RxIntrReq    0x00002000 | 
 | 251 | #define AR_RxCtlRsvd01  0xffffc000 | 
 | 252 |  | 
 | 253 | #define AR_RxRSSIAnt00      0x000000ff | 
 | 254 | #define AR_RxRSSIAnt00_S    0 | 
 | 255 | #define AR_RxRSSIAnt01      0x0000ff00 | 
 | 256 | #define AR_RxRSSIAnt01_S    8 | 
 | 257 | #define AR_RxRSSIAnt02      0x00ff0000 | 
 | 258 | #define AR_RxRSSIAnt02_S    16 | 
 | 259 | #define AR_RxRate           0xff000000 | 
 | 260 | #define AR_RxRate_S         24 | 
 | 261 | #define AR_RxStatusRsvd00   0xff000000 | 
 | 262 |  | 
 | 263 | #define AR_DataLen          0x00000fff | 
 | 264 | #define AR_RxMore           0x00001000 | 
 | 265 | #define AR_NumDelim         0x003fc000 | 
 | 266 | #define AR_NumDelim_S       14 | 
 | 267 | #define AR_RxStatusRsvd10   0xff800000 | 
 | 268 |  | 
 | 269 | #define AR_RcvTimestamp     ds_rxstatus2 | 
 | 270 |  | 
 | 271 | #define AR_GI               0x00000001 | 
 | 272 | #define AR_2040             0x00000002 | 
 | 273 | #define AR_Parallel40       0x00000004 | 
 | 274 | #define AR_Parallel40_S     2 | 
 | 275 | #define AR_RxStatusRsvd30   0x000000f8 | 
 | 276 | #define AR_RxAntenna	    0xffffff00 | 
 | 277 | #define AR_RxAntenna_S	    8 | 
 | 278 |  | 
 | 279 | #define AR_RxRSSIAnt10            0x000000ff | 
 | 280 | #define AR_RxRSSIAnt10_S          0 | 
 | 281 | #define AR_RxRSSIAnt11            0x0000ff00 | 
 | 282 | #define AR_RxRSSIAnt11_S          8 | 
 | 283 | #define AR_RxRSSIAnt12            0x00ff0000 | 
 | 284 | #define AR_RxRSSIAnt12_S          16 | 
 | 285 | #define AR_RxRSSICombined         0xff000000 | 
 | 286 | #define AR_RxRSSICombined_S       24 | 
 | 287 |  | 
 | 288 | #define AR_RxEVM0           ds_rxstatus4 | 
 | 289 | #define AR_RxEVM1           ds_rxstatus5 | 
 | 290 | #define AR_RxEVM2           ds_rxstatus6 | 
 | 291 |  | 
 | 292 | #define AR_RxDone           0x00000001 | 
 | 293 | #define AR_RxFrameOK        0x00000002 | 
 | 294 | #define AR_CRCErr           0x00000004 | 
 | 295 | #define AR_DecryptCRCErr    0x00000008 | 
 | 296 | #define AR_PHYErr           0x00000010 | 
 | 297 | #define AR_MichaelErr       0x00000020 | 
 | 298 | #define AR_PreDelimCRCErr   0x00000040 | 
 | 299 | #define AR_RxStatusRsvd70   0x00000080 | 
 | 300 | #define AR_RxKeyIdxValid    0x00000100 | 
 | 301 | #define AR_KeyIdx           0x0000fe00 | 
 | 302 | #define AR_KeyIdx_S         9 | 
 | 303 | #define AR_PHYErrCode       0x0000ff00 | 
 | 304 | #define AR_PHYErrCode_S     8 | 
 | 305 | #define AR_RxMoreAggr       0x00010000 | 
 | 306 | #define AR_RxAggr           0x00020000 | 
 | 307 | #define AR_PostDelimCRCErr  0x00040000 | 
 | 308 | #define AR_RxStatusRsvd71   0x3ff80000 | 
 | 309 | #define AR_DecryptBusyErr   0x40000000 | 
 | 310 | #define AR_KeyMiss          0x80000000 | 
 | 311 |  | 
 | 312 | #define AR5416_MAGIC        0x19641014 | 
 | 313 |  | 
 | 314 | #define RXSTATUS_RATE(ah, ads)  (AR_SREV_5416_V20_OR_LATER(ah) ?	\ | 
 | 315 | 				 MS(ads->ds_rxstatus0, AR_RxRate) :	\ | 
 | 316 | 				 (ads->ds_rxstatus3 >> 2) & 0xFF) | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 317 |  | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 318 | #define set11nTries(_series, _index) \ | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 319 | 	(SM((_series)[_index].Tries, AR_XmitDataTries##_index)) | 
 | 320 |  | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 321 | #define set11nRate(_series, _index) \ | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 322 | 	(SM((_series)[_index].Rate, AR_XmitRate##_index)) | 
 | 323 |  | 
 | 324 | #define set11nPktDurRTSCTS(_series, _index)				\ | 
 | 325 | 	(SM((_series)[_index].PktDuration, AR_PacketDur##_index) |	\ | 
 | 326 | 	((_series)[_index].RateFlags & ATH9K_RATESERIES_RTS_CTS   ?	\ | 
 | 327 | 		AR_RTSCTSQual##_index : 0)) | 
 | 328 |  | 
 | 329 | #define set11nRateFlags(_series, _index)				\ | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 330 | 	(((_series)[_index].RateFlags & ATH9K_RATESERIES_2040 ?		\ | 
 | 331 | 	  AR_2040_##_index : 0)						\ | 
 | 332 | 	 |((_series)[_index].RateFlags & ATH9K_RATESERIES_HALFGI ?	\ | 
 | 333 | 	   AR_GI##_index : 0)						\ | 
 | 334 | 	 |SM((_series)[_index].ChSel, AR_ChainSel##_index)) | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 335 |  | 
 | 336 | #define AR_SREV_9100(ah) ((ah->ah_macVersion) == AR_SREV_VERSION_9100) | 
 | 337 |  | 
 | 338 | #define INIT_CONFIG_STATUS  0x00000000 | 
 | 339 | #define INIT_RSSI_THR       0x00000700 | 
 | 340 | #define INIT_BCON_CNTRL_REG 0x00000000 | 
 | 341 |  | 
 | 342 | #define MIN_TX_FIFO_THRESHOLD   0x1 | 
 | 343 | #define MAX_TX_FIFO_THRESHOLD   ((4096 / 64) - 1) | 
 | 344 | #define INIT_TX_FIFO_THRESHOLD  MIN_TX_FIFO_THRESHOLD | 
 | 345 |  | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 346 | struct ar5416AniState { | 
 | 347 | 	struct ath9k_channel c; | 
 | 348 | 	u8 noiseImmunityLevel; | 
 | 349 | 	u8 spurImmunityLevel; | 
 | 350 | 	u8 firstepLevel; | 
 | 351 | 	u8 ofdmWeakSigDetectOff; | 
 | 352 | 	u8 cckWeakSigThreshold; | 
 | 353 | 	u32 listenTime; | 
 | 354 | 	u32 ofdmTrigHigh; | 
 | 355 | 	u32 ofdmTrigLow; | 
 | 356 | 	int32_t cckTrigHigh; | 
 | 357 | 	int32_t cckTrigLow; | 
 | 358 | 	int32_t rssiThrLow; | 
 | 359 | 	int32_t rssiThrHigh; | 
 | 360 | 	u32 noiseFloor; | 
 | 361 | 	u32 txFrameCount; | 
 | 362 | 	u32 rxFrameCount; | 
 | 363 | 	u32 cycleCount; | 
 | 364 | 	u32 ofdmPhyErrCount; | 
 | 365 | 	u32 cckPhyErrCount; | 
 | 366 | 	u32 ofdmPhyErrBase; | 
 | 367 | 	u32 cckPhyErrBase; | 
 | 368 | 	int16_t pktRssi[2]; | 
 | 369 | 	int16_t ofdmErrRssi[2]; | 
 | 370 | 	int16_t cckErrRssi[2]; | 
 | 371 | }; | 
 | 372 |  | 
 | 373 | #define HAL_PROCESS_ANI     0x00000001 | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 374 | #define DO_ANI(ah) \ | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 375 | 	((AH5416(ah)->ah_procPhyErr & HAL_PROCESS_ANI)) | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 376 |  | 
 | 377 | struct ar5416Stats { | 
 | 378 | 	u32 ast_ani_niup; | 
 | 379 | 	u32 ast_ani_nidown; | 
 | 380 | 	u32 ast_ani_spurup; | 
 | 381 | 	u32 ast_ani_spurdown; | 
 | 382 | 	u32 ast_ani_ofdmon; | 
 | 383 | 	u32 ast_ani_ofdmoff; | 
 | 384 | 	u32 ast_ani_cckhigh; | 
 | 385 | 	u32 ast_ani_ccklow; | 
 | 386 | 	u32 ast_ani_stepup; | 
 | 387 | 	u32 ast_ani_stepdown; | 
 | 388 | 	u32 ast_ani_ofdmerrs; | 
 | 389 | 	u32 ast_ani_cckerrs; | 
 | 390 | 	u32 ast_ani_reset; | 
 | 391 | 	u32 ast_ani_lzero; | 
 | 392 | 	u32 ast_ani_lneg; | 
 | 393 | 	struct ath9k_mib_stats ast_mibstats; | 
 | 394 | 	struct ath9k_node_stats ast_nodestats; | 
 | 395 | }; | 
 | 396 |  | 
 | 397 | #define AR5416_OPFLAGS_11A           0x01 | 
 | 398 | #define AR5416_OPFLAGS_11G           0x02 | 
 | 399 | #define AR5416_OPFLAGS_N_5G_HT40     0x04 | 
 | 400 | #define AR5416_OPFLAGS_N_2G_HT40     0x08 | 
 | 401 | #define AR5416_OPFLAGS_N_5G_HT20     0x10 | 
 | 402 | #define AR5416_OPFLAGS_N_2G_HT20     0x20 | 
 | 403 |  | 
 | 404 | #define EEP_RFSILENT_ENABLED        0x0001 | 
 | 405 | #define EEP_RFSILENT_ENABLED_S      0 | 
 | 406 | #define EEP_RFSILENT_POLARITY       0x0002 | 
 | 407 | #define EEP_RFSILENT_POLARITY_S     1 | 
 | 408 | #define EEP_RFSILENT_GPIO_SEL       0x001c | 
 | 409 | #define EEP_RFSILENT_GPIO_SEL_S     2 | 
 | 410 |  | 
 | 411 | #define AR5416_EEP_NO_BACK_VER       0x1 | 
 | 412 | #define AR5416_EEP_VER               0xE | 
 | 413 | #define AR5416_EEP_VER_MINOR_MASK    0x0FFF | 
 | 414 | #define AR5416_EEP_MINOR_VER_2       0x2 | 
 | 415 | #define AR5416_EEP_MINOR_VER_3       0x3 | 
 | 416 | #define AR5416_EEP_MINOR_VER_7       0x7 | 
 | 417 | #define AR5416_EEP_MINOR_VER_9       0x9 | 
| Senthil Balasubramanian | 9f80420 | 2008-11-13 17:58:41 +0530 | [diff] [blame] | 418 | #define AR5416_EEP_MINOR_VER_16      0x10 | 
 | 419 | #define AR5416_EEP_MINOR_VER_17      0x11 | 
 | 420 | #define AR5416_EEP_MINOR_VER_19      0x13 | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 421 |  | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 422 | #define AR5416_NUM_5G_CAL_PIERS         8 | 
 | 423 | #define AR5416_NUM_2G_CAL_PIERS         4 | 
 | 424 | #define AR5416_NUM_5G_20_TARGET_POWERS  8 | 
 | 425 | #define AR5416_NUM_5G_40_TARGET_POWERS  8 | 
 | 426 | #define AR5416_NUM_2G_CCK_TARGET_POWERS 3 | 
 | 427 | #define AR5416_NUM_2G_20_TARGET_POWERS  4 | 
 | 428 | #define AR5416_NUM_2G_40_TARGET_POWERS  4 | 
 | 429 | #define AR5416_NUM_CTLS                 24 | 
 | 430 | #define AR5416_NUM_BAND_EDGES           8 | 
 | 431 | #define AR5416_NUM_PD_GAINS             4 | 
 | 432 | #define AR5416_PD_GAINS_IN_MASK         4 | 
 | 433 | #define AR5416_PD_GAIN_ICEPTS           5 | 
 | 434 | #define AR5416_EEPROM_MODAL_SPURS       5 | 
 | 435 | #define AR5416_MAX_RATE_POWER           63 | 
 | 436 | #define AR5416_NUM_PDADC_VALUES         128 | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 437 | #define AR5416_BCHAN_UNUSED             0xFF | 
 | 438 | #define AR5416_MAX_PWR_RANGE_IN_HALF_DB 64 | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 439 | #define AR5416_MAX_CHAINS               3 | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 440 | #define AR5416_PWR_TABLE_OFFSET         -5 | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 441 |  | 
| Senthil Balasubramanian | 9f80420 | 2008-11-13 17:58:41 +0530 | [diff] [blame] | 442 | /* Rx gain type values */ | 
 | 443 | #define AR5416_EEP_RXGAIN_23DB_BACKOFF     0 | 
 | 444 | #define AR5416_EEP_RXGAIN_13DB_BACKOFF     1 | 
 | 445 | #define AR5416_EEP_RXGAIN_ORIG             2 | 
 | 446 |  | 
 | 447 | /* Tx gain type values */ | 
 | 448 | #define AR5416_EEP_TXGAIN_ORIGINAL         0 | 
 | 449 | #define AR5416_EEP_TXGAIN_HIGH_POWER       1 | 
 | 450 |  | 
 | 451 |  | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 452 | enum eeprom_param { | 
 | 453 | 	EEP_NFTHRESH_5, | 
 | 454 | 	EEP_NFTHRESH_2, | 
 | 455 | 	EEP_MAC_MSW, | 
 | 456 | 	EEP_MAC_MID, | 
 | 457 | 	EEP_MAC_LSW, | 
 | 458 | 	EEP_REG_0, | 
 | 459 | 	EEP_REG_1, | 
 | 460 | 	EEP_OP_CAP, | 
 | 461 | 	EEP_OP_MODE, | 
 | 462 | 	EEP_RF_SILENT, | 
 | 463 | 	EEP_OB_5, | 
 | 464 | 	EEP_DB_5, | 
 | 465 | 	EEP_OB_2, | 
 | 466 | 	EEP_DB_2, | 
 | 467 | 	EEP_MINOR_REV, | 
 | 468 | 	EEP_TX_MASK, | 
 | 469 | 	EEP_RX_MASK, | 
| Senthil Balasubramanian | 9f80420 | 2008-11-13 17:58:41 +0530 | [diff] [blame] | 470 | 	EEP_RXGAIN_TYPE, | 
 | 471 | 	EEP_TXGAIN_TYPE, | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 472 | }; | 
 | 473 |  | 
 | 474 | enum ar5416_rates { | 
 | 475 | 	rate6mb, rate9mb, rate12mb, rate18mb, | 
 | 476 | 	rate24mb, rate36mb, rate48mb, rate54mb, | 
 | 477 | 	rate1l, rate2l, rate2s, rate5_5l, | 
 | 478 | 	rate5_5s, rate11l, rate11s, rateXr, | 
 | 479 | 	rateHt20_0, rateHt20_1, rateHt20_2, rateHt20_3, | 
 | 480 | 	rateHt20_4, rateHt20_5, rateHt20_6, rateHt20_7, | 
 | 481 | 	rateHt40_0, rateHt40_1, rateHt40_2, rateHt40_3, | 
 | 482 | 	rateHt40_4, rateHt40_5, rateHt40_6, rateHt40_7, | 
 | 483 | 	rateDupCck, rateDupOfdm, rateExtCck, rateExtOfdm, | 
 | 484 | 	Ar5416RateSize | 
 | 485 | }; | 
 | 486 |  | 
 | 487 | struct base_eep_header { | 
 | 488 | 	u16 length; | 
 | 489 | 	u16 checksum; | 
 | 490 | 	u16 version; | 
 | 491 | 	u8 opCapFlags; | 
 | 492 | 	u8 eepMisc; | 
 | 493 | 	u16 regDmn[2]; | 
 | 494 | 	u8 macAddr[6]; | 
 | 495 | 	u8 rxMask; | 
 | 496 | 	u8 txMask; | 
 | 497 | 	u16 rfSilent; | 
 | 498 | 	u16 blueToothOptions; | 
 | 499 | 	u16 deviceCap; | 
 | 500 | 	u32 binBuildNumber; | 
 | 501 | 	u8 deviceType; | 
 | 502 | 	u8 pwdclkind; | 
| Senthil Balasubramanian | 9f80420 | 2008-11-13 17:58:41 +0530 | [diff] [blame] | 503 | 	u8 futureBase_1[2]; | 
 | 504 | 	u8 rxGainType; | 
 | 505 | 	u8 futureBase_2[3]; | 
 | 506 | 	u8 txGainType; | 
 | 507 | 	u8 futureBase_3[25]; | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 508 | } __packed; | 
 | 509 |  | 
 | 510 | struct spur_chan { | 
 | 511 | 	u16 spurChan; | 
 | 512 | 	u8 spurRangeLow; | 
 | 513 | 	u8 spurRangeHigh; | 
 | 514 | } __packed; | 
 | 515 |  | 
 | 516 | struct modal_eep_header { | 
 | 517 | 	u32 antCtrlChain[AR5416_MAX_CHAINS]; | 
 | 518 | 	u32 antCtrlCommon; | 
 | 519 | 	u8 antennaGainCh[AR5416_MAX_CHAINS]; | 
 | 520 | 	u8 switchSettling; | 
 | 521 | 	u8 txRxAttenCh[AR5416_MAX_CHAINS]; | 
 | 522 | 	u8 rxTxMarginCh[AR5416_MAX_CHAINS]; | 
 | 523 | 	u8 adcDesiredSize; | 
 | 524 | 	u8 pgaDesiredSize; | 
 | 525 | 	u8 xlnaGainCh[AR5416_MAX_CHAINS]; | 
 | 526 | 	u8 txEndToXpaOff; | 
 | 527 | 	u8 txEndToRxOn; | 
 | 528 | 	u8 txFrameToXpaOn; | 
 | 529 | 	u8 thresh62; | 
 | 530 | 	u8 noiseFloorThreshCh[AR5416_MAX_CHAINS]; | 
 | 531 | 	u8 xpdGain; | 
 | 532 | 	u8 xpd; | 
 | 533 | 	u8 iqCalICh[AR5416_MAX_CHAINS]; | 
 | 534 | 	u8 iqCalQCh[AR5416_MAX_CHAINS]; | 
 | 535 | 	u8 pdGainOverlap; | 
 | 536 | 	u8 ob; | 
 | 537 | 	u8 db; | 
 | 538 | 	u8 xpaBiasLvl; | 
 | 539 | 	u8 pwrDecreaseFor2Chain; | 
 | 540 | 	u8 pwrDecreaseFor3Chain; | 
 | 541 | 	u8 txFrameToDataStart; | 
 | 542 | 	u8 txFrameToPaOn; | 
 | 543 | 	u8 ht40PowerIncForPdadc; | 
 | 544 | 	u8 bswAtten[AR5416_MAX_CHAINS]; | 
 | 545 | 	u8 bswMargin[AR5416_MAX_CHAINS]; | 
 | 546 | 	u8 swSettleHt40; | 
 | 547 | 	u8 xatten2Db[AR5416_MAX_CHAINS]; | 
 | 548 | 	u8 xatten2Margin[AR5416_MAX_CHAINS]; | 
 | 549 | 	u8 ob_ch1; | 
 | 550 | 	u8 db_ch1; | 
 | 551 | 	u8 useAnt1:1, | 
 | 552 | 	    force_xpaon:1, | 
 | 553 | 	    local_bias:1, | 
 | 554 | 	    femBandSelectUsed:1, xlnabufin:1, xlnaisel:2, xlnabufmode:1; | 
 | 555 | 	u8 futureModalar9280; | 
 | 556 | 	u16 xpaBiasLvlFreq[3]; | 
 | 557 | 	u8 futureModal[6]; | 
 | 558 |  | 
 | 559 | 	struct spur_chan spurChans[AR5416_EEPROM_MODAL_SPURS]; | 
 | 560 | } __packed; | 
 | 561 |  | 
 | 562 | struct cal_data_per_freq { | 
 | 563 | 	u8 pwrPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; | 
 | 564 | 	u8 vpdPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS]; | 
 | 565 | } __packed; | 
 | 566 |  | 
 | 567 | struct cal_target_power_leg { | 
 | 568 | 	u8 bChannel; | 
 | 569 | 	u8 tPow2x[4]; | 
 | 570 | } __packed; | 
 | 571 |  | 
 | 572 | struct cal_target_power_ht { | 
 | 573 | 	u8 bChannel; | 
 | 574 | 	u8 tPow2x[8]; | 
 | 575 | } __packed; | 
 | 576 |  | 
 | 577 | #ifdef __BIG_ENDIAN_BITFIELD | 
 | 578 | struct cal_ctl_edges { | 
 | 579 | 	u8 bChannel; | 
 | 580 | 	u8 flag:2, tPower:6; | 
 | 581 | } __packed; | 
 | 582 | #else | 
 | 583 | struct cal_ctl_edges { | 
 | 584 | 	u8 bChannel; | 
 | 585 | 	u8 tPower:6, flag:2; | 
 | 586 | } __packed; | 
 | 587 | #endif | 
 | 588 |  | 
 | 589 | struct cal_ctl_data { | 
 | 590 | 	struct cal_ctl_edges | 
 | 591 | 	 ctlEdges[AR5416_MAX_CHAINS][AR5416_NUM_BAND_EDGES]; | 
 | 592 | } __packed; | 
 | 593 |  | 
 | 594 | struct ar5416_eeprom { | 
 | 595 | 	struct base_eep_header baseEepHeader; | 
 | 596 | 	u8 custData[64]; | 
 | 597 | 	struct modal_eep_header modalHeader[2]; | 
 | 598 | 	u8 calFreqPier5G[AR5416_NUM_5G_CAL_PIERS]; | 
 | 599 | 	u8 calFreqPier2G[AR5416_NUM_2G_CAL_PIERS]; | 
 | 600 | 	struct cal_data_per_freq | 
 | 601 | 	 calPierData5G[AR5416_MAX_CHAINS][AR5416_NUM_5G_CAL_PIERS]; | 
 | 602 | 	struct cal_data_per_freq | 
 | 603 | 	 calPierData2G[AR5416_MAX_CHAINS][AR5416_NUM_2G_CAL_PIERS]; | 
 | 604 | 	struct cal_target_power_leg | 
 | 605 | 	 calTargetPower5G[AR5416_NUM_5G_20_TARGET_POWERS]; | 
 | 606 | 	struct cal_target_power_ht | 
 | 607 | 	 calTargetPower5GHT20[AR5416_NUM_5G_20_TARGET_POWERS]; | 
 | 608 | 	struct cal_target_power_ht | 
 | 609 | 	 calTargetPower5GHT40[AR5416_NUM_5G_40_TARGET_POWERS]; | 
 | 610 | 	struct cal_target_power_leg | 
 | 611 | 	 calTargetPowerCck[AR5416_NUM_2G_CCK_TARGET_POWERS]; | 
 | 612 | 	struct cal_target_power_leg | 
 | 613 | 	 calTargetPower2G[AR5416_NUM_2G_20_TARGET_POWERS]; | 
 | 614 | 	struct cal_target_power_ht | 
 | 615 | 	 calTargetPower2GHT20[AR5416_NUM_2G_20_TARGET_POWERS]; | 
 | 616 | 	struct cal_target_power_ht | 
 | 617 | 	 calTargetPower2GHT40[AR5416_NUM_2G_40_TARGET_POWERS]; | 
 | 618 | 	u8 ctlIndex[AR5416_NUM_CTLS]; | 
 | 619 | 	struct cal_ctl_data ctlData[AR5416_NUM_CTLS]; | 
 | 620 | 	u8 padding; | 
 | 621 | } __packed; | 
 | 622 |  | 
 | 623 | struct ar5416IniArray { | 
 | 624 | 	u32 *ia_array; | 
 | 625 | 	u32 ia_rows; | 
 | 626 | 	u32 ia_columns; | 
 | 627 | }; | 
 | 628 |  | 
 | 629 | #define INIT_INI_ARRAY(iniarray, array, rows, columns) do {	\ | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 630 | 		(iniarray)->ia_array = (u32 *)(array);		\ | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 631 | 		(iniarray)->ia_rows = (rows);			\ | 
 | 632 | 		(iniarray)->ia_columns = (columns);		\ | 
 | 633 | 	} while (0) | 
 | 634 |  | 
 | 635 | #define INI_RA(iniarray, row, column) \ | 
 | 636 | 	(((iniarray)->ia_array)[(row) *	((iniarray)->ia_columns) + (column)]) | 
 | 637 |  | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 638 | #define INIT_CAL(_perCal) do {				\ | 
 | 639 | 		(_perCal)->calState = CAL_WAITING;	\ | 
 | 640 | 		(_perCal)->calNext = NULL;		\ | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 641 | 	} while (0) | 
 | 642 |  | 
 | 643 | #define INSERT_CAL(_ahp, _perCal)					\ | 
 | 644 | 	do {								\ | 
 | 645 | 		if ((_ahp)->ah_cal_list_last == NULL) {			\ | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 646 | 			(_ahp)->ah_cal_list =				\ | 
 | 647 | 				(_ahp)->ah_cal_list_last = (_perCal);	\ | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 648 | 			((_ahp)->ah_cal_list_last)->calNext = (_perCal); \ | 
 | 649 | 		} else {						\ | 
 | 650 | 			((_ahp)->ah_cal_list_last)->calNext = (_perCal); \ | 
 | 651 | 			(_ahp)->ah_cal_list_last = (_perCal);		\ | 
 | 652 | 			(_perCal)->calNext = (_ahp)->ah_cal_list;	\ | 
 | 653 | 		}							\ | 
 | 654 | 	} while (0) | 
 | 655 |  | 
 | 656 | enum hal_cal_types { | 
 | 657 | 	ADC_DC_INIT_CAL = 0x1, | 
 | 658 | 	ADC_GAIN_CAL = 0x2, | 
 | 659 | 	ADC_DC_CAL = 0x4, | 
 | 660 | 	IQ_MISMATCH_CAL = 0x8 | 
 | 661 | }; | 
 | 662 |  | 
 | 663 | enum hal_cal_state { | 
 | 664 | 	CAL_INACTIVE, | 
 | 665 | 	CAL_WAITING, | 
 | 666 | 	CAL_RUNNING, | 
 | 667 | 	CAL_DONE | 
 | 668 | }; | 
 | 669 |  | 
 | 670 | #define MIN_CAL_SAMPLES     1 | 
 | 671 | #define MAX_CAL_SAMPLES    64 | 
 | 672 | #define INIT_LOG_COUNT      5 | 
 | 673 | #define PER_MIN_LOG_COUNT   2 | 
 | 674 | #define PER_MAX_LOG_COUNT  10 | 
 | 675 |  | 
 | 676 | struct hal_percal_data { | 
 | 677 | 	enum hal_cal_types calType; | 
 | 678 | 	u32 calNumSamples; | 
 | 679 | 	u32 calCountMax; | 
 | 680 | 	void (*calCollect) (struct ath_hal *); | 
 | 681 | 	void (*calPostProc) (struct ath_hal *, u8); | 
 | 682 | }; | 
 | 683 |  | 
 | 684 | struct hal_cal_list { | 
 | 685 | 	const struct hal_percal_data *calData; | 
 | 686 | 	enum hal_cal_state calState; | 
 | 687 | 	struct hal_cal_list *calNext; | 
 | 688 | }; | 
 | 689 |  | 
 | 690 | struct ath_hal_5416 { | 
 | 691 | 	struct ath_hal ah; | 
 | 692 | 	struct ar5416_eeprom ah_eeprom; | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 693 | 	struct ar5416Stats ah_stats; | 
 | 694 | 	struct ath9k_tx_queue_info ah_txq[ATH9K_NUM_TX_QUEUES]; | 
 | 695 | 	void __iomem *ah_cal_mem; | 
 | 696 |  | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 697 | 	u8 ah_macaddr[ETH_ALEN]; | 
 | 698 | 	u8 ah_bssid[ETH_ALEN]; | 
 | 699 | 	u8 ah_bssidmask[ETH_ALEN]; | 
 | 700 | 	u16 ah_assocId; | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 701 |  | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 702 | 	int16_t ah_curchanRadIndex; | 
 | 703 | 	u32 ah_maskReg; | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 704 | 	u32 ah_txOkInterruptMask; | 
 | 705 | 	u32 ah_txErrInterruptMask; | 
 | 706 | 	u32 ah_txDescInterruptMask; | 
 | 707 | 	u32 ah_txEolInterruptMask; | 
 | 708 | 	u32 ah_txUrnInterruptMask; | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 709 | 	bool ah_chipFullSleep; | 
 | 710 | 	u32 ah_atimWindow; | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 711 | 	u16 ah_antennaSwitchSwap; | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 712 | 	enum ath9k_power_mode ah_powerMode; | 
 | 713 | 	enum ath9k_ant_setting ah_diversityControl; | 
 | 714 |  | 
 | 715 | 	/* Calibration */ | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 716 | 	enum hal_cal_types ah_suppCals; | 
 | 717 | 	struct hal_cal_list ah_iqCalData; | 
 | 718 | 	struct hal_cal_list ah_adcGainCalData; | 
 | 719 | 	struct hal_cal_list ah_adcDcCalInitData; | 
 | 720 | 	struct hal_cal_list ah_adcDcCalData; | 
 | 721 | 	struct hal_cal_list *ah_cal_list; | 
 | 722 | 	struct hal_cal_list *ah_cal_list_last; | 
 | 723 | 	struct hal_cal_list *ah_cal_list_curr; | 
 | 724 | #define ah_totalPowerMeasI ah_Meas0.unsign | 
 | 725 | #define ah_totalPowerMeasQ ah_Meas1.unsign | 
 | 726 | #define ah_totalIqCorrMeas ah_Meas2.sign | 
 | 727 | #define ah_totalAdcIOddPhase  ah_Meas0.unsign | 
 | 728 | #define ah_totalAdcIEvenPhase ah_Meas1.unsign | 
 | 729 | #define ah_totalAdcQOddPhase  ah_Meas2.unsign | 
 | 730 | #define ah_totalAdcQEvenPhase ah_Meas3.unsign | 
 | 731 | #define ah_totalAdcDcOffsetIOddPhase  ah_Meas0.sign | 
 | 732 | #define ah_totalAdcDcOffsetIEvenPhase ah_Meas1.sign | 
 | 733 | #define ah_totalAdcDcOffsetQOddPhase  ah_Meas2.sign | 
 | 734 | #define ah_totalAdcDcOffsetQEvenPhase ah_Meas3.sign | 
 | 735 | 	union { | 
 | 736 | 		u32 unsign[AR5416_MAX_CHAINS]; | 
 | 737 | 		int32_t sign[AR5416_MAX_CHAINS]; | 
 | 738 | 	} ah_Meas0; | 
 | 739 | 	union { | 
 | 740 | 		u32 unsign[AR5416_MAX_CHAINS]; | 
 | 741 | 		int32_t sign[AR5416_MAX_CHAINS]; | 
 | 742 | 	} ah_Meas1; | 
 | 743 | 	union { | 
 | 744 | 		u32 unsign[AR5416_MAX_CHAINS]; | 
 | 745 | 		int32_t sign[AR5416_MAX_CHAINS]; | 
 | 746 | 	} ah_Meas2; | 
 | 747 | 	union { | 
 | 748 | 		u32 unsign[AR5416_MAX_CHAINS]; | 
 | 749 | 		int32_t sign[AR5416_MAX_CHAINS]; | 
 | 750 | 	} ah_Meas3; | 
 | 751 | 	u16 ah_CalSamples; | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 752 |  | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 753 | 	u32 ah_staId1Defaults; | 
 | 754 | 	u32 ah_miscMode; | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 755 | 	enum { | 
 | 756 | 		AUTO_32KHZ, | 
 | 757 | 		USE_32KHZ, | 
 | 758 | 		DONT_USE_32KHZ, | 
 | 759 | 	} ah_enable32kHzClock; | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 760 |  | 
 | 761 | 	/* RF */ | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 762 | 	u32 *ah_analogBank0Data; | 
 | 763 | 	u32 *ah_analogBank1Data; | 
 | 764 | 	u32 *ah_analogBank2Data; | 
 | 765 | 	u32 *ah_analogBank3Data; | 
 | 766 | 	u32 *ah_analogBank6Data; | 
 | 767 | 	u32 *ah_analogBank6TPCData; | 
 | 768 | 	u32 *ah_analogBank7Data; | 
 | 769 | 	u32 *ah_addac5416_21; | 
 | 770 | 	u32 *ah_bank6Temp; | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 771 |  | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 772 | 	int16_t ah_txPowerIndexOffset; | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 773 | 	u32 ah_beaconInterval; | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 774 | 	u32 ah_slottime; | 
 | 775 | 	u32 ah_acktimeout; | 
 | 776 | 	u32 ah_ctstimeout; | 
 | 777 | 	u32 ah_globaltxtimeout; | 
 | 778 | 	u8 ah_gBeaconRate; | 
 | 779 | 	u32 ah_gpioSelect; | 
 | 780 | 	u32 ah_polarity; | 
 | 781 | 	u32 ah_gpioBit; | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 782 |  | 
 | 783 | 	/* ANI */ | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 784 | 	u32 ah_procPhyErr; | 
 | 785 | 	bool ah_hasHwPhyCounters; | 
 | 786 | 	u32 ah_aniPeriod; | 
 | 787 | 	struct ar5416AniState *ah_curani; | 
 | 788 | 	struct ar5416AniState ah_ani[255]; | 
 | 789 | 	int ah_totalSizeDesired[5]; | 
 | 790 | 	int ah_coarseHigh[5]; | 
 | 791 | 	int ah_coarseLow[5]; | 
 | 792 | 	int ah_firpwr[5]; | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 793 | 	enum ath9k_ani_cmd ah_ani_function; | 
 | 794 |  | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 795 | 	u32 ah_intrTxqs; | 
 | 796 | 	bool ah_intrMitigation; | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 797 | 	enum ath9k_ht_extprotspacing ah_extprotspacing; | 
 | 798 | 	u8 ah_txchainmask; | 
 | 799 | 	u8 ah_rxchainmask; | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 800 |  | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 801 | 	struct ar5416IniArray ah_iniModes; | 
 | 802 | 	struct ar5416IniArray ah_iniCommon; | 
 | 803 | 	struct ar5416IniArray ah_iniBank0; | 
 | 804 | 	struct ar5416IniArray ah_iniBB_RfGain; | 
 | 805 | 	struct ar5416IniArray ah_iniBank1; | 
 | 806 | 	struct ar5416IniArray ah_iniBank2; | 
 | 807 | 	struct ar5416IniArray ah_iniBank3; | 
 | 808 | 	struct ar5416IniArray ah_iniBank6; | 
 | 809 | 	struct ar5416IniArray ah_iniBank6TPC; | 
 | 810 | 	struct ar5416IniArray ah_iniBank7; | 
 | 811 | 	struct ar5416IniArray ah_iniAddac; | 
 | 812 | 	struct ar5416IniArray ah_iniPcieSerdes; | 
 | 813 | 	struct ar5416IniArray ah_iniModesAdditional; | 
| Senthil Balasubramanian | 9f80420 | 2008-11-13 17:58:41 +0530 | [diff] [blame] | 814 | 	struct ar5416IniArray ah_iniModesRxGain; | 
 | 815 | 	struct ar5416IniArray ah_iniModesTxGain; | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 816 | }; | 
 | 817 | #define AH5416(_ah) ((struct ath_hal_5416 *)(_ah)) | 
 | 818 |  | 
 | 819 | #define FREQ2FBIN(x, y) ((y) ? ((x) - 2300) : (((x) - 4800) / 5)) | 
 | 820 |  | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 821 | #define ar5416RfDetach(ah) do {					\ | 
 | 822 | 		if (AH5416(ah)->ah_rfHal.rfDetach != NULL)	\ | 
 | 823 | 			AH5416(ah)->ah_rfHal.rfDetach(ah);	\ | 
 | 824 | 	} while (0) | 
 | 825 |  | 
 | 826 | #define ath9k_hw_use_flash(_ah)			\ | 
 | 827 | 	(!(_ah->ah_flags & AH_USE_EEPROM)) | 
 | 828 |  | 
 | 829 |  | 
 | 830 | #define DO_DELAY(x) do {			\ | 
 | 831 | 		if ((++(x) % 64) == 0)          \ | 
 | 832 | 			udelay(1);		\ | 
 | 833 | 	} while (0) | 
 | 834 |  | 
 | 835 | #define REG_WRITE_ARRAY(iniarray, column, regWr) do {                   \ | 
 | 836 | 		int r;							\ | 
 | 837 | 		for (r = 0; r < ((iniarray)->ia_rows); r++) {		\ | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 838 | 			REG_WRITE(ah, INI_RA((iniarray), (r), 0),	\ | 
 | 839 | 				  INI_RA((iniarray), r, (column)));	\ | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 840 | 			DO_DELAY(regWr);				\ | 
 | 841 | 		}							\ | 
 | 842 | 	} while (0) | 
 | 843 |  | 
 | 844 | #define BASE_ACTIVATE_DELAY         100 | 
 | 845 | #define RTC_PLL_SETTLE_DELAY        1000 | 
 | 846 | #define COEF_SCALE_S                24 | 
 | 847 | #define HT40_CHANNEL_CENTER_SHIFT   10 | 
 | 848 |  | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 849 | #define AR5416_EEPROM_MAGIC_OFFSET  0x0 | 
 | 850 |  | 
 | 851 | #define AR5416_EEPROM_S             2 | 
 | 852 | #define AR5416_EEPROM_OFFSET        0x2000 | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 853 | #define AR5416_EEPROM_START_ADDR \ | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 854 | 	(AR_SREV_9100(ah)) ? 0x1fff1000 : 0x503f1200 | 
 | 855 | #define AR5416_EEPROM_MAX           0xae0 | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 856 | #define ar5416_get_eep_ver(_ahp) \ | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 857 | 	(((_ahp)->ah_eeprom.baseEepHeader.version >> 12) & 0xF) | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 858 | #define ar5416_get_eep_rev(_ahp) \ | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 859 | 	(((_ahp)->ah_eeprom.baseEepHeader.version) & 0xFFF) | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 860 | #define ar5416_get_ntxchains(_txchainmask) \ | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 861 | 	(((_txchainmask >> 2) & 1) + \ | 
 | 862 | 		((_txchainmask >> 1) & 1) + (_txchainmask & 1)) | 
 | 863 |  | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 864 | #ifdef __BIG_ENDIAN | 
 | 865 | #define AR5416_EEPROM_MAGIC 0x5aa5 | 
 | 866 | #else | 
 | 867 | #define AR5416_EEPROM_MAGIC 0xa55a | 
 | 868 | #endif | 
 | 869 |  | 
 | 870 | #define ATH9K_POW_SM(_r, _s)     (((_r) & 0x3f) << (_s)) | 
 | 871 |  | 
 | 872 | #define ATH9K_ANTENNA0_CHAINMASK        0x1 | 
 | 873 | #define ATH9K_ANTENNA1_CHAINMASK        0x2 | 
 | 874 |  | 
 | 875 | #define ATH9K_NUM_DMA_DEBUG_REGS        8 | 
 | 876 | #define ATH9K_NUM_QUEUES                10 | 
 | 877 |  | 
 | 878 | #define HAL_NOISE_IMMUNE_MAX            4 | 
 | 879 | #define HAL_SPUR_IMMUNE_MAX             7 | 
 | 880 | #define HAL_FIRST_STEP_MAX              2 | 
 | 881 |  | 
 | 882 | #define ATH9K_ANI_OFDM_TRIG_HIGH          500 | 
 | 883 | #define ATH9K_ANI_OFDM_TRIG_LOW           200 | 
 | 884 | #define ATH9K_ANI_CCK_TRIG_HIGH           200 | 
 | 885 | #define ATH9K_ANI_CCK_TRIG_LOW            100 | 
 | 886 | #define ATH9K_ANI_NOISE_IMMUNE_LVL        4 | 
 | 887 | #define ATH9K_ANI_USE_OFDM_WEAK_SIG       true | 
 | 888 | #define ATH9K_ANI_CCK_WEAK_SIG_THR        false | 
 | 889 | #define ATH9K_ANI_SPUR_IMMUNE_LVL         7 | 
 | 890 | #define ATH9K_ANI_FIRSTEP_LVL             0 | 
 | 891 | #define ATH9K_ANI_RSSI_THR_HIGH           40 | 
 | 892 | #define ATH9K_ANI_RSSI_THR_LOW            7 | 
 | 893 | #define ATH9K_ANI_PERIOD                  100 | 
 | 894 |  | 
 | 895 | #define AR_GPIOD_MASK                   0x00001FFF | 
 | 896 | #define AR_GPIO_BIT(_gpio)              (1 << (_gpio)) | 
 | 897 |  | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 898 | #define HAL_EP_RND(x, mul) \ | 
 | 899 | 	((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul)) | 
 | 900 | #define BEACON_RSSI(ahp) \ | 
 | 901 | 	HAL_EP_RND(ahp->ah_stats.ast_nodestats.ns_avgbrssi, \ | 
 | 902 | 		ATH9K_RSSI_EP_MULTIPLIER) | 
 | 903 |  | 
 | 904 | #define ah_mibStats     ah_stats.ast_mibstats | 
 | 905 |  | 
 | 906 | #define AH_TIMEOUT         100000 | 
 | 907 | #define AH_TIME_QUANTUM        10 | 
 | 908 |  | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 909 | #define AR_KEYTABLE_SIZE 128 | 
 | 910 | #define POWER_UP_TIME    200000 | 
 | 911 |  | 
 | 912 | #define EXT_ADDITIVE (0x8000) | 
 | 913 | #define CTL_11A_EXT (CTL_11A | EXT_ADDITIVE) | 
 | 914 | #define CTL_11G_EXT (CTL_11G | EXT_ADDITIVE) | 
 | 915 | #define CTL_11B_EXT (CTL_11B | EXT_ADDITIVE) | 
 | 916 |  | 
 | 917 | #define SUB_NUM_CTL_MODES_AT_5G_40 2 | 
 | 918 | #define SUB_NUM_CTL_MODES_AT_2G_40 3 | 
 | 919 | #define SPUR_RSSI_THRESH 40 | 
 | 920 |  | 
 | 921 | #define TU_TO_USEC(_tu)         ((_tu) << 10) | 
 | 922 |  | 
 | 923 | #define CAB_TIMEOUT_VAL         10 | 
 | 924 | #define BEACON_TIMEOUT_VAL      10 | 
 | 925 | #define MIN_BEACON_TIMEOUT_VAL   1 | 
 | 926 | #define SLEEP_SLOP               3 | 
 | 927 |  | 
 | 928 | #define CCK_SIFS_TIME        10 | 
 | 929 | #define CCK_PREAMBLE_BITS   144 | 
 | 930 | #define CCK_PLCP_BITS        48 | 
 | 931 |  | 
 | 932 | #define OFDM_SIFS_TIME        16 | 
 | 933 | #define OFDM_PREAMBLE_TIME    20 | 
 | 934 | #define OFDM_PLCP_BITS        22 | 
 | 935 | #define OFDM_SYMBOL_TIME      4 | 
 | 936 |  | 
 | 937 | #define OFDM_SIFS_TIME_HALF     32 | 
 | 938 | #define OFDM_PREAMBLE_TIME_HALF 40 | 
 | 939 | #define OFDM_PLCP_BITS_HALF     22 | 
 | 940 | #define OFDM_SYMBOL_TIME_HALF   8 | 
 | 941 |  | 
 | 942 | #define OFDM_SIFS_TIME_QUARTER      64 | 
 | 943 | #define OFDM_PREAMBLE_TIME_QUARTER  80 | 
 | 944 | #define OFDM_PLCP_BITS_QUARTER      22 | 
 | 945 | #define OFDM_SYMBOL_TIME_QUARTER    16 | 
 | 946 |  | 
| Sujith | f1dc560 | 2008-10-29 10:16:30 +0530 | [diff] [blame] | 947 | u32 ath9k_hw_get_eeprom(struct ath_hal *ah, | 
| Sujith | 6a2b9e8 | 2008-08-11 14:04:32 +0530 | [diff] [blame] | 948 | 			enum eeprom_param param); | 
| Luis R. Rodriguez | f078f20 | 2008-08-04 00:16:41 -0700 | [diff] [blame] | 949 |  | 
 | 950 | #endif |