iwl-4965-hw.h 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335
  1. /******************************************************************************
  2. *
  3. * This file is provided under a dual BSD/GPLv2 license. When using or
  4. * redistributing this file, you may do so under either license.
  5. *
  6. * GPL LICENSE SUMMARY
  7. *
  8. * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of version 2 of the GNU General Public License as
  12. * published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  22. * USA
  23. *
  24. * The full GNU General Public License is included in this distribution
  25. * in the file called LICENSE.GPL.
  26. *
  27. * Contact Information:
  28. * James P. Ketrenos <ipw2100-admin@linux.intel.com>
  29. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  30. *
  31. * BSD LICENSE
  32. *
  33. * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved.
  34. * All rights reserved.
  35. *
  36. * Redistribution and use in source and binary forms, with or without
  37. * modification, are permitted provided that the following conditions
  38. * are met:
  39. *
  40. * * Redistributions of source code must retain the above copyright
  41. * notice, this list of conditions and the following disclaimer.
  42. * * Redistributions in binary form must reproduce the above copyright
  43. * notice, this list of conditions and the following disclaimer in
  44. * the documentation and/or other materials provided with the
  45. * distribution.
  46. * * Neither the name Intel Corporation nor the names of its
  47. * contributors may be used to endorse or promote products derived
  48. * from this software without specific prior written permission.
  49. *
  50. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  51. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  52. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  53. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  54. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  55. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  56. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  57. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  58. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  59. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  60. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  61. *
  62. *****************************************************************************/
  63. #ifndef __iwl_4965_hw_h__
  64. #define __iwl_4965_hw_h__
  65. /* uCode queue management definitions */
  66. #define IWL_CMD_QUEUE_NUM 4
  67. #define IWL_CMD_FIFO_NUM 4
  68. #define IWL_BACK_QUEUE_FIRST_ID 7
  69. /* Tx rates */
  70. #define IWL_CCK_RATES 4
  71. #define IWL_OFDM_RATES 8
  72. #define IWL_HT_RATES 16
  73. #define IWL_MAX_RATES (IWL_CCK_RATES+IWL_OFDM_RATES+IWL_HT_RATES)
  74. /* Time constants */
  75. #define SHORT_SLOT_TIME 9
  76. #define LONG_SLOT_TIME 20
  77. /* RSSI to dBm */
  78. #define IWL_RSSI_OFFSET 44
  79. /*
  80. * EEPROM related constants, enums, and structures.
  81. */
  82. /*
  83. * EEPROM access time values:
  84. *
  85. * Driver initiates EEPROM read by writing byte address << 1 to CSR_EEPROM_REG,
  86. * then clearing (with subsequent read/modify/write) CSR_EEPROM_REG bit
  87. * CSR_EEPROM_REG_BIT_CMD (0x2).
  88. * Driver then polls CSR_EEPROM_REG for CSR_EEPROM_REG_READ_VALID_MSK (0x1).
  89. * When polling, wait 10 uSec between polling loops, up to a maximum 5000 uSec.
  90. * Driver reads 16-bit value from bits 31-16 of CSR_EEPROM_REG.
  91. */
  92. #define IWL_EEPROM_ACCESS_TIMEOUT 5000 /* uSec */
  93. #define IWL_EEPROM_ACCESS_DELAY 10 /* uSec */
  94. /* EEPROM field values */
  95. #define ANTENNA_SWITCH_NORMAL 0
  96. #define ANTENNA_SWITCH_INVERSE 1
  97. /*
  98. * Regulatory channel usage flags in EEPROM struct iwl4965_eeprom_channel.flags.
  99. *
  100. * IBSS and/or AP operation is allowed *only* on those channels with
  101. * (VALID && IBSS && ACTIVE && !RADAR). This restriction is in place because
  102. * RADAR detection is not supported by the 4965 driver, but is a
  103. * requirement for establishing a new network for legal operation on channels
  104. * requiring RADAR detection or restricting ACTIVE scanning.
  105. *
  106. * NOTE: "WIDE" flag does not indicate anything about "FAT" 40 MHz channels.
  107. * It only indicates that 20 MHz channel use is supported; FAT channel
  108. * usage is indicated by a separate set of regulatory flags for each
  109. * FAT channel pair.
  110. *
  111. * NOTE: Using a channel inappropriately will result in a uCode error!
  112. */
  113. enum {
  114. EEPROM_CHANNEL_VALID = (1 << 0), /* usable for this SKU/geo */
  115. EEPROM_CHANNEL_IBSS = (1 << 1), /* usable as an IBSS channel */
  116. /* Bit 2 Reserved */
  117. EEPROM_CHANNEL_ACTIVE = (1 << 3), /* active scanning allowed */
  118. EEPROM_CHANNEL_RADAR = (1 << 4), /* radar detection required */
  119. EEPROM_CHANNEL_WIDE = (1 << 5), /* 20 MHz channel okay */
  120. EEPROM_CHANNEL_NARROW = (1 << 6), /* 10 MHz channel, not used */
  121. EEPROM_CHANNEL_DFS = (1 << 7), /* dynamic freq selection candidate */
  122. };
  123. /* EEPROM field lengths */
  124. #define EEPROM_BOARD_PBA_NUMBER_LENGTH 11
  125. /* EEPROM field lengths */
  126. #define EEPROM_BOARD_PBA_NUMBER_LENGTH 11
  127. #define EEPROM_REGULATORY_SKU_ID_LENGTH 4
  128. #define EEPROM_REGULATORY_BAND1_CHANNELS_LENGTH 14
  129. #define EEPROM_REGULATORY_BAND2_CHANNELS_LENGTH 13
  130. #define EEPROM_REGULATORY_BAND3_CHANNELS_LENGTH 12
  131. #define EEPROM_REGULATORY_BAND4_CHANNELS_LENGTH 11
  132. #define EEPROM_REGULATORY_BAND5_CHANNELS_LENGTH 6
  133. #define EEPROM_REGULATORY_BAND_24_FAT_CHANNELS_LENGTH 7
  134. #define EEPROM_REGULATORY_BAND_52_FAT_CHANNELS_LENGTH 11
  135. #define EEPROM_REGULATORY_CHANNELS_LENGTH ( \
  136. EEPROM_REGULATORY_BAND1_CHANNELS_LENGTH + \
  137. EEPROM_REGULATORY_BAND2_CHANNELS_LENGTH + \
  138. EEPROM_REGULATORY_BAND3_CHANNELS_LENGTH + \
  139. EEPROM_REGULATORY_BAND4_CHANNELS_LENGTH + \
  140. EEPROM_REGULATORY_BAND5_CHANNELS_LENGTH + \
  141. EEPROM_REGULATORY_BAND_24_FAT_CHANNELS_LENGTH + \
  142. EEPROM_REGULATORY_BAND_52_FAT_CHANNELS_LENGTH)
  143. #define EEPROM_REGULATORY_NUMBER_OF_BANDS 5
  144. /* SKU Capabilities */
  145. #define EEPROM_SKU_CAP_SW_RF_KILL_ENABLE (1 << 0)
  146. #define EEPROM_SKU_CAP_HW_RF_KILL_ENABLE (1 << 1)
  147. #define EEPROM_SKU_CAP_OP_MODE_MRC (1 << 7)
  148. /* *regulatory* channel data format in eeprom, one for each channel.
  149. * There are separate entries for FAT (40 MHz) vs. normal (20 MHz) channels. */
  150. struct iwl4965_eeprom_channel {
  151. u8 flags; /* EEPROM_CHANNEL_* flags copied from EEPROM */
  152. s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */
  153. } __attribute__ ((packed));
  154. /* 4965 has two radio transmitters (and 3 radio receivers) */
  155. #define EEPROM_TX_POWER_TX_CHAINS (2)
  156. /* 4965 has room for up to 8 sets of txpower calibration data */
  157. #define EEPROM_TX_POWER_BANDS (8)
  158. /* 4965 factory calibration measures txpower gain settings for
  159. * each of 3 target output levels */
  160. #define EEPROM_TX_POWER_MEASUREMENTS (3)
  161. /* 4965 driver does not work with txpower calibration version < 5.
  162. * Look for this in calib_version member of struct iwl4965_eeprom. */
  163. #define EEPROM_TX_POWER_VERSION_NEW (5)
  164. /*
  165. * 4965 factory calibration data for one txpower level, on one channel,
  166. * measured on one of the 2 tx chains (radio transmitter and associated
  167. * antenna). EEPROM contains:
  168. *
  169. * 1) Temperature (degrees Celsius) of device when measurement was made.
  170. *
  171. * 2) Gain table index used to achieve the target measurement power.
  172. * This refers to the "well-known" gain tables (see iwl-4965-hw.h).
  173. *
  174. * 3) Actual measured output power, in half-dBm ("34" = 17 dBm).
  175. *
  176. * 4) RF power amplifier detector level measurement (not used).
  177. */
  178. struct iwl4965_eeprom_calib_measure {
  179. u8 temperature; /* Device temperature (Celsius) */
  180. u8 gain_idx; /* Index into gain table */
  181. u8 actual_pow; /* Measured RF output power, half-dBm */
  182. s8 pa_det; /* Power amp detector level (not used) */
  183. } __attribute__ ((packed));
  184. /*
  185. * 4965 measurement set for one channel. EEPROM contains:
  186. *
  187. * 1) Channel number measured
  188. *
  189. * 2) Measurements for each of 3 power levels for each of 2 radio transmitters
  190. * (a.k.a. "tx chains") (6 measurements altogether)
  191. */
  192. struct iwl4965_eeprom_calib_ch_info {
  193. u8 ch_num;
  194. struct iwl4965_eeprom_calib_measure measurements[EEPROM_TX_POWER_TX_CHAINS]
  195. [EEPROM_TX_POWER_MEASUREMENTS];
  196. } __attribute__ ((packed));
  197. /*
  198. * 4965 txpower subband info.
  199. *
  200. * For each frequency subband, EEPROM contains the following:
  201. *
  202. * 1) First and last channels within range of the subband. "0" values
  203. * indicate that this sample set is not being used.
  204. *
  205. * 2) Sample measurement sets for 2 channels close to the range endpoints.
  206. */
  207. struct iwl4965_eeprom_calib_subband_info {
  208. u8 ch_from; /* channel number of lowest channel in subband */
  209. u8 ch_to; /* channel number of highest channel in subband */
  210. struct iwl4965_eeprom_calib_ch_info ch1;
  211. struct iwl4965_eeprom_calib_ch_info ch2;
  212. } __attribute__ ((packed));
  213. /*
  214. * 4965 txpower calibration info. EEPROM contains:
  215. *
  216. * 1) Factory-measured saturation power levels (maximum levels at which
  217. * tx power amplifier can output a signal without too much distortion).
  218. * There is one level for 2.4 GHz band and one for 5 GHz band. These
  219. * values apply to all channels within each of the bands.
  220. *
  221. * 2) Factory-measured power supply voltage level. This is assumed to be
  222. * constant (i.e. same value applies to all channels/bands) while the
  223. * factory measurements are being made.
  224. *
  225. * 3) Up to 8 sets of factory-measured txpower calibration values.
  226. * These are for different frequency ranges, since txpower gain
  227. * characteristics of the analog radio circuitry vary with frequency.
  228. *
  229. * Not all sets need to be filled with data;
  230. * struct iwl4965_eeprom_calib_subband_info contains range of channels
  231. * (0 if unused) for each set of data.
  232. */
  233. struct iwl4965_eeprom_calib_info {
  234. u8 saturation_power24; /* half-dBm (e.g. "34" = 17 dBm) */
  235. u8 saturation_power52; /* half-dBm */
  236. s16 voltage; /* signed */
  237. struct iwl4965_eeprom_calib_subband_info band_info[EEPROM_TX_POWER_BANDS];
  238. } __attribute__ ((packed));
  239. /*
  240. * 4965 EEPROM map
  241. */
  242. struct iwl4965_eeprom {
  243. u8 reserved0[16];
  244. #define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */
  245. u16 device_id; /* abs.ofs: 16 */
  246. u8 reserved1[2];
  247. #define EEPROM_PMC (2*0x0A) /* 2 bytes */
  248. u16 pmc; /* abs.ofs: 20 */
  249. u8 reserved2[20];
  250. #define EEPROM_MAC_ADDRESS (2*0x15) /* 6 bytes */
  251. u8 mac_address[6]; /* abs.ofs: 42 */
  252. u8 reserved3[58];
  253. #define EEPROM_BOARD_REVISION (2*0x35) /* 2 bytes */
  254. u16 board_revision; /* abs.ofs: 106 */
  255. u8 reserved4[11];
  256. #define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1) /* 9 bytes */
  257. u8 board_pba_number[9]; /* abs.ofs: 119 */
  258. u8 reserved5[8];
  259. #define EEPROM_VERSION (2*0x44) /* 2 bytes */
  260. u16 version; /* abs.ofs: 136 */
  261. #define EEPROM_SKU_CAP (2*0x45) /* 1 bytes */
  262. u8 sku_cap; /* abs.ofs: 138 */
  263. #define EEPROM_LEDS_MODE (2*0x45+1) /* 1 bytes */
  264. u8 leds_mode; /* abs.ofs: 139 */
  265. #define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */
  266. u16 oem_mode;
  267. #define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */
  268. u16 wowlan_mode; /* abs.ofs: 142 */
  269. #define EEPROM_LEDS_TIME_INTERVAL (2*0x48) /* 2 bytes */
  270. u16 leds_time_interval; /* abs.ofs: 144 */
  271. #define EEPROM_LEDS_OFF_TIME (2*0x49) /* 1 bytes */
  272. u8 leds_off_time; /* abs.ofs: 146 */
  273. #define EEPROM_LEDS_ON_TIME (2*0x49+1) /* 1 bytes */
  274. u8 leds_on_time; /* abs.ofs: 147 */
  275. #define EEPROM_ALMGOR_M_VERSION (2*0x4A) /* 1 bytes */
  276. u8 almgor_m_version; /* abs.ofs: 148 */
  277. #define EEPROM_ANTENNA_SWITCH_TYPE (2*0x4A+1) /* 1 bytes */
  278. u8 antenna_switch_type; /* abs.ofs: 149 */
  279. u8 reserved6[8];
  280. #define EEPROM_4965_BOARD_REVISION (2*0x4F) /* 2 bytes */
  281. u16 board_revision_4965; /* abs.ofs: 158 */
  282. u8 reserved7[13];
  283. #define EEPROM_4965_BOARD_PBA (2*0x56+1) /* 9 bytes */
  284. u8 board_pba_number_4965[9]; /* abs.ofs: 173 */
  285. u8 reserved8[10];
  286. #define EEPROM_REGULATORY_SKU_ID (2*0x60) /* 4 bytes */
  287. u8 sku_id[4]; /* abs.ofs: 192 */
  288. /*
  289. * Per-channel regulatory data.
  290. *
  291. * Each channel that *might* be supported by 3945 or 4965 has a fixed location
  292. * in EEPROM containing EEPROM_CHANNEL_* usage flags (LSB) and max regulatory
  293. * txpower (MSB).
  294. *
  295. * Entries immediately below are for 20 MHz channel width. FAT (40 MHz)
  296. * channels (only for 4965, not supported by 3945) appear later in the EEPROM.
  297. *
  298. * 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
  299. */
  300. #define EEPROM_REGULATORY_BAND_1 (2*0x62) /* 2 bytes */
  301. u16 band_1_count; /* abs.ofs: 196 */
  302. #define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63) /* 28 bytes */
  303. struct iwl4965_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */
  304. /*
  305. * 4.9 GHz channels 183, 184, 185, 187, 188, 189, 192, 196,
  306. * 5.0 GHz channels 7, 8, 11, 12, 16
  307. * (4915-5080MHz) (none of these is ever supported)
  308. */
  309. #define EEPROM_REGULATORY_BAND_2 (2*0x71) /* 2 bytes */
  310. u16 band_2_count; /* abs.ofs: 226 */
  311. #define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72) /* 26 bytes */
  312. struct iwl4965_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */
  313. /*
  314. * 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64
  315. * (5170-5320MHz)
  316. */
  317. #define EEPROM_REGULATORY_BAND_3 (2*0x7F) /* 2 bytes */
  318. u16 band_3_count; /* abs.ofs: 254 */
  319. #define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80) /* 24 bytes */
  320. struct iwl4965_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */
  321. /*
  322. * 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
  323. * (5500-5700MHz)
  324. */
  325. #define EEPROM_REGULATORY_BAND_4 (2*0x8C) /* 2 bytes */
  326. u16 band_4_count; /* abs.ofs: 280 */
  327. #define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D) /* 22 bytes */
  328. struct iwl4965_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */
  329. /*
  330. * 5.7 GHz channels 145, 149, 153, 157, 161, 165
  331. * (5725-5825MHz)
  332. */
  333. #define EEPROM_REGULATORY_BAND_5 (2*0x98) /* 2 bytes */
  334. u16 band_5_count; /* abs.ofs: 304 */
  335. #define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99) /* 12 bytes */
  336. struct iwl4965_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */
  337. u8 reserved10[2];
  338. /*
  339. * 2.4 GHz FAT channels 1 (5), 2 (6), 3 (7), 4 (8), 5 (9), 6 (10), 7 (11)
  340. *
  341. * The channel listed is the center of the lower 20 MHz half of the channel.
  342. * The overall center frequency is actually 2 channels (10 MHz) above that,
  343. * and the upper half of each FAT channel is centered 4 channels (20 MHz) away
  344. * from the lower half; e.g. the upper half of FAT channel 1 is channel 5,
  345. * and the overall FAT channel width centers on channel 3.
  346. *
  347. * NOTE: The RXON command uses 20 MHz channel numbers to specify the
  348. * control channel to which to tune. RXON also specifies whether the
  349. * control channel is the upper or lower half of a FAT channel.
  350. *
  351. * NOTE: 4965 does not support FAT channels on 2.4 GHz.
  352. */
  353. #define EEPROM_REGULATORY_BAND_24_FAT_CHANNELS (2*0xA0) /* 14 bytes */
  354. struct iwl4965_eeprom_channel band_24_channels[7]; /* abs.ofs: 320 */
  355. u8 reserved11[2];
  356. /*
  357. * 5.2 GHz FAT channels 36 (40), 44 (48), 52 (56), 60 (64),
  358. * 100 (104), 108 (112), 116 (120), 124 (128), 132 (136), 149 (153), 157 (161)
  359. */
  360. #define EEPROM_REGULATORY_BAND_52_FAT_CHANNELS (2*0xA8) /* 22 bytes */
  361. struct iwl4965_eeprom_channel band_52_channels[11]; /* abs.ofs: 336 */
  362. u8 reserved12[6];
  363. /*
  364. * 4965 driver requires txpower calibration format version 5 or greater.
  365. * Driver does not work with txpower calibration version < 5.
  366. * This value is simply a 16-bit number, no major/minor versions here.
  367. */
  368. #define EEPROM_CALIB_VERSION_OFFSET (2*0xB6) /* 2 bytes */
  369. u16 calib_version; /* abs.ofs: 364 */
  370. u8 reserved13[2];
  371. u8 reserved14[96]; /* abs.ofs: 368 */
  372. /*
  373. * 4965 Txpower calibration data.
  374. */
  375. #define EEPROM_IWL_CALIB_TXPOWER_OFFSET (2*0xE8) /* 48 bytes */
  376. struct iwl4965_eeprom_calib_info calib_info; /* abs.ofs: 464 */
  377. u8 reserved16[140]; /* fill out to full 1024 byte block */
  378. } __attribute__ ((packed));
  379. #define IWL_EEPROM_IMAGE_SIZE 1024
  380. /* End of EEPROM */
  381. #include "iwl-4965-commands.h"
  382. #define PCI_LINK_CTRL 0x0F0
  383. #define PCI_POWER_SOURCE 0x0C8
  384. #define PCI_REG_WUM8 0x0E8
  385. #define PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT (0x80000000)
  386. /*=== CSR (control and status registers) ===*/
  387. #define CSR_BASE (0x000)
  388. #define CSR_SW_VER (CSR_BASE+0x000)
  389. #define CSR_HW_IF_CONFIG_REG (CSR_BASE+0x000) /* hardware interface config */
  390. #define CSR_INT_COALESCING (CSR_BASE+0x004) /* accum ints, 32-usec units */
  391. #define CSR_INT (CSR_BASE+0x008) /* host interrupt status/ack */
  392. #define CSR_INT_MASK (CSR_BASE+0x00c) /* host interrupt enable */
  393. #define CSR_FH_INT_STATUS (CSR_BASE+0x010) /* busmaster int status/ack*/
  394. #define CSR_GPIO_IN (CSR_BASE+0x018) /* read external chip pins */
  395. #define CSR_RESET (CSR_BASE+0x020) /* busmaster enable, NMI, etc*/
  396. #define CSR_GP_CNTRL (CSR_BASE+0x024)
  397. #define CSR_HW_REV (CSR_BASE+0x028)
  398. #define CSR_EEPROM_REG (CSR_BASE+0x02c)
  399. #define CSR_EEPROM_GP (CSR_BASE+0x030)
  400. #define CSR_GP_UCODE (CSR_BASE+0x044)
  401. #define CSR_UCODE_DRV_GP1 (CSR_BASE+0x054)
  402. #define CSR_UCODE_DRV_GP1_SET (CSR_BASE+0x058)
  403. #define CSR_UCODE_DRV_GP1_CLR (CSR_BASE+0x05c)
  404. #define CSR_UCODE_DRV_GP2 (CSR_BASE+0x060)
  405. #define CSR_LED_REG (CSR_BASE+0x094)
  406. #define CSR_DRAM_INT_TBL_CTL (CSR_BASE+0x0A0)
  407. #define CSR_GIO_CHICKEN_BITS (CSR_BASE+0x100)
  408. #define CSR_ANA_PLL_CFG (CSR_BASE+0x20c)
  409. #define CSR_HW_REV_WA_REG (CSR_BASE+0x22C)
  410. /* HW I/F configuration */
  411. #define CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MB (0x00000100)
  412. #define CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MM (0x00000200)
  413. #define CSR_HW_IF_CONFIG_REG_BIT_SKU_MRC (0x00000400)
  414. #define CSR_HW_IF_CONFIG_REG_BIT_BOARD_TYPE (0x00000800)
  415. #define CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A (0x00000000)
  416. #define CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B (0x00001000)
  417. #define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM (0x00200000)
  418. /* interrupt flags in INTA, set by uCode or hardware (e.g. dma),
  419. * acknowledged (reset) by host writing "1" to flagged bits. */
  420. #define CSR_INT_BIT_FH_RX (1<<31) /* Rx DMA, cmd responses, FH_INT[17:16] */
  421. #define CSR_INT_BIT_HW_ERR (1<<29) /* DMA hardware error FH_INT[31] */
  422. #define CSR_INT_BIT_DNLD (1<<28) /* uCode Download */
  423. #define CSR_INT_BIT_FH_TX (1<<27) /* Tx DMA FH_INT[1:0] */
  424. #define CSR_INT_BIT_MAC_CLK_ACTV (1<<26) /* NIC controller's clock toggled on/off */
  425. #define CSR_INT_BIT_SW_ERR (1<<25) /* uCode error */
  426. #define CSR_INT_BIT_RF_KILL (1<<7) /* HW RFKILL switch GP_CNTRL[27] toggled */
  427. #define CSR_INT_BIT_CT_KILL (1<<6) /* Critical temp (chip too hot) rfkill */
  428. #define CSR_INT_BIT_SW_RX (1<<3) /* Rx, command responses, 3945 */
  429. #define CSR_INT_BIT_WAKEUP (1<<1) /* NIC controller waking up (pwr mgmt) */
  430. #define CSR_INT_BIT_ALIVE (1<<0) /* uCode interrupts once it initializes */
  431. #define CSR_INI_SET_MASK (CSR_INT_BIT_FH_RX | \
  432. CSR_INT_BIT_HW_ERR | \
  433. CSR_INT_BIT_FH_TX | \
  434. CSR_INT_BIT_SW_ERR | \
  435. CSR_INT_BIT_RF_KILL | \
  436. CSR_INT_BIT_SW_RX | \
  437. CSR_INT_BIT_WAKEUP | \
  438. CSR_INT_BIT_ALIVE)
  439. /* interrupt flags in FH (flow handler) (PCI busmaster DMA) */
  440. #define CSR_FH_INT_BIT_ERR (1<<31) /* Error */
  441. #define CSR_FH_INT_BIT_HI_PRIOR (1<<30) /* High priority Rx, bypass coalescing */
  442. #define CSR_FH_INT_BIT_RX_CHNL2 (1<<18) /* Rx channel 2 (3945 only) */
  443. #define CSR_FH_INT_BIT_RX_CHNL1 (1<<17) /* Rx channel 1 */
  444. #define CSR_FH_INT_BIT_RX_CHNL0 (1<<16) /* Rx channel 0 */
  445. #define CSR_FH_INT_BIT_TX_CHNL6 (1<<6) /* Tx channel 6 (3945 only) */
  446. #define CSR_FH_INT_BIT_TX_CHNL1 (1<<1) /* Tx channel 1 */
  447. #define CSR_FH_INT_BIT_TX_CHNL0 (1<<0) /* Tx channel 0 */
  448. #define CSR_FH_INT_RX_MASK (CSR_FH_INT_BIT_HI_PRIOR | \
  449. CSR_FH_INT_BIT_RX_CHNL2 | \
  450. CSR_FH_INT_BIT_RX_CHNL1 | \
  451. CSR_FH_INT_BIT_RX_CHNL0)
  452. #define CSR_FH_INT_TX_MASK (CSR_FH_INT_BIT_TX_CHNL6 | \
  453. CSR_FH_INT_BIT_TX_CHNL1 | \
  454. CSR_FH_INT_BIT_TX_CHNL0)
  455. /* RESET */
  456. #define CSR_RESET_REG_FLAG_NEVO_RESET (0x00000001)
  457. #define CSR_RESET_REG_FLAG_FORCE_NMI (0x00000002)
  458. #define CSR_RESET_REG_FLAG_SW_RESET (0x00000080)
  459. #define CSR_RESET_REG_FLAG_MASTER_DISABLED (0x00000100)
  460. #define CSR_RESET_REG_FLAG_STOP_MASTER (0x00000200)
  461. /* GP (general purpose) CONTROL */
  462. #define CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY (0x00000001)
  463. #define CSR_GP_CNTRL_REG_FLAG_INIT_DONE (0x00000004)
  464. #define CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ (0x00000008)
  465. #define CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP (0x00000010)
  466. #define CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN (0x00000001)
  467. #define CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE (0x07000000)
  468. #define CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE (0x04000000)
  469. #define CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW (0x08000000)
  470. /* EEPROM REG */
  471. #define CSR_EEPROM_REG_READ_VALID_MSK (0x00000001)
  472. #define CSR_EEPROM_REG_BIT_CMD (0x00000002)
  473. /* EEPROM GP */
  474. #define CSR_EEPROM_GP_VALID_MSK (0x00000006)
  475. #define CSR_EEPROM_GP_BAD_SIGNATURE (0x00000000)
  476. #define CSR_EEPROM_GP_IF_OWNER_MSK (0x00000180)
  477. /* UCODE DRV GP */
  478. #define CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP (0x00000001)
  479. #define CSR_UCODE_SW_BIT_RFKILL (0x00000002)
  480. #define CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED (0x00000004)
  481. #define CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT (0x00000008)
  482. /* GPIO */
  483. #define CSR_GPIO_IN_BIT_AUX_POWER (0x00000200)
  484. #define CSR_GPIO_IN_VAL_VAUX_PWR_SRC (0x00000000)
  485. #define CSR_GPIO_IN_VAL_VMAIN_PWR_SRC CSR_GPIO_IN_BIT_AUX_POWER
  486. /* GI Chicken Bits */
  487. #define CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX (0x00800000)
  488. #define CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER (0x20000000)
  489. /* CSR_ANA_PLL_CFG */
  490. #define CSR_ANA_PLL_CFG_SH (0x00880300)
  491. #define CSR_LED_REG_TRUN_ON (0x00000078)
  492. #define CSR_LED_REG_TRUN_OFF (0x00000038)
  493. #define CSR_LED_BSM_CTRL_MSK (0xFFFFFFDF)
  494. /* DRAM_INT_TBL_CTRL */
  495. #define CSR_DRAM_INT_TBL_CTRL_EN (1<<31)
  496. #define CSR_DRAM_INT_TBL_CTRL_WRAP_CHK (1<<27)
  497. /*=== HBUS (Host-side Bus) ===*/
  498. #define HBUS_BASE (0x400)
  499. #define HBUS_TARG_MEM_RADDR (HBUS_BASE+0x00c)
  500. #define HBUS_TARG_MEM_WADDR (HBUS_BASE+0x010)
  501. #define HBUS_TARG_MEM_WDAT (HBUS_BASE+0x018)
  502. #define HBUS_TARG_MEM_RDAT (HBUS_BASE+0x01c)
  503. #define HBUS_TARG_PRPH_WADDR (HBUS_BASE+0x044)
  504. #define HBUS_TARG_PRPH_RADDR (HBUS_BASE+0x048)
  505. #define HBUS_TARG_PRPH_WDAT (HBUS_BASE+0x04c)
  506. #define HBUS_TARG_PRPH_RDAT (HBUS_BASE+0x050)
  507. #define HBUS_TARG_WRPTR (HBUS_BASE+0x060)
  508. #define HBUS_TARG_MBX_C (HBUS_BASE+0x030)
  509. /* SCD (Scheduler) */
  510. #define SCD_BASE (CSR_BASE + 0x2E00)
  511. #define SCD_MODE_REG (SCD_BASE + 0x000)
  512. #define SCD_ARASTAT_REG (SCD_BASE + 0x004)
  513. #define SCD_TXFACT_REG (SCD_BASE + 0x010)
  514. #define SCD_TXF4MF_REG (SCD_BASE + 0x014)
  515. #define SCD_TXF5MF_REG (SCD_BASE + 0x020)
  516. #define SCD_SBYP_MODE_1_REG (SCD_BASE + 0x02C)
  517. #define SCD_SBYP_MODE_2_REG (SCD_BASE + 0x030)
  518. /*=== FH (data Flow Handler) ===*/
  519. #define FH_BASE (0x800)
  520. #define FH_CBCC_TABLE (FH_BASE+0x140)
  521. #define FH_TFDB_TABLE (FH_BASE+0x180)
  522. #define FH_RCSR_TABLE (FH_BASE+0x400)
  523. #define FH_RSSR_TABLE (FH_BASE+0x4c0)
  524. #define FH_TCSR_TABLE (FH_BASE+0x500)
  525. #define FH_TSSR_TABLE (FH_BASE+0x680)
  526. /* TFDB (Transmit Frame Buffer Descriptor) */
  527. #define FH_TFDB(_channel, buf) \
  528. (FH_TFDB_TABLE+((_channel)*2+(buf))*0x28)
  529. #define ALM_FH_TFDB_CHNL_BUF_CTRL_REG(_channel) \
  530. (FH_TFDB_TABLE + 0x50 * _channel)
  531. /* CBCC _channel is [0,2] */
  532. #define FH_CBCC(_channel) (FH_CBCC_TABLE+(_channel)*0x8)
  533. #define FH_CBCC_CTRL(_channel) (FH_CBCC(_channel)+0x00)
  534. #define FH_CBCC_BASE(_channel) (FH_CBCC(_channel)+0x04)
  535. /* RCSR _channel is [0,2] */
  536. #define FH_RCSR(_channel) (FH_RCSR_TABLE+(_channel)*0x40)
  537. #define FH_RCSR_CONFIG(_channel) (FH_RCSR(_channel)+0x00)
  538. #define FH_RCSR_RBD_BASE(_channel) (FH_RCSR(_channel)+0x04)
  539. #define FH_RCSR_WPTR(_channel) (FH_RCSR(_channel)+0x20)
  540. #define FH_RCSR_RPTR_ADDR(_channel) (FH_RCSR(_channel)+0x24)
  541. #define FH_RSCSR_CHNL0_WPTR (FH_RSCSR_CHNL0_RBDCB_WPTR_REG)
  542. /* RSSR */
  543. #define FH_RSSR_CTRL (FH_RSSR_TABLE+0x000)
  544. #define FH_RSSR_STATUS (FH_RSSR_TABLE+0x004)
  545. /* TCSR */
  546. #define FH_TCSR(_channel) (FH_TCSR_TABLE+(_channel)*0x20)
  547. #define FH_TCSR_CONFIG(_channel) (FH_TCSR(_channel)+0x00)
  548. #define FH_TCSR_CREDIT(_channel) (FH_TCSR(_channel)+0x04)
  549. #define FH_TCSR_BUFF_STTS(_channel) (FH_TCSR(_channel)+0x08)
  550. /* TSSR */
  551. #define FH_TSSR_CBB_BASE (FH_TSSR_TABLE+0x000)
  552. #define FH_TSSR_MSG_CONFIG (FH_TSSR_TABLE+0x008)
  553. #define FH_TSSR_TX_STATUS (FH_TSSR_TABLE+0x010)
  554. /* 18 - reserved */
  555. /* card static random access memory (SRAM) for processor data and instructs */
  556. #define RTC_INST_LOWER_BOUND (0x000000)
  557. #define RTC_DATA_LOWER_BOUND (0x800000)
  558. /* DBM */
  559. #define ALM_FH_SRVC_CHNL (6)
  560. #define ALM_FH_RCSR_RX_CONFIG_REG_POS_RBDC_SIZE (20)
  561. #define ALM_FH_RCSR_RX_CONFIG_REG_POS_IRQ_RBTH (4)
  562. #define ALM_FH_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN (0x08000000)
  563. #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE (0x80000000)
  564. #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE (0x20000000)
  565. #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_MAX_FRAG_SIZE_128 (0x01000000)
  566. #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_IRQ_DEST_INT_HOST (0x00001000)
  567. #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH (0x00000000)
  568. #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000)
  569. #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRIVER (0x00000001)
  570. #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL (0x00000000)
  571. #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL (0x00000008)
  572. #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000)
  573. #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000)
  574. #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000)
  575. #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000)
  576. #define ALM_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00004000)
  577. #define ALM_FH_TCSR_CHNL_TX_BUF_STS_REG_BIT_TFDB_WPTR (0x00000001)
  578. #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON (0xFF000000)
  579. #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON (0x00FF0000)
  580. #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B (0x00000400)
  581. #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON (0x00000100)
  582. #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON (0x00000080)
  583. #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH (0x00000020)
  584. #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH (0x00000005)
  585. #define ALM_TB_MAX_BYTES_COUNT (0xFFF0)
  586. #define ALM_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_channel) \
  587. ((1LU << _channel) << 24)
  588. #define ALM_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_channel) \
  589. ((1LU << _channel) << 16)
  590. #define ALM_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_channel) \
  591. (ALM_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_channel) | \
  592. ALM_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_channel))
  593. #define PCI_CFG_REV_ID_BIT_BASIC_SKU (0x40) /* bit 6 */
  594. #define PCI_CFG_REV_ID_BIT_RTP (0x80) /* bit 7 */
  595. #define HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED (0x00000004)
  596. #define TFD_QUEUE_MIN 0
  597. #define TFD_QUEUE_MAX 6
  598. #define TFD_QUEUE_SIZE_MAX (256)
  599. /* spectrum and channel data structures */
  600. #define IWL_NUM_SCAN_RATES (2)
  601. #define IWL_SCAN_FLAG_24GHZ (1<<0)
  602. #define IWL_SCAN_FLAG_52GHZ (1<<1)
  603. #define IWL_SCAN_FLAG_ACTIVE (1<<2)
  604. #define IWL_SCAN_FLAG_DIRECT (1<<3)
  605. #define IWL_MAX_CMD_SIZE 1024
  606. #define IWL_DEFAULT_TX_RETRY 15
  607. #define IWL_MAX_TX_RETRY 16
  608. /*********************************************/
  609. #define RFD_SIZE 4
  610. #define NUM_TFD_CHUNKS 4
  611. #define RX_QUEUE_SIZE 256
  612. #define RX_QUEUE_MASK 255
  613. #define RX_QUEUE_SIZE_LOG 8
  614. /* QoS definitions */
  615. #define CW_MIN_OFDM 15
  616. #define CW_MAX_OFDM 1023
  617. #define CW_MIN_CCK 31
  618. #define CW_MAX_CCK 1023
  619. #define QOS_TX0_CW_MIN_OFDM CW_MIN_OFDM
  620. #define QOS_TX1_CW_MIN_OFDM CW_MIN_OFDM
  621. #define QOS_TX2_CW_MIN_OFDM ((CW_MIN_OFDM + 1) / 2 - 1)
  622. #define QOS_TX3_CW_MIN_OFDM ((CW_MIN_OFDM + 1) / 4 - 1)
  623. #define QOS_TX0_CW_MIN_CCK CW_MIN_CCK
  624. #define QOS_TX1_CW_MIN_CCK CW_MIN_CCK
  625. #define QOS_TX2_CW_MIN_CCK ((CW_MIN_CCK + 1) / 2 - 1)
  626. #define QOS_TX3_CW_MIN_CCK ((CW_MIN_CCK + 1) / 4 - 1)
  627. #define QOS_TX0_CW_MAX_OFDM CW_MAX_OFDM
  628. #define QOS_TX1_CW_MAX_OFDM CW_MAX_OFDM
  629. #define QOS_TX2_CW_MAX_OFDM CW_MIN_OFDM
  630. #define QOS_TX3_CW_MAX_OFDM ((CW_MIN_OFDM + 1) / 2 - 1)
  631. #define QOS_TX0_CW_MAX_CCK CW_MAX_CCK
  632. #define QOS_TX1_CW_MAX_CCK CW_MAX_CCK
  633. #define QOS_TX2_CW_MAX_CCK CW_MIN_CCK
  634. #define QOS_TX3_CW_MAX_CCK ((CW_MIN_CCK + 1) / 2 - 1)
  635. #define QOS_TX0_AIFS 3
  636. #define QOS_TX1_AIFS 7
  637. #define QOS_TX2_AIFS 2
  638. #define QOS_TX3_AIFS 2
  639. #define QOS_TX0_ACM 0
  640. #define QOS_TX1_ACM 0
  641. #define QOS_TX2_ACM 0
  642. #define QOS_TX3_ACM 0
  643. #define QOS_TX0_TXOP_LIMIT_CCK 0
  644. #define QOS_TX1_TXOP_LIMIT_CCK 0
  645. #define QOS_TX2_TXOP_LIMIT_CCK 6016
  646. #define QOS_TX3_TXOP_LIMIT_CCK 3264
  647. #define QOS_TX0_TXOP_LIMIT_OFDM 0
  648. #define QOS_TX1_TXOP_LIMIT_OFDM 0
  649. #define QOS_TX2_TXOP_LIMIT_OFDM 3008
  650. #define QOS_TX3_TXOP_LIMIT_OFDM 1504
  651. #define DEF_TX0_CW_MIN_OFDM CW_MIN_OFDM
  652. #define DEF_TX1_CW_MIN_OFDM CW_MIN_OFDM
  653. #define DEF_TX2_CW_MIN_OFDM CW_MIN_OFDM
  654. #define DEF_TX3_CW_MIN_OFDM CW_MIN_OFDM
  655. #define DEF_TX0_CW_MIN_CCK CW_MIN_CCK
  656. #define DEF_TX1_CW_MIN_CCK CW_MIN_CCK
  657. #define DEF_TX2_CW_MIN_CCK CW_MIN_CCK
  658. #define DEF_TX3_CW_MIN_CCK CW_MIN_CCK
  659. #define DEF_TX0_CW_MAX_OFDM CW_MAX_OFDM
  660. #define DEF_TX1_CW_MAX_OFDM CW_MAX_OFDM
  661. #define DEF_TX2_CW_MAX_OFDM CW_MAX_OFDM
  662. #define DEF_TX3_CW_MAX_OFDM CW_MAX_OFDM
  663. #define DEF_TX0_CW_MAX_CCK CW_MAX_CCK
  664. #define DEF_TX1_CW_MAX_CCK CW_MAX_CCK
  665. #define DEF_TX2_CW_MAX_CCK CW_MAX_CCK
  666. #define DEF_TX3_CW_MAX_CCK CW_MAX_CCK
  667. #define DEF_TX0_AIFS (2)
  668. #define DEF_TX1_AIFS (2)
  669. #define DEF_TX2_AIFS (2)
  670. #define DEF_TX3_AIFS (2)
  671. #define DEF_TX0_ACM 0
  672. #define DEF_TX1_ACM 0
  673. #define DEF_TX2_ACM 0
  674. #define DEF_TX3_ACM 0
  675. #define DEF_TX0_TXOP_LIMIT_CCK 0
  676. #define DEF_TX1_TXOP_LIMIT_CCK 0
  677. #define DEF_TX2_TXOP_LIMIT_CCK 0
  678. #define DEF_TX3_TXOP_LIMIT_CCK 0
  679. #define DEF_TX0_TXOP_LIMIT_OFDM 0
  680. #define DEF_TX1_TXOP_LIMIT_OFDM 0
  681. #define DEF_TX2_TXOP_LIMIT_OFDM 0
  682. #define DEF_TX3_TXOP_LIMIT_OFDM 0
  683. #define QOS_QOS_SETS 3
  684. #define QOS_PARAM_SET_ACTIVE 0
  685. #define QOS_PARAM_SET_DEF_CCK 1
  686. #define QOS_PARAM_SET_DEF_OFDM 2
  687. #define CTRL_QOS_NO_ACK (0x0020)
  688. #define DCT_FLAG_EXT_QOS_ENABLED (0x10)
  689. #define U32_PAD(n) ((4-(n))&0x3)
  690. /*
  691. * Generic queue structure
  692. *
  693. * Contains common data for Rx and Tx queues
  694. */
  695. #define TFD_CTL_COUNT_SET(n) (n<<24)
  696. #define TFD_CTL_COUNT_GET(ctl) ((ctl>>24) & 7)
  697. #define TFD_CTL_PAD_SET(n) (n<<28)
  698. #define TFD_CTL_PAD_GET(ctl) (ctl>>28)
  699. #define TFD_TX_CMD_SLOTS 256
  700. #define TFD_CMD_SLOTS 32
  701. #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl4965_cmd) - \
  702. sizeof(struct iwl4965_cmd_meta))
  703. /*
  704. * RX related structures and functions
  705. */
  706. #define RX_FREE_BUFFERS 64
  707. #define RX_LOW_WATERMARK 8
  708. #define IWL_RX_BUF_SIZE (4 * 1024)
  709. #define IWL_MAX_BSM_SIZE BSM_SRAM_SIZE
  710. #define KDR_RTC_INST_UPPER_BOUND (0x018000)
  711. #define KDR_RTC_DATA_UPPER_BOUND (0x80A000)
  712. #define KDR_RTC_INST_SIZE (KDR_RTC_INST_UPPER_BOUND - RTC_INST_LOWER_BOUND)
  713. #define KDR_RTC_DATA_SIZE (KDR_RTC_DATA_UPPER_BOUND - RTC_DATA_LOWER_BOUND)
  714. #define IWL_MAX_INST_SIZE KDR_RTC_INST_SIZE
  715. #define IWL_MAX_DATA_SIZE KDR_RTC_DATA_SIZE
  716. static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr)
  717. {
  718. return (addr >= RTC_DATA_LOWER_BOUND) &&
  719. (addr < KDR_RTC_DATA_UPPER_BOUND);
  720. }
  721. /********************* START TXPOWER *****************************************/
  722. enum {
  723. HT_IE_EXT_CHANNEL_NONE = 0,
  724. HT_IE_EXT_CHANNEL_ABOVE,
  725. HT_IE_EXT_CHANNEL_INVALID,
  726. HT_IE_EXT_CHANNEL_BELOW,
  727. HT_IE_EXT_CHANNEL_MAX
  728. };
  729. enum {
  730. CALIB_CH_GROUP_1 = 0,
  731. CALIB_CH_GROUP_2 = 1,
  732. CALIB_CH_GROUP_3 = 2,
  733. CALIB_CH_GROUP_4 = 3,
  734. CALIB_CH_GROUP_5 = 4,
  735. CALIB_CH_GROUP_MAX
  736. };
  737. /* Temperature calibration offset is 3% 0C in Kelvin */
  738. #define TEMPERATURE_CALIB_KELVIN_OFFSET 8
  739. #define TEMPERATURE_CALIB_A_VAL 259
  740. #define IWL_TX_POWER_TEMPERATURE_MIN (263)
  741. #define IWL_TX_POWER_TEMPERATURE_MAX (410)
  742. #define IWL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(t) \
  743. (((t) < IWL_TX_POWER_TEMPERATURE_MIN) || \
  744. ((t) > IWL_TX_POWER_TEMPERATURE_MAX))
  745. #define IWL_TX_POWER_ILLEGAL_TEMPERATURE (300)
  746. #define IWL_TX_POWER_TEMPERATURE_DIFFERENCE (2)
  747. #define IWL_TX_POWER_MIMO_REGULATORY_COMPENSATION (6)
  748. #define IWL_TX_POWER_TARGET_POWER_MIN (0) /* 0 dBm = 1 milliwatt */
  749. #define IWL_TX_POWER_TARGET_POWER_MAX (16) /* 16 dBm */
  750. /* timeout equivalent to 3 minutes */
  751. #define IWL_TX_POWER_TIMELIMIT_NOCALIB 1800000000
  752. #define IWL_TX_POWER_CCK_COMPENSATION (9)
  753. #define MIN_TX_GAIN_INDEX (0)
  754. #define MIN_TX_GAIN_INDEX_52GHZ_EXT (-9)
  755. #define MAX_TX_GAIN_INDEX_52GHZ (98)
  756. #define MIN_TX_GAIN_52GHZ (98)
  757. #define MAX_TX_GAIN_INDEX_24GHZ (98)
  758. #define MIN_TX_GAIN_24GHZ (98)
  759. #define MAX_TX_GAIN (0)
  760. #define MAX_TX_GAIN_52GHZ_EXT (-9)
  761. #define IWL_TX_POWER_DEFAULT_REGULATORY_24 (34)
  762. #define IWL_TX_POWER_DEFAULT_REGULATORY_52 (34)
  763. #define IWL_TX_POWER_REGULATORY_MIN (0)
  764. #define IWL_TX_POWER_REGULATORY_MAX (34)
  765. #define IWL_TX_POWER_DEFAULT_SATURATION_24 (38)
  766. #define IWL_TX_POWER_DEFAULT_SATURATION_52 (38)
  767. #define IWL_TX_POWER_SATURATION_MIN (20)
  768. #define IWL_TX_POWER_SATURATION_MAX (50)
  769. /* dv *0.4 = dt; so that 5 degrees temperature diff equals
  770. * 12.5 in voltage diff */
  771. #define IWL_TX_TEMPERATURE_UPDATE_LIMIT 9
  772. #define IWL_INVALID_CHANNEL (0xffffffff)
  773. #define IWL_TX_POWER_REGITRY_BIT (2)
  774. #define MIN_IWL_TX_POWER_CALIB_DUR (100)
  775. #define IWL_CCK_FROM_OFDM_POWER_DIFF (-5)
  776. #define IWL_CCK_FROM_OFDM_INDEX_DIFF (9)
  777. /* Number of entries in the gain table */
  778. #define POWER_GAIN_NUM_ENTRIES 78
  779. #define TX_POW_MAX_SESSION_NUM 5
  780. /* timeout equivalent to 3 minutes */
  781. #define TX_IWL_TIMELIMIT_NOCALIB 1800000000
  782. /* Kedron TX_CALIB_STATES */
  783. #define IWL_TX_CALIB_STATE_SEND_TX 0x00000001
  784. #define IWL_TX_CALIB_WAIT_TX_RESPONSE 0x00000002
  785. #define IWL_TX_CALIB_ENABLED 0x00000004
  786. #define IWL_TX_CALIB_XVT_ON 0x00000008
  787. #define IWL_TX_CALIB_TEMPERATURE_CORRECT 0x00000010
  788. #define IWL_TX_CALIB_WORKING_WITH_XVT 0x00000020
  789. #define IWL_TX_CALIB_XVT_PERIODICAL 0x00000040
  790. #define NUM_IWL_TX_CALIB_SETTINS 5 /* Number of tx correction groups */
  791. #define IWL_MIN_POWER_IN_VP_TABLE 1 /* 0.5dBm multiplied by 2 */
  792. #define IWL_MAX_POWER_IN_VP_TABLE 40 /* 20dBm - multiplied by 2 (because
  793. * entries are for each 0.5dBm) */
  794. #define IWL_STEP_IN_VP_TABLE 1 /* 0.5dB - multiplied by 2 */
  795. #define IWL_NUM_POINTS_IN_VPTABLE \
  796. (1 + IWL_MAX_POWER_IN_VP_TABLE - IWL_MIN_POWER_IN_VP_TABLE)
  797. #define MIN_TX_GAIN_INDEX (0)
  798. #define MAX_TX_GAIN_INDEX_52GHZ (98)
  799. #define MIN_TX_GAIN_52GHZ (98)
  800. #define MAX_TX_GAIN_INDEX_24GHZ (98)
  801. #define MIN_TX_GAIN_24GHZ (98)
  802. #define MAX_TX_GAIN (0)
  803. /* First and last channels of all groups */
  804. #define CALIB_IWL_TX_ATTEN_GR1_FCH 34
  805. #define CALIB_IWL_TX_ATTEN_GR1_LCH 43
  806. #define CALIB_IWL_TX_ATTEN_GR2_FCH 44
  807. #define CALIB_IWL_TX_ATTEN_GR2_LCH 70
  808. #define CALIB_IWL_TX_ATTEN_GR3_FCH 71
  809. #define CALIB_IWL_TX_ATTEN_GR3_LCH 124
  810. #define CALIB_IWL_TX_ATTEN_GR4_FCH 125
  811. #define CALIB_IWL_TX_ATTEN_GR4_LCH 200
  812. #define CALIB_IWL_TX_ATTEN_GR5_FCH 1
  813. #define CALIB_IWL_TX_ATTEN_GR5_LCH 20
  814. union iwl4965_tx_power_dual_stream {
  815. struct {
  816. u8 radio_tx_gain[2];
  817. u8 dsp_predis_atten[2];
  818. } s;
  819. u32 dw;
  820. };
  821. /********************* END TXPOWER *****************************************/
  822. /* HT flags */
  823. #define RXON_FLG_CTRL_CHANNEL_LOC_POS (22)
  824. #define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK __constant_cpu_to_le32(0x1<<22)
  825. #define RXON_FLG_HT_OPERATING_MODE_POS (23)
  826. #define RXON_FLG_HT_PROT_MSK __constant_cpu_to_le32(0x1<<23)
  827. #define RXON_FLG_FAT_PROT_MSK __constant_cpu_to_le32(0x2<<23)
  828. #define RXON_FLG_CHANNEL_MODE_POS (25)
  829. #define RXON_FLG_CHANNEL_MODE_MSK __constant_cpu_to_le32(0x3<<25)
  830. #define RXON_FLG_CHANNEL_MODE_PURE_40_MSK __constant_cpu_to_le32(0x1<<25)
  831. #define RXON_FLG_CHANNEL_MODE_MIXED_MSK __constant_cpu_to_le32(0x2<<25)
  832. #define RXON_RX_CHAIN_DRIVER_FORCE_MSK __constant_cpu_to_le16(0x1<<0)
  833. #define RXON_RX_CHAIN_VALID_MSK __constant_cpu_to_le16(0x7<<1)
  834. #define RXON_RX_CHAIN_VALID_POS (1)
  835. #define RXON_RX_CHAIN_FORCE_SEL_MSK __constant_cpu_to_le16(0x7<<4)
  836. #define RXON_RX_CHAIN_FORCE_SEL_POS (4)
  837. #define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK __constant_cpu_to_le16(0x7<<7)
  838. #define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
  839. #define RXON_RX_CHAIN_CNT_MSK __constant_cpu_to_le16(0x3<<10)
  840. #define RXON_RX_CHAIN_CNT_POS (10)
  841. #define RXON_RX_CHAIN_MIMO_CNT_MSK __constant_cpu_to_le16(0x3<<12)
  842. #define RXON_RX_CHAIN_MIMO_CNT_POS (12)
  843. #define RXON_RX_CHAIN_MIMO_FORCE_MSK __constant_cpu_to_le16(0x1<<14)
  844. #define RXON_RX_CHAIN_MIMO_FORCE_POS (14)
  845. #define MCS_DUP_6M_PLCP 0x20
  846. /* OFDM HT rate masks */
  847. /* ***************************************** */
  848. #define R_MCS_6M_MSK 0x1
  849. #define R_MCS_12M_MSK 0x2
  850. #define R_MCS_18M_MSK 0x4
  851. #define R_MCS_24M_MSK 0x8
  852. #define R_MCS_36M_MSK 0x10
  853. #define R_MCS_48M_MSK 0x20
  854. #define R_MCS_54M_MSK 0x40
  855. #define R_MCS_60M_MSK 0x80
  856. #define R_MCS_12M_DUAL_MSK 0x100
  857. #define R_MCS_24M_DUAL_MSK 0x200
  858. #define R_MCS_36M_DUAL_MSK 0x400
  859. #define R_MCS_48M_DUAL_MSK 0x800
  860. #define is_legacy(tbl) (((tbl) == LQ_G) || ((tbl) == LQ_A))
  861. #define is_siso(tbl) (((tbl) == LQ_SISO))
  862. #define is_mimo(tbl) (((tbl) == LQ_MIMO))
  863. #define is_Ht(tbl) (is_siso(tbl) || is_mimo(tbl))
  864. #define is_a_band(tbl) (((tbl) == LQ_A))
  865. #define is_g_and(tbl) (((tbl) == LQ_G))
  866. /* Flow Handler Definitions */
  867. /**********************/
  868. /* Addresses */
  869. /**********************/
  870. #define FH_MEM_LOWER_BOUND (0x1000)
  871. #define FH_MEM_UPPER_BOUND (0x1EF0)
  872. #define IWL_FH_REGS_LOWER_BOUND (0x1000)
  873. #define IWL_FH_REGS_UPPER_BOUND (0x2000)
  874. #define IWL_FH_KW_MEM_ADDR_REG (FH_MEM_LOWER_BOUND + 0x97C)
  875. /* CBBC Area - Circular buffers base address cache pointers table */
  876. #define FH_MEM_CBBC_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0)
  877. #define FH_MEM_CBBC_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10)
  878. /* queues 0 - 15 */
  879. #define FH_MEM_CBBC_QUEUE(x) (FH_MEM_CBBC_LOWER_BOUND + (x) * 0x4)
  880. /* RSCSR Area */
  881. #define FH_MEM_RSCSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xBC0)
  882. #define FH_MEM_RSCSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xC00)
  883. #define FH_MEM_RSCSR_CHNL0 (FH_MEM_RSCSR_LOWER_BOUND)
  884. #define FH_RSCSR_CHNL0_STTS_WPTR_REG (FH_MEM_RSCSR_CHNL0)
  885. #define FH_RSCSR_CHNL0_RBDCB_BASE_REG (FH_MEM_RSCSR_CHNL0 + 0x004)
  886. #define FH_RSCSR_CHNL0_RBDCB_WPTR_REG (FH_MEM_RSCSR_CHNL0 + 0x008)
  887. /* RCSR Area - Registers address map */
  888. #define FH_MEM_RCSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xC00)
  889. #define FH_MEM_RCSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xCC0)
  890. #define FH_MEM_RCSR_CHNL0 (FH_MEM_RCSR_LOWER_BOUND)
  891. #define FH_MEM_RCSR_CHNL0_CONFIG_REG (FH_MEM_RCSR_CHNL0)
  892. /* RSSR Area - Rx shared ctrl & status registers */
  893. #define FH_MEM_RSSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xC40)
  894. #define FH_MEM_RSSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xD00)
  895. #define FH_MEM_RSSR_SHARED_CTRL_REG (FH_MEM_RSSR_LOWER_BOUND)
  896. #define FH_MEM_RSSR_RX_STATUS_REG (FH_MEM_RSSR_LOWER_BOUND + 0x004)
  897. #define FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV (FH_MEM_RSSR_LOWER_BOUND + 0x008)
  898. /* TCSR */
  899. #define IWL_FH_TCSR_LOWER_BOUND (IWL_FH_REGS_LOWER_BOUND + 0xD00)
  900. #define IWL_FH_TCSR_UPPER_BOUND (IWL_FH_REGS_LOWER_BOUND + 0xE60)
  901. #define IWL_FH_TCSR_CHNL_NUM (7)
  902. #define IWL_FH_TCSR_CHNL_TX_CONFIG_REG(_chnl) \
  903. (IWL_FH_TCSR_LOWER_BOUND + 0x20 * _chnl)
  904. /* TSSR Area - Tx shared status registers */
  905. /* TSSR */
  906. #define IWL_FH_TSSR_LOWER_BOUND (IWL_FH_REGS_LOWER_BOUND + 0xEA0)
  907. #define IWL_FH_TSSR_UPPER_BOUND (IWL_FH_REGS_LOWER_BOUND + 0xEC0)
  908. #define IWL_FH_TSSR_TX_MSG_CONFIG_REG (IWL_FH_TSSR_LOWER_BOUND + 0x008)
  909. #define IWL_FH_TSSR_TX_STATUS_REG (IWL_FH_TSSR_LOWER_BOUND + 0x010)
  910. #define IWL_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON (0xFF000000)
  911. #define IWL_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON (0x00FF0000)
  912. #define IWL_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_64B (0x00000000)
  913. #define IWL_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B (0x00000400)
  914. #define IWL_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_256B (0x00000800)
  915. #define IWL_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_512B (0x00000C00)
  916. #define IWL_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON (0x00000100)
  917. #define IWL_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON (0x00000080)
  918. #define IWL_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH (0x00000020)
  919. #define IWL_FH_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH (0x00000005)
  920. #define IWL_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_chnl) \
  921. ((1 << (_chnl)) << 24)
  922. #define IWL_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_chnl) \
  923. ((1 << (_chnl)) << 16)
  924. #define IWL_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_chnl) \
  925. (IWL_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_chnl) | \
  926. IWL_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_chnl))
  927. /* TCSR: tx_config register values */
  928. #define IWL_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000)
  929. #define IWL_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRIVER (0x00000001)
  930. #define IWL_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_ARC (0x00000002)
  931. #define IWL_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL (0x00000000)
  932. #define IWL_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL (0x00000008)
  933. #define IWL_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_NOINT (0x00000000)
  934. #define IWL_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD (0x00100000)
  935. #define IWL_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000)
  936. #define IWL_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000)
  937. #define IWL_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_ENDTFD (0x00400000)
  938. #define IWL_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_IFTFD (0x00800000)
  939. #define IWL_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000)
  940. #define IWL_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE_EOF (0x40000000)
  941. #define IWL_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000)
  942. #define IWL_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_EMPTY (0x00000000)
  943. #define IWL_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_WAIT (0x00002000)
  944. #define IWL_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00000003)
  945. #define IWL_FH_TCSR_CHNL_TX_BUF_STS_REG_BIT_TFDB_WPTR (0x00000001)
  946. #define IWL_FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM (20)
  947. #define IWL_FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX (12)
  948. /* RCSR: channel 0 rx_config register defines */
  949. #define FH_RCSR_CHNL0_RX_CONFIG_DMA_CHNL_EN_MASK (0xC0000000) /* bits 30-31 */
  950. #define FH_RCSR_CHNL0_RX_CONFIG_RBDBC_SIZE_MASK (0x00F00000) /* bits 20-23 */
  951. #define FH_RCSR_CHNL0_RX_CONFIG_RB_SIZE_MASK (0x00030000) /* bits 16-17 */
  952. #define FH_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MASK (0x00008000) /* bit 15 */
  953. #define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_MASK (0x00001000) /* bit 12 */
  954. #define FH_RCSR_CHNL0_RX_CONFIG_RB_TIMEOUT_MASK (0x00000FF0) /* bit 4-11 */
  955. #define FH_RCSR_RX_CONFIG_RBDCB_SIZE_BITSHIFT (20)
  956. #define FH_RCSR_RX_CONFIG_RB_SIZE_BITSHIFT (16)
  957. /* RCSR: rx_config register values */
  958. #define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_VAL (0x00000000)
  959. #define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_EOF_VAL (0x40000000)
  960. #define FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL (0x80000000)
  961. #define IWL_FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K (0x00000000)
  962. /* RCSR channel 0 config register values */
  963. #define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_NO_INT_VAL (0x00000000)
  964. #define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL (0x00001000)
  965. /* RSCSR: defs used in normal mode */
  966. #define FH_RSCSR_CHNL0_RBDCB_WPTR_MASK (0x00000FFF) /* bits 0-11 */
  967. #define SCD_WIN_SIZE 64
  968. #define SCD_FRAME_LIMIT 64
  969. /* SRAM structures */
  970. #define SCD_CONTEXT_DATA_OFFSET 0x380
  971. #define SCD_TX_STTS_BITMAP_OFFSET 0x400
  972. #define SCD_TRANSLATE_TBL_OFFSET 0x500
  973. #define SCD_CONTEXT_QUEUE_OFFSET(x) (SCD_CONTEXT_DATA_OFFSET + ((x) * 8))
  974. #define SCD_TRANSLATE_TBL_OFFSET_QUEUE(x) \
  975. ((SCD_TRANSLATE_TBL_OFFSET + ((x) * 2)) & 0xfffffffc)
  976. #define SCD_TXFACT_REG_TXFIFO_MASK(lo, hi) \
  977. ((1<<(hi))|((1<<(hi))-(1<<(lo))))
  978. #define SCD_MODE_REG_BIT_SEARCH_MODE (1<<0)
  979. #define SCD_MODE_REG_BIT_SBYP_MODE (1<<1)
  980. #define SCD_TXFIFO_POS_TID (0)
  981. #define SCD_TXFIFO_POS_RA (4)
  982. #define SCD_QUEUE_STTS_REG_POS_ACTIVE (0)
  983. #define SCD_QUEUE_STTS_REG_POS_TXF (1)
  984. #define SCD_QUEUE_STTS_REG_POS_WSL (5)
  985. #define SCD_QUEUE_STTS_REG_POS_SCD_ACK (8)
  986. #define SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN (10)
  987. #define SCD_QUEUE_STTS_REG_MSK (0x0007FC00)
  988. #define SCD_QUEUE_RA_TID_MAP_RATID_MSK (0x01FF)
  989. #define SCD_QUEUE_CTX_REG1_WIN_SIZE_POS (0)
  990. #define SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK (0x0000007F)
  991. #define SCD_QUEUE_CTX_REG1_CREDIT_POS (8)
  992. #define SCD_QUEUE_CTX_REG1_CREDIT_MSK (0x00FFFF00)
  993. #define SCD_QUEUE_CTX_REG1_SUPER_CREDIT_POS (24)
  994. #define SCD_QUEUE_CTX_REG1_SUPER_CREDIT_MSK (0xFF000000)
  995. #define SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS (16)
  996. #define SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK (0x007F0000)
  997. #define CSR_HW_IF_CONFIG_REG_BIT_KEDRON_R (0x00000010)
  998. #define CSR_HW_IF_CONFIG_REG_MSK_BOARD_VER (0x00000C00)
  999. #define CSR_HW_IF_CONFIG_REG_BIT_MAC_SI (0x00000100)
  1000. #define CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI (0x00000200)
  1001. static inline u8 iwl4965_hw_get_rate(__le32 rate_n_flags)
  1002. {
  1003. return le32_to_cpu(rate_n_flags) & 0xFF;
  1004. }
  1005. static inline u16 iwl4965_hw_get_rate_n_flags(__le32 rate_n_flags)
  1006. {
  1007. return le32_to_cpu(rate_n_flags) & 0xFFFF;
  1008. }
  1009. static inline __le32 iwl4965_hw_set_rate_n_flags(u8 rate, u16 flags)
  1010. {
  1011. return cpu_to_le32(flags|(u16)rate);
  1012. }
  1013. struct iwl4965_tfd_frame_data {
  1014. __le32 tb1_addr;
  1015. __le32 val1;
  1016. /* __le32 ptb1_32_35:4; */
  1017. #define IWL_tb1_addr_hi_POS 0
  1018. #define IWL_tb1_addr_hi_LEN 4
  1019. #define IWL_tb1_addr_hi_SYM val1
  1020. /* __le32 tb_len1:12; */
  1021. #define IWL_tb1_len_POS 4
  1022. #define IWL_tb1_len_LEN 12
  1023. #define IWL_tb1_len_SYM val1
  1024. /* __le32 ptb2_0_15:16; */
  1025. #define IWL_tb2_addr_lo16_POS 16
  1026. #define IWL_tb2_addr_lo16_LEN 16
  1027. #define IWL_tb2_addr_lo16_SYM val1
  1028. __le32 val2;
  1029. /* __le32 ptb2_16_35:20; */
  1030. #define IWL_tb2_addr_hi20_POS 0
  1031. #define IWL_tb2_addr_hi20_LEN 20
  1032. #define IWL_tb2_addr_hi20_SYM val2
  1033. /* __le32 tb_len2:12; */
  1034. #define IWL_tb2_len_POS 20
  1035. #define IWL_tb2_len_LEN 12
  1036. #define IWL_tb2_len_SYM val2
  1037. } __attribute__ ((packed));
  1038. struct iwl4965_tfd_frame {
  1039. __le32 val0;
  1040. /* __le32 rsvd1:24; */
  1041. /* __le32 num_tbs:5; */
  1042. #define IWL_num_tbs_POS 24
  1043. #define IWL_num_tbs_LEN 5
  1044. #define IWL_num_tbs_SYM val0
  1045. /* __le32 rsvd2:1; */
  1046. /* __le32 padding:2; */
  1047. struct iwl4965_tfd_frame_data pa[10];
  1048. __le32 reserved;
  1049. } __attribute__ ((packed));
  1050. #define IWL4965_MAX_WIN_SIZE 64
  1051. #define IWL4965_QUEUE_SIZE 256
  1052. #define IWL4965_NUM_FIFOS 7
  1053. #define IWL_MAX_NUM_QUEUES 16
  1054. struct iwl4965_queue_byte_cnt_entry {
  1055. __le16 val;
  1056. /* __le16 byte_cnt:12; */
  1057. #define IWL_byte_cnt_POS 0
  1058. #define IWL_byte_cnt_LEN 12
  1059. #define IWL_byte_cnt_SYM val
  1060. /* __le16 rsvd:4; */
  1061. } __attribute__ ((packed));
  1062. struct iwl4965_sched_queue_byte_cnt_tbl {
  1063. struct iwl4965_queue_byte_cnt_entry tfd_offset[IWL4965_QUEUE_SIZE +
  1064. IWL4965_MAX_WIN_SIZE];
  1065. u8 dont_care[1024 -
  1066. (IWL4965_QUEUE_SIZE + IWL4965_MAX_WIN_SIZE) *
  1067. sizeof(__le16)];
  1068. } __attribute__ ((packed));
  1069. /* Base physical address of iwl4965_shared is provided to KDR_SCD_DRAM_BASE_ADDR
  1070. * and &iwl4965_shared.val0 is provided to FH_RSCSR_CHNL0_STTS_WPTR_REG */
  1071. struct iwl4965_shared {
  1072. struct iwl4965_sched_queue_byte_cnt_tbl
  1073. queues_byte_cnt_tbls[IWL_MAX_NUM_QUEUES];
  1074. __le32 val0;
  1075. /* __le32 rb_closed_stts_rb_num:12; */
  1076. #define IWL_rb_closed_stts_rb_num_POS 0
  1077. #define IWL_rb_closed_stts_rb_num_LEN 12
  1078. #define IWL_rb_closed_stts_rb_num_SYM val0
  1079. /* __le32 rsrv1:4; */
  1080. /* __le32 rb_closed_stts_rx_frame_num:12; */
  1081. #define IWL_rb_closed_stts_rx_frame_num_POS 16
  1082. #define IWL_rb_closed_stts_rx_frame_num_LEN 12
  1083. #define IWL_rb_closed_stts_rx_frame_num_SYM val0
  1084. /* __le32 rsrv2:4; */
  1085. __le32 val1;
  1086. /* __le32 frame_finished_stts_rb_num:12; */
  1087. #define IWL_frame_finished_stts_rb_num_POS 0
  1088. #define IWL_frame_finished_stts_rb_num_LEN 12
  1089. #define IWL_frame_finished_stts_rb_num_SYM val1
  1090. /* __le32 rsrv3:4; */
  1091. /* __le32 frame_finished_stts_rx_frame_num:12; */
  1092. #define IWL_frame_finished_stts_rx_frame_num_POS 16
  1093. #define IWL_frame_finished_stts_rx_frame_num_LEN 12
  1094. #define IWL_frame_finished_stts_rx_frame_num_SYM val1
  1095. /* __le32 rsrv4:4; */
  1096. __le32 padding1; /* so that allocation will be aligned to 16B */
  1097. __le32 padding2;
  1098. } __attribute__ ((packed));
  1099. #endif /* __iwl4965_4965_hw_h__ */