diff options
author | Ben Cahill <ben.m.cahill@intel.com> | 2007-11-28 22:09:47 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:05:17 -0500 |
commit | 9fbab5163aa8cb3a5aef845fbf67b0c1c85030b6 (patch) | |
tree | 6e078dc2ea37ea4aff9b2fb262ef278ae12b61b5 /drivers/net/wireless/iwlwifi/iwl4965-base.c | |
parent | 40ac81a35c3a19f6a78f0a9f58368d36048df35b (diff) |
iwlwifi: clean up and clarify some comments after 3945/4965 split
Clean up and clarify some comments after 3945/4965 split.
Signed-off-by: Ben Cahill <ben.m.cahill@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 163 |
1 files changed, 73 insertions, 90 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 33eace757435..74c3d3917fe1 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -27,16 +27,6 @@ | |||
27 | * | 27 | * |
28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
29 | 29 | ||
30 | /* | ||
31 | * NOTE: This file (iwl-base.c) is used to build to multiple hardware targets | ||
32 | * by defining IWL to either 3945 or 4965. The Makefile used when building | ||
33 | * the base targets will create base-3945.o and base-4965.o | ||
34 | * | ||
35 | * The eventual goal is to move as many of the #if IWL / #endif blocks out of | ||
36 | * this file and into the hardware specific implementation files (iwl-XXXX.c) | ||
37 | * and leave only the common (non #ifdef sprinkled) code in this file | ||
38 | */ | ||
39 | |||
40 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
41 | #include <linux/module.h> | 31 | #include <linux/module.h> |
42 | #include <linux/version.h> | 32 | #include <linux/version.h> |
@@ -75,9 +65,9 @@ static int iwl4965_tx_queue_update_write_ptr(struct iwl4965_priv *priv, | |||
75 | /* module parameters */ | 65 | /* module parameters */ |
76 | static int iwl4965_param_disable_hw_scan; | 66 | static int iwl4965_param_disable_hw_scan; |
77 | static int iwl4965_param_debug; | 67 | static int iwl4965_param_debug; |
78 | static int iwl4965_param_disable; /* def: enable radio */ | 68 | static int iwl4965_param_disable; /* def: enable radio */ |
79 | static int iwl4965_param_antenna; /* def: 0 = both antennas (use diversity) */ | 69 | static int iwl4965_param_antenna; /* def: 0 = both antennas (use diversity) */ |
80 | int iwl4965_param_hwcrypto; /* def: using software encryption */ | 70 | int iwl4965_param_hwcrypto; /* def: using software encryption */ |
81 | static int iwl4965_param_qos_enable = 1; | 71 | static int iwl4965_param_qos_enable = 1; |
82 | int iwl4965_param_queues_num = IWL_MAX_NUM_QUEUES; | 72 | int iwl4965_param_queues_num = IWL_MAX_NUM_QUEUES; |
83 | 73 | ||
@@ -395,11 +385,7 @@ void iwl4965_tx_queue_free(struct iwl4965_priv *priv, struct iwl4965_tx_queue *t | |||
395 | const u8 iwl4965_broadcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; | 385 | const u8 iwl4965_broadcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; |
396 | 386 | ||
397 | /*************** STATION TABLE MANAGEMENT **** | 387 | /*************** STATION TABLE MANAGEMENT **** |
398 | * | 388 | * mac80211 should be examined to determine if sta_info is duplicating |
399 | * NOTE: This needs to be overhauled to better synchronize between | ||
400 | * how the iwl-4965.c is using iwl4965_hw_find_station vs. iwl-3945.c | ||
401 | * | ||
402 | * mac80211 should also be examined to determine if sta_info is duplicating | ||
403 | * the functionality provided here | 389 | * the functionality provided here |
404 | */ | 390 | */ |
405 | 391 | ||
@@ -482,8 +468,8 @@ u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *addr, int is_a | |||
482 | } | 468 | } |
483 | 469 | ||
484 | 470 | ||
485 | /* These two conditions has the same outcome but keep them separate | 471 | /* These two conditions have the same outcome, but keep them separate |
486 | since they have different meaning */ | 472 | since they have different meanings */ |
487 | if (unlikely(index == IWL_INVALID_STATION)) { | 473 | if (unlikely(index == IWL_INVALID_STATION)) { |
488 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); | 474 | spin_unlock_irqrestore(&priv->sta_lock, flags_spin); |
489 | return index; | 475 | return index; |
@@ -843,8 +829,8 @@ int iwl4965_send_statistics_request(struct iwl4965_priv *priv) | |||
843 | * iwl4965_rxon_add_station - add station into station table. | 829 | * iwl4965_rxon_add_station - add station into station table. |
844 | * | 830 | * |
845 | * there is only one AP station with id= IWL_AP_ID | 831 | * there is only one AP station with id= IWL_AP_ID |
846 | * NOTE: mutex must be held before calling the this fnction | 832 | * NOTE: mutex must be held before calling this fnction |
847 | */ | 833 | */ |
848 | static int iwl4965_rxon_add_station(struct iwl4965_priv *priv, | 834 | static int iwl4965_rxon_add_station(struct iwl4965_priv *priv, |
849 | const u8 *addr, int is_ap) | 835 | const u8 *addr, int is_ap) |
850 | { | 836 | { |
@@ -866,7 +852,8 @@ static int iwl4965_rxon_add_station(struct iwl4965_priv *priv, | |||
866 | * NOTE: Does not commit to the hardware; it sets appropriate bit fields | 852 | * NOTE: Does not commit to the hardware; it sets appropriate bit fields |
867 | * in the staging RXON flag structure based on the phymode | 853 | * in the staging RXON flag structure based on the phymode |
868 | */ | 854 | */ |
869 | static int iwl4965_set_rxon_channel(struct iwl4965_priv *priv, u8 phymode, u16 channel) | 855 | static int iwl4965_set_rxon_channel(struct iwl4965_priv *priv, u8 phymode, |
856 | u16 channel) | ||
870 | { | 857 | { |
871 | if (!iwl4965_get_channel_info(priv, phymode, channel)) { | 858 | if (!iwl4965_get_channel_info(priv, phymode, channel)) { |
872 | IWL_DEBUG_INFO("Could not set channel to %d [%d]\n", | 859 | IWL_DEBUG_INFO("Could not set channel to %d [%d]\n", |
@@ -965,12 +952,12 @@ static int iwl4965_check_rxon_cmd(struct iwl4965_rxon_cmd *rxon) | |||
965 | } | 952 | } |
966 | 953 | ||
967 | /** | 954 | /** |
968 | * iwl4965_full_rxon_required - determine if RXON_ASSOC can be used in RXON commit | 955 | * iwl4965_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed |
969 | * @priv: staging_rxon is compared to active_rxon | 956 | * @priv: staging_rxon is compared to active_rxon |
970 | * | 957 | * |
971 | * If the RXON structure is changing sufficient to require a new | 958 | * If the RXON structure is changing enough to require a new tune, |
972 | * tune or to clear and reset the RXON_FILTER_ASSOC_MSK then return 1 | 959 | * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that |
973 | * to indicate a new tune is required. | 960 | * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required. |
974 | */ | 961 | */ |
975 | static int iwl4965_full_rxon_required(struct iwl4965_priv *priv) | 962 | static int iwl4965_full_rxon_required(struct iwl4965_priv *priv) |
976 | { | 963 | { |
@@ -1267,7 +1254,7 @@ static int iwl4965_card_state_sync_callback(struct iwl4965_priv *priv, | |||
1267 | /* | 1254 | /* |
1268 | * CARD_STATE_CMD | 1255 | * CARD_STATE_CMD |
1269 | * | 1256 | * |
1270 | * Use: Sets the internal card state to enable, disable, or halt | 1257 | * Use: Sets the device's internal card state to enable, disable, or halt |
1271 | * | 1258 | * |
1272 | * When in the 'enable' state the card operates as normal. | 1259 | * When in the 'enable' state the card operates as normal. |
1273 | * When in the 'disable' state, the card enters into a low power mode. | 1260 | * When in the 'disable' state, the card enters into a low power mode. |
@@ -1643,14 +1630,12 @@ done: | |||
1643 | /** | 1630 | /** |
1644 | * iwl4965_report_frame - dump frame to syslog during debug sessions | 1631 | * iwl4965_report_frame - dump frame to syslog during debug sessions |
1645 | * | 1632 | * |
1646 | * hack this function to show different aspects of received frames, | 1633 | * You may hack this function to show different aspects of received frames, |
1647 | * including selective frame dumps. | 1634 | * including selective frame dumps. |
1648 | * group100 parameter selects whether to show 1 out of 100 good frames. | 1635 | * group100 parameter selects whether to show 1 out of 100 good frames. |
1649 | * | 1636 | * |
1650 | * TODO: ieee80211_hdr stuff is common to 3945 and 4965, so frame type | 1637 | * TODO: This was originally written for 3945, need to audit for |
1651 | * info output is okay, but some of this stuff (e.g. iwl4965_rx_frame_stats) | 1638 | * proper operation with 4965. |
1652 | * is 3945-specific and gives bad output for 4965. Need to split the | ||
1653 | * functionality, keep common stuff here. | ||
1654 | */ | 1639 | */ |
1655 | void iwl4965_report_frame(struct iwl4965_priv *priv, | 1640 | void iwl4965_report_frame(struct iwl4965_priv *priv, |
1656 | struct iwl4965_rx_packet *pkt, | 1641 | struct iwl4965_rx_packet *pkt, |
@@ -2742,7 +2727,8 @@ static void iwl4965_build_tx_cmd_basic(struct iwl4965_priv *priv, | |||
2742 | cmd->cmd.tx.next_frame_len = 0; | 2727 | cmd->cmd.tx.next_frame_len = 0; |
2743 | } | 2728 | } |
2744 | 2729 | ||
2745 | static int iwl4965_get_sta_id(struct iwl4965_priv *priv, struct ieee80211_hdr *hdr) | 2730 | static int iwl4965_get_sta_id(struct iwl4965_priv *priv, |
2731 | struct ieee80211_hdr *hdr) | ||
2746 | { | 2732 | { |
2747 | int sta_id; | 2733 | int sta_id; |
2748 | u16 fc = le16_to_cpu(hdr->frame_control); | 2734 | u16 fc = le16_to_cpu(hdr->frame_control); |
@@ -4104,13 +4090,10 @@ static void iwl4965_setup_rx_handlers(struct iwl4965_priv *priv) | |||
4104 | iwl4965_rx_pm_debug_statistics_notif; | 4090 | iwl4965_rx_pm_debug_statistics_notif; |
4105 | priv->rx_handlers[BEACON_NOTIFICATION] = iwl4965_rx_beacon_notif; | 4091 | priv->rx_handlers[BEACON_NOTIFICATION] = iwl4965_rx_beacon_notif; |
4106 | 4092 | ||
4107 | /* NOTE: iwl4965_rx_statistics is different based on whether | 4093 | /* |
4108 | * the build is for the 3945 or the 4965. See the | 4094 | * The same handler is used for both the REPLY to a discrete |
4109 | * corresponding implementation in iwl-XXXX.c | 4095 | * statistics request from the host as well as for the periodic |
4110 | * | 4096 | * statistics notifications (after received beacons) from the uCode. |
4111 | * The same handler is used for both the REPLY to a | ||
4112 | * discrete statistics request from the host as well as | ||
4113 | * for the periodic statistics notification from the uCode | ||
4114 | */ | 4097 | */ |
4115 | priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl4965_hw_rx_statistics; | 4098 | priv->rx_handlers[REPLY_STATISTICS_CMD] = iwl4965_hw_rx_statistics; |
4116 | priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl4965_hw_rx_statistics; | 4099 | priv->rx_handlers[STATISTICS_NOTIFICATION] = iwl4965_hw_rx_statistics; |
@@ -4124,7 +4107,7 @@ static void iwl4965_setup_rx_handlers(struct iwl4965_priv *priv) | |||
4124 | priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl4965_rx_card_state_notif; | 4107 | priv->rx_handlers[CARD_STATE_NOTIFICATION] = iwl4965_rx_card_state_notif; |
4125 | priv->rx_handlers[REPLY_TX] = iwl4965_rx_reply_tx; | 4108 | priv->rx_handlers[REPLY_TX] = iwl4965_rx_reply_tx; |
4126 | 4109 | ||
4127 | /* Setup hardware specific Rx handlers */ | 4110 | /* Set up hardware specific Rx handlers */ |
4128 | iwl4965_hw_rx_handler_setup(priv); | 4111 | iwl4965_hw_rx_handler_setup(priv); |
4129 | } | 4112 | } |
4130 | 4113 | ||
@@ -4178,9 +4161,11 @@ static void iwl4965_tx_cmd_complete(struct iwl4965_priv *priv, | |||
4178 | /* | 4161 | /* |
4179 | * Rx theory of operation | 4162 | * Rx theory of operation |
4180 | * | 4163 | * |
4181 | * The host allocates 32 DMA target addresses and passes the host address | 4164 | * Driver allocates a circular buffer of Receive Buffer Descriptors (RBDs), |
4182 | * to the firmware at register IWL_RFDS_TABLE_LOWER + N * RFD_SIZE where N is | 4165 | * each of which point to Receive Buffers to be filled by 4965. These get |
4183 | * 0 to 31 | 4166 | * used not only for Rx frames, but for any command response or notification |
4167 | * from the 4965. The driver and 4965 manage the Rx buffers by means | ||
4168 | * of indexes into the circular buffer. | ||
4184 | * | 4169 | * |
4185 | * Rx Queue Indexes | 4170 | * Rx Queue Indexes |
4186 | * The host/firmware share two index registers for managing the Rx buffers. | 4171 | * The host/firmware share two index registers for managing the Rx buffers. |
@@ -4196,10 +4181,10 @@ static void iwl4965_tx_cmd_complete(struct iwl4965_priv *priv, | |||
4196 | * The queue is empty (no good data) if WRITE = READ - 1, and is full if | 4181 | * The queue is empty (no good data) if WRITE = READ - 1, and is full if |
4197 | * WRITE = READ. | 4182 | * WRITE = READ. |
4198 | * | 4183 | * |
4199 | * During initialization the host sets up the READ queue position to the first | 4184 | * During initialization, the host sets up the READ queue position to the first |
4200 | * INDEX position, and WRITE to the last (READ - 1 wrapped) | 4185 | * INDEX position, and WRITE to the last (READ - 1 wrapped) |
4201 | * | 4186 | * |
4202 | * When the firmware places a packet in a buffer it will advance the READ index | 4187 | * When the firmware places a packet in a buffer, it will advance the READ index |
4203 | * and fire the RX interrupt. The driver can then query the READ index and | 4188 | * and fire the RX interrupt. The driver can then query the READ index and |
4204 | * process as many packets as possible, moving the WRITE index forward as it | 4189 | * process as many packets as possible, moving the WRITE index forward as it |
4205 | * resets the Rx queue buffers with new memory. | 4190 | * resets the Rx queue buffers with new memory. |
@@ -4221,16 +4206,16 @@ static void iwl4965_tx_cmd_complete(struct iwl4965_priv *priv, | |||
4221 | * | 4206 | * |
4222 | * Driver sequence: | 4207 | * Driver sequence: |
4223 | * | 4208 | * |
4224 | * iwl4965_rx_queue_alloc() Allocates rx_free | 4209 | * iwl4965_rx_queue_alloc() Allocates rx_free |
4225 | * iwl4965_rx_replenish() Replenishes rx_free list from rx_used, and calls | 4210 | * iwl4965_rx_replenish() Replenishes rx_free list from rx_used, and calls |
4226 | * iwl4965_rx_queue_restock | 4211 | * iwl4965_rx_queue_restock |
4227 | * iwl4965_rx_queue_restock() Moves available buffers from rx_free into Rx | 4212 | * iwl4965_rx_queue_restock() Moves available buffers from rx_free into Rx |
4228 | * queue, updates firmware pointers, and updates | 4213 | * queue, updates firmware pointers, and updates |
4229 | * the WRITE index. If insufficient rx_free buffers | 4214 | * the WRITE index. If insufficient rx_free buffers |
4230 | * are available, schedules iwl4965_rx_replenish | 4215 | * are available, schedules iwl4965_rx_replenish |
4231 | * | 4216 | * |
4232 | * -- enable interrupts -- | 4217 | * -- enable interrupts -- |
4233 | * ISR - iwl4965_rx() Detach iwl4965_rx_mem_buffers from pool up to the | 4218 | * ISR - iwl4965_rx() Detach iwl4965_rx_mem_buffers from pool up to the |
4234 | * READ INDEX, detaching the SKB from the pool. | 4219 | * READ INDEX, detaching the SKB from the pool. |
4235 | * Moves the packet buffer from queue to rx_used. | 4220 | * Moves the packet buffer from queue to rx_used. |
4236 | * Calls iwl4965_rx_queue_restock to refill any empty | 4221 | * Calls iwl4965_rx_queue_restock to refill any empty |
@@ -4256,12 +4241,6 @@ static int iwl4965_rx_queue_space(const struct iwl4965_rx_queue *q) | |||
4256 | 4241 | ||
4257 | /** | 4242 | /** |
4258 | * iwl4965_rx_queue_update_write_ptr - Update the write pointer for the RX queue | 4243 | * iwl4965_rx_queue_update_write_ptr - Update the write pointer for the RX queue |
4259 | * | ||
4260 | * NOTE: This function has 3945 and 4965 specific code sections | ||
4261 | * but is declared in base due to the majority of the | ||
4262 | * implementation being the same (only a numeric constant is | ||
4263 | * different) | ||
4264 | * | ||
4265 | */ | 4244 | */ |
4266 | int iwl4965_rx_queue_update_write_ptr(struct iwl4965_priv *priv, struct iwl4965_rx_queue *q) | 4245 | int iwl4965_rx_queue_update_write_ptr(struct iwl4965_priv *priv, struct iwl4965_rx_queue *q) |
4267 | { | 4246 | { |
@@ -4302,9 +4281,7 @@ int iwl4965_rx_queue_update_write_ptr(struct iwl4965_priv *priv, struct iwl4965_ | |||
4302 | } | 4281 | } |
4303 | 4282 | ||
4304 | /** | 4283 | /** |
4305 | * iwl4965_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer pointer. | 4284 | * iwl4965_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr |
4306 | * | ||
4307 | * NOTE: This function has 3945 and 4965 specific code paths in it. | ||
4308 | */ | 4285 | */ |
4309 | static inline __le32 iwl4965_dma_addr2rbd_ptr(struct iwl4965_priv *priv, | 4286 | static inline __le32 iwl4965_dma_addr2rbd_ptr(struct iwl4965_priv *priv, |
4310 | dma_addr_t dma_addr) | 4287 | dma_addr_t dma_addr) |
@@ -4316,9 +4293,9 @@ static inline __le32 iwl4965_dma_addr2rbd_ptr(struct iwl4965_priv *priv, | |||
4316 | /** | 4293 | /** |
4317 | * iwl4965_rx_queue_restock - refill RX queue from pre-allocated pool | 4294 | * iwl4965_rx_queue_restock - refill RX queue from pre-allocated pool |
4318 | * | 4295 | * |
4319 | * If there are slots in the RX queue that need to be restocked, | 4296 | * If there are slots in the RX queue that need to be restocked, |
4320 | * and we have free pre-allocated buffers, fill the ranks as much | 4297 | * and we have free pre-allocated buffers, fill the ranks as much |
4321 | * as we can pulling from rx_free. | 4298 | * as we can, pulling from rx_free. |
4322 | * | 4299 | * |
4323 | * This moves the 'write' index forward to catch up with 'processed', and | 4300 | * This moves the 'write' index forward to catch up with 'processed', and |
4324 | * also updates the memory address in the firmware to reference the new | 4301 | * also updates the memory address in the firmware to reference the new |
@@ -4410,7 +4387,7 @@ void iwl4965_rx_replenish(void *data) | |||
4410 | } | 4387 | } |
4411 | 4388 | ||
4412 | /* Assumes that the skb field of the buffers in 'pool' is kept accurate. | 4389 | /* Assumes that the skb field of the buffers in 'pool' is kept accurate. |
4413 | * If an SKB has been detached, the POOL needs to have it's SKB set to NULL | 4390 | * If an SKB has been detached, the POOL needs to have its SKB set to NULL |
4414 | * This free routine walks the list of POOL entries and if SKB is set to | 4391 | * This free routine walks the list of POOL entries and if SKB is set to |
4415 | * non NULL it is unmapped and freed | 4392 | * non NULL it is unmapped and freed |
4416 | */ | 4393 | */ |
@@ -4562,7 +4539,7 @@ int iwl4965_calc_sig_qual(int rssi_dbm, int noise_dbm) | |||
4562 | } | 4539 | } |
4563 | 4540 | ||
4564 | /** | 4541 | /** |
4565 | * iwl4965_rx_handle - Main entry function for receiving responses from the uCode | 4542 | * iwl4965_rx_handle - Main entry function for receiving responses from uCode |
4566 | * | 4543 | * |
4567 | * Uses the priv->rx_handlers callback function array to invoke | 4544 | * Uses the priv->rx_handlers callback function array to invoke |
4568 | * the appropriate handlers, including command responses, | 4545 | * the appropriate handlers, including command responses, |
@@ -4587,7 +4564,7 @@ static void iwl4965_rx_handle(struct iwl4965_priv *priv) | |||
4587 | while (i != r) { | 4564 | while (i != r) { |
4588 | rxb = rxq->queue[i]; | 4565 | rxb = rxq->queue[i]; |
4589 | 4566 | ||
4590 | /* If an RXB doesn't have a queue slot associated with it | 4567 | /* If an RXB doesn't have a Rx queue slot associated with it, |
4591 | * then a bug has been introduced in the queue refilling | 4568 | * then a bug has been introduced in the queue refilling |
4592 | * routines -- catch it here */ | 4569 | * routines -- catch it here */ |
4593 | BUG_ON(rxb == NULL); | 4570 | BUG_ON(rxb == NULL); |
@@ -4629,8 +4606,8 @@ static void iwl4965_rx_handle(struct iwl4965_priv *priv) | |||
4629 | } | 4606 | } |
4630 | 4607 | ||
4631 | if (reclaim) { | 4608 | if (reclaim) { |
4632 | /* Invoke any callbacks, transfer the skb to caller, | 4609 | /* Invoke any callbacks, transfer the skb to caller, and |
4633 | * and fire off the (possibly) blocking iwl4965_send_cmd() | 4610 | * fire off the (possibly) blocking iwl4965_send_cmd() |
4634 | * as we reclaim the driver command queue */ | 4611 | * as we reclaim the driver command queue */ |
4635 | if (rxb && rxb->skb) | 4612 | if (rxb && rxb->skb) |
4636 | iwl4965_tx_cmd_complete(priv, rxb); | 4613 | iwl4965_tx_cmd_complete(priv, rxb); |
@@ -4996,7 +4973,8 @@ static void iwl4965_irq_tasklet(struct iwl4965_priv *priv) | |||
4996 | 4973 | ||
4997 | #ifdef CONFIG_IWL4965_DEBUG | 4974 | #ifdef CONFIG_IWL4965_DEBUG |
4998 | if (iwl4965_debug_level & IWL_DL_ISR) { | 4975 | if (iwl4965_debug_level & IWL_DL_ISR) { |
4999 | inta_mask = iwl4965_read32(priv, CSR_INT_MASK); /* just for debug */ | 4976 | /* just for debug */ |
4977 | inta_mask = iwl4965_read32(priv, CSR_INT_MASK); | ||
5000 | IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", | 4978 | IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", |
5001 | inta, inta_mask, inta_fh); | 4979 | inta, inta_mask, inta_fh); |
5002 | } | 4980 | } |
@@ -5041,7 +5019,7 @@ static void iwl4965_irq_tasklet(struct iwl4965_priv *priv) | |||
5041 | /* Safely ignore these bits for debug checks below */ | 5019 | /* Safely ignore these bits for debug checks below */ |
5042 | inta &= ~(CSR_INT_BIT_MAC_CLK_ACTV | CSR_INT_BIT_ALIVE); | 5020 | inta &= ~(CSR_INT_BIT_MAC_CLK_ACTV | CSR_INT_BIT_ALIVE); |
5043 | 5021 | ||
5044 | /* HW RF KILL switch toggled (4965 only) */ | 5022 | /* HW RF KILL switch toggled */ |
5045 | if (inta & CSR_INT_BIT_RF_KILL) { | 5023 | if (inta & CSR_INT_BIT_RF_KILL) { |
5046 | int hw_rf_kill = 0; | 5024 | int hw_rf_kill = 0; |
5047 | if (!(iwl4965_read32(priv, CSR_GP_CNTRL) & | 5025 | if (!(iwl4965_read32(priv, CSR_GP_CNTRL) & |
@@ -5064,7 +5042,7 @@ static void iwl4965_irq_tasklet(struct iwl4965_priv *priv) | |||
5064 | handled |= CSR_INT_BIT_RF_KILL; | 5042 | handled |= CSR_INT_BIT_RF_KILL; |
5065 | } | 5043 | } |
5066 | 5044 | ||
5067 | /* Chip got too hot and stopped itself (4965 only) */ | 5045 | /* Chip got too hot and stopped itself */ |
5068 | if (inta & CSR_INT_BIT_CT_KILL) { | 5046 | if (inta & CSR_INT_BIT_CT_KILL) { |
5069 | IWL_ERROR("Microcode CT kill error detected.\n"); | 5047 | IWL_ERROR("Microcode CT kill error detected.\n"); |
5070 | handled |= CSR_INT_BIT_CT_KILL; | 5048 | handled |= CSR_INT_BIT_CT_KILL; |
@@ -5219,11 +5197,11 @@ static const u8 iwl4965_eeprom_band_1[14] = { | |||
5219 | }; | 5197 | }; |
5220 | 5198 | ||
5221 | /* 5.2 GHz bands */ | 5199 | /* 5.2 GHz bands */ |
5222 | static const u8 iwl4965_eeprom_band_2[] = { | 5200 | static const u8 iwl4965_eeprom_band_2[] = { /* 4915-5080MHz */ |
5223 | 183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16 | 5201 | 183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16 |
5224 | }; | 5202 | }; |
5225 | 5203 | ||
5226 | static const u8 iwl4965_eeprom_band_3[] = { /* 5205-5320MHz */ | 5204 | static const u8 iwl4965_eeprom_band_3[] = { /* 5170-5320MHz */ |
5227 | 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 | 5205 | 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64 |
5228 | }; | 5206 | }; |
5229 | 5207 | ||
@@ -5243,7 +5221,8 @@ static u8 iwl4965_eeprom_band_7[] = { /* 5.2 FAT channel */ | |||
5243 | 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157 | 5221 | 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157 |
5244 | }; | 5222 | }; |
5245 | 5223 | ||
5246 | static void iwl4965_init_band_reference(const struct iwl4965_priv *priv, int band, | 5224 | static void iwl4965_init_band_reference(const struct iwl4965_priv *priv, |
5225 | int band, | ||
5247 | int *eeprom_ch_count, | 5226 | int *eeprom_ch_count, |
5248 | const struct iwl4965_eeprom_channel | 5227 | const struct iwl4965_eeprom_channel |
5249 | **eeprom_ch_info, | 5228 | **eeprom_ch_info, |
@@ -5255,7 +5234,7 @@ static void iwl4965_init_band_reference(const struct iwl4965_priv *priv, int ban | |||
5255 | *eeprom_ch_info = priv->eeprom.band_1_channels; | 5234 | *eeprom_ch_info = priv->eeprom.band_1_channels; |
5256 | *eeprom_ch_index = iwl4965_eeprom_band_1; | 5235 | *eeprom_ch_index = iwl4965_eeprom_band_1; |
5257 | break; | 5236 | break; |
5258 | case 2: /* 5.2GHz band */ | 5237 | case 2: /* 4.9GHz band */ |
5259 | *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_2); | 5238 | *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_2); |
5260 | *eeprom_ch_info = priv->eeprom.band_2_channels; | 5239 | *eeprom_ch_info = priv->eeprom.band_2_channels; |
5261 | *eeprom_ch_index = iwl4965_eeprom_band_2; | 5240 | *eeprom_ch_index = iwl4965_eeprom_band_2; |
@@ -5265,22 +5244,22 @@ static void iwl4965_init_band_reference(const struct iwl4965_priv *priv, int ban | |||
5265 | *eeprom_ch_info = priv->eeprom.band_3_channels; | 5244 | *eeprom_ch_info = priv->eeprom.band_3_channels; |
5266 | *eeprom_ch_index = iwl4965_eeprom_band_3; | 5245 | *eeprom_ch_index = iwl4965_eeprom_band_3; |
5267 | break; | 5246 | break; |
5268 | case 4: /* 5.2GHz band */ | 5247 | case 4: /* 5.5GHz band */ |
5269 | *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_4); | 5248 | *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_4); |
5270 | *eeprom_ch_info = priv->eeprom.band_4_channels; | 5249 | *eeprom_ch_info = priv->eeprom.band_4_channels; |
5271 | *eeprom_ch_index = iwl4965_eeprom_band_4; | 5250 | *eeprom_ch_index = iwl4965_eeprom_band_4; |
5272 | break; | 5251 | break; |
5273 | case 5: /* 5.2GHz band */ | 5252 | case 5: /* 5.7GHz band */ |
5274 | *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_5); | 5253 | *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_5); |
5275 | *eeprom_ch_info = priv->eeprom.band_5_channels; | 5254 | *eeprom_ch_info = priv->eeprom.band_5_channels; |
5276 | *eeprom_ch_index = iwl4965_eeprom_band_5; | 5255 | *eeprom_ch_index = iwl4965_eeprom_band_5; |
5277 | break; | 5256 | break; |
5278 | case 6: | 5257 | case 6: /* 2.4GHz FAT channels */ |
5279 | *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_6); | 5258 | *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_6); |
5280 | *eeprom_ch_info = priv->eeprom.band_24_channels; | 5259 | *eeprom_ch_info = priv->eeprom.band_24_channels; |
5281 | *eeprom_ch_index = iwl4965_eeprom_band_6; | 5260 | *eeprom_ch_index = iwl4965_eeprom_band_6; |
5282 | break; | 5261 | break; |
5283 | case 7: | 5262 | case 7: /* 5 GHz FAT channels */ |
5284 | *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_7); | 5263 | *eeprom_ch_count = ARRAY_SIZE(iwl4965_eeprom_band_7); |
5285 | *eeprom_ch_info = priv->eeprom.band_52_channels; | 5264 | *eeprom_ch_info = priv->eeprom.band_52_channels; |
5286 | *eeprom_ch_index = iwl4965_eeprom_band_7; | 5265 | *eeprom_ch_index = iwl4965_eeprom_band_7; |
@@ -5549,7 +5528,8 @@ static int iwl4965_get_channels_for_scan(struct iwl4965_priv *priv, int phymode, | |||
5549 | 5528 | ||
5550 | scan_ch->channel = channels[i].chan; | 5529 | scan_ch->channel = channels[i].chan; |
5551 | 5530 | ||
5552 | ch_info = iwl4965_get_channel_info(priv, phymode, scan_ch->channel); | 5531 | ch_info = iwl4965_get_channel_info(priv, phymode, |
5532 | scan_ch->channel); | ||
5553 | if (!is_channel_valid(ch_info)) { | 5533 | if (!is_channel_valid(ch_info)) { |
5554 | IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", | 5534 | IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", |
5555 | scan_ch->channel); | 5535 | scan_ch->channel); |
@@ -5571,7 +5551,7 @@ static int iwl4965_get_channels_for_scan(struct iwl4965_priv *priv, int phymode, | |||
5571 | scan_ch->active_dwell = cpu_to_le16(active_dwell); | 5551 | scan_ch->active_dwell = cpu_to_le16(active_dwell); |
5572 | scan_ch->passive_dwell = cpu_to_le16(passive_dwell); | 5552 | scan_ch->passive_dwell = cpu_to_le16(passive_dwell); |
5573 | 5553 | ||
5574 | /* Set power levels to defaults */ | 5554 | /* Set txpower levels to defaults */ |
5575 | scan_ch->tpc.dsp_atten = 110; | 5555 | scan_ch->tpc.dsp_atten = 110; |
5576 | /* scan_pwr_info->tpc.dsp_atten; */ | 5556 | /* scan_pwr_info->tpc.dsp_atten; */ |
5577 | 5557 | ||
@@ -5581,8 +5561,8 @@ static int iwl4965_get_channels_for_scan(struct iwl4965_priv *priv, int phymode, | |||
5581 | else { | 5561 | else { |
5582 | scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3)); | 5562 | scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3)); |
5583 | /* NOTE: if we were doing 6Mb OFDM for scans we'd use | 5563 | /* NOTE: if we were doing 6Mb OFDM for scans we'd use |
5584 | * power level | 5564 | * power level: |
5585 | scan_ch->tpc.tx_gain = ((1<<5) | (2 << 3)) | 3; | 5565 | * scan_ch->tpc.tx_gain = ((1<<5) | (2 << 3)) | 3; |
5586 | */ | 5566 | */ |
5587 | } | 5567 | } |
5588 | 5568 | ||
@@ -5859,7 +5839,8 @@ static void iwl4965_dealloc_ucode_pci(struct iwl4965_priv *priv) | |||
5859 | * iwl4965_verify_inst_full - verify runtime uCode image in card vs. host, | 5839 | * iwl4965_verify_inst_full - verify runtime uCode image in card vs. host, |
5860 | * looking at all data. | 5840 | * looking at all data. |
5861 | */ | 5841 | */ |
5862 | static int iwl4965_verify_inst_full(struct iwl4965_priv *priv, __le32 * image, u32 len) | 5842 | static int iwl4965_verify_inst_full(struct iwl4965_priv *priv, __le32 * image, |
5843 | u32 len) | ||
5863 | { | 5844 | { |
5864 | u32 val; | 5845 | u32 val; |
5865 | u32 save_len = len; | 5846 | u32 save_len = len; |
@@ -5984,8 +5965,9 @@ static int iwl4965_verify_ucode(struct iwl4965_priv *priv) | |||
5984 | 5965 | ||
5985 | IWL_ERROR("NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n"); | 5966 | IWL_ERROR("NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n"); |
5986 | 5967 | ||
5987 | /* Show first several data entries in instruction SRAM. | 5968 | /* Since nothing seems to match, show first several data entries in |
5988 | * Selection of bootstrap image is arbitrary. */ | 5969 | * instruction SRAM, so maybe visual inspection will give a clue. |
5970 | * Selection of bootstrap image (vs. other images) is arbitrary. */ | ||
5989 | image = (__le32 *)priv->ucode_boot.v_addr; | 5971 | image = (__le32 *)priv->ucode_boot.v_addr; |
5990 | len = priv->ucode_boot.len; | 5972 | len = priv->ucode_boot.len; |
5991 | rc = iwl4965_verify_inst_full(priv, image, len); | 5973 | rc = iwl4965_verify_inst_full(priv, image, len); |
@@ -6077,7 +6059,7 @@ static int iwl4965_load_bsm(struct iwl4965_priv *priv) | |||
6077 | return -EINVAL; | 6059 | return -EINVAL; |
6078 | 6060 | ||
6079 | /* Tell bootstrap uCode where to find the "Initialize" uCode | 6061 | /* Tell bootstrap uCode where to find the "Initialize" uCode |
6080 | * in host DRAM ... bits 31:0 for 3945, bits 35:4 for 4965. | 6062 | * in host DRAM ... host DRAM physical address bits 35:4 for 4965. |
6081 | * NOTE: iwl4965_initialize_alive_start() will replace these values, | 6063 | * NOTE: iwl4965_initialize_alive_start() will replace these values, |
6082 | * after the "initialize" uCode has run, to point to | 6064 | * after the "initialize" uCode has run, to point to |
6083 | * runtime/protocol instructions and backup data cache. */ | 6065 | * runtime/protocol instructions and backup data cache. */ |
@@ -6487,7 +6469,7 @@ static void iwl4965_alive_start(struct iwl4965_priv *priv) | |||
6487 | goto restart; | 6469 | goto restart; |
6488 | } | 6470 | } |
6489 | 6471 | ||
6490 | /* After the ALIVE response, we can process host commands */ | 6472 | /* After the ALIVE response, we can send host commands to 4965 uCode */ |
6491 | set_bit(STATUS_ALIVE, &priv->status); | 6473 | set_bit(STATUS_ALIVE, &priv->status); |
6492 | 6474 | ||
6493 | /* Clear out the uCode error bit if it is set */ | 6475 | /* Clear out the uCode error bit if it is set */ |
@@ -6544,7 +6526,7 @@ static void iwl4965_alive_start(struct iwl4965_priv *priv) | |||
6544 | memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); | 6526 | memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); |
6545 | } | 6527 | } |
6546 | 6528 | ||
6547 | /* Configure BT coexistence */ | 6529 | /* Configure Bluetooth device coexistence support */ |
6548 | iwl4965_send_bt_config(priv); | 6530 | iwl4965_send_bt_config(priv); |
6549 | 6531 | ||
6550 | /* Configure the adapter for unassociated operation */ | 6532 | /* Configure the adapter for unassociated operation */ |
@@ -6624,7 +6606,8 @@ static void __iwl4965_down(struct iwl4965_priv *priv) | |||
6624 | STATUS_FW_ERROR; | 6606 | STATUS_FW_ERROR; |
6625 | 6607 | ||
6626 | spin_lock_irqsave(&priv->lock, flags); | 6608 | spin_lock_irqsave(&priv->lock, flags); |
6627 | iwl4965_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | 6609 | iwl4965_clear_bit(priv, CSR_GP_CNTRL, |
6610 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | ||
6628 | spin_unlock_irqrestore(&priv->lock, flags); | 6611 | spin_unlock_irqrestore(&priv->lock, flags); |
6629 | 6612 | ||
6630 | iwl4965_hw_txq_ctx_stop(priv); | 6613 | iwl4965_hw_txq_ctx_stop(priv); |
@@ -6744,7 +6727,7 @@ static int __iwl4965_up(struct iwl4965_priv *priv) | |||
6744 | /* start card; "initialize" will load runtime ucode */ | 6727 | /* start card; "initialize" will load runtime ucode */ |
6745 | iwl4965_nic_start(priv); | 6728 | iwl4965_nic_start(priv); |
6746 | 6729 | ||
6747 | /* MAC Address location in EEPROM same for 3945/4965 */ | 6730 | /* MAC Address location in EEPROM is same for 3945/4965 */ |
6748 | get_eeprom_mac(priv, priv->mac_addr); | 6731 | get_eeprom_mac(priv, priv->mac_addr); |
6749 | IWL_DEBUG_INFO("MAC address: %s\n", | 6732 | IWL_DEBUG_INFO("MAC address: %s\n", |
6750 | print_mac(mac, priv->mac_addr)); | 6733 | print_mac(mac, priv->mac_addr)); |