iwl-4965-hw.h 50 KB

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