aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorAbhijeet Kolekar <abhijeet.kolekar@intel.com>2009-10-02 16:44:04 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-07 16:39:45 -0400
commitd68b603cf01a6e7d8c85c5a86db751ed3960c0c7 (patch)
treefeb661659e80684e3edaa918f650bcc7e70d0625 /drivers/net/wireless
parente932a609e9759cc75db0c234f465a5fd6e20d362 (diff)
iwlwifi/iwl3945 : unify apm stop operation
Unify the usage of apm_stop_master and apm_stop across all hardwares. Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-1000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c43
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c38
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c46
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c36
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h1
8 files changed, 47 insertions, 124 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index 86d93b52c6fc..679a67ff76eb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -112,7 +112,7 @@ static struct iwl_lib_ops iwl1000_lib = {
112 .apm_ops = { 112 .apm_ops = {
113 .init = iwl5000_apm_init, 113 .init = iwl5000_apm_init,
114 .reset = iwl5000_apm_reset, 114 .reset = iwl5000_apm_reset,
115 .stop = iwl5000_apm_stop, 115 .stop = iwl_apm_stop,
116 .config = iwl1000_nic_config, 116 .config = iwl1000_nic_config,
117 .set_pwr_src = iwl_set_pwr_src, 117 .set_pwr_src = iwl_set_pwr_src,
118 }, 118 },
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index f0ce5c45ca05..c5d1d57b4e0b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -1167,48 +1167,9 @@ void iwl3945_hw_txq_ctx_stop(struct iwl_priv *priv)
1167 iwl3945_hw_txq_ctx_free(priv); 1167 iwl3945_hw_txq_ctx_free(priv);
1168} 1168}
1169 1169
1170static int iwl3945_apm_stop_master(struct iwl_priv *priv)
1171{
1172 int ret = 0;
1173 unsigned long flags;
1174
1175 spin_lock_irqsave(&priv->lock, flags);
1176
1177 /* set stop master bit */
1178 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
1179
1180 iwl_poll_direct_bit(priv, CSR_RESET,
1181 CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
1182
1183 if (ret < 0)
1184 goto out;
1185
1186out:
1187 spin_unlock_irqrestore(&priv->lock, flags);
1188 IWL_DEBUG_INFO(priv, "stop master\n");
1189
1190 return ret;
1191}
1192
1193static void iwl3945_apm_stop(struct iwl_priv *priv)
1194{
1195 unsigned long flags;
1196
1197 iwl3945_apm_stop_master(priv);
1198
1199 spin_lock_irqsave(&priv->lock, flags);
1200
1201 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
1202
1203 udelay(10);
1204 /* clear "init complete" move adapter D0A* --> D0U state */
1205 iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
1206 spin_unlock_irqrestore(&priv->lock, flags);
1207}
1208
1209static int iwl3945_apm_reset(struct iwl_priv *priv) 1170static int iwl3945_apm_reset(struct iwl_priv *priv)
1210{ 1171{
1211 iwl3945_apm_stop_master(priv); 1172 iwl_apm_stop_master(priv);
1212 1173
1213 1174
1214 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); 1175 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
@@ -2841,7 +2802,7 @@ static struct iwl_lib_ops iwl3945_lib = {
2841 .apm_ops = { 2802 .apm_ops = {
2842 .init = iwl3945_apm_init, 2803 .init = iwl3945_apm_init,
2843 .reset = iwl3945_apm_reset, 2804 .reset = iwl3945_apm_reset,
2844 .stop = iwl3945_apm_stop, 2805 .stop = iwl_apm_stop,
2845 .config = iwl3945_nic_config, 2806 .config = iwl3945_nic_config,
2846 .set_pwr_src = iwl3945_set_pwr_src, 2807 .set_pwr_src = iwl3945_set_pwr_src,
2847 }, 2808 },
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 8717946de011..dd10c426ecc4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -396,45 +396,11 @@ static void iwl4965_nic_config(struct iwl_priv *priv)
396 spin_unlock_irqrestore(&priv->lock, flags); 396 spin_unlock_irqrestore(&priv->lock, flags);
397} 397}
398 398
399static int iwl4965_apm_stop_master(struct iwl_priv *priv)
400{
401 unsigned long flags;
402
403 spin_lock_irqsave(&priv->lock, flags);
404
405 /* set stop master bit */
406 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
407
408 iwl_poll_direct_bit(priv, CSR_RESET,
409 CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
410
411 spin_unlock_irqrestore(&priv->lock, flags);
412 IWL_DEBUG_INFO(priv, "stop master\n");
413
414 return 0;
415}
416
417static void iwl4965_apm_stop(struct iwl_priv *priv)
418{
419 unsigned long flags;
420
421 iwl4965_apm_stop_master(priv);
422
423 spin_lock_irqsave(&priv->lock, flags);
424
425 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
426
427 udelay(10);
428 /* clear "init complete" move adapter D0A* --> D0U state */
429 iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
430 spin_unlock_irqrestore(&priv->lock, flags);
431}
432
433static int iwl4965_apm_reset(struct iwl_priv *priv) 399static int iwl4965_apm_reset(struct iwl_priv *priv)
434{ 400{
435 int ret = 0; 401 int ret = 0;
436 402
437 iwl4965_apm_stop_master(priv); 403 iwl_apm_stop_master(priv);
438 404
439 405
440 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); 406 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
@@ -2306,7 +2272,7 @@ static struct iwl_lib_ops iwl4965_lib = {
2306 .apm_ops = { 2272 .apm_ops = {
2307 .init = iwl4965_apm_init, 2273 .init = iwl4965_apm_init,
2308 .reset = iwl4965_apm_reset, 2274 .reset = iwl4965_apm_reset,
2309 .stop = iwl4965_apm_stop, 2275 .stop = iwl_apm_stop,
2310 .config = iwl4965_nic_config, 2276 .config = iwl4965_nic_config,
2311 .set_pwr_src = iwl_set_pwr_src, 2277 .set_pwr_src = iwl_set_pwr_src,
2312 }, 2278 },
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 624853503db1..d8dadbf04138 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -72,26 +72,6 @@ static const u16 iwl5000_default_queue_to_tx_fifo[] = {
72 IWL_TX_FIFO_HCCA_2 72 IWL_TX_FIFO_HCCA_2
73}; 73};
74 74
75/* FIXME: same implementation as 4965 */
76static int iwl5000_apm_stop_master(struct iwl_priv *priv)
77{
78 unsigned long flags;
79
80 spin_lock_irqsave(&priv->lock, flags);
81
82 /* set stop master bit */
83 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
84
85 iwl_poll_direct_bit(priv, CSR_RESET,
86 CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
87
88 spin_unlock_irqrestore(&priv->lock, flags);
89 IWL_DEBUG_INFO(priv, "stop master\n");
90
91 return 0;
92}
93
94
95int iwl5000_apm_init(struct iwl_priv *priv) 75int iwl5000_apm_init(struct iwl_priv *priv)
96{ 76{
97 int ret = 0; 77 int ret = 0;
@@ -137,31 +117,11 @@ int iwl5000_apm_init(struct iwl_priv *priv)
137 return ret; 117 return ret;
138} 118}
139 119
140/* FIXME: this is identical to 4965 */
141void iwl5000_apm_stop(struct iwl_priv *priv)
142{
143 unsigned long flags;
144
145 iwl5000_apm_stop_master(priv);
146
147 spin_lock_irqsave(&priv->lock, flags);
148
149 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
150
151 udelay(10);
152
153 /* clear "init complete" move adapter D0A* --> D0U state */
154 iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
155
156 spin_unlock_irqrestore(&priv->lock, flags);
157}
158
159
160int iwl5000_apm_reset(struct iwl_priv *priv) 120int iwl5000_apm_reset(struct iwl_priv *priv)
161{ 121{
162 int ret = 0; 122 int ret = 0;
163 123
164 iwl5000_apm_stop_master(priv); 124 iwl_apm_stop_master(priv);
165 125
166 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); 126 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
167 127
@@ -1561,7 +1521,7 @@ struct iwl_lib_ops iwl5000_lib = {
1561 .apm_ops = { 1521 .apm_ops = {
1562 .init = iwl5000_apm_init, 1522 .init = iwl5000_apm_init,
1563 .reset = iwl5000_apm_reset, 1523 .reset = iwl5000_apm_reset,
1564 .stop = iwl5000_apm_stop, 1524 .stop = iwl_apm_stop,
1565 .config = iwl5000_nic_config, 1525 .config = iwl5000_nic_config,
1566 .set_pwr_src = iwl_set_pwr_src, 1526 .set_pwr_src = iwl_set_pwr_src,
1567 }, 1527 },
@@ -1613,7 +1573,7 @@ static struct iwl_lib_ops iwl5150_lib = {
1613 .apm_ops = { 1573 .apm_ops = {
1614 .init = iwl5000_apm_init, 1574 .init = iwl5000_apm_init,
1615 .reset = iwl5000_apm_reset, 1575 .reset = iwl5000_apm_reset,
1616 .stop = iwl5000_apm_stop, 1576 .stop = iwl_apm_stop,
1617 .config = iwl5000_nic_config, 1577 .config = iwl5000_nic_config,
1618 .set_pwr_src = iwl_set_pwr_src, 1578 .set_pwr_src = iwl_set_pwr_src,
1619 }, 1579 },
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index a002214f4d49..d1f0b0b4ad0c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -193,7 +193,7 @@ static struct iwl_lib_ops iwl6000_lib = {
193 .apm_ops = { 193 .apm_ops = {
194 .init = iwl5000_apm_init, 194 .init = iwl5000_apm_init,
195 .reset = iwl5000_apm_reset, 195 .reset = iwl5000_apm_reset,
196 .stop = iwl5000_apm_stop, 196 .stop = iwl_apm_stop,
197 .config = iwl6000_nic_config, 197 .config = iwl6000_nic_config,
198 .set_pwr_src = iwl_set_pwr_src, 198 .set_pwr_src = iwl_set_pwr_src,
199 }, 199 },
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 34547cf3a66e..7c0ef8e4ebbf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1329,6 +1329,42 @@ void iwl_irq_handle_error(struct iwl_priv *priv)
1329} 1329}
1330EXPORT_SYMBOL(iwl_irq_handle_error); 1330EXPORT_SYMBOL(iwl_irq_handle_error);
1331 1331
1332int iwl_apm_stop_master(struct iwl_priv *priv)
1333{
1334 unsigned long flags;
1335
1336 spin_lock_irqsave(&priv->lock, flags);
1337
1338 /* set stop master bit */
1339 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
1340
1341 iwl_poll_direct_bit(priv, CSR_RESET,
1342 CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
1343
1344 spin_unlock_irqrestore(&priv->lock, flags);
1345 IWL_DEBUG_INFO(priv, "stop master\n");
1346
1347 return 0;
1348}
1349EXPORT_SYMBOL(iwl_apm_stop_master);
1350
1351void iwl_apm_stop(struct iwl_priv *priv)
1352{
1353 unsigned long flags;
1354
1355 iwl_apm_stop_master(priv);
1356
1357 spin_lock_irqsave(&priv->lock, flags);
1358
1359 iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
1360
1361 udelay(10);
1362 /* clear "init complete" move adapter D0A* --> D0U state */
1363 iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
1364 spin_unlock_irqrestore(&priv->lock, flags);
1365}
1366EXPORT_SYMBOL(iwl_apm_stop);
1367
1332void iwl_configure_filter(struct ieee80211_hw *hw, 1368void iwl_configure_filter(struct ieee80211_hw *hw,
1333 unsigned int changed_flags, 1369 unsigned int changed_flags,
1334 unsigned int *total_flags, 1370 unsigned int *total_flags,
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index eb586a546181..6688b6944200 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -658,6 +658,8 @@ extern void iwl_rx_reply_rx_phy(struct iwl_priv *priv,
658 struct iwl_rx_mem_buffer *rxb); 658 struct iwl_rx_mem_buffer *rxb);
659void iwl_rx_reply_compressed_ba(struct iwl_priv *priv, 659void iwl_rx_reply_compressed_ba(struct iwl_priv *priv,
660 struct iwl_rx_mem_buffer *rxb); 660 struct iwl_rx_mem_buffer *rxb);
661void iwl_apm_stop(struct iwl_priv *priv);
662int iwl_apm_stop_master(struct iwl_priv *priv);
661 663
662void iwl_setup_rxon_timing(struct iwl_priv *priv); 664void iwl_setup_rxon_timing(struct iwl_priv *priv);
663static inline int iwl_send_rxon_assoc(struct iwl_priv *priv) 665static inline int iwl_send_rxon_assoc(struct iwl_priv *priv)
@@ -677,5 +679,4 @@ static inline const struct ieee80211_supported_band *iwl_get_hw_mode(
677{ 679{
678 return priv->hw->wiphy->bands[band]; 680 return priv->hw->wiphy->bands[band];
679} 681}
680
681#endif /* __iwl_core_h__ */ 682#endif /* __iwl_core_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index eabc55695aff..72946c144be7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -86,7 +86,6 @@ extern void iwl5000_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
86extern int iwl5000_calc_rssi(struct iwl_priv *priv, 86extern int iwl5000_calc_rssi(struct iwl_priv *priv,
87 struct iwl_rx_phy_res *rx_resp); 87 struct iwl_rx_phy_res *rx_resp);
88extern int iwl5000_apm_init(struct iwl_priv *priv); 88extern int iwl5000_apm_init(struct iwl_priv *priv);
89extern void iwl5000_apm_stop(struct iwl_priv *priv);
90extern int iwl5000_apm_reset(struct iwl_priv *priv); 89extern int iwl5000_apm_reset(struct iwl_priv *priv);
91extern void iwl5000_nic_config(struct iwl_priv *priv); 90extern void iwl5000_nic_config(struct iwl_priv *priv);
92extern u16 iwl5000_eeprom_calib_version(struct iwl_priv *priv); 91extern u16 iwl5000_eeprom_calib_version(struct iwl_priv *priv);