Back to home page

OSCL-LXR

 
 

    


0001 /******************************************************************************
0002  *
0003  * This file is provided under a dual BSD/GPLv2 license.  When using or
0004  * redistributing this file, you may do so under either license.
0005  *
0006  * GPL LICENSE SUMMARY
0007  *
0008  * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
0009  *
0010  * This program is free software; you can redistribute it and/or modify
0011  * it under the terms of version 2 of the GNU General Public License as
0012  * published by the Free Software Foundation.
0013  *
0014  * This program is distributed in the hope that it will be useful, but
0015  * WITHOUT ANY WARRANTY; without even the implied warranty of
0016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0017  * General Public License for more details.
0018  *
0019  * You should have received a copy of the GNU General Public License
0020  * along with this program; if not, write to the Free Software
0021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
0022  * USA
0023  *
0024  * The full GNU General Public License is included in this distribution
0025  * in the file called LICENSE.GPL.
0026  *
0027  * Contact Information:
0028  *  Intel Linux Wireless <ilw@linux.intel.com>
0029  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
0030  *
0031  * BSD LICENSE
0032  *
0033  * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
0034  * All rights reserved.
0035  *
0036  * Redistribution and use in source and binary forms, with or without
0037  * modification, are permitted provided that the following conditions
0038  * are met:
0039  *
0040  *  * Redistributions of source code must retain the above copyright
0041  *    notice, this list of conditions and the following disclaimer.
0042  *  * Redistributions in binary form must reproduce the above copyright
0043  *    notice, this list of conditions and the following disclaimer in
0044  *    the documentation and/or other materials provided with the
0045  *    distribution.
0046  *  * Neither the name Intel Corporation nor the names of its
0047  *    contributors may be used to endorse or promote products derived
0048  *    from this software without specific prior written permission.
0049  *
0050  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0051  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0052  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0053  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0054  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0055  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0056  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0057  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0058  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0059  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0060  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0061  *****************************************************************************/
0062 
0063 #ifndef __il_prph_h__
0064 #define __il_prph_h__
0065 
0066 /*
0067  * Registers in this file are internal, not PCI bus memory mapped.
0068  * Driver accesses these via HBUS_TARG_PRPH_* registers.
0069  */
0070 #define PRPH_BASE   (0x00000)
0071 #define PRPH_END    (0xFFFFF)
0072 
0073 /* APMG (power management) constants */
0074 #define APMG_BASE           (PRPH_BASE + 0x3000)
0075 #define APMG_CLK_CTRL_REG       (APMG_BASE + 0x0000)
0076 #define APMG_CLK_EN_REG         (APMG_BASE + 0x0004)
0077 #define APMG_CLK_DIS_REG        (APMG_BASE + 0x0008)
0078 #define APMG_PS_CTRL_REG        (APMG_BASE + 0x000c)
0079 #define APMG_PCIDEV_STT_REG     (APMG_BASE + 0x0010)
0080 #define APMG_RFKILL_REG         (APMG_BASE + 0x0014)
0081 #define APMG_RTC_INT_STT_REG        (APMG_BASE + 0x001c)
0082 #define APMG_RTC_INT_MSK_REG        (APMG_BASE + 0x0020)
0083 #define APMG_DIGITAL_SVR_REG        (APMG_BASE + 0x0058)
0084 #define APMG_ANALOG_SVR_REG     (APMG_BASE + 0x006C)
0085 
0086 #define APMS_CLK_VAL_MRB_FUNC_MODE  (0x00000001)
0087 #define APMG_CLK_VAL_DMA_CLK_RQT    (0x00000200)
0088 #define APMG_CLK_VAL_BSM_CLK_RQT    (0x00000800)
0089 
0090 #define APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS    (0x00400000)
0091 #define APMG_PS_CTRL_VAL_RESET_REQ      (0x04000000)
0092 #define APMG_PS_CTRL_MSK_PWR_SRC        (0x03000000)
0093 #define APMG_PS_CTRL_VAL_PWR_SRC_VMAIN      (0x00000000)
0094 #define APMG_PS_CTRL_VAL_PWR_SRC_MAX        (0x01000000)    /* 3945 only */
0095 #define APMG_PS_CTRL_VAL_PWR_SRC_VAUX       (0x02000000)
0096 #define APMG_SVR_VOLTAGE_CONFIG_BIT_MSK (0x000001E0)    /* bit 8:5 */
0097 #define APMG_SVR_DIGITAL_VOLTAGE_1_32       (0x00000060)
0098 
0099 #define APMG_PCIDEV_STT_VAL_L1_ACT_DIS      (0x00000800)
0100 
0101 /**
0102  * BSM (Bootstrap State Machine)
0103  *
0104  * The Bootstrap State Machine (BSM) stores a short bootstrap uCode program
0105  * in special SRAM that does not power down when the embedded control
0106  * processor is sleeping (e.g. for periodic power-saving shutdowns of radio).
0107  *
0108  * When powering back up after sleeps (or during initial uCode load), the BSM
0109  * internally loads the short bootstrap program from the special SRAM into the
0110  * embedded processor's instruction SRAM, and starts the processor so it runs
0111  * the bootstrap program.
0112  *
0113  * This bootstrap program loads (via PCI busmaster DMA) instructions and data
0114  * images for a uCode program from host DRAM locations.  The host driver
0115  * indicates DRAM locations and sizes for instruction and data images via the
0116  * four BSM_DRAM_* registers.  Once the bootstrap program loads the new program,
0117  * the new program starts automatically.
0118  *
0119  * The uCode used for open-source drivers includes two programs:
0120  *
0121  * 1)  Initialization -- performs hardware calibration and sets up some
0122  *     internal data, then notifies host via "initialize alive" notification
0123  *     (struct il_init_alive_resp) that it has completed all of its work.
0124  *     After signal from host, it then loads and starts the runtime program.
0125  *     The initialization program must be used when initially setting up the
0126  *     NIC after loading the driver.
0127  *
0128  * 2)  Runtime/Protocol -- performs all normal runtime operations.  This
0129  *     notifies host via "alive" notification (struct il_alive_resp) that it
0130  *     is ready to be used.
0131  *
0132  * When initializing the NIC, the host driver does the following procedure:
0133  *
0134  * 1)  Load bootstrap program (instructions only, no data image for bootstrap)
0135  *     into bootstrap memory.  Use dword writes starting at BSM_SRAM_LOWER_BOUND
0136  *
0137  * 2)  Point (via BSM_DRAM_*) to the "initialize" uCode data and instruction
0138  *     images in host DRAM.
0139  *
0140  * 3)  Set up BSM to copy from BSM SRAM into uCode instruction SRAM when asked:
0141  *     BSM_WR_MEM_SRC_REG = 0
0142  *     BSM_WR_MEM_DST_REG = RTC_INST_LOWER_BOUND
0143  *     BSM_WR_MEM_DWCOUNT_REG = # dwords in bootstrap instruction image
0144  *
0145  * 4)  Load bootstrap into instruction SRAM:
0146  *     BSM_WR_CTRL_REG = BSM_WR_CTRL_REG_BIT_START
0147  *
0148  * 5)  Wait for load completion:
0149  *     Poll BSM_WR_CTRL_REG for BSM_WR_CTRL_REG_BIT_START = 0
0150  *
0151  * 6)  Enable future boot loads whenever NIC's power management triggers it:
0152  *     BSM_WR_CTRL_REG = BSM_WR_CTRL_REG_BIT_START_EN
0153  *
0154  * 7)  Start the NIC by removing all reset bits:
0155  *     CSR_RESET = 0
0156  *
0157  *     The bootstrap uCode (already in instruction SRAM) loads initialization
0158  *     uCode.  Initialization uCode performs data initialization, sends
0159  *     "initialize alive" notification to host, and waits for a signal from
0160  *     host to load runtime code.
0161  *
0162  * 4)  Point (via BSM_DRAM_*) to the "runtime" uCode data and instruction
0163  *     images in host DRAM.  The last register loaded must be the instruction
0164  *     byte count register ("1" in MSbit tells initialization uCode to load
0165  *     the runtime uCode):
0166  *     BSM_DRAM_INST_BYTECOUNT_REG = byte count | BSM_DRAM_INST_LOAD
0167  *
0168  * 5)  Wait for "alive" notification, then issue normal runtime commands.
0169  *
0170  * Data caching during power-downs:
0171  *
0172  * Just before the embedded controller powers down (e.g for automatic
0173  * power-saving modes, or for RFKILL), uCode stores (via PCI busmaster DMA)
0174  * a current snapshot of the embedded processor's data SRAM into host DRAM.
0175  * This caches the data while the embedded processor's memory is powered down.
0176  * Location and size are controlled by BSM_DRAM_DATA_* registers.
0177  *
0178  * NOTE:  Instruction SRAM does not need to be saved, since that doesn't
0179  *        change during operation; the original image (from uCode distribution
0180  *        file) can be used for reload.
0181  *
0182  * When powering back up, the BSM loads the bootstrap program.  Bootstrap looks
0183  * at the BSM_DRAM_* registers, which now point to the runtime instruction
0184  * image and the cached (modified) runtime data (*not* the initialization
0185  * uCode).  Bootstrap reloads these runtime images into SRAM, and restarts the
0186  * uCode from where it left off before the power-down.
0187  *
0188  * NOTE:  Initialization uCode does *not* run as part of the save/restore
0189  *        procedure.
0190  *
0191  * This save/restore method is mostly for autonomous power management during
0192  * normal operation (result of C_POWER_TBL).  Platform suspend/resume and
0193  * RFKILL should use complete restarts (with total re-initialization) of uCode,
0194  * allowing total shutdown (including BSM memory).
0195  *
0196  * Note that, during normal operation, the host DRAM that held the initial
0197  * startup data for the runtime code is now being used as a backup data cache
0198  * for modified data!  If you need to completely re-initialize the NIC, make
0199  * sure that you use the runtime data image from the uCode distribution file,
0200  * not the modified/saved runtime data.  You may want to store a separate
0201  * "clean" runtime data image in DRAM to avoid disk reads of distribution file.
0202  */
0203 
0204 /* BSM bit fields */
0205 #define BSM_WR_CTRL_REG_BIT_START     (0x80000000)  /* start boot load now */
0206 #define BSM_WR_CTRL_REG_BIT_START_EN  (0x40000000)  /* enable boot after pwrup */
0207 #define BSM_DRAM_INST_LOAD            (0x80000000)  /* start program load now */
0208 
0209 /* BSM addresses */
0210 #define BSM_BASE                     (PRPH_BASE + 0x3400)
0211 #define BSM_END                      (PRPH_BASE + 0x3800)
0212 
0213 #define BSM_WR_CTRL_REG              (BSM_BASE + 0x000) /* ctl and status */
0214 #define BSM_WR_MEM_SRC_REG           (BSM_BASE + 0x004) /* source in BSM mem */
0215 #define BSM_WR_MEM_DST_REG           (BSM_BASE + 0x008) /* dest in SRAM mem */
0216 #define BSM_WR_DWCOUNT_REG           (BSM_BASE + 0x00C) /* bytes */
0217 #define BSM_WR_STATUS_REG            (BSM_BASE + 0x010) /* bit 0:  1 == done */
0218 
0219 /*
0220  * Pointers and size regs for bootstrap load and data SRAM save/restore.
0221  * NOTE:  3945 pointers use bits 31:0 of DRAM address.
0222  *        4965 pointers use bits 35:4 of DRAM address.
0223  */
0224 #define BSM_DRAM_INST_PTR_REG        (BSM_BASE + 0x090)
0225 #define BSM_DRAM_INST_BYTECOUNT_REG  (BSM_BASE + 0x094)
0226 #define BSM_DRAM_DATA_PTR_REG        (BSM_BASE + 0x098)
0227 #define BSM_DRAM_DATA_BYTECOUNT_REG  (BSM_BASE + 0x09C)
0228 
0229 /*
0230  * BSM special memory, stays powered on during power-save sleeps.
0231  * Read/write, address range from LOWER_BOUND to (LOWER_BOUND + SIZE -1)
0232  */
0233 #define BSM_SRAM_LOWER_BOUND         (PRPH_BASE + 0x3800)
0234 #define BSM_SRAM_SIZE           (1024)  /* bytes */
0235 
0236 /* 3945 Tx scheduler registers */
0237 #define ALM_SCD_BASE                        (PRPH_BASE + 0x2E00)
0238 #define ALM_SCD_MODE_REG                    (ALM_SCD_BASE + 0x000)
0239 #define ALM_SCD_ARASTAT_REG                 (ALM_SCD_BASE + 0x004)
0240 #define ALM_SCD_TXFACT_REG                  (ALM_SCD_BASE + 0x010)
0241 #define ALM_SCD_TXF4MF_REG                  (ALM_SCD_BASE + 0x014)
0242 #define ALM_SCD_TXF5MF_REG                  (ALM_SCD_BASE + 0x020)
0243 #define ALM_SCD_SBYP_MODE_1_REG             (ALM_SCD_BASE + 0x02C)
0244 #define ALM_SCD_SBYP_MODE_2_REG             (ALM_SCD_BASE + 0x030)
0245 
0246 /**
0247  * Tx Scheduler
0248  *
0249  * The Tx Scheduler selects the next frame to be transmitted, choosing TFDs
0250  * (Transmit Frame Descriptors) from up to 16 circular Tx queues resident in
0251  * host DRAM.  It steers each frame's Tx command (which contains the frame
0252  * data) into one of up to 7 prioritized Tx DMA FIFO channels within the
0253  * device.  A queue maps to only one (selectable by driver) Tx DMA channel,
0254  * but one DMA channel may take input from several queues.
0255  *
0256  * Tx DMA FIFOs have dedicated purposes.  For 4965, they are used as follows
0257  * (cf. default_queue_to_tx_fifo in 4965.c):
0258  *
0259  * 0 -- EDCA BK (background) frames, lowest priority
0260  * 1 -- EDCA BE (best effort) frames, normal priority
0261  * 2 -- EDCA VI (video) frames, higher priority
0262  * 3 -- EDCA VO (voice) and management frames, highest priority
0263  * 4 -- Commands (e.g. RXON, etc.)
0264  * 5 -- unused (HCCA)
0265  * 6 -- unused (HCCA)
0266  * 7 -- not used by driver (device-internal only)
0267  *
0268  *
0269  * Driver should normally map queues 0-6 to Tx DMA/FIFO channels 0-6.
0270  * In addition, driver can map the remaining queues to Tx DMA/FIFO
0271  * channels 0-3 to support 11n aggregation via EDCA DMA channels.
0272  *
0273  * The driver sets up each queue to work in one of two modes:
0274  *
0275  * 1)  Scheduler-Ack, in which the scheduler automatically supports a
0276  *     block-ack (BA) win of up to 64 TFDs.  In this mode, each queue
0277  *     contains TFDs for a unique combination of Recipient Address (RA)
0278  *     and Traffic Identifier (TID), that is, traffic of a given
0279  *     Quality-Of-Service (QOS) priority, destined for a single station.
0280  *
0281  *     In scheduler-ack mode, the scheduler keeps track of the Tx status of
0282  *     each frame within the BA win, including whether it's been transmitted,
0283  *     and whether it's been acknowledged by the receiving station.  The device
0284  *     automatically processes block-acks received from the receiving STA,
0285  *     and reschedules un-acked frames to be retransmitted (successful
0286  *     Tx completion may end up being out-of-order).
0287  *
0288  *     The driver must maintain the queue's Byte Count table in host DRAM
0289  *     (struct il4965_sched_queue_byte_cnt_tbl) for this mode.
0290  *     This mode does not support fragmentation.
0291  *
0292  * 2)  FIFO (a.k.a. non-Scheduler-ACK), in which each TFD is processed in order.
0293  *     The device may automatically retry Tx, but will retry only one frame
0294  *     at a time, until receiving ACK from receiving station, or reaching
0295  *     retry limit and giving up.
0296  *
0297  *     The command queue (#4/#9) must use this mode!
0298  *     This mode does not require use of the Byte Count table in host DRAM.
0299  *
0300  * Driver controls scheduler operation via 3 means:
0301  * 1)  Scheduler registers
0302  * 2)  Shared scheduler data base in internal 4956 SRAM
0303  * 3)  Shared data in host DRAM
0304  *
0305  * Initialization:
0306  *
0307  * When loading, driver should allocate memory for:
0308  * 1)  16 TFD circular buffers, each with space for (typically) 256 TFDs.
0309  * 2)  16 Byte Count circular buffers in 16 KBytes contiguous memory
0310  *     (1024 bytes for each queue).
0311  *
0312  * After receiving "Alive" response from uCode, driver must initialize
0313  * the scheduler (especially for queue #4/#9, the command queue, otherwise
0314  * the driver can't issue commands!):
0315  */
0316 
0317 /**
0318  * Max Tx win size is the max number of contiguous TFDs that the scheduler
0319  * can keep track of at one time when creating block-ack chains of frames.
0320  * Note that "64" matches the number of ack bits in a block-ack packet.
0321  * Driver should use SCD_WIN_SIZE and SCD_FRAME_LIMIT values to initialize
0322  * IL49_SCD_CONTEXT_QUEUE_OFFSET(x) values.
0323  */
0324 #define SCD_WIN_SIZE                64
0325 #define SCD_FRAME_LIMIT             64
0326 
0327 /* SCD registers are internal, must be accessed via HBUS_TARG_PRPH regs */
0328 #define IL49_SCD_START_OFFSET       0xa02c00
0329 
0330 /*
0331  * 4965 tells driver SRAM address for internal scheduler structs via this reg.
0332  * Value is valid only after "Alive" response from uCode.
0333  */
0334 #define IL49_SCD_SRAM_BASE_ADDR           (IL49_SCD_START_OFFSET + 0x0)
0335 
0336 /*
0337  * Driver may need to update queue-empty bits after changing queue's
0338  * write and read pointers (idxes) during (re-)initialization (i.e. when
0339  * scheduler is not tracking what's happening).
0340  * Bit fields:
0341  * 31-16:  Write mask -- 1: update empty bit, 0: don't change empty bit
0342  * 15-00:  Empty state, one for each queue -- 1: empty, 0: non-empty
0343  * NOTE:  This register is not used by Linux driver.
0344  */
0345 #define IL49_SCD_EMPTY_BITS               (IL49_SCD_START_OFFSET + 0x4)
0346 
0347 /*
0348  * Physical base address of array of byte count (BC) circular buffers (CBs).
0349  * Each Tx queue has a BC CB in host DRAM to support Scheduler-ACK mode.
0350  * This register points to BC CB for queue 0, must be on 1024-byte boundary.
0351  * Others are spaced by 1024 bytes.
0352  * Each BC CB is 2 bytes * (256 + 64) = 740 bytes, followed by 384 bytes pad.
0353  * (Index into a queue's BC CB) = (idx into queue's TFD CB) = (SSN & 0xff).
0354  * Bit fields:
0355  * 25-00:  Byte Count CB physical address [35:10], must be 1024-byte aligned.
0356  */
0357 #define IL49_SCD_DRAM_BASE_ADDR           (IL49_SCD_START_OFFSET + 0x10)
0358 
0359 /*
0360  * Enables any/all Tx DMA/FIFO channels.
0361  * Scheduler generates requests for only the active channels.
0362  * Set this to 0xff to enable all 8 channels (normal usage).
0363  * Bit fields:
0364  *  7- 0:  Enable (1), disable (0), one bit for each channel 0-7
0365  */
0366 #define IL49_SCD_TXFACT                   (IL49_SCD_START_OFFSET + 0x1c)
0367 /*
0368  * Queue (x) Write Pointers (idxes, really!), one for each Tx queue.
0369  * Initialized and updated by driver as new TFDs are added to queue.
0370  * NOTE:  If using Block Ack, idx must correspond to frame's
0371  *        Start Sequence Number; idx = (SSN & 0xff)
0372  * NOTE:  Alternative to HBUS_TARG_WRPTR, which is what Linux driver uses?
0373  */
0374 #define IL49_SCD_QUEUE_WRPTR(x)  (IL49_SCD_START_OFFSET + 0x24 + (x) * 4)
0375 
0376 /*
0377  * Queue (x) Read Pointers (idxes, really!), one for each Tx queue.
0378  * For FIFO mode, idx indicates next frame to transmit.
0379  * For Scheduler-ACK mode, idx indicates first frame in Tx win.
0380  * Initialized by driver, updated by scheduler.
0381  */
0382 #define IL49_SCD_QUEUE_RDPTR(x)  (IL49_SCD_START_OFFSET + 0x64 + (x) * 4)
0383 
0384 /*
0385  * Select which queues work in chain mode (1) vs. not (0).
0386  * Use chain mode to build chains of aggregated frames.
0387  * Bit fields:
0388  * 31-16:  Reserved
0389  * 15-00:  Mode, one bit for each queue -- 1: Chain mode, 0: one-at-a-time
0390  * NOTE:  If driver sets up queue for chain mode, it should be also set up
0391  *        Scheduler-ACK mode as well, via SCD_QUEUE_STATUS_BITS(x).
0392  */
0393 #define IL49_SCD_QUEUECHAIN_SEL  (IL49_SCD_START_OFFSET + 0xd0)
0394 
0395 /*
0396  * Select which queues interrupt driver when scheduler increments
0397  * a queue's read pointer (idx).
0398  * Bit fields:
0399  * 31-16:  Reserved
0400  * 15-00:  Interrupt enable, one bit for each queue -- 1: enabled, 0: disabled
0401  * NOTE:  This functionality is apparently a no-op; driver relies on interrupts
0402  *        from Rx queue to read Tx command responses and update Tx queues.
0403  */
0404 #define IL49_SCD_INTERRUPT_MASK  (IL49_SCD_START_OFFSET + 0xe4)
0405 
0406 /*
0407  * Queue search status registers.  One for each queue.
0408  * Sets up queue mode and assigns queue to Tx DMA channel.
0409  * Bit fields:
0410  * 19-10: Write mask/enable bits for bits 0-9
0411  *     9: Driver should init to "0"
0412  *     8: Scheduler-ACK mode (1), non-Scheduler-ACK (i.e. FIFO) mode (0).
0413  *        Driver should init to "1" for aggregation mode, or "0" otherwise.
0414  *   7-6: Driver should init to "0"
0415  *     5: Window Size Left; indicates whether scheduler can request
0416  *        another TFD, based on win size, etc.  Driver should init
0417  *        this bit to "1" for aggregation mode, or "0" for non-agg.
0418  *   4-1: Tx FIFO to use (range 0-7).
0419  *     0: Queue is active (1), not active (0).
0420  * Other bits should be written as "0"
0421  *
0422  * NOTE:  If enabling Scheduler-ACK mode, chain mode should also be enabled
0423  *        via SCD_QUEUECHAIN_SEL.
0424  */
0425 #define IL49_SCD_QUEUE_STATUS_BITS(x)\
0426     (IL49_SCD_START_OFFSET + 0x104 + (x) * 4)
0427 
0428 /* Bit field positions */
0429 #define IL49_SCD_QUEUE_STTS_REG_POS_ACTIVE  (0)
0430 #define IL49_SCD_QUEUE_STTS_REG_POS_TXF (1)
0431 #define IL49_SCD_QUEUE_STTS_REG_POS_WSL (5)
0432 #define IL49_SCD_QUEUE_STTS_REG_POS_SCD_ACK (8)
0433 
0434 /* Write masks */
0435 #define IL49_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN  (10)
0436 #define IL49_SCD_QUEUE_STTS_REG_MSK     (0x0007FC00)
0437 
0438 /**
0439  * 4965 internal SRAM structures for scheduler, shared with driver ...
0440  *
0441  * Driver should clear and initialize the following areas after receiving
0442  * "Alive" response from 4965 uCode, i.e. after initial
0443  * uCode load, or after a uCode load done for error recovery:
0444  *
0445  * SCD_CONTEXT_DATA_OFFSET (size 128 bytes)
0446  * SCD_TX_STTS_BITMAP_OFFSET (size 256 bytes)
0447  * SCD_TRANSLATE_TBL_OFFSET (size 32 bytes)
0448  *
0449  * Driver accesses SRAM via HBUS_TARG_MEM_* registers.
0450  * Driver reads base address of this scheduler area from SCD_SRAM_BASE_ADDR.
0451  * All OFFSET values must be added to this base address.
0452  */
0453 
0454 /*
0455  * Queue context.  One 8-byte entry for each of 16 queues.
0456  *
0457  * Driver should clear this entire area (size 0x80) to 0 after receiving
0458  * "Alive" notification from uCode.  Additionally, driver should init
0459  * each queue's entry as follows:
0460  *
0461  * LS Dword bit fields:
0462  *  0-06:  Max Tx win size for Scheduler-ACK.  Driver should init to 64.
0463  *
0464  * MS Dword bit fields:
0465  * 16-22:  Frame limit.  Driver should init to 10 (0xa).
0466  *
0467  * Driver should init all other bits to 0.
0468  *
0469  * Init must be done after driver receives "Alive" response from 4965 uCode,
0470  * and when setting up queue for aggregation.
0471  */
0472 #define IL49_SCD_CONTEXT_DATA_OFFSET            0x380
0473 #define IL49_SCD_CONTEXT_QUEUE_OFFSET(x) \
0474             (IL49_SCD_CONTEXT_DATA_OFFSET + ((x) * 8))
0475 
0476 #define IL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS        (0)
0477 #define IL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK        (0x0000007F)
0478 #define IL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS (16)
0479 #define IL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK (0x007F0000)
0480 
0481 /*
0482  * Tx Status Bitmap
0483  *
0484  * Driver should clear this entire area (size 0x100) to 0 after receiving
0485  * "Alive" notification from uCode.  Area is used only by device itself;
0486  * no other support (besides clearing) is required from driver.
0487  */
0488 #define IL49_SCD_TX_STTS_BITMAP_OFFSET      0x400
0489 
0490 /*
0491  * RAxTID to queue translation mapping.
0492  *
0493  * When queue is in Scheduler-ACK mode, frames placed in a that queue must be
0494  * for only one combination of receiver address (RA) and traffic ID (TID), i.e.
0495  * one QOS priority level destined for one station (for this wireless link,
0496  * not final destination).  The SCD_TRANSLATE_TBL area provides 16 16-bit
0497  * mappings, one for each of the 16 queues.  If queue is not in Scheduler-ACK
0498  * mode, the device ignores the mapping value.
0499  *
0500  * Bit fields, for each 16-bit map:
0501  * 15-9:  Reserved, set to 0
0502  *  8-4:  Index into device's station table for recipient station
0503  *  3-0:  Traffic ID (tid), range 0-15
0504  *
0505  * Driver should clear this entire area (size 32 bytes) to 0 after receiving
0506  * "Alive" notification from uCode.  To update a 16-bit map value, driver
0507  * must read a dword-aligned value from device SRAM, replace the 16-bit map
0508  * value of interest, and write the dword value back into device SRAM.
0509  */
0510 #define IL49_SCD_TRANSLATE_TBL_OFFSET       0x500
0511 
0512 /* Find translation table dword to read/write for given queue */
0513 #define IL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(x) \
0514     ((IL49_SCD_TRANSLATE_TBL_OFFSET + ((x) * 2)) & 0xfffffffc)
0515 
0516 #define IL_SCD_TXFIFO_POS_TID           (0)
0517 #define IL_SCD_TXFIFO_POS_RA            (4)
0518 #define IL_SCD_QUEUE_RA_TID_MAP_RATID_MSK   (0x01FF)
0519 
0520 /*********************** END TX SCHEDULER *************************************/
0521 
0522 #endif /* __il_prph_h__ */