diff options
author | Johannes Berg <johannes.berg@intel.com> | 2010-01-21 09:09:28 -0500 |
---|---|---|
committer | Reinette Chatre <reinette.chatre@intel.com> | 2010-03-09 19:03:26 -0500 |
commit | ee525d13f501baeaa33209620398adaf0a820629 (patch) | |
tree | 78b992a190ac325d64fa929b3fcbe6913f572044 | |
parent | a1175124f34a4b859b5064efb84a197e4f6794a6 (diff) |
iwlwifi: move 3945 specific data into union
To be obviously correct, this patch only modifies
3945 files and the struct definition. A follow-up
patch will create the AGN part of the union.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945-hw.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945.c | 27 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 30 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 22 |
5 files changed, 45 insertions, 40 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h index 3a876a8ece38..074f42a7dcad 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h | |||
@@ -78,6 +78,8 @@ | |||
78 | /* RSSI to dBm */ | 78 | /* RSSI to dBm */ |
79 | #define IWL39_RSSI_OFFSET 95 | 79 | #define IWL39_RSSI_OFFSET 95 |
80 | 80 | ||
81 | #define IWL_DEFAULT_TX_POWER 0x0F | ||
82 | |||
81 | /* | 83 | /* |
82 | * EEPROM related constants, enums, and structures. | 84 | * EEPROM related constants, enums, and structures. |
83 | */ | 85 | */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index 47909f94271e..effdd3670da4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |||
@@ -372,11 +372,11 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, | |||
372 | } | 372 | } |
373 | } | 373 | } |
374 | 374 | ||
375 | priv->sta_supp_rates = sta->supp_rates[sband->band]; | 375 | priv->_3945.sta_supp_rates = sta->supp_rates[sband->band]; |
376 | /* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */ | 376 | /* For 5 GHz band it start at IWL_FIRST_OFDM_RATE */ |
377 | if (sband->band == IEEE80211_BAND_5GHZ) { | 377 | if (sband->band == IEEE80211_BAND_5GHZ) { |
378 | rs_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; | 378 | rs_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; |
379 | priv->sta_supp_rates = priv->sta_supp_rates << | 379 | priv->_3945.sta_supp_rates = priv->_3945.sta_supp_rates << |
380 | IWL_FIRST_OFDM_RATE; | 380 | IWL_FIRST_OFDM_RATE; |
381 | } | 381 | } |
382 | 382 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 303cc8193adc..867bd69270f8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -242,7 +242,7 @@ int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate) | |||
242 | next_rate = IWL_RATE_6M_INDEX; | 242 | next_rate = IWL_RATE_6M_INDEX; |
243 | break; | 243 | break; |
244 | case IEEE80211_BAND_2GHZ: | 244 | case IEEE80211_BAND_2GHZ: |
245 | if (!(priv->sta_supp_rates & IWL_OFDM_RATES_MASK) && | 245 | if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) && |
246 | iwl_is_associated(priv)) { | 246 | iwl_is_associated(priv)) { |
247 | if (rate == IWL_RATE_11M_INDEX) | 247 | if (rate == IWL_RATE_11M_INDEX) |
248 | next_rate = IWL_RATE_5M_INDEX; | 248 | next_rate = IWL_RATE_5M_INDEX; |
@@ -359,7 +359,7 @@ void iwl3945_hw_rx_statistics(struct iwl_priv *priv, | |||
359 | (int)sizeof(struct iwl3945_notif_statistics), | 359 | (int)sizeof(struct iwl3945_notif_statistics), |
360 | le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK); | 360 | le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK); |
361 | 361 | ||
362 | memcpy(&priv->statistics_39, pkt->u.raw, sizeof(priv->statistics_39)); | 362 | memcpy(&priv->_3945.statistics, pkt->u.raw, sizeof(priv->_3945.statistics)); |
363 | } | 363 | } |
364 | 364 | ||
365 | /****************************************************************************** | 365 | /****************************************************************************** |
@@ -956,7 +956,7 @@ static int iwl3945_tx_reset(struct iwl_priv *priv) | |||
956 | iwl_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005); | 956 | iwl_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005); |
957 | 957 | ||
958 | iwl_write_direct32(priv, FH39_TSSR_CBB_BASE, | 958 | iwl_write_direct32(priv, FH39_TSSR_CBB_BASE, |
959 | priv->shared_phys); | 959 | priv->_3945.shared_phys); |
960 | 960 | ||
961 | iwl_write_direct32(priv, FH39_TSSR_MSG_CONFIG, | 961 | iwl_write_direct32(priv, FH39_TSSR_MSG_CONFIG, |
962 | FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON | | 962 | FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON | |
@@ -1997,13 +1997,13 @@ void iwl3945_reg_txpower_periodic(struct iwl_priv *priv) | |||
1997 | 1997 | ||
1998 | reschedule: | 1998 | reschedule: |
1999 | queue_delayed_work(priv->workqueue, | 1999 | queue_delayed_work(priv->workqueue, |
2000 | &priv->thermal_periodic, REG_RECALIB_PERIOD * HZ); | 2000 | &priv->_3945.thermal_periodic, REG_RECALIB_PERIOD * HZ); |
2001 | } | 2001 | } |
2002 | 2002 | ||
2003 | static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work) | 2003 | static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work) |
2004 | { | 2004 | { |
2005 | struct iwl_priv *priv = container_of(work, struct iwl_priv, | 2005 | struct iwl_priv *priv = container_of(work, struct iwl_priv, |
2006 | thermal_periodic.work); | 2006 | _3945.thermal_periodic.work); |
2007 | 2007 | ||
2008 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2008 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
2009 | return; | 2009 | return; |
@@ -2331,7 +2331,7 @@ int iwl3945_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq) | |||
2331 | { | 2331 | { |
2332 | int txq_id = txq->q.id; | 2332 | int txq_id = txq->q.id; |
2333 | 2333 | ||
2334 | struct iwl3945_shared *shared_data = priv->shared_virt; | 2334 | struct iwl3945_shared *shared_data = priv->_3945.shared_virt; |
2335 | 2335 | ||
2336 | shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32)txq->q.dma_addr); | 2336 | shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32)txq->q.dma_addr); |
2337 | 2337 | ||
@@ -2431,7 +2431,7 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv) | |||
2431 | /* If an OFDM rate is used, have it fall back to the | 2431 | /* If an OFDM rate is used, have it fall back to the |
2432 | * 1M CCK rates */ | 2432 | * 1M CCK rates */ |
2433 | 2433 | ||
2434 | if (!(priv->sta_supp_rates & IWL_OFDM_RATES_MASK) && | 2434 | if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) && |
2435 | iwl_is_associated(priv)) { | 2435 | iwl_is_associated(priv)) { |
2436 | 2436 | ||
2437 | index = IWL_FIRST_CCK_RATE; | 2437 | index = IWL_FIRST_CCK_RATE; |
@@ -2470,10 +2470,11 @@ int iwl3945_hw_set_hw_params(struct iwl_priv *priv) | |||
2470 | memset((void *)&priv->hw_params, 0, | 2470 | memset((void *)&priv->hw_params, 0, |
2471 | sizeof(struct iwl_hw_params)); | 2471 | sizeof(struct iwl_hw_params)); |
2472 | 2472 | ||
2473 | priv->shared_virt = dma_alloc_coherent(&priv->pci_dev->dev, | 2473 | priv->_3945.shared_virt = |
2474 | sizeof(struct iwl3945_shared), | 2474 | dma_alloc_coherent(&priv->pci_dev->dev, |
2475 | &priv->shared_phys, GFP_KERNEL); | 2475 | sizeof(struct iwl3945_shared), |
2476 | if (!priv->shared_virt) { | 2476 | &priv->_3945.shared_phys, GFP_KERNEL); |
2477 | if (!priv->_3945.shared_virt) { | ||
2477 | IWL_ERR(priv, "failed to allocate pci memory\n"); | 2478 | IWL_ERR(priv, "failed to allocate pci memory\n"); |
2478 | mutex_unlock(&priv->mutex); | 2479 | mutex_unlock(&priv->mutex); |
2479 | return -ENOMEM; | 2480 | return -ENOMEM; |
@@ -2536,13 +2537,13 @@ void iwl3945_hw_rx_handler_setup(struct iwl_priv *priv) | |||
2536 | 2537 | ||
2537 | void iwl3945_hw_setup_deferred_work(struct iwl_priv *priv) | 2538 | void iwl3945_hw_setup_deferred_work(struct iwl_priv *priv) |
2538 | { | 2539 | { |
2539 | INIT_DELAYED_WORK(&priv->thermal_periodic, | 2540 | INIT_DELAYED_WORK(&priv->_3945.thermal_periodic, |
2540 | iwl3945_bg_reg_txpower_periodic); | 2541 | iwl3945_bg_reg_txpower_periodic); |
2541 | } | 2542 | } |
2542 | 2543 | ||
2543 | void iwl3945_hw_cancel_deferred_work(struct iwl_priv *priv) | 2544 | void iwl3945_hw_cancel_deferred_work(struct iwl_priv *priv) |
2544 | { | 2545 | { |
2545 | cancel_delayed_work(&priv->thermal_periodic); | 2546 | cancel_delayed_work(&priv->_3945.thermal_periodic); |
2546 | } | 2547 | } |
2547 | 2548 | ||
2548 | /* check contents of special bootstrap uCode SRAM */ | 2549 | /* check contents of special bootstrap uCode SRAM */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 6054c5fba0c1..e6cae3884879 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -1262,10 +1262,22 @@ struct iwl_priv { | |||
1262 | u16 beacon_int; | 1262 | u16 beacon_int; |
1263 | struct ieee80211_vif *vif; | 1263 | struct ieee80211_vif *vif; |
1264 | 1264 | ||
1265 | /*Added for 3945 */ | 1265 | union { |
1266 | void *shared_virt; | 1266 | #if defined(CONFIG_IWL3945) || defined(CONFIG_IWL3945_MODULE) |
1267 | dma_addr_t shared_phys; | 1267 | struct { |
1268 | /*End*/ | 1268 | void *shared_virt; |
1269 | dma_addr_t shared_phys; | ||
1270 | |||
1271 | struct delayed_work thermal_periodic; | ||
1272 | struct delayed_work rfkill_poll; | ||
1273 | |||
1274 | struct iwl3945_notif_statistics statistics; | ||
1275 | |||
1276 | u32 sta_supp_rates; | ||
1277 | } _3945; | ||
1278 | #endif | ||
1279 | }; | ||
1280 | |||
1269 | struct iwl_hw_params hw_params; | 1281 | struct iwl_hw_params hw_params; |
1270 | 1282 | ||
1271 | /* INT ICT Table */ | 1283 | /* INT ICT Table */ |
@@ -1303,10 +1315,6 @@ struct iwl_priv { | |||
1303 | struct delayed_work alive_start; | 1315 | struct delayed_work alive_start; |
1304 | struct delayed_work scan_check; | 1316 | struct delayed_work scan_check; |
1305 | 1317 | ||
1306 | /*For 3945 only*/ | ||
1307 | struct delayed_work thermal_periodic; | ||
1308 | struct delayed_work rfkill_poll; | ||
1309 | |||
1310 | /* TX Power */ | 1318 | /* TX Power */ |
1311 | s8 tx_power_user_lmt; | 1319 | s8 tx_power_user_lmt; |
1312 | s8 tx_power_device_lmt; | 1320 | s8 tx_power_device_lmt; |
@@ -1339,12 +1347,6 @@ struct iwl_priv { | |||
1339 | struct timer_list statistics_periodic; | 1347 | struct timer_list statistics_periodic; |
1340 | struct timer_list ucode_trace; | 1348 | struct timer_list ucode_trace; |
1341 | bool hw_ready; | 1349 | bool hw_ready; |
1342 | /*For 3945*/ | ||
1343 | #define IWL_DEFAULT_TX_POWER 0x0F | ||
1344 | |||
1345 | struct iwl3945_notif_statistics statistics_39; | ||
1346 | |||
1347 | u32 sta_supp_rates; | ||
1348 | 1350 | ||
1349 | struct iwl_event_log event_log; | 1351 | struct iwl_event_log event_log; |
1350 | }; /*iwl_priv */ | 1352 | }; /*iwl_priv */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 54daa38ecba3..1b3a1ba4ed96 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -351,11 +351,11 @@ static int iwl3945_send_beacon_cmd(struct iwl_priv *priv) | |||
351 | 351 | ||
352 | static void iwl3945_unset_hw_params(struct iwl_priv *priv) | 352 | static void iwl3945_unset_hw_params(struct iwl_priv *priv) |
353 | { | 353 | { |
354 | if (priv->shared_virt) | 354 | if (priv->_3945.shared_virt) |
355 | dma_free_coherent(&priv->pci_dev->dev, | 355 | dma_free_coherent(&priv->pci_dev->dev, |
356 | sizeof(struct iwl3945_shared), | 356 | sizeof(struct iwl3945_shared), |
357 | priv->shared_virt, | 357 | priv->_3945.shared_virt, |
358 | priv->shared_phys); | 358 | priv->_3945.shared_phys); |
359 | } | 359 | } |
360 | 360 | ||
361 | static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, | 361 | static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, |
@@ -2786,7 +2786,7 @@ static void iwl3945_bg_alive_start(struct work_struct *data) | |||
2786 | static void iwl3945_rfkill_poll(struct work_struct *data) | 2786 | static void iwl3945_rfkill_poll(struct work_struct *data) |
2787 | { | 2787 | { |
2788 | struct iwl_priv *priv = | 2788 | struct iwl_priv *priv = |
2789 | container_of(data, struct iwl_priv, rfkill_poll.work); | 2789 | container_of(data, struct iwl_priv, _3945.rfkill_poll.work); |
2790 | bool old_rfkill = test_bit(STATUS_RF_KILL_HW, &priv->status); | 2790 | bool old_rfkill = test_bit(STATUS_RF_KILL_HW, &priv->status); |
2791 | bool new_rfkill = !(iwl_read32(priv, CSR_GP_CNTRL) | 2791 | bool new_rfkill = !(iwl_read32(priv, CSR_GP_CNTRL) |
2792 | & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); | 2792 | & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW); |
@@ -2805,7 +2805,7 @@ static void iwl3945_rfkill_poll(struct work_struct *data) | |||
2805 | 2805 | ||
2806 | /* Keep this running, even if radio now enabled. This will be | 2806 | /* Keep this running, even if radio now enabled. This will be |
2807 | * cancelled in mac_start() if system decides to start again */ | 2807 | * cancelled in mac_start() if system decides to start again */ |
2808 | queue_delayed_work(priv->workqueue, &priv->rfkill_poll, | 2808 | queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll, |
2809 | round_jiffies_relative(2 * HZ)); | 2809 | round_jiffies_relative(2 * HZ)); |
2810 | 2810 | ||
2811 | } | 2811 | } |
@@ -3212,7 +3212,7 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw) | |||
3212 | 3212 | ||
3213 | /* ucode is running and will send rfkill notifications, | 3213 | /* ucode is running and will send rfkill notifications, |
3214 | * no need to poll the killswitch state anymore */ | 3214 | * no need to poll the killswitch state anymore */ |
3215 | cancel_delayed_work(&priv->rfkill_poll); | 3215 | cancel_delayed_work(&priv->_3945.rfkill_poll); |
3216 | 3216 | ||
3217 | iwl_led_start(priv); | 3217 | iwl_led_start(priv); |
3218 | 3218 | ||
@@ -3253,7 +3253,7 @@ static void iwl3945_mac_stop(struct ieee80211_hw *hw) | |||
3253 | flush_workqueue(priv->workqueue); | 3253 | flush_workqueue(priv->workqueue); |
3254 | 3254 | ||
3255 | /* start polling the killswitch state again */ | 3255 | /* start polling the killswitch state again */ |
3256 | queue_delayed_work(priv->workqueue, &priv->rfkill_poll, | 3256 | queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll, |
3257 | round_jiffies_relative(2 * HZ)); | 3257 | round_jiffies_relative(2 * HZ)); |
3258 | 3258 | ||
3259 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 3259 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
@@ -3660,7 +3660,7 @@ static ssize_t show_statistics(struct device *d, | |||
3660 | struct iwl_priv *priv = dev_get_drvdata(d); | 3660 | struct iwl_priv *priv = dev_get_drvdata(d); |
3661 | u32 size = sizeof(struct iwl3945_notif_statistics); | 3661 | u32 size = sizeof(struct iwl3945_notif_statistics); |
3662 | u32 len = 0, ofs = 0; | 3662 | u32 len = 0, ofs = 0; |
3663 | u8 *data = (u8 *)&priv->statistics_39; | 3663 | u8 *data = (u8 *)&priv->_3945.statistics; |
3664 | int rc = 0; | 3664 | int rc = 0; |
3665 | 3665 | ||
3666 | if (!iwl_is_alive(priv)) | 3666 | if (!iwl_is_alive(priv)) |
@@ -3773,7 +3773,7 @@ static void iwl3945_setup_deferred_work(struct iwl_priv *priv) | |||
3773 | INIT_WORK(&priv->beacon_update, iwl3945_bg_beacon_update); | 3773 | INIT_WORK(&priv->beacon_update, iwl3945_bg_beacon_update); |
3774 | INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start); | 3774 | INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start); |
3775 | INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start); | 3775 | INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start); |
3776 | INIT_DELAYED_WORK(&priv->rfkill_poll, iwl3945_rfkill_poll); | 3776 | INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, iwl3945_rfkill_poll); |
3777 | INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); | 3777 | INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); |
3778 | INIT_WORK(&priv->request_scan, iwl3945_bg_request_scan); | 3778 | INIT_WORK(&priv->request_scan, iwl3945_bg_request_scan); |
3779 | INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); | 3779 | INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); |
@@ -4129,7 +4129,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
4129 | IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); | 4129 | IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); |
4130 | 4130 | ||
4131 | /* Start monitoring the killswitch */ | 4131 | /* Start monitoring the killswitch */ |
4132 | queue_delayed_work(priv->workqueue, &priv->rfkill_poll, | 4132 | queue_delayed_work(priv->workqueue, &priv->_3945.rfkill_poll, |
4133 | 2 * HZ); | 4133 | 2 * HZ); |
4134 | 4134 | ||
4135 | return 0; | 4135 | return 0; |
@@ -4203,7 +4203,7 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev) | |||
4203 | 4203 | ||
4204 | sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); | 4204 | sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); |
4205 | 4205 | ||
4206 | cancel_delayed_work_sync(&priv->rfkill_poll); | 4206 | cancel_delayed_work_sync(&priv->_3945.rfkill_poll); |
4207 | 4207 | ||
4208 | iwl3945_dealloc_ucode_pci(priv); | 4208 | iwl3945_dealloc_ucode_pci(priv); |
4209 | 4209 | ||