16169Shx147065 /* 26169Shx147065 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 36169Shx147065 * Use is subject to license terms. 46169Shx147065 */ 56169Shx147065 66169Shx147065 /* 76169Shx147065 * Copyright (c) 2007, Intel Corporation 86169Shx147065 * All rights reserved. 96169Shx147065 */ 106169Shx147065 116169Shx147065 /* 126169Shx147065 * Sun elects to use this software under the BSD license. 136169Shx147065 */ 146169Shx147065 156169Shx147065 /* 166169Shx147065 * This file is provided under a dual BSD/GPLv2 license. When using or 176169Shx147065 * redistributing this file, you may do so under either license. 186169Shx147065 * 196169Shx147065 * GPL LICENSE SUMMARY 206169Shx147065 * 216169Shx147065 * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. 226169Shx147065 * 236169Shx147065 * This program is free software; you can redistribute it and/or modify 246169Shx147065 * it under the terms of version 2 of the GNU Geeral Public License as 256169Shx147065 * published by the Free Software Foundation. 266169Shx147065 * 276169Shx147065 * This program is distributed in the hope that it will be useful, but 286169Shx147065 * WITHOUT ANY WARRANTY; without even the implied warranty of 296169Shx147065 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 306169Shx147065 * General Public License for more details. 316169Shx147065 * 326169Shx147065 * You should have received a copy of the GNU General Public License 336169Shx147065 * along with this program; if not, write to the Free Software 346169Shx147065 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, 356169Shx147065 * USA 366169Shx147065 * 376169Shx147065 * The full GNU General Public License is included in this distribution 386169Shx147065 * in the file called LICENSE.GPL. 396169Shx147065 * 406169Shx147065 * Contact Information: 416169Shx147065 * James P. Ketrenos <ipw2100-admin@linux.intel.com> 426169Shx147065 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 436169Shx147065 * 446169Shx147065 * BSD LICENSE 456169Shx147065 * 466169Shx147065 * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved. 476169Shx147065 * All rights reserved. 486169Shx147065 * 496169Shx147065 * Redistribution and use in source and binary forms, with or without 506169Shx147065 * modification, are permitted provided that the following conditions 516169Shx147065 * are met: 526169Shx147065 * 536169Shx147065 * * Redistributions of source code must retain the above copyright 546169Shx147065 * notice, this list of conditions and the following disclaimer. 556169Shx147065 * * Redistributions in binary form must reproduce the above copyright 566169Shx147065 * notice, this list of conditions and the following disclaimer in 576169Shx147065 * the documentation and/or other materials provided with the 586169Shx147065 * distribution. 596169Shx147065 * * Neither the name Intel Corporation nor the names of its 606169Shx147065 * contributors may be used to endorse or promote products derived 616169Shx147065 * from this software without specific prior written permission. 626169Shx147065 * 636169Shx147065 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 646169Shx147065 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 656169Shx147065 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 666169Shx147065 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 676169Shx147065 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 686169Shx147065 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 696169Shx147065 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 706169Shx147065 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 716169Shx147065 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 726169Shx147065 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 736169Shx147065 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 746169Shx147065 */ 756169Shx147065 766169Shx147065 #ifndef _IWK_HW_H_ 776169Shx147065 #define _IWK_HW_H_ 786169Shx147065 796169Shx147065 #ifdef __cplusplus 806169Shx147065 extern "C" { 816169Shx147065 #endif 826169Shx147065 836169Shx147065 /* 846169Shx147065 * maximum scatter/gather 856169Shx147065 */ 866169Shx147065 #define IWK_MAX_SCATTER (10) 876169Shx147065 886169Shx147065 /* 896169Shx147065 * Flow Handler Definitions 906169Shx147065 */ 916169Shx147065 #define FH_MEM_LOWER_BOUND (0x1000) 926169Shx147065 #define FH_MEM_UPPER_BOUND (0x1EF0) 936169Shx147065 946169Shx147065 #define IWK_FH_REGS_LOWER_BOUND (0x1000) 956169Shx147065 #define IWK_FH_REGS_UPPER_BOUND (0x2000) 966169Shx147065 976169Shx147065 /* 986169Shx147065 * TFDB Area - TFDs buffer table 996169Shx147065 */ 1006169Shx147065 #define FH_MEM_TFDB_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x000) 1016169Shx147065 #define FH_MEM_TFDB_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0x900) 1026169Shx147065 1036169Shx147065 /* 1046169Shx147065 * channels 0 - 8 1056169Shx147065 */ 1066169Shx147065 #define FH_MEM_TFDB_CHNL_BUF0(x) (FH_MEM_TFDB_LOWER_BOUND + (x) * 0x100) 1076169Shx147065 #define FH_MEM_TFDB_CHNL_BUF1(x) (FH_MEM_TFDB_LOWER_BOUND + 0x80 + (x) * 0x100) 1086169Shx147065 1096169Shx147065 /* 1106169Shx147065 * TFDIB Area - TFD Immediate Buffer 1116169Shx147065 */ 1126169Shx147065 #define FH_MEM_TFDIB_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x900) 1136169Shx147065 #define FH_MEM_TFDIB_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0x958) 1146169Shx147065 1156169Shx147065 /* 1166169Shx147065 * channels 0 - 10 1176169Shx147065 */ 1186169Shx147065 #define FH_MEM_TFDIB_CHNL(x) (FH_MEM_TFDIB_LOWER_BOUND + (x) * 0x8) 1196169Shx147065 1206169Shx147065 /* 1216169Shx147065 * TFDIB registers used in Service Mode 1226169Shx147065 */ 1236169Shx147065 #define FH_MEM_TFDIB_CHNL9_REG0 (FH_MEM_TFDIB_CHNL(9)) 1246169Shx147065 #define FH_MEM_TFDIB_CHNL9_REG1 (FH_MEM_TFDIB_CHNL(9) + 4) 1256169Shx147065 #define FH_MEM_TFDIB_CHNL10_REG0 (FH_MEM_TFDIB_CHNL(10)) 1266169Shx147065 #define FH_MEM_TFDIB_CHNL10_REG1 (FH_MEM_TFDIB_CHNL(10) + 4) 1276169Shx147065 1286169Shx147065 /* 1296169Shx147065 * Tx service channels 1306169Shx147065 */ 1316169Shx147065 #define FH_MEM_TFDIB_DRAM_ADDR_LSB_MASK (0xFFFFFFFF) 1326169Shx147065 #define FH_MEM_TFDIB_DRAM_ADDR_MSB_MASK (0xF00000000) 1336169Shx147065 #define FH_MEM_TFDIB_TB_LENGTH_MASK (0x0001FFFF) /* bits 16:0 */ 1346169Shx147065 1356169Shx147065 #define FH_MEM_TFDIB_DRAM_ADDR_LSB_BITSHIFT (0) 1366169Shx147065 #define FH_MEM_TFDIB_DRAM_ADDR_MSB_BITSHIFT (32) 1376169Shx147065 #define FH_MEM_TFDIB_TB_LENGTH_BITSHIFT (0) 1386169Shx147065 1396169Shx147065 #define FH_MEM_TFDIB_REG0_ADDR_MASK (0xFFFFFFFF) 1406169Shx147065 #define FH_MEM_TFDIB_REG1_ADDR_MASK (0xF0000000) 1416169Shx147065 #define FH_MEM_TFDIB_REG1_LENGTH_MASK (0x0001FFFF) 1426169Shx147065 1436169Shx147065 #define FH_MEM_TFDIB_REG0_ADDR_BITSHIFT (0) 1446169Shx147065 #define FH_MEM_TFDIB_REG1_ADDR_BITSHIFT (28) 1456169Shx147065 #define FH_MEM_TFDIB_REG1_LENGTH_BITSHIFT (0) 1466169Shx147065 1476169Shx147065 /* 1486169Shx147065 * TRB Area - Transmit Request Buffers 1496169Shx147065 */ 1506169Shx147065 #define FH_MEM_TRB_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x0958) 1516169Shx147065 #define FH_MEM_TRB_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0x0980) 1526169Shx147065 1536169Shx147065 /* 1546169Shx147065 * channels 0 - 8 1556169Shx147065 */ 1566169Shx147065 #define FH_MEM_TRB_CHNL(x) (FH_MEM_TRB_LOWER_BOUND + (x) * 0x4) 1576169Shx147065 1586169Shx147065 /* 1596169Shx147065 * Keep-Warm (KW) buffer base address. 1606169Shx147065 * 1616169Shx147065 * Driver must allocate a 4KByte buffer that is used by 4965 for keeping the 1626169Shx147065 * host DRAM powered on (via dummy accesses to DRAM) to maintain low-latency 1636169Shx147065 * DRAM access when 4965 is Txing or Rxing. The dummy accesses prevent host 1646169Shx147065 * from going into a power-savings mode that would cause higher DRAM latency, 1656169Shx147065 * and possible data over/under-runs, before all Tx/Rx is complete. 1666169Shx147065 * 1676169Shx147065 * Driver loads IWK_FH_KW_MEM_ADDR_REG with the physical address (bits 35:4) 1686169Shx147065 * of the buffer, which must be 4K aligned. Once this is set up, the 4965 1696169Shx147065 * automatically invokes keep-warm accesses when normal accesses might not 1706169Shx147065 * be sufficient to maintain fast DRAM response. 1716169Shx147065 * 1726169Shx147065 * Bit fields: 1736169Shx147065 * 31-0: Keep-warm buffer physical base address [35:4], must be 4K aligned 1746169Shx147065 */ 1756169Shx147065 #define IWK_FH_KW_MEM_ADDR_REG (FH_MEM_LOWER_BOUND + 0x97C) 1766169Shx147065 1776169Shx147065 /* 1786169Shx147065 * STAGB Area - Scheduler TAG Buffer 1796169Shx147065 */ 1806169Shx147065 #define FH_MEM_STAGB_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x980) 1816169Shx147065 #define FH_MEM_STAGB_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) 1826169Shx147065 1836169Shx147065 /* 1846169Shx147065 * channels 0 - 8 1856169Shx147065 */ 1866169Shx147065 #define FH_MEM_STAGB_0(x) (FH_MEM_STAGB_LOWER_BOUND + (x) * 0x8) 1876169Shx147065 #define FH_MEM_STAGB_1(x) (FH_MEM_STAGB_LOWER_BOUND + 0x4 + (x) * 0x8) 1886169Shx147065 1896169Shx147065 /* 1906169Shx147065 * Tx service channels 1916169Shx147065 */ 1926169Shx147065 #define FH_MEM_SRAM_ADDR_9 (FH_MEM_STAGB_LOWER_BOUND + 0x048) 1936169Shx147065 #define FH_MEM_SRAM_ADDR_10 (FH_MEM_STAGB_LOWER_BOUND + 0x04C) 1946169Shx147065 1956169Shx147065 #define FH_MEM_STAGB_SRAM_ADDR_MASK (0x00FFFFFF) 1966169Shx147065 1976169Shx147065 /* 1986169Shx147065 * TFD Circular Buffers Base (CBBC) addresses 1996169Shx147065 * 2006169Shx147065 * 4965 has 16 base pointer registers, one for each of 16 host-DRAM-resident 2016169Shx147065 * circular buffers (CBs/queues) containing Transmit Frame Descriptors (TFDs) 2026169Shx147065 * (see struct iwk_tfd_frame). These 16 pointer registers are offset by 0x04 2036169Shx147065 * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte 2046169Shx147065 * aligned (address bits 0-7 must be 0). 2056169Shx147065 * 2066169Shx147065 * Bit fields in each pointer register: 2076169Shx147065 * 27-0: TFD CB physical base address [35:8], must be 256-byte aligned 2086169Shx147065 */ 2096169Shx147065 #define FH_MEM_CBBC_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) 2106169Shx147065 #define FH_MEM_CBBC_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10) 2116169Shx147065 2126169Shx147065 /* 2136169Shx147065 * queues 0 - 15 2146169Shx147065 */ 2156169Shx147065 #define FH_MEM_CBBC_QUEUE(x) (FH_MEM_CBBC_LOWER_BOUND + (x) * 0x4) 2166169Shx147065 2176169Shx147065 /* 2186169Shx147065 * TAGR Area - TAG reconstruct table 2196169Shx147065 */ 2206169Shx147065 #define FH_MEM_TAGR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xA10) 2216169Shx147065 #define FH_MEM_TAGR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA70) 2226169Shx147065 2236169Shx147065 /* 2246169Shx147065 * TDBGR Area - Tx Debug Registers 2256169Shx147065 */ 2266169Shx147065 #define FH_MEM_TDBGR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x0A70) 2276169Shx147065 #define FH_MEM_TDBGR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0x0B20) 2286169Shx147065 2296169Shx147065 /* 2306169Shx147065 * channels 0 - 10 2316169Shx147065 */ 2326169Shx147065 #define FH_MEM_TDBGR_CHNL(x) (FH_MEM_TDBGR_LOWER_BOUND + (x) * 0x10) 2336169Shx147065 2346169Shx147065 #define FH_MEM_TDBGR_CHNL_REG_0(x) (FH_MEM_TDBGR_CHNL(x)) 2356169Shx147065 #define FH_MEM_TDBGR_CHNL_REG_1(x) (FH_MEM_TDBGR_CHNL_REG_0(x) + 0x4) 2366169Shx147065 2376169Shx147065 #define FH_MEM_TDBGR_CHNL_BYTES_TO_FIFO_MASK (0x000FFFFF) 2386169Shx147065 #define FH_MEM_TDBGR_CHNL_BYTES_TO_FIFO_BITSHIFT (0) 2396169Shx147065 2406169Shx147065 /* 2416169Shx147065 * RDBUF Area 2426169Shx147065 */ 2436169Shx147065 #define FH_MEM_RDBUF_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xB80) 2446169Shx147065 #define FH_MEM_RDBUF_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xBC0) 2456169Shx147065 #define FH_MEM_RDBUF_CHNL0 (FH_MEM_RDBUF_LOWER_BOUND) 2466169Shx147065 2476169Shx147065 /* 2486169Shx147065 * Rx SRAM Control and Status Registers (RSCSR) 2496169Shx147065 * 2506169Shx147065 * These registers provide handshake between driver and 4965 for the Rx queue 2516169Shx147065 * (this queue handles *all* command responses, notifications, Rx data, etc. 2526169Shx147065 * sent from 4965 uCode to host driver). Unlike Tx, there is only one Rx 2536169Shx147065 * queue, and only one Rx DMA/FIFO channel. Also unlike Tx, which can 2546169Shx147065 * concatenate up to 20 DRAM buffers to form a Tx frame, each Receive Buffer 2556169Shx147065 * Descriptor (RBD) points to only one Rx Buffer (RB); there is a 1:1 2566169Shx147065 * mapping between RBDs and RBs. 2576169Shx147065 * 2586169Shx147065 * Driver must allocate host DRAM memory for the following, and set the 2596169Shx147065 * physical address of each into 4965 registers: 2606169Shx147065 * 2616169Shx147065 * 1) Receive Buffer Descriptor (RBD) circular buffer (CB), typically with 256 2626169Shx147065 * entries (although any power of 2, up to 4096, is selectable by driver). 2636169Shx147065 * Each entry (1 dword) points to a receive buffer (RB) of consistent size 2646169Shx147065 * (typically 4K, although 8K or 16K are also selectable by driver). 2656169Shx147065 * Driver sets up RB size and number of RBDs in the CB via Rx config 2666169Shx147065 * register FH_MEM_RCSR_CHNL0_CONFIG_REG. 2676169Shx147065 * 2686169Shx147065 * Bit fields within one RBD: 2696169Shx147065 * 27-0: Receive Buffer physical address bits [35:8], 256-byte aligned. 2706169Shx147065 * 2716169Shx147065 * Driver sets physical address [35:8] of base of RBD circular buffer 2726169Shx147065 * into FH_RSCSR_CHNL0_RBDCB_BASE_REG [27:0]. 2736169Shx147065 * 2746169Shx147065 * 2) Rx status buffer, 8 bytes, in which 4965 indicates which Rx Buffers 2756169Shx147065 * (RBs) have been filled, via a "write pointer", actually the index of 2766169Shx147065 * the RB's corresponding RBD within the circular buffer. Driver sets 2776169Shx147065 * physical address [35:4] into FH_RSCSR_CHNL0_STTS_WPTR_REG [31:0]. 2786169Shx147065 * 2796169Shx147065 * Bit fields in lower dword of Rx status buffer (upper dword not used 2806169Shx147065 * by driver; see struct iwk_shared, val0): 2816169Shx147065 * 31-12: Not used by driver 2826169Shx147065 * 11- 0: Index of last filled Rx buffer descriptor 2836169Shx147065 * (4965 writes, driver reads this value) 2846169Shx147065 * 2856169Shx147065 * As the driver prepares Receive Buffers (RBs) for 4965 to fill, driver must 2866169Shx147065 * enter pointers to these RBs into contiguous RBD circular buffer entries, 2876169Shx147065 * and update the 4965's "write" index register, FH_RSCSR_CHNL0_RBDCB_WPTR_REG. 2886169Shx147065 * 2896169Shx147065 * This "write" index corresponds to the *next* RBD that the driver will make 2906169Shx147065 * available, i.e. one RBD past the the tail of the ready-to-fill RBDs within 2916169Shx147065 * the circular buffer. This value should initially be 0 (before preparing any 2926169Shx147065 * RBs), should be 8 after preparing the first 8 RBs (for example), and must 2936169Shx147065 * wrap back to 0 at the end of the circular buffer (but don't wrap before 2946169Shx147065 * "read" index has advanced past 1! See below). 2956169Shx147065 * NOTE: 4965 EXPECTS THE WRITE INDEX TO BE INCREMENTED IN MULTIPLES OF 8. 2966169Shx147065 * 2976169Shx147065 * As the 4965 fills RBs (referenced from contiguous RBDs within the circular 2986169Shx147065 * buffer), it updates the Rx status buffer in DRAM, 2) described above, 2996169Shx147065 * to tell the driver the index of the latest filled RBD. The driver must 3006169Shx147065 * read this "read" index from DRAM after receiving an Rx interrupt from 4965. 3016169Shx147065 * 3026169Shx147065 * The driver must also internally keep track of a third index, which is the 3036169Shx147065 * next RBD to process. When receiving an Rx interrupt, driver should process 3046169Shx147065 * all filled but unprocessed RBs up to, but not including, the RB 3056169Shx147065 * corresponding to the "read" index. For example, if "read" index becomes "1", 3066169Shx147065 * driver may process the RB pointed to by RBD 0. Depending on volume of 3076169Shx147065 * traffic, there may be many RBs to process. 3086169Shx147065 * 3096169Shx147065 * If read index == write index, 4965 thinks there is no room to put new data. 3106169Shx147065 * Due to this, the maximum number of filled RBs is 255, instead of 256. To 3116169Shx147065 * be safe, make sure that there is a gap of at least 2 RBDs between "write" 3126169Shx147065 * and "read" indexes; that is, make sure that there are no more than 254 3136169Shx147065 * buffers waiting to be filled. 3146169Shx147065 */ 3156169Shx147065 #define FH_MEM_RSCSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xBC0) 3166169Shx147065 #define FH_MEM_RSCSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xC00) 3176169Shx147065 #define FH_MEM_RSCSR_CHNL0 (FH_MEM_RSCSR_LOWER_BOUND) 3186169Shx147065 #define FH_MEM_RSCSR_CHNL1 (FH_MEM_RSCSR_LOWER_BOUND + 0x020) 3196169Shx147065 3206169Shx147065 /* 3216169Shx147065 * Physical base address of 8-byte Rx Status buffer. 3226169Shx147065 * Bit fields: 3236169Shx147065 * 31-0: Rx status buffer physical base address [35:4], must 16-byte aligned. 3246169Shx147065 */ 3256169Shx147065 3266169Shx147065 #define FH_RSCSR_CHNL0_STTS_WPTR_REG (FH_MEM_RSCSR_CHNL0) 3276169Shx147065 3286169Shx147065 /* 3296169Shx147065 * Physical base address of Rx Buffer Descriptor Circular Buffer. 3306169Shx147065 * Bit fields: 3316169Shx147065 * 27-0: RBD CD physical base address [35:8], must be 256-byte aligned. 3326169Shx147065 */ 3336169Shx147065 #define FH_RSCSR_CHNL0_RBDCB_BASE_REG (FH_MEM_RSCSR_CHNL0 + 0x004) 3346169Shx147065 3356169Shx147065 /* 3366169Shx147065 * Rx write pointer (index, really!). 3376169Shx147065 * Bit fields: 3386169Shx147065 * 11-0: Index of driver's most recent prepared-to-be-filled RBD, + 1. 3396169Shx147065 * NOTE: For 256-entry circular buffer, use only bits [7:0]. 3406169Shx147065 */ 3416169Shx147065 #define FH_RSCSR_CHNL0_RBDCB_WPTR_REG (FH_MEM_RSCSR_CHNL0 + 0x008) 3426169Shx147065 #define FH_RSCSR_CHNL0_RBDCB_RPTR_REG (FH_MEM_RSCSR_CHNL0 + 0x00c) 3436169Shx147065 3446169Shx147065 #define FH_RSCSR_FRAME_SIZE_MASK (0x00000FFF) /* bits 0-11 */ 3456169Shx147065 3466169Shx147065 /* 3476169Shx147065 * RSCSR registers used in Service mode 3486169Shx147065 */ 3496169Shx147065 #define FH_RSCSR_CHNL1_RB_WPTR_REG (FH_MEM_RSCSR_CHNL1) 3506169Shx147065 #define FH_RSCSR_CHNL1_RB_WPTR_OFFSET_REG (FH_MEM_RSCSR_CHNL1 + 0x004) 3516169Shx147065 #define FH_RSCSR_CHNL1_RB_CHUNK_NUM_REG (FH_MEM_RSCSR_CHNL1 + 0x008) 3526169Shx147065 #define FH_RSCSR_CHNL1_SRAM_ADDR_REG (FH_MEM_RSCSR_CHNL1 + 0x00C) 3536169Shx147065 3546169Shx147065 /* 3556169Shx147065 * Rx Config/Status Registers (RCSR) 3566169Shx147065 * Rx Config Reg for channel 0 (only channel used) 3576169Shx147065 * 3586169Shx147065 * Driver must initialize FH_MEM_RCSR_CHNL0_CONFIG_REG as follows for 3596169Shx147065 * normal operation (see bit fields). 3606169Shx147065 * 3616169Shx147065 * Clearing FH_MEM_RCSR_CHNL0_CONFIG_REG to 0 turns off Rx DMA. 3626169Shx147065 * Driver should poll FH_MEM_RSSR_RX_STATUS_REG for 3636169Shx147065 * FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (bit 24) before continuing. 3646169Shx147065 * 3656169Shx147065 * Bit fields: 3666169Shx147065 * 31-30: Rx DMA channel enable: '00' off/pause, '01' pause at end of frame, 3676169Shx147065 * '10' operate normally 3686169Shx147065 * 29-24: reserved 3696169Shx147065 * 23-20: # RBDs in circular buffer = 2^value; use "8" for 256 RBDs (normal), 3706169Shx147065 * min "5" for 32 RBDs, max "12" for 4096 RBDs. 3716169Shx147065 * 19-18: reserved 3726169Shx147065 * 17-16: size of each receive buffer; '00' 4K (normal), '01' 8K, 3736169Shx147065 * '10' 12K, '11' 16K. 3746169Shx147065 * 15-14: reserved 3756169Shx147065 * 13-12: IRQ destination; '00' none, '01' host driver (normal operation) 3766169Shx147065 * 11- 4: timeout for closing Rx buffer and interrupting host (units 32 usec) 3776169Shx147065 * typical value 0x10 (about 1/2 msec) 3786169Shx147065 * 3- 0: reserved 3796169Shx147065 */ 3806169Shx147065 #define FH_MEM_RCSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xC00) 3816169Shx147065 #define FH_MEM_RCSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xCC0) 3826169Shx147065 #define FH_MEM_RCSR_CHNL0 (FH_MEM_RCSR_LOWER_BOUND) 3836169Shx147065 #define FH_MEM_RCSR_CHNL1 (FH_MEM_RCSR_LOWER_BOUND + 0x020) 3846169Shx147065 3856169Shx147065 #define FH_MEM_RCSR_CHNL0_CONFIG_REG (FH_MEM_RCSR_CHNL0) 3866169Shx147065 #define FH_MEM_RCSR_CHNL0_CREDIT_REG (FH_MEM_RCSR_CHNL0 + 0x004) 3876169Shx147065 #define FH_MEM_RCSR_CHNL0_RBD_STTS_REG (FH_MEM_RCSR_CHNL0 + 0x008) 3886169Shx147065 #define FH_MEM_RCSR_CHNL0_RB_STTS_REG (FH_MEM_RCSR_CHNL0 + 0x00C) 3896169Shx147065 #define FH_MEM_RCSR_CHNL0_RXPD_STTS_REG (FH_MEM_RCSR_CHNL0 + 0x010) 3906169Shx147065 3916169Shx147065 #define FH_MEM_RCSR_CHNL0_RBD_STTS_FRAME_RB_CNT_MASK (0x7FFFFFF0) 3926169Shx147065 3936169Shx147065 /* 3946169Shx147065 * RCSR registers used in Service mode 3956169Shx147065 */ 3966169Shx147065 #define FH_MEM_RCSR_CHNL1_CONFIG_REG (FH_MEM_RCSR_CHNL1) 3976169Shx147065 #define FH_MEM_RCSR_CHNL1_RB_STTS_REG (FH_MEM_RCSR_CHNL1 + 0x00C) 3986169Shx147065 #define FH_MEM_RCSR_CHNL1_RX_PD_STTS_REG (FH_MEM_RCSR_CHNL1 + 0x010) 3996169Shx147065 4006169Shx147065 /* 4016169Shx147065 * Rx Shared Status Registers (RSSR) 4026169Shx147065 * 4036169Shx147065 * After stopping Rx DMA channel (writing 0 to FH_MEM_RCSR_CHNL0_CONFIG_REG), 4046169Shx147065 * driver must poll FH_MEM_RSSR_RX_STATUS_REG until Rx channel is idle. 4056169Shx147065 * 4066169Shx147065 * Bit fields: 4076169Shx147065 * 24: 1 = Channel 0 is idle 4086169Shx147065 * 4096169Shx147065 * FH_MEM_RSSR_SHARED_CTRL_REG and FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV contain 4106169Shx147065 * default values that should not be altered by the driver. 4116169Shx147065 */ 4126169Shx147065 #define FH_MEM_RSSR_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xC40) 4136169Shx147065 #define FH_MEM_RSSR_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xD00) 4146169Shx147065 #define FH_MEM_RSSR_SHARED_CTRL_REG (FH_MEM_RSSR_LOWER_BOUND) 4156169Shx147065 #define FH_MEM_RSSR_RX_STATUS_REG (FH_MEM_RSSR_LOWER_BOUND + 0x004) 4166169Shx147065 #define FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV (FH_MEM_RSSR_LOWER_BOUND + 0x008) 4176169Shx147065 4186169Shx147065 /* 4196169Shx147065 * Transmit DMA Channel Control/Status Registers (TCSR) 4206169Shx147065 * 4216169Shx147065 * 4965 has one configuration register for each of 8 Tx DMA/FIFO channels 4226169Shx147065 * supported in hardware; config regs are separated by 0x20 bytes. 4236169Shx147065 * 4246169Shx147065 * To use a Tx DMA channel, driver must initialize its 4256169Shx147065 * IWK_FH_TCSR_CHNL_TX_CONFIG_REG(chnl) with: 4266169Shx147065 * 4276169Shx147065 * IWK_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE | 4286169Shx147065 * IWK_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL 4296169Shx147065 * 4306169Shx147065 * All other bits should be 0. 4316169Shx147065 * 4326169Shx147065 * Bit fields: 4336169Shx147065 * 31-30: Tx DMA channel enable: '00' off/pause, '01' pause at end of frame, 4346169Shx147065 * '10' operate normally 4356169Shx147065 * 29- 4: Reserved, set to "0" 4366169Shx147065 * 3: Enable internal DMA requests (1, normal operation), disable (0) 4376169Shx147065 * 2- 0: Reserved, set to "0" 4386169Shx147065 */ 4396169Shx147065 #define IWK_FH_TCSR_LOWER_BOUND (IWK_FH_REGS_LOWER_BOUND + 0xD00) 4406169Shx147065 #define IWK_FH_TCSR_UPPER_BOUND (IWK_FH_REGS_LOWER_BOUND + 0xE60) 4416169Shx147065 4426169Shx147065 #define IWK_FH_TCSR_CHNL_NUM (7) 4436169Shx147065 #define IWK_FH_TCSR_CHNL_TX_CONFIG_REG(_chnl) \ 4446169Shx147065 (IWK_FH_TCSR_LOWER_BOUND + 0x20 * _chnl) 4456169Shx147065 #define IWK_FH_TCSR_CHNL_TX_CREDIT_REG(_chnl) \ 4466169Shx147065 (IWK_FH_TCSR_LOWER_BOUND + 0x20 * _chnl + 0x4) 4476169Shx147065 #define IWK_FH_TCSR_CHNL_TX_BUF_STS_REG(_chnl) \ 4486169Shx147065 (IWK_FH_TCSR_LOWER_BOUND + 0x20 * _chnl + 0x8) 4496169Shx147065 4506169Shx147065 /* 4516169Shx147065 * Tx Shared Status Registers (TSSR) 4526169Shx147065 * 4536169Shx147065 * After stopping Tx DMA channel (writing 0 to 4546169Shx147065 * IWK_FH_TCSR_CHNL_TX_CONFIG_REG(chnl)), driver must poll 4556169Shx147065 * IWK_FH_TSSR_TX_STATUS_REG until selected Tx channel is idle 4566169Shx147065 * (channel's buffers empty | no pending requests). 4576169Shx147065 * 4586169Shx147065 * Bit fields: 4596169Shx147065 * 31-24: 1 = Channel buffers empty (channel 7:0) 4606169Shx147065 * 23-16: 1 = No pending requests (channel 7:0) 4616169Shx147065 */ 4626169Shx147065 #define IWK_FH_TSSR_LOWER_BOUND (IWK_FH_REGS_LOWER_BOUND + 0xEA0) 4636169Shx147065 #define IWK_FH_TSSR_UPPER_BOUND (IWK_FH_REGS_LOWER_BOUND + 0xEC0) 4646169Shx147065 4656169Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG (IWK_FH_TSSR_LOWER_BOUND + 0x008) 4666169Shx147065 #define IWK_FH_TSSR_TX_STATUS_REG (IWK_FH_TSSR_LOWER_BOUND + 0x010) 4676169Shx147065 4686169Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON (0xFF000000) 4696169Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON (0x00FF0000) 4706169Shx147065 4716169Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_64B (0x00000000) 4726169Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B (0x00000400) 4736169Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_256B (0x00000800) 4746169Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_512B (0x00000C00) 4756169Shx147065 4766169Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON (0x00000100) 4776169Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON (0x00000080) 4786169Shx147065 4796169Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH (0x00000020) 4806169Shx147065 #define IWK_FH_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH (0x00000005) 4816169Shx147065 4826169Shx147065 #define IWK_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_chnl) \ 4836169Shx147065 ((1 << (_chnl)) << 24) 4846169Shx147065 #define IWK_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_chnl) \ 4856169Shx147065 ((1 << (_chnl)) << 16) 4866169Shx147065 4876169Shx147065 #define IWK_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_chnl) \ 4886169Shx147065 (IWK_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_chnl) | \ 4896169Shx147065 IWK_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_chnl)) 4906169Shx147065 4916169Shx147065 /* 4926169Shx147065 * SRVC 4936169Shx147065 */ 4946169Shx147065 #define IWK_FH_SRVC_LOWER_BOUND (IWK_FH_REGS_LOWER_BOUND + 0x9C8) 4956169Shx147065 #define IWK_FH_SRVC_UPPER_BOUND (IWK_FH_REGS_LOWER_BOUND + 0x9D0) 4966169Shx147065 4976169Shx147065 #define IWK_FH_SRVC_CHNL_SRAM_ADDR_REG(_chnl) \ 4986169Shx147065 (IWK_FH_SRVC_LOWER_BOUND + (_chnl - 9) * 0x4) 4996169Shx147065 5006169Shx147065 /* 5016169Shx147065 * TFDIB 5026169Shx147065 */ 5036169Shx147065 #define IWK_FH_TFDIB_LOWER_BOUND (IWK_FH_REGS_LOWER_BOUND + 0x900) 5046169Shx147065 #define IWK_FH_TFDIB_UPPER_BOUND (IWK_FH_REGS_LOWER_BOUND + 0x958) 5056169Shx147065 5066169Shx147065 #define IWK_FH_TFDIB_CTRL0_REG(_chnl) \ 5076169Shx147065 (IWK_FH_TFDIB_LOWER_BOUND + 0x8 * _chnl) 5086169Shx147065 #define IWK_FH_TFDIB_CTRL1_REG(_chnl) \ 5096169Shx147065 (IWK_FH_TFDIB_LOWER_BOUND + 0x8 * _chnl + 0x4) 5106169Shx147065 5116169Shx147065 #define IWK_FH_SRVC_CHNL (9) 5126169Shx147065 #define IWK_FH_TFDIB_CTRL1_REG_POS_MSB (28) 5136169Shx147065 5146169Shx147065 /* 5156169Shx147065 * Debug Monitor Area 5166169Shx147065 */ 5176169Shx147065 #define FH_MEM_DM_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xEE0) 5186169Shx147065 #define FH_MEM_DM_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xEF0) 5196169Shx147065 #define FH_MEM_DM_CONTROL_MASK_REG (FH_MEM_DM_LOWER_BOUND) 5206169Shx147065 #define FH_MEM_DM_CONTROL_START_REG (FH_MEM_DM_LOWER_BOUND + 0x004) 5216169Shx147065 #define FH_MEM_DM_CONTROL_STATUS_REG (FH_MEM_DM_LOWER_BOUND + 0x008) 5226169Shx147065 #define FH_MEM_DM_MONITOR_REG (FH_MEM_DM_LOWER_BOUND + 0x00C) 5236169Shx147065 5246169Shx147065 #define FH_TB1_ADDR_LOW_MASK (0xFFFFFFFF) /* bits 31:0 */ 5256169Shx147065 #define FH_TB1_ADDR_HIGH_MASK (0xF00000000) /* bits 35:32 */ 5266169Shx147065 #define FH_TB2_ADDR_LOW_MASK (0x0000FFFF) /* bits 15:0 */ 5276169Shx147065 #define FH_TB2_ADDR_HIGH_MASK (0xFFFFF0000) /* bits 35:16 */ 5286169Shx147065 5296169Shx147065 #define FH_TB1_ADDR_LOW_BITSHIFT (0) 5306169Shx147065 #define FH_TB1_ADDR_HIGH_BITSHIFT (32) 5316169Shx147065 #define FH_TB2_ADDR_LOW_BITSHIFT (0) 5326169Shx147065 #define FH_TB2_ADDR_HIGH_BITSHIFT (16) 5336169Shx147065 5346169Shx147065 #define FH_TB1_LENGTH_MASK (0x00000FFF) /* bits 11:0 */ 5356169Shx147065 #define FH_TB2_LENGTH_MASK (0x00000FFF) /* bits 11:0 */ 5366169Shx147065 5376169Shx147065 /* 5386169Shx147065 * number of FH channels including 2 service mode 5396169Shx147065 */ 5406169Shx147065 #define NUM_OF_FH_CHANNELS (10) 5416169Shx147065 5426169Shx147065 /* 5436169Shx147065 * ctrl field bitology 5446169Shx147065 */ 5456169Shx147065 #define FH_TFD_CTRL_PADDING_MASK (0xC0000000) /* bits 31:30 */ 5466169Shx147065 #define FH_TFD_CTRL_NUMTB_MASK (0x1F000000) /* bits 28:24 */ 5476169Shx147065 5486169Shx147065 #define FH_TFD_CTRL_PADDING_BITSHIFT (30) 5496169Shx147065 #define FH_TFD_CTRL_NUMTB_BITSHIFT (24) 5506169Shx147065 5516169Shx147065 #define FH_TFD_GET_NUM_TBS(ctrl) \ 5526169Shx147065 ((ctrl & FH_TFD_CTRL_NUMTB_MASK) >> FH_TFD_CTRL_NUMTB_BITSHIFT) 5536169Shx147065 #define FH_TFD_GET_PADDING(ctrl) \ 5546169Shx147065 ((ctrl & FH_TFD_CTRL_PADDING_MASK) >> FH_TFD_CTRL_PADDING_BITSHIFT) 5556169Shx147065 5566169Shx147065 /* TCSR: tx_config register values */ 5576169Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000) 5586169Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRIVER (0x00000001) 5596169Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_ARC (0x00000002) 5606169Shx147065 5616169Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL (0x00000000) 5626169Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL (0x00000008) 5636169Shx147065 5646169Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_NOINT (0x00000000) 5656169Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD (0x00100000) 5666169Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000) 5676169Shx147065 5686169Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000) 5696169Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_ENDTFD (0x00400000) 5706169Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_IFTFD (0x00800000) 5716169Shx147065 5726169Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000) 5736169Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE_EOF (0x40000000) 5746169Shx147065 #define IWK_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000) 5756169Shx147065 5766169Shx147065 #define IWK_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_EMPTY (0x00000000) 5776169Shx147065 #define IWK_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_WAIT (0x00002000) 5786169Shx147065 #define IWK_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00000003) 5796169Shx147065 5806169Shx147065 #define IWK_FH_TCSR_CHNL_TX_BUF_STS_REG_BIT_TFDB_WPTR (0x00000001) 5816169Shx147065 5826169Shx147065 #define IWK_FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM (20) 5836169Shx147065 #define IWK_FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX (12) 5846169Shx147065 5856169Shx147065 /* 5866169Shx147065 * CBB table 5876169Shx147065 */ 5886169Shx147065 #define FH_CBB_ADDR_MASK 0x0FFFFFFF /* bits 27:0 */ 5896169Shx147065 #define FH_CBB_ADDR_BIT_SHIFT (8) 5906169Shx147065 5916169Shx147065 /* 5926169Shx147065 * RCSR: channel 0 rx_config register defines 5936169Shx147065 */ 5946169Shx147065 #define FH_RCSR_CHNL0_RX_CONFIG_DMA_CHNL_EN_MASK (0xC0000000) /* bits 30-31 */ 5956169Shx147065 #define FH_RCSR_CHNL0_RX_CONFIG_RBDBC_SIZE_MASK (0x00F00000) /* bits 20-23 */ 5966169Shx147065 #define FH_RCSR_CHNL0_RX_CONFIG_RB_SIZE_MASK (0x00030000) /* bits 16-17 */ 5976169Shx147065 #define FH_RCSR_CHNL0_RX_CONFIG_SINGLE_FRAME_MASK (0x00008000) /* bit 15 */ 5986169Shx147065 #define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_MASK (0x00001000) /* bit 12 */ 5996169Shx147065 #define FH_RCSR_CHNL0_RX_CONFIG_RB_TIMEOUT_MASK (0x00000FF0) /* bit 4-11 */ 6006169Shx147065 6016169Shx147065 #define FH_RCSR_RX_CONFIG_RBDCB_SIZE_BITSHIFT (20) 6026169Shx147065 #define FH_RCSR_RX_CONFIG_RB_SIZE_BITSHIFT (16) 6036169Shx147065 6046169Shx147065 #define FH_RCSR_GET_RDBC_SIZE(reg) \ 6056169Shx147065 ((reg & FH_RCSR_RX_CONFIG_RDBC_SIZE_MASK) >> \ 6066169Shx147065 FH_RCSR_RX_CONFIG_RDBC_SIZE_BITSHIFT) 6076169Shx147065 6086169Shx147065 /* 6096169Shx147065 * RCSR: channel 1 rx_config register defines 6106169Shx147065 */ 6116169Shx147065 #define FH_RCSR_CHNL1_RX_CONFIG_DMA_CHNL_EN_MASK (0xC0000000) /* bits 30-31 */ 6126169Shx147065 #define FH_RCSR_CHNL1_RX_CONFIG_IRQ_DEST_MASK (0x00003000) /* bits 12-13 */ 6136169Shx147065 6146169Shx147065 /* 6156169Shx147065 * RCSR: rx_config register values 6166169Shx147065 */ 6176169Shx147065 #define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_VAL (0x00000000) 6186169Shx147065 #define FH_RCSR_RX_CONFIG_CHNL_EN_PAUSE_EOF_VAL (0x40000000) 6196169Shx147065 #define FH_RCSR_RX_CONFIG_CHNL_EN_ENABLE_VAL (0x80000000) 6206169Shx147065 #define FH_RCSR_RX_CONFIG_SINGLE_FRAME_MODE (0x00008000) 6216169Shx147065 6226169Shx147065 #define FH_RCSR_RX_CONFIG_RDRBD_DISABLE_VAL (0x00000000) 6236169Shx147065 #define FH_RCSR_RX_CONFIG_RDRBD_ENABLE_VAL (0x20000000) 6246169Shx147065 6256169Shx147065 #define IWK_FH_RCSR_RX_CONFIG_REG_VAL_RB_SIZE_4K (0x00000000) 6266169Shx147065 6276169Shx147065 /* 6286169Shx147065 * RCSR channel 0 config register values 6296169Shx147065 */ 6306169Shx147065 #define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_NO_INT_VAL (0x00000000) 6316169Shx147065 #define FH_RCSR_CHNL0_RX_CONFIG_IRQ_DEST_INT_HOST_VAL (0x00001000) 6326169Shx147065 6336169Shx147065 /* 6346169Shx147065 * RCSR channel 1 config register values 6356169Shx147065 */ 6366169Shx147065 #define FH_RCSR_CHNL1_RX_CONFIG_IRQ_DEST_NO_INT_VAL (0x00000000) 6376169Shx147065 #define FH_RCSR_CHNL1_RX_CONFIG_IRQ_DEST_INT_HOST_VAL (0x00001000) 6386169Shx147065 #define FH_RCSR_CHNL1_RX_CONFIG_IRQ_DEST_INT_RTC_VAL (0x00002000) 6396169Shx147065 #define FH_RCSR_CHNL1_RX_CONFIG_IRQ_DEST_INT_HOST_RTC_VAL (0x00003000) 6406169Shx147065 6416169Shx147065 /* 6426169Shx147065 * RCSR: rb status register defines 6436169Shx147065 */ 6446169Shx147065 #define FH_RCSR_RB_BYTE_TO_SEND_MASK (0x0001FFFF) /* bits 0-16 */ 6456169Shx147065 6466169Shx147065 /* 6476169Shx147065 * RSCSR: defs used in normal mode 6486169Shx147065 */ 6496169Shx147065 #define FH_RSCSR_CHNL0_RBDCB_WPTR_MASK (0x00000FFF) /* bits 0-11 */ 6506169Shx147065 6516169Shx147065 /* 6526169Shx147065 * RSCSR: defs used in service mode 6536169Shx147065 */ 6546169Shx147065 #define FH_RSCSR_CHNL1_SRAM_ADDR_MASK (0x00FFFFFF) /* bits 0-23 */ 6556169Shx147065 #define FH_RSCSR_CHNL1_RB_WPTR_MASK (0x0FFFFFFF) /* bits 0-27 */ 6566169Shx147065 #define FH_RSCSR_CHNL1_RB_WPTR_OFFSET_MASK (0x000000FF) /* bits 0-7 */ 6576169Shx147065 6586169Shx147065 /* 6596169Shx147065 * RSSR: RX Enable Error IRQ to Driver register defines 6606169Shx147065 */ 6616169Shx147065 #define FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV_NO_RBD (0x00400000) /* bit 22 */ 6626169Shx147065 6636169Shx147065 #define FH_DRAM2SRAM_DRAM_ADDR_HIGH_MASK (0xFFFFFFF00) /* bits 8-35 */ 6646169Shx147065 #define FH_DRAM2SRAM_DRAM_ADDR_LOW_MASK (0x000000FF) /* bits 0-7 */ 6656169Shx147065 6666169Shx147065 #define FH_DRAM2SRAM_DRAM_ADDR_HIGH_BITSHIFT (8) /* bits 8-35 */ 6676169Shx147065 6686169Shx147065 /* 6696169Shx147065 * RX DRAM status regs definitions 6706169Shx147065 */ 6716169Shx147065 #define FH_RX_RB_NUM_MASK (0x00000FFF) /* bits 0-11 */ 6726169Shx147065 #define FH_RX_FRAME_NUM_MASK (0x0FFF0000) /* bits 16-27 */ 6736169Shx147065 6746169Shx147065 #define FH_RX_RB_NUM_BITSHIFT (0) 6756169Shx147065 #define FH_RX_FRAME_NUM_BITSHIFT (16) 6766169Shx147065 6776169Shx147065 /* 6786169Shx147065 * Tx Scheduler 6796169Shx147065 * 6806169Shx147065 * The Tx Scheduler selects the next frame to be transmitted, chosing TFDs 6816169Shx147065 * (Transmit Frame Descriptors) from up to 16 circular queues resident in 6826169Shx147065 * host DRAM. It steers each frame's Tx command (which contains the frame 6836169Shx147065 * data) through one of up to 7 prioritized Tx DMA FIFO channels within the 6846169Shx147065 * device. A queue maps to only one (selectable by driver) Tx DMA channel, 6856169Shx147065 * but one DMA channel may take input from several queues. 6866169Shx147065 * 6876169Shx147065 * Tx DMA channels have dedicated purposes. For 4965, and are used as follows: 6886169Shx147065 * BMC TODO: CONFIRM channel assignments, esp for 0/1 6896169Shx147065 * 6906169Shx147065 * 0 -- EDCA BK (background) frames, lowest priority 6916169Shx147065 * 1 -- EDCA BE (best effort) frames, normal priority 6926169Shx147065 * 2 -- EDCA VI (video) frames, higher priority 6936169Shx147065 * 3 -- EDCA VO (voice) and management frames, highest priority 6946169Shx147065 * 4 -- Commands (e.g. RXON, etc.) 6956169Shx147065 * 5 -- HCCA short frames 6966169Shx147065 * 6 -- HCCA long frames 6976169Shx147065 * 7 -- not used by driver (device-internal only) 6986169Shx147065 * 6996169Shx147065 * Driver should normally map queues 0-6 to Tx DMA/FIFO channels 0-6. 7006169Shx147065 * In addition, driver can map queues 7-15 to Tx DMA/FIFO channels 0-3 to 7016169Shx147065 * support 11n aggregation via EDCA DMA channels. BMC confirm. 7026169Shx147065 * 7036169Shx147065 * The driver sets up each queue to work in one of two modes: 7046169Shx147065 * 7056169Shx147065 * 1) Scheduler-Ack, in which the scheduler automatically supports a 7066169Shx147065 * block-ack (BA) window of up to 64 TFDs. In this mode, each queue 7076169Shx147065 * contains TFDs for a unique combination of Recipient Address (RA) 7086169Shx147065 * and Traffic Identifier (TID), that is, traffic of a given 7096169Shx147065 * Quality-Of-Service (QOS) priority, destined for a single station. 7106169Shx147065 * 7116169Shx147065 * In scheduler-ack mode, the scheduler keeps track of the Tx status of 7126169Shx147065 * each frame within the BA window, including whether it's been transmitted, 7136169Shx147065 * and whether it's been acknowledged by the receiving station. The device 7146169Shx147065 * automatically processes block-acks received from the receiving STA, 7156169Shx147065 * and reschedules un-acked frames to be retransmitted (successful 7166169Shx147065 * Tx completion may end up being out-of-order). 7176169Shx147065 * 7186169Shx147065 * The driver must maintain the queue's Byte Count table in host DRAM 7196169Shx147065 * (struct iwk_sched_queue_byte_cnt_tbl) for this mode. 7206169Shx147065 * This mode does not support fragmentation. 7216169Shx147065 * 7226169Shx147065 * 2) FIFO (a.k.a. non-Scheduler-ACK), in which each TFD is processed in order. 7236169Shx147065 * The device may automatically retry Tx, but will retry only one frame 7246169Shx147065 * at a time, until receiving ACK from receiving station, or reaching 7256169Shx147065 * retry limit and giving up. 7266169Shx147065 * 7276169Shx147065 * The command queue (#4) must use this mode! 7286169Shx147065 * This mode does not require use of the Byte Count table in host DRAM. 7296169Shx147065 * 7306169Shx147065 * Driver controls scheduler operation via 3 means: 7316169Shx147065 * 1) Scheduler registers 7326169Shx147065 * 2) Shared scheduler data base in internal 4956 SRAM 7336169Shx147065 * 3) Shared data in host DRAM 7346169Shx147065 * 7356169Shx147065 * Initialization: 7366169Shx147065 * 7376169Shx147065 * When loading, driver should allocate memory for: 7386169Shx147065 * 1) 16 TFD circular buffers, each with space for (typically) 256 TFDs. 7396169Shx147065 * 2) 16 Byte Count circular buffers in 16 KBytes contiguous memory 7406169Shx147065 * (1024 bytes for each queue). 7416169Shx147065 * 7426169Shx147065 * After receiving "Alive" response from uCode, driver must initialize 7436169Shx147065 * the following (especially for queue #4, the command queue, otherwise 7446169Shx147065 * the driver can't issue commands!): 7456169Shx147065 * 7466169Shx147065 * 1) 4965's scheduler data base area in SRAM: 7476169Shx147065 * a) Read SRAM address of data base area from SCD_SRAM_BASE_ADDR 7486169Shx147065 * b) Clear and Init SCD_CONTEXT_DATA_OFFSET area (size 128 bytes) 7496169Shx147065 * c) Clear SCD_TX_STTS_BITMAP_OFFSET area (size 256 bytes) 7506169Shx147065 * d) Clear (BMC and init?) SCD_TRANSLATE_TBL_OFFSET (size 32 bytes) 7516169Shx147065 * 7526169Shx147065 * 2) Init SCD_DRAM_BASE_ADDR with physical base of Tx byte count circular 7536169Shx147065 * buffer array, allocated by driver in host DRAM. 7546169Shx147065 * 7556169Shx147065 * 3) 7566169Shx147065 */ 7576169Shx147065 7586169Shx147065 /* 7596169Shx147065 * Max Tx window size is the max number of contiguous TFDs that the scheduler 7606169Shx147065 * can keep track of at one time when creating block-ack chains of frames. 7616169Shx147065 * Note that "64" matches the number of ack bits in a block-ack. 7626169Shx147065 * Driver should use SCD_WIN_SIZE and SCD_FRAME_LIMIT values to initialize 7636169Shx147065 * SCD_CONTEXT_QUEUE_OFFSET(x) values. 7646169Shx147065 */ 7656169Shx147065 #define SCD_WIN_SIZE 64 7666169Shx147065 #define SCD_FRAME_LIMIT 10 7676169Shx147065 7686169Shx147065 /* 7696169Shx147065 * Memory mapped registers ... access via HBUS_TARG_PRPH regs 7706169Shx147065 */ 7716169Shx147065 #define SCD_START_OFFSET 0xa02c00 7726169Shx147065 7736169Shx147065 /* 7746169Shx147065 * 4965 tells driver SRAM address for internal scheduler structs via this reg. 7756169Shx147065 * Value is valid only after "Alive" response from uCode. 7766169Shx147065 */ 7776169Shx147065 #define SCD_SRAM_BASE_ADDR (SCD_START_OFFSET + 0x0) 7786169Shx147065 7796169Shx147065 /* 7806169Shx147065 * Driver may need to update queue-empty bits after changing queue's 7816169Shx147065 * write and read pointers (indexes) during (re-)initialization (i.e. when 7826169Shx147065 * scheduler is not tracking what's happening). 7836169Shx147065 * Bit fields: 7846169Shx147065 * 31-16: Write mask -- 1: update empty bit, 0: don't change empty bit 7856169Shx147065 * 15-00: Empty state, one for each queue -- 1: empty, 0: non-empty 7866169Shx147065 * NOTE BMC: THIS REGISTER NOT USED BY LINUX DRIVER. 7876169Shx147065 */ 7886169Shx147065 #define SCD_EMPTY_BITS (SCD_START_OFFSET + 0x4) 7896169Shx147065 7906169Shx147065 /* 7916169Shx147065 * Physical base address of array of byte count (BC) circular buffers (CBs). 7926169Shx147065 * Each Tx queue has a BC CB in host DRAM to support Scheduler-ACK mode. 7936169Shx147065 * This register points to BC CB for queue 0, must be on 1024-byte boundary. 7946169Shx147065 * Others are spaced by 1024 bytes. 7956169Shx147065 * Each BC CB is 2 bytes * (256 + 64) = 740 bytes, followed by 384 bytes pad. 7966169Shx147065 * (Index into a queue's BC CB) = (index into queue's TFD CB) = (SSN & 0xff). 7976169Shx147065 * Bit fields: 7986169Shx147065 * 25-00: Byte Count CB physical address [35:10], must be 1024-byte aligned. 7996169Shx147065 */ 8006169Shx147065 #define SCD_DRAM_BASE_ADDR (SCD_START_OFFSET + 0x10) 8016169Shx147065 #define SCD_AIT (SCD_START_OFFSET + 0x18) 8026169Shx147065 8036169Shx147065 /* 8046169Shx147065 * Enables any/all Tx DMA/FIFO channels. 8056169Shx147065 * Scheduler generates requests for only the active channels. 8066169Shx147065 * Set this to 0xff to enable all 8 channels (normal usage). 8076169Shx147065 * Bit fields: 8086169Shx147065 * 7- 0: Enable (1), disable (0), one bit for each channel 0-7 8096169Shx147065 */ 8106169Shx147065 #define SCD_TXFACT (SCD_START_OFFSET + 0x1c) 8116169Shx147065 8126169Shx147065 /* 8136169Shx147065 * Queue (x) Write Pointers (indexes, really!), one for each Tx queue. 8146169Shx147065 * Initialized and updated by driver as new TFDs are added to queue. 8156169Shx147065 * NOTE: If using Block Ack, index must correspond to frame's 8166169Shx147065 * Start Sequence Number; index = (SSN & 0xff) 8176169Shx147065 * NOTE BMC: Alternative to HBUS_TARG_WRPTR, which is what Linux driver uses? 8186169Shx147065 */ 8196169Shx147065 #define SCD_QUEUE_WRPTR(x) (SCD_START_OFFSET + 0x24 + (x) * 4) 8206169Shx147065 8216169Shx147065 /* 8226169Shx147065 * Queue (x) Read Pointers (indexes, really!), one for each Tx queue. 8236169Shx147065 * For FIFO mode, index indicates next frame to transmit. 8246169Shx147065 * For Scheduler-ACK mode, index indicates first frame in Tx window. 8256169Shx147065 * Initialized by driver, updated by scheduler. 8266169Shx147065 */ 8276169Shx147065 #define SCD_QUEUE_RDPTR(x) (SCD_START_OFFSET + 0x64 + (x) * 4) 8286169Shx147065 #define SCD_SETQUEUENUM (SCD_START_OFFSET + 0xa4) 8296169Shx147065 #define SCD_SET_TXSTAT_TXED (SCD_START_OFFSET + 0xa8) 8306169Shx147065 #define SCD_SET_TXSTAT_DONE (SCD_START_OFFSET + 0xac) 8316169Shx147065 #define SCD_SET_TXSTAT_NOT_SCHD (SCD_START_OFFSET + 0xb0) 8326169Shx147065 #define SCD_DECREASE_CREDIT (SCD_START_OFFSET + 0xb4) 8336169Shx147065 #define SCD_DECREASE_SCREDIT (SCD_START_OFFSET + 0xb8) 8346169Shx147065 #define SCD_LOAD_CREDIT (SCD_START_OFFSET + 0xbc) 8356169Shx147065 #define SCD_LOAD_SCREDIT (SCD_START_OFFSET + 0xc0) 8366169Shx147065 #define SCD_BAR (SCD_START_OFFSET + 0xc4) 8376169Shx147065 #define SCD_BAR_DW0 (SCD_START_OFFSET + 0xc8) 8386169Shx147065 #define SCD_BAR_DW1 (SCD_START_OFFSET + 0xcc) 8396169Shx147065 8406169Shx147065 /* 8416169Shx147065 * Select which queues work in chain mode (1) vs. not (0). 8426169Shx147065 * Use chain mode to build chains of aggregated frames. 8436169Shx147065 * Bit fields: 8446169Shx147065 * 31-16: Reserved 8456169Shx147065 * 15-00: Mode, one bit for each queue -- 1: Chain mode, 0: one-at-a-time 8466169Shx147065 * NOTE: If driver sets up queue for chain mode, it should be also set up 8476169Shx147065 * Scheduler-ACK mode as well, via SCD_QUEUE_STATUS_BITS(x). 8486169Shx147065 */ 8496169Shx147065 #define SCD_QUEUECHAIN_SEL (SCD_START_OFFSET + 0xd0) 8506169Shx147065 #define SCD_QUERY_REQ (SCD_START_OFFSET + 0xd8) 8516169Shx147065 #define SCD_QUERY_RES (SCD_START_OFFSET + 0xdc) 8526169Shx147065 #define SCD_PENDING_FRAMES (SCD_START_OFFSET + 0xe0) 8536169Shx147065 8546169Shx147065 /* 8556169Shx147065 * Select which queues interrupt driver when read pointer (index) increments. 8566169Shx147065 * Bit fields: 8576169Shx147065 * 31-16: Reserved 8586169Shx147065 * 15-00: Interrupt enable, one bit for each queue -- 1: enabled, 0: disabled 8596169Shx147065 * NOTE BMC: THIS FUNCTIONALITY IS APPARENTLY A NO-OP. 8606169Shx147065 */ 8616169Shx147065 #define SCD_INTERRUPT_MASK (SCD_START_OFFSET + 0xe4) 8626169Shx147065 #define SCD_INTERRUPT_THRESHOLD (SCD_START_OFFSET + 0xe8) 8636169Shx147065 #define SCD_QUERY_MIN_FRAME_SIZE (SCD_START_OFFSET + 0x100) 8646169Shx147065 8656169Shx147065 /* 8666169Shx147065 * Queue search status registers. One for each queue. 8676169Shx147065 * Sets up queue mode and assigns queue to Tx DMA channel. 8686169Shx147065 * Bit fields: 8696169Shx147065 * 19-10: Write mask/enable bits for bits 0-9 8706169Shx147065 * 9: Driver should init to "0" 8716169Shx147065 * 8: Scheduler-ACK mode (1), non-Scheduler-ACK (i.e. FIFO) mode (0). 8726169Shx147065 * Driver should init to "1" for aggregation mode, or "0" otherwise. 8736169Shx147065 * 7-6: Driver should init to "0" 8746169Shx147065 * 5: Window Size Left; indicates whether scheduler can request 8756169Shx147065 * another TFD, based on window size, etc. Driver should init 8766169Shx147065 * this bit to "1" for aggregation mode, or "0" for non-agg. 8776169Shx147065 * 4-1: Tx FIFO to use (range 0-7). 8786169Shx147065 * 0: Queue is active (1), not active (0). 8796169Shx147065 * Other bits should be written as "0" 8806169Shx147065 * 8816169Shx147065 * NOTE: If enabling Scheduler-ACK mode, chain mode should also be enabled 8826169Shx147065 * via SCD_QUEUECHAIN_SEL. 8836169Shx147065 */ 8846169Shx147065 #define SCD_QUEUE_STATUS_BITS(x) (SCD_START_OFFSET + 0x104 + (x) * 4) 8856169Shx147065 8866169Shx147065 /* 8876169Shx147065 * 4965 internal SRAM structures for scheduler, shared with driver ... 8886169Shx147065 * Driver should clear and initialize the following areas after receiving 8896169Shx147065 * "Alive" response from 4965 uCode, i.e. after initial 8906169Shx147065 * uCode load, or after a uCode load done for error recovery: 8916169Shx147065 * 8926169Shx147065 * SCD_CONTEXT_DATA_OFFSET (size 128 bytes) 8936169Shx147065 * SCD_TX_STTS_BITMAP_OFFSET (size 256 bytes) 8946169Shx147065 * SCD_TRANSLATE_TBL_OFFSET (size 32 bytes) 8956169Shx147065 * 8966169Shx147065 * Driver reads base address of this scheduler area from SCD_SRAM_BASE_ADDR. 8976169Shx147065 * All OFFSET values must be added to this base address. 8986169Shx147065 * Use HBUS_TARG_MEM_* registers to access SRAM. 8996169Shx147065 */ 9006169Shx147065 9016169Shx147065 /* 9026169Shx147065 * Queue context. One 8-byte entry for each of 16 queues. 9036169Shx147065 * 9046169Shx147065 * Driver should clear this entire area (size 0x80) to 0 after receiving 9056169Shx147065 * "Alive" notification from uCode. Additionally, driver should init 9066169Shx147065 * each queue's entry as follows: 9076169Shx147065 * 9086169Shx147065 * LS Dword bit fields: 9096169Shx147065 * 0-06: Max Tx window size for Scheduler-ACK. Driver should init to 64. 9106169Shx147065 * 9116169Shx147065 * MS Dword bit fields: 9126169Shx147065 * 16-22: Frame limit. Driver should init to 10 (0xa). 9136169Shx147065 * 9146169Shx147065 * Driver should init all other bits to 0. 9156169Shx147065 * 9166169Shx147065 * Init must be done after driver receives "Alive" response from 4965 uCode, 9176169Shx147065 * and when setting up queue for aggregation. 9186169Shx147065 */ 9196169Shx147065 #define SCD_CONTEXT_DATA_OFFSET 0x380 9206169Shx147065 9216169Shx147065 /* 9226169Shx147065 * Tx Status Bitmap 9236169Shx147065 * 9246169Shx147065 * Driver should clear this entire area (size 0x100) to 0 after receiving 9256169Shx147065 * "Alive" notification from uCode. Area is used only by device itself; 9266169Shx147065 * no other support (besides clearing) is required from driver. 9276169Shx147065 */ 9286169Shx147065 #define SCD_TX_STTS_BITMAP_OFFSET 0x400 9296169Shx147065 9306169Shx147065 /* 9316169Shx147065 * RAxTID to queue translation mapping. 9326169Shx147065 * 9336169Shx147065 * When queue is in Scheduler-ACK mode, frames placed in a that queue must be 9346169Shx147065 * for only one combination of receiver address (RA) and traffic ID (TID), i.e. 9356169Shx147065 * one QOS priority level destined for one station (for this link, not final 9366169Shx147065 * destination). The SCD_TRANSLATE_TABLE area provides 16 16-bit mappings, 9376169Shx147065 * one for each of the 16 queues. If queue is not in Scheduler-ACK mode, the 9386169Shx147065 * device ignores the mapping value. 9396169Shx147065 * 9406169Shx147065 * Bit fields, for each 16-bit map: 9416169Shx147065 * 15-9: Reserved, set to 0 9426169Shx147065 * 8-4: Index into device's station table for recipient station 9436169Shx147065 * 3-0: Traffic ID (tid), range 0-15 9446169Shx147065 * 9456169Shx147065 * Driver should clear this entire area (size 32 bytes) to 0 after receiving 9466169Shx147065 * "Alive" notification from uCode. To update a 16-bit map value, driver 9476169Shx147065 * must read a dword-aligned value from device SRAM, replace the 16-bit map 9486169Shx147065 * value of interest, and write the dword value back into device SRAM. 9496169Shx147065 */ 9506169Shx147065 #define SCD_TRANSLATE_TBL_OFFSET 0x500 9516169Shx147065 #define SCD_CONTEXT_QUEUE_OFFSET(x) (SCD_CONTEXT_DATA_OFFSET + ((x) * 8)) 9526169Shx147065 #define SCD_TRANSLATE_TBL_OFFSET_QUEUE(x) \ 9536169Shx147065 ((SCD_TRANSLATE_TBL_OFFSET + ((x) * 2)) & 0xfffffffc) 9546169Shx147065 9556169Shx147065 /* 9566169Shx147065 * Mask to enable contiguous Tx DMA/FIFO channels between "lo" and "hi". 9576169Shx147065 */ 9586169Shx147065 #define SCD_TXFACT_REG_TXFIFO_MASK(lo, hi) \ 9596169Shx147065 ((1<<(hi))|((1<<(hi))-(1<<(lo)))) 9606169Shx147065 9616169Shx147065 #define SCD_MODE_REG_BIT_SEARCH_MODE (1<<0) 9626169Shx147065 #define SCD_MODE_REG_BIT_SBYP_MODE (1<<1) 9636169Shx147065 9646169Shx147065 #define SCD_TXFIFO_POS_TID (0) 9656169Shx147065 #define SCD_TXFIFO_POS_RA (4) 9666169Shx147065 #define SCD_QUEUE_STTS_REG_POS_ACTIVE (0) 9676169Shx147065 #define SCD_QUEUE_STTS_REG_POS_TXF (1) 9686169Shx147065 #define SCD_QUEUE_STTS_REG_POS_WSL (5) 9696169Shx147065 #define SCD_QUEUE_STTS_REG_POS_SCD_ACK (8) 9706169Shx147065 #define SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN (10) 9716169Shx147065 #define SCD_QUEUE_STTS_REG_MSK (0x0007FC00) 9726169Shx147065 9736169Shx147065 #define SCD_QUEUE_RA_TID_MAP_RATID_MSK (0x01FF) 9746169Shx147065 9756169Shx147065 #define SCD_QUEUE_CTX_REG1_WIN_SIZE_POS (0) 9766169Shx147065 #define SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK (0x0000007F) 9776169Shx147065 #define SCD_QUEUE_CTX_REG1_CREDIT_POS (8) 9786169Shx147065 #define SCD_QUEUE_CTX_REG1_CREDIT_MSK (0x00FFFF00) 9796169Shx147065 #define SCD_QUEUE_CTX_REG1_SUPER_CREDIT_POS (24) 9806169Shx147065 #define SCD_QUEUE_CTX_REG1_SUPER_CREDIT_MSK (0xFF000000) 9816169Shx147065 #define SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS (16) 9826169Shx147065 #define SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK (0x007F0000) 9836169Shx147065 9846169Shx147065 #define CSR_HW_IF_CONFIG_REG_BIT_KEDRON_R (0x00000010) 9856169Shx147065 #define CSR_HW_IF_CONFIG_REG_MSK_BOARD_VER (0x00000C00) 9866169Shx147065 #define CSR_HW_IF_CONFIG_REG_BIT_MAC_SI (0x00000100) 9876169Shx147065 #define CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI (0x00000200) 9886169Shx147065 #define CSR_HW_IF_CONFIG_REG_EEP_SEM (0x00200000) 9896169Shx147065 9906169Shx147065 /* IWK-END */ 9916169Shx147065 9926169Shx147065 #define RX_RES_PHY_CNT 14 9936169Shx147065 9946169Shx147065 #define STATISTICS_FLG_CLEAR (0x1) 9956169Shx147065 #define STATISTICS_FLG_DISABLE_NOTIFICATION (0x2) 9966169Shx147065 9976169Shx147065 #define STATISTICS_REPLY_FLG_CLEAR (0x1) 9986169Shx147065 #define STATISTICS_REPLY_FLG_BAND_24G_MSK (0x2) 9996169Shx147065 #define STATISTICS_REPLY_FLG_TGJ_NARROW_BAND_MSK (0x4) 10006169Shx147065 #define STATISTICS_REPLY_FLG_FAT_MODE_MSK (0x8) 10016169Shx147065 #define RX_PHY_FLAGS_ANTENNAE_OFFSET (4) 10026169Shx147065 #define RX_PHY_FLAGS_ANTENNAE_MASK (0x70) 10036169Shx147065 10046169Shx147065 /* 10056169Shx147065 * Register and values 10066169Shx147065 */ 10076169Shx147065 #define CSR_BASE (0x0) 10086169Shx147065 #define HBUS_BASE (0x400) 10096169Shx147065 10106169Shx147065 #define HBUS_TARG_MBX_C (HBUS_BASE+0x030) 10116169Shx147065 10126169Shx147065 /* 10136169Shx147065 * CSR (control and status registers) 10146169Shx147065 */ 10156169Shx147065 #define CSR_SW_VER (CSR_BASE+0x000) 10166169Shx147065 #define CSR_HW_IF_CONFIG_REG (CSR_BASE+0x000) /* hardware interface config */ 10176169Shx147065 #define CSR_INT_COALESCING (CSR_BASE+0x004) /* accum ints, 32-usec units */ 10186169Shx147065 #define CSR_INT (CSR_BASE+0x008) /* host interrupt status/ack */ 10196169Shx147065 #define CSR_INT_MASK (CSR_BASE+0x00c) /* host interrupt enable */ 10206169Shx147065 #define CSR_FH_INT_STATUS (CSR_BASE+0x010) /* busmaster int status/ack */ 10216169Shx147065 #define CSR_GPIO_IN (CSR_BASE+0x018) /* read external chip pins */ 10226169Shx147065 #define CSR_RESET (CSR_BASE+0x020) /* busmaster enable, NMI, etc */ 10236169Shx147065 #define CSR_GP_CNTRL (CSR_BASE+0x024) 10246169Shx147065 /* 0x028 - reserved */ 10256169Shx147065 #define CSR_EEPROM_REG (CSR_BASE+0x02c) 10266169Shx147065 #define CSR_EEPROM_GP (CSR_BASE+0x030) 10276169Shx147065 #define CSR_UCODE_DRV_GP1 (CSR_BASE+0x054) 10286169Shx147065 #define CSR_UCODE_DRV_GP1_SET (CSR_BASE+0x058) 10296169Shx147065 #define CSR_UCODE_DRV_GP1_CLR (CSR_BASE+0x05c) 10306169Shx147065 #define CSR_UCODE_DRV_GP2 (CSR_BASE+0x060) 10316169Shx147065 #define CSR_GIO_CHICKEN_BITS (CSR_BASE+0x100) 10326169Shx147065 #define CSR_ANA_PLL_CFG (CSR_BASE+0x20c) 10336169Shx147065 #define CSR_HW_REV_WA_REG (CSR_BASE+0x22C) 10346169Shx147065 10356169Shx147065 /* 10366169Shx147065 * BSM (Bootstrap State Machine) 10376169Shx147065 */ 10386169Shx147065 #define BSM_BASE (CSR_BASE + 0x3400) 10396169Shx147065 10406169Shx147065 #define BSM_WR_CTRL_REG (BSM_BASE + 0x000) /* ctl and status */ 10416169Shx147065 #define BSM_WR_MEM_SRC_REG (BSM_BASE + 0x004) /* source in BSM mem */ 10426169Shx147065 #define BSM_WR_MEM_DST_REG (BSM_BASE + 0x008) /* dest in SRAM mem */ 10436169Shx147065 #define BSM_WR_DWCOUNT_REG (BSM_BASE + 0x00C) /* bytes */ 10446169Shx147065 #define BSM_WR_STATUS_REG (BSM_BASE + 0x010) /* bit 0: 1 == done */ 10456169Shx147065 10466169Shx147065 /* 10476169Shx147065 * pointers and size regs for bootstrap load and data SRAM save 10486169Shx147065 */ 10496169Shx147065 #define BSM_DRAM_INST_PTR_REG (BSM_BASE + 0x090) 10506169Shx147065 #define BSM_DRAM_INST_BYTECOUNT_REG (BSM_BASE + 0x094) 10516169Shx147065 #define BSM_DRAM_DATA_PTR_REG (BSM_BASE + 0x098) 10526169Shx147065 #define BSM_DRAM_DATA_BYTECOUNT_REG (BSM_BASE + 0x09C) 10536169Shx147065 10546169Shx147065 /* 10556169Shx147065 * BSM special memory, stays powered during power-save sleeps 10566169Shx147065 */ 10576169Shx147065 #define BSM_SRAM_LOWER_BOUND (CSR_BASE + 0x3800) 10586169Shx147065 #define BSM_SRAM_SIZE (1024) 10596169Shx147065 10606169Shx147065 10616169Shx147065 /* 10626169Shx147065 * card static random access memory (SRAM) for processor data and instructs 10636169Shx147065 */ 10646169Shx147065 #define RTC_INST_LOWER_BOUND (0x00000) 10656169Shx147065 #define ALM_RTC_INST_UPPER_BOUND (0x14000) 10666169Shx147065 10676169Shx147065 #define RTC_DATA_LOWER_BOUND (0x800000) 10686169Shx147065 #define ALM_RTC_DATA_UPPER_BOUND (0x808000) 10696169Shx147065 10706169Shx147065 /* 10716169Shx147065 * HBUS (Host-side bus) 10726169Shx147065 */ 10736169Shx147065 #define HBUS_TARG_MEM_RADDR (HBUS_BASE+0x00c) 10746169Shx147065 #define HBUS_TARG_MEM_WADDR (HBUS_BASE+0x010) 10756169Shx147065 #define HBUS_TARG_MEM_WDAT (HBUS_BASE+0x018) 10766169Shx147065 #define HBUS_TARG_MEM_RDAT (HBUS_BASE+0x01c) 10776169Shx147065 #define HBUS_TARG_PRPH_WADDR (HBUS_BASE+0x044) 10786169Shx147065 #define HBUS_TARG_PRPH_RADDR (HBUS_BASE+0x048) 10796169Shx147065 #define HBUS_TARG_PRPH_WDAT (HBUS_BASE+0x04c) 10806169Shx147065 #define HBUS_TARG_PRPH_RDAT (HBUS_BASE+0x050) 10816169Shx147065 #define HBUS_TARG_WRPTR (HBUS_BASE+0x060) 10826169Shx147065 10836169Shx147065 /* 10846169Shx147065 * HW I/F configuration 10856169Shx147065 */ 10866169Shx147065 #define CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MB (0x00000100) 10876169Shx147065 #define CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MM (0x00000200) 10886169Shx147065 #define CSR_HW_IF_CONFIG_REG_BIT_SKU_MRC (0x00000400) 10896169Shx147065 #define CSR_HW_IF_CONFIG_REG_BIT_BOARD_TYPE (0x00000800) 10906169Shx147065 #define CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A (0x00000000) 10916169Shx147065 #define CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B (0x00001000) 10926169Shx147065 10936169Shx147065 #define CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP (0x00000001) 10946169Shx147065 #define CSR_UCODE_SW_BIT_RFKILL (0x00000002) 10956169Shx147065 #define CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED (0x00000004) 10966169Shx147065 #define CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT (0x00000008) 10976169Shx147065 10986169Shx147065 #define CSR_GPIO_IN_BIT_AUX_POWER (0x00000200) 10996169Shx147065 #define CSR_GPIO_IN_VAL_VAUX_PWR_SRC (0x00000000) 11006169Shx147065 #define CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX (0x00800000) 11016169Shx147065 #define CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER (0x20000000) 11026169Shx147065 #define CSR_GPIO_IN_VAL_VMAIN_PWR_SRC CSR_GPIO_IN_BIT_AUX_POWER 11036169Shx147065 11046169Shx147065 #define PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT (0x80000000) 11056169Shx147065 11066169Shx147065 /* 11076169Shx147065 * interrupt flags in INTA, set by uCode or hardware (e.g. dma), 11086169Shx147065 * acknowledged (reset) by host writing "1" to flagged bits. 11096169Shx147065 */ 11106169Shx147065 #define BIT_INT_FH_RX \ 11116169Shx147065 (((uint32_t)1) << 31) /* Rx DMA, cmd responses, FH_INT[17:16] */ 11126169Shx147065 #define BIT_INT_ERR (1<<29) /* DMA hardware error FH_INT[31] */ 11136169Shx147065 #define BIT_INT_FH_TX (1<<27) /* Tx DMA FH_INT[1:0] */ 11146169Shx147065 #define BIT_INT_MAC_CLK_ACTV (1<<26) /* NIC controller's clock toggled on/off */ 11156169Shx147065 #define BIT_INT_SWERROR (1<<25) /* uCode error */ 11166169Shx147065 #define BIT_INT_RF_KILL (1<<7) /* HW RFKILL switch GP_CNTRL[27] toggled */ 11176169Shx147065 #define BIT_INT_CT_KILL (1<<6) /* Critical temp (chip too hot) rfkill */ 11186169Shx147065 #define BIT_INT_SW_RX (1<<3) /* Rx, command responses, 3945 */ 11196169Shx147065 #define BIT_INT_WAKEUP (1<<1) /* NIC controller waking up (pwr mgmt) */ 11206169Shx147065 #define BIT_INT_ALIVE (1<<0) /* uCode interrupts once it initializes */ 11216169Shx147065 11226169Shx147065 #define CSR_INI_SET_MASK (BIT_INT_FH_RX | \ 11236169Shx147065 BIT_INT_ERR | \ 11246169Shx147065 BIT_INT_FH_TX | \ 11256169Shx147065 BIT_INT_SWERROR | \ 11266169Shx147065 BIT_INT_RF_KILL | \ 11276169Shx147065 BIT_INT_SW_RX | \ 11286169Shx147065 BIT_INT_WAKEUP | \ 11296169Shx147065 BIT_INT_ALIVE) 11306169Shx147065 11316169Shx147065 /* 11326169Shx147065 * interrupt flags in FH (flow handler) (PCI busmaster DMA) 11336169Shx147065 */ 11346169Shx147065 #define BIT_FH_INT_ERR (((uint32_t)1) << 31) /* Error */ 11356169Shx147065 #define BIT_FH_INT_HI_PRIOR (1<<30) /* High priority Rx,bypass coalescing */ 11366169Shx147065 #define BIT_FH_INT_RX_CHNL2 (1<<18) /* Rx channel 2 (3945 only) */ 11376169Shx147065 #define BIT_FH_INT_RX_CHNL1 (1<<17) /* Rx channel 1 */ 11386169Shx147065 #define BIT_FH_INT_RX_CHNL0 (1<<16) /* Rx channel 0 */ 11396169Shx147065 #define BIT_FH_INT_TX_CHNL6 (1<<6) /* Tx channel 6 (3945 only) */ 11406169Shx147065 #define BIT_FH_INT_TX_CHNL1 (1<<1) /* Tx channel 1 */ 11416169Shx147065 #define BIT_FH_INT_TX_CHNL0 (1<<0) /* Tx channel 0 */ 11426169Shx147065 11436169Shx147065 #define FH_INT_RX_MASK (BIT_FH_INT_HI_PRIOR | \ 11446169Shx147065 BIT_FH_INT_RX_CHNL2 | \ 11456169Shx147065 BIT_FH_INT_RX_CHNL1 | \ 11466169Shx147065 BIT_FH_INT_RX_CHNL0) 11476169Shx147065 11486169Shx147065 #define FH_INT_TX_MASK (BIT_FH_INT_TX_CHNL6 | \ 11496169Shx147065 BIT_FH_INT_TX_CHNL1 | \ 11506169Shx147065 BIT_FH_INT_TX_CHNL0) 11516169Shx147065 11526169Shx147065 /* 11536169Shx147065 * RESET 11546169Shx147065 */ 11556169Shx147065 #define CSR_RESET_REG_FLAG_NEVO_RESET (0x00000001) 11566169Shx147065 #define CSR_RESET_REG_FLAG_FORCE_NMI (0x00000002) 11576169Shx147065 #define CSR_RESET_REG_FLAG_SW_RESET (0x00000080) 11586169Shx147065 #define CSR_RESET_REG_FLAG_MASTER_DISABLED (0x00000100) 11596169Shx147065 #define CSR_RESET_REG_FLAG_STOP_MASTER (0x00000200) 11606169Shx147065 11616169Shx147065 /* 11626169Shx147065 * GP (general purpose) CONTROL 11636169Shx147065 */ 11646169Shx147065 #define CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY (0x00000001) 11656169Shx147065 #define CSR_GP_CNTRL_REG_FLAG_INIT_DONE (0x00000004) 11666169Shx147065 #define CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ (0x00000008) 11676169Shx147065 #define CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP (0x00000010) 11686169Shx147065 11696169Shx147065 #define CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN (0x00000001) 11706169Shx147065 11716169Shx147065 #define CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE (0x07000000) 11726169Shx147065 #define CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE (0x04000000) 11736169Shx147065 #define CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW (0x08000000) 11746169Shx147065 11756169Shx147065 /* 11766169Shx147065 * APMG (power management) constants 11776169Shx147065 */ 11786169Shx147065 #define APMG_CLK_CTRL_REG (0x003000) 11796169Shx147065 #define ALM_APMG_CLK_EN (0x003004) 11806169Shx147065 #define ALM_APMG_CLK_DIS (0x003008) 11816169Shx147065 #define ALM_APMG_PS_CTL (0x00300c) 11826169Shx147065 #define ALM_APMG_PCIDEV_STT (0x003010) 11836169Shx147065 #define ALM_APMG_RFKILL (0x003014) 11846169Shx147065 #define ALM_APMG_LARC_INT (0x00301c) 11856169Shx147065 #define ALM_APMG_LARC_INT_MSK (0x003020) 11866169Shx147065 11876169Shx147065 #define APMG_CLK_REG_VAL_DMA_CLK_RQT (0x00000200) 11886169Shx147065 #define APMG_CLK_REG_VAL_BSM_CLK_RQT (0x00000800) 11896169Shx147065 11906169Shx147065 #define APMG_PS_CTRL_REG_VAL_ALM_R_RESET_REQ (0x04000000) 11916169Shx147065 11926169Shx147065 #define APMG_DEV_STATE_REG_VAL_L1_ACTIVE_DISABLE (0x00000800) 11936169Shx147065 11946169Shx147065 #define APMG_PS_CTRL_REG_MSK_POWER_SRC (0x03000000) 11956169Shx147065 #define APMG_PS_CTRL_REG_VAL_POWER_SRC_VMAIN (0x00000000) 11966169Shx147065 #define APMG_PS_CTRL_REG_VAL_POWER_SRC_VAUX (0x01000000) 11976169Shx147065 11986169Shx147065 /* 11996169Shx147065 * BSM (bootstrap state machine) 12006169Shx147065 */ 12016169Shx147065 /* 12026169Shx147065 * start boot load now 12036169Shx147065 */ 12046169Shx147065 #define BSM_WR_CTRL_REG_BIT_START (0x80000000) 12056169Shx147065 /* 12066169Shx147065 * enable boot after power up 12076169Shx147065 */ 12086169Shx147065 #define BSM_WR_CTRL_REG_BIT_START_EN (0x40000000) 12096169Shx147065 12106169Shx147065 /* 12116169Shx147065 * DBM 12126169Shx147065 */ 12136169Shx147065 #define ALM_FH_SRVC_CHNL (6) 12146169Shx147065 12156169Shx147065 #define ALM_FH_RCSR_RX_CONFIG_REG_POS_RBDC_SIZE (20) 12166169Shx147065 #define ALM_FH_RCSR_RX_CONFIG_REG_POS_IRQ_RBTH (4) 12176169Shx147065 12186169Shx147065 #define ALM_FH_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN (0x08000000) 12196169Shx147065 12206169Shx147065 #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE (0x80000000) 12216169Shx147065 12226169Shx147065 #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE (0x20000000) 12236169Shx147065 12246169Shx147065 #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_MAX_FRAG_SIZE_128 (0x01000000) 12256169Shx147065 12266169Shx147065 #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_IRQ_DEST_INT_HOST (0x00001000) 12276169Shx147065 12286169Shx147065 #define ALM_FH_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH (0x00000000) 12296169Shx147065 12306169Shx147065 #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF (0x00000000) 12316169Shx147065 #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRIVER (0x00000001) 12326169Shx147065 12336169Shx147065 #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL (0x00000000) 12346169Shx147065 #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL (0x00000008) 12356169Shx147065 12366169Shx147065 #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD (0x00200000) 12376169Shx147065 12386169Shx147065 #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT (0x00000000) 12396169Shx147065 12406169Shx147065 #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE (0x00000000) 12416169Shx147065 #define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE (0x80000000) 12426169Shx147065 12436169Shx147065 #define ALM_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID (0x00004000) 12446169Shx147065 12456169Shx147065 #define ALM_FH_TCSR_CHNL_TX_BUF_STS_REG_BIT_TFDB_WPTR (0x00000001) 12466169Shx147065 12476169Shx147065 #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON (0xFF000000) 12486169Shx147065 #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON (0x00FF0000) 12496169Shx147065 12506169Shx147065 #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B (0x00000400) 12516169Shx147065 12526169Shx147065 #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON (0x00000100) 12536169Shx147065 #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON (0x00000080) 12546169Shx147065 12556169Shx147065 #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH (0x00000020) 12566169Shx147065 #define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH (0x00000005) 12576169Shx147065 12586169Shx147065 #define ALM_TB_MAX_BYTES_COUNT (0xFFF0) 12596169Shx147065 12606169Shx147065 #define ALM_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_channel) \ 12616169Shx147065 ((1LU << _channel) << 24) 12626169Shx147065 #define ALM_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_channel) \ 12636169Shx147065 ((1LU << _channel) << 16) 12646169Shx147065 12656169Shx147065 #define ALM_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_channel) \ 12666169Shx147065 (ALM_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_channel) | \ 12676169Shx147065 ALM_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_channel)) 12686169Shx147065 #define PCI_CFG_REV_ID_BIT_BASIC_SKU (0x40) /* bit 6 */ 12696169Shx147065 #define PCI_CFG_REV_ID_BIT_RTP (0x80) /* bit 7 */ 12706169Shx147065 12716169Shx147065 #define HBUS_TARG_MBX_C_REG_BIT_CMD_BLOCKED (0x00000004) 12726169Shx147065 12736169Shx147065 #define TFD_QUEUE_MIN 0 12746169Shx147065 #define TFD_QUEUE_MAX 6 12756169Shx147065 #define TFD_QUEUE_SIZE_MAX (256) 12766169Shx147065 12776169Shx147065 /* 12786169Shx147065 * spectrum and channel data structures 12796169Shx147065 */ 12806169Shx147065 #define IWK_NUM_SCAN_RATES (2) 12816169Shx147065 12826169Shx147065 #define IWK_SCAN_FLAG_24GHZ (1<<0) 12836169Shx147065 #define IWK_SCAN_FLAG_52GHZ (1<<1) 12846169Shx147065 #define IWK_SCAN_FLAG_ACTIVE (1<<2) 12856169Shx147065 #define IWK_SCAN_FLAG_DIRECT (1<<3) 12866169Shx147065 12876169Shx147065 #define IWK_MAX_CMD_SIZE 1024 12886169Shx147065 12896169Shx147065 #define IWK_DEFAULT_TX_RETRY 15 12906169Shx147065 #define IWK_MAX_TX_RETRY 16 12916169Shx147065 12926169Shx147065 #define RFD_SIZE 4 12936169Shx147065 #define NUM_TFD_CHUNKS 4 12946169Shx147065 12956169Shx147065 #define RX_QUEUE_SIZE 256 12966169Shx147065 #define RX_QUEUE_SIZE_LOG 8 12976169Shx147065 12986169Shx147065 /* 12996169Shx147065 * TX Queue Flag Definitions 13006169Shx147065 */ 13016169Shx147065 /* 13026169Shx147065 * use short preamble 13036169Shx147065 */ 13046169Shx147065 #define DCT_FLAG_LONG_PREAMBLE 0x00 13056169Shx147065 #define DCT_FLAG_SHORT_PREAMBLE 0x04 13066169Shx147065 13076169Shx147065 /* 13086169Shx147065 * ACK rx is expected to follow 13096169Shx147065 */ 13106169Shx147065 #define DCT_FLAG_ACK_REQD 0x80 13116169Shx147065 13126169Shx147065 #define IWK_MB_DISASSOCIATE_THRESHOLD_DEFAULT 24 13136169Shx147065 #define IWK_MB_ROAMING_THRESHOLD_DEFAULT 8 13146169Shx147065 #define IWK_REAL_RATE_RX_PACKET_THRESHOLD 300 13156169Shx147065 13166169Shx147065 /* 13176169Shx147065 * QoS definitions 13186169Shx147065 */ 13196169Shx147065 #define CW_MIN_OFDM 15 13206169Shx147065 #define CW_MAX_OFDM 1023 13216169Shx147065 #define CW_MIN_CCK 31 13226169Shx147065 #define CW_MAX_CCK 1023 13236169Shx147065 13246169Shx147065 #define QOS_TX0_CW_MIN_OFDM CW_MIN_OFDM 13256169Shx147065 #define QOS_TX1_CW_MIN_OFDM CW_MIN_OFDM 13266169Shx147065 #define QOS_TX2_CW_MIN_OFDM ((CW_MIN_OFDM + 1) / 2 - 1) 13276169Shx147065 #define QOS_TX3_CW_MIN_OFDM ((CW_MIN_OFDM + 1) / 4 - 1) 13286169Shx147065 13296169Shx147065 #define QOS_TX0_CW_MIN_CCK CW_MIN_CCK 13306169Shx147065 #define QOS_TX1_CW_MIN_CCK CW_MIN_CCK 13316169Shx147065 #define QOS_TX2_CW_MIN_CCK ((CW_MIN_CCK + 1) / 2 - 1) 13326169Shx147065 #define QOS_TX3_CW_MIN_CCK ((CW_MIN_CCK + 1) / 4 - 1) 13336169Shx147065 13346169Shx147065 #define QOS_TX0_CW_MAX_OFDM CW_MAX_OFDM 13356169Shx147065 #define QOS_TX1_CW_MAX_OFDM CW_MAX_OFDM 13366169Shx147065 #define QOS_TX2_CW_MAX_OFDM CW_MIN_OFDM 13376169Shx147065 #define QOS_TX3_CW_MAX_OFDM ((CW_MIN_OFDM + 1) / 2 - 1) 13386169Shx147065 13396169Shx147065 #define QOS_TX0_CW_MAX_CCK CW_MAX_CCK 13406169Shx147065 #define QOS_TX1_CW_MAX_CCK CW_MAX_CCK 13416169Shx147065 #define QOS_TX2_CW_MAX_CCK CW_MIN_CCK 13426169Shx147065 #define QOS_TX3_CW_MAX_CCK ((CW_MIN_CCK + 1) / 2 - 1) 13436169Shx147065 13446169Shx147065 #define QOS_TX0_AIFS (3) 13456169Shx147065 #define QOS_TX1_AIFS (7) 13466169Shx147065 #define QOS_TX2_AIFS (2) 13476169Shx147065 #define QOS_TX3_AIFS (2) 13486169Shx147065 13496169Shx147065 #define QOS_TX0_ACM 0 13506169Shx147065 #define QOS_TX1_ACM 0 13516169Shx147065 #define QOS_TX2_ACM 0 13526169Shx147065 #define QOS_TX3_ACM 0 13536169Shx147065 13546169Shx147065 #define QOS_TX0_TXOP_LIMIT_CCK 0 13556169Shx147065 #define QOS_TX1_TXOP_LIMIT_CCK 0 13566169Shx147065 #define QOS_TX2_TXOP_LIMIT_CCK 6016 13576169Shx147065 #define QOS_TX3_TXOP_LIMIT_CCK 3264 13586169Shx147065 13596169Shx147065 #define QOS_TX0_TXOP_LIMIT_OFDM 0 13606169Shx147065 #define QOS_TX1_TXOP_LIMIT_OFDM 0 13616169Shx147065 #define QOS_TX2_TXOP_LIMIT_OFDM 3008 13626169Shx147065 #define QOS_TX3_TXOP_LIMIT_OFDM 1504 13636169Shx147065 13646169Shx147065 #define DEF_TX0_CW_MIN_OFDM CW_MIN_OFDM 13656169Shx147065 #define DEF_TX1_CW_MIN_OFDM CW_MIN_OFDM 13666169Shx147065 #define DEF_TX2_CW_MIN_OFDM CW_MIN_OFDM 13676169Shx147065 #define DEF_TX3_CW_MIN_OFDM CW_MIN_OFDM 13686169Shx147065 13696169Shx147065 #define DEF_TX0_CW_MIN_CCK CW_MIN_CCK 13706169Shx147065 #define DEF_TX1_CW_MIN_CCK CW_MIN_CCK 13716169Shx147065 #define DEF_TX2_CW_MIN_CCK CW_MIN_CCK 13726169Shx147065 #define DEF_TX3_CW_MIN_CCK CW_MIN_CCK 13736169Shx147065 13746169Shx147065 #define DEF_TX0_CW_MAX_OFDM CW_MAX_OFDM 13756169Shx147065 #define DEF_TX1_CW_MAX_OFDM CW_MAX_OFDM 13766169Shx147065 #define DEF_TX2_CW_MAX_OFDM CW_MAX_OFDM 13776169Shx147065 #define DEF_TX3_CW_MAX_OFDM CW_MAX_OFDM 13786169Shx147065 13796169Shx147065 #define DEF_TX0_CW_MAX_CCK CW_MAX_CCK 13806169Shx147065 #define DEF_TX1_CW_MAX_CCK CW_MAX_CCK 13816169Shx147065 #define DEF_TX2_CW_MAX_CCK CW_MAX_CCK 13826169Shx147065 #define DEF_TX3_CW_MAX_CCK CW_MAX_CCK 13836169Shx147065 13846169Shx147065 #define DEF_TX0_AIFS (2) 13856169Shx147065 #define DEF_TX1_AIFS (2) 13866169Shx147065 #define DEF_TX2_AIFS (2) 13876169Shx147065 #define DEF_TX3_AIFS (2) 13886169Shx147065 13896169Shx147065 #define DEF_TX0_ACM (0) 13906169Shx147065 #define DEF_TX1_ACM (0) 13916169Shx147065 #define DEF_TX2_ACM (0) 13926169Shx147065 #define DEF_TX3_ACM (0) 13936169Shx147065 13946169Shx147065 #define DEF_TX0_TXOP_LIMIT_CCK (0) 13956169Shx147065 #define DEF_TX1_TXOP_LIMIT_CCK (0) 13966169Shx147065 #define DEF_TX2_TXOP_LIMIT_CCK (0) 13976169Shx147065 #define DEF_TX3_TXOP_LIMIT_CCK (0) 13986169Shx147065 13996169Shx147065 #define DEF_TX0_TXOP_LIMIT_OFDM (0) 14006169Shx147065 #define DEF_TX1_TXOP_LIMIT_OFDM (0) 14016169Shx147065 #define DEF_TX2_TXOP_LIMIT_OFDM (0) 14026169Shx147065 #define DEF_TX3_TXOP_LIMIT_OFDM (0) 14036169Shx147065 14046169Shx147065 #define QOS_QOS_SETS (3) 14056169Shx147065 #define QOS_PARAM_SET_ACTIVE (0) 14066169Shx147065 #define QOS_PARAM_SET_DEF_CCK (1) 14076169Shx147065 #define QOS_PARAM_SET_DEF_OFDM (2) 14086169Shx147065 14096169Shx147065 #define CTRL_QOS_NO_ACK (0x0020) 14106169Shx147065 #define DCT_FLAG_EXT_QOS_ENABLED (0x10) 14116169Shx147065 14126169Shx147065 #define IWK_TX_QUEUE_AC0 (0) 14136169Shx147065 #define IWK_TX_QUEUE_AC1 (1) 14146169Shx147065 #define IWK_TX_QUEUE_AC2 (2) 14156169Shx147065 #define IWK_TX_QUEUE_AC3 (3) 14166169Shx147065 #define IWK_TX_QUEUE_HCCA_1 (5) 14176169Shx147065 #define IWK_TX_QUEUE_HCCA_2 (6) 14186169Shx147065 14196169Shx147065 #define U32_PAD(n) ((4-(n%4))%4) 14206169Shx147065 14216169Shx147065 #define AC_BE_TID_MASK 0x9 /* TID 0 and 3 */ 14226169Shx147065 #define AC_BK_TID_MASK 0x6 /* TID 1 and 2 */ 14236169Shx147065 14246169Shx147065 /* 14256169Shx147065 * Generic queue structure 14266169Shx147065 * 14276169Shx147065 * Contains common data for Rx and Tx queues 14286169Shx147065 */ 14296169Shx147065 #define TFD_CTL_COUNT_SET(n) (n<<24) 14306169Shx147065 #define TFD_CTL_COUNT_GET(ctl) ((ctl>>24) & 7) 14316169Shx147065 #define TFD_CTL_PAD_SET(n) (n<<28) 14326169Shx147065 #define TFD_CTL_PAD_GET(ctl) (ctl>>28) 14336169Shx147065 14346169Shx147065 #define TFD_TX_CMD_SLOTS 64 14356169Shx147065 #define TFD_CMD_SLOTS 32 14366169Shx147065 14376169Shx147065 /* 14386169Shx147065 * Tx/Rx Queues 14396169Shx147065 * 14406169Shx147065 * Most communication between driver and 4965 is via queues of data buffers. 14416169Shx147065 * For example, all commands that the driver issues to device's embedded 14426169Shx147065 * controller (uCode) are via the command queue (one of the Tx queues). All 14436169Shx147065 * uCode command responses/replies/notifications, including Rx frames, are 14446169Shx147065 * conveyed from uCode to driver via the Rx queue. 14456169Shx147065 * 14466169Shx147065 * Most support for these queues, including handshake support, resides in 14476169Shx147065 * structures in host DRAM, shared between the driver and the device. When 14486169Shx147065 * allocating this memory, the driver must make sure that data written by 14496169Shx147065 * the host CPU updates DRAM immediately (and does not get "stuck" in CPU's 14506169Shx147065 * cache memory), so DRAM and cache are consistent, and the device can 14516169Shx147065 * immediately see changes made by the driver. 14526169Shx147065 * 14536169Shx147065 * 4965 supports up to 16 DRAM-based Tx queues, and services these queues via 14546169Shx147065 * up to 7 DMA channels (FIFOs). Each Tx queue is supported by a circular array 14556169Shx147065 * in DRAM containing 256 Transmit Frame Descriptors (TFDs). 14566169Shx147065 */ 14576169Shx147065 #define IWK_MAX_WIN_SIZE 64 14586169Shx147065 #define IWK_QUEUE_SIZE 256 14596169Shx147065 #define IWK_NUM_FIFOS 7 14606795Shx147065 #define IWK_NUM_QUEUES 6 14616169Shx147065 #define IWK_CMD_QUEUE_NUM 4 14626169Shx147065 #define IWK_KW_SIZE 0x1000 /* 4k */ 14636169Shx147065 14646169Shx147065 struct iwk_rate { 14656169Shx147065 union { 14666169Shx147065 struct { 14676169Shx147065 uint8_t rate; 14686169Shx147065 uint8_t flags; 14696169Shx147065 uint16_t ext_flags; 14706169Shx147065 } s; 14716169Shx147065 uint32_t rate_n_flags; 14726169Shx147065 } r; 14736169Shx147065 }; 14746169Shx147065 14756169Shx147065 struct iwk_dram_scratch { 14766169Shx147065 uint8_t try_cnt; 14776169Shx147065 uint8_t bt_kill_cnt; 14786169Shx147065 uint16_t reserved; 14796169Shx147065 }; 14806169Shx147065 14816169Shx147065 /* 14826169Shx147065 * START TEMPERATURE 14836169Shx147065 */ 14846169Shx147065 /* 14856169Shx147065 * 4965 temperature calculation. 14866169Shx147065 * 14876169Shx147065 * The driver must calculate the device temperature before calculating 14886169Shx147065 * a txpower setting (amplifier gain is temperature dependent). The 14896169Shx147065 * calculation uses 4 measurements, 3 of which (R1, R2, R3) are calibration 14906169Shx147065 * values used for the life of the driver, and one of which (R4) is the 14916169Shx147065 * real-time temperature indicator. 14926169Shx147065 * 14936169Shx147065 * uCode provides all 4 values to the driver via the "initialize alive" 14946169Shx147065 * notification (see struct iwk_init_alive_resp). After the runtime uCode 14956169Shx147065 * image loads, uCode updates the R4 value via statistics notifications 14966169Shx147065 * (see STATISTICS_NOTIFICATION), which occur after each received beacon 14976169Shx147065 * when associated, or can be requested via REPLY_STATISTICS_CMD. 14986169Shx147065 * 14996169Shx147065 * NOTE: uCode provides the R4 value as a 23-bit signed value. Driver 15006169Shx147065 * must sign-extend to 32 bits before applying formula below. 15016169Shx147065 * 15026169Shx147065 * Formula: 15036169Shx147065 * 15046169Shx147065 * degrees Kelvin = ((97 * 259 * (R4 - R2) / (R3 - R1)) / 100) + 8 15056169Shx147065 * 15066169Shx147065 * NOTE: The basic formula is 259 * (R4-R2) / (R3-R1). The 97/100 is 15076169Shx147065 * an additional correction, which should be centered around 0 degrees 15086169Shx147065 * Celsius (273 degrees Kelvin). The 8 (3 percent of 273) compensates for 15096169Shx147065 * centering the 97/100 correction around 0 degrees K. 15106169Shx147065 * 15116169Shx147065 * Add 273 to Kelvin value to find degrees Celsius, for comparing current 15126169Shx147065 * temperature with factory-measured temperatures when calculating txpower 15136169Shx147065 * settings. 15146169Shx147065 */ 15156169Shx147065 #define TEMPERATURE_CALIB_KELVIN_OFFSET 8 15166169Shx147065 #define TEMPERATURE_CALIB_A_VAL 259 15176169Shx147065 15186169Shx147065 /* 15196169Shx147065 * Limit range of calculated temperature to be between these Kelvin values 15206169Shx147065 */ 15216169Shx147065 #define IWK_TX_POWER_TEMPERATURE_MIN (263) 15226169Shx147065 #define IWK_TX_POWER_TEMPERATURE_MAX (410) 15236169Shx147065 15246169Shx147065 #define IWK_TX_POWER_TEMPERATURE_OUT_OF_RANGE(t) \ 15256169Shx147065 (((t) < IWK_TX_POWER_TEMPERATURE_MIN) || \ 15266169Shx147065 ((t) > IWK_TX_POWER_TEMPERATURE_MAX)) 15276169Shx147065 15286169Shx147065 /* 15296169Shx147065 * END TEMPERATURE 15306169Shx147065 */ 15316169Shx147065 15326169Shx147065 /* 15336169Shx147065 * START TXPOWER 15346169Shx147065 */ 15356169Shx147065 /* 15366169Shx147065 * 4965 txpower calculations rely on information from three sources: 15376169Shx147065 * 15386169Shx147065 * 1) EEPROM 15396169Shx147065 * 2) "initialize" alive notification 15406169Shx147065 * 3) statistics notifications 15416169Shx147065 * 15426169Shx147065 * EEPROM data consists of: 15436169Shx147065 * 15446169Shx147065 * 1) Regulatory information (max txpower and channel usage flags) is provided 15456169Shx147065 * separately for each channel that can possibly supported by 4965. 15466169Shx147065 * 40 MHz wide (.11n fat) channels are listed separately from 20 MHz 15476169Shx147065 * (legacy) channels. 15486169Shx147065 * 15496169Shx147065 * See struct iwk_eeprom_channel for format, and struct iwk_eeprom for 15506169Shx147065 * locations in EEPROM. 15516169Shx147065 * 15526169Shx147065 * 2) Factory txpower calibration information is provided separately for 15536169Shx147065 * sub-bands of contiguous channels. 2.4GHz has just one sub-band, 15546169Shx147065 * but 5 GHz has several sub-bands. 15556169Shx147065 * 15566169Shx147065 * In addition, per-band (2.4 and 5 Ghz) saturation txpowers are provided. 15576169Shx147065 * 15586169Shx147065 * See struct iwk_eeprom_calib_info (and the tree of structures contained 15596169Shx147065 * within it) for format, and struct iwk_eeprom for locations in EEPROM. 15606169Shx147065 * 15616169Shx147065 * "Initialization alive" notification (see struct iwk_init_alive_resp) 15626169Shx147065 * consists of: 15636169Shx147065 * 15646169Shx147065 * 1) Temperature calculation parameters. 15656169Shx147065 * 15666169Shx147065 * 2) Power supply voltage measurement. 15676169Shx147065 * 15686169Shx147065 * 3) Tx gain compensation to balance 2 transmitters for MIMO use. 15696169Shx147065 * 15706169Shx147065 * Statistics notifications deliver: 15716169Shx147065 * 15726169Shx147065 * 1) Current values for temperature param R4. 15736169Shx147065 */ 15746169Shx147065 15756169Shx147065 /* 15766169Shx147065 * To calculate a txpower setting for a given desired target txpower, channel, 15776169Shx147065 * modulation bit rate, and transmitter chain (4965 has 2 transmitters to 15786169Shx147065 * support MIMO and transmit diversity), driver must do the following: 15796169Shx147065 * 15806169Shx147065 * 1) Compare desired txpower vs. (EEPROM) regulatory limit for this channel. 15816169Shx147065 * Do not exceed regulatory limit; reduce target txpower if necessary. 15826169Shx147065 * 15836169Shx147065 * If setting up txpowers for MIMO rates (rate indexes 8-15, 24-31), 15846169Shx147065 * 2 transmitters will be used simultaneously; driver must reduce the 15856169Shx147065 * regulatory limit by 3 dB (half-power) for each transmitter, so the 15866169Shx147065 * combined total output of the 2 transmitters is within regulatory limits. 15876169Shx147065 * 15886169Shx147065 * 15896169Shx147065 * 2) Compare target txpower vs. (EEPROM) saturation txpower *reduced by 15906169Shx147065 * backoff for this bit rate*. Do not exceed (saturation - backoff[rate]); 15916169Shx147065 * reduce target txpower if necessary. 15926169Shx147065 * 15936169Shx147065 * Backoff values below are in 1/2 dB units (equivalent to steps in 15946169Shx147065 * txpower gain tables): 15956169Shx147065 * 15966169Shx147065 * OFDM 6 - 36 MBit: 10 steps (5 dB) 15976169Shx147065 * OFDM 48 MBit: 15 steps (7.5 dB) 15986169Shx147065 * OFDM 54 MBit: 17 steps (8.5 dB) 15996169Shx147065 * OFDM 60 MBit: 20 steps (10 dB) 16006169Shx147065 * CCK all rates: 10 steps (5 dB) 16016169Shx147065 * 16026169Shx147065 * Backoff values apply to saturation txpower on a per-transmitter basis; 16036169Shx147065 * when using MIMO (2 transmitters), each transmitter uses the same 16046169Shx147065 * saturation level provided in EEPROM, and the same backoff values; 16056169Shx147065 * no reduction (such as with regulatory txpower limits) is required. 16066169Shx147065 * 16076169Shx147065 * Saturation and Backoff values apply equally to 20 Mhz (legacy) channel 16086169Shx147065 * widths and 40 Mhz (.11n fat) channel widths; there is no separate 16096169Shx147065 * factory measurement for fat channels. 16106169Shx147065 * 16116169Shx147065 * The result of this step is the final target txpower. The rest of 16126169Shx147065 * the steps figure out the proper settings for the device. 16136169Shx147065 * 16146169Shx147065 * 16156169Shx147065 * 3) Determine (EEPROM) calibration subband for the target channel, by 16166169Shx147065 * comparing against first and last channels in each subband 16176169Shx147065 * (see struct iwk_eeprom_calib_subband_info). 16186169Shx147065 * 16196169Shx147065 * 16206169Shx147065 * 4) Linearly interpolate (EEPROM) factory calibration measurement sets, 16216169Shx147065 * referencing the 2 factory-measured (sample) channels within the subband. 16226169Shx147065 * 16236169Shx147065 * Interpolation is based on difference between target channel's frequency 16246169Shx147065 * and the sample channels' frequencies. Since channel numbers are based 16256169Shx147065 * on frequency (5 MHz between each channel number), this is equivalent 16266169Shx147065 * to interpolating based on channel number differences. 16276169Shx147065 * 16286169Shx147065 * Note that the sample channels may or may not be the channels at the 16296169Shx147065 * edges of the subband. The target channel may be "outside" of the 16306169Shx147065 * span of the sampled channels. 16316169Shx147065 * 16326169Shx147065 * Driver may choose the pair (for 2 Tx chains) of measurements (see 16336169Shx147065 * struct iwk_eeprom_calib_ch_info) for which the actual measured 16346169Shx147065 * txpower comes closest to the desired txpower. Usually, though, 16356169Shx147065 * the middle set of measurements is closest to the regulatory limits, 16366169Shx147065 * and is therefore a good choice for all txpower calculations. 16376169Shx147065 * 16386169Shx147065 * Driver should interpolate both members of the chosen measurement pair, 16396169Shx147065 * i.e. for both Tx chains (radio transmitters), unless the driver knows 16406169Shx147065 * that only one of the chains will be used (e.g. only one tx antenna 16416169Shx147065 * connected, but this should be unusual). 16426169Shx147065 * 16436169Shx147065 * Driver should interpolate factory values for temperature, gain table 16446169Shx147065 * index, and actual power. The power amplifier detector values are 16456169Shx147065 * not used by the driver. 16466169Shx147065 * 16476169Shx147065 * If the target channel happens to be one of the sample channels, the 16486169Shx147065 * results should agree with the sample channel's measurements! 16496169Shx147065 * 16506169Shx147065 * 16516169Shx147065 * 5) Find difference between desired txpower and (interpolated) 16526169Shx147065 * factory-measured txpower. Using (interpolated) factory gain table index 16536169Shx147065 * as a starting point, adjust this index lower to increase txpower, 16546169Shx147065 * or higher to decrease txpower, until the target txpower is reached. 16556169Shx147065 * Each step in the gain table is 1/2 dB. 16566169Shx147065 * 16576169Shx147065 * For example, if factory measured txpower is 16 dBm, and target txpower 16586169Shx147065 * is 13 dBm, add 6 steps to the factory gain index to reduce txpower 16596169Shx147065 * by 3 dB. 16606169Shx147065 * 16616169Shx147065 * 16626169Shx147065 * 6) Find difference between current device temperature and (interpolated) 16636169Shx147065 * factory-measured temperature for sub-band. Factory values are in 16646169Shx147065 * degrees Celsius. To calculate current temperature, see comments for 16656169Shx147065 * "4965 temperature calculation". 16666169Shx147065 * 16676169Shx147065 * If current temperature is higher than factory temperature, driver must 16686169Shx147065 * increase gain (lower gain table index), and vice versa. 16696169Shx147065 * 16706169Shx147065 * Temperature affects gain differently for different channels: 16716169Shx147065 * 16726169Shx147065 * 2.4 GHz all channels: 3.5 degrees per half-dB step 16736169Shx147065 * 5 GHz channels 34-43: 4.5 degrees per half-dB step 16746169Shx147065 * 5 GHz channels >= 44: 4.0 degrees per half-dB step 16756169Shx147065 * 16766169Shx147065 * NOTE: Temperature can increase rapidly when transmitting, especially 16776169Shx147065 * with heavy traffic at high txpowers. Driver should update 16786169Shx147065 * temperature calculations often under these conditions to 16796169Shx147065 * maintain strong txpower in the face of rising temperature. 16806169Shx147065 * 16816169Shx147065 * 16826169Shx147065 * 7) Find difference between current power supply voltage indicator 16836169Shx147065 * (from "initialize alive") and factory-measured power supply voltage 16846169Shx147065 * indicator (EEPROM). 16856169Shx147065 * 16866169Shx147065 * If the current voltage is higher (indicator is lower) than factory 16876169Shx147065 * voltage, gain should be reduced (gain table index increased) by: 16886169Shx147065 * 16896169Shx147065 * (eeprom - current) / 7 16906169Shx147065 * 16916169Shx147065 * If the current voltage is lower (indicator is higher) than factory 16926169Shx147065 * voltage, gain should be increased (gain table index decreased) by: 16936169Shx147065 * 16946169Shx147065 * 2 * (current - eeprom) / 7 16956169Shx147065 * 16966169Shx147065 * If number of index steps in either direction turns out to be > 2, 16976169Shx147065 * something is wrong ... just use 0. 16986169Shx147065 * 16996169Shx147065 * NOTE: Voltage compensation is independent of band/channel. 17006169Shx147065 * 17016169Shx147065 * NOTE: "Initialize" uCode measures current voltage, which is assumed 17026169Shx147065 * to be constant after this initial measurement. Voltage 17036169Shx147065 * compensation for txpower (number of steps in gain table) 17046169Shx147065 * may be calculated once and used until the next uCode bootload. 17056169Shx147065 * 17066169Shx147065 * 17076169Shx147065 * 8) If setting up txpowers for MIMO rates (rate indexes 8-15, 24-31), 17086169Shx147065 * adjust txpower for each transmitter chain, so txpower is balanced 17096169Shx147065 * between the two chains. There are 5 pairs of tx_atten[group][chain] 17106169Shx147065 * values in "initialize alive", one pair for each of 5 channel ranges: 17116169Shx147065 * 17126169Shx147065 * Group 0: 5 GHz channel 34-43 17136169Shx147065 * Group 1: 5 GHz channel 44-70 17146169Shx147065 * Group 2: 5 GHz channel 71-124 17156169Shx147065 * Group 3: 5 GHz channel 125-200 17166169Shx147065 * Group 4: 2.4 GHz all channels 17176169Shx147065 * 17186169Shx147065 * Add the tx_atten[group][chain] value to the index for the target chain. 17196169Shx147065 * The values are signed, but are in pairs of 0 and a non-negative number, 17206169Shx147065 * so as to reduce gain (if necessary) of the "hotter" channel. This 17216169Shx147065 * avoids any need to double-check for regulatory compliance after 17226169Shx147065 * this step. 17236169Shx147065 * 17246169Shx147065 * 17256169Shx147065 * 9) If setting up for a CCK rate, lower the gain by adding a CCK compensation 17266169Shx147065 * value to the index: 17276169Shx147065 * 17286169Shx147065 * Hardware rev B: 9 steps (4.5 dB) 17296169Shx147065 * Hardware rev C: 5 steps (2.5 dB) 17306169Shx147065 * 17316169Shx147065 * Hardware rev for 4965 can be determined by reading CSR_HW_REV_WA_REG, 17326169Shx147065 * bits [3:2], 1 = B, 2 = C. 17336169Shx147065 * 17346169Shx147065 * NOTE: This compensation is in addition to any saturation backoff that 17356169Shx147065 * might have been applied in an earlier step. 17366169Shx147065 * 17376169Shx147065 * 17386169Shx147065 * 10) Select the gain table, based on band (2.4 vs 5 GHz). 17396169Shx147065 * 17406169Shx147065 * Limit the adjusted index to stay within the table! 17416169Shx147065 * 17426169Shx147065 * 17436169Shx147065 * 11) Read gain table entries for DSP and radio gain, place into appropriate 17446169Shx147065 * location(s) in command. 17456169Shx147065 */ 17466169Shx147065 17476169Shx147065 enum { 17486169Shx147065 HT_IE_EXT_CHANNEL_NONE = 0, 17496169Shx147065 HT_IE_EXT_CHANNEL_ABOVE, 17506169Shx147065 HT_IE_EXT_CHANNEL_INVALID, 17516169Shx147065 HT_IE_EXT_CHANNEL_BELOW, 17526169Shx147065 HT_IE_EXT_CHANNEL_MAX 17536169Shx147065 }; 17546169Shx147065 17556169Shx147065 enum { 17566169Shx147065 CALIB_CH_GROUP_1 = 0, 17576169Shx147065 CALIB_CH_GROUP_2 = 1, 17586169Shx147065 CALIB_CH_GROUP_3 = 2, 17596169Shx147065 CALIB_CH_GROUP_4 = 3, 17606169Shx147065 CALIB_CH_GROUP_5 = 4, 17616169Shx147065 CALIB_CH_GROUP_MAX 17626169Shx147065 }; 17636169Shx147065 17646169Shx147065 #define POWER_TABLE_NUM_HT_OFDM_ENTRIES (32) 17656169Shx147065 17666169Shx147065 /* 17676169Shx147065 * Temperature calibration offset is 3% 0C in Kelvin 17686169Shx147065 */ 17696169Shx147065 #define TEMPERATURE_CALIB_KELVIN_OFFSET 8 17706169Shx147065 #define TEMPERATURE_CALIB_A_VAL 259 17716169Shx147065 17726169Shx147065 #define IWK_TX_POWER_TEMPERATURE_MIN (263) 17736169Shx147065 #define IWK_TX_POWER_TEMPERATURE_MAX (410) 17746169Shx147065 17756169Shx147065 #define IWK_TX_POWER_TEMPERATURE_OUT_OF_RANGE(t) \ 17766169Shx147065 (((t) < IWK_TX_POWER_TEMPERATURE_MIN) || \ 17776169Shx147065 ((t) > IWK_TX_POWER_TEMPERATURE_MAX)) 17786169Shx147065 17796169Shx147065 #define IWK_TX_POWER_ILLEGAL_TEMPERATURE (300) 17806169Shx147065 17816169Shx147065 #define IWK_TX_POWER_TEMPERATURE_DIFFERENCE (2) 17826169Shx147065 17836169Shx147065 /* 17846169Shx147065 * When MIMO is used (2 transmitters operating simultaneously), driver should 17856169Shx147065 * limit each transmitter to deliver a max of 3 dB below the regulatory limit 17866169Shx147065 * for the device. That is, half power for each transmitter, so total power 17876169Shx147065 * is within regulatory limits. 17886169Shx147065 * 17896169Shx147065 * The value "6" represents number of steps in gain table to reduce power. 17906169Shx147065 * Each step is 1/2 dB. 17916169Shx147065 */ 17926169Shx147065 #define IWK_TX_POWER_MIMO_REGULATORY_COMPENSATION (6) 17936169Shx147065 17946169Shx147065 /* 17956169Shx147065 * Limit range of txpower output target to be between these values 17966169Shx147065 */ 17976169Shx147065 #define IWK_TX_POWER_TARGET_POWER_MIN (0) /* 0 dBm = 1 milliwatt */ 17986169Shx147065 #define IWK_TX_POWER_TARGET_POWER_MAX (16) /* 16 dBm */ 17996169Shx147065 18006169Shx147065 /* 18016169Shx147065 * timeout equivalent to 3 minutes 18026169Shx147065 */ 18036169Shx147065 #define IWK_TX_POWER_TIMELIMIT_NOCALIB 1800000000 18046169Shx147065 18056169Shx147065 /* 18066169Shx147065 * CCK gain compensation. 18076169Shx147065 * 18086169Shx147065 * When calculating txpowers for CCK, after making sure that the target power 18096169Shx147065 * is within regulatory and saturation limits, driver must additionally 18106169Shx147065 * back off gain by adding these values to the gain table index. 18116169Shx147065 */ 18126169Shx147065 #define IWK_TX_POWER_CCK_COMPENSATION (9) 18136169Shx147065 #define IWK_TX_POWER_CCK_COMPENSATION_B_STEP (9) 18146169Shx147065 #define IWK_TX_POWER_CCK_COMPENSATION_C_STEP (5) 18156169Shx147065 18166169Shx147065 /* 18176169Shx147065 * 4965 power supply voltage compensation 18186169Shx147065 */ 18196169Shx147065 #define TX_POWER_IWK_VOLTAGE_CODES_PER_03V (7) 18206169Shx147065 18216169Shx147065 /* 18226169Shx147065 * Gain tables. 18236169Shx147065 * 18246169Shx147065 * The following tables contain pair of values for setting txpower, i.e. 18256169Shx147065 * gain settings for the output of the device's digital signal processor (DSP), 18266169Shx147065 * and for the analog gain structure of the transmitter. 18276169Shx147065 * 18286169Shx147065 * Each entry in the gain tables represents a step of 1/2 dB. Note that these 18296169Shx147065 * are *relative* steps, not indications of absolute output power. Output 18306169Shx147065 * power varies with temperature, voltage, and channel frequency, and also 18316169Shx147065 * requires consideration of average power (to satisfy regulatory constraints), 18326169Shx147065 * and peak power (to avoid distortion of the output signal). 18336169Shx147065 * 18346169Shx147065 * Each entry contains two values: 18356169Shx147065 * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained 18366169Shx147065 * linear value that multiplies the output of the digital signal processor, 18376169Shx147065 * before being sent to the analog radio. 18386169Shx147065 * 2) Radio gain. This sets the analog gain of the radio Tx path. 18396169Shx147065 * It is a coarser setting, and behaves in a logarithmic (dB) fashion. 18406169Shx147065 * 18416169Shx147065 * EEPROM contains factory calibration data for txpower. This maps actual 18426169Shx147065 * measured txpower levels to gain settings in the "well known" tables 18436169Shx147065 * below ("well-known" means here that both factory calibration *and* the 18446169Shx147065 * driver work with the same table). 18456169Shx147065 * 18466169Shx147065 * There are separate tables for 2.4 GHz and 5 GHz bands. The 5 GHz table 18476169Shx147065 * has an extension (into negative indexes), in case the driver needs to 18486169Shx147065 * boost power setting for high device temperatures (higher than would be 18496169Shx147065 * present during factory calibration). A 5 Ghz EEPROM index of "40" 18506169Shx147065 * corresponds to the 49th entry in the table used by the driver. 18516169Shx147065 */ 18526169Shx147065 #define MIN_TX_GAIN_INDEX (0) 18536169Shx147065 #define MIN_TX_GAIN_INDEX_52GHZ_EXT (-9) 18546169Shx147065 #define MAX_TX_GAIN_INDEX_52GHZ (98) 18556169Shx147065 #define MIN_TX_GAIN_52GHZ (98) 18566169Shx147065 #define MAX_TX_GAIN_INDEX_24GHZ (98) 18576169Shx147065 #define MIN_TX_GAIN_24GHZ (98) 18586169Shx147065 #define MAX_TX_GAIN (0) 18596169Shx147065 #define MAX_TX_GAIN_52GHZ_EXT (-9) 18606169Shx147065 18616169Shx147065 /* 18626169Shx147065 * 2.4 GHz gain table 18636169Shx147065 * 18646169Shx147065 * Index Dsp gain Radio gain 18656169Shx147065 * 0 110 0x3f 18666169Shx147065 * 1 104 0x3f 18676169Shx147065 * 2 98 0x3f 18686169Shx147065 * 3 110 0x3e 18696169Shx147065 * 4 104 0x3e 18706169Shx147065 * 5 98 0x3e 18716169Shx147065 * 6 110 0x3d 18726169Shx147065 * 7 104 0x3d 18736169Shx147065 * 8 98 0x3d 18746169Shx147065 * 9 110 0x3c 18756169Shx147065 * 10 104 0x3c 18766169Shx147065 * 11 98 0x3c 18776169Shx147065 * 12 110 0x3b 18786169Shx147065 * 13 104 0x3b 18796169Shx147065 * 14 98 0x3b 18806169Shx147065 * 15 110 0x3a 18816169Shx147065 * 16 104 0x3a 18826169Shx147065 * 17 98 0x3a 18836169Shx147065 * 18 110 0x39 18846169Shx147065 * 19 104 0x39 18856169Shx147065 * 20 98 0x39 18866169Shx147065 * 21 110 0x38 18876169Shx147065 * 22 104 0x38 18886169Shx147065 * 23 98 0x38 18896169Shx147065 * 24 110 0x37 18906169Shx147065 * 25 104 0x37 18916169Shx147065 * 26 98 0x37 18926169Shx147065 * 27 110 0x36 18936169Shx147065 * 28 104 0x36 18946169Shx147065 * 29 98 0x36 18956169Shx147065 * 30 110 0x35 18966169Shx147065 * 31 104 0x35 18976169Shx147065 * 32 98 0x35 18986169Shx147065 * 33 110 0x34 18996169Shx147065 * 34 104 0x34 19006169Shx147065 * 35 98 0x34 19016169Shx147065 * 36 110 0x33 19026169Shx147065 * 37 104 0x33 19036169Shx147065 * 38 98 0x33 19046169Shx147065 * 39 110 0x32 19056169Shx147065 * 40 104 0x32 19066169Shx147065 * 41 98 0x32 19076169Shx147065 * 42 110 0x31 19086169Shx147065 * 43 104 0x31 19096169Shx147065 * 44 98 0x31 19106169Shx147065 * 45 110 0x30 19116169Shx147065 * 46 104 0x30 19126169Shx147065 * 47 98 0x30 19136169Shx147065 * 48 110 0x6 19146169Shx147065 * 49 104 0x6 19156169Shx147065 * 50 98 0x6 19166169Shx147065 * 51 110 0x5 19176169Shx147065 * 52 104 0x5 19186169Shx147065 * 53 98 0x5 19196169Shx147065 * 54 110 0x4 19206169Shx147065 * 55 104 0x4 19216169Shx147065 * 56 98 0x4 19226169Shx147065 * 57 110 0x3 19236169Shx147065 * 58 104 0x3 19246169Shx147065 * 59 98 0x3 19256169Shx147065 * 60 110 0x2 19266169Shx147065 * 61 104 0x2 19276169Shx147065 * 62 98 0x2 19286169Shx147065 * 63 110 0x1 19296169Shx147065 * 64 104 0x1 19306169Shx147065 * 65 98 0x1 19316169Shx147065 * 66 110 0x0 19326169Shx147065 * 67 104 0x0 19336169Shx147065 * 68 98 0x0 19346169Shx147065 * 69 97 0 19356169Shx147065 * 70 96 0 19366169Shx147065 * 71 95 0 19376169Shx147065 * 72 94 0 19386169Shx147065 * 73 93 0 19396169Shx147065 * 74 92 0 19406169Shx147065 * 75 91 0 19416169Shx147065 * 76 90 0 19426169Shx147065 * 77 89 0 19436169Shx147065 * 78 88 0 19446169Shx147065 * 79 87 0 19456169Shx147065 * 80 86 0 19466169Shx147065 * 81 85 0 19476169Shx147065 * 82 84 0 19486169Shx147065 * 83 83 0 19496169Shx147065 * 84 82 0 19506169Shx147065 * 85 81 0 19516169Shx147065 * 86 80 0 19526169Shx147065 * 87 79 0 19536169Shx147065 * 88 78 0 19546169Shx147065 * 89 77 0 19556169Shx147065 * 90 76 0 19566169Shx147065 * 91 75 0 19576169Shx147065 * 92 74 0 19586169Shx147065 * 93 73 0 19596169Shx147065 * 94 72 0 19606169Shx147065 * 95 71 0 19616169Shx147065 * 96 70 0 19626169Shx147065 * 97 69 0 19636169Shx147065 * 98 68 0 19646169Shx147065 */ 19656169Shx147065 19666169Shx147065 /* 19676169Shx147065 * 5 GHz gain table 19686169Shx147065 * 19696169Shx147065 * Index Dsp gain Radio gain 19706169Shx147065 * -9 123 0x3F 19716169Shx147065 * -8 117 0x3F 19726169Shx147065 * -7 110 0x3F 19736169Shx147065 * -6 104 0x3F 19746169Shx147065 * -5 98 0x3F 19756169Shx147065 * -4 110 0x3E 19766169Shx147065 * -3 104 0x3E 19776169Shx147065 * -2 98 0x3E 19786169Shx147065 * -1 110 0x3D 19796169Shx147065 * 0 104 0x3D 19806169Shx147065 * 1 98 0x3D 19816169Shx147065 * 2 110 0x3C 19826169Shx147065 * 3 104 0x3C 19836169Shx147065 * 4 98 0x3C 19846169Shx147065 * 5 110 0x3B 19856169Shx147065 * 6 104 0x3B 19866169Shx147065 * 7 98 0x3B 19876169Shx147065 * 8 110 0x3A 19886169Shx147065 * 9 104 0x3A 19896169Shx147065 * 10 98 0x3A 19906169Shx147065 * 11 110 0x39 19916169Shx147065 * 12 104 0x39 19926169Shx147065 * 13 98 0x39 19936169Shx147065 * 14 110 0x38 19946169Shx147065 * 15 104 0x38 19956169Shx147065 * 16 98 0x38 19966169Shx147065 * 17 110 0x37 19976169Shx147065 * 18 104 0x37 19986169Shx147065 * 19 98 0x37 19996169Shx147065 * 20 110 0x36 20006169Shx147065 * 21 104 0x36 20016169Shx147065 * 22 98 0x36 20026169Shx147065 * 23 110 0x35 20036169Shx147065 * 24 104 0x35 20046169Shx147065 * 25 98 0x35 20056169Shx147065 * 26 110 0x34 20066169Shx147065 * 27 104 0x34 20076169Shx147065 * 28 98 0x34 20086169Shx147065 * 29 110 0x33 20096169Shx147065 * 30 104 0x33 20106169Shx147065 * 31 98 0x33 20116169Shx147065 * 32 110 0x32 20126169Shx147065 * 33 104 0x32 20136169Shx147065 * 34 98 0x32 20146169Shx147065 * 35 110 0x31 20156169Shx147065 * 36 104 0x31 20166169Shx147065 * 37 98 0x31 20176169Shx147065 * 38 110 0x30 20186169Shx147065 * 39 104 0x30 20196169Shx147065 * 40 98 0x30 20206169Shx147065 * 41 110 0x25 20216169Shx147065 * 42 104 0x25 20226169Shx147065 * 43 98 0x25 20236169Shx147065 * 44 110 0x24 20246169Shx147065 * 45 104 0x24 20256169Shx147065 * 46 98 0x24 20266169Shx147065 * 47 110 0x23 20276169Shx147065 * 48 104 0x23 20286169Shx147065 * 49 98 0x23 20296169Shx147065 * 50 110 0x22 20306169Shx147065 * 51 104 0x18 20316169Shx147065 * 52 98 0x18 20326169Shx147065 * 53 110 0x17 20336169Shx147065 * 54 104 0x17 20346169Shx147065 * 55 98 0x17 20356169Shx147065 * 56 110 0x16 20366169Shx147065 * 57 104 0x16 20376169Shx147065 * 58 98 0x16 20386169Shx147065 * 59 110 0x15 20396169Shx147065 * 60 104 0x15 20406169Shx147065 * 61 98 0x15 20416169Shx147065 * 62 110 0x14 20426169Shx147065 * 63 104 0x14 20436169Shx147065 * 64 98 0x14 20446169Shx147065 * 65 110 0x13 20456169Shx147065 * 66 104 0x13 20466169Shx147065 * 67 98 0x13 20476169Shx147065 * 68 110 0x12 20486169Shx147065 * 69 104 0x08 20496169Shx147065 * 70 98 0x08 20506169Shx147065 * 71 110 0x07 20516169Shx147065 * 72 104 0x07 20526169Shx147065 * 73 98 0x07 20536169Shx147065 * 74 110 0x06 20546169Shx147065 * 75 104 0x06 20556169Shx147065 * 76 98 0x06 20566169Shx147065 * 77 110 0x05 20576169Shx147065 * 78 104 0x05 20586169Shx147065 * 79 98 0x05 20596169Shx147065 * 80 110 0x04 20606169Shx147065 * 81 104 0x04 20616169Shx147065 * 82 98 0x04 20626169Shx147065 * 83 110 0x03 20636169Shx147065 * 84 104 0x03 20646169Shx147065 * 85 98 0x03 20656169Shx147065 * 86 110 0x02 20666169Shx147065 * 87 104 0x02 20676169Shx147065 * 88 98 0x02 20686169Shx147065 * 89 110 0x01 20696169Shx147065 * 90 104 0x01 20706169Shx147065 * 91 98 0x01 20716169Shx147065 * 92 110 0x00 20726169Shx147065 * 93 104 0x00 20736169Shx147065 * 94 98 0x00 20746169Shx147065 * 95 93 0x00 20756169Shx147065 * 96 88 0x00 20766169Shx147065 * 97 83 0x00 20776169Shx147065 * 98 78 0x00 20786169Shx147065 */ 20796169Shx147065 20806169Shx147065 /* 20816169Shx147065 * Sanity checks and default values for EEPROM regulatory levels. 20826169Shx147065 * If EEPROM values fall outside MIN/MAX range, use default values. 20836169Shx147065 * 20846169Shx147065 * Regulatory limits refer to the maximum average txpower allowed by 20856169Shx147065 * regulatory agencies in the geographies in which the device is meant 20866169Shx147065 * to be operated. These limits are SKU-specific (i.e. geography-specific), 20876169Shx147065 * and channel-specific; each channel has an individual regulatory limit 20886169Shx147065 * listed in the EEPROM. 20896169Shx147065 * 20906169Shx147065 * Units are in half-dBm (i.e. "34" means 17 dBm). 20916169Shx147065 */ 20926169Shx147065 #define IWK_TX_POWER_DEFAULT_REGULATORY_24 (34) 20936169Shx147065 #define IWK_TX_POWER_DEFAULT_REGULATORY_52 (34) 20946169Shx147065 #define IWK_TX_POWER_REGULATORY_MIN (0) 20956169Shx147065 #define IWK_TX_POWER_REGULATORY_MAX (34) 20966169Shx147065 20976169Shx147065 /* 20986169Shx147065 * Sanity checks and default values for EEPROM saturation levels. 20996169Shx147065 * If EEPROM values fall outside MIN/MAX range, use default values. 21006169Shx147065 * 21016169Shx147065 * Saturation is the highest level that the output power amplifier can produce 21026169Shx147065 * without significant clipping distortion. This is a "peak" power level. 21036169Shx147065 * Different types of modulation (i.e. various "rates", and OFDM vs. CCK) 21046169Shx147065 * require differing amounts of backoff, relative to their average power output, 21056169Shx147065 * in order to avoid clipping distortion. 21066169Shx147065 * 21076169Shx147065 * Driver must make sure that it is violating neither the saturation limit, 21086169Shx147065 * nor the regulatory limit, when calculating Tx power settings for various 21096169Shx147065 * rates. 21106169Shx147065 * 21116169Shx147065 * Units are in half-dBm (i.e. "38" means 19 dBm). 21126169Shx147065 */ 21136169Shx147065 #define IWK_TX_POWER_DEFAULT_SATURATION_24 (38) 21146169Shx147065 #define IWK_TX_POWER_DEFAULT_SATURATION_52 (38) 21156169Shx147065 #define IWK_TX_POWER_SATURATION_MIN (20) 21166169Shx147065 #define IWK_TX_POWER_SATURATION_MAX (50) 21176169Shx147065 21186169Shx147065 /* 21196169Shx147065 * dv *0.4 = dt; so that 5 degrees temperature diff equals 21206169Shx147065 * 12.5 in voltage diff 21216169Shx147065 */ 21226169Shx147065 #define IWK_TX_TEMPERATURE_UPDATE_LIMIT 9 21236169Shx147065 21246169Shx147065 #define IWK_INVALID_CHANNEL (0xffffffff) 21256169Shx147065 #define IWK_TX_POWER_REGITRY_BIT (2) 21266169Shx147065 21276169Shx147065 #define MIN_IWK_TX_POWER_CALIB_DUR (100) 21286169Shx147065 #define IWK_CCK_FROM_OFDM_POWER_DIFF (-5) 21296169Shx147065 #define IWK_CCK_FROM_OFDM_INDEX_DIFF (9) 21306169Shx147065 21316169Shx147065 /* 21326169Shx147065 * Number of entries in the gain table 21336169Shx147065 */ 21346169Shx147065 #define POWER_GAIN_NUM_ENTRIES 78 21356169Shx147065 #define TX_POW_MAX_SESSION_NUM 5 21366169Shx147065 21376169Shx147065 /* 21386169Shx147065 * timeout equivalent to 3 minutes 21396169Shx147065 */ 21406169Shx147065 #define TX_IWK_TIMELIMIT_NOCALIB 1800000000 21416169Shx147065 21426169Shx147065 /* 21436169Shx147065 * Kedron TX_CALIB_STATES 21446169Shx147065 */ 21456169Shx147065 #define IWK_TX_CALIB_STATE_SEND_TX 0x00000001 21466169Shx147065 #define IWK_TX_CALIB_WAIT_TX_RESPONSE 0x00000002 21476169Shx147065 #define IWK_TX_CALIB_ENABLED 0x00000004 21486169Shx147065 #define IWK_TX_CALIB_XVT_ON 0x00000008 21496169Shx147065 #define IWK_TX_CALIB_TEMPERATURE_CORRECT 0x00000010 21506169Shx147065 #define IWK_TX_CALIB_WORKING_WITH_XVT 0x00000020 21516169Shx147065 #define IWK_TX_CALIB_XVT_PERIODICAL 0x00000040 21526169Shx147065 21536169Shx147065 #define NUM_IWK_TX_CALIB_SETTINS 5 /* Number of tx correction groups */ 21546169Shx147065 21556169Shx147065 #define IWK_MIN_POWER_IN_VP_TABLE 1 /* 0.5dBm multiplied by 2 */ 21566169Shx147065 /* 20dBm - multiplied by 2 - because entries are for each 0.5dBm */ 21576169Shx147065 #define IWK_MAX_POWER_IN_VP_TABLE 40 21586169Shx147065 #define IWK_STEP_IN_VP_TABLE 1 /* 0.5dB - multiplied by 2 */ 21596169Shx147065 #define IWK_NUM_POINTS_IN_VPTABLE \ 21606169Shx147065 (1 + IWK_MAX_POWER_IN_VP_TABLE - IWK_MIN_POWER_IN_VP_TABLE) 21616169Shx147065 21626169Shx147065 #define MIN_TX_GAIN_INDEX (0) 21636169Shx147065 #define MAX_TX_GAIN_INDEX_52GHZ (98) 21646169Shx147065 #define MIN_TX_GAIN_52GHZ (98) 21656169Shx147065 #define MAX_TX_GAIN_INDEX_24GHZ (98) 21666169Shx147065 #define MIN_TX_GAIN_24GHZ (98) 21676169Shx147065 #define MAX_TX_GAIN (0) 21686169Shx147065 21696169Shx147065 /* 21706169Shx147065 * Channel groups used for Tx Attenuation calibration (MIMO tx channel balance) 21716169Shx147065 * and thermal Txpower calibration. 21726169Shx147065 * 21736169Shx147065 * When calculating txpower, driver must compensate for current device 21746169Shx147065 * temperature; higher temperature requires higher gain. Driver must calculate 21756169Shx147065 * current temperature (see "4965 temperature calculation"), then compare vs. 21766169Shx147065 * factory calibration temperature in EEPROM; if current temperature is higher 21776169Shx147065 * than factory temperature, driver must *increase* gain by proportions shown 21786169Shx147065 * in table below. If current temperature is lower than factory, driver must 21796169Shx147065 * *decrease* gain. 21806169Shx147065 * 21816169Shx147065 * Different frequency ranges require different compensation, as shown below. 21826169Shx147065 */ 21836169Shx147065 /* 21846169Shx147065 * Group 0, 5.2 GHz ch 34-43: 4.5 degrees per 1/2 dB. 21856169Shx147065 */ 21866169Shx147065 #define CALIB_IWK_TX_ATTEN_GR1_FCH 34 21876169Shx147065 #define CALIB_IWK_TX_ATTEN_GR1_LCH 43 21886169Shx147065 21896169Shx147065 /* 21906169Shx147065 * Group 1, 5.3 GHz ch 44-70: 4.0 degrees per 1/2 dB. 21916169Shx147065 */ 21926169Shx147065 #define CALIB_IWK_TX_ATTEN_GR2_FCH 44 21936169Shx147065 #define CALIB_IWK_TX_ATTEN_GR2_LCH 70 21946169Shx147065 21956169Shx147065 /* 21966169Shx147065 * Group 2, 5.5 GHz ch 71-124: 4.0 degrees per 1/2 dB. 21976169Shx147065 */ 21986169Shx147065 #define CALIB_IWK_TX_ATTEN_GR3_FCH 71 21996169Shx147065 #define CALIB_IWK_TX_ATTEN_GR3_LCH 124 22006169Shx147065 22016169Shx147065 /* 22026169Shx147065 * Group 3, 5.7 GHz ch 125-200: 4.0 degrees per 1/2 dB. 22036169Shx147065 */ 22046169Shx147065 #define CALIB_IWK_TX_ATTEN_GR4_FCH 125 22056169Shx147065 #define CALIB_IWK_TX_ATTEN_GR4_LCH 200 22066169Shx147065 22076169Shx147065 /* 22086169Shx147065 * Group 4, 2.4 GHz all channels: 3.5 degrees per 1/2 dB. 22096169Shx147065 */ 22106169Shx147065 #define CALIB_IWK_TX_ATTEN_GR5_FCH 1 22116169Shx147065 #define CALIB_IWK_TX_ATTEN_GR5_LCH 20 22126169Shx147065 22136169Shx147065 struct iwk_tx_power { 22146169Shx147065 uint8_t tx_gain; /* gain for analog radio */ 22156169Shx147065 uint8_t dsp_atten; /* gain for DSP */ 22166169Shx147065 }; 22176169Shx147065 22186169Shx147065 struct tx_power_dual_stream { 22196169Shx147065 uint16_t ramon_tx_gain; 22206169Shx147065 uint16_t dsp_predis_atten; 22216169Shx147065 }; 22226169Shx147065 22236169Shx147065 union tx_power_dual_stream_u { 22246169Shx147065 struct tx_power_dual_stream s; 22256169Shx147065 uint32_t dw; 22266169Shx147065 }; 22276169Shx147065 22286169Shx147065 struct iwk_tx_power_db { 22296169Shx147065 union tx_power_dual_stream_u 22306169Shx147065 ht_ofdm_power[POWER_TABLE_NUM_HT_OFDM_ENTRIES]; 22316169Shx147065 union tx_power_dual_stream_u legacy_cck_power; 22326169Shx147065 22336169Shx147065 }; 22346169Shx147065 22356169Shx147065 typedef struct iwk_tx_power_table_cmd { 22366169Shx147065 uint8_t band; 22376169Shx147065 uint8_t channel_normal_width; 22386169Shx147065 uint16_t channel; 22396169Shx147065 struct iwk_tx_power_db tx_power; 22406169Shx147065 } iwk_tx_power_table_cmd_t; 22416169Shx147065 22426169Shx147065 typedef struct iwk_channel_switch_cmd { 22436169Shx147065 uint8_t band; 22446169Shx147065 uint8_t expect_beacon; 22456169Shx147065 uint16_t channel; 22466169Shx147065 uint32_t rxon_flags; 22476169Shx147065 uint32_t rxon_filter_flags; 22486169Shx147065 uint32_t switch_time; 22496169Shx147065 struct iwk_tx_power_db tx_power; 22506169Shx147065 } iwk_channel_switch_cmd_t; 22516169Shx147065 22526169Shx147065 struct iwk_channel_switch_notif { 22536169Shx147065 uint16_t band; 22546169Shx147065 uint16_t channel; 22556169Shx147065 uint32_t status; 22566169Shx147065 }; 22576169Shx147065 22586169Shx147065 /* 22596169Shx147065 * END TXPOWER 22606169Shx147065 */ 22616169Shx147065 22626169Shx147065 /* 22636169Shx147065 * HT flags 22646169Shx147065 */ 22656169Shx147065 #define RXON_FLG_CONTROL_CHANNEL_LOCATION_MSK 0x400000 22666169Shx147065 #define RXON_FLG_CONTROL_CHANNEL_LOC_LOW_MSK 0x000000 22676169Shx147065 #define RXON_FLG_CONTROL_CHANNEL_LOC_HIGH_MSK 0x400000 22686169Shx147065 22696169Shx147065 #define RXON_FLG_HT_OPERATING_MODE_POS (23) 22706169Shx147065 #define RXON_FLG_HT_PROT_MSK 0x800000 22716169Shx147065 #define RXON_FLG_FAT_PROT_MSK 0x1000000 22726169Shx147065 22736169Shx147065 #define RXON_FLG_CHANNEL_MODE_POS (25) 22746169Shx147065 #define RXON_FLG_CHANNEL_MODE_MSK 0x06000000 22756169Shx147065 #define RXON_FLG_CHANNEL_MODE_LEGACY_MSK 0x00000000 22766169Shx147065 #define RXON_FLG_CHANNEL_MODE_PURE_40_MSK 0x02000000 22776169Shx147065 #define RXON_FLG_CHANNEL_MODE_MIXED_MSK 0x04000000 22786169Shx147065 22796169Shx147065 #define RXON_RX_CHAIN_DRIVER_FORCE_MSK (0x1<<0) 22806169Shx147065 #define RXON_RX_CHAIN_VALID_MSK (0x7<<1) 22816169Shx147065 #define RXON_RX_CHAIN_VALID_POS (1) 22826169Shx147065 #define RXON_RX_CHAIN_FORCE_SEL_MSK (0x7<<4) 22836169Shx147065 #define RXON_RX_CHAIN_FORCE_SEL_POS (4) 22846169Shx147065 #define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK (0x7<<7) 22856169Shx147065 #define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7) 22866169Shx147065 #define RXON_RX_CHAIN_CNT_MSK (0x3<<10) 22876169Shx147065 #define RXON_RX_CHAIN_CNT_POS (10) 22886169Shx147065 #define RXON_RX_CHAIN_MIMO_CNT_MSK (0x3<<12) 22896169Shx147065 #define RXON_RX_CHAIN_MIMO_CNT_POS (12) 22906169Shx147065 #define RXON_RX_CHAIN_MIMO_FORCE_MSK (0x1<<14) 22916169Shx147065 #define RXON_RX_CHAIN_MIMO_FORCE_POS (14) 22926169Shx147065 22936169Shx147065 #define MCS_DUP_6M_PLCP 0x20 22946169Shx147065 22956169Shx147065 /* 22966169Shx147065 * OFDM HT rate masks 22976169Shx147065 */ 22986169Shx147065 #define R_MCS_6M_MSK 0x1 22996169Shx147065 #define R_MCS_12M_MSK 0x2 23006169Shx147065 #define R_MCS_18M_MSK 0x4 23016169Shx147065 #define R_MCS_24M_MSK 0x8 23026169Shx147065 #define R_MCS_36M_MSK 0x10 23036169Shx147065 #define R_MCS_48M_MSK 0x20 23046169Shx147065 #define R_MCS_54M_MSK 0x40 23056169Shx147065 #define R_MCS_60M_MSK 0x80 23066169Shx147065 #define R_MCS_12M_DUAL_MSK 0x100 23076169Shx147065 #define R_MCS_24M_DUAL_MSK 0x200 23086169Shx147065 #define R_MCS_36M_DUAL_MSK 0x400 23096169Shx147065 #define R_MCS_48M_DUAL_MSK 0x800 23106169Shx147065 23116169Shx147065 #define RATE_MCS_CODE_MSK 0x7 23126169Shx147065 #define RATE_MCS_MIMO_POS 3 23136169Shx147065 #define RATE_MCS_MIMO_MSK 0x8 23146169Shx147065 #define RATE_MCS_HT_DUP_POS 5 23156169Shx147065 #define RATE_MCS_HT_DUP_MSK 0x20 23166169Shx147065 #define RATE_MCS_FLAGS_POS 8 23176169Shx147065 #define RATE_MCS_HT_POS 8 23186169Shx147065 #define RATE_MCS_HT_MSK 0x100 23196169Shx147065 #define RATE_MCS_CCK_POS 9 23206169Shx147065 #define RATE_MCS_CCK_MSK 0x200 23216169Shx147065 #define RATE_MCS_GF_POS 10 23226169Shx147065 #define RATE_MCS_GF_MSK 0x400 23236169Shx147065 23246169Shx147065 #define RATE_MCS_FAT_POS 11 23256169Shx147065 #define RATE_MCS_FAT_MSK 0x800 23266169Shx147065 #define RATE_MCS_DUP_POS 12 23276169Shx147065 #define RATE_MCS_DUP_MSK 0x1000 23286169Shx147065 #define RATE_MCS_SGI_POS 13 23296169Shx147065 #define RATE_MCS_SGI_MSK 0x2000 23306169Shx147065 23316169Shx147065 #define EEPROM_SEM_TIMEOUT 10 23326169Shx147065 #define EEPROM_SEM_RETRY_LIMIT 1000 23336169Shx147065 23346169Shx147065 /* 23356169Shx147065 * Antenna masks: 23366169Shx147065 * bit14:15 01 B inactive, A active 23376169Shx147065 * 10 B active, A inactive 23386169Shx147065 * 11 Both active 23396169Shx147065 */ 23406169Shx147065 #define RATE_MCS_ANT_A_POS 14 23416169Shx147065 #define RATE_MCS_ANT_B_POS 15 23426169Shx147065 #define RATE_MCS_ANT_A_MSK 0x4000 23436169Shx147065 #define RATE_MCS_ANT_B_MSK 0x8000 23446169Shx147065 #define RATE_MCS_ANT_AB_MSK 0xc000 23456169Shx147065 23466169Shx147065 #define is_legacy(tbl) (((tbl) == LQ_G) || ((tbl) == LQ_A)) 23476169Shx147065 #define is_siso(tbl) (((tbl) == LQ_SISO)) 23486169Shx147065 #define is_mimo(tbl) (((tbl) == LQ_MIMO)) 23496169Shx147065 #define is_Ht(tbl) (is_siso(tbl) || is_mimo(tbl)) 23506169Shx147065 #define is_a_band(tbl) (((tbl) == LQ_A)) 23516169Shx147065 #define is_g_and(tbl) (((tbl) == LQ_G)) 23526169Shx147065 23536169Shx147065 /* 23546169Shx147065 * RS_NEW_API: only TLC_RTS remains and moved to bit 0 23556169Shx147065 */ 23566169Shx147065 #define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1<<0) 23576169Shx147065 23586169Shx147065 #define LINK_QUAL_AC_NUM 4 23596169Shx147065 #define LINK_QUAL_MAX_RETRY_NUM 16 23606169Shx147065 23616169Shx147065 #define LINK_QUAL_ANT_A_MSK (1<<0) 23626169Shx147065 #define LINK_QUAL_ANT_B_MSK (1<<1) 23636169Shx147065 #define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK) 23646169Shx147065 23656169Shx147065 struct iwk_link_qual_general_params { 23666169Shx147065 uint8_t flags; 23676169Shx147065 uint8_t mimo_delimiter; 23686169Shx147065 uint8_t single_stream_ant_msk; 23696169Shx147065 uint8_t dual_stream_ant_msk; 23706169Shx147065 uint8_t start_rate_index[LINK_QUAL_AC_NUM]; 23716169Shx147065 }; 23726169Shx147065 23736169Shx147065 struct iwk_link_qual_agg_params { 23746169Shx147065 uint16_t agg_time_limit; 23756169Shx147065 uint8_t agg_dis_start_th; 23766169Shx147065 uint8_t agg_frame_cnt_limit; 23776169Shx147065 uint32_t reserved; 23786169Shx147065 }; 23796169Shx147065 23806169Shx147065 typedef struct iwk_link_quality_cmd { 23816169Shx147065 uint8_t sta_id; 23826169Shx147065 uint8_t reserved1; 23836169Shx147065 uint16_t control; 23846169Shx147065 struct iwk_link_qual_general_params general_params; 23856169Shx147065 struct iwk_link_qual_agg_params agg_params; 23866169Shx147065 uint32_t rate_n_flags[LINK_QUAL_MAX_RETRY_NUM]; 23876169Shx147065 uint32_t reserved2; 23886169Shx147065 } iwk_link_quality_cmd_t; 23896169Shx147065 23906169Shx147065 typedef struct iwk_rx_phy_res { 23916169Shx147065 uint8_t non_cfg_phy_cnt; /* non configurable DSP phy data byte count */ 23926169Shx147065 uint8_t cfg_phy_cnt; /* configurable DSP phy data byte count */ 23936169Shx147065 uint8_t stat_id; /* configurable DSP phy data set ID */ 23946169Shx147065 uint8_t reserved1; 23956169Shx147065 uint32_t timestampl; /* TSF at on air rise */ 23966169Shx147065 uint32_t timestamph; 23976169Shx147065 uint32_t beacon_time_stamp; /* beacon at on-air rise */ 23986169Shx147065 uint16_t phy_flags; /* general phy flags: band, modulation, ... */ 23996169Shx147065 uint16_t channel; /* channel number */ 24006169Shx147065 uint16_t non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */ 24016169Shx147065 uint32_t reserved2; 24026169Shx147065 struct iwk_rate rate; /* rate in ucode internal format */ 24036169Shx147065 uint16_t byte_count; /* frame's byte-count */ 24046169Shx147065 uint16_t reserved3; 24056169Shx147065 } iwk_rx_phy_res_t; 24066169Shx147065 24076169Shx147065 struct iwk_rx_mpdu_res_start { 24086169Shx147065 uint16_t byte_count; 24096169Shx147065 uint16_t reserved; 24106169Shx147065 }; 24116169Shx147065 24126169Shx147065 #define IWK_AGC_DB_MASK (0x3f80) /* MASK(7,13) */ 24136169Shx147065 #define IWK_AGC_DB_POS (7) 24146169Shx147065 24156169Shx147065 /* 24166169Shx147065 * Fixed (non-configurable) rx data from phy 24176169Shx147065 */ 24186169Shx147065 struct iwk_rx_non_cfg_phy { 24196169Shx147065 uint16_t ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */ 24206169Shx147065 uint16_t agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */ 24216169Shx147065 uint8_t rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */ 24226169Shx147065 uint8_t pad[2]; 24236169Shx147065 }; 24246169Shx147065 24256169Shx147065 /* 24266169Shx147065 * Byte Count Table Entry 24276169Shx147065 * 24286169Shx147065 * Bit fields: 24296169Shx147065 * 15-12: reserved 24306169Shx147065 * 11- 0: total to-be-transmitted byte count of frame (does not include command) 24316169Shx147065 */ 24326169Shx147065 struct iwk_queue_byte_cnt_entry { 24336169Shx147065 uint16_t val; 24346169Shx147065 }; 24356169Shx147065 24366169Shx147065 /* 24376169Shx147065 * Byte Count table 24386169Shx147065 * 24396169Shx147065 * Each Tx queue uses a byte-count table containing 320 entries: 24406169Shx147065 * one 16-bit entry for each of 256 TFDs, plus an additional 64 entries that 24416169Shx147065 * duplicate the first 64 entries (to avoid wrap-around within a Tx window; 24426169Shx147065 * max Tx window is 64 TFDs). 24436169Shx147065 * 24446169Shx147065 * When driver sets up a new TFD, it must also enter the total byte count 24456169Shx147065 * of the frame to be transmitted into the corresponding entry in the byte 24466169Shx147065 * count table for the chosen Tx queue. If the TFD index is 0-63, the driver 24476169Shx147065 * must duplicate the byte count entry in corresponding index 256-319. 24486169Shx147065 * 24496169Shx147065 * "dont_care" padding puts each byte count table on a 1024-byte boundary; 24506169Shx147065 * 4965 assumes tables are separated by 1024 bytes. 24516169Shx147065 */ 24526169Shx147065 struct iwk_sched_queue_byte_cnt_tbl { 24536169Shx147065 struct iwk_queue_byte_cnt_entry tfd_offset[IWK_QUEUE_SIZE + 24546169Shx147065 IWK_MAX_WIN_SIZE]; 24556169Shx147065 uint8_t dont_care[1024 - (IWK_QUEUE_SIZE + IWK_MAX_WIN_SIZE) * 24566169Shx147065 sizeof (uint16_t)]; 24576169Shx147065 }; 24586169Shx147065 24596169Shx147065 /* 24606169Shx147065 * struct iwk_shared, handshake area for Tx and Rx 24616169Shx147065 * 24626169Shx147065 * For convenience in allocating memory, this structure combines 2 areas of 24636169Shx147065 * DRAM which must be shared between driver and 4965. These do not need to 24646169Shx147065 * be combined, if better allocation would result from keeping them separate: 24656169Shx147065 * TODO: Split these; carried over from 3945, doesn't work well for 4965. 24666169Shx147065 * 24676169Shx147065 * 1) The Tx byte count tables occupy 1024 bytes each (16 KBytes total for 24686169Shx147065 * 16 queues). Driver uses SCD_DRAM_BASE_ADDR to tell 4965 where to find 24696169Shx147065 * the first of these tables. 4965 assumes tables are 1024 bytes apart. 24706169Shx147065 * 24716169Shx147065 * 2) The Rx status (val0 and val1) occupies only 8 bytes. Driver uses 24726169Shx147065 * FH_RSCSR_CHNL0_STTS_WPTR_REG to tell 4965 where to find this area. 24736169Shx147065 * Driver reads val0 to determine the latest Receive Buffer Descriptor (RBD) 24746169Shx147065 * that has been filled by the 4965. 24756169Shx147065 * 24766169Shx147065 * Bit fields val0: 24776169Shx147065 * 31-12: Not used 24786169Shx147065 * 11- 0: Index of last filled Rx buffer descriptor (4965 writes, driver reads) 24796169Shx147065 * 24806169Shx147065 * Bit fields val1: 24816169Shx147065 * 31- 0: Not used 24826169Shx147065 */ 24836169Shx147065 typedef struct iwk_shared { 24846169Shx147065 struct iwk_sched_queue_byte_cnt_tbl 24856169Shx147065 queues_byte_cnt_tbls[IWK_NUM_QUEUES]; 24866169Shx147065 uint32_t val0; 24876169Shx147065 uint32_t val1; 24886169Shx147065 uint32_t padding1; /* so that allocation will be aligned to 16B */ 24896169Shx147065 uint32_t padding2; 24906169Shx147065 } iwk_shared_t; 24916169Shx147065 24926169Shx147065 24936169Shx147065 /* 24946169Shx147065 * struct iwk_tfd_frame_data 24956169Shx147065 * 24966169Shx147065 * Describes up to 2 buffers containing (contiguous) portions of a Tx frame. 24976169Shx147065 * Each buffer must be on dword boundary. 24986169Shx147065 * Up to 10 iwk_tfd_frame_data structures, describing up to 20 buffers, 24996169Shx147065 * may be filled within a TFD (iwk_tfd_frame). 25006169Shx147065 * 25016169Shx147065 * Bit fields in tb1_addr: 25026169Shx147065 * 31- 0: Tx buffer 1 address bits [31:0] 25036169Shx147065 * 25046169Shx147065 * Bit fields in val1: 25056169Shx147065 * 31-16: Tx buffer 2 address bits [15:0] 25066169Shx147065 * 15- 4: Tx buffer 1 length (bytes) 25076169Shx147065 * 3- 0: Tx buffer 1 address bits [32:32] 25086169Shx147065 * 25096169Shx147065 * Bit fields in val2: 25106169Shx147065 * 31-20: Tx buffer 2 length (bytes) 25116169Shx147065 * 19- 0: Tx buffer 2 address bits [35:16] 25126169Shx147065 */ 25136169Shx147065 struct iwk_tfd_frame_data { 25146169Shx147065 uint32_t tb1_addr; 25156169Shx147065 uint32_t val1; 25166169Shx147065 uint32_t val2; 25176169Shx147065 }; 25186169Shx147065 25196169Shx147065 typedef struct iwk_tx_desc { 25206169Shx147065 uint32_t val0; 25216169Shx147065 struct iwk_tfd_frame_data pa[10]; 25226169Shx147065 uint32_t reserved; 25236169Shx147065 } iwk_tx_desc_t; 25246169Shx147065 25256169Shx147065 typedef struct iwk_tx_stat { 25266169Shx147065 uint8_t frame_count; 25276169Shx147065 uint8_t bt_kill_count; 25286169Shx147065 uint8_t nrts; 25296169Shx147065 uint8_t ntries; 25306169Shx147065 struct iwk_rate rate; 25316169Shx147065 uint16_t duration; 25326169Shx147065 uint16_t reserved; 25336169Shx147065 uint32_t pa_power1; 25346169Shx147065 uint32_t pa_power2; 25356169Shx147065 uint32_t status; 25366169Shx147065 } iwk_tx_stat_t; 25376169Shx147065 25386169Shx147065 struct iwk_cmd_header { 25396169Shx147065 uint8_t type; 25406169Shx147065 uint8_t flags; 25416169Shx147065 uint8_t idx; 25426169Shx147065 uint8_t qid; 25436169Shx147065 }; 25446169Shx147065 25456169Shx147065 typedef struct iwk_rx_desc { 25466169Shx147065 uint32_t len; 25476169Shx147065 struct iwk_cmd_header hdr; 25486169Shx147065 } iwk_rx_desc_t; 25496169Shx147065 25506169Shx147065 typedef struct iwk_rx_stat { 25516169Shx147065 uint8_t len; 25526169Shx147065 uint8_t id; 25536169Shx147065 uint8_t rssi; /* received signal strength */ 25546169Shx147065 uint8_t agc; /* access gain control */ 25556169Shx147065 uint16_t signal; 25566169Shx147065 uint16_t noise; 25576169Shx147065 } iwk_rx_stat_t; 25586169Shx147065 25596169Shx147065 typedef struct iwk_rx_head { 25606169Shx147065 uint16_t chan; 25616169Shx147065 uint16_t flags; 25626169Shx147065 uint8_t reserved; 25636169Shx147065 uint8_t rate; 25646169Shx147065 uint16_t len; 25656169Shx147065 } iwk_rx_head_t; 25666169Shx147065 25676169Shx147065 typedef struct iwk_rx_tail { 25686169Shx147065 uint32_t flags; 25696169Shx147065 uint32_t timestampl; 25706169Shx147065 uint32_t timestamph; 25716169Shx147065 uint32_t tbeacon; 25726169Shx147065 } iwk_rx_tail_t; 25736169Shx147065 25746169Shx147065 enum { 25756169Shx147065 IWK_AP_ID = 0, 25766169Shx147065 IWK_MULTICAST_ID, 25776169Shx147065 IWK_STA_ID, 25786169Shx147065 IWK_BROADCAST_ID = 31, 25796169Shx147065 IWK_STATION_COUNT = 32, 25806169Shx147065 IWK_INVALID_STATION 25816169Shx147065 }; 25826169Shx147065 25836169Shx147065 /* 25846169Shx147065 * key flags 25856169Shx147065 */ 25866169Shx147065 enum { 25876169Shx147065 STA_KEY_FLG_ENCRYPT_MSK = 0x7, 25886169Shx147065 STA_KEY_FLG_NO_ENC = 0x0, 25896169Shx147065 STA_KEY_FLG_WEP = 0x1, 25906169Shx147065 STA_KEY_FLG_CCMP = 0x2, 25916169Shx147065 STA_KEY_FLG_TKIP = 0x3, 25926169Shx147065 25936169Shx147065 STA_KEY_FLG_KEYID_POS = 8, 25946169Shx147065 STA_KEY_FLG_INVALID = 0x0800, 25956169Shx147065 }; 25966169Shx147065 25976169Shx147065 /* 25986169Shx147065 * modify flags 25996169Shx147065 */ 26006169Shx147065 enum { 26016169Shx147065 STA_MODIFY_KEY_MASK = 0x01, 26026169Shx147065 STA_MODIFY_TID_DISABLE_TX = 0x02, 26036169Shx147065 STA_MODIFY_TX_RATE_MSK = 0x04 26046169Shx147065 }; 26056169Shx147065 26066169Shx147065 enum { 26076169Shx147065 RX_RES_STATUS_NO_CRC32_ERROR = (1 << 0), 26086169Shx147065 RX_RES_STATUS_NO_RXE_OVERFLOW = (1 << 1), 26096169Shx147065 }; 26106169Shx147065 26116169Shx147065 enum { 26126169Shx147065 RX_RES_PHY_FLAGS_BAND_24_MSK = (1 << 0), 26136169Shx147065 RX_RES_PHY_FLAGS_MOD_CCK_MSK = (1 << 1), 26146169Shx147065 RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK = (1 << 2), 26156169Shx147065 RX_RES_PHY_FLAGS_NARROW_BAND_MSK = (1 << 3), 26166169Shx147065 RX_RES_PHY_FLAGS_ANTENNA_MSK = 0xf0, 26176169Shx147065 26186169Shx147065 RX_RES_STATUS_SEC_TYPE_MSK = (0x7 << 8), 26196169Shx147065 RX_RES_STATUS_SEC_TYPE_NONE = (STA_KEY_FLG_NO_ENC << 8), 26206169Shx147065 RX_RES_STATUS_SEC_TYPE_WEP = (STA_KEY_FLG_WEP << 8), 26216169Shx147065 RX_RES_STATUS_SEC_TYPE_TKIP = (STA_KEY_FLG_TKIP << 8), 26226169Shx147065 RX_RES_STATUS_SEC_TYPE_CCMP = (STA_KEY_FLG_CCMP << 8), 26236169Shx147065 26246169Shx147065 RX_RES_STATUS_DECRYPT_TYPE_MSK = (0x3 << 11), 26256169Shx147065 RX_RES_STATUS_NOT_DECRYPT = (0x0 << 11), 26266169Shx147065 RX_RES_STATUS_DECRYPT_OK = (0x3 << 11), 26276169Shx147065 RX_RES_STATUS_BAD_ICV_MIC = (0x1 << 11), 26286169Shx147065 RX_RES_STATUS_BAD_KEY_TTAK = (0x2 << 11), 26296169Shx147065 }; 26306169Shx147065 26316169Shx147065 enum { 26326169Shx147065 REPLY_ALIVE = 0x1, 26336169Shx147065 REPLY_ERROR = 0x2, 26346169Shx147065 26356169Shx147065 /* RXON state commands */ 26366169Shx147065 REPLY_RXON = 0x10, 26376169Shx147065 REPLY_RXON_ASSOC = 0x11, 26386169Shx147065 REPLY_QOS_PARAM = 0x13, 26396169Shx147065 REPLY_RXON_TIMING = 0x14, 26406169Shx147065 26416169Shx147065 /* Multi-Station support */ 26426169Shx147065 REPLY_ADD_STA = 0x18, 26437569SXinghua.Wen@Sun.COM REPLY_REMOVE_ALL_STA = 0x1a, 26446169Shx147065 26456169Shx147065 /* RX, TX */ 26466169Shx147065 26476169Shx147065 REPLY_TX = 0x1c, 26486169Shx147065 26496169Shx147065 /* timers commands */ 26506169Shx147065 REPLY_BCON = 0x27, 26516169Shx147065 26526169Shx147065 REPLY_SHUTDOWN = 0x40, 26536169Shx147065 26546169Shx147065 /* MISC commands */ 26556169Shx147065 REPLY_RATE_SCALE = 0x47, 26566169Shx147065 REPLY_LEDS_CMD = 0x48, 26576169Shx147065 REPLY_TX_LINK_QUALITY_CMD = 0x4e, 26586169Shx147065 26596169Shx147065 /* 802.11h related */ 26606169Shx147065 RADAR_NOTIFICATION = 0x70, 26616169Shx147065 REPLY_QUIET_CMD = 0x71, 26626169Shx147065 REPLY_CHANNEL_SWITCH = 0x72, 26636169Shx147065 CHANNEL_SWITCH_NOTIFICATION = 0x73, 26646169Shx147065 REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74, 26656169Shx147065 SPECTRUM_MEASURE_NOTIFICATION = 0x75, 26666169Shx147065 26676169Shx147065 /* Power Management *** */ 26686169Shx147065 POWER_TABLE_CMD = 0x77, 26696169Shx147065 PM_SLEEP_NOTIFICATION = 0x7A, 26706169Shx147065 PM_DEBUG_STATISTIC_NOTIFIC = 0x7B, 26716169Shx147065 26726169Shx147065 /* Scan commands and notifications */ 26736169Shx147065 REPLY_SCAN_CMD = 0x80, 26746169Shx147065 REPLY_SCAN_ABORT_CMD = 0x81, 26756169Shx147065 26766169Shx147065 SCAN_START_NOTIFICATION = 0x82, 26776169Shx147065 SCAN_RESULTS_NOTIFICATION = 0x83, 26786169Shx147065 SCAN_COMPLETE_NOTIFICATION = 0x84, 26796169Shx147065 26806169Shx147065 /* IBSS/AP commands */ 26816169Shx147065 BEACON_NOTIFICATION = 0x90, 26826169Shx147065 REPLY_TX_BEACON = 0x91, 26836169Shx147065 WHO_IS_AWAKE_NOTIFICATION = 0x94, 26846169Shx147065 26856169Shx147065 QUIET_NOTIFICATION = 0x96, 26866169Shx147065 REPLY_TX_PWR_TABLE_CMD = 0x97, 26876169Shx147065 MEASURE_ABORT_NOTIFICATION = 0x99, 26886169Shx147065 26896169Shx147065 REPLY_CALIBRATION_TUNE = 0x9a, 26906169Shx147065 26916169Shx147065 /* BT config command */ 26926169Shx147065 REPLY_BT_CONFIG = 0x9b, 26936169Shx147065 REPLY_STATISTICS_CMD = 0x9c, 26946169Shx147065 STATISTICS_NOTIFICATION = 0x9d, 26956169Shx147065 26966169Shx147065 /* RF-KILL commands and notifications *** */ 26976169Shx147065 REPLY_CARD_STATE_CMD = 0xa0, 26986169Shx147065 CARD_STATE_NOTIFICATION = 0xa1, 26996169Shx147065 27006169Shx147065 /* Missed beacons notification */ 27016169Shx147065 MISSED_BEACONS_NOTIFICATION = 0xa2, 27026169Shx147065 MISSED_BEACONS_NOTIFICATION_TH_CMD = 0xa3, 27036169Shx147065 27046169Shx147065 REPLY_CT_KILL_CONFIG_CMD = 0xa4, 27056169Shx147065 SENSITIVITY_CMD = 0xa8, 27066169Shx147065 REPLY_PHY_CALIBRATION_CMD = 0xb0, 27076169Shx147065 REPLY_4965_RX = 0xc3, 27086169Shx147065 REPLY_RX_PHY_CMD = 0xc0, 27096169Shx147065 REPLY_RX_MPDU_CMD = 0xc1, 27106169Shx147065 REPLY_COMPRESSED_BA = 0xc5, 27116169Shx147065 REPLY_MAX = 0xff 27126169Shx147065 }; 27136169Shx147065 27146169Shx147065 typedef struct iwk_cmd { 27156169Shx147065 struct iwk_cmd_header hdr; 27166169Shx147065 uint8_t data[1024]; 27176169Shx147065 } iwk_cmd_t; 27186169Shx147065 27196169Shx147065 /* 27206169Shx147065 * Alive Command & Response 27216169Shx147065 */ 27226169Shx147065 #define UCODE_VALID_OK (0x1) 27236169Shx147065 #define INITIALIZE_SUBTYPE (9) 27246169Shx147065 27256169Shx147065 struct iwk_alive_resp { 27266169Shx147065 uint8_t ucode_minor; 27276169Shx147065 uint8_t ucode_major; 27286169Shx147065 uint16_t reserved1; 27296169Shx147065 uint8_t sw_rev[8]; 27306169Shx147065 uint8_t ver_type; 27316169Shx147065 uint8_t ver_subtype; 27326169Shx147065 uint16_t reserved2; 27336169Shx147065 uint32_t log_event_table_ptr; 27346169Shx147065 uint32_t error_event_table_ptr; 27356169Shx147065 uint32_t timestamp; 27366169Shx147065 uint32_t is_valid; 27376169Shx147065 }; 27386169Shx147065 27396169Shx147065 struct iwk_init_alive_resp { 27406169Shx147065 struct iwk_alive_resp s; 27416169Shx147065 /* calibration values from "initialize" uCode */ 27426169Shx147065 uint32_t voltage; /* signed */ 27436169Shx147065 uint32_t therm_r1[2]; /* signed 1st for normal, 2nd for FAT channel */ 27446169Shx147065 uint32_t therm_r2[2]; /* signed */ 27456169Shx147065 uint32_t therm_r3[2]; /* signed */ 27466169Shx147065 uint32_t therm_r4[2]; /* signed */ 27476169Shx147065 /* 27486169Shx147065 * signed MIMO gain comp, 5 freq groups, 2 Tx chains 27496169Shx147065 */ 27506169Shx147065 uint32_t tx_atten[5][2]; 27516169Shx147065 }; 27526169Shx147065 27536169Shx147065 /* 27546169Shx147065 * Rx config defines & structure 27556169Shx147065 */ 27566169Shx147065 /* 27576169Shx147065 * rx_config device types 27586169Shx147065 */ 27596169Shx147065 enum { 27606169Shx147065 RXON_DEV_TYPE_AP = 1, 27616169Shx147065 RXON_DEV_TYPE_ESS = 3, 27626169Shx147065 RXON_DEV_TYPE_IBSS = 4, 27636169Shx147065 RXON_DEV_TYPE_SNIFFER = 6, 27646169Shx147065 }; 27656169Shx147065 27666169Shx147065 /* 27676169Shx147065 * rx_config flags 27686169Shx147065 */ 27696169Shx147065 enum { 27706169Shx147065 /* band & modulation selection */ 27716169Shx147065 RXON_FLG_BAND_24G_MSK = (1 << 0), 27726169Shx147065 RXON_FLG_CCK_MSK = (1 << 1), 27736169Shx147065 /* auto detection enable */ 27746169Shx147065 RXON_FLG_AUTO_DETECT_MSK = (1 << 2), 27756169Shx147065 /* TGg protection when tx */ 27766169Shx147065 RXON_FLG_TGG_PROTECT_MSK = (1 << 3), 27776169Shx147065 /* cck short slot & preamble */ 27786169Shx147065 RXON_FLG_SHORT_SLOT_MSK = (1 << 4), 27796169Shx147065 RXON_FLG_SHORT_PREAMBLE_MSK = (1 << 5), 27806169Shx147065 /* antenna selection */ 27816169Shx147065 RXON_FLG_DIS_DIV_MSK = (1 << 7), 27826169Shx147065 RXON_FLG_ANT_SEL_MSK = 0x0f00, 27836169Shx147065 RXON_FLG_ANT_A_MSK = (1 << 8), 27846169Shx147065 RXON_FLG_ANT_B_MSK = (1 << 9), 27856169Shx147065 /* radar detection enable */ 27866169Shx147065 RXON_FLG_RADAR_DETECT_MSK = (1 << 12), 27876169Shx147065 RXON_FLG_TGJ_NARROW_BAND_MSK = (1 << 13), 27886169Shx147065 /* 27896169Shx147065 * rx response to host with 8-byte TSF 27906169Shx147065 * (according to ON_AIR deassertion) 27916169Shx147065 */ 27926169Shx147065 RXON_FLG_TSF2HOST_MSK = (1 << 15) 27936169Shx147065 }; 27946169Shx147065 27956169Shx147065 /* 27966169Shx147065 * rx_config filter flags 27976169Shx147065 */ 27986169Shx147065 enum { 27996169Shx147065 /* accept all data frames */ 28006169Shx147065 RXON_FILTER_PROMISC_MSK = (1 << 0), 28016169Shx147065 /* pass control & management to host */ 28026169Shx147065 RXON_FILTER_CTL2HOST_MSK = (1 << 1), 28036169Shx147065 /* accept multi-cast */ 28046169Shx147065 RXON_FILTER_ACCEPT_GRP_MSK = (1 << 2), 28056169Shx147065 /* don't decrypt uni-cast frames */ 28066169Shx147065 RXON_FILTER_DIS_DECRYPT_MSK = (1 << 3), 28076169Shx147065 /* don't decrypt multi-cast frames */ 28086169Shx147065 RXON_FILTER_DIS_GRP_DECRYPT_MSK = (1 << 4), 28096169Shx147065 /* STA is associated */ 28106169Shx147065 RXON_FILTER_ASSOC_MSK = (1 << 5), 28116169Shx147065 /* transfer to host non bssid beacons in associated state */ 28126169Shx147065 RXON_FILTER_BCON_AWARE_MSK = (1 << 6) 28136169Shx147065 }; 28146169Shx147065 28156169Shx147065 28166169Shx147065 /* 28176169Shx147065 * structure for RXON Command & Response 28186169Shx147065 */ 28196169Shx147065 typedef struct iwk_rxon_cmd { 28206169Shx147065 uint8_t node_addr[IEEE80211_ADDR_LEN]; 28216169Shx147065 uint16_t reserved1; 28226169Shx147065 uint8_t bssid[IEEE80211_ADDR_LEN]; 28236169Shx147065 uint16_t reserved2; 28246169Shx147065 uint8_t wlap_bssid[IEEE80211_ADDR_LEN]; 28256169Shx147065 uint16_t reserved3; 28266169Shx147065 uint8_t dev_type; 28276169Shx147065 uint8_t air_propagation; 28286169Shx147065 uint16_t rx_chain; 28296169Shx147065 uint8_t ofdm_basic_rates; 28306169Shx147065 uint8_t cck_basic_rates; 28316169Shx147065 uint16_t assoc_id; 28326169Shx147065 uint32_t flags; 28336169Shx147065 uint32_t filter_flags; 28346169Shx147065 uint16_t chan; 28356169Shx147065 uint8_t ofdm_ht_single_stream_basic_rates; 28366169Shx147065 uint8_t ofdm_ht_dual_stream_basic_rates; 28376169Shx147065 } iwk_rxon_cmd_t; 28386169Shx147065 28396169Shx147065 typedef struct iwk_compressed_ba_resp { 28406169Shx147065 uint32_t sta_addr_lo32; 28416169Shx147065 uint16_t sta_addr_hi16; 28426169Shx147065 uint16_t reserved; 28436169Shx147065 uint8_t sta_id; 28446169Shx147065 uint8_t tid; 28456169Shx147065 uint16_t ba_seq_ctl; 28466169Shx147065 uint32_t ba_bitmap0; 28476169Shx147065 uint32_t ba_bitmap1; 28486169Shx147065 uint16_t scd_flow; 28496169Shx147065 uint16_t scd_ssn; 28506169Shx147065 } iwk_compressed_ba_resp_t; 28516169Shx147065 28526169Shx147065 #define PHY_CALIBRATE_DIFF_GAIN_CMD (7) 28536169Shx147065 #define HD_TABLE_SIZE (11) 28546169Shx147065 28556169Shx147065 /* 28566169Shx147065 * Param table within SENSITIVITY_CMD 28576169Shx147065 */ 28586169Shx147065 #define HD_MIN_ENERGY_CCK_DET_INDEX (0) 28596169Shx147065 #define HD_MIN_ENERGY_OFDM_DET_INDEX (1) 28606169Shx147065 #define HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX (2) 28616169Shx147065 #define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX (3) 28626169Shx147065 #define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX (4) 28636169Shx147065 #define HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX (5) 28646169Shx147065 #define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX (6) 28656169Shx147065 #define HD_BARKER_CORR_TH_ADD_MIN_INDEX (7) 28666169Shx147065 #define HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX (8) 28676169Shx147065 #define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX (9) 28686169Shx147065 #define HD_OFDM_ENERGY_TH_IN_INDEX (10) 28696169Shx147065 28706169Shx147065 typedef struct iwk_sensitivity_cmd { 28716169Shx147065 uint16_t control; 28726169Shx147065 uint16_t table[HD_TABLE_SIZE]; 28736169Shx147065 } iwk_sensitivity_cmd_t; 28746169Shx147065 28756169Shx147065 typedef struct iwk_calibration_cmd { 28766169Shx147065 uint8_t opCode; 28776169Shx147065 uint8_t flags; 28786169Shx147065 uint16_t reserved; 28797569SXinghua.Wen@Sun.COM char diff_gain_a; 28807569SXinghua.Wen@Sun.COM char diff_gain_b; 28817569SXinghua.Wen@Sun.COM char diff_gain_c; 28826169Shx147065 uint8_t reserved1; 28836169Shx147065 } iwk_calibation_cmd_t; 28846169Shx147065 28856169Shx147065 typedef struct iwk_missed_beacon_notif { 28866169Shx147065 uint32_t consequtive_missed_beacons; 28876169Shx147065 uint32_t total_missed_becons; 28886169Shx147065 uint32_t num_expected_beacons; 28896169Shx147065 uint32_t num_recvd_beacons; 28906169Shx147065 } iwk_missed_beacon_notif_t; 28916169Shx147065 28926169Shx147065 typedef struct iwk_ct_kill_config { 28936169Shx147065 uint32_t reserved; 28946169Shx147065 uint32_t critical_temperature_M; 28956169Shx147065 uint32_t critical_temperature_R; 28966169Shx147065 } iwk_ct_kill_config_t; 28976169Shx147065 28986169Shx147065 /* 28996169Shx147065 * structure for command IWK_CMD_ASSOCIATE 29006169Shx147065 */ 29016169Shx147065 typedef struct iwk_assoc { 29026169Shx147065 uint32_t flags; 29036169Shx147065 uint32_t filter; 29046169Shx147065 uint8_t ofdm_mask; 29056169Shx147065 uint8_t cck_mask; 29066169Shx147065 uint8_t ofdm_ht_single_stream_basic_rates; 29076169Shx147065 uint8_t ofdm_ht_dual_stream_basic_rates; 29086169Shx147065 uint16_t rx_chain_select_flags; 29096169Shx147065 uint16_t reserved; 29106169Shx147065 } iwk_assoc_t; 29116169Shx147065 29126169Shx147065 /* 29136169Shx147065 * structure for command IWK_CMD_SET_WME 29146169Shx147065 */ 29156169Shx147065 typedef struct iwk_wme_setup { 29166169Shx147065 uint32_t flags; 29176169Shx147065 struct { 29186169Shx147065 uint16_t cwmin; 29196169Shx147065 uint16_t cwmax; 29206169Shx147065 uint8_t aifsn; 29216169Shx147065 uint8_t reserved; 29226169Shx147065 uint16_t txop; 29236169Shx147065 } ac[WME_NUM_AC]; 29246169Shx147065 } iwk_wme_setup_t; 29256169Shx147065 29266169Shx147065 /* 29276169Shx147065 * structure for command IWK_CMD_TSF 29286169Shx147065 */ 29296169Shx147065 typedef struct iwk_cmd_tsf { 29306169Shx147065 uint32_t timestampl; 29316169Shx147065 uint32_t timestamph; 29326169Shx147065 uint16_t bintval; 29336169Shx147065 uint16_t atim; 29346169Shx147065 uint32_t binitval; 29356169Shx147065 uint16_t lintval; 29366169Shx147065 uint16_t reserved; 29376169Shx147065 } iwk_cmd_tsf_t; 29386169Shx147065 29396169Shx147065 /* 29406169Shx147065 * structure for IWK_CMD_ADD_NODE 29416169Shx147065 */ 29426169Shx147065 typedef struct iwk_add_sta { 29436169Shx147065 uint8_t control; 29446169Shx147065 uint8_t reserved1[3]; 29456169Shx147065 uint8_t bssid[IEEE80211_ADDR_LEN]; 29466169Shx147065 uint16_t reserved2; 29476169Shx147065 uint8_t id; 29486169Shx147065 uint8_t sta_mask; 29496169Shx147065 uint16_t reserved3; 29506169Shx147065 uint16_t key_flags; 29516169Shx147065 uint8_t tkip; 29526169Shx147065 uint8_t reserved4; 29536169Shx147065 uint16_t ttak[5]; 29546169Shx147065 uint8_t keyp; 29556169Shx147065 uint8_t reserved5; 29566169Shx147065 uint8_t key[16]; 29576169Shx147065 uint32_t flags; 29586169Shx147065 uint32_t mask; 29596169Shx147065 uint16_t tid; 29606169Shx147065 union { 29616169Shx147065 struct { 29626169Shx147065 uint8_t rate; 29636169Shx147065 uint8_t flags; 29646169Shx147065 } s; 29656169Shx147065 uint16_t rate_n_flags; 29666169Shx147065 } tx_rate; 29676169Shx147065 uint8_t add_imm; 29686169Shx147065 uint8_t del_imm; 29696169Shx147065 uint16_t add_imm_start; 29706169Shx147065 uint32_t reserved7; 29716169Shx147065 } iwk_add_sta_t; 29726169Shx147065 29736169Shx147065 /* 29746169Shx147065 * Tx flags 29756169Shx147065 */ 29766169Shx147065 enum { 29776169Shx147065 TX_CMD_FLG_RTS_MSK = (1 << 1), 29786169Shx147065 TX_CMD_FLG_CTS_MSK = (1 << 2), 29796169Shx147065 TX_CMD_FLG_ACK_MSK = (1 << 3), 29806169Shx147065 TX_CMD_FLG_STA_RATE_MSK = (1 << 4), 29816169Shx147065 TX_CMD_FLG_IMM_BA_RSP_MASK = (1 << 6), 29826169Shx147065 TX_CMD_FLG_FULL_TXOP_PROT_MSK = (1 << 7), 29836169Shx147065 TX_CMD_FLG_ANT_SEL_MSK = 0xf00, 29846169Shx147065 TX_CMD_FLG_ANT_A_MSK = (1 << 8), 29856169Shx147065 TX_CMD_FLG_ANT_B_MSK = (1 << 9), 29866169Shx147065 29876169Shx147065 /* ucode ignores BT priority for this frame */ 29886169Shx147065 TX_CMD_FLG_BT_DIS_MSK = (1 << 12), 29896169Shx147065 29906169Shx147065 /* ucode overrides sequence control */ 29916169Shx147065 TX_CMD_FLG_SEQ_CTL_MSK = (1 << 13), 29926169Shx147065 29936169Shx147065 /* signal that this frame is non-last MPDU */ 29946169Shx147065 TX_CMD_FLG_MORE_FRAG_MSK = (1 << 14), 29956169Shx147065 29966169Shx147065 /* calculate TSF in outgoing frame */ 29976169Shx147065 TX_CMD_FLG_TSF_MSK = (1 << 16), 29986169Shx147065 29996169Shx147065 /* activate TX calibration. */ 30006169Shx147065 TX_CMD_FLG_CALIB_MSK = (1 << 17), 30016169Shx147065 30026169Shx147065 /* 30036169Shx147065 * signals that 2 bytes pad was inserted 30046169Shx147065 * after the MAC header 30056169Shx147065 */ 30066169Shx147065 TX_CMD_FLG_MH_PAD_MSK = (1 << 20), 30076169Shx147065 30086169Shx147065 /* HCCA-AP - disable duration overwriting. */ 30096169Shx147065 TX_CMD_FLG_DUR_MSK = (1 << 25), 30106169Shx147065 }; 30116169Shx147065 30126169Shx147065 /* 30136169Shx147065 * TX command security control 30146169Shx147065 */ 30156169Shx147065 #define TX_CMD_SEC_CCM 0x2 30166169Shx147065 #define TX_CMD_SEC_TKIP 0x3 30176169Shx147065 30186169Shx147065 /* 30196169Shx147065 * structure for command IWK_CMD_TX_DATA 30206169Shx147065 */ 30216169Shx147065 typedef struct iwk_tx_cmd { 30226169Shx147065 uint16_t len; 30236169Shx147065 uint16_t next_frame_len; 30246169Shx147065 uint32_t tx_flags; 30256169Shx147065 struct iwk_dram_scratch scratch; 30266169Shx147065 struct iwk_rate rate; 30276169Shx147065 uint8_t sta_id; 30286169Shx147065 uint8_t sec_ctl; 30296169Shx147065 uint8_t initial_rate_index; 30306169Shx147065 uint8_t reserved; 30316169Shx147065 uint8_t key[16]; 30326169Shx147065 uint16_t next_frame_flags; 30336169Shx147065 uint16_t reserved2; 30346169Shx147065 union { 30356169Shx147065 uint32_t life_time; 30366169Shx147065 uint32_t attempt; 30376169Shx147065 } stop_time; 30386169Shx147065 uint32_t dram_lsb_ptr; 30396169Shx147065 uint8_t dram_msb_ptr; 30406169Shx147065 uint8_t rts_retry_limit; 30416169Shx147065 uint8_t data_retry_limit; 30426169Shx147065 uint8_t tid_tspec; 30436169Shx147065 union { 30446169Shx147065 uint16_t pm_frame_timeout; 30456169Shx147065 uint16_t attempt_duration; 30466169Shx147065 } timeout; 30476169Shx147065 uint16_t driver_txop; 30486169Shx147065 } iwk_tx_cmd_t; 30496169Shx147065 30506169Shx147065 /* 30517569SXinghua.Wen@Sun.COM * structure for command "TX beacon" 30527569SXinghua.Wen@Sun.COM */ 30537569SXinghua.Wen@Sun.COM typedef struct iwk_tx_beacon_cmd { 30547569SXinghua.Wen@Sun.COM iwk_tx_cmd_t config; 30557569SXinghua.Wen@Sun.COM uint16_t tim_idx; 30567569SXinghua.Wen@Sun.COM uint8_t tim_size; 30577569SXinghua.Wen@Sun.COM uint8_t reserved; 30587569SXinghua.Wen@Sun.COM uint8_t bcon_frame[2342]; 30597569SXinghua.Wen@Sun.COM } iwk_tx_beacon_cmd_t; 30607569SXinghua.Wen@Sun.COM 30617569SXinghua.Wen@Sun.COM /* 30626169Shx147065 * LEDs Command & Response 30636169Shx147065 * REPLY_LEDS_CMD = 0x48 (command, has simple generic response) 30646169Shx147065 * 30656169Shx147065 * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), 30666169Shx147065 * this command turns it on or off, or sets up a periodic blinking cycle. 30676169Shx147065 */ 30686169Shx147065 typedef struct iwk_led_cmd { 30696169Shx147065 uint32_t interval; /* "interval" in uSec */ 30706169Shx147065 uint8_t id; /* 1: Activity, 2: Link, 3: Tech */ 30716169Shx147065 /* 30726169Shx147065 * # intervals off while blinking; 30736169Shx147065 * "0", with > 0 "on" value, turns LED on 30746169Shx147065 */ 30756169Shx147065 uint8_t off; 30766169Shx147065 /* 30776169Shx147065 * # intervals on while blinking; 30786169Shx147065 * "0", regardless of "off", turns LED off 30796169Shx147065 */ 30806169Shx147065 uint8_t on; 30816169Shx147065 uint8_t reserved; 30826169Shx147065 } iwk_led_cmd_t; 30836169Shx147065 30846169Shx147065 /* 30856169Shx147065 * structure for IWK_CMD_SET_POWER_MODE 30866169Shx147065 */ 30876169Shx147065 typedef struct iwk_powertable_cmd { 30886169Shx147065 uint16_t flags; 30896169Shx147065 uint8_t keep_alive_seconds; 30906169Shx147065 uint8_t debug_flags; 30916169Shx147065 uint32_t rx_timeout; 30926169Shx147065 uint32_t tx_timeout; 30936169Shx147065 uint32_t sleep[5]; 30946169Shx147065 uint32_t keep_alive_beacons; 30956169Shx147065 } iwk_powertable_cmd_t; 30966169Shx147065 30976169Shx147065 struct iwk_ssid_ie { 30986169Shx147065 uint8_t id; 30996169Shx147065 uint8_t len; 31006169Shx147065 uint8_t ssid[32]; 31016169Shx147065 }; 31026169Shx147065 /* 31036169Shx147065 * structure for command IWK_CMD_SCAN 31046169Shx147065 */ 31056169Shx147065 typedef struct iwk_scan_hdr { 31066169Shx147065 uint16_t len; 31076169Shx147065 uint8_t reserved1; 31086169Shx147065 uint8_t nchan; 31096169Shx147065 /* 31106169Shx147065 * dwell only this long on quiet chnl 31116169Shx147065 * (active scan) 31126169Shx147065 */ 31136169Shx147065 uint16_t quiet_time; 31146169Shx147065 uint16_t quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */ 31156169Shx147065 uint16_t good_crc_th; /* passive -> active promotion threshold */ 31166169Shx147065 uint16_t rx_chain; 31176169Shx147065 /* 31186169Shx147065 * max usec to be out of associated (service) 31196169Shx147065 * chnl 31206169Shx147065 */ 31216169Shx147065 uint32_t max_out_time; 31226169Shx147065 /* 31236169Shx147065 * pause scan this long when returning to svc 31246169Shx147065 * chnl. 31256169Shx147065 * 3945 -- 31:24 # beacons, 19:0 additional usec, 31266169Shx147065 * 4965 -- 31:22 # beacons, 21:0 additional usec. 31276169Shx147065 */ 31286169Shx147065 uint32_t suspend_time; 31296169Shx147065 uint32_t flags; 31306169Shx147065 uint32_t filter_flags; 31316169Shx147065 struct iwk_tx_cmd tx_cmd; 31326169Shx147065 struct iwk_ssid_ie direct_scan[4]; 31336169Shx147065 /* followed by probe request body */ 31346169Shx147065 /* followed by nchan x iwk_scan_chan */ 31356169Shx147065 } iwk_scan_hdr_t; 31366169Shx147065 31376169Shx147065 typedef struct iwk_scan_chan { 31386169Shx147065 uint8_t type; 31396169Shx147065 uint8_t chan; 31406169Shx147065 struct iwk_tx_power tpc; 31416169Shx147065 uint16_t active_dwell; /* dwell time */ 31426169Shx147065 uint16_t passive_dwell; /* dwell time */ 31436169Shx147065 } iwk_scan_chan_t; 31446169Shx147065 31456169Shx147065 /* 31466169Shx147065 * structure for IWK_CMD_BLUETOOTH 31476169Shx147065 */ 31486169Shx147065 typedef struct iwk_bt_cmd { 31496169Shx147065 uint8_t flags; 31506169Shx147065 uint8_t lead_time; 31516169Shx147065 uint8_t max_kill; 31526169Shx147065 uint8_t reserved; 31536169Shx147065 uint32_t kill_ack_mask; 31546169Shx147065 uint32_t kill_cts_mask; 31556169Shx147065 } iwk_bt_cmd_t; 31566169Shx147065 31576169Shx147065 /* 31586169Shx147065 * firmware image header 31596169Shx147065 */ 31606169Shx147065 typedef struct iwk_firmware_hdr { 31616169Shx147065 uint32_t version; 31626169Shx147065 uint32_t textsz; 31636169Shx147065 uint32_t datasz; 31646169Shx147065 uint32_t init_textsz; 31656169Shx147065 uint32_t init_datasz; 31666169Shx147065 uint32_t bootsz; 31676169Shx147065 } iwk_firmware_hdr_t; 31686169Shx147065 31696169Shx147065 /* 31706169Shx147065 * structure for IWK_START_SCAN notification 31716169Shx147065 */ 31726169Shx147065 typedef struct iwk_start_scan { 31736169Shx147065 uint32_t timestampl; 31746169Shx147065 uint32_t timestamph; 31756169Shx147065 uint32_t tbeacon; 31766169Shx147065 uint8_t chan; 31776169Shx147065 uint8_t band; 31786169Shx147065 uint16_t reserved; 31796169Shx147065 uint32_t status; 31806169Shx147065 } iwk_start_scan_t; 31816169Shx147065 3182*7691SPengcheng.Chen@Sun.COM /* 3183*7691SPengcheng.Chen@Sun.COM * structure for IWK_SCAN_COMPLETE notification 3184*7691SPengcheng.Chen@Sun.COM */ 3185*7691SPengcheng.Chen@Sun.COM typedef struct iwk_stop_scan { 3186*7691SPengcheng.Chen@Sun.COM uint8_t nchan; 3187*7691SPengcheng.Chen@Sun.COM uint8_t status; 3188*7691SPengcheng.Chen@Sun.COM uint8_t reserved; 3189*7691SPengcheng.Chen@Sun.COM uint8_t chan; 3190*7691SPengcheng.Chen@Sun.COM uint64_t tsf; 3191*7691SPengcheng.Chen@Sun.COM } iwk_stop_scan_t; 31926169Shx147065 31936169Shx147065 #define IWK_READ(sc, reg) \ 31946169Shx147065 ddi_get32((sc)->sc_handle, (uint32_t *)((sc)->sc_base + (reg))) 31956169Shx147065 31966169Shx147065 #define IWK_WRITE(sc, reg, val) \ 31976169Shx147065 ddi_put32((sc)->sc_handle, (uint32_t *)((sc)->sc_base + (reg)), (val)) 31986169Shx147065 31996169Shx147065 #ifdef __cplusplus 32006169Shx147065 } 32016169Shx147065 #endif 32026169Shx147065 32036169Shx147065 #endif /* _IWK_HW_H_ */ 3204