1c533a883Shx147065 /* 2c533a883Shx147065 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 3c533a883Shx147065 * Use is subject to license terms. 4c533a883Shx147065 */ 5c533a883Shx147065 6c533a883Shx147065 /* 7c533a883Shx147065 * Copyright (c) 2007, Intel Corporation 8c533a883Shx147065 * All rights reserved. 9c533a883Shx147065 */ 10c533a883Shx147065 11c533a883Shx147065 /* 12c533a883Shx147065 * Sun elects to use this software under the BSD license. 13c533a883Shx147065 */ 14c533a883Shx147065 15c533a883Shx147065 /* 16c533a883Shx147065 * This file is provided under a dual BSD/GPLv2 license. When using or 17c533a883Shx147065 * redistributing this file, you may do so under either license. 18c533a883Shx147065 * 19c533a883Shx147065 * GPL LICENSE SUMMARY 20c533a883Shx147065 * 21c533a883Shx147065 * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. 22c533a883Shx147065 * 23c533a883Shx147065 * This program is free software; you can redistribute it and/or modify 24c533a883Shx147065 * it under the terms of version 2 of the GNU Geeral Public License as 25c533a883Shx147065 * published by the Free Software Foundation. 26c533a883Shx147065 * 27c533a883Shx147065 * This program is distributed in the hope that it will be useful, but 28c533a883Shx147065 * WITHOUT ANY WARRANTY; without even the implied warranty of 29c533a883Shx147065 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30c533a883Shx147065 * General Public License for more details. 31c533a883Shx147065 * 32c533a883Shx147065 * You should have received a copy of the GNU General Public License 33c533a883Shx147065 * along with this program; if not, write to the Free Software 34c533a883Shx147065 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, 35c533a883Shx147065 * USA 36c533a883Shx147065 * 37c533a883Shx147065 * The full GNU General Public License is included in this distribution 38c533a883Shx147065 * in the file called LICENSE.GPL. 39c533a883Shx147065 * 40c533a883Shx147065 * Contact Information: 41c533a883Shx147065 * James P. Ketrenos <ipw2100-admin@linux.intel.com> 42c533a883Shx147065 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 43c533a883Shx147065 * 44c533a883Shx147065 * BSD LICENSE 45c533a883Shx147065 * 46c533a883Shx147065 * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. 47c533a883Shx147065 * All rights reserved. 48c533a883Shx147065 * 49c533a883Shx147065 * Redistribution and use in source and binary forms, with or without 50c533a883Shx147065 * modification, are permitted provided that the following conditions 51c533a883Shx147065 * are met: 52c533a883Shx147065 * 53c533a883Shx147065 * * Redistributions of source code must retain the above copyright 54c533a883Shx147065 * notice, this list of conditions and the following disclaimer. 55c533a883Shx147065 * * Redistributions in binary form must reproduce the above copyright 56c533a883Shx147065 * notice, this list of conditions and the following disclaimer in 57c533a883Shx147065 * the documentation and/or other materials provided with the 58c533a883Shx147065 * distribution. 59c533a883Shx147065 * * Neither the name Intel Corporation nor the names of its 60c533a883Shx147065 * contributors may be used to endorse or promote products derived 61c533a883Shx147065 * from this software without specific prior written permission. 62c533a883Shx147065 * 63c533a883Shx147065 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 64c533a883Shx147065 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 65c533a883Shx147065 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 66c533a883Shx147065 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 67c533a883Shx147065 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 68c533a883Shx147065 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 69c533a883Shx147065 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 70c533a883Shx147065 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 71c533a883Shx147065 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 72c533a883Shx147065 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 73c533a883Shx147065 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 74c533a883Shx147065 */ 75c533a883Shx147065 76c533a883Shx147065 #ifndef _IWK_HW_H_ 77c533a883Shx147065 #define _IWK_HW_H_ 78c533a883Shx147065 79c533a883Shx147065 #ifdef __cplusplus 80c533a883Shx147065 extern "C" { 81c533a883Shx147065 #endif 82c533a883Shx147065 83c533a883Shx147065 /* 84c533a883Shx147065 * maximum scatter/gather 85c533a883Shx147065 */ 86c533a883Shx147065 #define IWK_MAX_SCATTER (10) 87c533a883Shx147065 88c533a883Shx147065 /* 89c533a883Shx147065 * Flow Handler Definitions 90c533a883Shx147065 */ 91c533a883Shx147065 #define FH_MEM_LOWER_BOUND (0x1000) 92c533a883Shx147065 #define FH_MEM_UPPER_BOUND (0x1EF0) 93c533a883Shx147065 94c533a883Shx147065 #define IWK_FH_REGS_LOWER_BOUND (0x1000) 95c533a883Shx147065 #define IWK_FH_REGS_UPPER_BOUND (0x2000) 96c533a883Shx147065 97c533a883Shx147065 /* 98c533a883Shx147065 * TFDB Area - TFDs buffer table 99c533a883Shx147065 */ 100c533a883Shx147065 #define FH_MEM_TFDB_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x000) 101c533a883Shx147065 #define FH_MEM_TFDB_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0x900) 102c533a883Shx147065 103c533a883Shx147065 /* 104c533a883Shx147065 * channels 0 - 8 105c533a883Shx147065 */ 106c533a883Shx147065 #define FH_MEM_TFDB_CHNL_BUF0(x) (FH_MEM_TFDB_LOWER_BOUND + (x) * 0x100) 107c533a883Shx147065 #define FH_MEM_TFDB_CHNL_BUF1(x) (FH_MEM_TFDB_LOWER_BOUND + 0x80 + (x) * 0x100) 108c533a883Shx147065 109c533a883Shx147065 /* 110c533a883Shx147065 * TFDIB Area - TFD Immediate Buffer 111c533a883Shx147065 */ 112c533a883Shx147065 #define FH_MEM_TFDIB_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x900) 113c533a883Shx147065 #define FH_MEM_TFDIB_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0x958) 114c533a883Shx147065 115c533a883Shx147065 /* 116c533a883Shx147065 * channels 0 - 10 117c533a883Shx147065 */ 118c533a883Shx147065 #define FH_MEM_TFDIB_CHNL(x) (FH_MEM_TFDIB_LOWER_BOUND + (x) * 0x8) 119c533a883Shx147065 120c533a883Shx147065 /* 121c533a883Shx147065 * TFDIB registers used in Service Mode 122c533a883Shx147065 */ 123c533a883Shx147065 #define FH_MEM_TFDIB_CHNL9_REG0 (FH_MEM_TFDIB_CHNL(9)) 124c533a883Shx147065 #define FH_MEM_TFDIB_CHNL9_REG1 (FH_MEM_TFDIB_CHNL(9) + 4) 125c533a883Shx147065 #define FH_MEM_TFDIB_CHNL10_REG0 (FH_MEM_TFDIB_CHNL(10)) 126c533a883Shx147065 #define FH_MEM_TFDIB_CHNL10_REG1 (FH_MEM_TFDIB_CHNL(10) + 4) 127c533a883Shx147065 128c533a883Shx147065 /* 129c533a883Shx147065 * Tx service channels 130c533a883Shx147065 */ 131c533a883Shx147065 #define FH_MEM_TFDIB_DRAM_ADDR_LSB_MASK (0xFFFFFFFF) 132c533a883Shx147065 #define FH_MEM_TFDIB_DRAM_ADDR_MSB_MASK (0xF00000000) 133c533a883Shx147065 #define FH_MEM_TFDIB_TB_LENGTH_MASK (0x0001FFFF) /* bits 16:0 */ 134c533a883Shx147065 135c533a883Shx147065 #define FH_MEM_TFDIB_DRAM_ADDR_LSB_BITSHIFT (0) 136c533a883Shx147065 #define FH_MEM_TFDIB_DRAM_ADDR_MSB_BITSHIFT (32) 137c533a883Shx147065 #define FH_MEM_TFDIB_TB_LENGTH_BITSHIFT (0) 138c533a883Shx147065 139c533a883Shx147065 #define FH_MEM_TFDIB_REG0_ADDR_MASK (0xFFFFFFFF) 140c533a883Shx147065 #define FH_MEM_TFDIB_REG1_ADDR_MASK (0xF0000000) 141c533a883Shx147065 #define FH_MEM_TFDIB_REG1_LENGTH_MASK (0x0001FFFF) 142c533a883Shx147065 143c533a883Shx147065 #define FH_MEM_TFDIB_REG0_ADDR_BITSHIFT (0) 144c533a883Shx147065 #define FH_MEM_TFDIB_REG1_ADDR_BITSHIFT (28) 145c533a883Shx147065 #define FH_MEM_TFDIB_REG1_LENGTH_BITSHIFT (0) 146c533a883Shx147065 147c533a883Shx147065 /* 148c533a883Shx147065 * TRB Area - Transmit Request Buffers 149c533a883Shx147065 */ 150c533a883Shx147065 #define FH_MEM_TRB_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x0958) 151c533a883Shx147065 #define FH_MEM_TRB_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0x0980) 152c533a883Shx147065 153c533a883Shx147065 /* 154c533a883Shx147065 * channels 0 - 8 155c533a883Shx147065 */ 156c533a883Shx147065 #define FH_MEM_TRB_CHNL(x) (FH_MEM_TRB_LOWER_BOUND + (x) * 0x4) 157c533a883Shx147065 158c533a883Shx147065 /* 159c533a883Shx147065 * Keep-Warm (KW) buffer base address. 160c533a883Shx147065 * 161c533a883Shx147065 * Driver must allocate a 4KByte buffer that is used by 4965 for keeping the 162c533a883Shx147065 * host DRAM powered on (via dummy accesses to DRAM) to maintain low-latency 163c533a883Shx147065 * DRAM access when 4965 is Txing or Rxing. The dummy accesses prevent host 164c533a883Shx147065 * from going into a power-savings mode that would cause higher DRAM latency, 165c533a883Shx147065 * and possible data over/under-runs, before all Tx/Rx is complete. 166c533a883Shx147065 * 167c533a883Shx147065 * Driver loads IWK_FH_KW_MEM_ADDR_REG with the physical address (bits 35:4) 168c533a883Shx147065 * of the buffer, which must be 4K aligned. Once this is set up, the 4965 169c533a883Shx147065 * automatically invokes keep-warm accesses when normal accesses might not 170c533a883Shx147065 * be sufficient to maintain fast DRAM response. 171c533a883Shx147065 * 172c533a883Shx147065 * Bit fields: 173c533a883Shx147065 * 31-0: Keep-warm buffer physical base address [35:4], must be 4K aligned 174c533a883Shx147065 */ 175c533a883Shx147065 #define IWK_FH_KW_MEM_ADDR_REG (FH_MEM_LOWER_BOUND + 0x97C) 176c533a883Shx147065 177c533a883Shx147065 /* 178c533a883Shx147065 * STAGB Area - Scheduler TAG Buffer 179c533a883Shx147065 */ 180c533a883Shx147065 #define FH_MEM_STAGB_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x980) 181c533a883Shx147065 #define FH_MEM_STAGB_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) 182c533a883Shx147065 183c533a883Shx147065 /* 184c533a883Shx147065 * channels 0 - 8 185c533a883Shx147065 */ 186c533a883Shx147065 #define FH_MEM_STAGB_0(x) (FH_MEM_STAGB_LOWER_BOUND + (x) * 0x8) 187c533a883Shx147065 #define FH_MEM_STAGB_1(x) (FH_MEM_STAGB_LOWER_BOUND + 0x4 + (x) * 0x8) 188c533a883Shx147065 189c533a883Shx147065 /* 190c533a883Shx147065 * Tx service channels 191c533a883Shx147065 */ 192c533a883Shx147065 #define FH_MEM_SRAM_ADDR_9 (FH_MEM_STAGB_LOWER_BOUND + 0x048) 193c533a883Shx147065 #define FH_MEM_SRAM_ADDR_10 (FH_MEM_STAGB_LOWER_BOUND + 0x04C) 194c533a883Shx147065 195c533a883Shx147065 #define FH_MEM_STAGB_SRAM_ADDR_MASK (0x00FFFFFF) 196c533a883Shx147065 197c533a883Shx147065 /* 198c533a883Shx147065 * TFD Circular Buffers Base (CBBC) addresses 199c533a883Shx147065 * 200c533a883Shx147065 * 4965 has 16 base pointer registers, one for each of 16 host-DRAM-resident 201c533a883Shx147065 * circular buffers (CBs/queues) containing Transmit Frame Descriptors (TFDs) 202c533a883Shx147065 * (see struct iwk_tfd_frame). These 16 pointer registers are offset by 0x04 203c533a883Shx147065 * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte 204c533a883Shx147065 * aligned (address bits 0-7 must be 0). 205c533a883Shx147065 * 206c533a883Shx147065 * Bit fields in each pointer register: 207c533a883Shx147065 * 27-0: TFD CB physical base address [35:8], must be 256-byte aligned 208c533a883Shx147065 */ 209c533a883Shx147065 #define FH_MEM_CBBC_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) 210c533a883Shx147065 #define FH_MEM_CBBC_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10) 211c533a883Shx147065 212c533a883Shx147065 /* 213c533a883Shx147065 * queues 0 - 15 214c533a883Shx147065 */ 215c533a883Shx147065 #define FH_MEM_CBBC_QUEUE(x) (FH_MEM_CBBC_LOWER_BOUND + (x) * 0x4) 216c533a883Shx147065 217c533a883Shx147065 /* 218c533a883Shx147065 * TAGR Area - TAG reconstruct table 219c533a883Shx147065 */ 220c533a883Shx147065 #define FH_MEM_TAGR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xA10) 221c533a883Shx147065 #define FH_MEM_TAGR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA70) 222c533a883Shx147065 223c533a883Shx147065 /* 224c533a883Shx147065 * TDBGR Area - Tx Debug Registers 225c533a883Shx147065 */ 226c533a883Shx147065 #define FH_MEM_TDBGR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x0A70) 227c533a883Shx147065 #define FH_MEM_TDBGR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0x0B20) 228c533a883Shx147065 229c533a883Shx147065 /* 230c533a883Shx147065 * channels 0 - 10 231c533a883Shx147065 */ 232c533a883Shx147065 #define FH_MEM_TDBGR_CHNL(x) (FH_MEM_TDBGR_LOWER_BOUND + (x) * 0x10) 233c533a883Shx147065 234c533a883Shx147065 #define FH_MEM_TDBGR_CHNL_REG_0(x) (FH_MEM_TDBGR_CHNL(x)) 235c533a883Shx147065 #define FH_MEM_TDBGR_CHNL_REG_1(x) (FH_MEM_TDBGR_CHNL_REG_0(x) + 0x4) 236c533a883Shx147065 237c533a883Shx147065 #define FH_MEM_TDBGR_CHNL_BYTES_TO_FIFO_MASK (0x000FFFFF) 238c533a883Shx147065 #define FH_MEM_TDBGR_CHNL_BYTES_TO_FIFO_BITSHIFT (0) 239c533a883Shx147065 240c533a883Shx147065 /* 241c533a883Shx147065 * RDBUF Area 242c533a883Shx147065 */ 243c533a883Shx147065 #define FH_MEM_RDBUF_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xB80) 244c533a883Shx147065 #define FH_MEM_RDBUF_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xBC0) 245c533a883Shx147065 #define FH_MEM_RDBUF_CHNL0 (FH_MEM_RDBUF_LOWER_BOUND) 246c533a883Shx147065 247c533a883Shx147065 /* 248c533a883Shx147065 * Rx SRAM Control and Status Registers (RSCSR) 249c533a883Shx147065 * 250c533a883Shx147065 * These registers provide handshake between driver and 4965 for the Rx queue 251c533a883Shx147065 * (this queue handles *all* command responses, notifications, Rx data, etc. 252c533a883Shx147065 * sent from 4965 uCode to host driver). Unlike Tx, there is only one Rx 253c533a883Shx147065 * queue, and only one Rx DMA/FIFO channel. Also unlike Tx, which can 254c533a883Shx147065 * concatenate up to 20 DRAM buffers to form a Tx frame, each Receive Buffer 255c533a883Shx147065 * Descriptor (RBD) points to only one Rx Buffer (RB); there is a 1:1 256c533a883Shx147065 * mapping between RBDs and RBs. 257c533a883Shx147065 * 258c533a883Shx147065 * Driver must allocate host DRAM memory for the following, and set the 259c533a883Shx147065 * physical address of each into 4965 registers: 260c533a883Shx147065 * 261c533a883Shx147065 * 1) Receive Buffer Descriptor (RBD) circular buffer (CB), typically with 256 262c533a883Shx147065 * entries (although any power of 2, up to 4096, is selectable by driver). 263c533a883Shx147065 * Each entry (1 dword) points to a receive buffer (RB) of consistent size 264c533a883Shx147065 * (typically 4K, although 8K or 16K are also selectable by driver). 265c533a883Shx147065 * Driver sets up RB size and number of RBDs in the CB via Rx config 266c533a883Shx147065 * register FH_MEM_RCSR_CHNL0_CONFIG_REG. 267c533a883Shx147065 * 268c533a883Shx147065 * Bit fields within one RBD: 269c533a883Shx147065 * 27-0: Receive Buffer physical address bits [35:8], 256-byte aligned. 270c533a883Shx147065 * 271c533a883Shx147065 * Driver sets physical address [35:8] of base of RBD circular buffer 272c533a883Shx147065 * into FH_RSCSR_CHNL0_RBDCB_BASE_REG [27:0]. 273c533a883Shx147065 * 274c533a883Shx147065 * 2) Rx status buffer, 8 bytes, in which 4965 indicates which Rx Buffers 275c533a883Shx147065 * (RBs) have been filled, via a "write pointer", actually the index of 276c533a883Shx147065 * the RB's corresponding RBD within the circular buffer. Driver sets 277c533a883Shx147065 * physical address [35:4] into FH_RSCSR_CHNL0_STTS_WPTR_REG [31:0]. 278c533a883Shx147065 * 279c533a883Shx147065 * Bit fields in lower dword of Rx status buffer (upper dword not used 280c533a883Shx147065 * by driver; see struct iwk_shared, val0): 281c533a883Shx147065 * 31-12: Not used by driver 282c533a883Shx147065 * 11- 0: Index of last filled Rx buffer descriptor 283c533a883Shx147065 * (4965 writes, driver reads this value) 284c533a883Shx147065 * 285c533a883Shx147065 * As the driver prepares Receive Buffers (RBs) for 4965 to fill, driver must 286c533a883Shx147065 * enter pointers to these RBs into contiguous RBD circular buffer entries, 287c533a883Shx147065 * and update the 4965's "write" index register, FH_RSCSR_CHNL0_RBDCB_WPTR_REG. 288c533a883Shx147065 * 289c533a883Shx147065 * This "write" index corresponds to the *next* RBD that the driver will make 290c533a883Shx147065 * available, i.e. one RBD past the the tail of the ready-to-fill RBDs within 291c533a883Shx147065 * the circular buffer. This value should initially be 0 (before preparing any 292c533a883Shx147065 * RBs), should be 8 after preparing the first 8 RBs (for example), and must 293c533a883Shx147065 * wrap back to 0 at the end of the circular buffer (but don't wrap before 294c533a883Shx147065 * "read" index has advanced past 1! See below). 295c533a883Shx147065 * NOTE: 4965 EXPECTS THE WRITE INDEX TO BE INCREMENTED IN MULTIPLES OF 8. 296c533a883Shx147065 * 297c533a883Shx147065 * As the 4965 fills RBs (referenced from contiguous RBDs within the circular 298c533a883Shx147065 * buffer), it updates the Rx status buffer in DRAM, 2) described above, 299c533a883Shx147065 * to tell the driver the index of the latest filled RBD. The driver must 300c533a883Shx147065 * read this "read" index from DRAM after receiving an Rx interrupt from 4965. 301c533a883Shx147065 * 302c533a883Shx147065 * The driver must also internally keep track of a third index, which is the 303c533a883Shx147065 * next RBD to process. When receiving an Rx interrupt, driver should process 304c533a883Shx147065 * all filled but unprocessed RBs up to, but not including, the RB 305c533a883Shx147065 * corresponding to the "read" index. For example, if "read" index becomes "1", 306c533a883Shx147065 * driver may process the RB pointed to by RBD 0. Depending on volume of 307c533a883Shx147065 * traffic, there may be many RBs to process. 308c533a883Shx147065 * 309c533a883Shx147065 * If read index == write index, 4965 thinks there is no room to put new data. 310c533a883Shx147065 * Due to this, the maximum number of filled RBs is 255, instead of 256. To 311c533a883Shx147065 * be safe, make sure that there is a gap of at least 2 RBDs between "write" 312c533a883Shx147065 * and "read" indexes; that is, make sure that there are no more than 254 313c533a883Shx147065 * buffers waiting to be filled. 314c533a883Shx147065 */ 315c533a883Shx147065 #define FH_MEM_RSCSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xBC0) 316c533a883Shx147065 #define FH_MEM_RSCSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xC00) 317c533a883Shx147065 #define FH_MEM_RSCSR_CHNL0 (FH_MEM_RSCSR_LOWER_BOUND) 318c533a883Shx147065 #define FH_MEM_RSCSR_CHNL1 (FH_MEM_RSCSR_LOWER_BOUND + 0x020) 319c533a883Shx147065 320c533a883Shx147065 /* 321c533a883Shx147065 * Physical base address of 8-byte Rx Status buffer. 322c533a883Shx147065 * Bit fields: 323c533a883Shx147065 * 31-0: Rx status buffer physical base address [35:4], must 16-byte aligned. 324c533a883Shx147065 */ 325c533a883Shx147065 326c533a883Shx147065 #define FH_RSCSR_CHNL0_STTS_WPTR_REG (FH_MEM_RSCSR_CHNL0) 327c533a883Shx147065 328c533a883Shx147065 /* 329c533a883Shx147065 * Physical base address of Rx Buffer Descriptor Circular Buffer. 330c533a883Shx147065 * Bit fields: 331c533a883Shx147065 * 27-0: RBD CD physical base address [35:8], must be 256-byte aligned. 332c533a883Shx147065 */ 333c533a883Shx147065 #define FH_RSCSR_CHNL0_RBDCB_BASE_REG (FH_MEM_RSCSR_CHNL0 + 0x004) 334c533a883Shx147065 335c533a883Shx147065 /* 336c533a883Shx147065 * Rx write pointer (index, really!). 337c533a883Shx147065 * Bit fields: 338c533a883Shx147065 * 11-0: Index of driver's most recent prepared-to-be-filled RBD, + 1. 339c533a883Shx147065 * NOTE: For 256-entry circular buffer, use only bits [7:0]. 340c533a883Shx147065 */ 341c533a883Shx147065 #define FH_RSCSR_CHNL0_RBDCB_WPTR_REG (FH_MEM_RSCSR_CHNL0 + 0x008) 342c533a883Shx147065 #define FH_RSCSR_CHNL0_RBDCB_RPTR_REG (FH_MEM_RSCSR_CHNL0 + 0x00c) 343c533a883Shx147065 344c533a883Shx147065 #define FH_RSCSR_FRAME_SIZE_MASK (0x00000FFF) /* bits 0-11 */ 345c533a883Shx147065 346c533a883Shx147065 /* 347c533a883Shx147065 * RSCSR registers used in Service mode 348c533a883Shx147065 */ 349c533a883Shx147065 #define FH_RSCSR_CHNL1_RB_WPTR_REG (FH_MEM_RSCSR_CHNL1) 350c533a883Shx147065 #define FH_RSCSR_CHNL1_RB_WPTR_OFFSET_REG (FH_MEM_RSCSR_CHNL1 + 0x004) 351c533a883Shx147065 #define FH_RSCSR_CHNL1_RB_CHUNK_NUM_REG (FH_MEM_RSCSR_CHNL1 + 0x008) 352c533a883Shx147065 #define FH_RSCSR_CHNL1_SRAM_ADDR_REG (FH_MEM_RSCSR_CHNL1 + 0x00C) 353c533a883Shx147065 354c533a883Shx147065 /* 355c533a883Shx147065 * Rx Config/Status Registers (RCSR) 356c533a883Shx147065 * Rx Config Reg for channel 0 (only channel used) 357c533a883Shx147065 * 358c533a883Shx147065 * Driver must initialize FH_MEM_RCSR_CHNL0_CONFIG_REG as follows for 359c533a883Shx147065 * normal operation (see bit fields). 360c533a883Shx147065 * 361c533a883Shx147065 * Clearing FH_MEM_RCSR_CHNL0_CONFIG_REG to 0 turns off Rx DMA. 362c533a883Shx147065 * Driver should poll FH_MEM_RSSR_RX_STATUS_REG for 363c533a883Shx147065 * FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (bit 24) before continuing. 364c533a883Shx147065 * 365c533a883Shx147065 * Bit fields: 366c533a883Shx147065 * 31-30: Rx DMA channel enable: '00' off/pause, '01' pause at end of frame, 367c533a883Shx147065 * '10' operate normally 368c533a883Shx147065 * 29-24: reserved 369c533a883Shx147065 * 23-20: # RBDs in circular buffer = 2^value; use "8" for 256 RBDs (normal), 370c533a883Shx147065 * min "5" for 32 RBDs, max "12" for 4096 RBDs. 371c533a883Shx147065 * 19-18: reserved 372c533a883Shx147065 * 17-16: size of each receive buffer; '00' 4K (normal), '01' 8K, 373c533a883Shx147065 * '10' 12K, '11' 16K. 374c533a883Shx147065 * 15-14: reserved 375c533a883Shx147065 * 13-12: IRQ destination; '00' none, '01' host driver (normal operation) 376c533a883Shx147065 * 11- 4: timeout for closing Rx buffer and interrupting host (units 32 usec) 377c533a883Shx147065 * typical value 0x10 (about 1/2 msec) 378c533a883Shx147065 * 3- 0: reserved 379c533a883Shx147065 */ 380c533a883Shx147065 #define FH_MEM_RCSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xC00) 381c533a883Shx147065 #define FH_MEM_RCSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xCC0) 382c533a883Shx147065 #define FH_MEM_RCSR_CHNL0 (FH_MEM_RCSR_LOWER_BOUND) 383c533a883Shx147065 #define FH_MEM_RCSR_CHNL1 (FH_MEM_RCSR_LOWER_BOUND + 0x020) 384c533a883Shx147065 385c533a883Shx147065 #define FH_MEM_RCSR_CHNL0_CONFIG_REG (FH_MEM_RCSR_CHNL0) 386c533a883Shx147065 #define FH_MEM_RCSR_CHNL0_CREDIT_REG (FH_MEM_RCSR_CHNL0 + 0x004) 387c533a883Shx147065 #define FH_MEM_RCSR_CHNL0_RBD_STTS_REG (FH_MEM_RCSR_CHNL0 + 0x008) 388c533a883Shx147065 #define FH_MEM_RCSR_CHNL0_RB_STTS_REG (FH_MEM_RCSR_CHNL0 + 0x00C) 389c533a883Shx147065 #define FH_MEM_RCSR_CHNL0_RXPD_STTS_REG (FH_MEM_RCSR_CHNL0 + 0x010) 390c533a883Shx147065 391c533a883Shx147065 #define FH_MEM_RCSR_CHNL0_RBD_STTS_FRAME_RB_CNT_MASK (0x7FFFFFF0) 392c533a883Shx147065 393c533a883Shx147065 /* 394c533a883Shx147065 * RCSR registers used in Service mode 395c533a883Shx147065 */ 396c533a883Shx147065 #define FH_MEM_RCSR_CHNL1_CONFIG_REG (FH_MEM_RCSR_CHNL1) 397c533a883Shx147065 #define FH_MEM_RCSR_CHNL1_RB_STTS_REG (FH_MEM_RCSR_CHNL1 + 0x00C) 398c533a883Shx147065 #define FH_MEM_RCSR_CHNL1_RX_PD_STTS_REG (FH_MEM_RCSR_CHNL1 + 0x010) 399c533a883Shx147065 400c533a883Shx147065 /* 401c533a883Shx147065 * Rx Shared Status Registers (RSSR) 402c533a883Shx147065 * 403c533a883Shx147065 * After stopping Rx DMA channel (writing 0 to FH_MEM_RCSR_CHNL0_CONFIG_REG), 404c533a883Shx147065 * driver must poll FH_MEM_RSSR_RX_STATUS_REG until Rx channel is idle. 405c533a883Shx147065 * 406c533a883Shx147065 * Bit fields: 407c533a883Shx147065 * 24: 1 = Channel 0 is idle 408c533a883Shx147065 * 409c533a883Shx147065 * FH_MEM_RSSR_SHARED_CTRL_REG and FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV contain 410c533a883Shx147065 * default values that should not be altered by the driver. 411c533a883Shx147065 */ 412c533a883Shx147065 #define FH_MEM_RSSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xC40) 413c533a883Shx147065 #define FH_MEM_RSSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xD00) 414c533a883Shx147065 #define FH_MEM_RSSR_SHARED_CTRL_REG (FH_MEM_RSSR_LOWER_BOUND) 415c533a883Shx147065 #define FH_MEM_RSSR_RX_STATUS_REG (FH_MEM_RSSR_LOWER_BOUND + 0x004) 416c533a883Shx147065 #define FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV (FH_MEM_RSSR_LOWER_BOUND + 0x008) 417c533a883Shx147065 418c533a883Shx147065 /* 419c533a883Shx147065 * Transmit DMA Channel Control/Status Registers (TCSR) 420c533a883Shx147065 * 421c533a883Shx147065 * 4965 has one configuration register for each of 8 Tx DMA/FIFO channels 422c533a883Shx147065 * supported in hardware; config regs are separated by 0x20 bytes. 423c533a883Shx147065 * 424c533a883Shx147065 * To use a Tx DMA channel, driver must initialize its 425c533a883Shx147065 * IWK_FH_TCSR_CHNL_TX_CONFIG_REG(chnl) with: 426c533a883Shx147065 * 427c533a883Shx147065 * IWK_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | 428c533a883Shx147065 * IWK_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL 429c533a883Shx147065 * 430c533a883Shx147065 * All other bits should be 0. 431c533a883Shx147065 * 432c533a883Shx147065 * Bit fields: 433c533a883Shx147065 * 31-30: Tx DMA channel enable: '00' off/pause, '01' pause at end of frame, 434c533a883Shx147065 * '10' operate normally 435c533a883Shx147065 * 29- 4: Reserved, set to "0" 436c533a883Shx147065 * 3: Enable internal DMA requests (1, normal operation), disable (0) 437c533a883Shx147065 * 2- 0: Reserved, set to "0" 438c533a883Shx147065 */ 439c533a883Shx147065 #define IWK_FH_TCSR_LOWER_BOUND (IWK_FH_REGS_LOWER_BOUND + 0xD00) 440c533a883Shx147065 #define IWK_FH_TCSR_UPPER_BOUND (IWK_FH_REGS_LOWER_BOUND + 0xE60) 441c533a883Shx147065 442c533a883Shx147065 #define IWK_FH_TCSR_CHNL_NUM (7) 443c533a883Shx147065 #define IWK_FH_TCSR_CHNL_TX_CONFIG_REG(_chnl) \ 444c533a883Shx147065 (IWK_FH_TCSR_LOWER_BOUND + 0x20 * _chnl) 445c533a883Shx147065 #define IWK_FH_TCSR_CHNL_TX_CREDIT_REG(_chnl) \ 446c533a883Shx147065 (IWK_FH_TCSR_LOWER_BOUND + 0x20 * _chnl + 0x4) 447c533a883Shx147065 #define IWK_FH_TCSR_CHNL_TX_BUF_STS_REG(_chnl) \ 448c533a883Shx147065 (IWK_FH_TCSR_LOWER_BOUND + 0x20 * _chnl + 0x8) 449c533a883Shx147065 450c533a883Shx147065 /* 451c533a883Shx147065 * Tx Shared Status Registers (TSSR) 452c533a883Shx147065 * 453c533a883Shx147065 * After stopping Tx DMA channel (writing 0 to 454c533a883Shx147065 * IWK_FH_TCSR_CHNL_TX_CONFIG_REG(chnl)), driver must poll 455c533a883Shx147065 * IWK_FH_TSSR_TX_STATUS_REG until selected Tx channel is idle 456c533a883Shx147065 * (channel's buffers empty | no pending requests). 457c533a883Shx147065 * 458c533a883Shx147065 * Bit fields: 459c533a883Shx147065 * 31-24: 1 = Channel buffers empty (channel 7:0) 460c533a883Shx147065 * 23-16: 1 = No pending requests (channel 7:0) 461c533a883Shx147065 */ 462c533a883Shx147065 #define IWK_FH_TSSR_LOWER_BOUND (IWK_FH_REGS_LOWER_BOUND + 0xEA0) 463c533a883Shx147065 #define IWK_FH_TSSR_UPPER_BOUND (IWK_FH_REGS_LOWER_BOUND + 0xEC0) 464c533a883Shx147065 465c533a883Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG (IWK_FH_TSSR_LOWER_BOUND + 0x008) 466c533a883Shx147065 #define IWK_FH_TSSR_TX_STATUS_REG (IWK_FH_TSSR_LOWER_BOUND + 0x010) 467c533a883Shx147065 468c533a883Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON (0xFF000000) 469c533a883Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON (0x00FF0000) 470c533a883Shx147065 471c533a883Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_64B (0x00000000) 472c533a883Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B (0x00000400) 473c533a883Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_256B (0x00000800) 474c533a883Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_512B (0x00000C00) 475c533a883Shx147065 476c533a883Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON (0x00000100) 477c533a883Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON (0x00000080) 478c533a883Shx147065 479c533a883Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH (0x00000020) 480c533a883Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH (0x00000005) 481c533a883Shx147065 482c533a883Shx147065 #define IWK_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_chnl) \ 483c533a883Shx147065 ((1 << (_chnl)) << 24) 484c533a883Shx147065 #define IWK_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_chnl) \ 485c533a883Shx147065 ((1 << (_chnl)) << 16) 486c533a883Shx147065 487c533a883Shx147065 #define IWK_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_chnl) \ 488c533a883Shx147065 (IWK_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_chnl) | \ 489c533a883Shx147065 IWK_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_chnl)) 490c533a883Shx147065 491c533a883Shx147065 /* 492c533a883Shx147065 * SRVC 493c533a883Shx147065 */ 494c533a883Shx147065 #define IWK_FH_SRVC_LOWER_BOUND (IWK_FH_REGS_LOWER_BOUND + 0x9C8) 495c533a883Shx147065 #define IWK_FH_SRVC_UPPER_BOUND (IWK_FH_REGS_LOWER_BOUND + 0x9D0) 496c533a883Shx147065 497c533a883Shx147065 #define IWK_FH_SRVC_CHNL_SRAM_ADDR_REG(_chnl) \ 498c533a883Shx147065 (IWK_FH_SRVC_LOWER_BOUND + (_chnl - 9) * 0x4) 499c533a883Shx147065 500c533a883Shx147065 /* 501c533a883Shx147065 * TFDIB 502c533a883Shx147065 */ 503c533a883Shx147065 #define IWK_FH_TFDIB_LOWER_BOUND (IWK_FH_REGS_LOWER_BOUND + 0x900) 504c533a883Shx147065 #define IWK_FH_TFDIB_UPPER_BOUND (IWK_FH_REGS_LOWER_BOUND + 0x958) 505c533a883Shx147065 506c533a883Shx147065 #define IWK_FH_TFDIB_CTRL0_REG(_chnl) \ 507c533a883Shx147065 (IWK_FH_TFDIB_LOWER_BOUND + 0x8 * _chnl) 508c533a883Shx147065 #define IWK_FH_TFDIB_CTRL1_REG(_chnl) \ 509c533a883Shx147065 (IWK_FH_TFDIB_LOWER_BOUND + 0x8 * _chnl + 0x4) 510c533a883Shx147065 511c533a883Shx147065 #define IWK_FH_SRVC_CHNL (9) 512c533a883Shx147065 #define IWK_FH_TFDIB_CTRL1_REG_POS_MSB (28) 513c533a883Shx147065 514c533a883Shx147065 /* 515c533a883Shx147065 * Debug Monitor Area 516c533a883Shx147065 */ 517c533a883Shx147065 #define FH_MEM_DM_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xEE0) 518c533a883Shx147065 #define FH_MEM_DM_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xEF0) 519c533a883Shx147065 #define FH_MEM_DM_CONTROL_MASK_REG (FH_MEM_DM_LOWER_BOUND) 520c533a883Shx147065 #define FH_MEM_DM_CONTROL_START_REG (FH_MEM_DM_LOWER_BOUND + 0x004) 521c533a883Shx147065 #define FH_MEM_DM_CONTROL_STATUS_REG (FH_MEM_DM_LOWER_BOUND + 0x008) 522c533a883Shx147065 #define FH_MEM_DM_MONITOR_REG (FH_MEM_DM_LOWER_BOUND + 0x00C) 523c533a883Shx147065 524c533a883Shx147065 #define FH_TB1_ADDR_LOW_MASK (0xFFFFFFFF) /* bits 31:0 */ 525c533a883Shx147065 #define FH_TB1_ADDR_HIGH_MASK (0xF00000000) /* bits 35:32 */ 526c533a883Shx147065 #define FH_TB2_ADDR_LOW_MASK (0x0000FFFF) /* bits 15:0 */ 527c533a883Shx147065 #define FH_TB2_ADDR_HIGH_MASK (0xFFFFF0000) /* bits 35:16 */ 528c533a883Shx147065 529c533a883Shx147065 #define FH_TB1_ADDR_LOW_BITSHIFT (0) 530c533a883Shx147065 #define FH_TB1_ADDR_HIGH_BITSHIFT (32) 531c533a883Shx147065 #define FH_TB2_ADDR_LOW_BITSHIFT (0) 532c533a883Shx147065 #define FH_TB2_ADDR_HIGH_BITSHIFT (16) 533c533a883Shx147065 534c533a883Shx147065 #define FH_TB1_LENGTH_MASK (0x00000FFF) /* bits 11:0 */ 535c533a883Shx147065 #define FH_TB2_LENGTH_MASK (0x00000FFF) /* bits 11:0 */ 536c533a883Shx147065 537c533a883Shx147065 /* 538c533a883Shx147065 * number of FH channels including 2 service mode 539c533a883Shx147065 */ 540c533a883Shx147065 #define NUM_OF_FH_CHANNELS (10) 541c533a883Shx147065 542c533a883Shx147065 /* 543c533a883Shx147065 * ctrl field bitology 544c533a883Shx147065 */ 545c533a883Shx147065 #define FH_TFD_CTRL_PADDING_MASK (0xC0000000) /* bits 31:30 */ 546c533a883Shx147065 #define FH_TFD_CTRL_NUMTB_MASK (0x1F000000) /* bits 28:24 */ 547c533a883Shx147065 548c533a883Shx147065 #define FH_TFD_CTRL_PADDING_BITSHIFT (30) 549c533a883Shx147065 #define FH_TFD_CTRL_NUMTB_BITSHIFT (24) 550c533a883Shx147065 551c533a883Shx147065 #define FH_TFD_GET_NUM_TBS(ctrl) \ 552c533a883Shx147065 ((ctrl & FH_TFD_CTRL_NUMTB_MASK) >> FH_TFD_CTRL_NUMTB_BITSHIFT) 553c533a883Shx147065 #define FH_TFD_GET_PADDING(ctrl) \ 554c533a883Shx147065 ((ctrl & FH_TFD_CTRL_PADDING_MASK) >> FH_TFD_CTRL_PADDING_BITSHIFT) 555c533a883Shx147065 556c533a883Shx147065 /* TCSR: tx_config register values */ 557c533a883Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000) 558c533a883Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRIVER (0x00000001) 559c533a883Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_ARC (0x00000002) 560c533a883Shx147065 561c533a883Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL (0x00000000) 562c533a883Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL (0x00000008) 563c533a883Shx147065 564c533a883Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_NOINT (0x00000000) 565c533a883Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD (0x00100000) 566c533a883Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000) 567c533a883Shx147065 568c533a883Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000) 569c533a883Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_ENDTFD (0x00400000) 570c533a883Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_IFTFD (0x00800000) 571c533a883Shx147065 572c533a883Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000) 573c533a883Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE_EOF (0x40000000) 574c533a883Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000) 575c533a883Shx147065 576c533a883Shx147065 #define IWK_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_EMPTY (0x00000000) 577c533a883Shx147065 #define IWK_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_WAIT (0x00002000) 578c533a883Shx147065 #define IWK_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00000003) 579c533a883Shx147065 580c533a883Shx147065 #define IWK_FH_TCSR_CHNL_TX_BUF_STS_REG_BIT_TFDB_WPTR (0x00000001) 581c533a883Shx147065 582c533a883Shx147065 #define IWK_FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM (20) 583c533a883Shx147065 #define IWK_FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX (12) 584c533a883Shx147065 585c533a883Shx147065 /* 586c533a883Shx147065 * CBB table 587c533a883Shx147065 */ 588c533a883Shx147065 #define FH_CBB_ADDR_MASK 0x0FFFFFFF /* bits 27:0 */ 589c533a883Shx147065 #define FH_CBB_ADDR_BIT_SHIFT (8) 590c533a883Shx147065 591c533a883Shx147065 /* 592c533a883Shx147065 * RCSR: channel 0 rx_config register defines 593c533a883Shx147065 */ 594c533a883Shx147065 #define FH_RCSR_CHNL0_RX_CONFIG_DMA_CHNL_EN_MASK (0xC0000000) /* bits 30-31 */ 595c533a883Shx147065 #define FH_RCSR_CHNL0_RX_CONFIG_RBDBC_SIZE_MASK (0x00F00000) /* bits 20-23 */ 596c533a883Shx147065 #define FH_RCSR_CHNL0_RX_CONFIG_RB_SIZE_MASK (0x00030000) /* bits 16-17 */ 597c533a883Shx147065 #define FH_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MASK (0x00008000) /* bit 15 */ 598c533a883Shx147065 #define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_MASK (0x00001000) /* bit 12 */ 599c533a883Shx147065 #define FH_RCSR_CHNL0_RX_CONFIG_RB_TIMEOUT_MASK (0x00000FF0) /* bit 4-11 */ 600c533a883Shx147065 601c533a883Shx147065 #define FH_RCSR_RX_CONFIG_RBDCB_SIZE_BITSHIFT (20) 602c533a883Shx147065 #define FH_RCSR_RX_CONFIG_RB_SIZE_BITSHIFT (16) 603c533a883Shx147065 604c533a883Shx147065 #define FH_RCSR_GET_RDBC_SIZE(reg) \ 605c533a883Shx147065 ((reg & FH_RCSR_RX_CONFIG_RDBC_SIZE_MASK) >> \ 606c533a883Shx147065 FH_RCSR_RX_CONFIG_RDBC_SIZE_BITSHIFT) 607c533a883Shx147065 608c533a883Shx147065 /* 609c533a883Shx147065 * RCSR: channel 1 rx_config register defines 610c533a883Shx147065 */ 611c533a883Shx147065 #define FH_RCSR_CHNL1_RX_CONFIG_DMA_CHNL_EN_MASK (0xC0000000) /* bits 30-31 */ 612c533a883Shx147065 #define FH_RCSR_CHNL1_RX_CONFIG_IRQ_DEST_MASK (0x00003000) /* bits 12-13 */ 613c533a883Shx147065 614c533a883Shx147065 /* 615c533a883Shx147065 * RCSR: rx_config register values 616c533a883Shx147065 */ 617c533a883Shx147065 #define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_VAL (0x00000000) 618c533a883Shx147065 #define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_EOF_VAL (0x40000000) 619c533a883Shx147065 #define FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL (0x80000000) 620c533a883Shx147065 #define FH_RCSR_RX_CONFIG_SINGLE_FRAME_MODE (0x00008000) 621c533a883Shx147065 622c533a883Shx147065 #define FH_RCSR_RX_CONFIG_RDRBD_DISABLE_VAL (0x00000000) 623c533a883Shx147065 #define FH_RCSR_RX_CONFIG_RDRBD_ENABLE_VAL (0x20000000) 624c533a883Shx147065 625c533a883Shx147065 #define IWK_FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K (0x00000000) 626c533a883Shx147065 627c533a883Shx147065 /* 628c533a883Shx147065 * RCSR channel 0 config register values 629c533a883Shx147065 */ 630c533a883Shx147065 #define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_NO_INT_VAL (0x00000000) 631c533a883Shx147065 #define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL (0x00001000) 632c533a883Shx147065 633c533a883Shx147065 /* 634c533a883Shx147065 * RCSR channel 1 config register values 635c533a883Shx147065 */ 636c533a883Shx147065 #define FH_RCSR_CHNL1_RX_CONFIG_IRQ_DEST_NO_INT_VAL (0x00000000) 637c533a883Shx147065 #define FH_RCSR_CHNL1_RX_CONFIG_IRQ_DEST_INT_HOST_VAL (0x00001000) 638c533a883Shx147065 #define FH_RCSR_CHNL1_RX_CONFIG_IRQ_DEST_INT_RTC_VAL (0x00002000) 639c533a883Shx147065 #define FH_RCSR_CHNL1_RX_CONFIG_IRQ_DEST_INT_HOST_RTC_VAL (0x00003000) 640c533a883Shx147065 641c533a883Shx147065 /* 642c533a883Shx147065 * RCSR: rb status register defines 643c533a883Shx147065 */ 644c533a883Shx147065 #define FH_RCSR_RB_BYTE_TO_SEND_MASK (0x0001FFFF) /* bits 0-16 */ 645c533a883Shx147065 646c533a883Shx147065 /* 647c533a883Shx147065 * RSCSR: defs used in normal mode 648c533a883Shx147065 */ 649c533a883Shx147065 #define FH_RSCSR_CHNL0_RBDCB_WPTR_MASK (0x00000FFF) /* bits 0-11 */ 650c533a883Shx147065 651c533a883Shx147065 /* 652c533a883Shx147065 * RSCSR: defs used in service mode 653c533a883Shx147065 */ 654c533a883Shx147065 #define FH_RSCSR_CHNL1_SRAM_ADDR_MASK (0x00FFFFFF) /* bits 0-23 */ 655c533a883Shx147065 #define FH_RSCSR_CHNL1_RB_WPTR_MASK (0x0FFFFFFF) /* bits 0-27 */ 656c533a883Shx147065 #define FH_RSCSR_CHNL1_RB_WPTR_OFFSET_MASK (0x000000FF) /* bits 0-7 */ 657c533a883Shx147065 658c533a883Shx147065 /* 659c533a883Shx147065 * RSSR: RX Enable Error IRQ to Driver register defines 660c533a883Shx147065 */ 661c533a883Shx147065 #define FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV_NO_RBD (0x00400000) /* bit 22 */ 662c533a883Shx147065 663c533a883Shx147065 #define FH_DRAM2SRAM_DRAM_ADDR_HIGH_MASK (0xFFFFFFF00) /* bits 8-35 */ 664c533a883Shx147065 #define FH_DRAM2SRAM_DRAM_ADDR_LOW_MASK (0x000000FF) /* bits 0-7 */ 665c533a883Shx147065 666c533a883Shx147065 #define FH_DRAM2SRAM_DRAM_ADDR_HIGH_BITSHIFT (8) /* bits 8-35 */ 667c533a883Shx147065 668c533a883Shx147065 /* 669c533a883Shx147065 * RX DRAM status regs definitions 670c533a883Shx147065 */ 671c533a883Shx147065 #define FH_RX_RB_NUM_MASK (0x00000FFF) /* bits 0-11 */ 672c533a883Shx147065 #define FH_RX_FRAME_NUM_MASK (0x0FFF0000) /* bits 16-27 */ 673c533a883Shx147065 674c533a883Shx147065 #define FH_RX_RB_NUM_BITSHIFT (0) 675c533a883Shx147065 #define FH_RX_FRAME_NUM_BITSHIFT (16) 676c533a883Shx147065 677c533a883Shx147065 /* 678c533a883Shx147065 * Tx Scheduler 679c533a883Shx147065 * 680c533a883Shx147065 * The Tx Scheduler selects the next frame to be transmitted, chosing TFDs 681c533a883Shx147065 * (Transmit Frame Descriptors) from up to 16 circular queues resident in 682c533a883Shx147065 * host DRAM. It steers each frame's Tx command (which contains the frame 683c533a883Shx147065 * data) through one of up to 7 prioritized Tx DMA FIFO channels within the 684c533a883Shx147065 * device. A queue maps to only one (selectable by driver) Tx DMA channel, 685c533a883Shx147065 * but one DMA channel may take input from several queues. 686c533a883Shx147065 * 687c533a883Shx147065 * Tx DMA channels have dedicated purposes. For 4965, and are used as follows: 688c533a883Shx147065 * BMC TODO: CONFIRM channel assignments, esp for 0/1 689c533a883Shx147065 * 690c533a883Shx147065 * 0 -- EDCA BK (background) frames, lowest priority 691c533a883Shx147065 * 1 -- EDCA BE (best effort) frames, normal priority 692c533a883Shx147065 * 2 -- EDCA VI (video) frames, higher priority 693c533a883Shx147065 * 3 -- EDCA VO (voice) and management frames, highest priority 694c533a883Shx147065 * 4 -- Commands (e.g. RXON, etc.) 695c533a883Shx147065 * 5 -- HCCA short frames 696c533a883Shx147065 * 6 -- HCCA long frames 697c533a883Shx147065 * 7 -- not used by driver (device-internal only) 698c533a883Shx147065 * 699c533a883Shx147065 * Driver should normally map queues 0-6 to Tx DMA/FIFO channels 0-6. 700c533a883Shx147065 * In addition, driver can map queues 7-15 to Tx DMA/FIFO channels 0-3 to 701c533a883Shx147065 * support 11n aggregation via EDCA DMA channels. BMC confirm. 702c533a883Shx147065 * 703c533a883Shx147065 * The driver sets up each queue to work in one of two modes: 704c533a883Shx147065 * 705c533a883Shx147065 * 1) Scheduler-Ack, in which the scheduler automatically supports a 706c533a883Shx147065 * block-ack (BA) window of up to 64 TFDs. In this mode, each queue 707c533a883Shx147065 * contains TFDs for a unique combination of Recipient Address (RA) 708c533a883Shx147065 * and Traffic Identifier (TID), that is, traffic of a given 709c533a883Shx147065 * Quality-Of-Service (QOS) priority, destined for a single station. 710c533a883Shx147065 * 711c533a883Shx147065 * In scheduler-ack mode, the scheduler keeps track of the Tx status of 712c533a883Shx147065 * each frame within the BA window, including whether it's been transmitted, 713c533a883Shx147065 * and whether it's been acknowledged by the receiving station. The device 714c533a883Shx147065 * automatically processes block-acks received from the receiving STA, 715c533a883Shx147065 * and reschedules un-acked frames to be retransmitted (successful 716c533a883Shx147065 * Tx completion may end up being out-of-order). 717c533a883Shx147065 * 718c533a883Shx147065 * The driver must maintain the queue's Byte Count table in host DRAM 719c533a883Shx147065 * (struct iwk_sched_queue_byte_cnt_tbl) for this mode. 720c533a883Shx147065 * This mode does not support fragmentation. 721c533a883Shx147065 * 722c533a883Shx147065 * 2) FIFO (a.k.a. non-Scheduler-ACK), in which each TFD is processed in order. 723c533a883Shx147065 * The device may automatically retry Tx, but will retry only one frame 724c533a883Shx147065 * at a time, until receiving ACK from receiving station, or reaching 725c533a883Shx147065 * retry limit and giving up. 726c533a883Shx147065 * 727c533a883Shx147065 * The command queue (#4) must use this mode! 728c533a883Shx147065 * This mode does not require use of the Byte Count table in host DRAM. 729c533a883Shx147065 * 730c533a883Shx147065 * Driver controls scheduler operation via 3 means: 731c533a883Shx147065 * 1) Scheduler registers 732c533a883Shx147065 * 2) Shared scheduler data base in internal 4956 SRAM 733c533a883Shx147065 * 3) Shared data in host DRAM 734c533a883Shx147065 * 735c533a883Shx147065 * Initialization: 736c533a883Shx147065 * 737c533a883Shx147065 * When loading, driver should allocate memory for: 738c533a883Shx147065 * 1) 16 TFD circular buffers, each with space for (typically) 256 TFDs. 739c533a883Shx147065 * 2) 16 Byte Count circular buffers in 16 KBytes contiguous memory 740c533a883Shx147065 * (1024 bytes for each queue). 741c533a883Shx147065 * 742c533a883Shx147065 * After receiving "Alive" response from uCode, driver must initialize 743c533a883Shx147065 * the following (especially for queue #4, the command queue, otherwise 744c533a883Shx147065 * the driver can't issue commands!): 745c533a883Shx147065 * 746c533a883Shx147065 * 1) 4965's scheduler data base area in SRAM: 747c533a883Shx147065 * a) Read SRAM address of data base area from SCD_SRAM_BASE_ADDR 748c533a883Shx147065 * b) Clear and Init SCD_CONTEXT_DATA_OFFSET area (size 128 bytes) 749c533a883Shx147065 * c) Clear SCD_TX_STTS_BITMAP_OFFSET area (size 256 bytes) 750c533a883Shx147065 * d) Clear (BMC and init?) SCD_TRANSLATE_TBL_OFFSET (size 32 bytes) 751c533a883Shx147065 * 752c533a883Shx147065 * 2) Init SCD_DRAM_BASE_ADDR with physical base of Tx byte count circular 753c533a883Shx147065 * buffer array, allocated by driver in host DRAM. 754c533a883Shx147065 * 755c533a883Shx147065 * 3) 756c533a883Shx147065 */ 757c533a883Shx147065 758c533a883Shx147065 /* 759c533a883Shx147065 * Max Tx window size is the max number of contiguous TFDs that the scheduler 760c533a883Shx147065 * can keep track of at one time when creating block-ack chains of frames. 761c533a883Shx147065 * Note that "64" matches the number of ack bits in a block-ack. 762c533a883Shx147065 * Driver should use SCD_WIN_SIZE and SCD_FRAME_LIMIT values to initialize 763c533a883Shx147065 * SCD_CONTEXT_QUEUE_OFFSET(x) values. 764c533a883Shx147065 */ 765c533a883Shx147065 #define SCD_WIN_SIZE 64 766c533a883Shx147065 #define SCD_FRAME_LIMIT 10 767c533a883Shx147065 768c533a883Shx147065 /* 769c533a883Shx147065 * Memory mapped registers ... access via HBUS_TARG_PRPH regs 770c533a883Shx147065 */ 771c533a883Shx147065 #define SCD_START_OFFSET 0xa02c00 772c533a883Shx147065 773c533a883Shx147065 /* 774c533a883Shx147065 * 4965 tells driver SRAM address for internal scheduler structs via this reg. 775c533a883Shx147065 * Value is valid only after "Alive" response from uCode. 776c533a883Shx147065 */ 777c533a883Shx147065 #define SCD_SRAM_BASE_ADDR (SCD_START_OFFSET + 0x0) 778c533a883Shx147065 779c533a883Shx147065 /* 780c533a883Shx147065 * Driver may need to update queue-empty bits after changing queue's 781c533a883Shx147065 * write and read pointers (indexes) during (re-)initialization (i.e. when 782c533a883Shx147065 * scheduler is not tracking what's happening). 783c533a883Shx147065 * Bit fields: 784c533a883Shx147065 * 31-16: Write mask -- 1: update empty bit, 0: don't change empty bit 785c533a883Shx147065 * 15-00: Empty state, one for each queue -- 1: empty, 0: non-empty 786c533a883Shx147065 * NOTE BMC: THIS REGISTER NOT USED BY LINUX DRIVER. 787c533a883Shx147065 */ 788c533a883Shx147065 #define SCD_EMPTY_BITS (SCD_START_OFFSET + 0x4) 789c533a883Shx147065 790c533a883Shx147065 /* 791c533a883Shx147065 * Physical base address of array of byte count (BC) circular buffers (CBs). 792c533a883Shx147065 * Each Tx queue has a BC CB in host DRAM to support Scheduler-ACK mode. 793c533a883Shx147065 * This register points to BC CB for queue 0, must be on 1024-byte boundary. 794c533a883Shx147065 * Others are spaced by 1024 bytes. 795c533a883Shx147065 * Each BC CB is 2 bytes * (256 + 64) = 740 bytes, followed by 384 bytes pad. 796c533a883Shx147065 * (Index into a queue's BC CB) = (index into queue's TFD CB) = (SSN & 0xff). 797c533a883Shx147065 * Bit fields: 798c533a883Shx147065 * 25-00: Byte Count CB physical address [35:10], must be 1024-byte aligned. 799c533a883Shx147065 */ 800c533a883Shx147065 #define SCD_DRAM_BASE_ADDR (SCD_START_OFFSET + 0x10) 801c533a883Shx147065 #define SCD_AIT (SCD_START_OFFSET + 0x18) 802c533a883Shx147065 803c533a883Shx147065 /* 804c533a883Shx147065 * Enables any/all Tx DMA/FIFO channels. 805c533a883Shx147065 * Scheduler generates requests for only the active channels. 806c533a883Shx147065 * Set this to 0xff to enable all 8 channels (normal usage). 807c533a883Shx147065 * Bit fields: 808c533a883Shx147065 * 7- 0: Enable (1), disable (0), one bit for each channel 0-7 809c533a883Shx147065 */ 810c533a883Shx147065 #define SCD_TXFACT (SCD_START_OFFSET + 0x1c) 811c533a883Shx147065 812c533a883Shx147065 /* 813c533a883Shx147065 * Queue (x) Write Pointers (indexes, really!), one for each Tx queue. 814c533a883Shx147065 * Initialized and updated by driver as new TFDs are added to queue. 815c533a883Shx147065 * NOTE: If using Block Ack, index must correspond to frame's 816c533a883Shx147065 * Start Sequence Number; index = (SSN & 0xff) 817c533a883Shx147065 * NOTE BMC: Alternative to HBUS_TARG_WRPTR, which is what Linux driver uses? 818c533a883Shx147065 */ 819c533a883Shx147065 #define SCD_QUEUE_WRPTR(x) (SCD_START_OFFSET + 0x24 + (x) * 4) 820c533a883Shx147065 821c533a883Shx147065 /* 822c533a883Shx147065 * Queue (x) Read Pointers (indexes, really!), one for each Tx queue. 823c533a883Shx147065 * For FIFO mode, index indicates next frame to transmit. 824c533a883Shx147065 * For Scheduler-ACK mode, index indicates first frame in Tx window. 825c533a883Shx147065 * Initialized by driver, updated by scheduler. 826c533a883Shx147065 */ 827c533a883Shx147065 #define SCD_QUEUE_RDPTR(x) (SCD_START_OFFSET + 0x64 + (x) * 4) 828c533a883Shx147065 #define SCD_SETQUEUENUM (SCD_START_OFFSET + 0xa4) 829c533a883Shx147065 #define SCD_SET_TXSTAT_TXED (SCD_START_OFFSET + 0xa8) 830c533a883Shx147065 #define SCD_SET_TXSTAT_DONE (SCD_START_OFFSET + 0xac) 831c533a883Shx147065 #define SCD_SET_TXSTAT_NOT_SCHD (SCD_START_OFFSET + 0xb0) 832c533a883Shx147065 #define SCD_DECREASE_CREDIT (SCD_START_OFFSET + 0xb4) 833c533a883Shx147065 #define SCD_DECREASE_SCREDIT (SCD_START_OFFSET + 0xb8) 834c533a883Shx147065 #define SCD_LOAD_CREDIT (SCD_START_OFFSET + 0xbc) 835c533a883Shx147065 #define SCD_LOAD_SCREDIT (SCD_START_OFFSET + 0xc0) 836c533a883Shx147065 #define SCD_BAR (SCD_START_OFFSET + 0xc4) 837c533a883Shx147065 #define SCD_BAR_DW0 (SCD_START_OFFSET + 0xc8) 838c533a883Shx147065 #define SCD_BAR_DW1 (SCD_START_OFFSET + 0xcc) 839c533a883Shx147065 840c533a883Shx147065 /* 841c533a883Shx147065 * Select which queues work in chain mode (1) vs. not (0). 842c533a883Shx147065 * Use chain mode to build chains of aggregated frames. 843c533a883Shx147065 * Bit fields: 844c533a883Shx147065 * 31-16: Reserved 845c533a883Shx147065 * 15-00: Mode, one bit for each queue -- 1: Chain mode, 0: one-at-a-time 846c533a883Shx147065 * NOTE: If driver sets up queue for chain mode, it should be also set up 847c533a883Shx147065 * Scheduler-ACK mode as well, via SCD_QUEUE_STATUS_BITS(x). 848c533a883Shx147065 */ 849c533a883Shx147065 #define SCD_QUEUECHAIN_SEL (SCD_START_OFFSET + 0xd0) 850c533a883Shx147065 #define SCD_QUERY_REQ (SCD_START_OFFSET + 0xd8) 851c533a883Shx147065 #define SCD_QUERY_RES (SCD_START_OFFSET + 0xdc) 852c533a883Shx147065 #define SCD_PENDING_FRAMES (SCD_START_OFFSET + 0xe0) 853c533a883Shx147065 854c533a883Shx147065 /* 855c533a883Shx147065 * Select which queues interrupt driver when read pointer (index) increments. 856c533a883Shx147065 * Bit fields: 857c533a883Shx147065 * 31-16: Reserved 858c533a883Shx147065 * 15-00: Interrupt enable, one bit for each queue -- 1: enabled, 0: disabled 859c533a883Shx147065 * NOTE BMC: THIS FUNCTIONALITY IS APPARENTLY A NO-OP. 860c533a883Shx147065 */ 861c533a883Shx147065 #define SCD_INTERRUPT_MASK (SCD_START_OFFSET + 0xe4) 862c533a883Shx147065 #define SCD_INTERRUPT_THRESHOLD (SCD_START_OFFSET + 0xe8) 863c533a883Shx147065 #define SCD_QUERY_MIN_FRAME_SIZE (SCD_START_OFFSET + 0x100) 864c533a883Shx147065 865c533a883Shx147065 /* 866c533a883Shx147065 * Queue search status registers. One for each queue. 867c533a883Shx147065 * Sets up queue mode and assigns queue to Tx DMA channel. 868c533a883Shx147065 * Bit fields: 869c533a883Shx147065 * 19-10: Write mask/enable bits for bits 0-9 870c533a883Shx147065 * 9: Driver should init to "0" 871c533a883Shx147065 * 8: Scheduler-ACK mode (1), non-Scheduler-ACK (i.e. FIFO) mode (0). 872c533a883Shx147065 * Driver should init to "1" for aggregation mode, or "0" otherwise. 873c533a883Shx147065 * 7-6: Driver should init to "0" 874c533a883Shx147065 * 5: Window Size Left; indicates whether scheduler can request 875c533a883Shx147065 * another TFD, based on window size, etc. Driver should init 876c533a883Shx147065 * this bit to "1" for aggregation mode, or "0" for non-agg. 877c533a883Shx147065 * 4-1: Tx FIFO to use (range 0-7). 878c533a883Shx147065 * 0: Queue is active (1), not active (0). 879c533a883Shx147065 * Other bits should be written as "0" 880c533a883Shx147065 * 881c533a883Shx147065 * NOTE: If enabling Scheduler-ACK mode, chain mode should also be enabled 882c533a883Shx147065 * via SCD_QUEUECHAIN_SEL. 883c533a883Shx147065 */ 884c533a883Shx147065 #define SCD_QUEUE_STATUS_BITS(x) (SCD_START_OFFSET + 0x104 + (x) * 4) 885c533a883Shx147065 886c533a883Shx147065 /* 887c533a883Shx147065 * 4965 internal SRAM structures for scheduler, shared with driver ... 888c533a883Shx147065 * Driver should clear and initialize the following areas after receiving 889c533a883Shx147065 * "Alive" response from 4965 uCode, i.e. after initial 890c533a883Shx147065 * uCode load, or after a uCode load done for error recovery: 891c533a883Shx147065 * 892c533a883Shx147065 * SCD_CONTEXT_DATA_OFFSET (size 128 bytes) 893c533a883Shx147065 * SCD_TX_STTS_BITMAP_OFFSET (size 256 bytes) 894c533a883Shx147065 * SCD_TRANSLATE_TBL_OFFSET (size 32 bytes) 895c533a883Shx147065 * 896c533a883Shx147065 * Driver reads base address of this scheduler area from SCD_SRAM_BASE_ADDR. 897c533a883Shx147065 * All OFFSET values must be added to this base address. 898c533a883Shx147065 * Use HBUS_TARG_MEM_* registers to access SRAM. 899c533a883Shx147065 */ 900c533a883Shx147065 901c533a883Shx147065 /* 902c533a883Shx147065 * Queue context. One 8-byte entry for each of 16 queues. 903c533a883Shx147065 * 904c533a883Shx147065 * Driver should clear this entire area (size 0x80) to 0 after receiving 905c533a883Shx147065 * "Alive" notification from uCode. Additionally, driver should init 906c533a883Shx147065 * each queue's entry as follows: 907c533a883Shx147065 * 908c533a883Shx147065 * LS Dword bit fields: 909c533a883Shx147065 * 0-06: Max Tx window size for Scheduler-ACK. Driver should init to 64. 910c533a883Shx147065 * 911c533a883Shx147065 * MS Dword bit fields: 912c533a883Shx147065 * 16-22: Frame limit. Driver should init to 10 (0xa). 913c533a883Shx147065 * 914c533a883Shx147065 * Driver should init all other bits to 0. 915c533a883Shx147065 * 916c533a883Shx147065 * Init must be done after driver receives "Alive" response from 4965 uCode, 917c533a883Shx147065 * and when setting up queue for aggregation. 918c533a883Shx147065 */ 919c533a883Shx147065 #define SCD_CONTEXT_DATA_OFFSET 0x380 920c533a883Shx147065 921c533a883Shx147065 /* 922c533a883Shx147065 * Tx Status Bitmap 923c533a883Shx147065 * 924c533a883Shx147065 * Driver should clear this entire area (size 0x100) to 0 after receiving 925c533a883Shx147065 * "Alive" notification from uCode. Area is used only by device itself; 926c533a883Shx147065 * no other support (besides clearing) is required from driver. 927c533a883Shx147065 */ 928c533a883Shx147065 #define SCD_TX_STTS_BITMAP_OFFSET 0x400 929c533a883Shx147065 930c533a883Shx147065 /* 931c533a883Shx147065 * RAxTID to queue translation mapping. 932c533a883Shx147065 * 933c533a883Shx147065 * When queue is in Scheduler-ACK mode, frames placed in a that queue must be 934c533a883Shx147065 * for only one combination of receiver address (RA) and traffic ID (TID), i.e. 935c533a883Shx147065 * one QOS priority level destined for one station (for this link, not final 936c533a883Shx147065 * destination). The SCD_TRANSLATE_TABLE area provides 16 16-bit mappings, 937c533a883Shx147065 * one for each of the 16 queues. If queue is not in Scheduler-ACK mode, the 938c533a883Shx147065 * device ignores the mapping value. 939c533a883Shx147065 * 940c533a883Shx147065 * Bit fields, for each 16-bit map: 941c533a883Shx147065 * 15-9: Reserved, set to 0 942c533a883Shx147065 * 8-4: Index into device's station table for recipient station 943c533a883Shx147065 * 3-0: Traffic ID (tid), range 0-15 944c533a883Shx147065 * 945c533a883Shx147065 * Driver should clear this entire area (size 32 bytes) to 0 after receiving 946c533a883Shx147065 * "Alive" notification from uCode. To update a 16-bit map value, driver 947c533a883Shx147065 * must read a dword-aligned value from device SRAM, replace the 16-bit map 948c533a883Shx147065 * value of interest, and write the dword value back into device SRAM. 949c533a883Shx147065 */ 950c533a883Shx147065 #define SCD_TRANSLATE_TBL_OFFSET 0x500 951c533a883Shx147065 #define SCD_CONTEXT_QUEUE_OFFSET(x) (SCD_CONTEXT_DATA_OFFSET + ((x) * 8)) 952c533a883Shx147065 #define SCD_TRANSLATE_TBL_OFFSET_QUEUE(x) \ 953c533a883Shx147065 ((SCD_TRANSLATE_TBL_OFFSET + ((x) * 2)) & 0xfffffffc) 954c533a883Shx147065 955c533a883Shx147065 /* 956c533a883Shx147065 * Mask to enable contiguous Tx DMA/FIFO channels between "lo" and "hi". 957c533a883Shx147065 */ 958c533a883Shx147065 #define SCD_TXFACT_REG_TXFIFO_MASK(lo, hi) \ 959c533a883Shx147065 ((1<<(hi))|((1<<(hi))-(1<<(lo)))) 960c533a883Shx147065 961c533a883Shx147065 #define SCD_MODE_REG_BIT_SEARCH_MODE (1<<0) 962c533a883Shx147065 #define SCD_MODE_REG_BIT_SBYP_MODE (1<<1) 963c533a883Shx147065 964c533a883Shx147065 #define SCD_TXFIFO_POS_TID (0) 965c533a883Shx147065 #define SCD_TXFIFO_POS_RA (4) 966c533a883Shx147065 #define SCD_QUEUE_STTS_REG_POS_ACTIVE (0) 967c533a883Shx147065 #define SCD_QUEUE_STTS_REG_POS_TXF (1) 968c533a883Shx147065 #define SCD_QUEUE_STTS_REG_POS_WSL (5) 969c533a883Shx147065 #define SCD_QUEUE_STTS_REG_POS_SCD_ACK (8) 970c533a883Shx147065 #define SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN (10) 971c533a883Shx147065 #define SCD_QUEUE_STTS_REG_MSK (0x0007FC00) 972c533a883Shx147065 973c533a883Shx147065 #define SCD_QUEUE_RA_TID_MAP_RATID_MSK (0x01FF) 974c533a883Shx147065 975c533a883Shx147065 #define SCD_QUEUE_CTX_REG1_WIN_SIZE_POS (0) 976c533a883Shx147065 #define SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK (0x0000007F) 977c533a883Shx147065 #define SCD_QUEUE_CTX_REG1_CREDIT_POS (8) 978c533a883Shx147065 #define SCD_QUEUE_CTX_REG1_CREDIT_MSK (0x00FFFF00) 979c533a883Shx147065 #define SCD_QUEUE_CTX_REG1_SUPER_CREDIT_POS (24) 980c533a883Shx147065 #define SCD_QUEUE_CTX_REG1_SUPER_CREDIT_MSK (0xFF000000) 981c533a883Shx147065 #define SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS (16) 982c533a883Shx147065 #define SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK (0x007F0000) 983c533a883Shx147065 984c533a883Shx147065 #define CSR_HW_IF_CONFIG_REG_BIT_KEDRON_R (0x00000010) 985c533a883Shx147065 #define CSR_HW_IF_CONFIG_REG_MSK_BOARD_VER (0x00000C00) 986c533a883Shx147065 #define CSR_HW_IF_CONFIG_REG_BIT_MAC_SI (0x00000100) 987c533a883Shx147065 #define CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI (0x00000200) 988c533a883Shx147065 #define CSR_HW_IF_CONFIG_REG_EEP_SEM (0x00200000) 989c533a883Shx147065 990c533a883Shx147065 /* IWK-END */ 991c533a883Shx147065 992c533a883Shx147065 #define RX_RES_PHY_CNT 14 993c533a883Shx147065 994c533a883Shx147065 #define STATISTICS_FLG_CLEAR (0x1) 995c533a883Shx147065 #define STATISTICS_FLG_DISABLE_NOTIFICATION (0x2) 996c533a883Shx147065 997c533a883Shx147065 #define STATISTICS_REPLY_FLG_CLEAR (0x1) 998c533a883Shx147065 #define STATISTICS_REPLY_FLG_BAND_24G_MSK (0x2) 999c533a883Shx147065 #define STATISTICS_REPLY_FLG_TGJ_NARROW_BAND_MSK (0x4) 1000c533a883Shx147065 #define STATISTICS_REPLY_FLG_FAT_MODE_MSK (0x8) 1001c533a883Shx147065 #define RX_PHY_FLAGS_ANTENNAE_OFFSET (4) 1002c533a883Shx147065 #define RX_PHY_FLAGS_ANTENNAE_MASK (0x70) 1003c533a883Shx147065 1004c533a883Shx147065 /* 1005c533a883Shx147065 * Register and values 1006c533a883Shx147065 */ 1007c533a883Shx147065 #define CSR_BASE (0x0) 1008c533a883Shx147065 #define HBUS_BASE (0x400) 1009c533a883Shx147065 1010c533a883Shx147065 #define HBUS_TARG_MBX_C (HBUS_BASE+0x030) 1011c533a883Shx147065 1012c533a883Shx147065 /* 1013c533a883Shx147065 * CSR (control and status registers) 1014c533a883Shx147065 */ 1015c533a883Shx147065 #define CSR_SW_VER (CSR_BASE+0x000) 1016c533a883Shx147065 #define CSR_HW_IF_CONFIG_REG (CSR_BASE+0x000) /* hardware interface config */ 1017c533a883Shx147065 #define CSR_INT_COALESCING (CSR_BASE+0x004) /* accum ints, 32-usec units */ 1018c533a883Shx147065 #define CSR_INT (CSR_BASE+0x008) /* host interrupt status/ack */ 1019c533a883Shx147065 #define CSR_INT_MASK (CSR_BASE+0x00c) /* host interrupt enable */ 1020c533a883Shx147065 #define CSR_FH_INT_STATUS (CSR_BASE+0x010) /* busmaster int status/ack */ 1021c533a883Shx147065 #define CSR_GPIO_IN (CSR_BASE+0x018) /* read external chip pins */ 1022c533a883Shx147065 #define CSR_RESET (CSR_BASE+0x020) /* busmaster enable, NMI, etc */ 1023c533a883Shx147065 #define CSR_GP_CNTRL (CSR_BASE+0x024) 1024c533a883Shx147065 /* 0x028 - reserved */ 1025c533a883Shx147065 #define CSR_EEPROM_REG (CSR_BASE+0x02c) 1026c533a883Shx147065 #define CSR_EEPROM_GP (CSR_BASE+0x030) 1027c533a883Shx147065 #define CSR_UCODE_DRV_GP1 (CSR_BASE+0x054) 1028c533a883Shx147065 #define CSR_UCODE_DRV_GP1_SET (CSR_BASE+0x058) 1029c533a883Shx147065 #define CSR_UCODE_DRV_GP1_CLR (CSR_BASE+0x05c) 1030c533a883Shx147065 #define CSR_UCODE_DRV_GP2 (CSR_BASE+0x060) 1031c533a883Shx147065 #define CSR_GIO_CHICKEN_BITS (CSR_BASE+0x100) 1032c533a883Shx147065 #define CSR_ANA_PLL_CFG (CSR_BASE+0x20c) 1033c533a883Shx147065 #define CSR_HW_REV_WA_REG (CSR_BASE+0x22C) 1034c533a883Shx147065 1035c533a883Shx147065 /* 1036c533a883Shx147065 * BSM (Bootstrap State Machine) 1037c533a883Shx147065 */ 1038c533a883Shx147065 #define BSM_BASE (CSR_BASE + 0x3400) 1039c533a883Shx147065 1040c533a883Shx147065 #define BSM_WR_CTRL_REG (BSM_BASE + 0x000) /* ctl and status */ 1041c533a883Shx147065 #define BSM_WR_MEM_SRC_REG (BSM_BASE + 0x004) /* source in BSM mem */ 1042c533a883Shx147065 #define BSM_WR_MEM_DST_REG (BSM_BASE + 0x008) /* dest in SRAM mem */ 1043c533a883Shx147065 #define BSM_WR_DWCOUNT_REG (BSM_BASE + 0x00C) /* bytes */ 1044c533a883Shx147065 #define BSM_WR_STATUS_REG (BSM_BASE + 0x010) /* bit 0: 1 == done */ 1045c533a883Shx147065 1046c533a883Shx147065 /* 1047c533a883Shx147065 * pointers and size regs for bootstrap load and data SRAM save 1048c533a883Shx147065 */ 1049c533a883Shx147065 #define BSM_DRAM_INST_PTR_REG (BSM_BASE + 0x090) 1050c533a883Shx147065 #define BSM_DRAM_INST_BYTECOUNT_REG (BSM_BASE + 0x094) 1051c533a883Shx147065 #define BSM_DRAM_DATA_PTR_REG (BSM_BASE + 0x098) 1052c533a883Shx147065 #define BSM_DRAM_DATA_BYTECOUNT_REG (BSM_BASE + 0x09C) 1053c533a883Shx147065 1054c533a883Shx147065 /* 1055c533a883Shx147065 * BSM special memory, stays powered during power-save sleeps 1056c533a883Shx147065 */ 1057c533a883Shx147065 #define BSM_SRAM_LOWER_BOUND (CSR_BASE + 0x3800) 1058c533a883Shx147065 #define BSM_SRAM_SIZE (1024) 1059c533a883Shx147065 1060c533a883Shx147065 1061c533a883Shx147065 /* 1062c533a883Shx147065 * card static random access memory (SRAM) for processor data and instructs 1063c533a883Shx147065 */ 1064c533a883Shx147065 #define RTC_INST_LOWER_BOUND (0x00000) 1065c533a883Shx147065 #define ALM_RTC_INST_UPPER_BOUND (0x14000) 1066c533a883Shx147065 1067c533a883Shx147065 #define RTC_DATA_LOWER_BOUND (0x800000) 1068c533a883Shx147065 #define ALM_RTC_DATA_UPPER_BOUND (0x808000) 1069c533a883Shx147065 1070c533a883Shx147065 /* 1071c533a883Shx147065 * HBUS (Host-side bus) 1072c533a883Shx147065 */ 1073c533a883Shx147065 #define HBUS_TARG_MEM_RADDR (HBUS_BASE+0x00c) 1074c533a883Shx147065 #define HBUS_TARG_MEM_WADDR (HBUS_BASE+0x010) 1075c533a883Shx147065 #define HBUS_TARG_MEM_WDAT (HBUS_BASE+0x018) 1076c533a883Shx147065 #define HBUS_TARG_MEM_RDAT (HBUS_BASE+0x01c) 1077c533a883Shx147065 #define HBUS_TARG_PRPH_WADDR (HBUS_BASE+0x044) 1078c533a883Shx147065 #define HBUS_TARG_PRPH_RADDR (HBUS_BASE+0x048) 1079c533a883Shx147065 #define HBUS_TARG_PRPH_WDAT (HBUS_BASE+0x04c) 1080c533a883Shx147065 #define HBUS_TARG_PRPH_RDAT (HBUS_BASE+0x050) 1081c533a883Shx147065 #define HBUS_TARG_WRPTR (HBUS_BASE+0x060) 1082c533a883Shx147065 1083c533a883Shx147065 /* 1084c533a883Shx147065 * HW I/F configuration 1085c533a883Shx147065 */ 1086c533a883Shx147065 #define CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MB (0x00000100) 1087c533a883Shx147065 #define CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MM (0x00000200) 1088c533a883Shx147065 #define CSR_HW_IF_CONFIG_REG_BIT_SKU_MRC (0x00000400) 1089c533a883Shx147065 #define CSR_HW_IF_CONFIG_REG_BIT_BOARD_TYPE (0x00000800) 1090c533a883Shx147065 #define CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A (0x00000000) 1091c533a883Shx147065 #define CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B (0x00001000) 1092c533a883Shx147065 1093c533a883Shx147065 #define CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP (0x00000001) 1094c533a883Shx147065 #define CSR_UCODE_SW_BIT_RFKILL (0x00000002) 1095c533a883Shx147065 #define CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED (0x00000004) 1096c533a883Shx147065 #define CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT (0x00000008) 1097c533a883Shx147065 1098c533a883Shx147065 #define CSR_GPIO_IN_BIT_AUX_POWER (0x00000200) 1099c533a883Shx147065 #define CSR_GPIO_IN_VAL_VAUX_PWR_SRC (0x00000000) 1100c533a883Shx147065 #define CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX (0x00800000) 1101c533a883Shx147065 #define CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER (0x20000000) 1102c533a883Shx147065 #define CSR_GPIO_IN_VAL_VMAIN_PWR_SRC CSR_GPIO_IN_BIT_AUX_POWER 1103c533a883Shx147065 1104c533a883Shx147065 #define PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT (0x80000000) 1105c533a883Shx147065 1106c533a883Shx147065 /* 1107c533a883Shx147065 * interrupt flags in INTA, set by uCode or hardware (e.g. dma), 1108c533a883Shx147065 * acknowledged (reset) by host writing "1" to flagged bits. 1109c533a883Shx147065 */ 1110c533a883Shx147065 #define BIT_INT_FH_RX \ 1111c533a883Shx147065 (((uint32_t)1) << 31) /* Rx DMA, cmd responses, FH_INT[17:16] */ 1112c533a883Shx147065 #define BIT_INT_ERR (1<<29) /* DMA hardware error FH_INT[31] */ 1113c533a883Shx147065 #define BIT_INT_FH_TX (1<<27) /* Tx DMA FH_INT[1:0] */ 1114c533a883Shx147065 #define BIT_INT_MAC_CLK_ACTV (1<<26) /* NIC controller's clock toggled on/off */ 1115c533a883Shx147065 #define BIT_INT_SWERROR (1<<25) /* uCode error */ 1116c533a883Shx147065 #define BIT_INT_RF_KILL (1<<7) /* HW RFKILL switch GP_CNTRL[27] toggled */ 1117c533a883Shx147065 #define BIT_INT_CT_KILL (1<<6) /* Critical temp (chip too hot) rfkill */ 1118c533a883Shx147065 #define BIT_INT_SW_RX (1<<3) /* Rx, command responses, 3945 */ 1119c533a883Shx147065 #define BIT_INT_WAKEUP (1<<1) /* NIC controller waking up (pwr mgmt) */ 1120c533a883Shx147065 #define BIT_INT_ALIVE (1<<0) /* uCode interrupts once it initializes */ 1121c533a883Shx147065 1122c533a883Shx147065 #define CSR_INI_SET_MASK (BIT_INT_FH_RX | \ 1123c533a883Shx147065 BIT_INT_ERR | \ 1124c533a883Shx147065 BIT_INT_FH_TX | \ 1125c533a883Shx147065 BIT_INT_SWERROR | \ 1126c533a883Shx147065 BIT_INT_RF_KILL | \ 1127c533a883Shx147065 BIT_INT_SW_RX | \ 1128c533a883Shx147065 BIT_INT_WAKEUP | \ 1129c533a883Shx147065 BIT_INT_ALIVE) 1130c533a883Shx147065 1131c533a883Shx147065 /* 1132c533a883Shx147065 * interrupt flags in FH (flow handler) (PCI busmaster DMA) 1133c533a883Shx147065 */ 1134c533a883Shx147065 #define BIT_FH_INT_ERR (((uint32_t)1) << 31) /* Error */ 1135c533a883Shx147065 #define BIT_FH_INT_HI_PRIOR (1<<30) /* High priority Rx,bypass coalescing */ 1136c533a883Shx147065 #define BIT_FH_INT_RX_CHNL2 (1<<18) /* Rx channel 2 (3945 only) */ 1137c533a883Shx147065 #define BIT_FH_INT_RX_CHNL1 (1<<17) /* Rx channel 1 */ 1138c533a883Shx147065 #define BIT_FH_INT_RX_CHNL0 (1<<16) /* Rx channel 0 */ 1139c533a883Shx147065 #define BIT_FH_INT_TX_CHNL6 (1<<6) /* Tx channel 6 (3945 only) */ 1140c533a883Shx147065 #define BIT_FH_INT_TX_CHNL1 (1<<1) /* Tx channel 1 */ 1141c533a883Shx147065 #define BIT_FH_INT_TX_CHNL0 (1<<0) /* Tx channel 0 */ 1142c533a883Shx147065 1143c533a883Shx147065 #define FH_INT_RX_MASK (BIT_FH_INT_HI_PRIOR | \ 1144c533a883Shx147065 BIT_FH_INT_RX_CHNL2 | \ 1145c533a883Shx147065 BIT_FH_INT_RX_CHNL1 | \ 1146c533a883Shx147065 BIT_FH_INT_RX_CHNL0) 1147c533a883Shx147065 1148c533a883Shx147065 #define FH_INT_TX_MASK (BIT_FH_INT_TX_CHNL6 | \ 1149c533a883Shx147065 BIT_FH_INT_TX_CHNL1 | \ 1150c533a883Shx147065 BIT_FH_INT_TX_CHNL0) 1151c533a883Shx147065 1152c533a883Shx147065 /* 1153c533a883Shx147065 * RESET 1154c533a883Shx147065 */ 1155c533a883Shx147065 #define CSR_RESET_REG_FLAG_NEVO_RESET (0x00000001) 1156c533a883Shx147065 #define CSR_RESET_REG_FLAG_FORCE_NMI (0x00000002) 1157c533a883Shx147065 #define CSR_RESET_REG_FLAG_SW_RESET (0x00000080) 1158c533a883Shx147065 #define CSR_RESET_REG_FLAG_MASTER_DISABLED (0x00000100) 1159c533a883Shx147065 #define CSR_RESET_REG_FLAG_STOP_MASTER (0x00000200) 1160c533a883Shx147065 1161c533a883Shx147065 /* 1162c533a883Shx147065 * GP (general purpose) CONTROL 1163c533a883Shx147065 */ 1164c533a883Shx147065 #define CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY (0x00000001) 1165c533a883Shx147065 #define CSR_GP_CNTRL_REG_FLAG_INIT_DONE (0x00000004) 1166c533a883Shx147065 #define CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ (0x00000008) 1167c533a883Shx147065 #define CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP (0x00000010) 1168c533a883Shx147065 1169c533a883Shx147065 #define CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN (0x00000001) 1170c533a883Shx147065 1171c533a883Shx147065 #define CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE (0x07000000) 1172c533a883Shx147065 #define CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE (0x04000000) 1173c533a883Shx147065 #define CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW (0x08000000) 1174c533a883Shx147065 1175c533a883Shx147065 /* 1176c533a883Shx147065 * APMG (power management) constants 1177c533a883Shx147065 */ 1178c533a883Shx147065 #define APMG_CLK_CTRL_REG (0x003000) 1179c533a883Shx147065 #define ALM_APMG_CLK_EN (0x003004) 1180c533a883Shx147065 #define ALM_APMG_CLK_DIS (0x003008) 1181c533a883Shx147065 #define ALM_APMG_PS_CTL (0x00300c) 1182c533a883Shx147065 #define ALM_APMG_PCIDEV_STT (0x003010) 1183c533a883Shx147065 #define ALM_APMG_RFKILL (0x003014) 1184c533a883Shx147065 #define ALM_APMG_LARC_INT (0x00301c) 1185c533a883Shx147065 #define ALM_APMG_LARC_INT_MSK (0x003020) 1186c533a883Shx147065 1187c533a883Shx147065 #define APMG_CLK_REG_VAL_DMA_CLK_RQT (0x00000200) 1188c533a883Shx147065 #define APMG_CLK_REG_VAL_BSM_CLK_RQT (0x00000800) 1189c533a883Shx147065 1190c533a883Shx147065 #define APMG_PS_CTRL_REG_VAL_ALM_R_RESET_REQ (0x04000000) 1191c533a883Shx147065 1192c533a883Shx147065 #define APMG_DEV_STATE_REG_VAL_L1_ACTIVE_DISABLE (0x00000800) 1193c533a883Shx147065 1194c533a883Shx147065 #define APMG_PS_CTRL_REG_MSK_POWER_SRC (0x03000000) 1195c533a883Shx147065 #define APMG_PS_CTRL_REG_VAL_POWER_SRC_VMAIN (0x00000000) 1196c533a883Shx147065 #define APMG_PS_CTRL_REG_VAL_POWER_SRC_VAUX (0x01000000) 1197c533a883Shx147065 1198c533a883Shx147065 /* 1199c533a883Shx147065 * BSM (bootstrap state machine) 1200c533a883Shx147065 */ 1201c533a883Shx147065 /* 1202c533a883Shx147065 * start boot load now 1203c533a883Shx147065 */ 1204c533a883Shx147065 #define BSM_WR_CTRL_REG_BIT_START (0x80000000) 1205c533a883Shx147065 /* 1206c533a883Shx147065 * enable boot after power up 1207c533a883Shx147065 */ 1208c533a883Shx147065 #define BSM_WR_CTRL_REG_BIT_START_EN (0x40000000) 1209c533a883Shx147065 1210c533a883Shx147065 /* 1211c533a883Shx147065 * DBM 1212c533a883Shx147065 */ 1213c533a883Shx147065 #define ALM_FH_SRVC_CHNL (6) 1214c533a883Shx147065 1215c533a883Shx147065 #define ALM_FH_RCSR_RX_CONFIG_REG_POS_RBDC_SIZE (20) 1216c533a883Shx147065 #define ALM_FH_RCSR_RX_CONFIG_REG_POS_IRQ_RBTH (4) 1217c533a883Shx147065 1218c533a883Shx147065 #define ALM_FH_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN (0x08000000) 1219c533a883Shx147065 1220c533a883Shx147065 #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE (0x80000000) 1221c533a883Shx147065 1222c533a883Shx147065 #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE (0x20000000) 1223c533a883Shx147065 1224c533a883Shx147065 #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_MAX_FRAG_SIZE_128 (0x01000000) 1225c533a883Shx147065 1226c533a883Shx147065 #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_IRQ_DEST_INT_HOST (0x00001000) 1227c533a883Shx147065 1228c533a883Shx147065 #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH (0x00000000) 1229c533a883Shx147065 1230c533a883Shx147065 #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000) 1231c533a883Shx147065 #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRIVER (0x00000001) 1232c533a883Shx147065 1233c533a883Shx147065 #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL (0x00000000) 1234c533a883Shx147065 #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL (0x00000008) 1235c533a883Shx147065 1236c533a883Shx147065 #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000) 1237c533a883Shx147065 1238c533a883Shx147065 #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000) 1239c533a883Shx147065 1240c533a883Shx147065 #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000) 1241c533a883Shx147065 #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000) 1242c533a883Shx147065 1243c533a883Shx147065 #define ALM_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00004000) 1244c533a883Shx147065 1245c533a883Shx147065 #define ALM_FH_TCSR_CHNL_TX_BUF_STS_REG_BIT_TFDB_WPTR (0x00000001) 1246c533a883Shx147065 1247c533a883Shx147065 #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON (0xFF000000) 1248c533a883Shx147065 #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON (0x00FF0000) 1249c533a883Shx147065 1250c533a883Shx147065 #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B (0x00000400) 1251c533a883Shx147065 1252c533a883Shx147065 #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON (0x00000100) 1253c533a883Shx147065 #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON (0x00000080) 1254c533a883Shx147065 1255c533a883Shx147065 #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH (0x00000020) 1256c533a883Shx147065 #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH (0x00000005) 1257c533a883Shx147065 1258c533a883Shx147065 #define ALM_TB_MAX_BYTES_COUNT (0xFFF0) 1259c533a883Shx147065 1260c533a883Shx147065 #define ALM_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_channel) \ 1261c533a883Shx147065 ((1LU << _channel) << 24) 1262c533a883Shx147065 #define ALM_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_channel) \ 1263c533a883Shx147065 ((1LU << _channel) << 16) 1264c533a883Shx147065 1265c533a883Shx147065 #define ALM_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_channel) \ 1266c533a883Shx147065 (ALM_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_channel) | \ 1267c533a883Shx147065 ALM_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_channel)) 1268c533a883Shx147065 #define PCI_CFG_REV_ID_BIT_BASIC_SKU (0x40) /* bit 6 */ 1269c533a883Shx147065 #define PCI_CFG_REV_ID_BIT_RTP (0x80) /* bit 7 */ 1270c533a883Shx147065 1271c533a883Shx147065 #define HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED (0x00000004) 1272c533a883Shx147065 1273c533a883Shx147065 #define TFD_QUEUE_MIN 0 1274c533a883Shx147065 #define TFD_QUEUE_MAX 6 1275c533a883Shx147065 #define TFD_QUEUE_SIZE_MAX (256) 1276c533a883Shx147065 1277c533a883Shx147065 /* 1278c533a883Shx147065 * spectrum and channel data structures 1279c533a883Shx147065 */ 1280c533a883Shx147065 #define IWK_NUM_SCAN_RATES (2) 1281c533a883Shx147065 1282c533a883Shx147065 #define IWK_SCAN_FLAG_24GHZ (1<<0) 1283c533a883Shx147065 #define IWK_SCAN_FLAG_52GHZ (1<<1) 1284c533a883Shx147065 #define IWK_SCAN_FLAG_ACTIVE (1<<2) 1285c533a883Shx147065 #define IWK_SCAN_FLAG_DIRECT (1<<3) 1286c533a883Shx147065 1287c533a883Shx147065 #define IWK_MAX_CMD_SIZE 1024 1288c533a883Shx147065 1289c533a883Shx147065 #define IWK_DEFAULT_TX_RETRY 15 1290c533a883Shx147065 #define IWK_MAX_TX_RETRY 16 1291c533a883Shx147065 1292c533a883Shx147065 #define RFD_SIZE 4 1293c533a883Shx147065 #define NUM_TFD_CHUNKS 4 1294c533a883Shx147065 1295c533a883Shx147065 #define RX_QUEUE_SIZE 256 1296c533a883Shx147065 #define RX_QUEUE_SIZE_LOG 8 1297c533a883Shx147065 1298c533a883Shx147065 /* 1299c533a883Shx147065 * TX Queue Flag Definitions 1300c533a883Shx147065 */ 1301c533a883Shx147065 /* 1302c533a883Shx147065 * use short preamble 1303c533a883Shx147065 */ 1304c533a883Shx147065 #define DCT_FLAG_LONG_PREAMBLE 0x00 1305c533a883Shx147065 #define DCT_FLAG_SHORT_PREAMBLE 0x04 1306c533a883Shx147065 1307c533a883Shx147065 /* 1308c533a883Shx147065 * ACK rx is expected to follow 1309c533a883Shx147065 */ 1310c533a883Shx147065 #define DCT_FLAG_ACK_REQD 0x80 1311c533a883Shx147065 1312c533a883Shx147065 #define IWK_MB_DISASSOCIATE_THRESHOLD_DEFAULT 24 1313c533a883Shx147065 #define IWK_MB_ROAMING_THRESHOLD_DEFAULT 8 1314c533a883Shx147065 #define IWK_REAL_RATE_RX_PACKET_THRESHOLD 300 1315c533a883Shx147065 1316c533a883Shx147065 /* 1317c533a883Shx147065 * QoS definitions 1318c533a883Shx147065 */ 1319c533a883Shx147065 #define CW_MIN_OFDM 15 1320c533a883Shx147065 #define CW_MAX_OFDM 1023 1321c533a883Shx147065 #define CW_MIN_CCK 31 1322c533a883Shx147065 #define CW_MAX_CCK 1023 1323c533a883Shx147065 1324c533a883Shx147065 #define QOS_TX0_CW_MIN_OFDM CW_MIN_OFDM 1325c533a883Shx147065 #define QOS_TX1_CW_MIN_OFDM CW_MIN_OFDM 1326c533a883Shx147065 #define QOS_TX2_CW_MIN_OFDM ((CW_MIN_OFDM + 1) / 2 - 1) 1327c533a883Shx147065 #define QOS_TX3_CW_MIN_OFDM ((CW_MIN_OFDM + 1) / 4 - 1) 1328c533a883Shx147065 1329c533a883Shx147065 #define QOS_TX0_CW_MIN_CCK CW_MIN_CCK 1330c533a883Shx147065 #define QOS_TX1_CW_MIN_CCK CW_MIN_CCK 1331c533a883Shx147065 #define QOS_TX2_CW_MIN_CCK ((CW_MIN_CCK + 1) / 2 - 1) 1332c533a883Shx147065 #define QOS_TX3_CW_MIN_CCK ((CW_MIN_CCK + 1) / 4 - 1) 1333c533a883Shx147065 1334c533a883Shx147065 #define QOS_TX0_CW_MAX_OFDM CW_MAX_OFDM 1335c533a883Shx147065 #define QOS_TX1_CW_MAX_OFDM CW_MAX_OFDM 1336c533a883Shx147065 #define QOS_TX2_CW_MAX_OFDM CW_MIN_OFDM 1337c533a883Shx147065 #define QOS_TX3_CW_MAX_OFDM ((CW_MIN_OFDM + 1) / 2 - 1) 1338c533a883Shx147065 1339c533a883Shx147065 #define QOS_TX0_CW_MAX_CCK CW_MAX_CCK 1340c533a883Shx147065 #define QOS_TX1_CW_MAX_CCK CW_MAX_CCK 1341c533a883Shx147065 #define QOS_TX2_CW_MAX_CCK CW_MIN_CCK 1342c533a883Shx147065 #define QOS_TX3_CW_MAX_CCK ((CW_MIN_CCK + 1) / 2 - 1) 1343c533a883Shx147065 1344c533a883Shx147065 #define QOS_TX0_AIFS (3) 1345c533a883Shx147065 #define QOS_TX1_AIFS (7) 1346c533a883Shx147065 #define QOS_TX2_AIFS (2) 1347c533a883Shx147065 #define QOS_TX3_AIFS (2) 1348c533a883Shx147065 1349c533a883Shx147065 #define QOS_TX0_ACM 0 1350c533a883Shx147065 #define QOS_TX1_ACM 0 1351c533a883Shx147065 #define QOS_TX2_ACM 0 1352c533a883Shx147065 #define QOS_TX3_ACM 0 1353c533a883Shx147065 1354c533a883Shx147065 #define QOS_TX0_TXOP_LIMIT_CCK 0 1355c533a883Shx147065 #define QOS_TX1_TXOP_LIMIT_CCK 0 1356c533a883Shx147065 #define QOS_TX2_TXOP_LIMIT_CCK 6016 1357c533a883Shx147065 #define QOS_TX3_TXOP_LIMIT_CCK 3264 1358c533a883Shx147065 1359c533a883Shx147065 #define QOS_TX0_TXOP_LIMIT_OFDM 0 1360c533a883Shx147065 #define QOS_TX1_TXOP_LIMIT_OFDM 0 1361c533a883Shx147065 #define QOS_TX2_TXOP_LIMIT_OFDM 3008 1362c533a883Shx147065 #define QOS_TX3_TXOP_LIMIT_OFDM 1504 1363c533a883Shx147065 1364c533a883Shx147065 #define DEF_TX0_CW_MIN_OFDM CW_MIN_OFDM 1365c533a883Shx147065 #define DEF_TX1_CW_MIN_OFDM CW_MIN_OFDM 1366c533a883Shx147065 #define DEF_TX2_CW_MIN_OFDM CW_MIN_OFDM 1367c533a883Shx147065 #define DEF_TX3_CW_MIN_OFDM CW_MIN_OFDM 1368c533a883Shx147065 1369c533a883Shx147065 #define DEF_TX0_CW_MIN_CCK CW_MIN_CCK 1370c533a883Shx147065 #define DEF_TX1_CW_MIN_CCK CW_MIN_CCK 1371c533a883Shx147065 #define DEF_TX2_CW_MIN_CCK CW_MIN_CCK 1372c533a883Shx147065 #define DEF_TX3_CW_MIN_CCK CW_MIN_CCK 1373c533a883Shx147065 1374c533a883Shx147065 #define DEF_TX0_CW_MAX_OFDM CW_MAX_OFDM 1375c533a883Shx147065 #define DEF_TX1_CW_MAX_OFDM CW_MAX_OFDM 1376c533a883Shx147065 #define DEF_TX2_CW_MAX_OFDM CW_MAX_OFDM 1377c533a883Shx147065 #define DEF_TX3_CW_MAX_OFDM CW_MAX_OFDM 1378c533a883Shx147065 1379c533a883Shx147065 #define DEF_TX0_CW_MAX_CCK CW_MAX_CCK 1380c533a883Shx147065 #define DEF_TX1_CW_MAX_CCK CW_MAX_CCK 1381c533a883Shx147065 #define DEF_TX2_CW_MAX_CCK CW_MAX_CCK 1382c533a883Shx147065 #define DEF_TX3_CW_MAX_CCK CW_MAX_CCK 1383c533a883Shx147065 1384c533a883Shx147065 #define DEF_TX0_AIFS (2) 1385c533a883Shx147065 #define DEF_TX1_AIFS (2) 1386c533a883Shx147065 #define DEF_TX2_AIFS (2) 1387c533a883Shx147065 #define DEF_TX3_AIFS (2) 1388c533a883Shx147065 1389c533a883Shx147065 #define DEF_TX0_ACM (0) 1390c533a883Shx147065 #define DEF_TX1_ACM (0) 1391c533a883Shx147065 #define DEF_TX2_ACM (0) 1392c533a883Shx147065 #define DEF_TX3_ACM (0) 1393c533a883Shx147065 1394c533a883Shx147065 #define DEF_TX0_TXOP_LIMIT_CCK (0) 1395c533a883Shx147065 #define DEF_TX1_TXOP_LIMIT_CCK (0) 1396c533a883Shx147065 #define DEF_TX2_TXOP_LIMIT_CCK (0) 1397c533a883Shx147065 #define DEF_TX3_TXOP_LIMIT_CCK (0) 1398c533a883Shx147065 1399c533a883Shx147065 #define DEF_TX0_TXOP_LIMIT_OFDM (0) 1400c533a883Shx147065 #define DEF_TX1_TXOP_LIMIT_OFDM (0) 1401c533a883Shx147065 #define DEF_TX2_TXOP_LIMIT_OFDM (0) 1402c533a883Shx147065 #define DEF_TX3_TXOP_LIMIT_OFDM (0) 1403c533a883Shx147065 1404c533a883Shx147065 #define QOS_QOS_SETS (3) 1405c533a883Shx147065 #define QOS_PARAM_SET_ACTIVE (0) 1406c533a883Shx147065 #define QOS_PARAM_SET_DEF_CCK (1) 1407c533a883Shx147065 #define QOS_PARAM_SET_DEF_OFDM (2) 1408c533a883Shx147065 1409c533a883Shx147065 #define CTRL_QOS_NO_ACK (0x0020) 1410c533a883Shx147065 #define DCT_FLAG_EXT_QOS_ENABLED (0x10) 1411c533a883Shx147065 1412c533a883Shx147065 #define IWK_TX_QUEUE_AC0 (0) 1413c533a883Shx147065 #define IWK_TX_QUEUE_AC1 (1) 1414c533a883Shx147065 #define IWK_TX_QUEUE_AC2 (2) 1415c533a883Shx147065 #define IWK_TX_QUEUE_AC3 (3) 1416c533a883Shx147065 #define IWK_TX_QUEUE_HCCA_1 (5) 1417c533a883Shx147065 #define IWK_TX_QUEUE_HCCA_2 (6) 1418c533a883Shx147065 1419c533a883Shx147065 #define U32_PAD(n) ((4-(n%4))%4) 1420c533a883Shx147065 1421c533a883Shx147065 #define AC_BE_TID_MASK 0x9 /* TID 0 and 3 */ 1422c533a883Shx147065 #define AC_BK_TID_MASK 0x6 /* TID 1 and 2 */ 1423c533a883Shx147065 1424c533a883Shx147065 /* 1425c533a883Shx147065 * Generic queue structure 1426c533a883Shx147065 * 1427c533a883Shx147065 * Contains common data for Rx and Tx queues 1428c533a883Shx147065 */ 1429c533a883Shx147065 #define TFD_CTL_COUNT_SET(n) (n<<24) 1430c533a883Shx147065 #define TFD_CTL_COUNT_GET(ctl) ((ctl>>24) & 7) 1431c533a883Shx147065 #define TFD_CTL_PAD_SET(n) (n<<28) 1432c533a883Shx147065 #define TFD_CTL_PAD_GET(ctl) (ctl>>28) 1433c533a883Shx147065 1434c533a883Shx147065 #define TFD_TX_CMD_SLOTS 64 1435c533a883Shx147065 #define TFD_CMD_SLOTS 32 1436c533a883Shx147065 1437c533a883Shx147065 /* 1438c533a883Shx147065 * Tx/Rx Queues 1439c533a883Shx147065 * 1440c533a883Shx147065 * Most communication between driver and 4965 is via queues of data buffers. 1441c533a883Shx147065 * For example, all commands that the driver issues to device's embedded 1442c533a883Shx147065 * controller (uCode) are via the command queue (one of the Tx queues). All 1443c533a883Shx147065 * uCode command responses/replies/notifications, including Rx frames, are 1444c533a883Shx147065 * conveyed from uCode to driver via the Rx queue. 1445c533a883Shx147065 * 1446c533a883Shx147065 * Most support for these queues, including handshake support, resides in 1447c533a883Shx147065 * structures in host DRAM, shared between the driver and the device. When 1448c533a883Shx147065 * allocating this memory, the driver must make sure that data written by 1449c533a883Shx147065 * the host CPU updates DRAM immediately (and does not get "stuck" in CPU's 1450c533a883Shx147065 * cache memory), so DRAM and cache are consistent, and the device can 1451c533a883Shx147065 * immediately see changes made by the driver. 1452c533a883Shx147065 * 1453c533a883Shx147065 * 4965 supports up to 16 DRAM-based Tx queues, and services these queues via 1454c533a883Shx147065 * up to 7 DMA channels (FIFOs). Each Tx queue is supported by a circular array 1455c533a883Shx147065 * in DRAM containing 256 Transmit Frame Descriptors (TFDs). 1456c533a883Shx147065 */ 1457c533a883Shx147065 #define IWK_MAX_WIN_SIZE 64 1458c533a883Shx147065 #define IWK_QUEUE_SIZE 256 1459c533a883Shx147065 #define IWK_NUM_FIFOS 7 1460d62cb7ffShx147065 #define IWK_NUM_QUEUES 6 1461c533a883Shx147065 #define IWK_CMD_QUEUE_NUM 4 1462c533a883Shx147065 #define IWK_KW_SIZE 0x1000 /* 4k */ 1463c533a883Shx147065 1464c533a883Shx147065 struct iwk_rate { 1465c533a883Shx147065 union { 1466c533a883Shx147065 struct { 1467c533a883Shx147065 uint8_t rate; 1468c533a883Shx147065 uint8_t flags; 1469c533a883Shx147065 uint16_t ext_flags; 1470c533a883Shx147065 } s; 1471c533a883Shx147065 uint32_t rate_n_flags; 1472c533a883Shx147065 } r; 1473c533a883Shx147065 }; 1474c533a883Shx147065 1475c533a883Shx147065 struct iwk_dram_scratch { 1476c533a883Shx147065 uint8_t try_cnt; 1477c533a883Shx147065 uint8_t bt_kill_cnt; 1478c533a883Shx147065 uint16_t reserved; 1479c533a883Shx147065 }; 1480c533a883Shx147065 1481c533a883Shx147065 /* 1482c533a883Shx147065 * START TEMPERATURE 1483c533a883Shx147065 */ 1484c533a883Shx147065 /* 1485c533a883Shx147065 * 4965 temperature calculation. 1486c533a883Shx147065 * 1487c533a883Shx147065 * The driver must calculate the device temperature before calculating 1488c533a883Shx147065 * a txpower setting (amplifier gain is temperature dependent). The 1489c533a883Shx147065 * calculation uses 4 measurements, 3 of which (R1, R2, R3) are calibration 1490c533a883Shx147065 * values used for the life of the driver, and one of which (R4) is the 1491c533a883Shx147065 * real-time temperature indicator. 1492c533a883Shx147065 * 1493c533a883Shx147065 * uCode provides all 4 values to the driver via the "initialize alive" 1494c533a883Shx147065 * notification (see struct iwk_init_alive_resp). After the runtime uCode 1495c533a883Shx147065 * image loads, uCode updates the R4 value via statistics notifications 1496c533a883Shx147065 * (see STATISTICS_NOTIFICATION), which occur after each received beacon 1497c533a883Shx147065 * when associated, or can be requested via REPLY_STATISTICS_CMD. 1498c533a883Shx147065 * 1499c533a883Shx147065 * NOTE: uCode provides the R4 value as a 23-bit signed value. Driver 1500c533a883Shx147065 * must sign-extend to 32 bits before applying formula below. 1501c533a883Shx147065 * 1502c533a883Shx147065 * Formula: 1503c533a883Shx147065 * 1504c533a883Shx147065 * degrees Kelvin = ((97 * 259 * (R4 - R2) / (R3 - R1)) / 100) + 8 1505c533a883Shx147065 * 1506c533a883Shx147065 * NOTE: The basic formula is 259 * (R4-R2) / (R3-R1). The 97/100 is 1507c533a883Shx147065 * an additional correction, which should be centered around 0 degrees 1508c533a883Shx147065 * Celsius (273 degrees Kelvin). The 8 (3 percent of 273) compensates for 1509c533a883Shx147065 * centering the 97/100 correction around 0 degrees K. 1510c533a883Shx147065 * 1511c533a883Shx147065 * Add 273 to Kelvin value to find degrees Celsius, for comparing current 1512c533a883Shx147065 * temperature with factory-measured temperatures when calculating txpower 1513c533a883Shx147065 * settings. 1514c533a883Shx147065 */ 1515c533a883Shx147065 #define TEMPERATURE_CALIB_KELVIN_OFFSET 8 1516c533a883Shx147065 #define TEMPERATURE_CALIB_A_VAL 259 1517c533a883Shx147065 1518c533a883Shx147065 /* 1519c533a883Shx147065 * Limit range of calculated temperature to be between these Kelvin values 1520c533a883Shx147065 */ 1521c533a883Shx147065 #define IWK_TX_POWER_TEMPERATURE_MIN (263) 1522c533a883Shx147065 #define IWK_TX_POWER_TEMPERATURE_MAX (410) 1523c533a883Shx147065 1524c533a883Shx147065 #define IWK_TX_POWER_TEMPERATURE_OUT_OF_RANGE(t) \ 1525c533a883Shx147065 (((t) < IWK_TX_POWER_TEMPERATURE_MIN) || \ 1526c533a883Shx147065 ((t) > IWK_TX_POWER_TEMPERATURE_MAX)) 1527c533a883Shx147065 1528c533a883Shx147065 /* 1529c533a883Shx147065 * END TEMPERATURE 1530c533a883Shx147065 */ 1531c533a883Shx147065 1532c533a883Shx147065 /* 1533c533a883Shx147065 * START TXPOWER 1534c533a883Shx147065 */ 1535c533a883Shx147065 /* 1536c533a883Shx147065 * 4965 txpower calculations rely on information from three sources: 1537c533a883Shx147065 * 1538c533a883Shx147065 * 1) EEPROM 1539c533a883Shx147065 * 2) "initialize" alive notification 1540c533a883Shx147065 * 3) statistics notifications 1541c533a883Shx147065 * 1542c533a883Shx147065 * EEPROM data consists of: 1543c533a883Shx147065 * 1544c533a883Shx147065 * 1) Regulatory information (max txpower and channel usage flags) is provided 1545c533a883Shx147065 * separately for each channel that can possibly supported by 4965. 1546c533a883Shx147065 * 40 MHz wide (.11n fat) channels are listed separately from 20 MHz 1547c533a883Shx147065 * (legacy) channels. 1548c533a883Shx147065 * 1549c533a883Shx147065 * See struct iwk_eeprom_channel for format, and struct iwk_eeprom for 1550c533a883Shx147065 * locations in EEPROM. 1551c533a883Shx147065 * 1552c533a883Shx147065 * 2) Factory txpower calibration information is provided separately for 1553c533a883Shx147065 * sub-bands of contiguous channels. 2.4GHz has just one sub-band, 1554c533a883Shx147065 * but 5 GHz has several sub-bands. 1555c533a883Shx147065 * 1556c533a883Shx147065 * In addition, per-band (2.4 and 5 Ghz) saturation txpowers are provided. 1557c533a883Shx147065 * 1558c533a883Shx147065 * See struct iwk_eeprom_calib_info (and the tree of structures contained 1559c533a883Shx147065 * within it) for format, and struct iwk_eeprom for locations in EEPROM. 1560c533a883Shx147065 * 1561c533a883Shx147065 * "Initialization alive" notification (see struct iwk_init_alive_resp) 1562c533a883Shx147065 * consists of: 1563c533a883Shx147065 * 1564c533a883Shx147065 * 1) Temperature calculation parameters. 1565c533a883Shx147065 * 1566c533a883Shx147065 * 2) Power supply voltage measurement. 1567c533a883Shx147065 * 1568c533a883Shx147065 * 3) Tx gain compensation to balance 2 transmitters for MIMO use. 1569c533a883Shx147065 * 1570c533a883Shx147065 * Statistics notifications deliver: 1571c533a883Shx147065 * 1572c533a883Shx147065 * 1) Current values for temperature param R4. 1573c533a883Shx147065 */ 1574c533a883Shx147065 1575c533a883Shx147065 /* 1576c533a883Shx147065 * To calculate a txpower setting for a given desired target txpower, channel, 1577c533a883Shx147065 * modulation bit rate, and transmitter chain (4965 has 2 transmitters to 1578c533a883Shx147065 * support MIMO and transmit diversity), driver must do the following: 1579c533a883Shx147065 * 1580c533a883Shx147065 * 1) Compare desired txpower vs. (EEPROM) regulatory limit for this channel. 1581c533a883Shx147065 * Do not exceed regulatory limit; reduce target txpower if necessary. 1582c533a883Shx147065 * 1583c533a883Shx147065 * If setting up txpowers for MIMO rates (rate indexes 8-15, 24-31), 1584c533a883Shx147065 * 2 transmitters will be used simultaneously; driver must reduce the 1585c533a883Shx147065 * regulatory limit by 3 dB (half-power) for each transmitter, so the 1586c533a883Shx147065 * combined total output of the 2 transmitters is within regulatory limits. 1587c533a883Shx147065 * 1588c533a883Shx147065 * 1589c533a883Shx147065 * 2) Compare target txpower vs. (EEPROM) saturation txpower *reduced by 1590c533a883Shx147065 * backoff for this bit rate*. Do not exceed (saturation - backoff[rate]); 1591c533a883Shx147065 * reduce target txpower if necessary. 1592c533a883Shx147065 * 1593c533a883Shx147065 * Backoff values below are in 1/2 dB units (equivalent to steps in 1594c533a883Shx147065 * txpower gain tables): 1595c533a883Shx147065 * 1596c533a883Shx147065 * OFDM 6 - 36 MBit: 10 steps (5 dB) 1597c533a883Shx147065 * OFDM 48 MBit: 15 steps (7.5 dB) 1598c533a883Shx147065 * OFDM 54 MBit: 17 steps (8.5 dB) 1599c533a883Shx147065 * OFDM 60 MBit: 20 steps (10 dB) 1600c533a883Shx147065 * CCK all rates: 10 steps (5 dB) 1601c533a883Shx147065 * 1602c533a883Shx147065 * Backoff values apply to saturation txpower on a per-transmitter basis; 1603c533a883Shx147065 * when using MIMO (2 transmitters), each transmitter uses the same 1604c533a883Shx147065 * saturation level provided in EEPROM, and the same backoff values; 1605c533a883Shx147065 * no reduction (such as with regulatory txpower limits) is required. 1606c533a883Shx147065 * 1607c533a883Shx147065 * Saturation and Backoff values apply equally to 20 Mhz (legacy) channel 1608c533a883Shx147065 * widths and 40 Mhz (.11n fat) channel widths; there is no separate 1609c533a883Shx147065 * factory measurement for fat channels. 1610c533a883Shx147065 * 1611c533a883Shx147065 * The result of this step is the final target txpower. The rest of 1612c533a883Shx147065 * the steps figure out the proper settings for the device. 1613c533a883Shx147065 * 1614c533a883Shx147065 * 1615c533a883Shx147065 * 3) Determine (EEPROM) calibration subband for the target channel, by 1616c533a883Shx147065 * comparing against first and last channels in each subband 1617c533a883Shx147065 * (see struct iwk_eeprom_calib_subband_info). 1618c533a883Shx147065 * 1619c533a883Shx147065 * 1620c533a883Shx147065 * 4) Linearly interpolate (EEPROM) factory calibration measurement sets, 1621c533a883Shx147065 * referencing the 2 factory-measured (sample) channels within the subband. 1622c533a883Shx147065 * 1623c533a883Shx147065 * Interpolation is based on difference between target channel's frequency 1624c533a883Shx147065 * and the sample channels' frequencies. Since channel numbers are based 1625c533a883Shx147065 * on frequency (5 MHz between each channel number), this is equivalent 1626c533a883Shx147065 * to interpolating based on channel number differences. 1627c533a883Shx147065 * 1628c533a883Shx147065 * Note that the sample channels may or may not be the channels at the 1629c533a883Shx147065 * edges of the subband. The target channel may be "outside" of the 1630c533a883Shx147065 * span of the sampled channels. 1631c533a883Shx147065 * 1632c533a883Shx147065 * Driver may choose the pair (for 2 Tx chains) of measurements (see 1633c533a883Shx147065 * struct iwk_eeprom_calib_ch_info) for which the actual measured 1634c533a883Shx147065 * txpower comes closest to the desired txpower. Usually, though, 1635c533a883Shx147065 * the middle set of measurements is closest to the regulatory limits, 1636c533a883Shx147065 * and is therefore a good choice for all txpower calculations. 1637c533a883Shx147065 * 1638c533a883Shx147065 * Driver should interpolate both members of the chosen measurement pair, 1639c533a883Shx147065 * i.e. for both Tx chains (radio transmitters), unless the driver knows 1640c533a883Shx147065 * that only one of the chains will be used (e.g. only one tx antenna 1641c533a883Shx147065 * connected, but this should be unusual). 1642c533a883Shx147065 * 1643c533a883Shx147065 * Driver should interpolate factory values for temperature, gain table 1644c533a883Shx147065 * index, and actual power. The power amplifier detector values are 1645c533a883Shx147065 * not used by the driver. 1646c533a883Shx147065 * 1647c533a883Shx147065 * If the target channel happens to be one of the sample channels, the 1648c533a883Shx147065 * results should agree with the sample channel's measurements! 1649c533a883Shx147065 * 1650c533a883Shx147065 * 1651c533a883Shx147065 * 5) Find difference between desired txpower and (interpolated) 1652c533a883Shx147065 * factory-measured txpower. Using (interpolated) factory gain table index 1653c533a883Shx147065 * as a starting point, adjust this index lower to increase txpower, 1654c533a883Shx147065 * or higher to decrease txpower, until the target txpower is reached. 1655c533a883Shx147065 * Each step in the gain table is 1/2 dB. 1656c533a883Shx147065 * 1657c533a883Shx147065 * For example, if factory measured txpower is 16 dBm, and target txpower 1658c533a883Shx147065 * is 13 dBm, add 6 steps to the factory gain index to reduce txpower 1659c533a883Shx147065 * by 3 dB. 1660c533a883Shx147065 * 1661c533a883Shx147065 * 1662c533a883Shx147065 * 6) Find difference between current device temperature and (interpolated) 1663c533a883Shx147065 * factory-measured temperature for sub-band. Factory values are in 1664c533a883Shx147065 * degrees Celsius. To calculate current temperature, see comments for 1665c533a883Shx147065 * "4965 temperature calculation". 1666c533a883Shx147065 * 1667c533a883Shx147065 * If current temperature is higher than factory temperature, driver must 1668c533a883Shx147065 * increase gain (lower gain table index), and vice versa. 1669c533a883Shx147065 * 1670c533a883Shx147065 * Temperature affects gain differently for different channels: 1671c533a883Shx147065 * 1672c533a883Shx147065 * 2.4 GHz all channels: 3.5 degrees per half-dB step 1673c533a883Shx147065 * 5 GHz channels 34-43: 4.5 degrees per half-dB step 1674c533a883Shx147065 * 5 GHz channels >= 44: 4.0 degrees per half-dB step 1675c533a883Shx147065 * 1676c533a883Shx147065 * NOTE: Temperature can increase rapidly when transmitting, especially 1677c533a883Shx147065 * with heavy traffic at high txpowers. Driver should update 1678c533a883Shx147065 * temperature calculations often under these conditions to 1679c533a883Shx147065 * maintain strong txpower in the face of rising temperature. 1680c533a883Shx147065 * 1681c533a883Shx147065 * 1682c533a883Shx147065 * 7) Find difference between current power supply voltage indicator 1683c533a883Shx147065 * (from "initialize alive") and factory-measured power supply voltage 1684c533a883Shx147065 * indicator (EEPROM). 1685c533a883Shx147065 * 1686c533a883Shx147065 * If the current voltage is higher (indicator is lower) than factory 1687c533a883Shx147065 * voltage, gain should be reduced (gain table index increased) by: 1688c533a883Shx147065 * 1689c533a883Shx147065 * (eeprom - current) / 7 1690c533a883Shx147065 * 1691c533a883Shx147065 * If the current voltage is lower (indicator is higher) than factory 1692c533a883Shx147065 * voltage, gain should be increased (gain table index decreased) by: 1693c533a883Shx147065 * 1694c533a883Shx147065 * 2 * (current - eeprom) / 7 1695c533a883Shx147065 * 1696c533a883Shx147065 * If number of index steps in either direction turns out to be > 2, 1697c533a883Shx147065 * something is wrong ... just use 0. 1698c533a883Shx147065 * 1699c533a883Shx147065 * NOTE: Voltage compensation is independent of band/channel. 1700c533a883Shx147065 * 1701c533a883Shx147065 * NOTE: "Initialize" uCode measures current voltage, which is assumed 1702c533a883Shx147065 * to be constant after this initial measurement. Voltage 1703c533a883Shx147065 * compensation for txpower (number of steps in gain table) 1704c533a883Shx147065 * may be calculated once and used until the next uCode bootload. 1705c533a883Shx147065 * 1706c533a883Shx147065 * 1707c533a883Shx147065 * 8) If setting up txpowers for MIMO rates (rate indexes 8-15, 24-31), 1708c533a883Shx147065 * adjust txpower for each transmitter chain, so txpower is balanced 1709c533a883Shx147065 * between the two chains. There are 5 pairs of tx_atten[group][chain] 1710c533a883Shx147065 * values in "initialize alive", one pair for each of 5 channel ranges: 1711c533a883Shx147065 * 1712c533a883Shx147065 * Group 0: 5 GHz channel 34-43 1713c533a883Shx147065 * Group 1: 5 GHz channel 44-70 1714c533a883Shx147065 * Group 2: 5 GHz channel 71-124 1715c533a883Shx147065 * Group 3: 5 GHz channel 125-200 1716c533a883Shx147065 * Group 4: 2.4 GHz all channels 1717c533a883Shx147065 * 1718c533a883Shx147065 * Add the tx_atten[group][chain] value to the index for the target chain. 1719c533a883Shx147065 * The values are signed, but are in pairs of 0 and a non-negative number, 1720c533a883Shx147065 * so as to reduce gain (if necessary) of the "hotter" channel. This 1721c533a883Shx147065 * avoids any need to double-check for regulatory compliance after 1722c533a883Shx147065 * this step. 1723c533a883Shx147065 * 1724c533a883Shx147065 * 1725c533a883Shx147065 * 9) If setting up for a CCK rate, lower the gain by adding a CCK compensation 1726c533a883Shx147065 * value to the index: 1727c533a883Shx147065 * 1728c533a883Shx147065 * Hardware rev B: 9 steps (4.5 dB) 1729c533a883Shx147065 * Hardware rev C: 5 steps (2.5 dB) 1730c533a883Shx147065 * 1731c533a883Shx147065 * Hardware rev for 4965 can be determined by reading CSR_HW_REV_WA_REG, 1732c533a883Shx147065 * bits [3:2], 1 = B, 2 = C. 1733c533a883Shx147065 * 1734c533a883Shx147065 * NOTE: This compensation is in addition to any saturation backoff that 1735c533a883Shx147065 * might have been applied in an earlier step. 1736c533a883Shx147065 * 1737c533a883Shx147065 * 1738c533a883Shx147065 * 10) Select the gain table, based on band (2.4 vs 5 GHz). 1739c533a883Shx147065 * 1740c533a883Shx147065 * Limit the adjusted index to stay within the table! 1741c533a883Shx147065 * 1742c533a883Shx147065 * 1743c533a883Shx147065 * 11) Read gain table entries for DSP and radio gain, place into appropriate 1744c533a883Shx147065 * location(s) in command. 1745c533a883Shx147065 */ 1746c533a883Shx147065 1747c533a883Shx147065 enum { 1748c533a883Shx147065 HT_IE_EXT_CHANNEL_NONE = 0, 1749c533a883Shx147065 HT_IE_EXT_CHANNEL_ABOVE, 1750c533a883Shx147065 HT_IE_EXT_CHANNEL_INVALID, 1751c533a883Shx147065 HT_IE_EXT_CHANNEL_BELOW, 1752c533a883Shx147065 HT_IE_EXT_CHANNEL_MAX 1753c533a883Shx147065 }; 1754c533a883Shx147065 1755c533a883Shx147065 enum { 1756c533a883Shx147065 CALIB_CH_GROUP_1 = 0, 1757c533a883Shx147065 CALIB_CH_GROUP_2 = 1, 1758c533a883Shx147065 CALIB_CH_GROUP_3 = 2, 1759c533a883Shx147065 CALIB_CH_GROUP_4 = 3, 1760c533a883Shx147065 CALIB_CH_GROUP_5 = 4, 1761c533a883Shx147065 CALIB_CH_GROUP_MAX 1762c533a883Shx147065 }; 1763c533a883Shx147065 1764c533a883Shx147065 #define POWER_TABLE_NUM_HT_OFDM_ENTRIES (32) 1765c533a883Shx147065 1766c533a883Shx147065 /* 1767c533a883Shx147065 * Temperature calibration offset is 3% 0C in Kelvin 1768c533a883Shx147065 */ 1769c533a883Shx147065 #define TEMPERATURE_CALIB_KELVIN_OFFSET 8 1770c533a883Shx147065 #define TEMPERATURE_CALIB_A_VAL 259 1771c533a883Shx147065 1772c533a883Shx147065 #define IWK_TX_POWER_TEMPERATURE_MIN (263) 1773c533a883Shx147065 #define IWK_TX_POWER_TEMPERATURE_MAX (410) 1774c533a883Shx147065 1775c533a883Shx147065 #define IWK_TX_POWER_TEMPERATURE_OUT_OF_RANGE(t) \ 1776c533a883Shx147065 (((t) < IWK_TX_POWER_TEMPERATURE_MIN) || \ 1777c533a883Shx147065 ((t) > IWK_TX_POWER_TEMPERATURE_MAX)) 1778c533a883Shx147065 1779c533a883Shx147065 #define IWK_TX_POWER_ILLEGAL_TEMPERATURE (300) 1780c533a883Shx147065 1781c533a883Shx147065 #define IWK_TX_POWER_TEMPERATURE_DIFFERENCE (2) 1782c533a883Shx147065 1783c533a883Shx147065 /* 1784c533a883Shx147065 * When MIMO is used (2 transmitters operating simultaneously), driver should 1785c533a883Shx147065 * limit each transmitter to deliver a max of 3 dB below the regulatory limit 1786c533a883Shx147065 * for the device. That is, half power for each transmitter, so total power 1787c533a883Shx147065 * is within regulatory limits. 1788c533a883Shx147065 * 1789c533a883Shx147065 * The value "6" represents number of steps in gain table to reduce power. 1790c533a883Shx147065 * Each step is 1/2 dB. 1791c533a883Shx147065 */ 1792c533a883Shx147065 #define IWK_TX_POWER_MIMO_REGULATORY_COMPENSATION (6) 1793c533a883Shx147065 1794c533a883Shx147065 /* 1795c533a883Shx147065 * Limit range of txpower output target to be between these values 1796c533a883Shx147065 */ 1797c533a883Shx147065 #define IWK_TX_POWER_TARGET_POWER_MIN (0) /* 0 dBm = 1 milliwatt */ 1798c533a883Shx147065 #define IWK_TX_POWER_TARGET_POWER_MAX (16) /* 16 dBm */ 1799c533a883Shx147065 1800c533a883Shx147065 /* 1801c533a883Shx147065 * timeout equivalent to 3 minutes 1802c533a883Shx147065 */ 1803c533a883Shx147065 #define IWK_TX_POWER_TIMELIMIT_NOCALIB 1800000000 1804c533a883Shx147065 1805c533a883Shx147065 /* 1806c533a883Shx147065 * CCK gain compensation. 1807c533a883Shx147065 * 1808c533a883Shx147065 * When calculating txpowers for CCK, after making sure that the target power 1809c533a883Shx147065 * is within regulatory and saturation limits, driver must additionally 1810c533a883Shx147065 * back off gain by adding these values to the gain table index. 1811c533a883Shx147065 */ 1812c533a883Shx147065 #define IWK_TX_POWER_CCK_COMPENSATION (9) 1813c533a883Shx147065 #define IWK_TX_POWER_CCK_COMPENSATION_B_STEP (9) 1814c533a883Shx147065 #define IWK_TX_POWER_CCK_COMPENSATION_C_STEP (5) 1815c533a883Shx147065 1816c533a883Shx147065 /* 1817c533a883Shx147065 * 4965 power supply voltage compensation 1818c533a883Shx147065 */ 1819c533a883Shx147065 #define TX_POWER_IWK_VOLTAGE_CODES_PER_03V (7) 1820c533a883Shx147065 1821c533a883Shx147065 /* 1822c533a883Shx147065 * Gain tables. 1823c533a883Shx147065 * 1824c533a883Shx147065 * The following tables contain pair of values for setting txpower, i.e. 1825c533a883Shx147065 * gain settings for the output of the device's digital signal processor (DSP), 1826c533a883Shx147065 * and for the analog gain structure of the transmitter. 1827c533a883Shx147065 * 1828c533a883Shx147065 * Each entry in the gain tables represents a step of 1/2 dB. Note that these 1829c533a883Shx147065 * are *relative* steps, not indications of absolute output power. Output 1830c533a883Shx147065 * power varies with temperature, voltage, and channel frequency, and also 1831c533a883Shx147065 * requires consideration of average power (to satisfy regulatory constraints), 1832c533a883Shx147065 * and peak power (to avoid distortion of the output signal). 1833c533a883Shx147065 * 1834c533a883Shx147065 * Each entry contains two values: 1835c533a883Shx147065 * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained 1836c533a883Shx147065 * linear value that multiplies the output of the digital signal processor, 1837c533a883Shx147065 * before being sent to the analog radio. 1838c533a883Shx147065 * 2) Radio gain. This sets the analog gain of the radio Tx path. 1839c533a883Shx147065 * It is a coarser setting, and behaves in a logarithmic (dB) fashion. 1840c533a883Shx147065 * 1841c533a883Shx147065 * EEPROM contains factory calibration data for txpower. This maps actual 1842c533a883Shx147065 * measured txpower levels to gain settings in the "well known" tables 1843c533a883Shx147065 * below ("well-known" means here that both factory calibration *and* the 1844c533a883Shx147065 * driver work with the same table). 1845c533a883Shx147065 * 1846c533a883Shx147065 * There are separate tables for 2.4 GHz and 5 GHz bands. The 5 GHz table 1847c533a883Shx147065 * has an extension (into negative indexes), in case the driver needs to 1848c533a883Shx147065 * boost power setting for high device temperatures (higher than would be 1849c533a883Shx147065 * present during factory calibration). A 5 Ghz EEPROM index of "40" 1850c533a883Shx147065 * corresponds to the 49th entry in the table used by the driver. 1851c533a883Shx147065 */ 1852c533a883Shx147065 #define MIN_TX_GAIN_INDEX (0) 1853c533a883Shx147065 #define MIN_TX_GAIN_INDEX_52GHZ_EXT (-9) 1854c533a883Shx147065 #define MAX_TX_GAIN_INDEX_52GHZ (98) 1855c533a883Shx147065 #define MIN_TX_GAIN_52GHZ (98) 1856c533a883Shx147065 #define MAX_TX_GAIN_INDEX_24GHZ (98) 1857c533a883Shx147065 #define MIN_TX_GAIN_24GHZ (98) 1858c533a883Shx147065 #define MAX_TX_GAIN (0) 1859c533a883Shx147065 #define MAX_TX_GAIN_52GHZ_EXT (-9) 1860c533a883Shx147065 1861c533a883Shx147065 /* 1862c533a883Shx147065 * 2.4 GHz gain table 1863c533a883Shx147065 * 1864c533a883Shx147065 * Index Dsp gain Radio gain 1865c533a883Shx147065 * 0 110 0x3f 1866c533a883Shx147065 * 1 104 0x3f 1867c533a883Shx147065 * 2 98 0x3f 1868c533a883Shx147065 * 3 110 0x3e 1869c533a883Shx147065 * 4 104 0x3e 1870c533a883Shx147065 * 5 98 0x3e 1871c533a883Shx147065 * 6 110 0x3d 1872c533a883Shx147065 * 7 104 0x3d 1873c533a883Shx147065 * 8 98 0x3d 1874c533a883Shx147065 * 9 110 0x3c 1875c533a883Shx147065 * 10 104 0x3c 1876c533a883Shx147065 * 11 98 0x3c 1877c533a883Shx147065 * 12 110 0x3b 1878c533a883Shx147065 * 13 104 0x3b 1879c533a883Shx147065 * 14 98 0x3b 1880c533a883Shx147065 * 15 110 0x3a 1881c533a883Shx147065 * 16 104 0x3a 1882c533a883Shx147065 * 17 98 0x3a 1883c533a883Shx147065 * 18 110 0x39 1884c533a883Shx147065 * 19 104 0x39 1885c533a883Shx147065 * 20 98 0x39 1886c533a883Shx147065 * 21 110 0x38 1887c533a883Shx147065 * 22 104 0x38 1888c533a883Shx147065 * 23 98 0x38 1889c533a883Shx147065 * 24 110 0x37 1890c533a883Shx147065 * 25 104 0x37 1891c533a883Shx147065 * 26 98 0x37 1892c533a883Shx147065 * 27 110 0x36 1893c533a883Shx147065 * 28 104 0x36 1894c533a883Shx147065 * 29 98 0x36 1895c533a883Shx147065 * 30 110 0x35 1896c533a883Shx147065 * 31 104 0x35 1897c533a883Shx147065 * 32 98 0x35 1898c533a883Shx147065 * 33 110 0x34 1899c533a883Shx147065 * 34 104 0x34 1900c533a883Shx147065 * 35 98 0x34 1901c533a883Shx147065 * 36 110 0x33 1902c533a883Shx147065 * 37 104 0x33 1903c533a883Shx147065 * 38 98 0x33 1904c533a883Shx147065 * 39 110 0x32 1905c533a883Shx147065 * 40 104 0x32 1906c533a883Shx147065 * 41 98 0x32 1907c533a883Shx147065 * 42 110 0x31 1908c533a883Shx147065 * 43 104 0x31 1909c533a883Shx147065 * 44 98 0x31 1910c533a883Shx147065 * 45 110 0x30 1911c533a883Shx147065 * 46 104 0x30 1912c533a883Shx147065 * 47 98 0x30 1913c533a883Shx147065 * 48 110 0x6 1914c533a883Shx147065 * 49 104 0x6 1915c533a883Shx147065 * 50 98 0x6 1916c533a883Shx147065 * 51 110 0x5 1917c533a883Shx147065 * 52 104 0x5 1918c533a883Shx147065 * 53 98 0x5 1919c533a883Shx147065 * 54 110 0x4 1920c533a883Shx147065 * 55 104 0x4 1921c533a883Shx147065 * 56 98 0x4 1922c533a883Shx147065 * 57 110 0x3 1923c533a883Shx147065 * 58 104 0x3 1924c533a883Shx147065 * 59 98 0x3 1925c533a883Shx147065 * 60 110 0x2 1926c533a883Shx147065 * 61 104 0x2 1927c533a883Shx147065 * 62 98 0x2 1928c533a883Shx147065 * 63 110 0x1 1929c533a883Shx147065 * 64 104 0x1 1930c533a883Shx147065 * 65 98 0x1 1931c533a883Shx147065 * 66 110 0x0 1932c533a883Shx147065 * 67 104 0x0 1933c533a883Shx147065 * 68 98 0x0 1934c533a883Shx147065 * 69 97 0 1935c533a883Shx147065 * 70 96 0 1936c533a883Shx147065 * 71 95 0 1937c533a883Shx147065 * 72 94 0 1938c533a883Shx147065 * 73 93 0 1939c533a883Shx147065 * 74 92 0 1940c533a883Shx147065 * 75 91 0 1941c533a883Shx147065 * 76 90 0 1942c533a883Shx147065 * 77 89 0 1943c533a883Shx147065 * 78 88 0 1944c533a883Shx147065 * 79 87 0 1945c533a883Shx147065 * 80 86 0 1946c533a883Shx147065 * 81 85 0 1947c533a883Shx147065 * 82 84 0 1948c533a883Shx147065 * 83 83 0 1949c533a883Shx147065 * 84 82 0 1950c533a883Shx147065 * 85 81 0 1951c533a883Shx147065 * 86 80 0 1952c533a883Shx147065 * 87 79 0 1953c533a883Shx147065 * 88 78 0 1954c533a883Shx147065 * 89 77 0 1955c533a883Shx147065 * 90 76 0 1956c533a883Shx147065 * 91 75 0 1957c533a883Shx147065 * 92 74 0 1958c533a883Shx147065 * 93 73 0 1959c533a883Shx147065 * 94 72 0 1960c533a883Shx147065 * 95 71 0 1961c533a883Shx147065 * 96 70 0 1962c533a883Shx147065 * 97 69 0 1963c533a883Shx147065 * 98 68 0 1964c533a883Shx147065 */ 1965c533a883Shx147065 1966c533a883Shx147065 /* 1967c533a883Shx147065 * 5 GHz gain table 1968c533a883Shx147065 * 1969c533a883Shx147065 * Index Dsp gain Radio gain 1970c533a883Shx147065 * -9 123 0x3F 1971c533a883Shx147065 * -8 117 0x3F 1972c533a883Shx147065 * -7 110 0x3F 1973c533a883Shx147065 * -6 104 0x3F 1974c533a883Shx147065 * -5 98 0x3F 1975c533a883Shx147065 * -4 110 0x3E 1976c533a883Shx147065 * -3 104 0x3E 1977c533a883Shx147065 * -2 98 0x3E 1978c533a883Shx147065 * -1 110 0x3D 1979c533a883Shx147065 * 0 104 0x3D 1980c533a883Shx147065 * 1 98 0x3D 1981c533a883Shx147065 * 2 110 0x3C 1982c533a883Shx147065 * 3 104 0x3C 1983c533a883Shx147065 * 4 98 0x3C 1984c533a883Shx147065 * 5 110 0x3B 1985c533a883Shx147065 * 6 104 0x3B 1986c533a883Shx147065 * 7 98 0x3B 1987c533a883Shx147065 * 8 110 0x3A 1988c533a883Shx147065 * 9 104 0x3A 1989c533a883Shx147065 * 10 98 0x3A 1990c533a883Shx147065 * 11 110 0x39 1991c533a883Shx147065 * 12 104 0x39 1992c533a883Shx147065 * 13 98 0x39 1993c533a883Shx147065 * 14 110 0x38 1994c533a883Shx147065 * 15 104 0x38 1995c533a883Shx147065 * 16 98 0x38 1996c533a883Shx147065 * 17 110 0x37 1997c533a883Shx147065 * 18 104 0x37 1998c533a883Shx147065 * 19 98 0x37 1999c533a883Shx147065 * 20 110 0x36 2000c533a883Shx147065 * 21 104 0x36 2001c533a883Shx147065 * 22 98 0x36 2002c533a883Shx147065 * 23 110 0x35 2003c533a883Shx147065 * 24 104 0x35 2004c533a883Shx147065 * 25 98 0x35 2005c533a883Shx147065 * 26 110 0x34 2006c533a883Shx147065 * 27 104 0x34 2007c533a883Shx147065 * 28 98 0x34 2008c533a883Shx147065 * 29 110 0x33 2009c533a883Shx147065 * 30 104 0x33 2010c533a883Shx147065 * 31 98 0x33 2011c533a883Shx147065 * 32 110 0x32 2012c533a883Shx147065 * 33 104 0x32 2013c533a883Shx147065 * 34 98 0x32 2014c533a883Shx147065 * 35 110 0x31 2015c533a883Shx147065 * 36 104 0x31 2016c533a883Shx147065 * 37 98 0x31 2017c533a883Shx147065 * 38 110 0x30 2018c533a883Shx147065 * 39 104 0x30 2019c533a883Shx147065 * 40 98 0x30 2020c533a883Shx147065 * 41 110 0x25 2021c533a883Shx147065 * 42 104 0x25 2022c533a883Shx147065 * 43 98 0x25 2023c533a883Shx147065 * 44 110 0x24 2024c533a883Shx147065 * 45 104 0x24 2025c533a883Shx147065 * 46 98 0x24 2026c533a883Shx147065 * 47 110 0x23 2027c533a883Shx147065 * 48 104 0x23 2028c533a883Shx147065 * 49 98 0x23 2029c533a883Shx147065 * 50 110 0x22 2030c533a883Shx147065 * 51 104 0x18 2031c533a883Shx147065 * 52 98 0x18 2032c533a883Shx147065 * 53 110 0x17 2033c533a883Shx147065 * 54 104 0x17 2034c533a883Shx147065 * 55 98 0x17 2035c533a883Shx147065 * 56 110 0x16 2036c533a883Shx147065 * 57 104 0x16 2037c533a883Shx147065 * 58 98 0x16 2038c533a883Shx147065 * 59 110 0x15 2039c533a883Shx147065 * 60 104 0x15 2040c533a883Shx147065 * 61 98 0x15 2041c533a883Shx147065 * 62 110 0x14 2042c533a883Shx147065 * 63 104 0x14 2043c533a883Shx147065 * 64 98 0x14 2044c533a883Shx147065 * 65 110 0x13 2045c533a883Shx147065 * 66 104 0x13 2046c533a883Shx147065 * 67 98 0x13 2047c533a883Shx147065 * 68 110 0x12 2048c533a883Shx147065 * 69 104 0x08 2049c533a883Shx147065 * 70 98 0x08 2050c533a883Shx147065 * 71 110 0x07 2051c533a883Shx147065 * 72 104 0x07 2052c533a883Shx147065 * 73 98 0x07 2053c533a883Shx147065 * 74 110 0x06 2054c533a883Shx147065 * 75 104 0x06 2055c533a883Shx147065 * 76 98 0x06 2056c533a883Shx147065 * 77 110 0x05 2057c533a883Shx147065 * 78 104 0x05 2058c533a883Shx147065 * 79 98 0x05 2059c533a883Shx147065 * 80 110 0x04 2060c533a883Shx147065 * 81 104 0x04 2061c533a883Shx147065 * 82 98 0x04 2062c533a883Shx147065 * 83 110 0x03 2063c533a883Shx147065 * 84 104 0x03 2064c533a883Shx147065 * 85 98 0x03 2065c533a883Shx147065 * 86 110 0x02 2066c533a883Shx147065 * 87 104 0x02 2067c533a883Shx147065 * 88 98 0x02 2068c533a883Shx147065 * 89 110 0x01 2069c533a883Shx147065 * 90 104 0x01 2070c533a883Shx147065 * 91 98 0x01 2071c533a883Shx147065 * 92 110 0x00 2072c533a883Shx147065 * 93 104 0x00 2073c533a883Shx147065 * 94 98 0x00 2074c533a883Shx147065 * 95 93 0x00 2075c533a883Shx147065 * 96 88 0x00 2076c533a883Shx147065 * 97 83 0x00 2077c533a883Shx147065 * 98 78 0x00 2078c533a883Shx147065 */ 2079c533a883Shx147065 2080c533a883Shx147065 /* 2081c533a883Shx147065 * Sanity checks and default values for EEPROM regulatory levels. 2082c533a883Shx147065 * If EEPROM values fall outside MIN/MAX range, use default values. 2083c533a883Shx147065 * 2084c533a883Shx147065 * Regulatory limits refer to the maximum average txpower allowed by 2085c533a883Shx147065 * regulatory agencies in the geographies in which the device is meant 2086c533a883Shx147065 * to be operated. These limits are SKU-specific (i.e. geography-specific), 2087c533a883Shx147065 * and channel-specific; each channel has an individual regulatory limit 2088c533a883Shx147065 * listed in the EEPROM. 2089c533a883Shx147065 * 2090c533a883Shx147065 * Units are in half-dBm (i.e. "34" means 17 dBm). 2091c533a883Shx147065 */ 2092c533a883Shx147065 #define IWK_TX_POWER_DEFAULT_REGULATORY_24 (34) 2093c533a883Shx147065 #define IWK_TX_POWER_DEFAULT_REGULATORY_52 (34) 2094c533a883Shx147065 #define IWK_TX_POWER_REGULATORY_MIN (0) 2095c533a883Shx147065 #define IWK_TX_POWER_REGULATORY_MAX (34) 2096c533a883Shx147065 2097c533a883Shx147065 /* 2098c533a883Shx147065 * Sanity checks and default values for EEPROM saturation levels. 2099c533a883Shx147065 * If EEPROM values fall outside MIN/MAX range, use default values. 2100c533a883Shx147065 * 2101c533a883Shx147065 * Saturation is the highest level that the output power amplifier can produce 2102c533a883Shx147065 * without significant clipping distortion. This is a "peak" power level. 2103c533a883Shx147065 * Different types of modulation (i.e. various "rates", and OFDM vs. CCK) 2104c533a883Shx147065 * require differing amounts of backoff, relative to their average power output, 2105c533a883Shx147065 * in order to avoid clipping distortion. 2106c533a883Shx147065 * 2107c533a883Shx147065 * Driver must make sure that it is violating neither the saturation limit, 2108c533a883Shx147065 * nor the regulatory limit, when calculating Tx power settings for various 2109c533a883Shx147065 * rates. 2110c533a883Shx147065 * 2111c533a883Shx147065 * Units are in half-dBm (i.e. "38" means 19 dBm). 2112c533a883Shx147065 */ 2113c533a883Shx147065 #define IWK_TX_POWER_DEFAULT_SATURATION_24 (38) 2114c533a883Shx147065 #define IWK_TX_POWER_DEFAULT_SATURATION_52 (38) 2115c533a883Shx147065 #define IWK_TX_POWER_SATURATION_MIN (20) 2116c533a883Shx147065 #define IWK_TX_POWER_SATURATION_MAX (50) 2117c533a883Shx147065 2118c533a883Shx147065 /* 2119c533a883Shx147065 * dv *0.4 = dt; so that 5 degrees temperature diff equals 2120c533a883Shx147065 * 12.5 in voltage diff 2121c533a883Shx147065 */ 2122c533a883Shx147065 #define IWK_TX_TEMPERATURE_UPDATE_LIMIT 9 2123c533a883Shx147065 2124c533a883Shx147065 #define IWK_INVALID_CHANNEL (0xffffffff) 2125c533a883Shx147065 #define IWK_TX_POWER_REGITRY_BIT (2) 2126c533a883Shx147065 2127c533a883Shx147065 #define MIN_IWK_TX_POWER_CALIB_DUR (100) 2128c533a883Shx147065 #define IWK_CCK_FROM_OFDM_POWER_DIFF (-5) 2129c533a883Shx147065 #define IWK_CCK_FROM_OFDM_INDEX_DIFF (9) 2130c533a883Shx147065 2131c533a883Shx147065 /* 2132c533a883Shx147065 * Number of entries in the gain table 2133c533a883Shx147065 */ 2134c533a883Shx147065 #define POWER_GAIN_NUM_ENTRIES 78 2135c533a883Shx147065 #define TX_POW_MAX_SESSION_NUM 5 2136c533a883Shx147065 2137c533a883Shx147065 /* 2138c533a883Shx147065 * timeout equivalent to 3 minutes 2139c533a883Shx147065 */ 2140c533a883Shx147065 #define TX_IWK_TIMELIMIT_NOCALIB 1800000000 2141c533a883Shx147065 2142c533a883Shx147065 /* 2143c533a883Shx147065 * Kedron TX_CALIB_STATES 2144c533a883Shx147065 */ 2145c533a883Shx147065 #define IWK_TX_CALIB_STATE_SEND_TX 0x00000001 2146c533a883Shx147065 #define IWK_TX_CALIB_WAIT_TX_RESPONSE 0x00000002 2147c533a883Shx147065 #define IWK_TX_CALIB_ENABLED 0x00000004 2148c533a883Shx147065 #define IWK_TX_CALIB_XVT_ON 0x00000008 2149c533a883Shx147065 #define IWK_TX_CALIB_TEMPERATURE_CORRECT 0x00000010 2150c533a883Shx147065 #define IWK_TX_CALIB_WORKING_WITH_XVT 0x00000020 2151c533a883Shx147065 #define IWK_TX_CALIB_XVT_PERIODICAL 0x00000040 2152c533a883Shx147065 2153c533a883Shx147065 #define NUM_IWK_TX_CALIB_SETTINS 5 /* Number of tx correction groups */ 2154c533a883Shx147065 2155c533a883Shx147065 #define IWK_MIN_POWER_IN_VP_TABLE 1 /* 0.5dBm multiplied by 2 */ 2156c533a883Shx147065 /* 20dBm - multiplied by 2 - because entries are for each 0.5dBm */ 2157c533a883Shx147065 #define IWK_MAX_POWER_IN_VP_TABLE 40 2158c533a883Shx147065 #define IWK_STEP_IN_VP_TABLE 1 /* 0.5dB - multiplied by 2 */ 2159c533a883Shx147065 #define IWK_NUM_POINTS_IN_VPTABLE \ 2160c533a883Shx147065 (1 + IWK_MAX_POWER_IN_VP_TABLE - IWK_MIN_POWER_IN_VP_TABLE) 2161c533a883Shx147065 2162c533a883Shx147065 #define MIN_TX_GAIN_INDEX (0) 2163c533a883Shx147065 #define MAX_TX_GAIN_INDEX_52GHZ (98) 2164c533a883Shx147065 #define MIN_TX_GAIN_52GHZ (98) 2165c533a883Shx147065 #define MAX_TX_GAIN_INDEX_24GHZ (98) 2166c533a883Shx147065 #define MIN_TX_GAIN_24GHZ (98) 2167c533a883Shx147065 #define MAX_TX_GAIN (0) 2168c533a883Shx147065 2169c533a883Shx147065 /* 2170c533a883Shx147065 * Channel groups used for Tx Attenuation calibration (MIMO tx channel balance) 2171c533a883Shx147065 * and thermal Txpower calibration. 2172c533a883Shx147065 * 2173c533a883Shx147065 * When calculating txpower, driver must compensate for current device 2174c533a883Shx147065 * temperature; higher temperature requires higher gain. Driver must calculate 2175c533a883Shx147065 * current temperature (see "4965 temperature calculation"), then compare vs. 2176c533a883Shx147065 * factory calibration temperature in EEPROM; if current temperature is higher 2177c533a883Shx147065 * than factory temperature, driver must *increase* gain by proportions shown 2178c533a883Shx147065 * in table below. If current temperature is lower than factory, driver must 2179c533a883Shx147065 * *decrease* gain. 2180c533a883Shx147065 * 2181c533a883Shx147065 * Different frequency ranges require different compensation, as shown below. 2182c533a883Shx147065 */ 2183c533a883Shx147065 /* 2184c533a883Shx147065 * Group 0, 5.2 GHz ch 34-43: 4.5 degrees per 1/2 dB. 2185c533a883Shx147065 */ 2186c533a883Shx147065 #define CALIB_IWK_TX_ATTEN_GR1_FCH 34 2187c533a883Shx147065 #define CALIB_IWK_TX_ATTEN_GR1_LCH 43 2188c533a883Shx147065 2189c533a883Shx147065 /* 2190c533a883Shx147065 * Group 1, 5.3 GHz ch 44-70: 4.0 degrees per 1/2 dB. 2191c533a883Shx147065 */ 2192c533a883Shx147065 #define CALIB_IWK_TX_ATTEN_GR2_FCH 44 2193c533a883Shx147065 #define CALIB_IWK_TX_ATTEN_GR2_LCH 70 2194c533a883Shx147065 2195c533a883Shx147065 /* 2196c533a883Shx147065 * Group 2, 5.5 GHz ch 71-124: 4.0 degrees per 1/2 dB. 2197c533a883Shx147065 */ 2198c533a883Shx147065 #define CALIB_IWK_TX_ATTEN_GR3_FCH 71 2199c533a883Shx147065 #define CALIB_IWK_TX_ATTEN_GR3_LCH 124 2200c533a883Shx147065 2201c533a883Shx147065 /* 2202c533a883Shx147065 * Group 3, 5.7 GHz ch 125-200: 4.0 degrees per 1/2 dB. 2203c533a883Shx147065 */ 2204c533a883Shx147065 #define CALIB_IWK_TX_ATTEN_GR4_FCH 125 2205c533a883Shx147065 #define CALIB_IWK_TX_ATTEN_GR4_LCH 200 2206c533a883Shx147065 2207c533a883Shx147065 /* 2208c533a883Shx147065 * Group 4, 2.4 GHz all channels: 3.5 degrees per 1/2 dB. 2209c533a883Shx147065 */ 2210c533a883Shx147065 #define CALIB_IWK_TX_ATTEN_GR5_FCH 1 2211c533a883Shx147065 #define CALIB_IWK_TX_ATTEN_GR5_LCH 20 2212c533a883Shx147065 2213c533a883Shx147065 struct iwk_tx_power { 2214c533a883Shx147065 uint8_t tx_gain; /* gain for analog radio */ 2215c533a883Shx147065 uint8_t dsp_atten; /* gain for DSP */ 2216c533a883Shx147065 }; 2217c533a883Shx147065 2218c533a883Shx147065 struct tx_power_dual_stream { 2219c533a883Shx147065 uint16_t ramon_tx_gain; 2220c533a883Shx147065 uint16_t dsp_predis_atten; 2221c533a883Shx147065 }; 2222c533a883Shx147065 2223c533a883Shx147065 union tx_power_dual_stream_u { 2224c533a883Shx147065 struct tx_power_dual_stream s; 2225c533a883Shx147065 uint32_t dw; 2226c533a883Shx147065 }; 2227c533a883Shx147065 2228c533a883Shx147065 struct iwk_tx_power_db { 2229c533a883Shx147065 union tx_power_dual_stream_u 2230c533a883Shx147065 ht_ofdm_power[POWER_TABLE_NUM_HT_OFDM_ENTRIES]; 2231c533a883Shx147065 union tx_power_dual_stream_u legacy_cck_power; 2232c533a883Shx147065 2233c533a883Shx147065 }; 2234c533a883Shx147065 2235c533a883Shx147065 typedef struct iwk_tx_power_table_cmd { 2236c533a883Shx147065 uint8_t band; 2237c533a883Shx147065 uint8_t channel_normal_width; 2238c533a883Shx147065 uint16_t channel; 2239c533a883Shx147065 struct iwk_tx_power_db tx_power; 2240c533a883Shx147065 } iwk_tx_power_table_cmd_t; 2241c533a883Shx147065 2242c533a883Shx147065 typedef struct iwk_channel_switch_cmd { 2243c533a883Shx147065 uint8_t band; 2244c533a883Shx147065 uint8_t expect_beacon; 2245c533a883Shx147065 uint16_t channel; 2246c533a883Shx147065 uint32_t rxon_flags; 2247c533a883Shx147065 uint32_t rxon_filter_flags; 2248c533a883Shx147065 uint32_t switch_time; 2249c533a883Shx147065 struct iwk_tx_power_db tx_power; 2250c533a883Shx147065 } iwk_channel_switch_cmd_t; 2251c533a883Shx147065 2252c533a883Shx147065 struct iwk_channel_switch_notif { 2253c533a883Shx147065 uint16_t band; 2254c533a883Shx147065 uint16_t channel; 2255c533a883Shx147065 uint32_t status; 2256c533a883Shx147065 }; 2257c533a883Shx147065 2258c533a883Shx147065 /* 2259c533a883Shx147065 * END TXPOWER 2260c533a883Shx147065 */ 2261c533a883Shx147065 2262c533a883Shx147065 /* 2263c533a883Shx147065 * HT flags 2264c533a883Shx147065 */ 2265c533a883Shx147065 #define RXON_FLG_CONTROL_CHANNEL_LOCATION_MSK 0x400000 2266c533a883Shx147065 #define RXON_FLG_CONTROL_CHANNEL_LOC_LOW_MSK 0x000000 2267c533a883Shx147065 #define RXON_FLG_CONTROL_CHANNEL_LOC_HIGH_MSK 0x400000 2268c533a883Shx147065 2269c533a883Shx147065 #define RXON_FLG_HT_OPERATING_MODE_POS (23) 2270c533a883Shx147065 #define RXON_FLG_HT_PROT_MSK 0x800000 2271c533a883Shx147065 #define RXON_FLG_FAT_PROT_MSK 0x1000000 2272c533a883Shx147065 2273c533a883Shx147065 #define RXON_FLG_CHANNEL_MODE_POS (25) 2274c533a883Shx147065 #define RXON_FLG_CHANNEL_MODE_MSK 0x06000000 2275c533a883Shx147065 #define RXON_FLG_CHANNEL_MODE_LEGACY_MSK 0x00000000 2276c533a883Shx147065 #define RXON_FLG_CHANNEL_MODE_PURE_40_MSK 0x02000000 2277c533a883Shx147065 #define RXON_FLG_CHANNEL_MODE_MIXED_MSK 0x04000000 2278c533a883Shx147065 2279c533a883Shx147065 #define RXON_RX_CHAIN_DRIVER_FORCE_MSK (0x1<<0) 2280c533a883Shx147065 #define RXON_RX_CHAIN_VALID_MSK (0x7<<1) 2281c533a883Shx147065 #define RXON_RX_CHAIN_VALID_POS (1) 2282c533a883Shx147065 #define RXON_RX_CHAIN_FORCE_SEL_MSK (0x7<<4) 2283c533a883Shx147065 #define RXON_RX_CHAIN_FORCE_SEL_POS (4) 2284c533a883Shx147065 #define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK (0x7<<7) 2285c533a883Shx147065 #define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7) 2286c533a883Shx147065 #define RXON_RX_CHAIN_CNT_MSK (0x3<<10) 2287c533a883Shx147065 #define RXON_RX_CHAIN_CNT_POS (10) 2288c533a883Shx147065 #define RXON_RX_CHAIN_MIMO_CNT_MSK (0x3<<12) 2289c533a883Shx147065 #define RXON_RX_CHAIN_MIMO_CNT_POS (12) 2290c533a883Shx147065 #define RXON_RX_CHAIN_MIMO_FORCE_MSK (0x1<<14) 2291c533a883Shx147065 #define RXON_RX_CHAIN_MIMO_FORCE_POS (14) 2292c533a883Shx147065 2293c533a883Shx147065 #define MCS_DUP_6M_PLCP 0x20 2294c533a883Shx147065 2295c533a883Shx147065 /* 2296c533a883Shx147065 * OFDM HT rate masks 2297c533a883Shx147065 */ 2298c533a883Shx147065 #define R_MCS_6M_MSK 0x1 2299c533a883Shx147065 #define R_MCS_12M_MSK 0x2 2300c533a883Shx147065 #define R_MCS_18M_MSK 0x4 2301c533a883Shx147065 #define R_MCS_24M_MSK 0x8 2302c533a883Shx147065 #define R_MCS_36M_MSK 0x10 2303c533a883Shx147065 #define R_MCS_48M_MSK 0x20 2304c533a883Shx147065 #define R_MCS_54M_MSK 0x40 2305c533a883Shx147065 #define R_MCS_60M_MSK 0x80 2306c533a883Shx147065 #define R_MCS_12M_DUAL_MSK 0x100 2307c533a883Shx147065 #define R_MCS_24M_DUAL_MSK 0x200 2308c533a883Shx147065 #define R_MCS_36M_DUAL_MSK 0x400 2309c533a883Shx147065 #define R_MCS_48M_DUAL_MSK 0x800 2310c533a883Shx147065 2311c533a883Shx147065 #define RATE_MCS_CODE_MSK 0x7 2312c533a883Shx147065 #define RATE_MCS_MIMO_POS 3 2313c533a883Shx147065 #define RATE_MCS_MIMO_MSK 0x8 2314c533a883Shx147065 #define RATE_MCS_HT_DUP_POS 5 2315c533a883Shx147065 #define RATE_MCS_HT_DUP_MSK 0x20 2316c533a883Shx147065 #define RATE_MCS_FLAGS_POS 8 2317c533a883Shx147065 #define RATE_MCS_HT_POS 8 2318c533a883Shx147065 #define RATE_MCS_HT_MSK 0x100 2319c533a883Shx147065 #define RATE_MCS_CCK_POS 9 2320c533a883Shx147065 #define RATE_MCS_CCK_MSK 0x200 2321c533a883Shx147065 #define RATE_MCS_GF_POS 10 2322c533a883Shx147065 #define RATE_MCS_GF_MSK 0x400 2323c533a883Shx147065 2324c533a883Shx147065 #define RATE_MCS_FAT_POS 11 2325c533a883Shx147065 #define RATE_MCS_FAT_MSK 0x800 2326c533a883Shx147065 #define RATE_MCS_DUP_POS 12 2327c533a883Shx147065 #define RATE_MCS_DUP_MSK 0x1000 2328c533a883Shx147065 #define RATE_MCS_SGI_POS 13 2329c533a883Shx147065 #define RATE_MCS_SGI_MSK 0x2000 2330c533a883Shx147065 2331c533a883Shx147065 #define EEPROM_SEM_TIMEOUT 10 2332c533a883Shx147065 #define EEPROM_SEM_RETRY_LIMIT 1000 2333c533a883Shx147065 2334c533a883Shx147065 /* 2335c533a883Shx147065 * Antenna masks: 2336c533a883Shx147065 * bit14:15 01 B inactive, A active 2337c533a883Shx147065 * 10 B active, A inactive 2338c533a883Shx147065 * 11 Both active 2339c533a883Shx147065 */ 2340c533a883Shx147065 #define RATE_MCS_ANT_A_POS 14 2341c533a883Shx147065 #define RATE_MCS_ANT_B_POS 15 2342c533a883Shx147065 #define RATE_MCS_ANT_A_MSK 0x4000 2343c533a883Shx147065 #define RATE_MCS_ANT_B_MSK 0x8000 2344c533a883Shx147065 #define RATE_MCS_ANT_AB_MSK 0xc000 2345c533a883Shx147065 2346c533a883Shx147065 #define is_legacy(tbl) (((tbl) == LQ_G) || ((tbl) == LQ_A)) 2347c533a883Shx147065 #define is_siso(tbl) (((tbl) == LQ_SISO)) 2348c533a883Shx147065 #define is_mimo(tbl) (((tbl) == LQ_MIMO)) 2349c533a883Shx147065 #define is_Ht(tbl) (is_siso(tbl) || is_mimo(tbl)) 2350c533a883Shx147065 #define is_a_band(tbl) (((tbl) == LQ_A)) 2351c533a883Shx147065 #define is_g_and(tbl) (((tbl) == LQ_G)) 2352c533a883Shx147065 2353c533a883Shx147065 /* 2354c533a883Shx147065 * RS_NEW_API: only TLC_RTS remains and moved to bit 0 2355c533a883Shx147065 */ 2356c533a883Shx147065 #define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1<<0) 2357c533a883Shx147065 2358c533a883Shx147065 #define LINK_QUAL_AC_NUM 4 2359c533a883Shx147065 #define LINK_QUAL_MAX_RETRY_NUM 16 2360c533a883Shx147065 2361c533a883Shx147065 #define LINK_QUAL_ANT_A_MSK (1<<0) 2362c533a883Shx147065 #define LINK_QUAL_ANT_B_MSK (1<<1) 2363c533a883Shx147065 #define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK) 2364c533a883Shx147065 2365c533a883Shx147065 struct iwk_link_qual_general_params { 2366c533a883Shx147065 uint8_t flags; 2367c533a883Shx147065 uint8_t mimo_delimiter; 2368c533a883Shx147065 uint8_t single_stream_ant_msk; 2369c533a883Shx147065 uint8_t dual_stream_ant_msk; 2370c533a883Shx147065 uint8_t start_rate_index[LINK_QUAL_AC_NUM]; 2371c533a883Shx147065 }; 2372c533a883Shx147065 2373c533a883Shx147065 struct iwk_link_qual_agg_params { 2374c533a883Shx147065 uint16_t agg_time_limit; 2375c533a883Shx147065 uint8_t agg_dis_start_th; 2376c533a883Shx147065 uint8_t agg_frame_cnt_limit; 2377c533a883Shx147065 uint32_t reserved; 2378c533a883Shx147065 }; 2379c533a883Shx147065 2380c533a883Shx147065 typedef struct iwk_link_quality_cmd { 2381c533a883Shx147065 uint8_t sta_id; 2382c533a883Shx147065 uint8_t reserved1; 2383c533a883Shx147065 uint16_t control; 2384c533a883Shx147065 struct iwk_link_qual_general_params general_params; 2385c533a883Shx147065 struct iwk_link_qual_agg_params agg_params; 2386c533a883Shx147065 uint32_t rate_n_flags[LINK_QUAL_MAX_RETRY_NUM]; 2387c533a883Shx147065 uint32_t reserved2; 2388c533a883Shx147065 } iwk_link_quality_cmd_t; 2389c533a883Shx147065 2390c533a883Shx147065 typedef struct iwk_rx_phy_res { 2391c533a883Shx147065 uint8_t non_cfg_phy_cnt; /* non configurable DSP phy data byte count */ 2392c533a883Shx147065 uint8_t cfg_phy_cnt; /* configurable DSP phy data byte count */ 2393c533a883Shx147065 uint8_t stat_id; /* configurable DSP phy data set ID */ 2394c533a883Shx147065 uint8_t reserved1; 2395c533a883Shx147065 uint32_t timestampl; /* TSF at on air rise */ 2396c533a883Shx147065 uint32_t timestamph; 2397c533a883Shx147065 uint32_t beacon_time_stamp; /* beacon at on-air rise */ 2398c533a883Shx147065 uint16_t phy_flags; /* general phy flags: band, modulation, ... */ 2399c533a883Shx147065 uint16_t channel; /* channel number */ 2400c533a883Shx147065 uint16_t non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */ 2401c533a883Shx147065 uint32_t reserved2; 2402c533a883Shx147065 struct iwk_rate rate; /* rate in ucode internal format */ 2403c533a883Shx147065 uint16_t byte_count; /* frame's byte-count */ 2404c533a883Shx147065 uint16_t reserved3; 2405c533a883Shx147065 } iwk_rx_phy_res_t; 2406c533a883Shx147065 2407c533a883Shx147065 struct iwk_rx_mpdu_res_start { 2408c533a883Shx147065 uint16_t byte_count; 2409c533a883Shx147065 uint16_t reserved; 2410c533a883Shx147065 }; 2411c533a883Shx147065 2412c533a883Shx147065 #define IWK_AGC_DB_MASK (0x3f80) /* MASK(7,13) */ 2413c533a883Shx147065 #define IWK_AGC_DB_POS (7) 2414c533a883Shx147065 2415c533a883Shx147065 /* 2416c533a883Shx147065 * Fixed (non-configurable) rx data from phy 2417c533a883Shx147065 */ 2418c533a883Shx147065 struct iwk_rx_non_cfg_phy { 2419c533a883Shx147065 uint16_t ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */ 2420c533a883Shx147065 uint16_t agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */ 2421c533a883Shx147065 uint8_t rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */ 2422c533a883Shx147065 uint8_t pad[2]; 2423c533a883Shx147065 }; 2424c533a883Shx147065 2425c533a883Shx147065 /* 2426c533a883Shx147065 * Byte Count Table Entry 2427c533a883Shx147065 * 2428c533a883Shx147065 * Bit fields: 2429c533a883Shx147065 * 15-12: reserved 2430c533a883Shx147065 * 11- 0: total to-be-transmitted byte count of frame (does not include command) 2431c533a883Shx147065 */ 2432c533a883Shx147065 struct iwk_queue_byte_cnt_entry { 2433c533a883Shx147065 uint16_t val; 2434c533a883Shx147065 }; 2435c533a883Shx147065 2436c533a883Shx147065 /* 2437c533a883Shx147065 * Byte Count table 2438c533a883Shx147065 * 2439c533a883Shx147065 * Each Tx queue uses a byte-count table containing 320 entries: 2440c533a883Shx147065 * one 16-bit entry for each of 256 TFDs, plus an additional 64 entries that 2441c533a883Shx147065 * duplicate the first 64 entries (to avoid wrap-around within a Tx window; 2442c533a883Shx147065 * max Tx window is 64 TFDs). 2443c533a883Shx147065 * 2444c533a883Shx147065 * When driver sets up a new TFD, it must also enter the total byte count 2445c533a883Shx147065 * of the frame to be transmitted into the corresponding entry in the byte 2446c533a883Shx147065 * count table for the chosen Tx queue. If the TFD index is 0-63, the driver 2447c533a883Shx147065 * must duplicate the byte count entry in corresponding index 256-319. 2448c533a883Shx147065 * 2449c533a883Shx147065 * "dont_care" padding puts each byte count table on a 1024-byte boundary; 2450c533a883Shx147065 * 4965 assumes tables are separated by 1024 bytes. 2451c533a883Shx147065 */ 2452c533a883Shx147065 struct iwk_sched_queue_byte_cnt_tbl { 2453c533a883Shx147065 struct iwk_queue_byte_cnt_entry tfd_offset[IWK_QUEUE_SIZE + 2454c533a883Shx147065 IWK_MAX_WIN_SIZE]; 2455c533a883Shx147065 uint8_t dont_care[1024 - (IWK_QUEUE_SIZE + IWK_MAX_WIN_SIZE) * 2456c533a883Shx147065 sizeof (uint16_t)]; 2457c533a883Shx147065 }; 2458c533a883Shx147065 2459c533a883Shx147065 /* 2460c533a883Shx147065 * struct iwk_shared, handshake area for Tx and Rx 2461c533a883Shx147065 * 2462c533a883Shx147065 * For convenience in allocating memory, this structure combines 2 areas of 2463c533a883Shx147065 * DRAM which must be shared between driver and 4965. These do not need to 2464c533a883Shx147065 * be combined, if better allocation would result from keeping them separate: 2465c533a883Shx147065 * TODO: Split these; carried over from 3945, doesn't work well for 4965. 2466c533a883Shx147065 * 2467c533a883Shx147065 * 1) The Tx byte count tables occupy 1024 bytes each (16 KBytes total for 2468c533a883Shx147065 * 16 queues). Driver uses SCD_DRAM_BASE_ADDR to tell 4965 where to find 2469c533a883Shx147065 * the first of these tables. 4965 assumes tables are 1024 bytes apart. 2470c533a883Shx147065 * 2471c533a883Shx147065 * 2) The Rx status (val0 and val1) occupies only 8 bytes. Driver uses 2472c533a883Shx147065 * FH_RSCSR_CHNL0_STTS_WPTR_REG to tell 4965 where to find this area. 2473c533a883Shx147065 * Driver reads val0 to determine the latest Receive Buffer Descriptor (RBD) 2474c533a883Shx147065 * that has been filled by the 4965. 2475c533a883Shx147065 * 2476c533a883Shx147065 * Bit fields val0: 2477c533a883Shx147065 * 31-12: Not used 2478c533a883Shx147065 * 11- 0: Index of last filled Rx buffer descriptor (4965 writes, driver reads) 2479c533a883Shx147065 * 2480c533a883Shx147065 * Bit fields val1: 2481c533a883Shx147065 * 31- 0: Not used 2482c533a883Shx147065 */ 2483c533a883Shx147065 typedef struct iwk_shared { 2484c533a883Shx147065 struct iwk_sched_queue_byte_cnt_tbl 2485c533a883Shx147065 queues_byte_cnt_tbls[IWK_NUM_QUEUES]; 2486c533a883Shx147065 uint32_t val0; 2487c533a883Shx147065 uint32_t val1; 2488c533a883Shx147065 uint32_t padding1; /* so that allocation will be aligned to 16B */ 2489c533a883Shx147065 uint32_t padding2; 2490c533a883Shx147065 } iwk_shared_t; 2491c533a883Shx147065 2492c533a883Shx147065 2493c533a883Shx147065 /* 2494c533a883Shx147065 * struct iwk_tfd_frame_data 2495c533a883Shx147065 * 2496c533a883Shx147065 * Describes up to 2 buffers containing (contiguous) portions of a Tx frame. 2497c533a883Shx147065 * Each buffer must be on dword boundary. 2498c533a883Shx147065 * Up to 10 iwk_tfd_frame_data structures, describing up to 20 buffers, 2499c533a883Shx147065 * may be filled within a TFD (iwk_tfd_frame). 2500c533a883Shx147065 * 2501c533a883Shx147065 * Bit fields in tb1_addr: 2502c533a883Shx147065 * 31- 0: Tx buffer 1 address bits [31:0] 2503c533a883Shx147065 * 2504c533a883Shx147065 * Bit fields in val1: 2505c533a883Shx147065 * 31-16: Tx buffer 2 address bits [15:0] 2506c533a883Shx147065 * 15- 4: Tx buffer 1 length (bytes) 2507c533a883Shx147065 * 3- 0: Tx buffer 1 address bits [32:32] 2508c533a883Shx147065 * 2509c533a883Shx147065 * Bit fields in val2: 2510c533a883Shx147065 * 31-20: Tx buffer 2 length (bytes) 2511c533a883Shx147065 * 19- 0: Tx buffer 2 address bits [35:16] 2512c533a883Shx147065 */ 2513c533a883Shx147065 struct iwk_tfd_frame_data { 2514c533a883Shx147065 uint32_t tb1_addr; 2515c533a883Shx147065 uint32_t val1; 2516c533a883Shx147065 uint32_t val2; 2517c533a883Shx147065 }; 2518c533a883Shx147065 2519c533a883Shx147065 typedef struct iwk_tx_desc { 2520c533a883Shx147065 uint32_t val0; 2521c533a883Shx147065 struct iwk_tfd_frame_data pa[10]; 2522c533a883Shx147065 uint32_t reserved; 2523c533a883Shx147065 } iwk_tx_desc_t; 2524c533a883Shx147065 2525c533a883Shx147065 typedef struct iwk_tx_stat { 2526c533a883Shx147065 uint8_t frame_count; 2527c533a883Shx147065 uint8_t bt_kill_count; 2528c533a883Shx147065 uint8_t nrts; 2529c533a883Shx147065 uint8_t ntries; 2530c533a883Shx147065 struct iwk_rate rate; 2531c533a883Shx147065 uint16_t duration; 2532c533a883Shx147065 uint16_t reserved; 2533c533a883Shx147065 uint32_t pa_power1; 2534c533a883Shx147065 uint32_t pa_power2; 2535c533a883Shx147065 uint32_t status; 2536c533a883Shx147065 } iwk_tx_stat_t; 2537c533a883Shx147065 2538c533a883Shx147065 struct iwk_cmd_header { 2539c533a883Shx147065 uint8_t type; 2540c533a883Shx147065 uint8_t flags; 2541c533a883Shx147065 uint8_t idx; 2542c533a883Shx147065 uint8_t qid; 2543c533a883Shx147065 }; 2544c533a883Shx147065 2545c533a883Shx147065 typedef struct iwk_rx_desc { 2546c533a883Shx147065 uint32_t len; 2547c533a883Shx147065 struct iwk_cmd_header hdr; 2548c533a883Shx147065 } iwk_rx_desc_t; 2549c533a883Shx147065 2550c533a883Shx147065 typedef struct iwk_rx_stat { 2551c533a883Shx147065 uint8_t len; 2552c533a883Shx147065 uint8_t id; 2553c533a883Shx147065 uint8_t rssi; /* received signal strength */ 2554c533a883Shx147065 uint8_t agc; /* access gain control */ 2555c533a883Shx147065 uint16_t signal; 2556c533a883Shx147065 uint16_t noise; 2557c533a883Shx147065 } iwk_rx_stat_t; 2558c533a883Shx147065 2559c533a883Shx147065 typedef struct iwk_rx_head { 2560c533a883Shx147065 uint16_t chan; 2561c533a883Shx147065 uint16_t flags; 2562c533a883Shx147065 uint8_t reserved; 2563c533a883Shx147065 uint8_t rate; 2564c533a883Shx147065 uint16_t len; 2565c533a883Shx147065 } iwk_rx_head_t; 2566c533a883Shx147065 2567c533a883Shx147065 typedef struct iwk_rx_tail { 2568c533a883Shx147065 uint32_t flags; 2569c533a883Shx147065 uint32_t timestampl; 2570c533a883Shx147065 uint32_t timestamph; 2571c533a883Shx147065 uint32_t tbeacon; 2572c533a883Shx147065 } iwk_rx_tail_t; 2573c533a883Shx147065 2574c533a883Shx147065 enum { 2575c533a883Shx147065 IWK_AP_ID = 0, 2576c533a883Shx147065 IWK_MULTICAST_ID, 2577c533a883Shx147065 IWK_STA_ID, 2578c533a883Shx147065 IWK_BROADCAST_ID = 31, 2579c533a883Shx147065 IWK_STATION_COUNT = 32, 2580c533a883Shx147065 IWK_INVALID_STATION 2581c533a883Shx147065 }; 2582c533a883Shx147065 2583c533a883Shx147065 /* 2584c533a883Shx147065 * key flags 2585c533a883Shx147065 */ 2586c533a883Shx147065 enum { 2587c533a883Shx147065 STA_KEY_FLG_ENCRYPT_MSK = 0x7, 2588c533a883Shx147065 STA_KEY_FLG_NO_ENC = 0x0, 2589c533a883Shx147065 STA_KEY_FLG_WEP = 0x1, 2590c533a883Shx147065 STA_KEY_FLG_CCMP = 0x2, 2591c533a883Shx147065 STA_KEY_FLG_TKIP = 0x3, 2592c533a883Shx147065 2593c533a883Shx147065 STA_KEY_FLG_KEYID_POS = 8, 2594c533a883Shx147065 STA_KEY_FLG_INVALID = 0x0800, 2595c533a883Shx147065 }; 2596c533a883Shx147065 2597c533a883Shx147065 /* 2598c533a883Shx147065 * modify flags 2599c533a883Shx147065 */ 2600c533a883Shx147065 enum { 2601c533a883Shx147065 STA_MODIFY_KEY_MASK = 0x01, 2602c533a883Shx147065 STA_MODIFY_TID_DISABLE_TX = 0x02, 2603c533a883Shx147065 STA_MODIFY_TX_RATE_MSK = 0x04 2604c533a883Shx147065 }; 2605c533a883Shx147065 2606c533a883Shx147065 enum { 2607c533a883Shx147065 RX_RES_STATUS_NO_CRC32_ERROR = (1 << 0), 2608c533a883Shx147065 RX_RES_STATUS_NO_RXE_OVERFLOW = (1 << 1), 2609c533a883Shx147065 }; 2610c533a883Shx147065 2611c533a883Shx147065 enum { 2612c533a883Shx147065 RX_RES_PHY_FLAGS_BAND_24_MSK = (1 << 0), 2613c533a883Shx147065 RX_RES_PHY_FLAGS_MOD_CCK_MSK = (1 << 1), 2614c533a883Shx147065 RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK = (1 << 2), 2615c533a883Shx147065 RX_RES_PHY_FLAGS_NARROW_BAND_MSK = (1 << 3), 2616c533a883Shx147065 RX_RES_PHY_FLAGS_ANTENNA_MSK = 0xf0, 2617c533a883Shx147065 2618c533a883Shx147065 RX_RES_STATUS_SEC_TYPE_MSK = (0x7 << 8), 2619c533a883Shx147065 RX_RES_STATUS_SEC_TYPE_NONE = (STA_KEY_FLG_NO_ENC << 8), 2620c533a883Shx147065 RX_RES_STATUS_SEC_TYPE_WEP = (STA_KEY_FLG_WEP << 8), 2621c533a883Shx147065 RX_RES_STATUS_SEC_TYPE_TKIP = (STA_KEY_FLG_TKIP << 8), 2622c533a883Shx147065 RX_RES_STATUS_SEC_TYPE_CCMP = (STA_KEY_FLG_CCMP << 8), 2623c533a883Shx147065 2624c533a883Shx147065 RX_RES_STATUS_DECRYPT_TYPE_MSK = (0x3 << 11), 2625c533a883Shx147065 RX_RES_STATUS_NOT_DECRYPT = (0x0 << 11), 2626c533a883Shx147065 RX_RES_STATUS_DECRYPT_OK = (0x3 << 11), 2627c533a883Shx147065 RX_RES_STATUS_BAD_ICV_MIC = (0x1 << 11), 2628c533a883Shx147065 RX_RES_STATUS_BAD_KEY_TTAK = (0x2 << 11), 2629c533a883Shx147065 }; 2630c533a883Shx147065 2631c533a883Shx147065 enum { 2632c533a883Shx147065 REPLY_ALIVE = 0x1, 2633c533a883Shx147065 REPLY_ERROR = 0x2, 2634c533a883Shx147065 2635c533a883Shx147065 /* RXON state commands */ 2636c533a883Shx147065 REPLY_RXON = 0x10, 2637c533a883Shx147065 REPLY_RXON_ASSOC = 0x11, 2638c533a883Shx147065 REPLY_QOS_PARAM = 0x13, 2639c533a883Shx147065 REPLY_RXON_TIMING = 0x14, 2640c533a883Shx147065 2641c533a883Shx147065 /* Multi-Station support */ 2642c533a883Shx147065 REPLY_ADD_STA = 0x18, 2643cdc64593Sxinghua wen - Sun Microsystems - Beijing China REPLY_REMOVE_ALL_STA = 0x1a, 2644c533a883Shx147065 2645c533a883Shx147065 /* RX, TX */ 2646c533a883Shx147065 2647c533a883Shx147065 REPLY_TX = 0x1c, 2648c533a883Shx147065 2649c533a883Shx147065 /* timers commands */ 2650c533a883Shx147065 REPLY_BCON = 0x27, 2651c533a883Shx147065 2652c533a883Shx147065 REPLY_SHUTDOWN = 0x40, 2653c533a883Shx147065 2654c533a883Shx147065 /* MISC commands */ 2655c533a883Shx147065 REPLY_RATE_SCALE = 0x47, 2656c533a883Shx147065 REPLY_LEDS_CMD = 0x48, 2657c533a883Shx147065 REPLY_TX_LINK_QUALITY_CMD = 0x4e, 2658c533a883Shx147065 2659c533a883Shx147065 /* 802.11h related */ 2660c533a883Shx147065 RADAR_NOTIFICATION = 0x70, 2661c533a883Shx147065 REPLY_QUIET_CMD = 0x71, 2662c533a883Shx147065 REPLY_CHANNEL_SWITCH = 0x72, 2663c533a883Shx147065 CHANNEL_SWITCH_NOTIFICATION = 0x73, 2664c533a883Shx147065 REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74, 2665c533a883Shx147065 SPECTRUM_MEASURE_NOTIFICATION = 0x75, 2666c533a883Shx147065 2667c533a883Shx147065 /* Power Management *** */ 2668c533a883Shx147065 POWER_TABLE_CMD = 0x77, 2669c533a883Shx147065 PM_SLEEP_NOTIFICATION = 0x7A, 2670c533a883Shx147065 PM_DEBUG_STATISTIC_NOTIFIC = 0x7B, 2671c533a883Shx147065 2672c533a883Shx147065 /* Scan commands and notifications */ 2673c533a883Shx147065 REPLY_SCAN_CMD = 0x80, 2674c533a883Shx147065 REPLY_SCAN_ABORT_CMD = 0x81, 2675c533a883Shx147065 2676c533a883Shx147065 SCAN_START_NOTIFICATION = 0x82, 2677c533a883Shx147065 SCAN_RESULTS_NOTIFICATION = 0x83, 2678c533a883Shx147065 SCAN_COMPLETE_NOTIFICATION = 0x84, 2679c533a883Shx147065 2680c533a883Shx147065 /* IBSS/AP commands */ 2681c533a883Shx147065 BEACON_NOTIFICATION = 0x90, 2682c533a883Shx147065 REPLY_TX_BEACON = 0x91, 2683c533a883Shx147065 WHO_IS_AWAKE_NOTIFICATION = 0x94, 2684c533a883Shx147065 2685c533a883Shx147065 QUIET_NOTIFICATION = 0x96, 2686c533a883Shx147065 REPLY_TX_PWR_TABLE_CMD = 0x97, 2687c533a883Shx147065 MEASURE_ABORT_NOTIFICATION = 0x99, 2688c533a883Shx147065 2689c533a883Shx147065 REPLY_CALIBRATION_TUNE = 0x9a, 2690c533a883Shx147065 2691c533a883Shx147065 /* BT config command */ 2692c533a883Shx147065 REPLY_BT_CONFIG = 0x9b, 2693c533a883Shx147065 REPLY_STATISTICS_CMD = 0x9c, 2694c533a883Shx147065 STATISTICS_NOTIFICATION = 0x9d, 2695c533a883Shx147065 2696c533a883Shx147065 /* RF-KILL commands and notifications *** */ 2697c533a883Shx147065 REPLY_CARD_STATE_CMD = 0xa0, 2698c533a883Shx147065 CARD_STATE_NOTIFICATION = 0xa1, 2699c533a883Shx147065 2700c533a883Shx147065 /* Missed beacons notification */ 2701c533a883Shx147065 MISSED_BEACONS_NOTIFICATION = 0xa2, 2702c533a883Shx147065 MISSED_BEACONS_NOTIFICATION_TH_CMD = 0xa3, 2703c533a883Shx147065 2704c533a883Shx147065 REPLY_CT_KILL_CONFIG_CMD = 0xa4, 2705c533a883Shx147065 SENSITIVITY_CMD = 0xa8, 2706c533a883Shx147065 REPLY_PHY_CALIBRATION_CMD = 0xb0, 2707c533a883Shx147065 REPLY_4965_RX = 0xc3, 2708c533a883Shx147065 REPLY_RX_PHY_CMD = 0xc0, 2709c533a883Shx147065 REPLY_RX_MPDU_CMD = 0xc1, 2710c533a883Shx147065 REPLY_COMPRESSED_BA = 0xc5, 2711c533a883Shx147065 REPLY_MAX = 0xff 2712c533a883Shx147065 }; 2713c533a883Shx147065 2714c533a883Shx147065 typedef struct iwk_cmd { 2715c533a883Shx147065 struct iwk_cmd_header hdr; 2716c533a883Shx147065 uint8_t data[1024]; 2717c533a883Shx147065 } iwk_cmd_t; 2718c533a883Shx147065 2719c533a883Shx147065 /* 2720c533a883Shx147065 * Alive Command & Response 2721c533a883Shx147065 */ 2722c533a883Shx147065 #define UCODE_VALID_OK (0x1) 2723c533a883Shx147065 #define INITIALIZE_SUBTYPE (9) 2724c533a883Shx147065 2725c533a883Shx147065 struct iwk_alive_resp { 2726c533a883Shx147065 uint8_t ucode_minor; 2727c533a883Shx147065 uint8_t ucode_major; 2728c533a883Shx147065 uint16_t reserved1; 2729c533a883Shx147065 uint8_t sw_rev[8]; 2730c533a883Shx147065 uint8_t ver_type; 2731c533a883Shx147065 uint8_t ver_subtype; 2732c533a883Shx147065 uint16_t reserved2; 2733c533a883Shx147065 uint32_t log_event_table_ptr; 2734c533a883Shx147065 uint32_t error_event_table_ptr; 2735c533a883Shx147065 uint32_t timestamp; 2736c533a883Shx147065 uint32_t is_valid; 2737c533a883Shx147065 }; 2738c533a883Shx147065 2739c533a883Shx147065 struct iwk_init_alive_resp { 2740c533a883Shx147065 struct iwk_alive_resp s; 2741c533a883Shx147065 /* calibration values from "initialize" uCode */ 2742c533a883Shx147065 uint32_t voltage; /* signed */ 2743c533a883Shx147065 uint32_t therm_r1[2]; /* signed 1st for normal, 2nd for FAT channel */ 2744c533a883Shx147065 uint32_t therm_r2[2]; /* signed */ 2745c533a883Shx147065 uint32_t therm_r3[2]; /* signed */ 2746c533a883Shx147065 uint32_t therm_r4[2]; /* signed */ 2747c533a883Shx147065 /* 2748c533a883Shx147065 * signed MIMO gain comp, 5 freq groups, 2 Tx chains 2749c533a883Shx147065 */ 2750c533a883Shx147065 uint32_t tx_atten[5][2]; 2751c533a883Shx147065 }; 2752c533a883Shx147065 2753c533a883Shx147065 /* 2754c533a883Shx147065 * Rx config defines & structure 2755c533a883Shx147065 */ 2756c533a883Shx147065 /* 2757c533a883Shx147065 * rx_config device types 2758c533a883Shx147065 */ 2759c533a883Shx147065 enum { 2760c533a883Shx147065 RXON_DEV_TYPE_AP = 1, 2761c533a883Shx147065 RXON_DEV_TYPE_ESS = 3, 2762c533a883Shx147065 RXON_DEV_TYPE_IBSS = 4, 2763c533a883Shx147065 RXON_DEV_TYPE_SNIFFER = 6, 2764c533a883Shx147065 }; 2765c533a883Shx147065 2766c533a883Shx147065 /* 2767c533a883Shx147065 * rx_config flags 2768c533a883Shx147065 */ 2769c533a883Shx147065 enum { 2770c533a883Shx147065 /* band & modulation selection */ 2771c533a883Shx147065 RXON_FLG_BAND_24G_MSK = (1 << 0), 2772c533a883Shx147065 RXON_FLG_CCK_MSK = (1 << 1), 2773c533a883Shx147065 /* auto detection enable */ 2774c533a883Shx147065 RXON_FLG_AUTO_DETECT_MSK = (1 << 2), 2775c533a883Shx147065 /* TGg protection when tx */ 2776c533a883Shx147065 RXON_FLG_TGG_PROTECT_MSK = (1 << 3), 2777c533a883Shx147065 /* cck short slot & preamble */ 2778c533a883Shx147065 RXON_FLG_SHORT_SLOT_MSK = (1 << 4), 2779c533a883Shx147065 RXON_FLG_SHORT_PREAMBLE_MSK = (1 << 5), 2780c533a883Shx147065 /* antenna selection */ 2781c533a883Shx147065 RXON_FLG_DIS_DIV_MSK = (1 << 7), 2782c533a883Shx147065 RXON_FLG_ANT_SEL_MSK = 0x0f00, 2783c533a883Shx147065 RXON_FLG_ANT_A_MSK = (1 << 8), 2784c533a883Shx147065 RXON_FLG_ANT_B_MSK = (1 << 9), 2785c533a883Shx147065 /* radar detection enable */ 2786c533a883Shx147065 RXON_FLG_RADAR_DETECT_MSK = (1 << 12), 2787c533a883Shx147065 RXON_FLG_TGJ_NARROW_BAND_MSK = (1 << 13), 2788c533a883Shx147065 /* 2789c533a883Shx147065 * rx response to host with 8-byte TSF 2790c533a883Shx147065 * (according to ON_AIR deassertion) 2791c533a883Shx147065 */ 2792c533a883Shx147065 RXON_FLG_TSF2HOST_MSK = (1 << 15) 2793c533a883Shx147065 }; 2794c533a883Shx147065 2795c533a883Shx147065 /* 2796c533a883Shx147065 * rx_config filter flags 2797c533a883Shx147065 */ 2798c533a883Shx147065 enum { 2799c533a883Shx147065 /* accept all data frames */ 2800c533a883Shx147065 RXON_FILTER_PROMISC_MSK = (1 << 0), 2801c533a883Shx147065 /* pass control & management to host */ 2802c533a883Shx147065 RXON_FILTER_CTL2HOST_MSK = (1 << 1), 2803c533a883Shx147065 /* accept multi-cast */ 2804c533a883Shx147065 RXON_FILTER_ACCEPT_GRP_MSK = (1 << 2), 2805c533a883Shx147065 /* don't decrypt uni-cast frames */ 2806c533a883Shx147065 RXON_FILTER_DIS_DECRYPT_MSK = (1 << 3), 2807c533a883Shx147065 /* don't decrypt multi-cast frames */ 2808c533a883Shx147065 RXON_FILTER_DIS_GRP_DECRYPT_MSK = (1 << 4), 2809c533a883Shx147065 /* STA is associated */ 2810c533a883Shx147065 RXON_FILTER_ASSOC_MSK = (1 << 5), 2811c533a883Shx147065 /* transfer to host non bssid beacons in associated state */ 2812c533a883Shx147065 RXON_FILTER_BCON_AWARE_MSK = (1 << 6) 2813c533a883Shx147065 }; 2814c533a883Shx147065 2815c533a883Shx147065 2816c533a883Shx147065 /* 2817c533a883Shx147065 * structure for RXON Command & Response 2818c533a883Shx147065 */ 2819c533a883Shx147065 typedef struct iwk_rxon_cmd { 2820c533a883Shx147065 uint8_t node_addr[IEEE80211_ADDR_LEN]; 2821c533a883Shx147065 uint16_t reserved1; 2822c533a883Shx147065 uint8_t bssid[IEEE80211_ADDR_LEN]; 2823c533a883Shx147065 uint16_t reserved2; 2824c533a883Shx147065 uint8_t wlap_bssid[IEEE80211_ADDR_LEN]; 2825c533a883Shx147065 uint16_t reserved3; 2826c533a883Shx147065 uint8_t dev_type; 2827c533a883Shx147065 uint8_t air_propagation; 2828c533a883Shx147065 uint16_t rx_chain; 2829c533a883Shx147065 uint8_t ofdm_basic_rates; 2830c533a883Shx147065 uint8_t cck_basic_rates; 2831c533a883Shx147065 uint16_t assoc_id; 2832c533a883Shx147065 uint32_t flags; 2833c533a883Shx147065 uint32_t filter_flags; 2834c533a883Shx147065 uint16_t chan; 2835c533a883Shx147065 uint8_t ofdm_ht_single_stream_basic_rates; 2836c533a883Shx147065 uint8_t ofdm_ht_dual_stream_basic_rates; 2837c533a883Shx147065 } iwk_rxon_cmd_t; 2838c533a883Shx147065 2839c533a883Shx147065 typedef struct iwk_compressed_ba_resp { 2840c533a883Shx147065 uint32_t sta_addr_lo32; 2841c533a883Shx147065 uint16_t sta_addr_hi16; 2842c533a883Shx147065 uint16_t reserved; 2843c533a883Shx147065 uint8_t sta_id; 2844c533a883Shx147065 uint8_t tid; 2845c533a883Shx147065 uint16_t ba_seq_ctl; 2846c533a883Shx147065 uint32_t ba_bitmap0; 2847c533a883Shx147065 uint32_t ba_bitmap1; 2848c533a883Shx147065 uint16_t scd_flow; 2849c533a883Shx147065 uint16_t scd_ssn; 2850c533a883Shx147065 } iwk_compressed_ba_resp_t; 2851c533a883Shx147065 2852c533a883Shx147065 #define PHY_CALIBRATE_DIFF_GAIN_CMD (7) 2853c533a883Shx147065 #define HD_TABLE_SIZE (11) 2854c533a883Shx147065 2855c533a883Shx147065 /* 2856c533a883Shx147065 * Param table within SENSITIVITY_CMD 2857c533a883Shx147065 */ 2858c533a883Shx147065 #define HD_MIN_ENERGY_CCK_DET_INDEX (0) 2859c533a883Shx147065 #define HD_MIN_ENERGY_OFDM_DET_INDEX (1) 2860c533a883Shx147065 #define HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX (2) 2861c533a883Shx147065 #define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX (3) 2862c533a883Shx147065 #define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX (4) 2863c533a883Shx147065 #define HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX (5) 2864c533a883Shx147065 #define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX (6) 2865c533a883Shx147065 #define HD_BARKER_CORR_TH_ADD_MIN_INDEX (7) 2866c533a883Shx147065 #define HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX (8) 2867c533a883Shx147065 #define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX (9) 2868c533a883Shx147065 #define HD_OFDM_ENERGY_TH_IN_INDEX (10) 2869c533a883Shx147065 2870c533a883Shx147065 typedef struct iwk_sensitivity_cmd { 2871c533a883Shx147065 uint16_t control; 2872c533a883Shx147065 uint16_t table[HD_TABLE_SIZE]; 2873c533a883Shx147065 } iwk_sensitivity_cmd_t; 2874c533a883Shx147065 2875c533a883Shx147065 typedef struct iwk_calibration_cmd { 2876c533a883Shx147065 uint8_t opCode; 2877c533a883Shx147065 uint8_t flags; 2878c533a883Shx147065 uint16_t reserved; 2879cdc64593Sxinghua wen - Sun Microsystems - Beijing China char diff_gain_a; 2880cdc64593Sxinghua wen - Sun Microsystems - Beijing China char diff_gain_b; 2881cdc64593Sxinghua wen - Sun Microsystems - Beijing China char diff_gain_c; 2882c533a883Shx147065 uint8_t reserved1; 2883c533a883Shx147065 } iwk_calibation_cmd_t; 2884c533a883Shx147065 2885c533a883Shx147065 typedef struct iwk_missed_beacon_notif { 2886c533a883Shx147065 uint32_t consequtive_missed_beacons; 2887c533a883Shx147065 uint32_t total_missed_becons; 2888c533a883Shx147065 uint32_t num_expected_beacons; 2889c533a883Shx147065 uint32_t num_recvd_beacons; 2890c533a883Shx147065 } iwk_missed_beacon_notif_t; 2891c533a883Shx147065 2892c533a883Shx147065 typedef struct iwk_ct_kill_config { 2893c533a883Shx147065 uint32_t reserved; 2894c533a883Shx147065 uint32_t critical_temperature_M; 2895c533a883Shx147065 uint32_t critical_temperature_R; 2896c533a883Shx147065 } iwk_ct_kill_config_t; 2897c533a883Shx147065 2898c533a883Shx147065 /* 2899c533a883Shx147065 * structure for command IWK_CMD_ASSOCIATE 2900c533a883Shx147065 */ 2901c533a883Shx147065 typedef struct iwk_assoc { 2902c533a883Shx147065 uint32_t flags; 2903c533a883Shx147065 uint32_t filter; 2904c533a883Shx147065 uint8_t ofdm_mask; 2905c533a883Shx147065 uint8_t cck_mask; 2906c533a883Shx147065 uint8_t ofdm_ht_single_stream_basic_rates; 2907c533a883Shx147065 uint8_t ofdm_ht_dual_stream_basic_rates; 2908c533a883Shx147065 uint16_t rx_chain_select_flags; 2909c533a883Shx147065 uint16_t reserved; 2910c533a883Shx147065 } iwk_assoc_t; 2911c533a883Shx147065 2912c533a883Shx147065 /* 2913c533a883Shx147065 * structure for command IWK_CMD_SET_WME 2914c533a883Shx147065 */ 2915c533a883Shx147065 typedef struct iwk_wme_setup { 2916c533a883Shx147065 uint32_t flags; 2917c533a883Shx147065 struct { 2918c533a883Shx147065 uint16_t cwmin; 2919c533a883Shx147065 uint16_t cwmax; 2920c533a883Shx147065 uint8_t aifsn; 2921c533a883Shx147065 uint8_t reserved; 2922c533a883Shx147065 uint16_t txop; 2923c533a883Shx147065 } ac[WME_NUM_AC]; 2924c533a883Shx147065 } iwk_wme_setup_t; 2925c533a883Shx147065 2926c533a883Shx147065 /* 2927c533a883Shx147065 * structure for command IWK_CMD_TSF 2928c533a883Shx147065 */ 2929c533a883Shx147065 typedef struct iwk_cmd_tsf { 2930c533a883Shx147065 uint32_t timestampl; 2931c533a883Shx147065 uint32_t timestamph; 2932c533a883Shx147065 uint16_t bintval; 2933c533a883Shx147065 uint16_t atim; 2934c533a883Shx147065 uint32_t binitval; 2935c533a883Shx147065 uint16_t lintval; 2936c533a883Shx147065 uint16_t reserved; 2937c533a883Shx147065 } iwk_cmd_tsf_t; 2938c533a883Shx147065 2939c533a883Shx147065 /* 2940c533a883Shx147065 * structure for IWK_CMD_ADD_NODE 2941c533a883Shx147065 */ 2942c533a883Shx147065 typedef struct iwk_add_sta { 2943c533a883Shx147065 uint8_t control; 2944c533a883Shx147065 uint8_t reserved1[3]; 2945c533a883Shx147065 uint8_t bssid[IEEE80211_ADDR_LEN]; 2946c533a883Shx147065 uint16_t reserved2; 2947c533a883Shx147065 uint8_t id; 2948c533a883Shx147065 uint8_t sta_mask; 2949c533a883Shx147065 uint16_t reserved3; 2950c533a883Shx147065 uint16_t key_flags; 2951c533a883Shx147065 uint8_t tkip; 2952c533a883Shx147065 uint8_t reserved4; 2953c533a883Shx147065 uint16_t ttak[5]; 2954c533a883Shx147065 uint8_t keyp; 2955c533a883Shx147065 uint8_t reserved5; 2956c533a883Shx147065 uint8_t key[16]; 2957c533a883Shx147065 uint32_t flags; 2958c533a883Shx147065 uint32_t mask; 2959c533a883Shx147065 uint16_t tid; 2960c533a883Shx147065 union { 2961c533a883Shx147065 struct { 2962c533a883Shx147065 uint8_t rate; 2963c533a883Shx147065 uint8_t flags; 2964c533a883Shx147065 } s; 2965c533a883Shx147065 uint16_t rate_n_flags; 2966c533a883Shx147065 } tx_rate; 2967c533a883Shx147065 uint8_t add_imm; 2968c533a883Shx147065 uint8_t del_imm; 2969c533a883Shx147065 uint16_t add_imm_start; 2970c533a883Shx147065 uint32_t reserved7; 2971c533a883Shx147065 } iwk_add_sta_t; 2972c533a883Shx147065 2973c533a883Shx147065 /* 2974c533a883Shx147065 * Tx flags 2975c533a883Shx147065 */ 2976c533a883Shx147065 enum { 2977c533a883Shx147065 TX_CMD_FLG_RTS_MSK = (1 << 1), 2978c533a883Shx147065 TX_CMD_FLG_CTS_MSK = (1 << 2), 2979c533a883Shx147065 TX_CMD_FLG_ACK_MSK = (1 << 3), 2980c533a883Shx147065 TX_CMD_FLG_STA_RATE_MSK = (1 << 4), 2981c533a883Shx147065 TX_CMD_FLG_IMM_BA_RSP_MASK = (1 << 6), 2982c533a883Shx147065 TX_CMD_FLG_FULL_TXOP_PROT_MSK = (1 << 7), 2983c533a883Shx147065 TX_CMD_FLG_ANT_SEL_MSK = 0xf00, 2984c533a883Shx147065 TX_CMD_FLG_ANT_A_MSK = (1 << 8), 2985c533a883Shx147065 TX_CMD_FLG_ANT_B_MSK = (1 << 9), 2986c533a883Shx147065 2987c533a883Shx147065 /* ucode ignores BT priority for this frame */ 2988c533a883Shx147065 TX_CMD_FLG_BT_DIS_MSK = (1 << 12), 2989c533a883Shx147065 2990c533a883Shx147065 /* ucode overrides sequence control */ 2991c533a883Shx147065 TX_CMD_FLG_SEQ_CTL_MSK = (1 << 13), 2992c533a883Shx147065 2993c533a883Shx147065 /* signal that this frame is non-last MPDU */ 2994c533a883Shx147065 TX_CMD_FLG_MORE_FRAG_MSK = (1 << 14), 2995c533a883Shx147065 2996c533a883Shx147065 /* calculate TSF in outgoing frame */ 2997c533a883Shx147065 TX_CMD_FLG_TSF_MSK = (1 << 16), 2998c533a883Shx147065 2999c533a883Shx147065 /* activate TX calibration. */ 3000c533a883Shx147065 TX_CMD_FLG_CALIB_MSK = (1 << 17), 3001c533a883Shx147065 3002c533a883Shx147065 /* 3003c533a883Shx147065 * signals that 2 bytes pad was inserted 3004c533a883Shx147065 * after the MAC header 3005c533a883Shx147065 */ 3006c533a883Shx147065 TX_CMD_FLG_MH_PAD_MSK = (1 << 20), 3007c533a883Shx147065 3008c533a883Shx147065 /* HCCA-AP - disable duration overwriting. */ 3009c533a883Shx147065 TX_CMD_FLG_DUR_MSK = (1 << 25), 3010c533a883Shx147065 }; 3011c533a883Shx147065 3012c533a883Shx147065 /* 3013c533a883Shx147065 * TX command security control 3014c533a883Shx147065 */ 3015c533a883Shx147065 #define TX_CMD_SEC_CCM 0x2 3016c533a883Shx147065 #define TX_CMD_SEC_TKIP 0x3 3017c533a883Shx147065 3018c533a883Shx147065 /* 3019c533a883Shx147065 * structure for command IWK_CMD_TX_DATA 3020c533a883Shx147065 */ 3021c533a883Shx147065 typedef struct iwk_tx_cmd { 3022c533a883Shx147065 uint16_t len; 3023c533a883Shx147065 uint16_t next_frame_len; 3024c533a883Shx147065 uint32_t tx_flags; 3025c533a883Shx147065 struct iwk_dram_scratch scratch; 3026c533a883Shx147065 struct iwk_rate rate; 3027c533a883Shx147065 uint8_t sta_id; 3028c533a883Shx147065 uint8_t sec_ctl; 3029c533a883Shx147065 uint8_t initial_rate_index; 3030c533a883Shx147065 uint8_t reserved; 3031c533a883Shx147065 uint8_t key[16]; 3032c533a883Shx147065 uint16_t next_frame_flags; 3033c533a883Shx147065 uint16_t reserved2; 3034c533a883Shx147065 union { 3035c533a883Shx147065 uint32_t life_time; 3036c533a883Shx147065 uint32_t attempt; 3037c533a883Shx147065 } stop_time; 3038c533a883Shx147065 uint32_t dram_lsb_ptr; 3039c533a883Shx147065 uint8_t dram_msb_ptr; 3040c533a883Shx147065 uint8_t rts_retry_limit; 3041c533a883Shx147065 uint8_t data_retry_limit; 3042c533a883Shx147065 uint8_t tid_tspec; 3043c533a883Shx147065 union { 3044c533a883Shx147065 uint16_t pm_frame_timeout; 3045c533a883Shx147065 uint16_t attempt_duration; 3046c533a883Shx147065 } timeout; 3047c533a883Shx147065 uint16_t driver_txop; 3048c533a883Shx147065 } iwk_tx_cmd_t; 3049c533a883Shx147065 3050c533a883Shx147065 /* 3051cdc64593Sxinghua wen - Sun Microsystems - Beijing China * structure for command "TX beacon" 3052cdc64593Sxinghua wen - Sun Microsystems - Beijing China */ 3053cdc64593Sxinghua wen - Sun Microsystems - Beijing China typedef struct iwk_tx_beacon_cmd { 3054cdc64593Sxinghua wen - Sun Microsystems - Beijing China iwk_tx_cmd_t config; 3055cdc64593Sxinghua wen - Sun Microsystems - Beijing China uint16_t tim_idx; 3056cdc64593Sxinghua wen - Sun Microsystems - Beijing China uint8_t tim_size; 3057cdc64593Sxinghua wen - Sun Microsystems - Beijing China uint8_t reserved; 3058cdc64593Sxinghua wen - Sun Microsystems - Beijing China uint8_t bcon_frame[2342]; 3059cdc64593Sxinghua wen - Sun Microsystems - Beijing China } iwk_tx_beacon_cmd_t; 3060cdc64593Sxinghua wen - Sun Microsystems - Beijing China 3061cdc64593Sxinghua wen - Sun Microsystems - Beijing China /* 3062c533a883Shx147065 * LEDs Command & Response 3063c533a883Shx147065 * REPLY_LEDS_CMD = 0x48 (command, has simple generic response) 3064c533a883Shx147065 * 3065c533a883Shx147065 * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), 3066c533a883Shx147065 * this command turns it on or off, or sets up a periodic blinking cycle. 3067c533a883Shx147065 */ 3068c533a883Shx147065 typedef struct iwk_led_cmd { 3069c533a883Shx147065 uint32_t interval; /* "interval" in uSec */ 3070c533a883Shx147065 uint8_t id; /* 1: Activity, 2: Link, 3: Tech */ 3071c533a883Shx147065 /* 3072c533a883Shx147065 * # intervals off while blinking; 3073c533a883Shx147065 * "0", with > 0 "on" value, turns LED on 3074c533a883Shx147065 */ 3075c533a883Shx147065 uint8_t off; 3076c533a883Shx147065 /* 3077c533a883Shx147065 * # intervals on while blinking; 3078c533a883Shx147065 * "0", regardless of "off", turns LED off 3079c533a883Shx147065 */ 3080c533a883Shx147065 uint8_t on; 3081c533a883Shx147065 uint8_t reserved; 3082c533a883Shx147065 } iwk_led_cmd_t; 3083c533a883Shx147065 3084c533a883Shx147065 /* 3085c533a883Shx147065 * structure for IWK_CMD_SET_POWER_MODE 3086c533a883Shx147065 */ 3087c533a883Shx147065 typedef struct iwk_powertable_cmd { 3088c533a883Shx147065 uint16_t flags; 3089c533a883Shx147065 uint8_t keep_alive_seconds; 3090c533a883Shx147065 uint8_t debug_flags; 3091c533a883Shx147065 uint32_t rx_timeout; 3092c533a883Shx147065 uint32_t tx_timeout; 3093c533a883Shx147065 uint32_t sleep[5]; 3094c533a883Shx147065 uint32_t keep_alive_beacons; 3095c533a883Shx147065 } iwk_powertable_cmd_t; 3096c533a883Shx147065 3097c533a883Shx147065 struct iwk_ssid_ie { 3098c533a883Shx147065 uint8_t id; 3099c533a883Shx147065 uint8_t len; 3100c533a883Shx147065 uint8_t ssid[32]; 3101c533a883Shx147065 }; 3102c533a883Shx147065 /* 3103c533a883Shx147065 * structure for command IWK_CMD_SCAN 3104c533a883Shx147065 */ 3105c533a883Shx147065 typedef struct iwk_scan_hdr { 3106c533a883Shx147065 uint16_t len; 3107c533a883Shx147065 uint8_t reserved1; 3108c533a883Shx147065 uint8_t nchan; 3109c533a883Shx147065 /* 3110c533a883Shx147065 * dwell only this long on quiet chnl 3111c533a883Shx147065 * (active scan) 3112c533a883Shx147065 */ 3113c533a883Shx147065 uint16_t quiet_time; 3114c533a883Shx147065 uint16_t quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */ 3115c533a883Shx147065 uint16_t good_crc_th; /* passive -> active promotion threshold */ 3116c533a883Shx147065 uint16_t rx_chain; 3117c533a883Shx147065 /* 3118c533a883Shx147065 * max usec to be out of associated (service) 3119c533a883Shx147065 * chnl 3120c533a883Shx147065 */ 3121c533a883Shx147065 uint32_t max_out_time; 3122c533a883Shx147065 /* 3123c533a883Shx147065 * pause scan this long when returning to svc 3124c533a883Shx147065 * chnl. 3125c533a883Shx147065 * 3945 -- 31:24 # beacons, 19:0 additional usec, 3126c533a883Shx147065 * 4965 -- 31:22 # beacons, 21:0 additional usec. 3127c533a883Shx147065 */ 3128c533a883Shx147065 uint32_t suspend_time; 3129c533a883Shx147065 uint32_t flags; 3130c533a883Shx147065 uint32_t filter_flags; 3131c533a883Shx147065 struct iwk_tx_cmd tx_cmd; 3132c533a883Shx147065 struct iwk_ssid_ie direct_scan[4]; 3133c533a883Shx147065 /* followed by probe request body */ 3134c533a883Shx147065 /* followed by nchan x iwk_scan_chan */ 3135c533a883Shx147065 } iwk_scan_hdr_t; 3136c533a883Shx147065 3137c533a883Shx147065 typedef struct iwk_scan_chan { 3138c533a883Shx147065 uint8_t type; 3139c533a883Shx147065 uint8_t chan; 3140c533a883Shx147065 struct iwk_tx_power tpc; 3141c533a883Shx147065 uint16_t active_dwell; /* dwell time */ 3142c533a883Shx147065 uint16_t passive_dwell; /* dwell time */ 3143c533a883Shx147065 } iwk_scan_chan_t; 3144c533a883Shx147065 3145c533a883Shx147065 /* 3146c533a883Shx147065 * structure for IWK_CMD_BLUETOOTH 3147c533a883Shx147065 */ 3148c533a883Shx147065 typedef struct iwk_bt_cmd { 3149c533a883Shx147065 uint8_t flags; 3150c533a883Shx147065 uint8_t lead_time; 3151c533a883Shx147065 uint8_t max_kill; 3152c533a883Shx147065 uint8_t reserved; 3153c533a883Shx147065 uint32_t kill_ack_mask; 3154c533a883Shx147065 uint32_t kill_cts_mask; 3155c533a883Shx147065 } iwk_bt_cmd_t; 3156c533a883Shx147065 3157c533a883Shx147065 /* 3158c533a883Shx147065 * firmware image header 3159c533a883Shx147065 */ 3160c533a883Shx147065 typedef struct iwk_firmware_hdr { 3161c533a883Shx147065 uint32_t version; 3162c533a883Shx147065 uint32_t textsz; 3163c533a883Shx147065 uint32_t datasz; 3164c533a883Shx147065 uint32_t init_textsz; 3165c533a883Shx147065 uint32_t init_datasz; 3166c533a883Shx147065 uint32_t bootsz; 3167c533a883Shx147065 } iwk_firmware_hdr_t; 3168c533a883Shx147065 3169c533a883Shx147065 /* 3170c533a883Shx147065 * structure for IWK_START_SCAN notification 3171c533a883Shx147065 */ 3172c533a883Shx147065 typedef struct iwk_start_scan { 3173c533a883Shx147065 uint32_t timestampl; 3174c533a883Shx147065 uint32_t timestamph; 3175c533a883Shx147065 uint32_t tbeacon; 3176c533a883Shx147065 uint8_t chan; 3177c533a883Shx147065 uint8_t band; 3178c533a883Shx147065 uint16_t reserved; 3179c533a883Shx147065 uint32_t status; 3180c533a883Shx147065 } iwk_start_scan_t; 3181c533a883Shx147065 3182*c50ced99Spengcheng chen - Sun Microsystems - Beijing China /* 3183*c50ced99Spengcheng chen - Sun Microsystems - Beijing China * structure for IWK_SCAN_COMPLETE notification 3184*c50ced99Spengcheng chen - Sun Microsystems - Beijing China */ 3185*c50ced99Spengcheng chen - Sun Microsystems - Beijing China typedef struct iwk_stop_scan { 3186*c50ced99Spengcheng chen - Sun Microsystems - Beijing China uint8_t nchan; 3187*c50ced99Spengcheng chen - Sun Microsystems - Beijing China uint8_t status; 3188*c50ced99Spengcheng chen - Sun Microsystems - Beijing China uint8_t reserved; 3189*c50ced99Spengcheng chen - Sun Microsystems - Beijing China uint8_t chan; 3190*c50ced99Spengcheng chen - Sun Microsystems - Beijing China uint64_t tsf; 3191*c50ced99Spengcheng chen - Sun Microsystems - Beijing China } iwk_stop_scan_t; 3192c533a883Shx147065 3193c533a883Shx147065 #define IWK_READ(sc, reg) \ 3194c533a883Shx147065 ddi_get32((sc)->sc_handle, (uint32_t *)((sc)->sc_base + (reg))) 3195c533a883Shx147065 3196c533a883Shx147065 #define IWK_WRITE(sc, reg, val) \ 3197c533a883Shx147065 ddi_put32((sc)->sc_handle, (uint32_t *)((sc)->sc_base + (reg)), (val)) 3198c533a883Shx147065 3199c533a883Shx147065 #ifdef __cplusplus 3200c533a883Shx147065 } 3201c533a883Shx147065 #endif 3202c533a883Shx147065 3203c533a883Shx147065 #endif /* _IWK_HW_H_ */ 3204