rt2800pci.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*
  2. Copyright (C) 2009 Ivo van Doorn <IvDoorn@gmail.com>
  3. Copyright (C) 2009 Alban Browaeys <prahal@yahoo.com>
  4. Copyright (C) 2009 Felix Fietkau <nbd@openwrt.org>
  5. Copyright (C) 2009 Luis Correia <luis.f.correia@gmail.com>
  6. Copyright (C) 2009 Mattias Nissler <mattias.nissler@gmx.de>
  7. Copyright (C) 2009 Mark Asselstine <asselsm@gmail.com>
  8. Copyright (C) 2009 Xose Vazquez Perez <xose.vazquez@gmail.com>
  9. Copyright (C) 2009 Bart Zolnierkiewicz <bzolnier@gmail.com>
  10. <http://rt2x00.serialmonkey.com>
  11. This program is free software; you can redistribute it and/or modify
  12. it under the terms of the GNU General Public License as published by
  13. the Free Software Foundation; either version 2 of the License, or
  14. (at your option) any later version.
  15. This program is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. GNU General Public License for more details.
  19. You should have received a copy of the GNU General Public License
  20. along with this program; if not, write to the
  21. Free Software Foundation, Inc.,
  22. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  23. */
  24. /*
  25. Module: rt2800pci
  26. Abstract: Data structures and registers for the rt2800pci module.
  27. Supported chipsets: RT2800E & RT2800ED.
  28. */
  29. #ifndef RT2800PCI_H
  30. #define RT2800PCI_H
  31. /*
  32. * PCI registers.
  33. */
  34. /*
  35. * E2PROM_CSR: EEPROM control register.
  36. * RELOAD: Write 1 to reload eeprom content.
  37. * TYPE: 0: 93c46, 1:93c66.
  38. * LOAD_STATUS: 1:loading, 0:done.
  39. */
  40. #define E2PROM_CSR 0x0004
  41. #define E2PROM_CSR_DATA_CLOCK FIELD32(0x00000001)
  42. #define E2PROM_CSR_CHIP_SELECT FIELD32(0x00000002)
  43. #define E2PROM_CSR_DATA_IN FIELD32(0x00000004)
  44. #define E2PROM_CSR_DATA_OUT FIELD32(0x00000008)
  45. #define E2PROM_CSR_TYPE FIELD32(0x00000030)
  46. #define E2PROM_CSR_LOAD_STATUS FIELD32(0x00000040)
  47. #define E2PROM_CSR_RELOAD FIELD32(0x00000080)
  48. /*
  49. * Queue register offset macros
  50. */
  51. #define TX_QUEUE_REG_OFFSET 0x10
  52. #define TX_BASE_PTR(__x) TX_BASE_PTR0 + ((__x) * TX_QUEUE_REG_OFFSET)
  53. #define TX_MAX_CNT(__x) TX_MAX_CNT0 + ((__x) * TX_QUEUE_REG_OFFSET)
  54. #define TX_CTX_IDX(__x) TX_CTX_IDX0 + ((__x) * TX_QUEUE_REG_OFFSET)
  55. #define TX_DTX_IDX(__x) TX_DTX_IDX0 + ((__x) * TX_QUEUE_REG_OFFSET)
  56. /*
  57. * 8051 firmware image.
  58. */
  59. #define FIRMWARE_RT2860 "rt2860.bin"
  60. #define FIRMWARE_IMAGE_BASE 0x2000
  61. /*
  62. * DMA descriptor defines.
  63. */
  64. #define TXD_DESC_SIZE ( 4 * sizeof(__le32) )
  65. #define RXD_DESC_SIZE ( 4 * sizeof(__le32) )
  66. /*
  67. * TX descriptor format for TX, PRIO and Beacon Ring.
  68. */
  69. /*
  70. * Word0
  71. */
  72. #define TXD_W0_SD_PTR0 FIELD32(0xffffffff)
  73. /*
  74. * Word1
  75. */
  76. #define TXD_W1_SD_LEN1 FIELD32(0x00003fff)
  77. #define TXD_W1_LAST_SEC1 FIELD32(0x00004000)
  78. #define TXD_W1_BURST FIELD32(0x00008000)
  79. #define TXD_W1_SD_LEN0 FIELD32(0x3fff0000)
  80. #define TXD_W1_LAST_SEC0 FIELD32(0x40000000)
  81. #define TXD_W1_DMA_DONE FIELD32(0x80000000)
  82. /*
  83. * Word2
  84. */
  85. #define TXD_W2_SD_PTR1 FIELD32(0xffffffff)
  86. /*
  87. * Word3
  88. * WIV: Wireless Info Valid. 1: Driver filled WI, 0: DMA needs to copy WI
  89. * QSEL: Select on-chip FIFO ID for 2nd-stage output scheduler.
  90. * 0:MGMT, 1:HCCA 2:EDCA
  91. */
  92. #define TXD_W3_WIV FIELD32(0x01000000)
  93. #define TXD_W3_QSEL FIELD32(0x06000000)
  94. #define TXD_W3_TCO FIELD32(0x20000000)
  95. #define TXD_W3_UCO FIELD32(0x40000000)
  96. #define TXD_W3_ICO FIELD32(0x80000000)
  97. /*
  98. * RX descriptor format for RX Ring.
  99. */
  100. /*
  101. * Word0
  102. */
  103. #define RXD_W0_SDP0 FIELD32(0xffffffff)
  104. /*
  105. * Word1
  106. */
  107. #define RXD_W1_SDL1 FIELD32(0x00003fff)
  108. #define RXD_W1_SDL0 FIELD32(0x3fff0000)
  109. #define RXD_W1_LS0 FIELD32(0x40000000)
  110. #define RXD_W1_DMA_DONE FIELD32(0x80000000)
  111. /*
  112. * Word2
  113. */
  114. #define RXD_W2_SDP1 FIELD32(0xffffffff)
  115. /*
  116. * Word3
  117. * AMSDU: RX with 802.3 header, not 802.11 header.
  118. * DECRYPTED: This frame is being decrypted.
  119. */
  120. #define RXD_W3_BA FIELD32(0x00000001)
  121. #define RXD_W3_DATA FIELD32(0x00000002)
  122. #define RXD_W3_NULLDATA FIELD32(0x00000004)
  123. #define RXD_W3_FRAG FIELD32(0x00000008)
  124. #define RXD_W3_UNICAST_TO_ME FIELD32(0x00000010)
  125. #define RXD_W3_MULTICAST FIELD32(0x00000020)
  126. #define RXD_W3_BROADCAST FIELD32(0x00000040)
  127. #define RXD_W3_MY_BSS FIELD32(0x00000080)
  128. #define RXD_W3_CRC_ERROR FIELD32(0x00000100)
  129. #define RXD_W3_CIPHER_ERROR FIELD32(0x00000600)
  130. #define RXD_W3_AMSDU FIELD32(0x00000800)
  131. #define RXD_W3_HTC FIELD32(0x00001000)
  132. #define RXD_W3_RSSI FIELD32(0x00002000)
  133. #define RXD_W3_L2PAD FIELD32(0x00004000)
  134. #define RXD_W3_AMPDU FIELD32(0x00008000)
  135. #define RXD_W3_DECRYPTED FIELD32(0x00010000)
  136. #define RXD_W3_PLCP_SIGNAL FIELD32(0x00020000)
  137. #define RXD_W3_PLCP_RSSI FIELD32(0x00040000)
  138. #endif /* RT2800PCI_H */