aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c41
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h34
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c36
4 files changed, 49 insertions, 69 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 82b2023c6ad0..b5b23b1ad240 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -804,10 +804,10 @@ u8 iwl3945_hw_find_station(struct iwl3945_priv *priv, const u8 *addr)
804 start = IWL_STA_ID; 804 start = IWL_STA_ID;
805 805
806 if (is_broadcast_ether_addr(addr)) 806 if (is_broadcast_ether_addr(addr))
807 return priv->hw_setting.bcast_sta_id; 807 return priv->hw_params.bcast_sta_id;
808 808
809 spin_lock_irqsave(&priv->sta_lock, flags); 809 spin_lock_irqsave(&priv->sta_lock, flags);
810 for (i = start; i < priv->hw_setting.max_stations; i++) 810 for (i = start; i < priv->hw_params.max_stations; i++)
811 if ((priv->stations[i].used) && 811 if ((priv->stations[i].used) &&
812 (!compare_ether_addr 812 (!compare_ether_addr
813 (priv->stations[i].sta.sta.addr, addr))) { 813 (priv->stations[i].sta.sta.addr, addr))) {
@@ -975,7 +975,7 @@ static int iwl3945_rx_init(struct iwl3945_priv *priv, struct iwl_rx_queue *rxq)
975 975
976 iwl3945_write_direct32(priv, FH39_RCSR_RBD_BASE(0), rxq->dma_addr); 976 iwl3945_write_direct32(priv, FH39_RCSR_RBD_BASE(0), rxq->dma_addr);
977 iwl3945_write_direct32(priv, FH39_RCSR_RPTR_ADDR(0), 977 iwl3945_write_direct32(priv, FH39_RCSR_RPTR_ADDR(0),
978 priv->hw_setting.shared_phys + 978 priv->shared_phys +
979 offsetof(struct iwl3945_shared, rx_read_ptr[0])); 979 offsetof(struct iwl3945_shared, rx_read_ptr[0]));
980 iwl3945_write_direct32(priv, FH39_RCSR_WPTR(0), 0); 980 iwl3945_write_direct32(priv, FH39_RCSR_WPTR(0), 0);
981 iwl3945_write_direct32(priv, FH39_RCSR_CONFIG(0), 981 iwl3945_write_direct32(priv, FH39_RCSR_CONFIG(0),
@@ -1024,7 +1024,7 @@ static int iwl3945_tx_reset(struct iwl3945_priv *priv)
1024 iwl3945_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005); 1024 iwl3945_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005);
1025 1025
1026 iwl3945_write_direct32(priv, FH39_TSSR_CBB_BASE, 1026 iwl3945_write_direct32(priv, FH39_TSSR_CBB_BASE,
1027 priv->hw_setting.shared_phys); 1027 priv->shared_phys);
1028 1028
1029 iwl3945_write_direct32(priv, FH39_TSSR_MSG_CONFIG, 1029 iwl3945_write_direct32(priv, FH39_TSSR_MSG_CONFIG,
1030 FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON | 1030 FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON |
@@ -2314,7 +2314,7 @@ int iwl3945_hw_tx_queue_init(struct iwl3945_priv *priv, struct iwl3945_tx_queue
2314 unsigned long flags; 2314 unsigned long flags;
2315 int txq_id = txq->q.id; 2315 int txq_id = txq->q.id;
2316 2316
2317 struct iwl3945_shared *shared_data = priv->hw_setting.shared_virt; 2317 struct iwl3945_shared *shared_data = priv->shared_virt;
2318 2318
2319 shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32)txq->q.dma_addr); 2319 shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32)txq->q.dma_addr);
2320 2320
@@ -2344,7 +2344,7 @@ int iwl3945_hw_tx_queue_init(struct iwl3945_priv *priv, struct iwl3945_tx_queue
2344 2344
2345int iwl3945_hw_get_rx_read(struct iwl3945_priv *priv) 2345int iwl3945_hw_get_rx_read(struct iwl3945_priv *priv)
2346{ 2346{
2347 struct iwl3945_shared *shared_data = priv->hw_setting.shared_virt; 2347 struct iwl3945_shared *shared_data = priv->shared_virt;
2348 2348
2349 return le32_to_cpu(shared_data->rx_read_ptr[0]); 2349 return le32_to_cpu(shared_data->rx_read_ptr[0]);
2350} 2350}
@@ -2429,31 +2429,30 @@ int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv)
2429} 2429}
2430 2430
2431/* Called when initializing driver */ 2431/* Called when initializing driver */
2432int iwl3945_hw_set_hw_setting(struct iwl3945_priv *priv) 2432int iwl3945_hw_set_hw_params(struct iwl3945_priv *priv)
2433{ 2433{
2434 memset((void *)&priv->hw_setting, 0, 2434 memset((void *)&priv->hw_params, 0,
2435 sizeof(struct iwl3945_driver_hw_info)); 2435 sizeof(struct iwl_hw_params));
2436 2436
2437 priv->hw_setting.shared_virt = 2437 priv->shared_virt =
2438 pci_alloc_consistent(priv->pci_dev, 2438 pci_alloc_consistent(priv->pci_dev,
2439 sizeof(struct iwl3945_shared), 2439 sizeof(struct iwl3945_shared),
2440 &priv->hw_setting.shared_phys); 2440 &priv->shared_phys);
2441 2441
2442 if (!priv->hw_setting.shared_virt) { 2442 if (!priv->shared_virt) {
2443 IWL_ERROR("failed to allocate pci memory\n"); 2443 IWL_ERROR("failed to allocate pci memory\n");
2444 mutex_unlock(&priv->mutex); 2444 mutex_unlock(&priv->mutex);
2445 return -ENOMEM; 2445 return -ENOMEM;
2446 } 2446 }
2447 2447
2448 priv->hw_setting.rx_buf_size = IWL_RX_BUF_SIZE; 2448 priv->hw_params.rx_buf_size = IWL_RX_BUF_SIZE;
2449 priv->hw_setting.max_pkt_size = 2342; 2449 priv->hw_params.max_pkt_size = 2342;
2450 priv->hw_setting.tx_cmd_len = sizeof(struct iwl3945_tx_cmd); 2450 priv->hw_params.max_rxq_size = RX_QUEUE_SIZE;
2451 priv->hw_setting.max_rxq_size = RX_QUEUE_SIZE; 2451 priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG;
2452 priv->hw_setting.max_rxq_log = RX_QUEUE_SIZE_LOG; 2452 priv->hw_params.max_stations = IWL3945_STATION_COUNT;
2453 priv->hw_setting.max_stations = IWL3945_STATION_COUNT; 2453 priv->hw_params.bcast_sta_id = IWL3945_BROADCAST_ID;
2454 priv->hw_setting.bcast_sta_id = IWL3945_BROADCAST_ID;
2455 2454
2456 priv->hw_setting.tx_ant_num = 2; 2455 priv->hw_params.tx_ant_num = 2;
2457 return 0; 2456 return 0;
2458} 2457}
2459 2458
@@ -2466,7 +2465,7 @@ unsigned int iwl3945_hw_get_beacon_cmd(struct iwl3945_priv *priv,
2466 tx_beacon_cmd = (struct iwl3945_tx_beacon_cmd *)&frame->u; 2465 tx_beacon_cmd = (struct iwl3945_tx_beacon_cmd *)&frame->u;
2467 memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); 2466 memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd));
2468 2467
2469 tx_beacon_cmd->tx.sta_id = priv->hw_setting.bcast_sta_id; 2468 tx_beacon_cmd->tx.sta_id = priv->hw_params.bcast_sta_id;
2470 tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 2469 tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
2471 2470
2472 frame_size = iwl3945_fill_beacon_frame(priv, 2471 frame_size = iwl3945_fill_beacon_frame(priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index c4d56ef0fa8f..cfceee18814d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -253,34 +253,6 @@ struct iwl3945_ibss_seq {
253 struct list_head list; 253 struct list_head list;
254}; 254};
255 255
256/**
257 * struct iwl3945_driver_hw_info
258 * @max_txq_num: Max # Tx queues supported
259 * @tx_cmd_len: Size of Tx command (but not including frame itself)
260 * @tx_ant_num: Number of TX antennas
261 * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2)
262 * @rx_buf_size:
263 * @max_pkt_size:
264 * @max_rxq_log: Log-base-2 of max_rxq_size
265 * @max_stations:
266 * @bcast_sta_id:
267 * @shared_virt: Pointer to driver/uCode shared Tx Byte Counts and Rx status
268 * @shared_phys: Physical Pointer to Tx Byte Counts and Rx status
269 */
270struct iwl3945_driver_hw_info {
271 u16 max_txq_num;
272 u16 tx_cmd_len;
273 u16 tx_ant_num;
274 u16 max_rxq_size;
275 u32 rx_buf_size;
276 u32 max_pkt_size;
277 u16 max_rxq_log;
278 u8 max_stations;
279 u8 bcast_sta_id;
280 void *shared_virt;
281 dma_addr_t shared_phys;
282};
283
284#define IWL_RX_HDR(x) ((struct iwl3945_rx_frame_hdr *)(\ 256#define IWL_RX_HDR(x) ((struct iwl3945_rx_frame_hdr *)(\
285 x->u.rx_frame.stats.payload + \ 257 x->u.rx_frame.stats.payload + \
286 x->u.rx_frame.stats.phy_count)) 258 x->u.rx_frame.stats.phy_count))
@@ -353,7 +325,7 @@ extern void iwl3945_hw_rx_handler_setup(struct iwl3945_priv *priv);
353extern void iwl3945_hw_setup_deferred_work(struct iwl3945_priv *priv); 325extern void iwl3945_hw_setup_deferred_work(struct iwl3945_priv *priv);
354extern void iwl3945_hw_cancel_deferred_work(struct iwl3945_priv *priv); 326extern void iwl3945_hw_cancel_deferred_work(struct iwl3945_priv *priv);
355extern int iwl3945_hw_rxq_stop(struct iwl3945_priv *priv); 327extern int iwl3945_hw_rxq_stop(struct iwl3945_priv *priv);
356extern int iwl3945_hw_set_hw_setting(struct iwl3945_priv *priv); 328extern int iwl3945_hw_set_hw_params(struct iwl3945_priv *priv);
357extern int iwl3945_hw_nic_init(struct iwl3945_priv *priv); 329extern int iwl3945_hw_nic_init(struct iwl3945_priv *priv);
358extern int iwl3945_hw_nic_stop_master(struct iwl3945_priv *priv); 330extern int iwl3945_hw_nic_stop_master(struct iwl3945_priv *priv);
359extern void iwl3945_hw_txq_ctx_free(struct iwl3945_priv *priv); 331extern void iwl3945_hw_txq_ctx_free(struct iwl3945_priv *priv);
@@ -583,7 +555,9 @@ struct iwl3945_priv {
583 /* Last Rx'd beacon timestamp */ 555 /* Last Rx'd beacon timestamp */
584 u64 timestamp; 556 u64 timestamp;
585 u16 beacon_int; 557 u16 beacon_int;
586 struct iwl3945_driver_hw_info hw_setting; 558 void *shared_virt;
559 dma_addr_t shared_phys;
560 struct iwl_hw_params hw_params;
587 struct ieee80211_vif *vif; 561 struct ieee80211_vif *vif;
588 562
589 /* Current association information needed to configure the 563 /* Current association information needed to configure the
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 245f1d2fa327..9904406ae368 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -611,6 +611,9 @@ struct iwl_hw_params {
611 u32 ct_kill_threshold; /* value in hw-dependent units */ 611 u32 ct_kill_threshold; /* value in hw-dependent units */
612 u32 calib_init_cfg; 612 u32 calib_init_cfg;
613 const struct iwl_sensitivity_ranges *sens; 613 const struct iwl_sensitivity_ranges *sens;
614
615 /* for 3945 */
616 u16 tx_ant_num;
614}; 617};
615 618
616 619
@@ -1010,6 +1013,10 @@ struct iwl_priv {
1010 u16 beacon_int; 1013 u16 beacon_int;
1011 struct ieee80211_vif *vif; 1014 struct ieee80211_vif *vif;
1012 1015
1016 /*Added for 3945 */
1017 void *shared_virt;
1018 dma_addr_t shared_phys;
1019 /*End*/
1013 struct iwl_hw_params hw_params; 1020 struct iwl_hw_params hw_params;
1014 1021
1015 1022
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index da5309e69bdd..b42bb8433a57 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -326,9 +326,9 @@ static u8 iwl3945_remove_station(struct iwl3945_priv *priv, const u8 *addr, int
326 if (is_ap) 326 if (is_ap)
327 index = IWL_AP_ID; 327 index = IWL_AP_ID;
328 else if (is_broadcast_ether_addr(addr)) 328 else if (is_broadcast_ether_addr(addr))
329 index = priv->hw_setting.bcast_sta_id; 329 index = priv->hw_params.bcast_sta_id;
330 else 330 else
331 for (i = IWL_STA_ID; i < priv->hw_setting.max_stations; i++) 331 for (i = IWL_STA_ID; i < priv->hw_params.max_stations; i++)
332 if (priv->stations[i].used && 332 if (priv->stations[i].used &&
333 !compare_ether_addr(priv->stations[i].sta.sta.addr, 333 !compare_ether_addr(priv->stations[i].sta.sta.addr,
334 addr)) { 334 addr)) {
@@ -384,9 +384,9 @@ u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap, u8
384 if (is_ap) 384 if (is_ap)
385 index = IWL_AP_ID; 385 index = IWL_AP_ID;
386 else if (is_broadcast_ether_addr(addr)) 386 else if (is_broadcast_ether_addr(addr))
387 index = priv->hw_setting.bcast_sta_id; 387 index = priv->hw_params.bcast_sta_id;
388 else 388 else
389 for (i = IWL_STA_ID; i < priv->hw_setting.max_stations; i++) { 389 for (i = IWL_STA_ID; i < priv->hw_params.max_stations; i++) {
390 if (!compare_ether_addr(priv->stations[i].sta.sta.addr, 390 if (!compare_ether_addr(priv->stations[i].sta.sta.addr,
391 addr)) { 391 addr)) {
392 index = i; 392 index = i;
@@ -1470,13 +1470,13 @@ int iwl3945_eeprom_init(struct iwl3945_priv *priv)
1470 return 0; 1470 return 0;
1471} 1471}
1472 1472
1473static void iwl3945_unset_hw_setting(struct iwl3945_priv *priv) 1473static void iwl3945_unset_hw_params(struct iwl3945_priv *priv)
1474{ 1474{
1475 if (priv->hw_setting.shared_virt) 1475 if (priv->shared_virt)
1476 pci_free_consistent(priv->pci_dev, 1476 pci_free_consistent(priv->pci_dev,
1477 sizeof(struct iwl3945_shared), 1477 sizeof(struct iwl3945_shared),
1478 priv->hw_setting.shared_virt, 1478 priv->shared_virt,
1479 priv->hw_setting.shared_phys); 1479 priv->shared_phys);
1480} 1480}
1481 1481
1482/** 1482/**
@@ -2322,7 +2322,7 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h
2322 /* If this frame is broadcast or management, use broadcast station id */ 2322 /* If this frame is broadcast or management, use broadcast station id */
2323 if (((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) || 2323 if (((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) ||
2324 is_multicast_ether_addr(hdr->addr1)) 2324 is_multicast_ether_addr(hdr->addr1))
2325 return priv->hw_setting.bcast_sta_id; 2325 return priv->hw_params.bcast_sta_id;
2326 2326
2327 switch (priv->iw_mode) { 2327 switch (priv->iw_mode) {
2328 2328
@@ -2336,7 +2336,7 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h
2336 sta_id = iwl3945_hw_find_station(priv, hdr->addr1); 2336 sta_id = iwl3945_hw_find_station(priv, hdr->addr1);
2337 if (sta_id != IWL_INVALID_STATION) 2337 if (sta_id != IWL_INVALID_STATION)
2338 return sta_id; 2338 return sta_id;
2339 return priv->hw_setting.bcast_sta_id; 2339 return priv->hw_params.bcast_sta_id;
2340 2340
2341 /* If this frame is going out to an IBSS network, find the station, 2341 /* If this frame is going out to an IBSS network, find the station,
2342 * or create a new station table entry */ 2342 * or create a new station table entry */
@@ -2355,16 +2355,16 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h
2355 "Defaulting to broadcast...\n", 2355 "Defaulting to broadcast...\n",
2356 hdr->addr1); 2356 hdr->addr1);
2357 iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); 2357 iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr));
2358 return priv->hw_setting.bcast_sta_id; 2358 return priv->hw_params.bcast_sta_id;
2359 } 2359 }
2360 /* If we are in monitor mode, use BCAST. This is required for 2360 /* If we are in monitor mode, use BCAST. This is required for
2361 * packet injection. */ 2361 * packet injection. */
2362 case NL80211_IFTYPE_MONITOR: 2362 case NL80211_IFTYPE_MONITOR:
2363 return priv->hw_setting.bcast_sta_id; 2363 return priv->hw_params.bcast_sta_id;
2364 2364
2365 default: 2365 default:
2366 IWL_WARNING("Unknown mode of operation: %d\n", priv->iw_mode); 2366 IWL_WARNING("Unknown mode of operation: %d\n", priv->iw_mode);
2367 return priv->hw_setting.bcast_sta_id; 2367 return priv->hw_params.bcast_sta_id;
2368 } 2368 }
2369} 2369}
2370 2370
@@ -2497,7 +2497,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
2497 * of the MAC header (device reads on dword boundaries). 2497 * of the MAC header (device reads on dword boundaries).
2498 * We'll tell device about this padding later. 2498 * We'll tell device about this padding later.
2499 */ 2499 */
2500 len = priv->hw_setting.tx_cmd_len + 2500 len = sizeof(struct iwl3945_tx_cmd) +
2501 sizeof(struct iwl_cmd_header) + hdr_len; 2501 sizeof(struct iwl_cmd_header) + hdr_len;
2502 2502
2503 len_org = len; 2503 len_org = len;
@@ -6094,7 +6094,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
6094 iwl3945_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, 6094 iwl3945_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data,
6095 IWL_MAX_SCAN_SIZE - sizeof(*scan))); 6095 IWL_MAX_SCAN_SIZE - sizeof(*scan)));
6096 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; 6096 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK;
6097 scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id; 6097 scan->tx_cmd.sta_id = priv->hw_params.bcast_sta_id;
6098 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 6098 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
6099 6099
6100 /* flags + rate selection */ 6100 /* flags + rate selection */
@@ -7848,7 +7848,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
7848 * 5. Setup HW Constants 7848 * 5. Setup HW Constants
7849 * ********************/ 7849 * ********************/
7850 /* Device-specific setup */ 7850 /* Device-specific setup */
7851 if (iwl3945_hw_set_hw_setting(priv)) { 7851 if (iwl3945_hw_set_hw_params(priv)) {
7852 IWL_ERROR("failed to set hw settings\n"); 7852 IWL_ERROR("failed to set hw settings\n");
7853 goto out_iounmap; 7853 goto out_iounmap;
7854 } 7854 }
@@ -7971,7 +7971,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
7971 out_release_irq: 7971 out_release_irq:
7972 destroy_workqueue(priv->workqueue); 7972 destroy_workqueue(priv->workqueue);
7973 priv->workqueue = NULL; 7973 priv->workqueue = NULL;
7974 iwl3945_unset_hw_setting(priv); 7974 iwl3945_unset_hw_params(priv);
7975 7975
7976 out_iounmap: 7976 out_iounmap:
7977 pci_iounmap(pdev, priv->hw_base); 7977 pci_iounmap(pdev, priv->hw_base);
@@ -8018,7 +8018,7 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
8018 iwl3945_rx_queue_free(priv, &priv->rxq); 8018 iwl3945_rx_queue_free(priv, &priv->rxq);
8019 iwl3945_hw_txq_ctx_free(priv); 8019 iwl3945_hw_txq_ctx_free(priv);
8020 8020
8021 iwl3945_unset_hw_setting(priv); 8021 iwl3945_unset_hw_params(priv);
8022 iwl3945_clear_stations_table(priv); 8022 iwl3945_clear_stations_table(priv);
8023 8023
8024 if (priv->mac80211_registered) 8024 if (priv->mac80211_registered)