diff options
author | Jussi Kivilinna <jussi.kivilinna@mbnet.fi> | 2011-01-31 13:49:43 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-02-04 16:29:50 -0500 |
commit | 212e1a5b9df0a51d54d7841467f3f01baa1b82f1 (patch) | |
tree | 7e001a521f613ded27315bdf280e26967ac1abbc /drivers/net/wireless/zd1211rw/zd_mac.c | |
parent | 8f2d8f869af5088d4e4866c8286f0599e83cc963 (diff) |
zd1211rw: collect driver settings and add function to restore theim
We need HW hard reset later in patchset to reset device after TX-stall.
Collect all settings that we have set to driver for later reset and
add restore function.
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/zd1211rw/zd_mac.c')
-rw-r--r-- | drivers/net/wireless/zd1211rw/zd_mac.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index 84ee1b886912..e82f0075ed93 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c | |||
@@ -141,6 +141,9 @@ static void housekeeping_disable(struct zd_mac *mac); | |||
141 | static void beacon_init(struct zd_mac *mac); | 141 | static void beacon_init(struct zd_mac *mac); |
142 | static void beacon_enable(struct zd_mac *mac); | 142 | static void beacon_enable(struct zd_mac *mac); |
143 | static void beacon_disable(struct zd_mac *mac); | 143 | static void beacon_disable(struct zd_mac *mac); |
144 | static void set_rts_cts(struct zd_mac *mac, unsigned int short_preamble); | ||
145 | static int zd_mac_config_beacon(struct ieee80211_hw *hw, | ||
146 | struct sk_buff *beacon); | ||
144 | 147 | ||
145 | static int zd_reg2alpha2(u8 regdomain, char *alpha2) | 148 | static int zd_reg2alpha2(u8 regdomain, char *alpha2) |
146 | { | 149 | { |
@@ -339,6 +342,68 @@ static void zd_op_stop(struct ieee80211_hw *hw) | |||
339 | dev_kfree_skb_any(skb); | 342 | dev_kfree_skb_any(skb); |
340 | } | 343 | } |
341 | 344 | ||
345 | int zd_restore_settings(struct zd_mac *mac) | ||
346 | { | ||
347 | struct sk_buff *beacon; | ||
348 | struct zd_mc_hash multicast_hash; | ||
349 | unsigned int short_preamble; | ||
350 | int r, beacon_interval, beacon_period; | ||
351 | u8 channel; | ||
352 | |||
353 | dev_dbg_f(zd_mac_dev(mac), "\n"); | ||
354 | |||
355 | spin_lock_irq(&mac->lock); | ||
356 | multicast_hash = mac->multicast_hash; | ||
357 | short_preamble = mac->short_preamble; | ||
358 | beacon_interval = mac->beacon.interval; | ||
359 | beacon_period = mac->beacon.period; | ||
360 | channel = mac->channel; | ||
361 | spin_unlock_irq(&mac->lock); | ||
362 | |||
363 | r = set_mac_and_bssid(mac); | ||
364 | if (r < 0) { | ||
365 | dev_dbg_f(zd_mac_dev(mac), "set_mac_and_bssid failed, %d\n", r); | ||
366 | return r; | ||
367 | } | ||
368 | |||
369 | r = zd_chip_set_channel(&mac->chip, channel); | ||
370 | if (r < 0) { | ||
371 | dev_dbg_f(zd_mac_dev(mac), "zd_chip_set_channel failed, %d\n", | ||
372 | r); | ||
373 | return r; | ||
374 | } | ||
375 | |||
376 | set_rts_cts(mac, short_preamble); | ||
377 | |||
378 | r = zd_chip_set_multicast_hash(&mac->chip, &multicast_hash); | ||
379 | if (r < 0) { | ||
380 | dev_dbg_f(zd_mac_dev(mac), | ||
381 | "zd_chip_set_multicast_hash failed, %d\n", r); | ||
382 | return r; | ||
383 | } | ||
384 | |||
385 | if (mac->type == NL80211_IFTYPE_MESH_POINT || | ||
386 | mac->type == NL80211_IFTYPE_ADHOC || | ||
387 | mac->type == NL80211_IFTYPE_AP) { | ||
388 | if (mac->vif != NULL) { | ||
389 | beacon = ieee80211_beacon_get(mac->hw, mac->vif); | ||
390 | if (beacon) { | ||
391 | zd_mac_config_beacon(mac->hw, beacon); | ||
392 | kfree_skb(beacon); | ||
393 | } | ||
394 | } | ||
395 | |||
396 | zd_set_beacon_interval(&mac->chip, beacon_interval, | ||
397 | beacon_period, mac->type); | ||
398 | |||
399 | spin_lock_irq(&mac->lock); | ||
400 | mac->beacon.last_update = jiffies; | ||
401 | spin_unlock_irq(&mac->lock); | ||
402 | } | ||
403 | |||
404 | return 0; | ||
405 | } | ||
406 | |||
342 | /** | 407 | /** |
343 | * zd_mac_tx_status - reports tx status of a packet if required | 408 | * zd_mac_tx_status - reports tx status of a packet if required |
344 | * @hw - a &struct ieee80211_hw pointer | 409 | * @hw - a &struct ieee80211_hw pointer |
@@ -988,6 +1053,10 @@ static int zd_op_config(struct ieee80211_hw *hw, u32 changed) | |||
988 | struct zd_mac *mac = zd_hw_mac(hw); | 1053 | struct zd_mac *mac = zd_hw_mac(hw); |
989 | struct ieee80211_conf *conf = &hw->conf; | 1054 | struct ieee80211_conf *conf = &hw->conf; |
990 | 1055 | ||
1056 | spin_lock_irq(&mac->lock); | ||
1057 | mac->channel = conf->channel->hw_value; | ||
1058 | spin_unlock_irq(&mac->lock); | ||
1059 | |||
991 | return zd_chip_set_channel(&mac->chip, conf->channel->hw_value); | 1060 | return zd_chip_set_channel(&mac->chip, conf->channel->hw_value); |
992 | } | 1061 | } |
993 | 1062 | ||