Commit 3832ec9d authored by Abhijeet Kolekar's avatar Abhijeet Kolekar Committed by John W. Linville

iwl3945: use iwl_hw_params in iwl3945_priv

The patch makes changed necessary to use iwl_hw_params to
replace iwl3945_driver_hw_info.
Signed-off-by: default avatarAbhijeet Kolekar <abhijeet.kolekar@intel.com>
Signed-off-by: default avatarZhu Yi <yi.zhu@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent cc2f362c
...@@ -804,10 +804,10 @@ u8 iwl3945_hw_find_station(struct iwl3945_priv *priv, const u8 *addr) ...@@ -804,10 +804,10 @@ u8 iwl3945_hw_find_station(struct iwl3945_priv *priv, const u8 *addr)
start = IWL_STA_ID; start = IWL_STA_ID;
if (is_broadcast_ether_addr(addr)) if (is_broadcast_ether_addr(addr))
return priv->hw_setting.bcast_sta_id; return priv->hw_params.bcast_sta_id;
spin_lock_irqsave(&priv->sta_lock, flags); spin_lock_irqsave(&priv->sta_lock, flags);
for (i = start; i < priv->hw_setting.max_stations; i++) for (i = start; i < priv->hw_params.max_stations; i++)
if ((priv->stations[i].used) && if ((priv->stations[i].used) &&
(!compare_ether_addr (!compare_ether_addr
(priv->stations[i].sta.sta.addr, addr))) { (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,7 +975,7 @@ static int iwl3945_rx_init(struct iwl3945_priv *priv, struct iwl_rx_queue *rxq)
iwl3945_write_direct32(priv, FH39_RCSR_RBD_BASE(0), rxq->dma_addr); iwl3945_write_direct32(priv, FH39_RCSR_RBD_BASE(0), rxq->dma_addr);
iwl3945_write_direct32(priv, FH39_RCSR_RPTR_ADDR(0), iwl3945_write_direct32(priv, FH39_RCSR_RPTR_ADDR(0),
priv->hw_setting.shared_phys + priv->shared_phys +
offsetof(struct iwl3945_shared, rx_read_ptr[0])); offsetof(struct iwl3945_shared, rx_read_ptr[0]));
iwl3945_write_direct32(priv, FH39_RCSR_WPTR(0), 0); iwl3945_write_direct32(priv, FH39_RCSR_WPTR(0), 0);
iwl3945_write_direct32(priv, FH39_RCSR_CONFIG(0), iwl3945_write_direct32(priv, FH39_RCSR_CONFIG(0),
...@@ -1024,7 +1024,7 @@ static int iwl3945_tx_reset(struct iwl3945_priv *priv) ...@@ -1024,7 +1024,7 @@ static int iwl3945_tx_reset(struct iwl3945_priv *priv)
iwl3945_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005); iwl3945_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005);
iwl3945_write_direct32(priv, FH39_TSSR_CBB_BASE, iwl3945_write_direct32(priv, FH39_TSSR_CBB_BASE,
priv->hw_setting.shared_phys); priv->shared_phys);
iwl3945_write_direct32(priv, FH39_TSSR_MSG_CONFIG, iwl3945_write_direct32(priv, FH39_TSSR_MSG_CONFIG,
FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON | 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,7 +2314,7 @@ int iwl3945_hw_tx_queue_init(struct iwl3945_priv *priv, struct iwl3945_tx_queue
unsigned long flags; unsigned long flags;
int txq_id = txq->q.id; int txq_id = txq->q.id;
struct iwl3945_shared *shared_data = priv->hw_setting.shared_virt; struct iwl3945_shared *shared_data = priv->shared_virt;
shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32)txq->q.dma_addr); shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32)txq->q.dma_addr);
...@@ -2344,7 +2344,7 @@ int iwl3945_hw_tx_queue_init(struct iwl3945_priv *priv, struct iwl3945_tx_queue ...@@ -2344,7 +2344,7 @@ int iwl3945_hw_tx_queue_init(struct iwl3945_priv *priv, struct iwl3945_tx_queue
int iwl3945_hw_get_rx_read(struct iwl3945_priv *priv) int iwl3945_hw_get_rx_read(struct iwl3945_priv *priv)
{ {
struct iwl3945_shared *shared_data = priv->hw_setting.shared_virt; struct iwl3945_shared *shared_data = priv->shared_virt;
return le32_to_cpu(shared_data->rx_read_ptr[0]); return le32_to_cpu(shared_data->rx_read_ptr[0]);
} }
...@@ -2429,31 +2429,30 @@ int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv) ...@@ -2429,31 +2429,30 @@ int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv)
} }
/* Called when initializing driver */ /* Called when initializing driver */
int iwl3945_hw_set_hw_setting(struct iwl3945_priv *priv) int iwl3945_hw_set_hw_params(struct iwl3945_priv *priv)
{ {
memset((void *)&priv->hw_setting, 0, memset((void *)&priv->hw_params, 0,
sizeof(struct iwl3945_driver_hw_info)); sizeof(struct iwl_hw_params));
priv->hw_setting.shared_virt = priv->shared_virt =
pci_alloc_consistent(priv->pci_dev, pci_alloc_consistent(priv->pci_dev,
sizeof(struct iwl3945_shared), sizeof(struct iwl3945_shared),
&priv->hw_setting.shared_phys); &priv->shared_phys);
if (!priv->hw_setting.shared_virt) { if (!priv->shared_virt) {
IWL_ERROR("failed to allocate pci memory\n"); IWL_ERROR("failed to allocate pci memory\n");
mutex_unlock(&priv->mutex); mutex_unlock(&priv->mutex);
return -ENOMEM; return -ENOMEM;
} }
priv->hw_setting.rx_buf_size = IWL_RX_BUF_SIZE; priv->hw_params.rx_buf_size = IWL_RX_BUF_SIZE;
priv->hw_setting.max_pkt_size = 2342; priv->hw_params.max_pkt_size = 2342;
priv->hw_setting.tx_cmd_len = sizeof(struct iwl3945_tx_cmd); priv->hw_params.max_rxq_size = RX_QUEUE_SIZE;
priv->hw_setting.max_rxq_size = RX_QUEUE_SIZE; priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG;
priv->hw_setting.max_rxq_log = RX_QUEUE_SIZE_LOG; priv->hw_params.max_stations = IWL3945_STATION_COUNT;
priv->hw_setting.max_stations = IWL3945_STATION_COUNT; priv->hw_params.bcast_sta_id = IWL3945_BROADCAST_ID;
priv->hw_setting.bcast_sta_id = IWL3945_BROADCAST_ID;
priv->hw_setting.tx_ant_num = 2; priv->hw_params.tx_ant_num = 2;
return 0; return 0;
} }
...@@ -2466,7 +2465,7 @@ unsigned int iwl3945_hw_get_beacon_cmd(struct iwl3945_priv *priv, ...@@ -2466,7 +2465,7 @@ unsigned int iwl3945_hw_get_beacon_cmd(struct iwl3945_priv *priv,
tx_beacon_cmd = (struct iwl3945_tx_beacon_cmd *)&frame->u; tx_beacon_cmd = (struct iwl3945_tx_beacon_cmd *)&frame->u;
memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd));
tx_beacon_cmd->tx.sta_id = priv->hw_setting.bcast_sta_id; tx_beacon_cmd->tx.sta_id = priv->hw_params.bcast_sta_id;
tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
frame_size = iwl3945_fill_beacon_frame(priv, frame_size = iwl3945_fill_beacon_frame(priv,
......
...@@ -253,34 +253,6 @@ struct iwl3945_ibss_seq { ...@@ -253,34 +253,6 @@ struct iwl3945_ibss_seq {
struct list_head list; struct list_head list;
}; };
/**
* struct iwl3945_driver_hw_info
* @max_txq_num: Max # Tx queues supported
* @tx_cmd_len: Size of Tx command (but not including frame itself)
* @tx_ant_num: Number of TX antennas
* @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2)
* @rx_buf_size:
* @max_pkt_size:
* @max_rxq_log: Log-base-2 of max_rxq_size
* @max_stations:
* @bcast_sta_id:
* @shared_virt: Pointer to driver/uCode shared Tx Byte Counts and Rx status
* @shared_phys: Physical Pointer to Tx Byte Counts and Rx status
*/
struct iwl3945_driver_hw_info {
u16 max_txq_num;
u16 tx_cmd_len;
u16 tx_ant_num;
u16 max_rxq_size;
u32 rx_buf_size;
u32 max_pkt_size;
u16 max_rxq_log;
u8 max_stations;
u8 bcast_sta_id;
void *shared_virt;
dma_addr_t shared_phys;
};
#define IWL_RX_HDR(x) ((struct iwl3945_rx_frame_hdr *)(\ #define IWL_RX_HDR(x) ((struct iwl3945_rx_frame_hdr *)(\
x->u.rx_frame.stats.payload + \ x->u.rx_frame.stats.payload + \
x->u.rx_frame.stats.phy_count)) x->u.rx_frame.stats.phy_count))
...@@ -353,7 +325,7 @@ extern void iwl3945_hw_rx_handler_setup(struct iwl3945_priv *priv); ...@@ -353,7 +325,7 @@ extern void iwl3945_hw_rx_handler_setup(struct iwl3945_priv *priv);
extern void iwl3945_hw_setup_deferred_work(struct iwl3945_priv *priv); extern void iwl3945_hw_setup_deferred_work(struct iwl3945_priv *priv);
extern void iwl3945_hw_cancel_deferred_work(struct iwl3945_priv *priv); extern void iwl3945_hw_cancel_deferred_work(struct iwl3945_priv *priv);
extern int iwl3945_hw_rxq_stop(struct iwl3945_priv *priv); extern int iwl3945_hw_rxq_stop(struct iwl3945_priv *priv);
extern int iwl3945_hw_set_hw_setting(struct iwl3945_priv *priv); extern int iwl3945_hw_set_hw_params(struct iwl3945_priv *priv);
extern int iwl3945_hw_nic_init(struct iwl3945_priv *priv); extern int iwl3945_hw_nic_init(struct iwl3945_priv *priv);
extern int iwl3945_hw_nic_stop_master(struct iwl3945_priv *priv); extern int iwl3945_hw_nic_stop_master(struct iwl3945_priv *priv);
extern void iwl3945_hw_txq_ctx_free(struct iwl3945_priv *priv); extern void iwl3945_hw_txq_ctx_free(struct iwl3945_priv *priv);
...@@ -583,7 +555,9 @@ struct iwl3945_priv { ...@@ -583,7 +555,9 @@ struct iwl3945_priv {
/* Last Rx'd beacon timestamp */ /* Last Rx'd beacon timestamp */
u64 timestamp; u64 timestamp;
u16 beacon_int; u16 beacon_int;
struct iwl3945_driver_hw_info hw_setting; void *shared_virt;
dma_addr_t shared_phys;
struct iwl_hw_params hw_params;
struct ieee80211_vif *vif; struct ieee80211_vif *vif;
/* Current association information needed to configure the /* Current association information needed to configure the
......
...@@ -611,6 +611,9 @@ struct iwl_hw_params { ...@@ -611,6 +611,9 @@ struct iwl_hw_params {
u32 ct_kill_threshold; /* value in hw-dependent units */ u32 ct_kill_threshold; /* value in hw-dependent units */
u32 calib_init_cfg; u32 calib_init_cfg;
const struct iwl_sensitivity_ranges *sens; const struct iwl_sensitivity_ranges *sens;
/* for 3945 */
u16 tx_ant_num;
}; };
...@@ -1010,6 +1013,10 @@ struct iwl_priv { ...@@ -1010,6 +1013,10 @@ struct iwl_priv {
u16 beacon_int; u16 beacon_int;
struct ieee80211_vif *vif; struct ieee80211_vif *vif;
/*Added for 3945 */
void *shared_virt;
dma_addr_t shared_phys;
/*End*/
struct iwl_hw_params hw_params; struct iwl_hw_params hw_params;
......
...@@ -326,9 +326,9 @@ static u8 iwl3945_remove_station(struct iwl3945_priv *priv, const u8 *addr, int ...@@ -326,9 +326,9 @@ static u8 iwl3945_remove_station(struct iwl3945_priv *priv, const u8 *addr, int
if (is_ap) if (is_ap)
index = IWL_AP_ID; index = IWL_AP_ID;
else if (is_broadcast_ether_addr(addr)) else if (is_broadcast_ether_addr(addr))
index = priv->hw_setting.bcast_sta_id; index = priv->hw_params.bcast_sta_id;
else else
for (i = IWL_STA_ID; i < priv->hw_setting.max_stations; i++) for (i = IWL_STA_ID; i < priv->hw_params.max_stations; i++)
if (priv->stations[i].used && if (priv->stations[i].used &&
!compare_ether_addr(priv->stations[i].sta.sta.addr, !compare_ether_addr(priv->stations[i].sta.sta.addr,
addr)) { addr)) {
...@@ -384,9 +384,9 @@ u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap, u8 ...@@ -384,9 +384,9 @@ u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap, u8
if (is_ap) if (is_ap)
index = IWL_AP_ID; index = IWL_AP_ID;
else if (is_broadcast_ether_addr(addr)) else if (is_broadcast_ether_addr(addr))
index = priv->hw_setting.bcast_sta_id; index = priv->hw_params.bcast_sta_id;
else else
for (i = IWL_STA_ID; i < priv->hw_setting.max_stations; i++) { for (i = IWL_STA_ID; i < priv->hw_params.max_stations; i++) {
if (!compare_ether_addr(priv->stations[i].sta.sta.addr, if (!compare_ether_addr(priv->stations[i].sta.sta.addr,
addr)) { addr)) {
index = i; index = i;
...@@ -1470,13 +1470,13 @@ int iwl3945_eeprom_init(struct iwl3945_priv *priv) ...@@ -1470,13 +1470,13 @@ int iwl3945_eeprom_init(struct iwl3945_priv *priv)
return 0; return 0;
} }
static void iwl3945_unset_hw_setting(struct iwl3945_priv *priv) static void iwl3945_unset_hw_params(struct iwl3945_priv *priv)
{ {
if (priv->hw_setting.shared_virt) if (priv->shared_virt)
pci_free_consistent(priv->pci_dev, pci_free_consistent(priv->pci_dev,
sizeof(struct iwl3945_shared), sizeof(struct iwl3945_shared),
priv->hw_setting.shared_virt, priv->shared_virt,
priv->hw_setting.shared_phys); priv->shared_phys);
} }
/** /**
...@@ -2322,7 +2322,7 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h ...@@ -2322,7 +2322,7 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h
/* If this frame is broadcast or management, use broadcast station id */ /* If this frame is broadcast or management, use broadcast station id */
if (((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) || if (((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) ||
is_multicast_ether_addr(hdr->addr1)) is_multicast_ether_addr(hdr->addr1))
return priv->hw_setting.bcast_sta_id; return priv->hw_params.bcast_sta_id;
switch (priv->iw_mode) { switch (priv->iw_mode) {
...@@ -2336,7 +2336,7 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h ...@@ -2336,7 +2336,7 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h
sta_id = iwl3945_hw_find_station(priv, hdr->addr1); sta_id = iwl3945_hw_find_station(priv, hdr->addr1);
if (sta_id != IWL_INVALID_STATION) if (sta_id != IWL_INVALID_STATION)
return sta_id; return sta_id;
return priv->hw_setting.bcast_sta_id; return priv->hw_params.bcast_sta_id;
/* If this frame is going out to an IBSS network, find the station, /* If this frame is going out to an IBSS network, find the station,
* or create a new station table entry */ * 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,16 +2355,16 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h
"Defaulting to broadcast...\n", "Defaulting to broadcast...\n",
hdr->addr1); hdr->addr1);
iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr));
return priv->hw_setting.bcast_sta_id; return priv->hw_params.bcast_sta_id;
} }
/* If we are in monitor mode, use BCAST. This is required for /* If we are in monitor mode, use BCAST. This is required for
* packet injection. */ * packet injection. */
case NL80211_IFTYPE_MONITOR: case NL80211_IFTYPE_MONITOR:
return priv->hw_setting.bcast_sta_id; return priv->hw_params.bcast_sta_id;
default: default:
IWL_WARNING("Unknown mode of operation: %d\n", priv->iw_mode); IWL_WARNING("Unknown mode of operation: %d\n", priv->iw_mode);
return priv->hw_setting.bcast_sta_id; return priv->hw_params.bcast_sta_id;
} }
} }
...@@ -2497,7 +2497,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb) ...@@ -2497,7 +2497,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
* of the MAC header (device reads on dword boundaries). * of the MAC header (device reads on dword boundaries).
* We'll tell device about this padding later. * We'll tell device about this padding later.
*/ */
len = priv->hw_setting.tx_cmd_len + len = sizeof(struct iwl3945_tx_cmd) +
sizeof(struct iwl_cmd_header) + hdr_len; sizeof(struct iwl_cmd_header) + hdr_len;
len_org = len; len_org = len;
...@@ -6094,7 +6094,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data) ...@@ -6094,7 +6094,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
iwl3945_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, iwl3945_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data,
IWL_MAX_SCAN_SIZE - sizeof(*scan))); IWL_MAX_SCAN_SIZE - sizeof(*scan)));
scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK;
scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id; scan->tx_cmd.sta_id = priv->hw_params.bcast_sta_id;
scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
/* flags + rate selection */ /* flags + rate selection */
...@@ -7848,7 +7848,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e ...@@ -7848,7 +7848,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
* 5. Setup HW Constants * 5. Setup HW Constants
* ********************/ * ********************/
/* Device-specific setup */ /* Device-specific setup */
if (iwl3945_hw_set_hw_setting(priv)) { if (iwl3945_hw_set_hw_params(priv)) {
IWL_ERROR("failed to set hw settings\n"); IWL_ERROR("failed to set hw settings\n");
goto out_iounmap; goto out_iounmap;
} }
...@@ -7971,7 +7971,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e ...@@ -7971,7 +7971,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
out_release_irq: out_release_irq:
destroy_workqueue(priv->workqueue); destroy_workqueue(priv->workqueue);
priv->workqueue = NULL; priv->workqueue = NULL;
iwl3945_unset_hw_setting(priv); iwl3945_unset_hw_params(priv);
out_iounmap: out_iounmap:
pci_iounmap(pdev, priv->hw_base); pci_iounmap(pdev, priv->hw_base);
...@@ -8018,7 +8018,7 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev) ...@@ -8018,7 +8018,7 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
iwl3945_rx_queue_free(priv, &priv->rxq); iwl3945_rx_queue_free(priv, &priv->rxq);
iwl3945_hw_txq_ctx_free(priv); iwl3945_hw_txq_ctx_free(priv);
iwl3945_unset_hw_setting(priv); iwl3945_unset_hw_params(priv);
iwl3945_clear_stations_table(priv); iwl3945_clear_stations_table(priv);
if (priv->mac80211_registered) if (priv->mac80211_registered)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment