diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2008-04-23 20:15:04 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-05-07 15:02:19 -0400 |
commit | 038669e49c30867956a7fa0d06c6e0e72bb38fa8 (patch) | |
tree | 5911d8cb49f67da53a4a5261747951c88b77bde9 /drivers/net | |
parent | 07bc28ed87424af13f622b7c4e2a1bff06112d94 (diff) |
iwlwifi: clean up register names and defines
This patch cleans up and renames some of the SCD registers.
It move SCD definitions into iwl-prhp.h file
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965-hw.h | 298 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 66 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-prph.h | 310 |
3 files changed, 320 insertions, 354 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h index 4f45093ab3ba..38627040ad59 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h | |||
@@ -1072,286 +1072,6 @@ enum { | |||
1072 | (IWL_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_chnl) | \ | 1072 | (IWL_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_chnl) | \ |
1073 | IWL_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_chnl)) | 1073 | IWL_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_chnl)) |
1074 | 1074 | ||
1075 | |||
1076 | /********************* START TX SCHEDULER *************************************/ | ||
1077 | |||
1078 | /** | ||
1079 | * 4965 Tx Scheduler | ||
1080 | * | ||
1081 | * The Tx Scheduler selects the next frame to be transmitted, chosing TFDs | ||
1082 | * (Transmit Frame Descriptors) from up to 16 circular Tx queues resident in | ||
1083 | * host DRAM. It steers each frame's Tx command (which contains the frame | ||
1084 | * data) into one of up to 7 prioritized Tx DMA FIFO channels within the | ||
1085 | * device. A queue maps to only one (selectable by driver) Tx DMA channel, | ||
1086 | * but one DMA channel may take input from several queues. | ||
1087 | * | ||
1088 | * Tx DMA channels have dedicated purposes. For 4965, they are used as follows: | ||
1089 | * | ||
1090 | * 0 -- EDCA BK (background) frames, lowest priority | ||
1091 | * 1 -- EDCA BE (best effort) frames, normal priority | ||
1092 | * 2 -- EDCA VI (video) frames, higher priority | ||
1093 | * 3 -- EDCA VO (voice) and management frames, highest priority | ||
1094 | * 4 -- Commands (e.g. RXON, etc.) | ||
1095 | * 5 -- HCCA short frames | ||
1096 | * 6 -- HCCA long frames | ||
1097 | * 7 -- not used by driver (device-internal only) | ||
1098 | * | ||
1099 | * Driver should normally map queues 0-6 to Tx DMA/FIFO channels 0-6. | ||
1100 | * In addition, driver can map queues 7-15 to Tx DMA/FIFO channels 0-3 to | ||
1101 | * support 11n aggregation via EDCA DMA channels. | ||
1102 | * | ||
1103 | * The driver sets up each queue to work in one of two modes: | ||
1104 | * | ||
1105 | * 1) Scheduler-Ack, in which the scheduler automatically supports a | ||
1106 | * block-ack (BA) window of up to 64 TFDs. In this mode, each queue | ||
1107 | * contains TFDs for a unique combination of Recipient Address (RA) | ||
1108 | * and Traffic Identifier (TID), that is, traffic of a given | ||
1109 | * Quality-Of-Service (QOS) priority, destined for a single station. | ||
1110 | * | ||
1111 | * In scheduler-ack mode, the scheduler keeps track of the Tx status of | ||
1112 | * each frame within the BA window, including whether it's been transmitted, | ||
1113 | * and whether it's been acknowledged by the receiving station. The device | ||
1114 | * automatically processes block-acks received from the receiving STA, | ||
1115 | * and reschedules un-acked frames to be retransmitted (successful | ||
1116 | * Tx completion may end up being out-of-order). | ||
1117 | * | ||
1118 | * The driver must maintain the queue's Byte Count table in host DRAM | ||
1119 | * (struct iwl4965_sched_queue_byte_cnt_tbl) for this mode. | ||
1120 | * This mode does not support fragmentation. | ||
1121 | * | ||
1122 | * 2) FIFO (a.k.a. non-Scheduler-ACK), in which each TFD is processed in order. | ||
1123 | * The device may automatically retry Tx, but will retry only one frame | ||
1124 | * at a time, until receiving ACK from receiving station, or reaching | ||
1125 | * retry limit and giving up. | ||
1126 | * | ||
1127 | * The command queue (#4) must use this mode! | ||
1128 | * This mode does not require use of the Byte Count table in host DRAM. | ||
1129 | * | ||
1130 | * Driver controls scheduler operation via 3 means: | ||
1131 | * 1) Scheduler registers | ||
1132 | * 2) Shared scheduler data base in internal 4956 SRAM | ||
1133 | * 3) Shared data in host DRAM | ||
1134 | * | ||
1135 | * Initialization: | ||
1136 | * | ||
1137 | * When loading, driver should allocate memory for: | ||
1138 | * 1) 16 TFD circular buffers, each with space for (typically) 256 TFDs. | ||
1139 | * 2) 16 Byte Count circular buffers in 16 KBytes contiguous memory | ||
1140 | * (1024 bytes for each queue). | ||
1141 | * | ||
1142 | * After receiving "Alive" response from uCode, driver must initialize | ||
1143 | * the scheduler (especially for queue #4, the command queue, otherwise | ||
1144 | * the driver can't issue commands!): | ||
1145 | */ | ||
1146 | |||
1147 | /** | ||
1148 | * Max Tx window size is the max number of contiguous TFDs that the scheduler | ||
1149 | * can keep track of at one time when creating block-ack chains of frames. | ||
1150 | * Note that "64" matches the number of ack bits in a block-ack packet. | ||
1151 | * Driver should use SCD_WIN_SIZE and SCD_FRAME_LIMIT values to initialize | ||
1152 | * SCD_CONTEXT_QUEUE_OFFSET(x) values. | ||
1153 | */ | ||
1154 | #define SCD_WIN_SIZE 64 | ||
1155 | #define SCD_FRAME_LIMIT 64 | ||
1156 | |||
1157 | /* SCD registers are internal, must be accessed via HBUS_TARG_PRPH regs */ | ||
1158 | #define SCD_START_OFFSET 0xa02c00 | ||
1159 | |||
1160 | /* | ||
1161 | * 4965 tells driver SRAM address for internal scheduler structs via this reg. | ||
1162 | * Value is valid only after "Alive" response from uCode. | ||
1163 | */ | ||
1164 | #define SCD_SRAM_BASE_ADDR (SCD_START_OFFSET + 0x0) | ||
1165 | |||
1166 | /* | ||
1167 | * Driver may need to update queue-empty bits after changing queue's | ||
1168 | * write and read pointers (indexes) during (re-)initialization (i.e. when | ||
1169 | * scheduler is not tracking what's happening). | ||
1170 | * Bit fields: | ||
1171 | * 31-16: Write mask -- 1: update empty bit, 0: don't change empty bit | ||
1172 | * 15-00: Empty state, one for each queue -- 1: empty, 0: non-empty | ||
1173 | * NOTE: This register is not used by Linux driver. | ||
1174 | */ | ||
1175 | #define SCD_EMPTY_BITS (SCD_START_OFFSET + 0x4) | ||
1176 | |||
1177 | /* | ||
1178 | * Physical base address of array of byte count (BC) circular buffers (CBs). | ||
1179 | * Each Tx queue has a BC CB in host DRAM to support Scheduler-ACK mode. | ||
1180 | * This register points to BC CB for queue 0, must be on 1024-byte boundary. | ||
1181 | * Others are spaced by 1024 bytes. | ||
1182 | * Each BC CB is 2 bytes * (256 + 64) = 740 bytes, followed by 384 bytes pad. | ||
1183 | * (Index into a queue's BC CB) = (index into queue's TFD CB) = (SSN & 0xff). | ||
1184 | * Bit fields: | ||
1185 | * 25-00: Byte Count CB physical address [35:10], must be 1024-byte aligned. | ||
1186 | */ | ||
1187 | #define SCD_DRAM_BASE_ADDR (SCD_START_OFFSET + 0x10) | ||
1188 | |||
1189 | /* | ||
1190 | * Enables any/all Tx DMA/FIFO channels. | ||
1191 | * Scheduler generates requests for only the active channels. | ||
1192 | * Set this to 0xff to enable all 8 channels (normal usage). | ||
1193 | * Bit fields: | ||
1194 | * 7- 0: Enable (1), disable (0), one bit for each channel 0-7 | ||
1195 | */ | ||
1196 | #define SCD_TXFACT (SCD_START_OFFSET + 0x1c) | ||
1197 | |||
1198 | /* Mask to enable contiguous Tx DMA/FIFO channels between "lo" and "hi". */ | ||
1199 | #define SCD_TXFACT_REG_TXFIFO_MASK(lo, hi) \ | ||
1200 | ((1 << (hi)) | ((1 << (hi)) - (1 << (lo)))) | ||
1201 | |||
1202 | /* | ||
1203 | * Queue (x) Write Pointers (indexes, really!), one for each Tx queue. | ||
1204 | * Initialized and updated by driver as new TFDs are added to queue. | ||
1205 | * NOTE: If using Block Ack, index must correspond to frame's | ||
1206 | * Start Sequence Number; index = (SSN & 0xff) | ||
1207 | * NOTE: Alternative to HBUS_TARG_WRPTR, which is what Linux driver uses? | ||
1208 | */ | ||
1209 | #define SCD_QUEUE_WRPTR(x) (SCD_START_OFFSET + 0x24 + (x) * 4) | ||
1210 | |||
1211 | /* | ||
1212 | * Queue (x) Read Pointers (indexes, really!), one for each Tx queue. | ||
1213 | * For FIFO mode, index indicates next frame to transmit. | ||
1214 | * For Scheduler-ACK mode, index indicates first frame in Tx window. | ||
1215 | * Initialized by driver, updated by scheduler. | ||
1216 | */ | ||
1217 | #define SCD_QUEUE_RDPTR(x) (SCD_START_OFFSET + 0x64 + (x) * 4) | ||
1218 | |||
1219 | /* | ||
1220 | * Select which queues work in chain mode (1) vs. not (0). | ||
1221 | * Use chain mode to build chains of aggregated frames. | ||
1222 | * Bit fields: | ||
1223 | * 31-16: Reserved | ||
1224 | * 15-00: Mode, one bit for each queue -- 1: Chain mode, 0: one-at-a-time | ||
1225 | * NOTE: If driver sets up queue for chain mode, it should be also set up | ||
1226 | * Scheduler-ACK mode as well, via SCD_QUEUE_STATUS_BITS(x). | ||
1227 | */ | ||
1228 | #define SCD_QUEUECHAIN_SEL (SCD_START_OFFSET + 0xd0) | ||
1229 | |||
1230 | /* | ||
1231 | * Select which queues interrupt driver when scheduler increments | ||
1232 | * a queue's read pointer (index). | ||
1233 | * Bit fields: | ||
1234 | * 31-16: Reserved | ||
1235 | * 15-00: Interrupt enable, one bit for each queue -- 1: enabled, 0: disabled | ||
1236 | * NOTE: This functionality is apparently a no-op; driver relies on interrupts | ||
1237 | * from Rx queue to read Tx command responses and update Tx queues. | ||
1238 | */ | ||
1239 | #define SCD_INTERRUPT_MASK (SCD_START_OFFSET + 0xe4) | ||
1240 | |||
1241 | /* | ||
1242 | * Queue search status registers. One for each queue. | ||
1243 | * Sets up queue mode and assigns queue to Tx DMA channel. | ||
1244 | * Bit fields: | ||
1245 | * 19-10: Write mask/enable bits for bits 0-9 | ||
1246 | * 9: Driver should init to "0" | ||
1247 | * 8: Scheduler-ACK mode (1), non-Scheduler-ACK (i.e. FIFO) mode (0). | ||
1248 | * Driver should init to "1" for aggregation mode, or "0" otherwise. | ||
1249 | * 7-6: Driver should init to "0" | ||
1250 | * 5: Window Size Left; indicates whether scheduler can request | ||
1251 | * another TFD, based on window size, etc. Driver should init | ||
1252 | * this bit to "1" for aggregation mode, or "0" for non-agg. | ||
1253 | * 4-1: Tx FIFO to use (range 0-7). | ||
1254 | * 0: Queue is active (1), not active (0). | ||
1255 | * Other bits should be written as "0" | ||
1256 | * | ||
1257 | * NOTE: If enabling Scheduler-ACK mode, chain mode should also be enabled | ||
1258 | * via SCD_QUEUECHAIN_SEL. | ||
1259 | */ | ||
1260 | #define SCD_QUEUE_STATUS_BITS(x) (SCD_START_OFFSET + 0x104 + (x) * 4) | ||
1261 | |||
1262 | /* Bit field positions */ | ||
1263 | #define SCD_QUEUE_STTS_REG_POS_ACTIVE (0) | ||
1264 | #define SCD_QUEUE_STTS_REG_POS_TXF (1) | ||
1265 | #define SCD_QUEUE_STTS_REG_POS_WSL (5) | ||
1266 | #define SCD_QUEUE_STTS_REG_POS_SCD_ACK (8) | ||
1267 | |||
1268 | /* Write masks */ | ||
1269 | #define SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN (10) | ||
1270 | #define SCD_QUEUE_STTS_REG_MSK (0x0007FC00) | ||
1271 | |||
1272 | /** | ||
1273 | * 4965 internal SRAM structures for scheduler, shared with driver ... | ||
1274 | * | ||
1275 | * Driver should clear and initialize the following areas after receiving | ||
1276 | * "Alive" response from 4965 uCode, i.e. after initial | ||
1277 | * uCode load, or after a uCode load done for error recovery: | ||
1278 | * | ||
1279 | * SCD_CONTEXT_DATA_OFFSET (size 128 bytes) | ||
1280 | * SCD_TX_STTS_BITMAP_OFFSET (size 256 bytes) | ||
1281 | * SCD_TRANSLATE_TBL_OFFSET (size 32 bytes) | ||
1282 | * | ||
1283 | * Driver accesses SRAM via HBUS_TARG_MEM_* registers. | ||
1284 | * Driver reads base address of this scheduler area from SCD_SRAM_BASE_ADDR. | ||
1285 | * All OFFSET values must be added to this base address. | ||
1286 | */ | ||
1287 | |||
1288 | /* | ||
1289 | * Queue context. One 8-byte entry for each of 16 queues. | ||
1290 | * | ||
1291 | * Driver should clear this entire area (size 0x80) to 0 after receiving | ||
1292 | * "Alive" notification from uCode. Additionally, driver should init | ||
1293 | * each queue's entry as follows: | ||
1294 | * | ||
1295 | * LS Dword bit fields: | ||
1296 | * 0-06: Max Tx window size for Scheduler-ACK. Driver should init to 64. | ||
1297 | * | ||
1298 | * MS Dword bit fields: | ||
1299 | * 16-22: Frame limit. Driver should init to 10 (0xa). | ||
1300 | * | ||
1301 | * Driver should init all other bits to 0. | ||
1302 | * | ||
1303 | * Init must be done after driver receives "Alive" response from 4965 uCode, | ||
1304 | * and when setting up queue for aggregation. | ||
1305 | */ | ||
1306 | #define SCD_CONTEXT_DATA_OFFSET 0x380 | ||
1307 | #define SCD_CONTEXT_QUEUE_OFFSET(x) (SCD_CONTEXT_DATA_OFFSET + ((x) * 8)) | ||
1308 | |||
1309 | #define SCD_QUEUE_CTX_REG1_WIN_SIZE_POS (0) | ||
1310 | #define SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK (0x0000007F) | ||
1311 | #define SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS (16) | ||
1312 | #define SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK (0x007F0000) | ||
1313 | |||
1314 | /* | ||
1315 | * Tx Status Bitmap | ||
1316 | * | ||
1317 | * Driver should clear this entire area (size 0x100) to 0 after receiving | ||
1318 | * "Alive" notification from uCode. Area is used only by device itself; | ||
1319 | * no other support (besides clearing) is required from driver. | ||
1320 | */ | ||
1321 | #define SCD_TX_STTS_BITMAP_OFFSET 0x400 | ||
1322 | |||
1323 | /* | ||
1324 | * RAxTID to queue translation mapping. | ||
1325 | * | ||
1326 | * When queue is in Scheduler-ACK mode, frames placed in a that queue must be | ||
1327 | * for only one combination of receiver address (RA) and traffic ID (TID), i.e. | ||
1328 | * one QOS priority level destined for one station (for this wireless link, | ||
1329 | * not final destination). The SCD_TRANSLATE_TABLE area provides 16 16-bit | ||
1330 | * mappings, one for each of the 16 queues. If queue is not in Scheduler-ACK | ||
1331 | * mode, the device ignores the mapping value. | ||
1332 | * | ||
1333 | * Bit fields, for each 16-bit map: | ||
1334 | * 15-9: Reserved, set to 0 | ||
1335 | * 8-4: Index into device's station table for recipient station | ||
1336 | * 3-0: Traffic ID (tid), range 0-15 | ||
1337 | * | ||
1338 | * Driver should clear this entire area (size 32 bytes) to 0 after receiving | ||
1339 | * "Alive" notification from uCode. To update a 16-bit map value, driver | ||
1340 | * must read a dword-aligned value from device SRAM, replace the 16-bit map | ||
1341 | * value of interest, and write the dword value back into device SRAM. | ||
1342 | */ | ||
1343 | #define SCD_TRANSLATE_TBL_OFFSET 0x500 | ||
1344 | |||
1345 | /* Find translation table dword to read/write for given queue */ | ||
1346 | #define SCD_TRANSLATE_TBL_OFFSET_QUEUE(x) \ | ||
1347 | ((SCD_TRANSLATE_TBL_OFFSET + ((x) * 2)) & 0xfffffffc) | ||
1348 | |||
1349 | #define SCD_TXFIFO_POS_TID (0) | ||
1350 | #define SCD_TXFIFO_POS_RA (4) | ||
1351 | #define SCD_QUEUE_RA_TID_MAP_RATID_MSK (0x01FF) | ||
1352 | |||
1353 | /*********************** END TX SCHEDULER *************************************/ | ||
1354 | |||
1355 | static inline u8 iwl4965_hw_get_rate(__le32 rate_n_flags) | 1075 | static inline u8 iwl4965_hw_get_rate(__le32 rate_n_flags) |
1356 | { | 1076 | { |
1357 | return le32_to_cpu(rate_n_flags) & 0xFF; | 1077 | return le32_to_cpu(rate_n_flags) & 0xFF; |
@@ -1386,11 +1106,11 @@ static inline __le32 iwl4965_hw_set_rate_n_flags(u8 rate, u16 flags) | |||
1386 | * up to 7 DMA channels (FIFOs). Each Tx queue is supported by a circular array | 1106 | * up to 7 DMA channels (FIFOs). Each Tx queue is supported by a circular array |
1387 | * in DRAM containing 256 Transmit Frame Descriptors (TFDs). | 1107 | * in DRAM containing 256 Transmit Frame Descriptors (TFDs). |
1388 | */ | 1108 | */ |
1389 | #define IWL4965_MAX_WIN_SIZE 64 | 1109 | #define IWL49_MAX_WIN_SIZE 64 |
1390 | #define IWL4965_QUEUE_SIZE 256 | 1110 | #define IWL49_QUEUE_SIZE 256 |
1391 | #define IWL4965_NUM_FIFOS 7 | 1111 | #define IWL49_NUM_FIFOS 7 |
1392 | #define IWL4965_MAX_NUM_QUEUES 16 | 1112 | #define IWL49_CMD_FIFO_NUM 4 |
1393 | 1113 | #define IWL49_NUM_QUEUES 16 | |
1394 | 1114 | ||
1395 | /** | 1115 | /** |
1396 | * struct iwl4965_tfd_frame_data | 1116 | * struct iwl4965_tfd_frame_data |
@@ -1521,10 +1241,10 @@ struct iwl4965_queue_byte_cnt_entry { | |||
1521 | * 4965 assumes tables are separated by 1024 bytes. | 1241 | * 4965 assumes tables are separated by 1024 bytes. |
1522 | */ | 1242 | */ |
1523 | struct iwl4965_sched_queue_byte_cnt_tbl { | 1243 | struct iwl4965_sched_queue_byte_cnt_tbl { |
1524 | struct iwl4965_queue_byte_cnt_entry tfd_offset[IWL4965_QUEUE_SIZE + | 1244 | struct iwl4965_queue_byte_cnt_entry tfd_offset[IWL49_QUEUE_SIZE + |
1525 | IWL4965_MAX_WIN_SIZE]; | 1245 | IWL49_MAX_WIN_SIZE]; |
1526 | u8 dont_care[1024 - | 1246 | u8 dont_care[1024 - |
1527 | (IWL4965_QUEUE_SIZE + IWL4965_MAX_WIN_SIZE) * | 1247 | (IWL49_QUEUE_SIZE + IWL49_MAX_WIN_SIZE) * |
1528 | sizeof(__le16)]; | 1248 | sizeof(__le16)]; |
1529 | } __attribute__ ((packed)); | 1249 | } __attribute__ ((packed)); |
1530 | 1250 | ||
@@ -1554,7 +1274,7 @@ struct iwl4965_sched_queue_byte_cnt_tbl { | |||
1554 | */ | 1274 | */ |
1555 | struct iwl4965_shared { | 1275 | struct iwl4965_shared { |
1556 | struct iwl4965_sched_queue_byte_cnt_tbl | 1276 | struct iwl4965_sched_queue_byte_cnt_tbl |
1557 | queues_byte_cnt_tbls[IWL4965_MAX_NUM_QUEUES]; | 1277 | queues_byte_cnt_tbls[IWL49_NUM_QUEUES]; |
1558 | __le32 rb_closed; | 1278 | __le32 rb_closed; |
1559 | 1279 | ||
1560 | /* __le32 rb_closed_stts_rb_num:12; */ | 1280 | /* __le32 rb_closed_stts_rb_num:12; */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index f5796b78f2d2..2b21edb757b9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -47,7 +47,7 @@ | |||
47 | 47 | ||
48 | /* module parameters */ | 48 | /* module parameters */ |
49 | static struct iwl_mod_params iwl4965_mod_params = { | 49 | static struct iwl_mod_params iwl4965_mod_params = { |
50 | .num_of_queues = IWL4965_MAX_NUM_QUEUES, | 50 | .num_of_queues = IWL49_NUM_QUEUES, |
51 | .enable_qos = 1, | 51 | .enable_qos = 1, |
52 | .amsdu_size_8K = 1, | 52 | .amsdu_size_8K = 1, |
53 | /* the rest are 0 by default */ | 53 | /* the rest are 0 by default */ |
@@ -1164,11 +1164,11 @@ static void iwl4965_tx_queue_set_status(struct iwl_priv *priv, | |||
1164 | 1164 | ||
1165 | /* Set up and activate */ | 1165 | /* Set up and activate */ |
1166 | iwl_write_prph(priv, IWL49_SCD_QUEUE_STATUS_BITS(txq_id), | 1166 | iwl_write_prph(priv, IWL49_SCD_QUEUE_STATUS_BITS(txq_id), |
1167 | (active << SCD_QUEUE_STTS_REG_POS_ACTIVE) | | 1167 | (active << IWL49_SCD_QUEUE_STTS_REG_POS_ACTIVE) | |
1168 | (tx_fifo_id << SCD_QUEUE_STTS_REG_POS_TXF) | | 1168 | (tx_fifo_id << IWL49_SCD_QUEUE_STTS_REG_POS_TXF) | |
1169 | (scd_retry << SCD_QUEUE_STTS_REG_POS_WSL) | | 1169 | (scd_retry << IWL49_SCD_QUEUE_STTS_REG_POS_WSL) | |
1170 | (scd_retry << SCD_QUEUE_STTS_REG_POS_SCD_ACK) | | 1170 | (scd_retry << IWL49_SCD_QUEUE_STTS_REG_POS_SCD_ACK) | |
1171 | SCD_QUEUE_STTS_REG_MSK); | 1171 | IWL49_SCD_QUEUE_STTS_REG_MSK); |
1172 | 1172 | ||
1173 | txq->sched_retry = scd_retry; | 1173 | txq->sched_retry = scd_retry; |
1174 | 1174 | ||
@@ -1182,7 +1182,7 @@ static const u16 default_queue_to_tx_fifo[] = { | |||
1182 | IWL_TX_FIFO_AC2, | 1182 | IWL_TX_FIFO_AC2, |
1183 | IWL_TX_FIFO_AC1, | 1183 | IWL_TX_FIFO_AC1, |
1184 | IWL_TX_FIFO_AC0, | 1184 | IWL_TX_FIFO_AC0, |
1185 | IWL_CMD_FIFO_NUM, | 1185 | IWL49_CMD_FIFO_NUM, |
1186 | IWL_TX_FIFO_HCCA_1, | 1186 | IWL_TX_FIFO_HCCA_1, |
1187 | IWL_TX_FIFO_HCCA_2 | 1187 | IWL_TX_FIFO_HCCA_2 |
1188 | }; | 1188 | }; |
@@ -1223,10 +1223,10 @@ int iwl4965_alive_notify(struct iwl_priv *priv) | |||
1223 | 1223 | ||
1224 | /* Clear 4965's internal Tx Scheduler data base */ | 1224 | /* Clear 4965's internal Tx Scheduler data base */ |
1225 | priv->scd_base_addr = iwl_read_prph(priv, IWL49_SCD_SRAM_BASE_ADDR); | 1225 | priv->scd_base_addr = iwl_read_prph(priv, IWL49_SCD_SRAM_BASE_ADDR); |
1226 | a = priv->scd_base_addr + SCD_CONTEXT_DATA_OFFSET; | 1226 | a = priv->scd_base_addr + IWL49_SCD_CONTEXT_DATA_OFFSET; |
1227 | for (; a < priv->scd_base_addr + SCD_TX_STTS_BITMAP_OFFSET; a += 4) | 1227 | for (; a < priv->scd_base_addr + IWL49_SCD_TX_STTS_BITMAP_OFFSET; a += 4) |
1228 | iwl_write_targ_mem(priv, a, 0); | 1228 | iwl_write_targ_mem(priv, a, 0); |
1229 | for (; a < priv->scd_base_addr + SCD_TRANSLATE_TBL_OFFSET; a += 4) | 1229 | for (; a < priv->scd_base_addr + IWL49_SCD_TRANSLATE_TBL_OFFSET; a += 4) |
1230 | iwl_write_targ_mem(priv, a, 0); | 1230 | iwl_write_targ_mem(priv, a, 0); |
1231 | for (; a < sizeof(u16) * priv->hw_params.max_txq_num; a += 4) | 1231 | for (; a < sizeof(u16) * priv->hw_params.max_txq_num; a += 4) |
1232 | iwl_write_targ_mem(priv, a, 0); | 1232 | iwl_write_targ_mem(priv, a, 0); |
@@ -1248,18 +1248,18 @@ int iwl4965_alive_notify(struct iwl_priv *priv) | |||
1248 | 1248 | ||
1249 | /* Max Tx Window size for Scheduler-ACK mode */ | 1249 | /* Max Tx Window size for Scheduler-ACK mode */ |
1250 | iwl_write_targ_mem(priv, priv->scd_base_addr + | 1250 | iwl_write_targ_mem(priv, priv->scd_base_addr + |
1251 | SCD_CONTEXT_QUEUE_OFFSET(i), | 1251 | IWL49_SCD_CONTEXT_QUEUE_OFFSET(i), |
1252 | (SCD_WIN_SIZE << | 1252 | (SCD_WIN_SIZE << |
1253 | SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & | 1253 | IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & |
1254 | SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); | 1254 | IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); |
1255 | 1255 | ||
1256 | /* Frame limit */ | 1256 | /* Frame limit */ |
1257 | iwl_write_targ_mem(priv, priv->scd_base_addr + | 1257 | iwl_write_targ_mem(priv, priv->scd_base_addr + |
1258 | SCD_CONTEXT_QUEUE_OFFSET(i) + | 1258 | IWL49_SCD_CONTEXT_QUEUE_OFFSET(i) + |
1259 | sizeof(u32), | 1259 | sizeof(u32), |
1260 | (SCD_FRAME_LIMIT << | 1260 | (SCD_FRAME_LIMIT << |
1261 | SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) & | 1261 | IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) & |
1262 | SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); | 1262 | IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); |
1263 | 1263 | ||
1264 | } | 1264 | } |
1265 | iwl_write_prph(priv, IWL49_SCD_INTERRUPT_MASK, | 1265 | iwl_write_prph(priv, IWL49_SCD_INTERRUPT_MASK, |
@@ -1320,10 +1320,10 @@ static struct iwl_sensitivity_ranges iwl4965_sensitivity = { | |||
1320 | int iwl4965_hw_set_hw_params(struct iwl_priv *priv) | 1320 | int iwl4965_hw_set_hw_params(struct iwl_priv *priv) |
1321 | { | 1321 | { |
1322 | 1322 | ||
1323 | if ((priv->cfg->mod_params->num_of_queues > IWL4965_MAX_NUM_QUEUES) || | 1323 | if ((priv->cfg->mod_params->num_of_queues > IWL49_NUM_QUEUES) || |
1324 | (priv->cfg->mod_params->num_of_queues < IWL_MIN_NUM_QUEUES)) { | 1324 | (priv->cfg->mod_params->num_of_queues < IWL_MIN_NUM_QUEUES)) { |
1325 | IWL_ERROR("invalid queues_num, should be between %d and %d\n", | 1325 | IWL_ERROR("invalid queues_num, should be between %d and %d\n", |
1326 | IWL_MIN_NUM_QUEUES, IWL4965_MAX_NUM_QUEUES); | 1326 | IWL_MIN_NUM_QUEUES, IWL49_NUM_QUEUES); |
1327 | return -EINVAL; | 1327 | return -EINVAL; |
1328 | } | 1328 | } |
1329 | 1329 | ||
@@ -2520,9 +2520,9 @@ static void iwl4965_txq_update_byte_cnt_tbl(struct iwl_priv *priv, | |||
2520 | tfd_offset[txq->q.write_ptr], byte_cnt, len); | 2520 | tfd_offset[txq->q.write_ptr], byte_cnt, len); |
2521 | 2521 | ||
2522 | /* If within first 64 entries, duplicate at end */ | 2522 | /* If within first 64 entries, duplicate at end */ |
2523 | if (txq->q.write_ptr < IWL4965_MAX_WIN_SIZE) | 2523 | if (txq->q.write_ptr < IWL49_MAX_WIN_SIZE) |
2524 | IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id]. | 2524 | IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id]. |
2525 | tfd_offset[IWL4965_QUEUE_SIZE + txq->q.write_ptr], | 2525 | tfd_offset[IWL49_QUEUE_SIZE + txq->q.write_ptr], |
2526 | byte_cnt, len); | 2526 | byte_cnt, len); |
2527 | } | 2527 | } |
2528 | 2528 | ||
@@ -3646,8 +3646,8 @@ static void iwl4965_tx_queue_stop_scheduler(struct iwl_priv *priv, | |||
3646 | * the SCD_ACT_EN bit is the write-enable mask for the ACTIVE bit. */ | 3646 | * the SCD_ACT_EN bit is the write-enable mask for the ACTIVE bit. */ |
3647 | iwl_write_prph(priv, | 3647 | iwl_write_prph(priv, |
3648 | IWL49_SCD_QUEUE_STATUS_BITS(txq_id), | 3648 | IWL49_SCD_QUEUE_STATUS_BITS(txq_id), |
3649 | (0 << SCD_QUEUE_STTS_REG_POS_ACTIVE)| | 3649 | (0 << IWL49_SCD_QUEUE_STTS_REG_POS_ACTIVE)| |
3650 | (1 << SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); | 3650 | (1 << IWL49_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); |
3651 | } | 3651 | } |
3652 | 3652 | ||
3653 | /** | 3653 | /** |
@@ -3812,10 +3812,10 @@ static int iwl4965_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid, | |||
3812 | u32 tbl_dw; | 3812 | u32 tbl_dw; |
3813 | u16 scd_q2ratid; | 3813 | u16 scd_q2ratid; |
3814 | 3814 | ||
3815 | scd_q2ratid = ra_tid & SCD_QUEUE_RA_TID_MAP_RATID_MSK; | 3815 | scd_q2ratid = ra_tid & IWL49_SCD_QUEUE_RA_TID_MAP_RATID_MSK; |
3816 | 3816 | ||
3817 | tbl_dw_addr = priv->scd_base_addr + | 3817 | tbl_dw_addr = priv->scd_base_addr + |
3818 | SCD_TRANSLATE_TBL_OFFSET_QUEUE(txq_id); | 3818 | IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(txq_id); |
3819 | 3819 | ||
3820 | tbl_dw = iwl_read_targ_mem(priv, tbl_dw_addr); | 3820 | tbl_dw = iwl_read_targ_mem(priv, tbl_dw_addr); |
3821 | 3821 | ||
@@ -3877,14 +3877,14 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id, | |||
3877 | 3877 | ||
3878 | /* Set up Tx window size and frame limit for this queue */ | 3878 | /* Set up Tx window size and frame limit for this queue */ |
3879 | iwl_write_targ_mem(priv, | 3879 | iwl_write_targ_mem(priv, |
3880 | priv->scd_base_addr + SCD_CONTEXT_QUEUE_OFFSET(txq_id), | 3880 | priv->scd_base_addr + IWL49_SCD_CONTEXT_QUEUE_OFFSET(txq_id), |
3881 | (SCD_WIN_SIZE << SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & | 3881 | (SCD_WIN_SIZE << IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS) & |
3882 | SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); | 3882 | IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK); |
3883 | 3883 | ||
3884 | iwl_write_targ_mem(priv, priv->scd_base_addr + | 3884 | iwl_write_targ_mem(priv, priv->scd_base_addr + |
3885 | SCD_CONTEXT_QUEUE_OFFSET(txq_id) + sizeof(u32), | 3885 | IWL49_SCD_CONTEXT_QUEUE_OFFSET(txq_id) + sizeof(u32), |
3886 | (SCD_FRAME_LIMIT << SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) | 3886 | (SCD_FRAME_LIMIT << IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) |
3887 | & SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); | 3887 | & IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); |
3888 | 3888 | ||
3889 | iwl_set_bits_prph(priv, IWL49_SCD_INTERRUPT_MASK, (1 << txq_id)); | 3889 | iwl_set_bits_prph(priv, IWL49_SCD_INTERRUPT_MASK, (1 << txq_id)); |
3890 | 3890 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h index c9cf8eef1a90..acac629386e0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-prph.h +++ b/drivers/net/wireless/iwlwifi/iwl-prph.h | |||
@@ -239,40 +239,284 @@ | |||
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 | /* Mask to enable contiguous Tx DMA/FIFO channels between "lo" and "hi". */ | ||
363 | #define SCD_TXFACT_REG_TXFIFO_MASK(lo, hi) \ | ||
364 | ((1 << (hi)) | ((1 << (hi)) - (1 << (lo)))) | ||
365 | |||
366 | /* | ||
367 | * Queue (x) Write Pointers (indexes, really!), one for each Tx queue. | ||
368 | * Initialized and updated by driver as new TFDs are added to queue. | ||
369 | * NOTE: If using Block Ack, index must correspond to frame's | ||
370 | * Start Sequence Number; index = (SSN & 0xff) | ||
371 | * NOTE: Alternative to HBUS_TARG_WRPTR, which is what Linux driver uses? | ||
372 | */ | ||
373 | #define IWL49_SCD_QUEUE_WRPTR(x) (IWL49_SCD_START_OFFSET + 0x24 + (x) * 4) | ||
374 | |||
375 | /* | ||
376 | * Queue (x) Read Pointers (indexes, really!), one for each Tx queue. | ||
377 | * For FIFO mode, index indicates next frame to transmit. | ||
378 | * For Scheduler-ACK mode, index indicates first frame in Tx window. | ||
379 | * Initialized by driver, updated by scheduler. | ||
380 | */ | ||
381 | #define IWL49_SCD_QUEUE_RDPTR(x) (IWL49_SCD_START_OFFSET + 0x64 + (x) * 4) | ||
382 | |||
383 | /* | ||
384 | * Select which queues work in chain mode (1) vs. not (0). | ||
385 | * Use chain mode to build chains of aggregated frames. | ||
386 | * Bit fields: | ||
387 | * 31-16: Reserved | ||
388 | * 15-00: Mode, one bit for each queue -- 1: Chain mode, 0: one-at-a-time | ||
389 | * NOTE: If driver sets up queue for chain mode, it should be also set up | ||
390 | * Scheduler-ACK mode as well, via SCD_QUEUE_STATUS_BITS(x). | ||
391 | */ | ||
392 | #define IWL49_SCD_QUEUECHAIN_SEL (IWL49_SCD_START_OFFSET + 0xd0) | ||
393 | |||
394 | /* | ||
395 | * Select which queues interrupt driver when scheduler increments | ||
396 | * a queue's read pointer (index). | ||
397 | * Bit fields: | ||
398 | * 31-16: Reserved | ||
399 | * 15-00: Interrupt enable, one bit for each queue -- 1: enabled, 0: disabled | ||
400 | * NOTE: This functionality is apparently a no-op; driver relies on interrupts | ||
401 | * from Rx queue to read Tx command responses and update Tx queues. | ||
402 | */ | ||
403 | #define IWL49_SCD_INTERRUPT_MASK (IWL49_SCD_START_OFFSET + 0xe4) | ||
404 | |||
405 | /* | ||
406 | * Queue search status registers. One for each queue. | ||
407 | * Sets up queue mode and assigns queue to Tx DMA channel. | ||
408 | * Bit fields: | ||
409 | * 19-10: Write mask/enable bits for bits 0-9 | ||
410 | * 9: Driver should init to "0" | ||
411 | * 8: Scheduler-ACK mode (1), non-Scheduler-ACK (i.e. FIFO) mode (0). | ||
412 | * Driver should init to "1" for aggregation mode, or "0" otherwise. | ||
413 | * 7-6: Driver should init to "0" | ||
414 | * 5: Window Size Left; indicates whether scheduler can request | ||
415 | * another TFD, based on window size, etc. Driver should init | ||
416 | * this bit to "1" for aggregation mode, or "0" for non-agg. | ||
417 | * 4-1: Tx FIFO to use (range 0-7). | ||
418 | * 0: Queue is active (1), not active (0). | ||
419 | * Other bits should be written as "0" | ||
420 | * | ||
421 | * NOTE: If enabling Scheduler-ACK mode, chain mode should also be enabled | ||
422 | * via SCD_QUEUECHAIN_SEL. | ||
423 | */ | ||
424 | #define IWL49_SCD_QUEUE_STATUS_BITS(x)\ | ||
425 | (IWL49_SCD_START_OFFSET + 0x104 + (x) * 4) | ||
426 | |||
427 | /* Bit field positions */ | ||
428 | #define IWL49_SCD_QUEUE_STTS_REG_POS_ACTIVE (0) | ||
429 | #define IWL49_SCD_QUEUE_STTS_REG_POS_TXF (1) | ||
430 | #define IWL49_SCD_QUEUE_STTS_REG_POS_WSL (5) | ||
431 | #define IWL49_SCD_QUEUE_STTS_REG_POS_SCD_ACK (8) | ||
432 | |||
433 | /* Write masks */ | ||
434 | #define IWL49_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN (10) | ||
435 | #define IWL49_SCD_QUEUE_STTS_REG_MSK (0x0007FC00) | ||
436 | |||
437 | /** | ||
438 | * 4965 internal SRAM structures for scheduler, shared with driver ... | ||
439 | * | ||
440 | * Driver should clear and initialize the following areas after receiving | ||
441 | * "Alive" response from 4965 uCode, i.e. after initial | ||
442 | * uCode load, or after a uCode load done for error recovery: | ||
443 | * | ||
444 | * SCD_CONTEXT_DATA_OFFSET (size 128 bytes) | ||
445 | * SCD_TX_STTS_BITMAP_OFFSET (size 256 bytes) | ||
446 | * SCD_TRANSLATE_TBL_OFFSET (size 32 bytes) | ||
447 | * | ||
448 | * Driver accesses SRAM via HBUS_TARG_MEM_* registers. | ||
449 | * Driver reads base address of this scheduler area from SCD_SRAM_BASE_ADDR. | ||
450 | * All OFFSET values must be added to this base address. | ||
451 | */ | ||
452 | |||
453 | /* | ||
454 | * Queue context. One 8-byte entry for each of 16 queues. | ||
455 | * | ||
456 | * Driver should clear this entire area (size 0x80) to 0 after receiving | ||
457 | * "Alive" notification from uCode. Additionally, driver should init | ||
458 | * each queue's entry as follows: | ||
459 | * | ||
460 | * LS Dword bit fields: | ||
461 | * 0-06: Max Tx window size for Scheduler-ACK. Driver should init to 64. | ||
462 | * | ||
463 | * MS Dword bit fields: | ||
464 | * 16-22: Frame limit. Driver should init to 10 (0xa). | ||
465 | * | ||
466 | * Driver should init all other bits to 0. | ||
467 | * | ||
468 | * Init must be done after driver receives "Alive" response from 4965 uCode, | ||
469 | * and when setting up queue for aggregation. | ||
470 | */ | ||
471 | #define IWL49_SCD_CONTEXT_DATA_OFFSET 0x380 | ||
472 | #define IWL49_SCD_CONTEXT_QUEUE_OFFSET(x) \ | ||
473 | (IWL49_SCD_CONTEXT_DATA_OFFSET + ((x) * 8)) | ||
474 | |||
475 | #define IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_POS (0) | ||
476 | #define IWL49_SCD_QUEUE_CTX_REG1_WIN_SIZE_MSK (0x0000007F) | ||
477 | #define IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS (16) | ||
478 | #define IWL49_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK (0x007F0000) | ||
479 | |||
242 | /* | 480 | /* |
243 | * 4965 Tx Scheduler registers. | 481 | * Tx Status Bitmap |
244 | * Details are documented in iwl-4965-hw.h | 482 | * |
483 | * Driver should clear this entire area (size 0x100) to 0 after receiving | ||
484 | * "Alive" notification from uCode. Area is used only by device itself; | ||
485 | * no other support (besides clearing) is required from driver. | ||
245 | */ | 486 | */ |
246 | #define IWL49_SCD_BASE (PRPH_BASE + 0xa02c00) | 487 | #define IWL49_SCD_TX_STTS_BITMAP_OFFSET 0x400 |
247 | 488 | ||
248 | #define IWL49_SCD_SRAM_BASE_ADDR (IWL49_SCD_BASE + 0x0) | 489 | /* |
249 | #define IWL49_SCD_EMPTY_BITS (IWL49_SCD_BASE + 0x4) | 490 | * RAxTID to queue translation mapping. |
250 | #define IWL49_SCD_DRAM_BASE_ADDR (IWL49_SCD_BASE + 0x10) | 491 | * |
251 | #define IWL49_SCD_AIT (IWL49_SCD_BASE + 0x18) | 492 | * When queue is in Scheduler-ACK mode, frames placed in a that queue must be |
252 | #define IWL49_SCD_TXFACT (IWL49_SCD_BASE + 0x1c) | 493 | * for only one combination of receiver address (RA) and traffic ID (TID), i.e. |
253 | #define IWL49_SCD_QUEUE_WRPTR(x) (IWL49_SCD_BASE + 0x24 + (x) * 4) | 494 | * one QOS priority level destined for one station (for this wireless link, |
254 | #define IWL49_SCD_QUEUE_RDPTR(x) (IWL49_SCD_BASE + 0x64 + (x) * 4) | 495 | * not final destination). The SCD_TRANSLATE_TABLE area provides 16 16-bit |
255 | #define IWL49_SCD_SETQUEUENUM (IWL49_SCD_BASE + 0xa4) | 496 | * mappings, one for each of the 16 queues. If queue is not in Scheduler-ACK |
256 | #define IWL49_SCD_SET_TXSTAT_TXED (IWL49_SCD_BASE + 0xa8) | 497 | * mode, the device ignores the mapping value. |
257 | #define IWL49_SCD_SET_TXSTAT_DONE (IWL49_SCD_BASE + 0xac) | 498 | * |
258 | #define IWL49_SCD_SET_TXSTAT_NOT_SCHD (IWL49_SCD_BASE + 0xb0) | 499 | * Bit fields, for each 16-bit map: |
259 | #define IWL49_SCD_DECREASE_CREDIT (IWL49_SCD_BASE + 0xb4) | 500 | * 15-9: Reserved, set to 0 |
260 | #define IWL49_SCD_DECREASE_SCREDIT (IWL49_SCD_BASE + 0xb8) | 501 | * 8-4: Index into device's station table for recipient station |
261 | #define IWL49_SCD_LOAD_CREDIT (IWL49_SCD_BASE + 0xbc) | 502 | * 3-0: Traffic ID (tid), range 0-15 |
262 | #define IWL49_SCD_LOAD_SCREDIT (IWL49_SCD_BASE + 0xc0) | 503 | * |
263 | #define IWL49_SCD_BAR (IWL49_SCD_BASE + 0xc4) | 504 | * Driver should clear this entire area (size 32 bytes) to 0 after receiving |
264 | #define IWL49_SCD_BAR_DW0 (IWL49_SCD_BASE + 0xc8) | 505 | * "Alive" notification from uCode. To update a 16-bit map value, driver |
265 | #define IWL49_SCD_BAR_DW1 (IWL49_SCD_BASE + 0xcc) | 506 | * must read a dword-aligned value from device SRAM, replace the 16-bit map |
266 | #define IWL49_SCD_QUEUECHAIN_SEL (IWL49_SCD_BASE + 0xd0) | 507 | * value of interest, and write the dword value back into device SRAM. |
267 | #define IWL49_SCD_QUERY_REQ (IWL49_SCD_BASE + 0xd8) | 508 | */ |
268 | #define IWL49_SCD_QUERY_RES (IWL49_SCD_BASE + 0xdc) | 509 | #define IWL49_SCD_TRANSLATE_TBL_OFFSET 0x500 |
269 | #define IWL49_SCD_PENDING_FRAMES (IWL49_SCD_BASE + 0xe0) | 510 | |
270 | #define IWL49_SCD_INTERRUPT_MASK (IWL49_SCD_BASE + 0xe4) | 511 | /* Find translation table dword to read/write for given queue */ |
271 | #define IWL49_SCD_INTERRUPT_THRESHOLD (IWL49_SCD_BASE + 0xe8) | 512 | #define IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(x) \ |
272 | #define IWL49_SCD_QUERY_MIN_FRAME_SIZE (IWL49_SCD_BASE + 0x100) | 513 | ((IWL49_SCD_TRANSLATE_TBL_OFFSET + ((x) * 2)) & 0xfffffffc) |
273 | #define IWL49_SCD_QUEUE_STATUS_BITS(x) (IWL49_SCD_BASE + 0x104 + (x) * 4) | 514 | |
274 | 515 | #define IWL49_SCD_TXFIFO_POS_TID (0) | |
275 | /* SP SCD */ | 516 | #define IWL49_SCD_TXFIFO_POS_RA (4) |
517 | #define IWL49_SCD_QUEUE_RA_TID_MAP_RATID_MSK (0x01FF) | ||
518 | |||
519 | /* 5000 SCD */ | ||
276 | #define IWL50_SCD_BASE (PRPH_BASE + 0xa02c00) | 520 | #define IWL50_SCD_BASE (PRPH_BASE + 0xa02c00) |
277 | 521 | ||
278 | #define IWL50_SCD_SRAM_BASE_ADDR (IWL50_SCD_BASE + 0x0) | 522 | #define IWL50_SCD_SRAM_BASE_ADDR (IWL50_SCD_BASE + 0x0) |
@@ -287,4 +531,6 @@ | |||
287 | #define IWL50_SCD_INTERRUPT_MASK (IWL50_SCD_BASE + 0x108) | 531 | #define IWL50_SCD_INTERRUPT_MASK (IWL50_SCD_BASE + 0x108) |
288 | #define IWL50_SCD_QUEUE_STATUS_BITS(x) (IWL50_SCD_BASE + 0x10c + (x) * 4) | 532 | #define IWL50_SCD_QUEUE_STATUS_BITS(x) (IWL50_SCD_BASE + 0x10c + (x) * 4) |
289 | 533 | ||
534 | /*********************** END TX SCHEDULER *************************************/ | ||
535 | |||
290 | #endif /* __iwl_prph_h__ */ | 536 | #endif /* __iwl_prph_h__ */ |