iwl-3945-hw.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839
  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_3945_hw__
  64. #define __iwl_3945_hw__
  65. /*
  66. * uCode queue management definitions ...
  67. * Queue #4 is the command queue for 3945 and 4965.
  68. */
  69. #define IWL_CMD_QUEUE_NUM 4
  70. /* Tx rates */
  71. #define IWL_CCK_RATES 4
  72. #define IWL_OFDM_RATES 8
  73. #define IWL_HT_RATES 0
  74. #define IWL_MAX_RATES (IWL_CCK_RATES+IWL_OFDM_RATES+IWL_HT_RATES)
  75. /* Time constants */
  76. #define SHORT_SLOT_TIME 9
  77. #define LONG_SLOT_TIME 20
  78. /* RSSI to dBm */
  79. #define IWL_RSSI_OFFSET 95
  80. /*
  81. * EEPROM related constants, enums, and structures.
  82. */
  83. /*
  84. * EEPROM access time values:
  85. *
  86. * Driver initiates EEPROM read by writing byte address << 1 to CSR_EEPROM_REG,
  87. * then clearing (with subsequent read/modify/write) CSR_EEPROM_REG bit
  88. * CSR_EEPROM_REG_BIT_CMD (0x2).
  89. * Driver then polls CSR_EEPROM_REG for CSR_EEPROM_REG_READ_VALID_MSK (0x1).
  90. * When polling, wait 10 uSec between polling loops, up to a maximum 5000 uSec.
  91. * Driver reads 16-bit value from bits 31-16 of CSR_EEPROM_REG.
  92. */
  93. #define IWL_EEPROM_ACCESS_TIMEOUT 5000 /* uSec */
  94. #define IWL_EEPROM_ACCESS_DELAY 10 /* uSec */
  95. /* EEPROM field values */
  96. #define ANTENNA_SWITCH_NORMAL 0
  97. #define ANTENNA_SWITCH_INVERSE 1
  98. /*
  99. * Regulatory channel usage flags in EEPROM struct iwl_eeprom_channel.flags.
  100. *
  101. * IBSS and/or AP operation is allowed *only* on those channels with
  102. * (VALID && IBSS && ACTIVE && !RADAR). This restriction is in place because
  103. * RADAR detection is not supported by the 3945 driver, but is a
  104. * requirement for establishing a new network for legal operation on channels
  105. * requiring RADAR detection or restricting ACTIVE scanning.
  106. *
  107. * NOTE: "WIDE" flag indicates that 20 MHz channel is supported;
  108. * 3945 does not support FAT 40 MHz-wide channels.
  109. *
  110. * NOTE: Using a channel inappropriately will result in a uCode error!
  111. */
  112. enum {
  113. EEPROM_CHANNEL_VALID = (1 << 0), /* usable for this SKU/geo */
  114. EEPROM_CHANNEL_IBSS = (1 << 1), /* usable as an IBSS channel */
  115. /* Bit 2 Reserved */
  116. EEPROM_CHANNEL_ACTIVE = (1 << 3), /* active scanning allowed */
  117. EEPROM_CHANNEL_RADAR = (1 << 4), /* radar detection required */
  118. EEPROM_CHANNEL_WIDE = (1 << 5), /* 20 MHz channel okay */
  119. EEPROM_CHANNEL_NARROW = (1 << 6), /* 10 MHz channel, not used */
  120. EEPROM_CHANNEL_DFS = (1 << 7), /* dynamic freq selection candidate */
  121. };
  122. /* EEPROM field lengths */
  123. #define EEPROM_BOARD_PBA_NUMBER_LENGTH 11
  124. /* EEPROM field lengths */
  125. #define EEPROM_BOARD_PBA_NUMBER_LENGTH 11
  126. #define EEPROM_REGULATORY_SKU_ID_LENGTH 4
  127. #define EEPROM_REGULATORY_BAND1_CHANNELS_LENGTH 14
  128. #define EEPROM_REGULATORY_BAND2_CHANNELS_LENGTH 13
  129. #define EEPROM_REGULATORY_BAND3_CHANNELS_LENGTH 12
  130. #define EEPROM_REGULATORY_BAND4_CHANNELS_LENGTH 11
  131. #define EEPROM_REGULATORY_BAND5_CHANNELS_LENGTH 6
  132. #define EEPROM_REGULATORY_CHANNELS_LENGTH ( \
  133. EEPROM_REGULATORY_BAND1_CHANNELS_LENGTH + \
  134. EEPROM_REGULATORY_BAND2_CHANNELS_LENGTH + \
  135. EEPROM_REGULATORY_BAND3_CHANNELS_LENGTH + \
  136. EEPROM_REGULATORY_BAND4_CHANNELS_LENGTH + \
  137. EEPROM_REGULATORY_BAND5_CHANNELS_LENGTH)
  138. #define EEPROM_REGULATORY_NUMBER_OF_BANDS 5
  139. /* SKU Capabilities */
  140. #define EEPROM_SKU_CAP_SW_RF_KILL_ENABLE (1 << 0)
  141. #define EEPROM_SKU_CAP_HW_RF_KILL_ENABLE (1 << 1)
  142. #define EEPROM_SKU_CAP_OP_MODE_MRC (1 << 7)
  143. /* *regulatory* channel data from eeprom, one for each channel */
  144. struct iwl3945_eeprom_channel {
  145. u8 flags; /* flags copied from EEPROM */
  146. s8 max_power_avg; /* max power (dBm) on this chnl, limit 31 */
  147. } __attribute__ ((packed));
  148. /*
  149. * Mapping of a Tx power level, at factory calibration temperature,
  150. * to a radio/DSP gain table index.
  151. * One for each of 5 "sample" power levels in each band.
  152. * v_det is measured at the factory, using the 3945's built-in power amplifier
  153. * (PA) output voltage detector. This same detector is used during Tx of
  154. * long packets in normal operation to provide feedback as to proper output
  155. * level.
  156. * Data copied from EEPROM.
  157. * DO NOT ALTER THIS STRUCTURE!!!
  158. */
  159. struct iwl3945_eeprom_txpower_sample {
  160. u8 gain_index; /* index into power (gain) setup table ... */
  161. s8 power; /* ... for this pwr level for this chnl group */
  162. u16 v_det; /* PA output voltage */
  163. } __attribute__ ((packed));
  164. /*
  165. * Mappings of Tx power levels -> nominal radio/DSP gain table indexes.
  166. * One for each channel group (a.k.a. "band") (1 for BG, 4 for A).
  167. * Tx power setup code interpolates between the 5 "sample" power levels
  168. * to determine the nominal setup for a requested power level.
  169. * Data copied from EEPROM.
  170. * DO NOT ALTER THIS STRUCTURE!!!
  171. */
  172. struct iwl3945_eeprom_txpower_group {
  173. struct iwl3945_eeprom_txpower_sample samples[5]; /* 5 power levels */
  174. s32 a, b, c, d, e; /* coefficients for voltage->power
  175. * formula (signed) */
  176. s32 Fa, Fb, Fc, Fd, Fe; /* these modify coeffs based on
  177. * frequency (signed) */
  178. s8 saturation_power; /* highest power possible by h/w in this
  179. * band */
  180. u8 group_channel; /* "representative" channel # in this band */
  181. s16 temperature; /* h/w temperature at factory calib this band
  182. * (signed) */
  183. } __attribute__ ((packed));
  184. /*
  185. * Temperature-based Tx-power compensation data, not band-specific.
  186. * These coefficients are use to modify a/b/c/d/e coeffs based on
  187. * difference between current temperature and factory calib temperature.
  188. * Data copied from EEPROM.
  189. */
  190. struct iwl3945_eeprom_temperature_corr {
  191. u32 Ta;
  192. u32 Tb;
  193. u32 Tc;
  194. u32 Td;
  195. u32 Te;
  196. } __attribute__ ((packed));
  197. /*
  198. * EEPROM map
  199. */
  200. struct iwl3945_eeprom {
  201. u8 reserved0[16];
  202. #define EEPROM_DEVICE_ID (2*0x08) /* 2 bytes */
  203. u16 device_id; /* abs.ofs: 16 */
  204. u8 reserved1[2];
  205. #define EEPROM_PMC (2*0x0A) /* 2 bytes */
  206. u16 pmc; /* abs.ofs: 20 */
  207. u8 reserved2[20];
  208. #define EEPROM_MAC_ADDRESS (2*0x15) /* 6 bytes */
  209. u8 mac_address[6]; /* abs.ofs: 42 */
  210. u8 reserved3[58];
  211. #define EEPROM_BOARD_REVISION (2*0x35) /* 2 bytes */
  212. u16 board_revision; /* abs.ofs: 106 */
  213. u8 reserved4[11];
  214. #define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1) /* 9 bytes */
  215. u8 board_pba_number[9]; /* abs.ofs: 119 */
  216. u8 reserved5[8];
  217. #define EEPROM_VERSION (2*0x44) /* 2 bytes */
  218. u16 version; /* abs.ofs: 136 */
  219. #define EEPROM_SKU_CAP (2*0x45) /* 1 bytes */
  220. u8 sku_cap; /* abs.ofs: 138 */
  221. #define EEPROM_LEDS_MODE (2*0x45+1) /* 1 bytes */
  222. u8 leds_mode; /* abs.ofs: 139 */
  223. #define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */
  224. u16 oem_mode;
  225. #define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */
  226. u16 wowlan_mode; /* abs.ofs: 142 */
  227. #define EEPROM_LEDS_TIME_INTERVAL (2*0x48) /* 2 bytes */
  228. u16 leds_time_interval; /* abs.ofs: 144 */
  229. #define EEPROM_LEDS_OFF_TIME (2*0x49) /* 1 bytes */
  230. u8 leds_off_time; /* abs.ofs: 146 */
  231. #define EEPROM_LEDS_ON_TIME (2*0x49+1) /* 1 bytes */
  232. u8 leds_on_time; /* abs.ofs: 147 */
  233. #define EEPROM_ALMGOR_M_VERSION (2*0x4A) /* 1 bytes */
  234. u8 almgor_m_version; /* abs.ofs: 148 */
  235. #define EEPROM_ANTENNA_SWITCH_TYPE (2*0x4A+1) /* 1 bytes */
  236. u8 antenna_switch_type; /* abs.ofs: 149 */
  237. u8 reserved6[42];
  238. #define EEPROM_REGULATORY_SKU_ID (2*0x60) /* 4 bytes */
  239. u8 sku_id[4]; /* abs.ofs: 192 */
  240. /*
  241. * Per-channel regulatory data.
  242. *
  243. * Each channel that *might* be supported by 3945 or 4965 has a fixed location
  244. * in EEPROM containing EEPROM_CHANNEL_* usage flags (LSB) and max regulatory
  245. * txpower (MSB).
  246. *
  247. * Entries immediately below are for 20 MHz channel width. FAT (40 MHz)
  248. * channels (only for 4965, not supported by 3945) appear later in the EEPROM.
  249. *
  250. * 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
  251. */
  252. #define EEPROM_REGULATORY_BAND_1 (2*0x62) /* 2 bytes */
  253. u16 band_1_count; /* abs.ofs: 196 */
  254. #define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63) /* 28 bytes */
  255. struct iwl3945_eeprom_channel band_1_channels[14]; /* abs.ofs: 196 */
  256. /*
  257. * 4.9 GHz channels 183, 184, 185, 187, 188, 189, 192, 196,
  258. * 5.0 GHz channels 7, 8, 11, 12, 16
  259. * (4915-5080MHz) (none of these is ever supported)
  260. */
  261. #define EEPROM_REGULATORY_BAND_2 (2*0x71) /* 2 bytes */
  262. u16 band_2_count; /* abs.ofs: 226 */
  263. #define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72) /* 26 bytes */
  264. struct iwl3945_eeprom_channel band_2_channels[13]; /* abs.ofs: 228 */
  265. /*
  266. * 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64
  267. * (5170-5320MHz)
  268. */
  269. #define EEPROM_REGULATORY_BAND_3 (2*0x7F) /* 2 bytes */
  270. u16 band_3_count; /* abs.ofs: 254 */
  271. #define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80) /* 24 bytes */
  272. struct iwl3945_eeprom_channel band_3_channels[12]; /* abs.ofs: 256 */
  273. /*
  274. * 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
  275. * (5500-5700MHz)
  276. */
  277. #define EEPROM_REGULATORY_BAND_4 (2*0x8C) /* 2 bytes */
  278. u16 band_4_count; /* abs.ofs: 280 */
  279. #define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D) /* 22 bytes */
  280. struct iwl3945_eeprom_channel band_4_channels[11]; /* abs.ofs: 282 */
  281. /*
  282. * 5.7 GHz channels 145, 149, 153, 157, 161, 165
  283. * (5725-5825MHz)
  284. */
  285. #define EEPROM_REGULATORY_BAND_5 (2*0x98) /* 2 bytes */
  286. u16 band_5_count; /* abs.ofs: 304 */
  287. #define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99) /* 12 bytes */
  288. struct iwl3945_eeprom_channel band_5_channels[6]; /* abs.ofs: 306 */
  289. u8 reserved9[194];
  290. /*
  291. * 3945 Txpower calibration data.
  292. */
  293. #define EEPROM_TXPOWER_CALIB_GROUP0 0x200
  294. #define EEPROM_TXPOWER_CALIB_GROUP1 0x240
  295. #define EEPROM_TXPOWER_CALIB_GROUP2 0x280
  296. #define EEPROM_TXPOWER_CALIB_GROUP3 0x2c0
  297. #define EEPROM_TXPOWER_CALIB_GROUP4 0x300
  298. #define IWL_NUM_TX_CALIB_GROUPS 5
  299. struct iwl3945_eeprom_txpower_group groups[IWL_NUM_TX_CALIB_GROUPS];
  300. /* abs.ofs: 512 */
  301. #define EEPROM_CALIB_TEMPERATURE_CORRECT 0x340
  302. struct iwl3945_eeprom_temperature_corr corrections; /* abs.ofs: 832 */
  303. u8 reserved16[172]; /* fill out to full 1024 byte block */
  304. } __attribute__ ((packed));
  305. #define IWL_EEPROM_IMAGE_SIZE 1024
  306. /* End of EEPROM */
  307. #include "iwl-3945-commands.h"
  308. #define PCI_LINK_CTRL 0x0F0
  309. #define PCI_POWER_SOURCE 0x0C8
  310. #define PCI_REG_WUM8 0x0E8
  311. #define PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT (0x80000000)
  312. /*=== CSR (control and status registers) ===*/
  313. #define CSR_BASE (0x000)
  314. #define CSR_SW_VER (CSR_BASE+0x000)
  315. #define CSR_HW_IF_CONFIG_REG (CSR_BASE+0x000) /* hardware interface config */
  316. #define CSR_INT_COALESCING (CSR_BASE+0x004) /* accum ints, 32-usec units */
  317. #define CSR_INT (CSR_BASE+0x008) /* host interrupt status/ack */
  318. #define CSR_INT_MASK (CSR_BASE+0x00c) /* host interrupt enable */
  319. #define CSR_FH_INT_STATUS (CSR_BASE+0x010) /* busmaster int status/ack*/
  320. #define CSR_GPIO_IN (CSR_BASE+0x018) /* read external chip pins */
  321. #define CSR_RESET (CSR_BASE+0x020) /* busmaster enable, NMI, etc*/
  322. #define CSR_GP_CNTRL (CSR_BASE+0x024)
  323. /*
  324. * Hardware revision info
  325. * Bit fields:
  326. * 31-8: Reserved
  327. * 7-4: Type of device: 0x0 = 4965, 0xd = 3945
  328. * 3-2: Revision step: 0 = A, 1 = B, 2 = C, 3 = D
  329. * 1-0: "Dash" value, as in A-1, etc.
  330. */
  331. #define CSR_HW_REV (CSR_BASE+0x028)
  332. /* EEPROM reads */
  333. #define CSR_EEPROM_REG (CSR_BASE+0x02c)
  334. #define CSR_EEPROM_GP (CSR_BASE+0x030)
  335. #define CSR_GP_UCODE (CSR_BASE+0x044)
  336. #define CSR_UCODE_DRV_GP1 (CSR_BASE+0x054)
  337. #define CSR_UCODE_DRV_GP1_SET (CSR_BASE+0x058)
  338. #define CSR_UCODE_DRV_GP1_CLR (CSR_BASE+0x05c)
  339. #define CSR_UCODE_DRV_GP2 (CSR_BASE+0x060)
  340. #define CSR_GIO_CHICKEN_BITS (CSR_BASE+0x100)
  341. /* Analog phase-lock-loop configuration (3945 only)
  342. * Set bit 24. */
  343. #define CSR_ANA_PLL_CFG (CSR_BASE+0x20c)
  344. /* Bits for CSR_HW_IF_CONFIG_REG */
  345. #define CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MB (0x00000100)
  346. #define CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MM (0x00000200)
  347. #define CSR_HW_IF_CONFIG_REG_BIT_SKU_MRC (0x00000400)
  348. #define CSR_HW_IF_CONFIG_REG_BIT_BOARD_TYPE (0x00000800)
  349. #define CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A (0x00000000)
  350. #define CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B (0x00001000)
  351. #define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM (0x00200000)
  352. /* interrupt flags in INTA, set by uCode or hardware (e.g. dma),
  353. * acknowledged (reset) by host writing "1" to flagged bits. */
  354. #define CSR_INT_BIT_FH_RX (1<<31) /* Rx DMA, cmd responses, FH_INT[17:16] */
  355. #define CSR_INT_BIT_HW_ERR (1<<29) /* DMA hardware error FH_INT[31] */
  356. #define CSR_INT_BIT_DNLD (1<<28) /* uCode Download */
  357. #define CSR_INT_BIT_FH_TX (1<<27) /* Tx DMA FH_INT[1:0] */
  358. #define CSR_INT_BIT_MAC_CLK_ACTV (1<<26) /* NIC controller's clock toggled on/off */
  359. #define CSR_INT_BIT_SW_ERR (1<<25) /* uCode error */
  360. #define CSR_INT_BIT_RF_KILL (1<<7) /* HW RFKILL switch GP_CNTRL[27] toggled */
  361. #define CSR_INT_BIT_CT_KILL (1<<6) /* Critical temp (chip too hot) rfkill */
  362. #define CSR_INT_BIT_SW_RX (1<<3) /* Rx, command responses, 3945 */
  363. #define CSR_INT_BIT_WAKEUP (1<<1) /* NIC controller waking up (pwr mgmt) */
  364. #define CSR_INT_BIT_ALIVE (1<<0) /* uCode interrupts once it initializes */
  365. #define CSR_INI_SET_MASK (CSR_INT_BIT_FH_RX | \
  366. CSR_INT_BIT_HW_ERR | \
  367. CSR_INT_BIT_FH_TX | \
  368. CSR_INT_BIT_SW_ERR | \
  369. CSR_INT_BIT_RF_KILL | \
  370. CSR_INT_BIT_SW_RX | \
  371. CSR_INT_BIT_WAKEUP | \
  372. CSR_INT_BIT_ALIVE)
  373. /* interrupt flags in FH (flow handler) (PCI busmaster DMA) */
  374. #define CSR_FH_INT_BIT_ERR (1<<31) /* Error */
  375. #define CSR_FH_INT_BIT_HI_PRIOR (1<<30) /* High priority Rx, bypass coalescing */
  376. #define CSR_FH_INT_BIT_RX_CHNL2 (1<<18) /* Rx channel 2 (3945 only) */
  377. #define CSR_FH_INT_BIT_RX_CHNL1 (1<<17) /* Rx channel 1 */
  378. #define CSR_FH_INT_BIT_RX_CHNL0 (1<<16) /* Rx channel 0 */
  379. #define CSR_FH_INT_BIT_TX_CHNL6 (1<<6) /* Tx channel 6 (3945 only) */
  380. #define CSR_FH_INT_BIT_TX_CHNL1 (1<<1) /* Tx channel 1 */
  381. #define CSR_FH_INT_BIT_TX_CHNL0 (1<<0) /* Tx channel 0 */
  382. #define CSR_FH_INT_RX_MASK (CSR_FH_INT_BIT_HI_PRIOR | \
  383. CSR_FH_INT_BIT_RX_CHNL2 | \
  384. CSR_FH_INT_BIT_RX_CHNL1 | \
  385. CSR_FH_INT_BIT_RX_CHNL0)
  386. #define CSR_FH_INT_TX_MASK (CSR_FH_INT_BIT_TX_CHNL6 | \
  387. CSR_FH_INT_BIT_TX_CHNL1 | \
  388. CSR_FH_INT_BIT_TX_CHNL0)
  389. /* RESET */
  390. #define CSR_RESET_REG_FLAG_NEVO_RESET (0x00000001)
  391. #define CSR_RESET_REG_FLAG_FORCE_NMI (0x00000002)
  392. #define CSR_RESET_REG_FLAG_SW_RESET (0x00000080)
  393. #define CSR_RESET_REG_FLAG_MASTER_DISABLED (0x00000100)
  394. #define CSR_RESET_REG_FLAG_STOP_MASTER (0x00000200)
  395. /* GP (general purpose) CONTROL */
  396. #define CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY (0x00000001)
  397. #define CSR_GP_CNTRL_REG_FLAG_INIT_DONE (0x00000004)
  398. #define CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ (0x00000008)
  399. #define CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP (0x00000010)
  400. #define CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN (0x00000001)
  401. #define CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE (0x07000000)
  402. #define CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE (0x04000000)
  403. #define CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW (0x08000000)
  404. /* EEPROM REG */
  405. #define CSR_EEPROM_REG_READ_VALID_MSK (0x00000001)
  406. #define CSR_EEPROM_REG_BIT_CMD (0x00000002)
  407. /* EEPROM GP */
  408. #define CSR_EEPROM_GP_VALID_MSK (0x00000006)
  409. #define CSR_EEPROM_GP_BAD_SIGNATURE (0x00000000)
  410. #define CSR_EEPROM_GP_IF_OWNER_MSK (0x00000180)
  411. /* UCODE DRV GP */
  412. #define CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP (0x00000001)
  413. #define CSR_UCODE_SW_BIT_RFKILL (0x00000002)
  414. #define CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED (0x00000004)
  415. #define CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT (0x00000008)
  416. /* GPIO */
  417. #define CSR_GPIO_IN_BIT_AUX_POWER (0x00000200)
  418. #define CSR_GPIO_IN_VAL_VAUX_PWR_SRC (0x00000000)
  419. #define CSR_GPIO_IN_VAL_VMAIN_PWR_SRC CSR_GPIO_IN_BIT_AUX_POWER
  420. /* GI Chicken Bits */
  421. #define CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX (0x00800000)
  422. #define CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER (0x20000000)
  423. /* CSR_ANA_PLL_CFG */
  424. #define CSR_ANA_PLL_CFG_SH (0x00880300)
  425. /*=== HBUS (Host-side Bus) ===*/
  426. #define HBUS_BASE (0x400)
  427. /*
  428. * Registers for accessing device's internal SRAM memory (e.g. SCD SRAM
  429. * structures, error log, event log, verifying uCode load).
  430. * First write to address register, then read from or write to data register
  431. * to complete the job. Once the address register is set up, accesses to
  432. * data registers auto-increment the address by one dword.
  433. * Bit usage for address registers (read or write):
  434. * 0-31: memory address within device
  435. */
  436. #define HBUS_TARG_MEM_RADDR (HBUS_BASE+0x00c)
  437. #define HBUS_TARG_MEM_WADDR (HBUS_BASE+0x010)
  438. #define HBUS_TARG_MEM_WDAT (HBUS_BASE+0x018)
  439. #define HBUS_TARG_MEM_RDAT (HBUS_BASE+0x01c)
  440. /*
  441. * Registers for accessing device's internal peripheral registers
  442. * (e.g. SCD, BSM, etc.). First write to address register,
  443. * then read from or write to data register to complete the job.
  444. * Bit usage for address registers (read or write):
  445. * 0-15: register address (offset) within device
  446. * 24-25: (# bytes - 1) to read or write (e.g. 3 for dword)
  447. */
  448. #define HBUS_TARG_PRPH_WADDR (HBUS_BASE+0x044)
  449. #define HBUS_TARG_PRPH_RADDR (HBUS_BASE+0x048)
  450. #define HBUS_TARG_PRPH_WDAT (HBUS_BASE+0x04c)
  451. #define HBUS_TARG_PRPH_RDAT (HBUS_BASE+0x050)
  452. /*
  453. * Per-Tx-queue write pointer (index, really!) (3945 and 4965).
  454. * Indicates index to next TFD that driver will fill (1 past latest filled).
  455. * Bit usage:
  456. * 0-7: queue write index
  457. * 11-8: queue selector
  458. */
  459. #define HBUS_TARG_WRPTR (HBUS_BASE+0x060)
  460. /* SCD (3945 Tx Frame Scheduler) */
  461. #define SCD_BASE (CSR_BASE + 0x2E00)
  462. #define SCD_MODE_REG (SCD_BASE + 0x000)
  463. #define SCD_ARASTAT_REG (SCD_BASE + 0x004)
  464. #define SCD_TXFACT_REG (SCD_BASE + 0x010)
  465. #define SCD_TXF4MF_REG (SCD_BASE + 0x014)
  466. #define SCD_TXF5MF_REG (SCD_BASE + 0x020)
  467. #define SCD_SBYP_MODE_1_REG (SCD_BASE + 0x02C)
  468. #define SCD_SBYP_MODE_2_REG (SCD_BASE + 0x030)
  469. /*=== FH (data Flow Handler) ===*/
  470. #define FH_BASE (0x800)
  471. #define FH_CBCC_TABLE (FH_BASE+0x140)
  472. #define FH_TFDB_TABLE (FH_BASE+0x180)
  473. #define FH_RCSR_TABLE (FH_BASE+0x400)
  474. #define FH_RSSR_TABLE (FH_BASE+0x4c0)
  475. #define FH_TCSR_TABLE (FH_BASE+0x500)
  476. #define FH_TSSR_TABLE (FH_BASE+0x680)
  477. /* TFDB (Transmit Frame Buffer Descriptor) */
  478. #define FH_TFDB(_channel, buf) \
  479. (FH_TFDB_TABLE+((_channel)*2+(buf))*0x28)
  480. #define ALM_FH_TFDB_CHNL_BUF_CTRL_REG(_channel) \
  481. (FH_TFDB_TABLE + 0x50 * _channel)
  482. /* CBCC _channel is [0,2] */
  483. #define FH_CBCC(_channel) (FH_CBCC_TABLE+(_channel)*0x8)
  484. #define FH_CBCC_CTRL(_channel) (FH_CBCC(_channel)+0x00)
  485. #define FH_CBCC_BASE(_channel) (FH_CBCC(_channel)+0x04)
  486. /* RCSR _channel is [0,2] */
  487. #define FH_RCSR(_channel) (FH_RCSR_TABLE+(_channel)*0x40)
  488. #define FH_RCSR_CONFIG(_channel) (FH_RCSR(_channel)+0x00)
  489. #define FH_RCSR_RBD_BASE(_channel) (FH_RCSR(_channel)+0x04)
  490. #define FH_RCSR_WPTR(_channel) (FH_RCSR(_channel)+0x20)
  491. #define FH_RCSR_RPTR_ADDR(_channel) (FH_RCSR(_channel)+0x24)
  492. #define FH_RSCSR_CHNL0_WPTR (FH_RCSR_WPTR(0))
  493. /* RSSR */
  494. #define FH_RSSR_CTRL (FH_RSSR_TABLE+0x000)
  495. #define FH_RSSR_STATUS (FH_RSSR_TABLE+0x004)
  496. /* TCSR */
  497. #define FH_TCSR(_channel) (FH_TCSR_TABLE+(_channel)*0x20)
  498. #define FH_TCSR_CONFIG(_channel) (FH_TCSR(_channel)+0x00)
  499. #define FH_TCSR_CREDIT(_channel) (FH_TCSR(_channel)+0x04)
  500. #define FH_TCSR_BUFF_STTS(_channel) (FH_TCSR(_channel)+0x08)
  501. /* TSSR */
  502. #define FH_TSSR_CBB_BASE (FH_TSSR_TABLE+0x000)
  503. #define FH_TSSR_MSG_CONFIG (FH_TSSR_TABLE+0x008)
  504. #define FH_TSSR_TX_STATUS (FH_TSSR_TABLE+0x010)
  505. /* 18 - reserved */
  506. /* card static random access memory (SRAM) for processor data and instructs */
  507. #define RTC_INST_LOWER_BOUND (0x000000)
  508. #define RTC_DATA_LOWER_BOUND (0x800000)
  509. /* DBM */
  510. #define ALM_FH_SRVC_CHNL (6)
  511. #define ALM_FH_RCSR_RX_CONFIG_REG_POS_RBDC_SIZE (20)
  512. #define ALM_FH_RCSR_RX_CONFIG_REG_POS_IRQ_RBTH (4)
  513. #define ALM_FH_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN (0x08000000)
  514. #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE (0x80000000)
  515. #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE (0x20000000)
  516. #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_MAX_FRAG_SIZE_128 (0x01000000)
  517. #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_IRQ_DEST_INT_HOST (0x00001000)
  518. #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH (0x00000000)
  519. #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000)
  520. #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRIVER (0x00000001)
  521. #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL (0x00000000)
  522. #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL (0x00000008)
  523. #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000)
  524. #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000)
  525. #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000)
  526. #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000)
  527. #define ALM_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00004000)
  528. #define ALM_FH_TCSR_CHNL_TX_BUF_STS_REG_BIT_TFDB_WPTR (0x00000001)
  529. #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON (0xFF000000)
  530. #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON (0x00FF0000)
  531. #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B (0x00000400)
  532. #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON (0x00000100)
  533. #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON (0x00000080)
  534. #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH (0x00000020)
  535. #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH (0x00000005)
  536. #define ALM_TB_MAX_BYTES_COUNT (0xFFF0)
  537. #define ALM_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_channel) \
  538. ((1LU << _channel) << 24)
  539. #define ALM_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_channel) \
  540. ((1LU << _channel) << 16)
  541. #define ALM_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_channel) \
  542. (ALM_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_channel) | \
  543. ALM_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_channel))
  544. #define PCI_CFG_REV_ID_BIT_BASIC_SKU (0x40) /* bit 6 */
  545. #define PCI_CFG_REV_ID_BIT_RTP (0x80) /* bit 7 */
  546. #define HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED (0x00000004)
  547. #define TFD_QUEUE_MIN 0
  548. #define TFD_QUEUE_MAX 6
  549. #define TFD_QUEUE_SIZE_MAX (256)
  550. /* spectrum and channel data structures */
  551. #define IWL_NUM_SCAN_RATES (2)
  552. #define IWL_SCAN_FLAG_24GHZ (1<<0)
  553. #define IWL_SCAN_FLAG_52GHZ (1<<1)
  554. #define IWL_SCAN_FLAG_ACTIVE (1<<2)
  555. #define IWL_SCAN_FLAG_DIRECT (1<<3)
  556. #define IWL_MAX_CMD_SIZE 1024
  557. #define IWL_DEFAULT_TX_RETRY 15
  558. #define IWL_MAX_TX_RETRY 16
  559. /*********************************************/
  560. #define RFD_SIZE 4
  561. #define NUM_TFD_CHUNKS 4
  562. #define RX_QUEUE_SIZE 256
  563. #define RX_QUEUE_MASK 255
  564. #define RX_QUEUE_SIZE_LOG 8
  565. /* QoS definitions */
  566. #define CW_MIN_OFDM 15
  567. #define CW_MAX_OFDM 1023
  568. #define CW_MIN_CCK 31
  569. #define CW_MAX_CCK 1023
  570. #define QOS_TX0_CW_MIN_OFDM CW_MIN_OFDM
  571. #define QOS_TX1_CW_MIN_OFDM CW_MIN_OFDM
  572. #define QOS_TX2_CW_MIN_OFDM ((CW_MIN_OFDM + 1) / 2 - 1)
  573. #define QOS_TX3_CW_MIN_OFDM ((CW_MIN_OFDM + 1) / 4 - 1)
  574. #define QOS_TX0_CW_MIN_CCK CW_MIN_CCK
  575. #define QOS_TX1_CW_MIN_CCK CW_MIN_CCK
  576. #define QOS_TX2_CW_MIN_CCK ((CW_MIN_CCK + 1) / 2 - 1)
  577. #define QOS_TX3_CW_MIN_CCK ((CW_MIN_CCK + 1) / 4 - 1)
  578. #define QOS_TX0_CW_MAX_OFDM CW_MAX_OFDM
  579. #define QOS_TX1_CW_MAX_OFDM CW_MAX_OFDM
  580. #define QOS_TX2_CW_MAX_OFDM CW_MIN_OFDM
  581. #define QOS_TX3_CW_MAX_OFDM ((CW_MIN_OFDM + 1) / 2 - 1)
  582. #define QOS_TX0_CW_MAX_CCK CW_MAX_CCK
  583. #define QOS_TX1_CW_MAX_CCK CW_MAX_CCK
  584. #define QOS_TX2_CW_MAX_CCK CW_MIN_CCK
  585. #define QOS_TX3_CW_MAX_CCK ((CW_MIN_CCK + 1) / 2 - 1)
  586. #define QOS_TX0_AIFS 3
  587. #define QOS_TX1_AIFS 7
  588. #define QOS_TX2_AIFS 2
  589. #define QOS_TX3_AIFS 2
  590. #define QOS_TX0_ACM 0
  591. #define QOS_TX1_ACM 0
  592. #define QOS_TX2_ACM 0
  593. #define QOS_TX3_ACM 0
  594. #define QOS_TX0_TXOP_LIMIT_CCK 0
  595. #define QOS_TX1_TXOP_LIMIT_CCK 0
  596. #define QOS_TX2_TXOP_LIMIT_CCK 6016
  597. #define QOS_TX3_TXOP_LIMIT_CCK 3264
  598. #define QOS_TX0_TXOP_LIMIT_OFDM 0
  599. #define QOS_TX1_TXOP_LIMIT_OFDM 0
  600. #define QOS_TX2_TXOP_LIMIT_OFDM 3008
  601. #define QOS_TX3_TXOP_LIMIT_OFDM 1504
  602. #define DEF_TX0_CW_MIN_OFDM CW_MIN_OFDM
  603. #define DEF_TX1_CW_MIN_OFDM CW_MIN_OFDM
  604. #define DEF_TX2_CW_MIN_OFDM CW_MIN_OFDM
  605. #define DEF_TX3_CW_MIN_OFDM CW_MIN_OFDM
  606. #define DEF_TX0_CW_MIN_CCK CW_MIN_CCK
  607. #define DEF_TX1_CW_MIN_CCK CW_MIN_CCK
  608. #define DEF_TX2_CW_MIN_CCK CW_MIN_CCK
  609. #define DEF_TX3_CW_MIN_CCK CW_MIN_CCK
  610. #define DEF_TX0_CW_MAX_OFDM CW_MAX_OFDM
  611. #define DEF_TX1_CW_MAX_OFDM CW_MAX_OFDM
  612. #define DEF_TX2_CW_MAX_OFDM CW_MAX_OFDM
  613. #define DEF_TX3_CW_MAX_OFDM CW_MAX_OFDM
  614. #define DEF_TX0_CW_MAX_CCK CW_MAX_CCK
  615. #define DEF_TX1_CW_MAX_CCK CW_MAX_CCK
  616. #define DEF_TX2_CW_MAX_CCK CW_MAX_CCK
  617. #define DEF_TX3_CW_MAX_CCK CW_MAX_CCK
  618. #define DEF_TX0_AIFS (2)
  619. #define DEF_TX1_AIFS (2)
  620. #define DEF_TX2_AIFS (2)
  621. #define DEF_TX3_AIFS (2)
  622. #define DEF_TX0_ACM 0
  623. #define DEF_TX1_ACM 0
  624. #define DEF_TX2_ACM 0
  625. #define DEF_TX3_ACM 0
  626. #define DEF_TX0_TXOP_LIMIT_CCK 0
  627. #define DEF_TX1_TXOP_LIMIT_CCK 0
  628. #define DEF_TX2_TXOP_LIMIT_CCK 0
  629. #define DEF_TX3_TXOP_LIMIT_CCK 0
  630. #define DEF_TX0_TXOP_LIMIT_OFDM 0
  631. #define DEF_TX1_TXOP_LIMIT_OFDM 0
  632. #define DEF_TX2_TXOP_LIMIT_OFDM 0
  633. #define DEF_TX3_TXOP_LIMIT_OFDM 0
  634. #define QOS_QOS_SETS 3
  635. #define QOS_PARAM_SET_ACTIVE 0
  636. #define QOS_PARAM_SET_DEF_CCK 1
  637. #define QOS_PARAM_SET_DEF_OFDM 2
  638. #define CTRL_QOS_NO_ACK (0x0020)
  639. #define DCT_FLAG_EXT_QOS_ENABLED (0x10)
  640. #define U32_PAD(n) ((4-(n))&0x3)
  641. /*
  642. * Generic queue structure
  643. *
  644. * Contains common data for Rx and Tx queues
  645. */
  646. #define TFD_CTL_COUNT_SET(n) (n<<24)
  647. #define TFD_CTL_COUNT_GET(ctl) ((ctl>>24) & 7)
  648. #define TFD_CTL_PAD_SET(n) (n<<28)
  649. #define TFD_CTL_PAD_GET(ctl) (ctl>>28)
  650. #define TFD_TX_CMD_SLOTS 256
  651. #define TFD_CMD_SLOTS 32
  652. #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl3945_cmd) - \
  653. sizeof(struct iwl3945_cmd_meta))
  654. /*
  655. * RX related structures and functions
  656. */
  657. #define RX_FREE_BUFFERS 64
  658. #define RX_LOW_WATERMARK 8
  659. #define IWL_RX_BUF_SIZE 3000
  660. /* card static random access memory (SRAM) for processor data and instructs */
  661. #define ALM_RTC_INST_UPPER_BOUND (0x014000)
  662. #define ALM_RTC_DATA_UPPER_BOUND (0x808000)
  663. #define ALM_RTC_INST_SIZE (ALM_RTC_INST_UPPER_BOUND - RTC_INST_LOWER_BOUND)
  664. #define ALM_RTC_DATA_SIZE (ALM_RTC_DATA_UPPER_BOUND - RTC_DATA_LOWER_BOUND)
  665. #define IWL_MAX_BSM_SIZE ALM_RTC_INST_SIZE
  666. #define IWL_MAX_INST_SIZE ALM_RTC_INST_SIZE
  667. #define IWL_MAX_DATA_SIZE ALM_RTC_DATA_SIZE
  668. #define IWL_MAX_NUM_QUEUES 8
  669. static inline int iwl3945_hw_valid_rtc_data_addr(u32 addr)
  670. {
  671. return (addr >= RTC_DATA_LOWER_BOUND) &&
  672. (addr < ALM_RTC_DATA_UPPER_BOUND);
  673. }
  674. /* Base physical address of iwl3945_shared is provided to FH_TSSR_CBB_BASE
  675. * and &iwl3945_shared.rx_read_ptr[0] is provided to FH_RCSR_RPTR_ADDR(0) */
  676. struct iwl3945_shared {
  677. __le32 tx_base_ptr[8];
  678. __le32 rx_read_ptr[3];
  679. } __attribute__ ((packed));
  680. struct iwl3945_tfd_frame_data {
  681. __le32 addr;
  682. __le32 len;
  683. } __attribute__ ((packed));
  684. struct iwl3945_tfd_frame {
  685. __le32 control_flags;
  686. struct iwl3945_tfd_frame_data pa[4];
  687. u8 reserved[28];
  688. } __attribute__ ((packed));
  689. static inline u8 iwl3945_hw_get_rate(__le16 rate_n_flags)
  690. {
  691. return le16_to_cpu(rate_n_flags) & 0xFF;
  692. }
  693. static inline u16 iwl3945_hw_get_rate_n_flags(__le16 rate_n_flags)
  694. {
  695. return le16_to_cpu(rate_n_flags);
  696. }
  697. static inline __le16 iwl3945_hw_set_rate_n_flags(u8 rate, u16 flags)
  698. {
  699. return cpu_to_le16((u16)rate|flags);
  700. }
  701. #endif