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