diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-prph.h')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-prph.h | 333 |
1 files changed, 301 insertions, 32 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h index c9cf8eef1a90..70d9c7568b98 100644 --- a/drivers/net/wireless/iwlwifi/iwl-prph.h +++ b/drivers/net/wireless/iwlwifi/iwl-prph.h | |||
@@ -239,40 +239,307 @@ | |||
239 | #define ALM_SCD_SBYP_MODE_1_REG (ALM_SCD_BASE + 0x02C) | 239 | #define ALM_SCD_SBYP_MODE_1_REG (ALM_SCD_BASE + 0x02C) |
240 | #define ALM_SCD_SBYP_MODE_2_REG (ALM_SCD_BASE + 0x030) | 240 | #define ALM_SCD_SBYP_MODE_2_REG (ALM_SCD_BASE + 0x030) |
241 | 241 | ||
242 | /** | ||
243 | * Tx Scheduler | ||
244 | * | ||
245 | * The Tx Scheduler selects the next frame to be transmitted, chosing TFDs | ||
246 | * (Transmit Frame Descriptors) from up to 16 circular Tx queues resident in | ||
247 | * host DRAM. It steers each frame's Tx command (which contains the frame | ||
248 | * data) into one of up to 7 prioritized Tx DMA FIFO channels within the | ||
249 | * device. A queue maps to only one (selectable by driver) Tx DMA channel, | ||
250 | * but one DMA channel may take input from several queues. | ||
251 | * | ||
252 | * Tx DMA channels have dedicated purposes. For 4965, they are used as follows: | ||
253 | * | ||
254 | * 0 -- EDCA BK (background) frames, lowest priority | ||
255 | * 1 -- EDCA BE (best effort) frames, normal priority | ||
256 | * 2 -- EDCA VI (video) frames, higher priority | ||
257 | * 3 -- EDCA VO (voice) and management frames, highest priority | ||
258 | * 4 -- Commands (e.g. RXON, etc.) | ||
259 | * 5 -- HCCA short frames | ||
260 | * 6 -- HCCA long frames | ||
261 | * 7 -- not used by driver (device-internal only) | ||
262 | * | ||
263 | * Driver should normally map queues 0-6 to Tx DMA/FIFO channels 0-6. | ||
264 | * In addition, driver can map queues 7-15 to Tx DMA/FIFO channels 0-3 to | ||
265 | * support 11n aggregation via EDCA DMA channels. | ||
266 | * | ||
267 | * The driver sets up each queue to work in one of two modes: | ||
268 | * | ||
269 | * 1) Scheduler-Ack, in which the scheduler automatically supports a | ||
270 | * block-ack (BA) window of up to 64 TFDs. In this mode, each queue | ||
271 | * contains TFDs for a unique combination of Recipient Address (RA) | ||
272 | * and Traffic Identifier (TID), that is, traffic of a given | ||
273 | * Quality-Of-Service (QOS) priority, destined for a single station. | ||
274 | * | ||
275 | * In scheduler-ack mode, the scheduler keeps track of the Tx status of | ||
276 | * each frame within the BA window, including whether it's been transmitted, | ||
277 | * and whether it's been acknowledged by the receiving station. The device | ||
278 | * automatically processes block-acks received from the receiving STA, | ||
279 | * and reschedules un-acked frames to be retransmitted (successful | ||
280 | * Tx completion may end up being out-of-order). | ||
281 | * | ||
282 | * The driver must maintain the queue's Byte Count table in host DRAM | ||
283 | * (struct iwl4965_sched_queue_byte_cnt_tbl) for this mode. | ||
284 | * This mode does not support fragmentation. | ||
285 | * | ||
286 | * 2) FIFO (a.k.a. non-Scheduler-ACK), in which each TFD is processed in order. | ||
287 | * The device may automatically retry Tx, but will retry only one frame | ||
288 | * at a time, until receiving ACK from receiving station, or reaching | ||
289 | * retry limit and giving up. | ||
290 | * | ||
291 | * The command queue (#4) must use this mode! | ||
292 | * This mode does not require use of the Byte Count table in host DRAM. | ||
293 | * | ||
294 | * Driver controls scheduler operation via 3 means: | ||
295 | * 1) Scheduler registers | ||
296 | * 2) Shared scheduler data base in internal 4956 SRAM | ||
297 | * 3) Shared data in host DRAM | ||
298 | * | ||
299 | * Initialization: | ||
300 | * | ||
301 | * When loading, driver should allocate memory for: | ||
302 | * 1) 16 TFD circular buffers, each with space for (typically) 256 TFDs. | ||
303 | * 2) 16 Byte Count circular buffers in 16 KBytes contiguous memory | ||
304 | * (1024 bytes for each queue). | ||
305 | * | ||
306 | * After receiving "Alive" response from uCode, driver must initialize | ||
307 | * the scheduler (especially for queue #4, the command queue, otherwise | ||
308 | * the driver can't issue commands!): | ||
309 | */ | ||
310 | |||
311 | /** | ||
312 | * Max Tx window size is the max number of contiguous TFDs that the scheduler | ||
313 | * can keep track of at one time when creating block-ack chains of frames. | ||
314 | * Note that "64" matches the number of ack bits in a block-ack packet. | ||
315 | * Driver should use SCD_WIN_SIZE and SCD_FRAME_LIMIT values to initialize | ||
316 | * IWL49_SCD_CONTEXT_QUEUE_OFFSET(x) values. | ||
317 | */ | ||
318 | #define SCD_WIN_SIZE 64 | ||
319 | #define SCD_FRAME_LIMIT 64 | ||
320 | |||
321 | /* SCD registers are internal, must be accessed via HBUS_TARG_PRPH regs */ | ||
322 | #define IWL49_SCD_START_OFFSET 0xa02c00 | ||
323 | |||
324 | /* | ||
325 | * 4965 tells driver SRAM address for internal scheduler structs via this reg. | ||
326 | * Value is valid only after "Alive" response from uCode. | ||
327 | */ | ||
328 | #define IWL49_SCD_SRAM_BASE_ADDR (IWL49_SCD_START_OFFSET + 0x0) | ||
329 | |||
330 | /* | ||
331 | * Driver may need to update queue-empty bits after changing queue's | ||
332 | * write and read pointers (indexes) during (re-)initialization (i.e. when | ||
333 | * scheduler is not tracking what's happening). | ||
334 | * Bit fields: | ||
335 | * 31-16: Write mask -- 1: update empty bit, 0: don't change empty bit | ||
336 | * 15-00: Empty state, one for each queue -- 1: empty, 0: non-empty | ||
337 | * NOTE: This register is not used by Linux driver. | ||
338 | */ | ||
339 | #define IWL49_SCD_EMPTY_BITS (IWL49_SCD_START_OFFSET + 0x4) | ||
340 | |||
341 | /* | ||
342 | * Physical base address of array of byte count (BC) circular buffers (CBs). | ||
343 | * Each Tx queue has a BC CB in host DRAM to support Scheduler-ACK mode. | ||
344 | * This register points to BC CB for queue 0, must be on 1024-byte boundary. | ||
345 | * Others are spaced by 1024 bytes. | ||
346 | * Each BC CB is 2 bytes * (256 + 64) = 740 bytes, followed by 384 bytes pad. | ||
347 | * (Index into a queue's BC CB) = (index into queue's TFD CB) = (SSN & 0xff). | ||
348 | * Bit fields: | ||
349 | * 25-00: Byte Count CB physical address [35:10], must be 1024-byte aligned. | ||
350 | */ | ||
351 | #define IWL49_SCD_DRAM_BASE_ADDR (IWL49_SCD_START_OFFSET + 0x10) | ||
352 | |||
353 | /* | ||
354 | * Enables any/all Tx DMA/FIFO channels. | ||
355 | * Scheduler generates requests for only the active channels. | ||
356 | * Set this to 0xff to enable all 8 channels (normal usage). | ||
357 | * Bit fields: | ||
358 | * 7- 0: Enable (1), disable (0), one bit for each channel 0-7 | ||
359 | */ | ||
360 | #define IWL49_SCD_TXFACT (IWL49_SCD_START_OFFSET + 0x1c) | ||
361 | /* | ||
362 | * Queue (x) Write Pointers (indexes, really!), one for each Tx queue. | ||
363 | * Initialized and updated by driver as new TFDs are added to queue. | ||
364 | * NOTE: If using Block Ack, index must correspond to frame's | ||
365 | * Start Sequence Number; index = (SSN & 0xff) | ||
366 | * NOTE: Alternative to HBUS_TARG_WRPTR, which is what Linux driver uses? | ||
367 | */ | ||
368 | #define IWL49_SCD_QUEUE_WRPTR(x) (IWL49_SCD_START_OFFSET + 0x24 + (x) * 4) | ||
369 | |||
370 | /* | ||
371 | * Queue (x) Read Pointers (indexes, really!), one for each Tx queue. | ||
372 | * For FIFO mode, index indicates next frame to transmit. | ||
373 | * For Scheduler-ACK mode, index indicates first frame in Tx window. | ||
374 | * Initialized by driver, updated by scheduler. | ||
375 | */ | ||
376 | #define IWL49_SCD_QUEUE_RDPTR(x) (IWL49_SCD_START_OFFSET + 0x64 + (x) * 4) | ||
377 | |||
378 | /* | ||
379 | * Select which queues work in chain mode (1) vs. not (0). | ||
380 | * Use chain mode to build chains of aggregated frames. | ||
381 | * Bit fields: | ||
382 | * 31-16: Reserved | ||
383 | * 15-00: Mode, one bit for each queue -- 1: Chain mode, 0: one-at-a-time | ||
384 | * NOTE: If driver sets up queue for chain mode, it should be also set up | ||
385 | * Scheduler-ACK mode as well, via SCD_QUEUE_STATUS_BITS(x). | ||
386 | */ | ||
387 | #define IWL49_SCD_QUEUECHAIN_SEL (IWL49_SCD_START_OFFSET + 0xd0) | ||
388 | |||
389 | /* | ||
390 | * Select which queues interrupt driver when scheduler increments | ||
391 | * a queue's read pointer (index). | ||
392 | * Bit fields: | ||
393 | * 31-16: Reserved | ||
394 | * 15-00: Interrupt enable, one bit for each queue -- 1: enabled, 0: disabled | ||
395 | * NOTE: This functionality is apparently a no-op; driver relies on interrupts | ||
396 | * from Rx queue to read Tx command responses and update Tx queues. | ||
397 | */ | ||
398 | #define IWL49_SCD_INTERRUPT_MASK (IWL49_SCD_START_OFFSET + 0xe4) | ||
399 | |||
400 | /* | ||
401 | * Queue search status registers. One for each queue. | ||
402 | * Sets up queue mode and assigns queue to Tx DMA channel. | ||
403 | * Bit fields: | ||
404 | * 19-10: Write mask/enable bits for bits 0-9 | ||
405 | * 9: Driver should init to "0" | ||
406 | * 8: Scheduler-ACK mode (1), non-Scheduler-ACK (i.e. FIFO) mode (0). | ||
407 | * Driver should init to "1" for aggregation mode, or "0" otherwise. | ||
408 | * 7-6: Driver should init to "0" | ||
409 | * 5: Window Size Left; indicates whether scheduler can request | ||
410 | * another TFD, based on window size, etc. Driver should init | ||
411 | * this bit to "1" for aggregation mode, or "0" for non-agg. | ||
412 | * 4-1: Tx FIFO to use (range 0-7). | ||
413 | * 0: Queue is active (1), not active (0). | ||
414 | * Other bits should be written as "0" | ||
415 | * | ||
416 | * NOTE: If enabling Scheduler-ACK mode, chain mode should also be enabled | ||
417 | * via SCD_QUEUECHAIN_SEL. | ||
418 | */ | ||
419 | #define IWL49_SCD_QUEUE_STATUS_BITS(x)\ | ||
420 | (IWL49_SCD_START_OFFSET + 0x104 + (x) * 4) | ||
421 | |||
422 | /* Bit field positions */ | ||
423 | #define IWL49_SCD_QUEUE_STTS_REG_POS_ACTIVE (0) | ||
424 | #define IWL49_SCD_QUEUE_STTS_REG_POS_TXF (1) | ||
425 | #define IWL49_SCD_QUEUE_STTS_REG_POS_WSL (5) | ||
426 | #define IWL49_SCD_QUEUE_STTS_REG_POS_SCD_ACK (8) | ||
427 | |||
428 | /* Write masks */ | ||
429 | #define IWL49_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN (10) | ||
430 | #define IWL49_SCD_QUEUE_STTS_REG_MSK (0x0007FC00) | ||
431 | |||
432 | /** | ||
433 | * 4965 internal SRAM structures for scheduler, shared with driver ... | ||
434 | * | ||
435 | * Driver should clear and initialize the following areas after receiving | ||
436 | * "Alive" response from 4965 uCode, i.e. after initial | ||
437 | * uCode load, or after a uCode load done for error recovery: | ||
438 | * | ||
439 | * SCD_CONTEXT_DATA_OFFSET (size 128 bytes) | ||
440 | * SCD_TX_STTS_BITMAP_OFFSET (size 256 bytes) | ||
441 | * SCD_TRANSLATE_TBL_OFFSET (size 32 bytes) | ||
442 | * | ||
443 | * Driver accesses SRAM via HBUS_TARG_MEM_* registers. | ||
444 | * Driver reads base address of this scheduler area from SCD_SRAM_BASE_ADDR. | ||
445 | * All OFFSET values must be added to this base address. | ||
446 | */ | ||
447 | |||
448 | /* | ||
449 | * Queue context. One 8-byte entry for each of 16 queues. | ||
450 | * | ||
451 | * Driver should clear this entire area (size 0x80) to 0 after receiving | ||
452 | * "Alive" notification from uCode. Additionally, driver should init | ||
453 | * each queue's entry as follows: | ||
454 | * | ||
455 | * LS Dword bit fields: | ||
456 | * 0-06: Max Tx window size for Scheduler-ACK. Driver should init to 64. | ||
457 | * | ||
458 | * MS Dword bit fields: | ||
459 | * 16-22: Frame limit. Driver should init to 10 (0xa). | ||
460 | * | ||
461 | * Driver should init all other bits to 0. | ||
462 | * | ||
463 | * Init must be done after driver receives "Alive" response from 4965 uCode, | ||
464 | * and when setting up queue for aggregation. | ||
465 | */ | ||
466 | #define IWL49_SCD_CONTEXT_DATA_OFFSET 0x380 | ||
467 | #define IWL49_SCD_CONTEXT_QUEUE_OFFSET(x) \ | ||
468 | (IWL49_SCD_CONTEXT_DATA_OFFSET + ((x) * 8)) | ||
469 | |||
470 | #define IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS (0) | ||
471 | #define IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK (0x0000007F) | ||
472 | #define IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS (16) | ||
473 | #define IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK (0x007F0000) | ||
474 | |||
475 | /* | ||
476 | * Tx Status Bitmap | ||
477 | * | ||
478 | * Driver should clear this entire area (size 0x100) to 0 after receiving | ||
479 | * "Alive" notification from uCode. Area is used only by device itself; | ||
480 | * no other support (besides clearing) is required from driver. | ||
481 | */ | ||
482 | #define IWL49_SCD_TX_STTS_BITMAP_OFFSET 0x400 | ||
483 | |||
242 | /* | 484 | /* |
243 | * 4965 Tx Scheduler registers. | 485 | * RAxTID to queue translation mapping. |
244 | * Details are documented in iwl-4965-hw.h | 486 | * |
487 | * When queue is in Scheduler-ACK mode, frames placed in a that queue must be | ||
488 | * for only one combination of receiver address (RA) and traffic ID (TID), i.e. | ||
489 | * one QOS priority level destined for one station (for this wireless link, | ||
490 | * not final destination). The SCD_TRANSLATE_TABLE area provides 16 16-bit | ||
491 | * mappings, one for each of the 16 queues. If queue is not in Scheduler-ACK | ||
492 | * mode, the device ignores the mapping value. | ||
493 | * | ||
494 | * Bit fields, for each 16-bit map: | ||
495 | * 15-9: Reserved, set to 0 | ||
496 | * 8-4: Index into device's station table for recipient station | ||
497 | * 3-0: Traffic ID (tid), range 0-15 | ||
498 | * | ||
499 | * Driver should clear this entire area (size 32 bytes) to 0 after receiving | ||
500 | * "Alive" notification from uCode. To update a 16-bit map value, driver | ||
501 | * must read a dword-aligned value from device SRAM, replace the 16-bit map | ||
502 | * value of interest, and write the dword value back into device SRAM. | ||
245 | */ | 503 | */ |
246 | #define IWL49_SCD_BASE (PRPH_BASE + 0xa02c00) | 504 | #define IWL49_SCD_TRANSLATE_TBL_OFFSET 0x500 |
247 | 505 | ||
248 | #define IWL49_SCD_SRAM_BASE_ADDR (IWL49_SCD_BASE + 0x0) | 506 | /* Find translation table dword to read/write for given queue */ |
249 | #define IWL49_SCD_EMPTY_BITS (IWL49_SCD_BASE + 0x4) | 507 | #define IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(x) \ |
250 | #define IWL49_SCD_DRAM_BASE_ADDR (IWL49_SCD_BASE + 0x10) | 508 | ((IWL49_SCD_TRANSLATE_TBL_OFFSET + ((x) * 2)) & 0xfffffffc) |
251 | #define IWL49_SCD_AIT (IWL49_SCD_BASE + 0x18) | 509 | |
252 | #define IWL49_SCD_TXFACT (IWL49_SCD_BASE + 0x1c) | 510 | #define IWL_SCD_TXFIFO_POS_TID (0) |
253 | #define IWL49_SCD_QUEUE_WRPTR(x) (IWL49_SCD_BASE + 0x24 + (x) * 4) | 511 | #define IWL_SCD_TXFIFO_POS_RA (4) |
254 | #define IWL49_SCD_QUEUE_RDPTR(x) (IWL49_SCD_BASE + 0x64 + (x) * 4) | 512 | #define IWL_SCD_QUEUE_RA_TID_MAP_RATID_MSK (0x01FF) |
255 | #define IWL49_SCD_SETQUEUENUM (IWL49_SCD_BASE + 0xa4) | 513 | |
256 | #define IWL49_SCD_SET_TXSTAT_TXED (IWL49_SCD_BASE + 0xa8) | 514 | /* 5000 SCD */ |
257 | #define IWL49_SCD_SET_TXSTAT_DONE (IWL49_SCD_BASE + 0xac) | 515 | #define IWL50_SCD_QUEUE_STTS_REG_POS_TXF (0) |
258 | #define IWL49_SCD_SET_TXSTAT_NOT_SCHD (IWL49_SCD_BASE + 0xb0) | 516 | #define IWL50_SCD_QUEUE_STTS_REG_POS_ACTIVE (3) |
259 | #define IWL49_SCD_DECREASE_CREDIT (IWL49_SCD_BASE + 0xb4) | 517 | #define IWL50_SCD_QUEUE_STTS_REG_POS_WSL (4) |
260 | #define IWL49_SCD_DECREASE_SCREDIT (IWL49_SCD_BASE + 0xb8) | 518 | #define IWL50_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN (19) |
261 | #define IWL49_SCD_LOAD_CREDIT (IWL49_SCD_BASE + 0xbc) | 519 | #define IWL50_SCD_QUEUE_STTS_REG_MSK (0x00FF0000) |
262 | #define IWL49_SCD_LOAD_SCREDIT (IWL49_SCD_BASE + 0xc0) | 520 | |
263 | #define IWL49_SCD_BAR (IWL49_SCD_BASE + 0xc4) | 521 | #define IWL50_SCD_QUEUE_CTX_REG1_CREDIT_POS (8) |
264 | #define IWL49_SCD_BAR_DW0 (IWL49_SCD_BASE + 0xc8) | 522 | #define IWL50_SCD_QUEUE_CTX_REG1_CREDIT_MSK (0x00FFFF00) |
265 | #define IWL49_SCD_BAR_DW1 (IWL49_SCD_BASE + 0xcc) | 523 | #define IWL50_SCD_QUEUE_CTX_REG1_SUPER_CREDIT_POS (24) |
266 | #define IWL49_SCD_QUEUECHAIN_SEL (IWL49_SCD_BASE + 0xd0) | 524 | #define IWL50_SCD_QUEUE_CTX_REG1_SUPER_CREDIT_MSK (0xFF000000) |
267 | #define IWL49_SCD_QUERY_REQ (IWL49_SCD_BASE + 0xd8) | 525 | #define IWL50_SCD_QUEUE_CTX_REG2_WIN_SIZE_POS (0) |
268 | #define IWL49_SCD_QUERY_RES (IWL49_SCD_BASE + 0xdc) | 526 | #define IWL50_SCD_QUEUE_CTX_REG2_WIN_SIZE_MSK (0x0000007F) |
269 | #define IWL49_SCD_PENDING_FRAMES (IWL49_SCD_BASE + 0xe0) | 527 | #define IWL50_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS (16) |
270 | #define IWL49_SCD_INTERRUPT_MASK (IWL49_SCD_BASE + 0xe4) | 528 | #define IWL50_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK (0x007F0000) |
271 | #define IWL49_SCD_INTERRUPT_THRESHOLD (IWL49_SCD_BASE + 0xe8) | 529 | |
272 | #define IWL49_SCD_QUERY_MIN_FRAME_SIZE (IWL49_SCD_BASE + 0x100) | 530 | #define IWL50_SCD_CONTEXT_DATA_OFFSET (0x600) |
273 | #define IWL49_SCD_QUEUE_STATUS_BITS(x) (IWL49_SCD_BASE + 0x104 + (x) * 4) | 531 | #define IWL50_SCD_TX_STTS_BITMAP_OFFSET (0x7B1) |
274 | 532 | #define IWL50_SCD_TRANSLATE_TBL_OFFSET (0x7E0) | |
275 | /* SP SCD */ | 533 | |
534 | #define IWL50_SCD_CONTEXT_QUEUE_OFFSET(x)\ | ||
535 | (IWL50_SCD_CONTEXT_DATA_OFFSET + ((x) * 8)) | ||
536 | |||
537 | #define IWL50_SCD_TRANSLATE_TBL_OFFSET_QUEUE(x) \ | ||
538 | ((IWL50_SCD_TRANSLATE_TBL_OFFSET + ((x) * 2)) & 0xfffc) | ||
539 | |||
540 | #define IWL50_SCD_QUEUECHAIN_SEL_ALL(x) (((1<<(x)) - 1) &\ | ||
541 | (~(1<<IWL_CMD_QUEUE_NUM))) | ||
542 | |||
276 | #define IWL50_SCD_BASE (PRPH_BASE + 0xa02c00) | 543 | #define IWL50_SCD_BASE (PRPH_BASE + 0xa02c00) |
277 | 544 | ||
278 | #define IWL50_SCD_SRAM_BASE_ADDR (IWL50_SCD_BASE + 0x0) | 545 | #define IWL50_SCD_SRAM_BASE_ADDR (IWL50_SCD_BASE + 0x0) |
@@ -287,4 +554,6 @@ | |||
287 | #define IWL50_SCD_INTERRUPT_MASK (IWL50_SCD_BASE + 0x108) | 554 | #define IWL50_SCD_INTERRUPT_MASK (IWL50_SCD_BASE + 0x108) |
288 | #define IWL50_SCD_QUEUE_STATUS_BITS(x) (IWL50_SCD_BASE + 0x10c + (x) * 4) | 555 | #define IWL50_SCD_QUEUE_STATUS_BITS(x) (IWL50_SCD_BASE + 0x10c + (x) * 4) |
289 | 556 | ||
557 | /*********************** END TX SCHEDULER *************************************/ | ||
558 | |||
290 | #endif /* __iwl_prph_h__ */ | 559 | #endif /* __iwl_prph_h__ */ |