aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-4965.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-03-21 16:53:44 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-03-25 16:41:55 -0400
commit857485c0c46ceee5c658c1761bba4d9a5ddf433f (patch)
treedf2028c6a3d99ad32491efba7b6ca69f7d45edcf /drivers/net/wireless/iwlwifi/iwl-4965.c
parent8622e7058a8764223ae2305d980a38d07f034717 (diff)
iwlwifi: move host command sending functions to core module
1. Host command sending functions moved from iwl4965-base.c to iwl-hcmd.c in iwlcore module 2. enqueue_hcmd function currently stays in iwl4965-base.c. It is invoked through the new 'utils' field in priv's ops. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Assaf Krauss <assaf.krauss@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-4965.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c86
1 files changed, 45 insertions, 41 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index c0c35d38cf5e..46b3f47edefd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -861,7 +861,7 @@ void iwl4965_rf_kill_ct_config(struct iwl_priv *priv)
861 u32 temp_th; 861 u32 temp_th;
862 u32 crit_temperature; 862 u32 crit_temperature;
863 unsigned long flags; 863 unsigned long flags;
864 int rc = 0; 864 int ret = 0;
865 865
866 spin_lock_irqsave(&priv->lock, flags); 866 spin_lock_irqsave(&priv->lock, flags);
867 iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, 867 iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR,
@@ -882,9 +882,9 @@ void iwl4965_rf_kill_ct_config(struct iwl_priv *priv)
882 882
883 crit_temperature = ((temp_th * (R3-R1))/CT_LIMIT_CONST) + R2; 883 crit_temperature = ((temp_th * (R3-R1))/CT_LIMIT_CONST) + R2;
884 cmd.critical_temperature_R = cpu_to_le32(crit_temperature); 884 cmd.critical_temperature_R = cpu_to_le32(crit_temperature);
885 rc = iwl4965_send_cmd_pdu(priv, 885 ret = iwl_send_cmd_pdu(priv, REPLY_CT_KILL_CONFIG_CMD,
886 REPLY_CT_KILL_CONFIG_CMD, sizeof(cmd), &cmd); 886 sizeof(cmd), &cmd);
887 if (rc) 887 if (ret)
888 IWL_ERROR("REPLY_CT_KILL_CONFIG_CMD failed\n"); 888 IWL_ERROR("REPLY_CT_KILL_CONFIG_CMD failed\n");
889 else 889 else
890 IWL_DEBUG_INFO("REPLY_CT_KILL_CONFIG_CMD succeeded\n"); 890 IWL_DEBUG_INFO("REPLY_CT_KILL_CONFIG_CMD succeeded\n");
@@ -1157,7 +1157,7 @@ static int iwl4965_sens_auto_corr_ofdm(struct iwl_priv *priv,
1157} 1157}
1158 1158
1159static int iwl4965_sensitivity_callback(struct iwl_priv *priv, 1159static int iwl4965_sensitivity_callback(struct iwl_priv *priv,
1160 struct iwl4965_cmd *cmd, struct sk_buff *skb) 1160 struct iwl_cmd *cmd, struct sk_buff *skb)
1161{ 1161{
1162 /* We didn't cache the SKB; let the caller free it */ 1162 /* We didn't cache the SKB; let the caller free it */
1163 return 1; 1163 return 1;
@@ -1166,15 +1166,15 @@ static int iwl4965_sensitivity_callback(struct iwl_priv *priv,
1166/* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */ 1166/* Prepare a SENSITIVITY_CMD, send to uCode if values have changed */
1167static int iwl4965_sensitivity_write(struct iwl_priv *priv, u8 flags) 1167static int iwl4965_sensitivity_write(struct iwl_priv *priv, u8 flags)
1168{ 1168{
1169 int rc = 0;
1170 struct iwl4965_sensitivity_cmd cmd ; 1169 struct iwl4965_sensitivity_cmd cmd ;
1171 struct iwl4965_sensitivity_data *data = NULL; 1170 struct iwl4965_sensitivity_data *data = NULL;
1172 struct iwl4965_host_cmd cmd_out = { 1171 struct iwl_host_cmd cmd_out = {
1173 .id = SENSITIVITY_CMD, 1172 .id = SENSITIVITY_CMD,
1174 .len = sizeof(struct iwl4965_sensitivity_cmd), 1173 .len = sizeof(struct iwl4965_sensitivity_cmd),
1175 .meta.flags = flags, 1174 .meta.flags = flags,
1176 .data = &cmd, 1175 .data = &cmd,
1177 }; 1176 };
1177 int ret;
1178 1178
1179 data = &(priv->sensitivity_data); 1179 data = &(priv->sensitivity_data);
1180 1180
@@ -1232,20 +1232,18 @@ static int iwl4965_sensitivity_write(struct iwl_priv *priv, u8 flags)
1232 memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]), 1232 memcpy(&(priv->sensitivity_tbl[0]), &(cmd.table[0]),
1233 sizeof(u16)*HD_TABLE_SIZE); 1233 sizeof(u16)*HD_TABLE_SIZE);
1234 1234
1235 rc = iwl4965_send_cmd(priv, &cmd_out); 1235 ret = iwl_send_cmd(priv, &cmd_out);
1236 if (!rc) { 1236 if (ret)
1237 IWL_DEBUG_CALIB("SENSITIVITY_CMD succeeded\n"); 1237 IWL_ERROR("SENSITIVITY_CMD failed\n");
1238 return rc;
1239 }
1240 1238
1241 return 0; 1239 return ret;
1242} 1240}
1243 1241
1244void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, u8 force) 1242void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, u8 force)
1245{ 1243{
1246 int rc = 0;
1247 int i;
1248 struct iwl4965_sensitivity_data *data = NULL; 1244 struct iwl4965_sensitivity_data *data = NULL;
1245 int i;
1246 int ret = 0;
1249 1247
1250 IWL_DEBUG_CALIB("Start iwl4965_init_sensitivity\n"); 1248 IWL_DEBUG_CALIB("Start iwl4965_init_sensitivity\n");
1251 1249
@@ -1289,8 +1287,8 @@ void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, u8 force)
1289 memset(&(priv->sensitivity_tbl[0]), 0, 1287 memset(&(priv->sensitivity_tbl[0]), 0,
1290 sizeof(u16)*HD_TABLE_SIZE); 1288 sizeof(u16)*HD_TABLE_SIZE);
1291 1289
1292 rc |= iwl4965_sensitivity_write(priv, flags); 1290 ret |= iwl4965_sensitivity_write(priv, flags);
1293 IWL_DEBUG_CALIB("<<return 0x%X\n", rc); 1291 IWL_DEBUG_CALIB("<<return 0x%X\n", ret);
1294 1292
1295 return; 1293 return;
1296} 1294}
@@ -1302,7 +1300,6 @@ void iwl4965_init_sensitivity(struct iwl_priv *priv, u8 flags, u8 force)
1302void iwl4965_chain_noise_reset(struct iwl_priv *priv) 1300void iwl4965_chain_noise_reset(struct iwl_priv *priv)
1303{ 1301{
1304 struct iwl4965_chain_noise_data *data = NULL; 1302 struct iwl4965_chain_noise_data *data = NULL;
1305 int rc = 0;
1306 1303
1307 data = &(priv->chain_noise_data); 1304 data = &(priv->chain_noise_data);
1308 if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl4965_is_associated(priv)) { 1305 if ((data->state == IWL_CHAIN_NOISE_ALIVE) && iwl4965_is_associated(priv)) {
@@ -1313,7 +1310,7 @@ void iwl4965_chain_noise_reset(struct iwl_priv *priv)
1313 cmd.diff_gain_a = 0; 1310 cmd.diff_gain_a = 0;
1314 cmd.diff_gain_b = 0; 1311 cmd.diff_gain_b = 0;
1315 cmd.diff_gain_c = 0; 1312 cmd.diff_gain_c = 0;
1316 rc = iwl4965_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, 1313 iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
1317 sizeof(cmd), &cmd); 1314 sizeof(cmd), &cmd);
1318 msleep(4); 1315 msleep(4);
1319 data->state = IWL_CHAIN_NOISE_ACCUMULATE; 1316 data->state = IWL_CHAIN_NOISE_ACCUMULATE;
@@ -1332,7 +1329,7 @@ static void iwl4965_noise_calibration(struct iwl_priv *priv,
1332 struct iwl4965_notif_statistics *stat_resp) 1329 struct iwl4965_notif_statistics *stat_resp)
1333{ 1330{
1334 struct iwl4965_chain_noise_data *data = NULL; 1331 struct iwl4965_chain_noise_data *data = NULL;
1335 int rc = 0; 1332 int ret = 0;
1336 1333
1337 u32 chain_noise_a; 1334 u32 chain_noise_a;
1338 u32 chain_noise_b; 1335 u32 chain_noise_b;
@@ -1538,9 +1535,9 @@ static void iwl4965_noise_calibration(struct iwl_priv *priv,
1538 cmd.diff_gain_a = data->delta_gain_code[0]; 1535 cmd.diff_gain_a = data->delta_gain_code[0];
1539 cmd.diff_gain_b = data->delta_gain_code[1]; 1536 cmd.diff_gain_b = data->delta_gain_code[1];
1540 cmd.diff_gain_c = data->delta_gain_code[2]; 1537 cmd.diff_gain_c = data->delta_gain_code[2];
1541 rc = iwl4965_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, 1538 ret = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
1542 sizeof(cmd), &cmd); 1539 sizeof(cmd), &cmd);
1543 if (rc) 1540 if (ret)
1544 IWL_DEBUG_CALIB("fail sending cmd " 1541 IWL_DEBUG_CALIB("fail sending cmd "
1545 "REPLY_PHY_CALIBRATION_CMD \n"); 1542 "REPLY_PHY_CALIBRATION_CMD \n");
1546 1543
@@ -1564,7 +1561,6 @@ static void iwl4965_noise_calibration(struct iwl_priv *priv,
1564static void iwl4965_sensitivity_calibration(struct iwl_priv *priv, 1561static void iwl4965_sensitivity_calibration(struct iwl_priv *priv,
1565 struct iwl4965_notif_statistics *resp) 1562 struct iwl4965_notif_statistics *resp)
1566{ 1563{
1567 int rc = 0;
1568 u32 rx_enable_time; 1564 u32 rx_enable_time;
1569 u32 fa_cck; 1565 u32 fa_cck;
1570 u32 fa_ofdm; 1566 u32 fa_ofdm;
@@ -1577,6 +1573,7 @@ static void iwl4965_sensitivity_calibration(struct iwl_priv *priv,
1577 struct statistics_rx *statistics = &(resp->rx); 1573 struct statistics_rx *statistics = &(resp->rx);
1578 unsigned long flags; 1574 unsigned long flags;
1579 struct statistics_general_data statis; 1575 struct statistics_general_data statis;
1576 int ret;
1580 1577
1581 data = &(priv->sensitivity_data); 1578 data = &(priv->sensitivity_data);
1582 1579
@@ -1661,7 +1658,7 @@ static void iwl4965_sensitivity_calibration(struct iwl_priv *priv,
1661 1658
1662 iwl4965_sens_auto_corr_ofdm(priv, norm_fa_ofdm, rx_enable_time); 1659 iwl4965_sens_auto_corr_ofdm(priv, norm_fa_ofdm, rx_enable_time);
1663 iwl4965_sens_energy_cck(priv, norm_fa_cck, rx_enable_time, &statis); 1660 iwl4965_sens_energy_cck(priv, norm_fa_cck, rx_enable_time, &statis);
1664 rc |= iwl4965_sensitivity_write(priv, CMD_ASYNC); 1661 ret = iwl4965_sensitivity_write(priv, CMD_ASYNC);
1665 1662
1666 return; 1663 return;
1667} 1664}
@@ -1789,7 +1786,7 @@ int iwl4965_alive_notify(struct iwl_priv *priv)
1789 u32 a; 1786 u32 a;
1790 int i = 0; 1787 int i = 0;
1791 unsigned long flags; 1788 unsigned long flags;
1792 int rc; 1789 int ret;
1793 1790
1794 spin_lock_irqsave(&priv->lock, flags); 1791 spin_lock_irqsave(&priv->lock, flags);
1795 1792
@@ -1802,10 +1799,10 @@ int iwl4965_alive_notify(struct iwl_priv *priv)
1802 priv->chain_noise_data.delta_gain_code[i] = 1799 priv->chain_noise_data.delta_gain_code[i] =
1803 CHAIN_NOISE_DELTA_GAIN_INIT_VAL; 1800 CHAIN_NOISE_DELTA_GAIN_INIT_VAL;
1804#endif /* CONFIG_IWL4965_SENSITIVITY*/ 1801#endif /* CONFIG_IWL4965_SENSITIVITY*/
1805 rc = iwl4965_grab_nic_access(priv); 1802 ret = iwl4965_grab_nic_access(priv);
1806 if (rc) { 1803 if (ret) {
1807 spin_unlock_irqrestore(&priv->lock, flags); 1804 spin_unlock_irqrestore(&priv->lock, flags);
1808 return rc; 1805 return ret;
1809 } 1806 }
1810 1807
1811 /* Clear 4965's internal Tx Scheduler data base */ 1808 /* Clear 4965's internal Tx Scheduler data base */
@@ -1868,7 +1865,7 @@ int iwl4965_alive_notify(struct iwl_priv *priv)
1868 iwl4965_release_nic_access(priv); 1865 iwl4965_release_nic_access(priv);
1869 spin_unlock_irqrestore(&priv->lock, flags); 1866 spin_unlock_irqrestore(&priv->lock, flags);
1870 1867
1871 return 0; 1868 return ret;
1872} 1869}
1873 1870
1874/** 1871/**
@@ -2719,7 +2716,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
2719int iwl4965_hw_reg_send_txpower(struct iwl_priv *priv) 2716int iwl4965_hw_reg_send_txpower(struct iwl_priv *priv)
2720{ 2717{
2721 struct iwl4965_txpowertable_cmd cmd = { 0 }; 2718 struct iwl4965_txpowertable_cmd cmd = { 0 };
2722 int rc = 0; 2719 int ret;
2723 u8 band = 0; 2720 u8 band = 0;
2724 u8 is_fat = 0; 2721 u8 is_fat = 0;
2725 u8 ctrl_chan_high = 0; 2722 u8 ctrl_chan_high = 0;
@@ -2743,14 +2740,16 @@ int iwl4965_hw_reg_send_txpower(struct iwl_priv *priv)
2743 cmd.band = band; 2740 cmd.band = band;
2744 cmd.channel = priv->active_rxon.channel; 2741 cmd.channel = priv->active_rxon.channel;
2745 2742
2746 rc = iwl4965_fill_txpower_tbl(priv, band, 2743 ret = iwl4965_fill_txpower_tbl(priv, band,
2747 le16_to_cpu(priv->active_rxon.channel), 2744 le16_to_cpu(priv->active_rxon.channel),
2748 is_fat, ctrl_chan_high, &cmd.tx_power); 2745 is_fat, ctrl_chan_high, &cmd.tx_power);
2749 if (rc) 2746 if (ret)
2750 return rc; 2747 goto out;
2751 2748
2752 rc = iwl4965_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, sizeof(cmd), &cmd); 2749 ret = iwl_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD, sizeof(cmd), &cmd);
2753 return rc; 2750
2751out:
2752 return ret;
2754} 2753}
2755 2754
2756int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel) 2755int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel)
@@ -2790,7 +2789,7 @@ int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel)
2790 return rc; 2789 return rc;
2791 } 2790 }
2792 2791
2793 rc = iwl4965_send_cmd_pdu(priv, REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); 2792 rc = iwl_send_cmd_pdu(priv, REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd);
2794 return rc; 2793 return rc;
2795} 2794}
2796 2795
@@ -2798,7 +2797,7 @@ int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel)
2798#define RTS_DFAULT_RETRY_LIMIT 60 2797#define RTS_DFAULT_RETRY_LIMIT 60
2799 2798
2800void iwl4965_hw_build_tx_cmd_rate(struct iwl_priv *priv, 2799void iwl4965_hw_build_tx_cmd_rate(struct iwl_priv *priv,
2801 struct iwl4965_cmd *cmd, 2800 struct iwl_cmd *cmd,
2802 struct ieee80211_tx_control *ctrl, 2801 struct ieee80211_tx_control *ctrl,
2803 struct ieee80211_hdr *hdr, int sta_id, 2802 struct ieee80211_hdr *hdr, int sta_id,
2804 int is_hcca) 2803 int is_hcca)
@@ -3863,7 +3862,7 @@ static inline void iwl4965_dbg_report_frame(struct iwl_priv *priv,
3863 3862
3864#define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) 3863#define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6)
3865 3864
3866/* Called for REPLY_4965_RX (legacy ABG frames), or 3865/* Called for REPLY_RX (legacy ABG frames), or
3867 * REPLY_RX_MPDU_CMD (HT high-throughput N frames). */ 3866 * REPLY_RX_MPDU_CMD (HT high-throughput N frames). */
3868static void iwl4965_rx_reply_rx(struct iwl_priv *priv, 3867static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
3869 struct iwl4965_rx_mem_buffer *rxb) 3868 struct iwl4965_rx_mem_buffer *rxb)
@@ -3874,7 +3873,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
3874 /* Use phy data (Rx signal strength, etc.) contained within 3873 /* Use phy data (Rx signal strength, etc.) contained within
3875 * this rx packet for legacy frames, 3874 * this rx packet for legacy frames,
3876 * or phy data cached from REPLY_RX_PHY_CMD for HT frames. */ 3875 * or phy data cached from REPLY_RX_PHY_CMD for HT frames. */
3877 int include_phy = (pkt->hdr.cmd == REPLY_4965_RX); 3876 int include_phy = (pkt->hdr.cmd == REPLY_RX);
3878 struct iwl4965_rx_phy_res *rx_start = (include_phy) ? 3877 struct iwl4965_rx_phy_res *rx_start = (include_phy) ?
3879 (struct iwl4965_rx_phy_res *)&(pkt->u.raw[0]) : 3878 (struct iwl4965_rx_phy_res *)&(pkt->u.raw[0]) :
3880 (struct iwl4965_rx_phy_res *)&priv->last_phy_res[1]; 3879 (struct iwl4965_rx_phy_res *)&priv->last_phy_res[1];
@@ -4562,7 +4561,7 @@ void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap)
4562 /* Update the rate scaling for control frame Tx to AP */ 4561 /* Update the rate scaling for control frame Tx to AP */
4563 link_cmd.sta_id = is_ap ? IWL_AP_ID : priv->hw_setting.bcast_sta_id; 4562 link_cmd.sta_id = is_ap ? IWL_AP_ID : priv->hw_setting.bcast_sta_id;
4564 4563
4565 iwl4965_send_cmd_pdu(priv, REPLY_TX_LINK_QUALITY_CMD, sizeof(link_cmd), 4564 iwl_send_cmd_pdu(priv, REPLY_TX_LINK_QUALITY_CMD, sizeof(link_cmd),
4566 &link_cmd); 4565 &link_cmd);
4567} 4566}
4568 4567
@@ -4915,7 +4914,7 @@ int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw,
4915void iwl4965_hw_rx_handler_setup(struct iwl_priv *priv) 4914void iwl4965_hw_rx_handler_setup(struct iwl_priv *priv)
4916{ 4915{
4917 /* Legacy Rx frames */ 4916 /* Legacy Rx frames */
4918 priv->rx_handlers[REPLY_4965_RX] = iwl4965_rx_reply_rx; 4917 priv->rx_handlers[REPLY_RX] = iwl4965_rx_reply_rx;
4919 4918
4920 /* High-throughput (HT) Rx frames */ 4919 /* High-throughput (HT) Rx frames */
4921 priv->rx_handlers[REPLY_RX_PHY_CMD] = iwl4965_rx_reply_rx_phy; 4920 priv->rx_handlers[REPLY_RX_PHY_CMD] = iwl4965_rx_reply_rx_phy;
@@ -4948,6 +4947,10 @@ void iwl4965_hw_cancel_deferred_work(struct iwl_priv *priv)
4948 cancel_delayed_work(&priv->init_alive_start); 4947 cancel_delayed_work(&priv->init_alive_start);
4949} 4948}
4950 4949
4950static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = {
4951 .enqueue_hcmd = iwl4965_enqueue_hcmd,
4952};
4953
4951static struct iwl_lib_ops iwl4965_lib = { 4954static struct iwl_lib_ops iwl4965_lib = {
4952 .init_drv = iwl4965_init_drv, 4955 .init_drv = iwl4965_init_drv,
4953 .eeprom_ops = { 4956 .eeprom_ops = {
@@ -4959,6 +4962,7 @@ static struct iwl_lib_ops iwl4965_lib = {
4959 4962
4960static struct iwl_ops iwl4965_ops = { 4963static struct iwl_ops iwl4965_ops = {
4961 .lib = &iwl4965_lib, 4964 .lib = &iwl4965_lib,
4965 .utils = &iwl4965_hcmd_utils,
4962}; 4966};
4963 4967
4964static struct iwl_cfg iwl4965_agn_cfg = { 4968static struct iwl_cfg iwl4965_agn_cfg = {