aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-12-10 12:50:47 -0500
committerDavid S. Miller <davem@davemloft.net>2010-12-10 12:50:47 -0500
commit1e13f863ca88014d9550876c05c939fdab1017d1 (patch)
tree1ede9804ee33d7eefb73e9535e0399dfd7f58c00
parentf404c2fea37e02bec7c8b6edddf5edd22ca60505 (diff)
parentf435d9eea01309aa7b6c1f134569a7b5957918ae (diff)
Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Conflicts: drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
-rw-r--r--Documentation/DocBook/80211.tmpl70
-rw-r--r--drivers/net/wireless/ath/ar9170/usb.c6
-rw-r--r--drivers/net/wireless/ath/ath.h2
-rw-r--r--drivers/net/wireless/ath/ath5k/Kconfig17
-rw-r--r--drivers/net/wireless/ath/ath5k/Makefile2
-rw-r--r--drivers/net/wireless/ath/ath5k/ahb.c219
-rw-r--r--drivers/net/wireless/ath/ath5k/ani.c6
-rw-r--r--drivers/net/wireless/ath/ath5k/ath5k.h260
-rw-r--r--drivers/net/wireless/ath/ath5k/attach.c28
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c753
-rw-r--r--drivers/net/wireless/ath/ath5k/base.h5
-rw-r--r--drivers/net/wireless/ath/ath5k/caps.c6
-rw-r--r--drivers/net/wireless/ath/ath5k/debug.c1
-rw-r--r--drivers/net/wireless/ath/ath5k/debug.h2
-rw-r--r--drivers/net/wireless/ath/ath5k/desc.c24
-rw-r--r--drivers/net/wireless/ath/ath5k/dma.c180
-rw-r--r--drivers/net/wireless/ath/ath5k/eeprom.c127
-rw-r--r--drivers/net/wireless/ath/ath5k/eeprom.h2
-rw-r--r--drivers/net/wireless/ath/ath5k/initvals.c409
-rw-r--r--drivers/net/wireless/ath/ath5k/led.c11
-rw-r--r--drivers/net/wireless/ath/ath5k/pci.c326
-rw-r--r--drivers/net/wireless/ath/ath5k/pcu.c571
-rw-r--r--drivers/net/wireless/ath/ath5k/phy.c641
-rw-r--r--drivers/net/wireless/ath/ath5k/qcu.c692
-rw-r--r--drivers/net/wireless/ath/ath5k/reg.h31
-rw-r--r--drivers/net/wireless/ath/ath5k/reset.c1221
-rw-r--r--drivers/net/wireless/ath/ath5k/rfbuffer.h1169
-rw-r--r--drivers/net/wireless/ath/ath5k/sysfs.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_eeprom.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_phy.c6
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h3
-rw-r--r--drivers/net/wireless/ath/ath9k/beacon.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/btcoex.c23
-rw-r--r--drivers/net/wireless/ath/ath9k/btcoex.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c35
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.h16
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/hif_usb.c119
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c64
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_hst.h19
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c9
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c35
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c27
-rw-r--r--drivers/net/wireless/ath/carl9170/usb.c3
-rw-r--r--drivers/net/wireless/b43/phy_n.c305
-rw-r--r--drivers/net/wireless/b43/phy_n.h2
-rw-r--r--drivers/net/wireless/b43/radio_2055.c246
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-1000.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c20
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c66
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c20
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c34
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tx.c45
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-ucode.c24
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.h1
-rw-r--r--drivers/net/wireless/p54/p54usb.c2
-rw-r--r--drivers/net/wireless/ray_cs.c14
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c9
-rw-r--r--drivers/net/wireless/zd1201.c2
-rw-r--r--drivers/ssb/main.c30
-rw-r--r--drivers/ssb/pci.c44
-rw-r--r--include/linux/nl80211.h25
-rw-r--r--include/linux/ssb/ssb.h4
-rw-r--r--include/linux/ssb/ssb_regs.h40
-rw-r--r--include/net/bluetooth/hci.h16
-rw-r--r--include/net/bluetooth/hci_core.h14
-rw-r--r--include/net/bluetooth/l2cap.h22
-rw-r--r--include/net/bluetooth/rfcomm.h18
-rw-r--r--include/net/bluetooth/sco.h20
-rw-r--r--include/net/cfg80211.h18
-rw-r--r--include/net/mac80211.h28
-rw-r--r--net/bluetooth/bnep/core.c1
-rw-r--r--net/bluetooth/cmtp/core.c1
-rw-r--r--net/bluetooth/hci_conn.c23
-rw-r--r--net/bluetooth/hci_core.c66
-rw-r--r--net/bluetooth/hci_event.c177
-rw-r--r--net/bluetooth/hci_sock.c17
-rw-r--r--net/bluetooth/hidp/core.c2
-rw-r--r--net/bluetooth/l2cap.c94
-rw-r--r--net/bluetooth/rfcomm/core.c8
-rw-r--r--net/bluetooth/rfcomm/sock.c24
-rw-r--r--net/bluetooth/rfcomm/tty.c28
-rw-r--r--net/bluetooth/sco.c22
-rw-r--r--net/mac80211/agg-rx.c8
-rw-r--r--net/mac80211/cfg.c94
-rw-r--r--net/mac80211/debugfs_sta.c29
-rw-r--r--net/mac80211/ieee80211_i.h5
-rw-r--r--net/mac80211/rx.c22
-rw-r--r--net/mac80211/sta_info.h29
-rw-r--r--net/mac80211/status.c15
-rw-r--r--net/mac80211/work.c22
-rw-r--r--net/wireless/core.h4
-rw-r--r--net/wireless/mlme.c9
-rw-r--r--net/wireless/nl80211.c57
100 files changed, 5312 insertions, 3692 deletions
diff --git a/Documentation/DocBook/80211.tmpl b/Documentation/DocBook/80211.tmpl
index 19a1210c2530..03641a08e275 100644
--- a/Documentation/DocBook/80211.tmpl
+++ b/Documentation/DocBook/80211.tmpl
@@ -146,6 +146,7 @@
146!Finclude/net/cfg80211.h cfg80211_rx_mgmt 146!Finclude/net/cfg80211.h cfg80211_rx_mgmt
147!Finclude/net/cfg80211.h cfg80211_mgmt_tx_status 147!Finclude/net/cfg80211.h cfg80211_mgmt_tx_status
148!Finclude/net/cfg80211.h cfg80211_cqm_rssi_notify 148!Finclude/net/cfg80211.h cfg80211_cqm_rssi_notify
149!Finclude/net/cfg80211.h cfg80211_cqm_pktloss_notify
149!Finclude/net/cfg80211.h cfg80211_michael_mic_failure 150!Finclude/net/cfg80211.h cfg80211_michael_mic_failure
150 </chapter> 151 </chapter>
151 <chapter> 152 <chapter>
@@ -332,10 +333,16 @@
332 <title>functions/definitions</title> 333 <title>functions/definitions</title>
333!Finclude/net/mac80211.h ieee80211_rx_status 334!Finclude/net/mac80211.h ieee80211_rx_status
334!Finclude/net/mac80211.h mac80211_rx_flags 335!Finclude/net/mac80211.h mac80211_rx_flags
336!Finclude/net/mac80211.h mac80211_tx_control_flags
337!Finclude/net/mac80211.h mac80211_rate_control_flags
338!Finclude/net/mac80211.h ieee80211_tx_rate
335!Finclude/net/mac80211.h ieee80211_tx_info 339!Finclude/net/mac80211.h ieee80211_tx_info
340!Finclude/net/mac80211.h ieee80211_tx_info_clear_status
336!Finclude/net/mac80211.h ieee80211_rx 341!Finclude/net/mac80211.h ieee80211_rx
342!Finclude/net/mac80211.h ieee80211_rx_ni
337!Finclude/net/mac80211.h ieee80211_rx_irqsafe 343!Finclude/net/mac80211.h ieee80211_rx_irqsafe
338!Finclude/net/mac80211.h ieee80211_tx_status 344!Finclude/net/mac80211.h ieee80211_tx_status
345!Finclude/net/mac80211.h ieee80211_tx_status_ni
339!Finclude/net/mac80211.h ieee80211_tx_status_irqsafe 346!Finclude/net/mac80211.h ieee80211_tx_status_irqsafe
340!Finclude/net/mac80211.h ieee80211_rts_get 347!Finclude/net/mac80211.h ieee80211_rts_get
341!Finclude/net/mac80211.h ieee80211_rts_duration 348!Finclude/net/mac80211.h ieee80211_rts_duration
@@ -346,6 +353,7 @@
346!Finclude/net/mac80211.h ieee80211_stop_queue 353!Finclude/net/mac80211.h ieee80211_stop_queue
347!Finclude/net/mac80211.h ieee80211_wake_queues 354!Finclude/net/mac80211.h ieee80211_wake_queues
348!Finclude/net/mac80211.h ieee80211_stop_queues 355!Finclude/net/mac80211.h ieee80211_stop_queues
356!Finclude/net/mac80211.h ieee80211_queue_stopped
349 </sect1> 357 </sect1>
350 </chapter> 358 </chapter>
351 359
@@ -354,6 +362,13 @@
354!Pinclude/net/mac80211.h Frame filtering 362!Pinclude/net/mac80211.h Frame filtering
355!Finclude/net/mac80211.h ieee80211_filter_flags 363!Finclude/net/mac80211.h ieee80211_filter_flags
356 </chapter> 364 </chapter>
365
366 <chapter id="workqueue">
367 <title>The mac80211 workqueue</title>
368!Pinclude/net/mac80211.h mac80211 workqueue
369!Finclude/net/mac80211.h ieee80211_queue_work
370!Finclude/net/mac80211.h ieee80211_queue_delayed_work
371 </chapter>
357 </part> 372 </part>
358 373
359 <part id="advanced"> 374 <part id="advanced">
@@ -374,6 +389,9 @@
374!Finclude/net/mac80211.h set_key_cmd 389!Finclude/net/mac80211.h set_key_cmd
375!Finclude/net/mac80211.h ieee80211_key_conf 390!Finclude/net/mac80211.h ieee80211_key_conf
376!Finclude/net/mac80211.h ieee80211_key_flags 391!Finclude/net/mac80211.h ieee80211_key_flags
392!Finclude/net/mac80211.h ieee80211_tkip_key_type
393!Finclude/net/mac80211.h ieee80211_get_tkip_key
394!Finclude/net/mac80211.h ieee80211_key_removed
377 </chapter> 395 </chapter>
378 396
379 <chapter id="powersave"> 397 <chapter id="powersave">
@@ -417,6 +435,18 @@
417 supported by mac80211, add notes about supporting hw crypto 435 supported by mac80211, add notes about supporting hw crypto
418 with it. 436 with it.
419 </para> 437 </para>
438!Finclude/net/mac80211.h ieee80211_iterate_active_interfaces
439!Finclude/net/mac80211.h ieee80211_iterate_active_interfaces_atomic
440 </chapter>
441
442 <chapter id="station-handling">
443 <title>Station handling</title>
444 <para>TODO</para>
445!Finclude/net/mac80211.h ieee80211_sta
446!Finclude/net/mac80211.h sta_notify_cmd
447!Finclude/net/mac80211.h ieee80211_find_sta
448!Finclude/net/mac80211.h ieee80211_find_sta_by_ifaddr
449!Finclude/net/mac80211.h ieee80211_sta_block_awake
420 </chapter> 450 </chapter>
421 451
422 <chapter id="hardware-scan-offload"> 452 <chapter id="hardware-scan-offload">
@@ -424,6 +454,28 @@
424 <para>TBD</para> 454 <para>TBD</para>
425!Finclude/net/mac80211.h ieee80211_scan_completed 455!Finclude/net/mac80211.h ieee80211_scan_completed
426 </chapter> 456 </chapter>
457
458 <chapter id="aggregation">
459 <title>Aggregation</title>
460 <sect1>
461 <title>TX A-MPDU aggregation</title>
462!Pnet/mac80211/agg-tx.c TX A-MPDU aggregation
463!Cnet/mac80211/agg-tx.c
464 </sect1>
465 <sect1>
466 <title>RX A-MPDU aggregation</title>
467!Pnet/mac80211/agg-rx.c RX A-MPDU aggregation
468!Cnet/mac80211/agg-rx.c
469 </sect1>
470!Finclude/net/mac80211.h ieee80211_ampdu_mlme_action
471 </chapter>
472
473 <chapter id="smps">
474 <title>Spatial Multiplexing Powersave (SMPS)</title>
475!Pinclude/net/mac80211.h Spatial multiplexing power save
476!Finclude/net/mac80211.h ieee80211_request_smps
477!Finclude/net/mac80211.h ieee80211_smps_mode
478 </chapter>
427 </part> 479 </part>
428 480
429 <part id="rate-control"> 481 <part id="rate-control">
@@ -435,9 +487,16 @@
435 interface and how it relates to mac80211 and drivers. 487 interface and how it relates to mac80211 and drivers.
436 </para> 488 </para>
437 </partintro> 489 </partintro>
438 <chapter id="dummy"> 490 <chapter id="ratecontrol-api">
439 <title>dummy chapter</title> 491 <title>Rate Control API</title>
440 <para>TBD</para> 492 <para>TBD</para>
493!Finclude/net/mac80211.h ieee80211_start_tx_ba_session
494!Finclude/net/mac80211.h ieee80211_start_tx_ba_cb_irqsafe
495!Finclude/net/mac80211.h ieee80211_stop_tx_ba_session
496!Finclude/net/mac80211.h ieee80211_stop_tx_ba_cb_irqsafe
497!Finclude/net/mac80211.h rate_control_changed
498!Finclude/net/mac80211.h ieee80211_tx_rate_control
499!Finclude/net/mac80211.h rate_control_send_low
441 </chapter> 500 </chapter>
442 </part> 501 </part>
443 502
@@ -485,6 +544,13 @@
485 </sect1> 544 </sect1>
486 </chapter> 545 </chapter>
487 546
547 <chapter id="aggregation-internals">
548 <title>Aggregation</title>
549!Fnet/mac80211/sta_info.h sta_ampdu_mlme
550!Fnet/mac80211/sta_info.h tid_ampdu_tx
551!Fnet/mac80211/sta_info.h tid_ampdu_rx
552 </chapter>
553
488 <chapter id="synchronisation"> 554 <chapter id="synchronisation">
489 <title>Synchronisation</title> 555 <title>Synchronisation</title>
490 <para>TBD</para> 556 <para>TBD</para>
diff --git a/drivers/net/wireless/ath/ar9170/usb.c b/drivers/net/wireless/ath/ar9170/usb.c
index 5dbb5361fd51..d3be6f9816b5 100644
--- a/drivers/net/wireless/ath/ar9170/usb.c
+++ b/drivers/net/wireless/ath/ar9170/usb.c
@@ -161,8 +161,7 @@ static void ar9170_usb_submit_urb(struct ar9170_usb *aru)
161static void ar9170_usb_tx_urb_complete_frame(struct urb *urb) 161static void ar9170_usb_tx_urb_complete_frame(struct urb *urb)
162{ 162{
163 struct sk_buff *skb = urb->context; 163 struct sk_buff *skb = urb->context;
164 struct ar9170_usb *aru = (struct ar9170_usb *) 164 struct ar9170_usb *aru = usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
165 usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
166 165
167 if (unlikely(!aru)) { 166 if (unlikely(!aru)) {
168 dev_kfree_skb_irq(skb); 167 dev_kfree_skb_irq(skb);
@@ -219,8 +218,7 @@ free:
219static void ar9170_usb_rx_completed(struct urb *urb) 218static void ar9170_usb_rx_completed(struct urb *urb)
220{ 219{
221 struct sk_buff *skb = urb->context; 220 struct sk_buff *skb = urb->context;
222 struct ar9170_usb *aru = (struct ar9170_usb *) 221 struct ar9170_usb *aru = usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
223 usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
224 int err; 222 int err;
225 223
226 if (!aru) 224 if (!aru)
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
index 20ea68c59f7b..26bdbeee424f 100644
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -168,6 +168,8 @@ struct ath_common {
168 struct ath_regulatory regulatory; 168 struct ath_regulatory regulatory;
169 const struct ath_ops *ops; 169 const struct ath_ops *ops;
170 const struct ath_bus_ops *bus_ops; 170 const struct ath_bus_ops *bus_ops;
171
172 bool btcoex_enabled;
171}; 173};
172 174
173struct sk_buff *ath_rxbuf_alloc(struct ath_common *common, 175struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
diff --git a/drivers/net/wireless/ath/ath5k/Kconfig b/drivers/net/wireless/ath/ath5k/Kconfig
index 47844575caa3..e0793319389d 100644
--- a/drivers/net/wireless/ath/ath5k/Kconfig
+++ b/drivers/net/wireless/ath/ath5k/Kconfig
@@ -1,10 +1,12 @@
1config ATH5K 1config ATH5K
2 tristate "Atheros 5xxx wireless cards support" 2 tristate "Atheros 5xxx wireless cards support"
3 depends on PCI && MAC80211 3 depends on (PCI || ATHEROS_AR231X) && MAC80211
4 select MAC80211_LEDS 4 select MAC80211_LEDS
5 select LEDS_CLASS 5 select LEDS_CLASS
6 select NEW_LEDS 6 select NEW_LEDS
7 select AVERAGE 7 select AVERAGE
8 select ATH5K_AHB if (ATHEROS_AR231X && !PCI)
9 select ATH5K_PCI if (!ATHEROS_AR231X && PCI)
8 ---help--- 10 ---help---
9 This module adds support for wireless adapters based on 11 This module adds support for wireless adapters based on
10 Atheros 5xxx chipset. 12 Atheros 5xxx chipset.
@@ -38,3 +40,16 @@ config ATH5K_DEBUG
38 40
39 modprobe ath5k debug=0x00000400 41 modprobe ath5k debug=0x00000400
40 42
43config ATH5K_AHB
44 bool "Atheros 5xxx AHB bus support"
45 depends on (ATHEROS_AR231X && !PCI)
46 ---help---
47 This adds support for WiSoC type chipsets of the 5xxx Atheros
48 family.
49
50config ATH5K_PCI
51 bool "Atheros 5xxx PCI bus support"
52 depends on (!ATHEROS_AR231X && PCI)
53 ---help---
54 This adds support for PCI type chipsets of the 5xxx Atheros
55 family.
diff --git a/drivers/net/wireless/ath/ath5k/Makefile b/drivers/net/wireless/ath/ath5k/Makefile
index 2242a140e4fe..67dd9fd0650e 100644
--- a/drivers/net/wireless/ath/ath5k/Makefile
+++ b/drivers/net/wireless/ath/ath5k/Makefile
@@ -15,4 +15,6 @@ ath5k-y += rfkill.o
15ath5k-y += ani.o 15ath5k-y += ani.o
16ath5k-y += sysfs.o 16ath5k-y += sysfs.o
17ath5k-$(CONFIG_ATH5K_DEBUG) += debug.o 17ath5k-$(CONFIG_ATH5K_DEBUG) += debug.o
18ath5k-$(CONFIG_ATH5K_AHB) += ahb.o
19ath5k-$(CONFIG_ATH5K_PCI) += pci.o
18obj-$(CONFIG_ATH5K) += ath5k.o 20obj-$(CONFIG_ATH5K) += ath5k.o
diff --git a/drivers/net/wireless/ath/ath5k/ahb.c b/drivers/net/wireless/ath/ath5k/ahb.c
new file mode 100644
index 000000000000..707cde149248
--- /dev/null
+++ b/drivers/net/wireless/ath/ath5k/ahb.c
@@ -0,0 +1,219 @@
1/*
2 * Copyright (c) 2008-2009 Atheros Communications Inc.
3 * Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org>
4 * Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include <linux/nl80211.h>
20#include <linux/platform_device.h>
21#include <ar231x_platform.h>
22#include "ath5k.h"
23#include "debug.h"
24#include "base.h"
25#include "reg.h"
26#include "debug.h"
27
28/* return bus cachesize in 4B word units */
29static void ath5k_ahb_read_cachesize(struct ath_common *common, int *csz)
30{
31 *csz = L1_CACHE_BYTES >> 2;
32}
33
34bool ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data)
35{
36 struct ath5k_softc *sc = common->priv;
37 struct platform_device *pdev = to_platform_device(sc->dev);
38 struct ar231x_board_config *bcfg = pdev->dev.platform_data;
39 u16 *eeprom, *eeprom_end;
40
41
42
43 bcfg = pdev->dev.platform_data;
44 eeprom = (u16 *) bcfg->radio;
45 eeprom_end = ((void *) bcfg->config) + BOARD_CONFIG_BUFSZ;
46
47 eeprom += off;
48 if (eeprom > eeprom_end)
49 return -EINVAL;
50
51 *data = *eeprom;
52 return 0;
53}
54
55int ath5k_hw_read_srev(struct ath5k_hw *ah)
56{
57 struct ath5k_softc *sc = ah->ah_sc;
58 struct platform_device *pdev = to_platform_device(sc->dev);
59 struct ar231x_board_config *bcfg = pdev->dev.platform_data;
60 ah->ah_mac_srev = bcfg->devid;
61 return 0;
62}
63
64static const struct ath_bus_ops ath_ahb_bus_ops = {
65 .ath_bus_type = ATH_AHB,
66 .read_cachesize = ath5k_ahb_read_cachesize,
67 .eeprom_read = ath5k_ahb_eeprom_read,
68};
69
70/*Initialization*/
71static int ath_ahb_probe(struct platform_device *pdev)
72{
73 struct ar231x_board_config *bcfg = pdev->dev.platform_data;
74 struct ath5k_softc *sc;
75 struct ieee80211_hw *hw;
76 struct resource *res;
77 void __iomem *mem;
78 int irq;
79 int ret = 0;
80 u32 reg;
81
82 if (!pdev->dev.platform_data) {
83 dev_err(&pdev->dev, "no platform data specified\n");
84 ret = -EINVAL;
85 goto err_out;
86 }
87
88 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
89 if (res == NULL) {
90 dev_err(&pdev->dev, "no memory resource found\n");
91 ret = -ENXIO;
92 goto err_out;
93 }
94
95 mem = ioremap_nocache(res->start, res->end - res->start + 1);
96 if (mem == NULL) {
97 dev_err(&pdev->dev, "ioremap failed\n");
98 ret = -ENOMEM;
99 goto err_out;
100 }
101
102 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
103 if (res == NULL) {
104 dev_err(&pdev->dev, "no IRQ resource found\n");
105 ret = -ENXIO;
106 goto err_out;
107 }
108
109 irq = res->start;
110
111 hw = ieee80211_alloc_hw(sizeof(struct ath5k_softc), &ath5k_hw_ops);
112 if (hw == NULL) {
113 dev_err(&pdev->dev, "no memory for ieee80211_hw\n");
114 ret = -ENOMEM;
115 goto err_out;
116 }
117
118 sc = hw->priv;
119 sc->hw = hw;
120 sc->dev = &pdev->dev;
121 sc->iobase = mem;
122 sc->irq = irq;
123 sc->devid = bcfg->devid;
124
125 if (bcfg->devid >= AR5K_SREV_AR2315_R6) {
126 /* Enable WMAC AHB arbitration */
127 reg = __raw_readl((void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
128 reg |= AR5K_AR2315_AHB_ARB_CTL_WLAN;
129 __raw_writel(reg, (void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
130
131 /* Enable global WMAC swapping */
132 reg = __raw_readl((void __iomem *) AR5K_AR2315_BYTESWAP);
133 reg |= AR5K_AR2315_BYTESWAP_WMAC;
134 __raw_writel(reg, (void __iomem *) AR5K_AR2315_BYTESWAP);
135 } else {
136 /* Enable WMAC DMA access (assuming 5312 or 231x*/
137 /* TODO: check other platforms */
138 reg = __raw_readl((void __iomem *) AR5K_AR5312_ENABLE);
139 if (to_platform_device(sc->dev)->id == 0)
140 reg |= AR5K_AR5312_ENABLE_WLAN0;
141 else
142 reg |= AR5K_AR5312_ENABLE_WLAN1;
143 __raw_writel(reg, (void __iomem *) AR5K_AR5312_ENABLE);
144 }
145
146 ret = ath5k_init_softc(sc, &ath_ahb_bus_ops);
147 if (ret != 0) {
148 dev_err(&pdev->dev, "failed to attach device, err=%d\n", ret);
149 ret = -ENODEV;
150 goto err_free_hw;
151 }
152
153 platform_set_drvdata(pdev, hw);
154
155 return 0;
156
157 err_free_hw:
158 ieee80211_free_hw(hw);
159 platform_set_drvdata(pdev, NULL);
160 err_out:
161 return ret;
162}
163
164static int ath_ahb_remove(struct platform_device *pdev)
165{
166 struct ar231x_board_config *bcfg = pdev->dev.platform_data;
167 struct ieee80211_hw *hw = platform_get_drvdata(pdev);
168 struct ath5k_softc *sc;
169 u32 reg;
170
171 if (!hw)
172 return 0;
173
174 sc = hw->priv;
175
176 if (bcfg->devid >= AR5K_SREV_AR2315_R6) {
177 /* Disable WMAC AHB arbitration */
178 reg = __raw_readl((void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
179 reg &= ~AR5K_AR2315_AHB_ARB_CTL_WLAN;
180 __raw_writel(reg, (void __iomem *) AR5K_AR2315_AHB_ARB_CTL);
181 } else {
182 /*Stop DMA access */
183 reg = __raw_readl((void __iomem *) AR5K_AR5312_ENABLE);
184 if (to_platform_device(sc->dev)->id == 0)
185 reg &= ~AR5K_AR5312_ENABLE_WLAN0;
186 else
187 reg &= ~AR5K_AR5312_ENABLE_WLAN1;
188 __raw_writel(reg, (void __iomem *) AR5K_AR5312_ENABLE);
189 }
190
191 ath5k_deinit_softc(sc);
192 platform_set_drvdata(pdev, NULL);
193
194 return 0;
195}
196
197static struct platform_driver ath_ahb_driver = {
198 .probe = ath_ahb_probe,
199 .remove = ath_ahb_remove,
200 .driver = {
201 .name = "ar231x-wmac",
202 .owner = THIS_MODULE,
203 },
204};
205
206static int __init
207ath5k_ahb_init(void)
208{
209 return platform_driver_register(&ath_ahb_driver);
210}
211
212static void __exit
213ath5k_ahb_exit(void)
214{
215 platform_driver_unregister(&ath_ahb_driver);
216}
217
218module_init(ath5k_ahb_init);
219module_exit(ath5k_ahb_exit);
diff --git a/drivers/net/wireless/ath/ath5k/ani.c b/drivers/net/wireless/ath/ath5k/ani.c
index 6b75b22a929a..f915f404302d 100644
--- a/drivers/net/wireless/ath/ath5k/ani.c
+++ b/drivers/net/wireless/ath/ath5k/ani.c
@@ -58,19 +58,19 @@ ath5k_ani_set_noise_immunity_level(struct ath5k_hw *ah, int level)
58{ 58{
59 /* TODO: 59 /* TODO:
60 * ANI documents suggest the following five levels to use, but the HAL 60 * ANI documents suggest the following five levels to use, but the HAL
61 * and ath9k use only use the last two levels, making this 61 * and ath9k use only the last two levels, making this
62 * essentially an on/off option. There *may* be a reason for this (???), 62 * essentially an on/off option. There *may* be a reason for this (???),
63 * so i stick with the HAL version for now... 63 * so i stick with the HAL version for now...
64 */ 64 */
65#if 0 65#if 0
66 static const s8 hi[] = { -18, -18, -16, -14, -12 };
67 static const s8 lo[] = { -52, -56, -60, -64, -70 }; 66 static const s8 lo[] = { -52, -56, -60, -64, -70 };
67 static const s8 hi[] = { -18, -18, -16, -14, -12 };
68 static const s8 sz[] = { -34, -41, -48, -55, -62 }; 68 static const s8 sz[] = { -34, -41, -48, -55, -62 };
69 static const s8 fr[] = { -70, -72, -75, -78, -80 }; 69 static const s8 fr[] = { -70, -72, -75, -78, -80 };
70#else 70#else
71 static const s8 sz[] = { -55, -62 };
72 static const s8 lo[] = { -64, -70 }; 71 static const s8 lo[] = { -64, -70 };
73 static const s8 hi[] = { -14, -12 }; 72 static const s8 hi[] = { -14, -12 };
73 static const s8 sz[] = { -55, -62 };
74 static const s8 fr[] = { -78, -80 }; 74 static const s8 fr[] = { -78, -80 };
75#endif 75#endif
76 if (level < 0 || level >= ARRAY_SIZE(sz)) { 76 if (level < 0 || level >= ARRAY_SIZE(sz)) {
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index 2718136e4886..d6e744088bc6 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -158,15 +158,6 @@
158#define AR5K_INI_RFGAIN_5GHZ 0 158#define AR5K_INI_RFGAIN_5GHZ 0
159#define AR5K_INI_RFGAIN_2GHZ 1 159#define AR5K_INI_RFGAIN_2GHZ 1
160 160
161/* TODO: Clean this up */
162#define AR5K_INI_VAL_11A 0
163#define AR5K_INI_VAL_11A_TURBO 1
164#define AR5K_INI_VAL_11B 2
165#define AR5K_INI_VAL_11G 3
166#define AR5K_INI_VAL_11G_TURBO 4
167#define AR5K_INI_VAL_XR 0
168#define AR5K_INI_VAL_MAX 5
169
170/* 161/*
171 * Some tuneable values (these should be changeable by the user) 162 * Some tuneable values (these should be changeable by the user)
172 * TODO: Make use of them and add more options OR use debug/configfs 163 * TODO: Make use of them and add more options OR use debug/configfs
@@ -222,42 +213,66 @@
222 213
223/* Initial values */ 214/* Initial values */
224#define AR5K_INIT_CYCRSSI_THR1 2 215#define AR5K_INIT_CYCRSSI_THR1 2
225#define AR5K_INIT_TX_LATENCY 502 216
226#define AR5K_INIT_USEC 39 217/* Tx retry limits */
227#define AR5K_INIT_USEC_TURBO 79
228#define AR5K_INIT_USEC_32 31
229#define AR5K_INIT_SLOT_TIME 396
230#define AR5K_INIT_SLOT_TIME_TURBO 480
231#define AR5K_INIT_ACK_CTS_TIMEOUT 1024
232#define AR5K_INIT_ACK_CTS_TIMEOUT_TURBO 0x08000800
233#define AR5K_INIT_PROG_IFS 920
234#define AR5K_INIT_PROG_IFS_TURBO 960
235#define AR5K_INIT_EIFS 3440
236#define AR5K_INIT_EIFS_TURBO 6880
237#define AR5K_INIT_SIFS 560
238#define AR5K_INIT_SIFS_TURBO 480
239#define AR5K_INIT_SH_RETRY 10 218#define AR5K_INIT_SH_RETRY 10
240#define AR5K_INIT_LG_RETRY AR5K_INIT_SH_RETRY 219#define AR5K_INIT_LG_RETRY AR5K_INIT_SH_RETRY
220/* For station mode */
241#define AR5K_INIT_SSH_RETRY 32 221#define AR5K_INIT_SSH_RETRY 32
242#define AR5K_INIT_SLG_RETRY AR5K_INIT_SSH_RETRY 222#define AR5K_INIT_SLG_RETRY AR5K_INIT_SSH_RETRY
243#define AR5K_INIT_TX_RETRY 10 223#define AR5K_INIT_TX_RETRY 10
244 224
245#define AR5K_INIT_TRANSMIT_LATENCY ( \ 225
246 (AR5K_INIT_TX_LATENCY << 14) | (AR5K_INIT_USEC_32 << 7) | \ 226/* Slot time */
247 (AR5K_INIT_USEC) \ 227#define AR5K_INIT_SLOT_TIME_TURBO 6
248) 228#define AR5K_INIT_SLOT_TIME_DEFAULT 9
249#define AR5K_INIT_TRANSMIT_LATENCY_TURBO ( \ 229#define AR5K_INIT_SLOT_TIME_HALF_RATE 13
250 (AR5K_INIT_TX_LATENCY << 14) | (AR5K_INIT_USEC_32 << 7) | \ 230#define AR5K_INIT_SLOT_TIME_QUARTER_RATE 21
251 (AR5K_INIT_USEC_TURBO) \ 231#define AR5K_INIT_SLOT_TIME_B 20
252) 232#define AR5K_SLOT_TIME_MAX 0xffff
253#define AR5K_INIT_PROTO_TIME_CNTRL ( \ 233
254 (AR5K_INIT_CARR_SENSE_EN << 26) | (AR5K_INIT_EIFS << 12) | \ 234/* SIFS */
255 (AR5K_INIT_PROG_IFS) \ 235#define AR5K_INIT_SIFS_TURBO 6
256) 236/* XXX: 8 from initvals 10 from standard */
257#define AR5K_INIT_PROTO_TIME_CNTRL_TURBO ( \ 237#define AR5K_INIT_SIFS_DEFAULT_BG 8
258 (AR5K_INIT_CARR_SENSE_EN << 26) | (AR5K_INIT_EIFS_TURBO << 12) | \ 238#define AR5K_INIT_SIFS_DEFAULT_A 16
259 (AR5K_INIT_PROG_IFS_TURBO) \ 239#define AR5K_INIT_SIFS_HALF_RATE 32
260) 240#define AR5K_INIT_SIFS_QUARTER_RATE 64
241
242/* Used to calculate tx time for non 5/10/40MHz
243 * operation */
244/* It's preamble time + signal time (16 + 4) */
245#define AR5K_INIT_OFDM_PREAMPLE_TIME 20
246/* Preamble time for 40MHz (turbo) operation (min ?) */
247#define AR5K_INIT_OFDM_PREAMBLE_TIME_MIN 14
248#define AR5K_INIT_OFDM_SYMBOL_TIME 4
249#define AR5K_INIT_OFDM_PLCP_BITS 22
250
251/* Rx latency for 5 and 10MHz operation (max ?) */
252#define AR5K_INIT_RX_LAT_MAX 63
253/* Tx latencies from initvals (5212 only but no problem
254 * because we only tweak them on 5212) */
255#define AR5K_INIT_TX_LAT_A 54
256#define AR5K_INIT_TX_LAT_BG 384
257/* Tx latency for 40MHz (turbo) operation (min ?) */
258#define AR5K_INIT_TX_LAT_MIN 32
259/* Default Tx/Rx latencies (same for 5211)*/
260#define AR5K_INIT_TX_LATENCY_5210 54
261#define AR5K_INIT_RX_LATENCY_5210 29
262
263/* Tx frame to Tx data start delay */
264#define AR5K_INIT_TXF2TXD_START_DEFAULT 14
265#define AR5K_INIT_TXF2TXD_START_DELAY_10MHZ 12
266#define AR5K_INIT_TXF2TXD_START_DELAY_5MHZ 13
267
268/* We need to increase PHY switch and agc settling time
269 * on turbo mode */
270#define AR5K_SWITCH_SETTLING 5760
271#define AR5K_SWITCH_SETTLING_TURBO 7168
272
273#define AR5K_AGC_SETTLING 28
274/* 38 on 5210 but shouldn't matter */
275#define AR5K_AGC_SETTLING_TURBO 37
261 276
262 277
263/* GENERIC CHIPSET DEFINITIONS */ 278/* GENERIC CHIPSET DEFINITIONS */
@@ -304,12 +319,19 @@ struct ath5k_srev_name {
304#define AR5K_SREV_AR5311B 0x30 /* Spirit */ 319#define AR5K_SREV_AR5311B 0x30 /* Spirit */
305#define AR5K_SREV_AR5211 0x40 /* Oahu */ 320#define AR5K_SREV_AR5211 0x40 /* Oahu */
306#define AR5K_SREV_AR5212 0x50 /* Venice */ 321#define AR5K_SREV_AR5212 0x50 /* Venice */
322#define AR5K_SREV_AR5312_R2 0x52 /* AP31 */
307#define AR5K_SREV_AR5212_V4 0x54 /* ??? */ 323#define AR5K_SREV_AR5212_V4 0x54 /* ??? */
308#define AR5K_SREV_AR5213 0x55 /* ??? */ 324#define AR5K_SREV_AR5213 0x55 /* ??? */
325#define AR5K_SREV_AR5312_R7 0x57 /* AP30 */
326#define AR5K_SREV_AR2313_R8 0x58 /* AP43 */
309#define AR5K_SREV_AR5213A 0x59 /* Hainan */ 327#define AR5K_SREV_AR5213A 0x59 /* Hainan */
310#define AR5K_SREV_AR2413 0x78 /* Griffin lite */ 328#define AR5K_SREV_AR2413 0x78 /* Griffin lite */
311#define AR5K_SREV_AR2414 0x70 /* Griffin */ 329#define AR5K_SREV_AR2414 0x70 /* Griffin */
330#define AR5K_SREV_AR2315_R6 0x86 /* AP51-Light */
331#define AR5K_SREV_AR2315_R7 0x87 /* AP51-Full */
312#define AR5K_SREV_AR5424 0x90 /* Condor */ 332#define AR5K_SREV_AR5424 0x90 /* Condor */
333#define AR5K_SREV_AR2317_R1 0x90 /* AP61-Light */
334#define AR5K_SREV_AR2317_R2 0x91 /* AP61-Full */
313#define AR5K_SREV_AR5413 0xa4 /* Eagle lite */ 335#define AR5K_SREV_AR5413 0xa4 /* Eagle lite */
314#define AR5K_SREV_AR5414 0xa0 /* Eagle */ 336#define AR5K_SREV_AR5414 0xa0 /* Eagle */
315#define AR5K_SREV_AR2415 0xb0 /* Talon */ 337#define AR5K_SREV_AR2415 0xb0 /* Talon */
@@ -405,12 +427,10 @@ struct ath5k_srev_name {
405 427
406enum ath5k_driver_mode { 428enum ath5k_driver_mode {
407 AR5K_MODE_11A = 0, 429 AR5K_MODE_11A = 0,
408 AR5K_MODE_11A_TURBO = 1, 430 AR5K_MODE_11B = 1,
409 AR5K_MODE_11B = 2, 431 AR5K_MODE_11G = 2,
410 AR5K_MODE_11G = 3,
411 AR5K_MODE_11G_TURBO = 4,
412 AR5K_MODE_XR = 0, 432 AR5K_MODE_XR = 0,
413 AR5K_MODE_MAX = 5 433 AR5K_MODE_MAX = 3
414}; 434};
415 435
416enum ath5k_ant_mode { 436enum ath5k_ant_mode {
@@ -424,6 +444,12 @@ enum ath5k_ant_mode {
424 AR5K_ANTMODE_MAX, 444 AR5K_ANTMODE_MAX,
425}; 445};
426 446
447enum ath5k_bw_mode {
448 AR5K_BWMODE_DEFAULT = 0, /* 20MHz, default operation */
449 AR5K_BWMODE_5MHZ = 1, /* Quarter rate */
450 AR5K_BWMODE_10MHZ = 2, /* Half rate */
451 AR5K_BWMODE_40MHZ = 3 /* Turbo */
452};
427 453
428/****************\ 454/****************\
429 TX DEFINITIONS 455 TX DEFINITIONS
@@ -656,7 +682,6 @@ struct ath5k_gain {
656 682
657/* channel_flags */ 683/* channel_flags */
658#define CHANNEL_CW_INT 0x0008 /* Contention Window interference detected */ 684#define CHANNEL_CW_INT 0x0008 /* Contention Window interference detected */
659#define CHANNEL_TURBO 0x0010 /* Turbo Channel */
660#define CHANNEL_CCK 0x0020 /* CCK channel */ 685#define CHANNEL_CCK 0x0020 /* CCK channel */
661#define CHANNEL_OFDM 0x0040 /* OFDM channel */ 686#define CHANNEL_OFDM 0x0040 /* OFDM channel */
662#define CHANNEL_2GHZ 0x0080 /* 2GHz channel. */ 687#define CHANNEL_2GHZ 0x0080 /* 2GHz channel. */
@@ -668,16 +693,10 @@ struct ath5k_gain {
668#define CHANNEL_A (CHANNEL_5GHZ|CHANNEL_OFDM) 693#define CHANNEL_A (CHANNEL_5GHZ|CHANNEL_OFDM)
669#define CHANNEL_B (CHANNEL_2GHZ|CHANNEL_CCK) 694#define CHANNEL_B (CHANNEL_2GHZ|CHANNEL_CCK)
670#define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_OFDM) 695#define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_OFDM)
671#define CHANNEL_T (CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_TURBO)
672#define CHANNEL_TG (CHANNEL_2GHZ|CHANNEL_OFDM|CHANNEL_TURBO)
673#define CHANNEL_108A CHANNEL_T
674#define CHANNEL_108G CHANNEL_TG
675#define CHANNEL_X (CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_XR) 696#define CHANNEL_X (CHANNEL_5GHZ|CHANNEL_OFDM|CHANNEL_XR)
676 697
677#define CHANNEL_ALL (CHANNEL_OFDM|CHANNEL_CCK|CHANNEL_2GHZ|CHANNEL_5GHZ| \ 698#define CHANNEL_ALL (CHANNEL_OFDM|CHANNEL_CCK|CHANNEL_2GHZ|CHANNEL_5GHZ)
678 CHANNEL_TURBO)
679 699
680#define CHANNEL_ALL_NOTURBO (CHANNEL_ALL & ~CHANNEL_TURBO)
681#define CHANNEL_MODES CHANNEL_ALL 700#define CHANNEL_MODES CHANNEL_ALL
682 701
683/* 702/*
@@ -1026,7 +1045,6 @@ struct ath5k_hw {
1026 enum ath5k_int ah_imr; 1045 enum ath5k_int ah_imr;
1027 1046
1028 struct ieee80211_channel *ah_current_channel; 1047 struct ieee80211_channel *ah_current_channel;
1029 bool ah_turbo;
1030 bool ah_calibration; 1048 bool ah_calibration;
1031 bool ah_single_chip; 1049 bool ah_single_chip;
1032 1050
@@ -1035,6 +1053,7 @@ struct ath5k_hw {
1035 u32 ah_phy; 1053 u32 ah_phy;
1036 u32 ah_mac_srev; 1054 u32 ah_mac_srev;
1037 u16 ah_mac_version; 1055 u16 ah_mac_version;
1056 u16 ah_mac_revision;
1038 u16 ah_phy_revision; 1057 u16 ah_phy_revision;
1039 u16 ah_radio_5ghz_revision; 1058 u16 ah_radio_5ghz_revision;
1040 u16 ah_radio_2ghz_revision; 1059 u16 ah_radio_2ghz_revision;
@@ -1044,6 +1063,8 @@ struct ath5k_hw {
1044 1063
1045 u32 ah_limit_tx_retries; 1064 u32 ah_limit_tx_retries;
1046 u8 ah_coverage_class; 1065 u8 ah_coverage_class;
1066 bool ah_ack_bitrate_high;
1067 u8 ah_bwmode;
1047 1068
1048 /* Antenna Control */ 1069 /* Antenna Control */
1049 u32 ah_ant_ctl[AR5K_EEPROM_N_MODES][AR5K_ANT_MAX]; 1070 u32 ah_ant_ctl[AR5K_EEPROM_N_MODES][AR5K_ANT_MAX];
@@ -1132,36 +1153,50 @@ struct ath5k_hw {
1132/* 1153/*
1133 * Prototypes 1154 * Prototypes
1134 */ 1155 */
1156extern const struct ieee80211_ops ath5k_hw_ops;
1135 1157
1136/* Attach/Detach Functions */ 1158/* Initialization and detach functions */
1137int ath5k_hw_attach(struct ath5k_softc *sc); 1159int ath5k_init_softc(struct ath5k_softc *sc, const struct ath_bus_ops *bus_ops);
1138void ath5k_hw_detach(struct ath5k_hw *ah); 1160void ath5k_deinit_softc(struct ath5k_softc *sc);
1161int ath5k_hw_init(struct ath5k_softc *sc);
1162void ath5k_hw_deinit(struct ath5k_hw *ah);
1139 1163
1140int ath5k_sysfs_register(struct ath5k_softc *sc); 1164int ath5k_sysfs_register(struct ath5k_softc *sc);
1141void ath5k_sysfs_unregister(struct ath5k_softc *sc); 1165void ath5k_sysfs_unregister(struct ath5k_softc *sc);
1142 1166
1167/*Chip id helper functions */
1168const char *ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val);
1169int ath5k_hw_read_srev(struct ath5k_hw *ah);
1170
1143/* LED functions */ 1171/* LED functions */
1144int ath5k_init_leds(struct ath5k_softc *sc); 1172int ath5k_init_leds(struct ath5k_softc *sc);
1145void ath5k_led_enable(struct ath5k_softc *sc); 1173void ath5k_led_enable(struct ath5k_softc *sc);
1146void ath5k_led_off(struct ath5k_softc *sc); 1174void ath5k_led_off(struct ath5k_softc *sc);
1147void ath5k_unregister_leds(struct ath5k_softc *sc); 1175void ath5k_unregister_leds(struct ath5k_softc *sc);
1148 1176
1177
1149/* Reset Functions */ 1178/* Reset Functions */
1150int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial); 1179int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial);
1151int ath5k_hw_on_hold(struct ath5k_hw *ah); 1180int ath5k_hw_on_hold(struct ath5k_hw *ah);
1152int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, 1181int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
1153 struct ieee80211_channel *channel, bool change_channel); 1182 struct ieee80211_channel *channel, bool fast, bool skip_pcu);
1154int ath5k_hw_register_timeout(struct ath5k_hw *ah, u32 reg, u32 flag, u32 val, 1183int ath5k_hw_register_timeout(struct ath5k_hw *ah, u32 reg, u32 flag, u32 val,
1155 bool is_set); 1184 bool is_set);
1156/* Power management functions */ 1185/* Power management functions */
1157 1186
1187
1188/* Clock rate related functions */
1189unsigned int ath5k_hw_htoclock(struct ath5k_hw *ah, unsigned int usec);
1190unsigned int ath5k_hw_clocktoh(struct ath5k_hw *ah, unsigned int clock);
1191void ath5k_hw_set_clockrate(struct ath5k_hw *ah);
1192
1193
1158/* DMA Related Functions */ 1194/* DMA Related Functions */
1159void ath5k_hw_start_rx_dma(struct ath5k_hw *ah); 1195void ath5k_hw_start_rx_dma(struct ath5k_hw *ah);
1160int ath5k_hw_stop_rx_dma(struct ath5k_hw *ah);
1161u32 ath5k_hw_get_rxdp(struct ath5k_hw *ah); 1196u32 ath5k_hw_get_rxdp(struct ath5k_hw *ah);
1162void ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr); 1197int ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr);
1163int ath5k_hw_start_tx_dma(struct ath5k_hw *ah, unsigned int queue); 1198int ath5k_hw_start_tx_dma(struct ath5k_hw *ah, unsigned int queue);
1164int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue); 1199int ath5k_hw_stop_beacon_queue(struct ath5k_hw *ah, unsigned int queue);
1165u32 ath5k_hw_get_txdp(struct ath5k_hw *ah, unsigned int queue); 1200u32 ath5k_hw_get_txdp(struct ath5k_hw *ah, unsigned int queue);
1166int ath5k_hw_set_txdp(struct ath5k_hw *ah, unsigned int queue, 1201int ath5k_hw_set_txdp(struct ath5k_hw *ah, unsigned int queue,
1167 u32 phys_addr); 1202 u32 phys_addr);
@@ -1171,38 +1206,43 @@ bool ath5k_hw_is_intr_pending(struct ath5k_hw *ah);
1171int ath5k_hw_get_isr(struct ath5k_hw *ah, enum ath5k_int *interrupt_mask); 1206int ath5k_hw_get_isr(struct ath5k_hw *ah, enum ath5k_int *interrupt_mask);
1172enum ath5k_int ath5k_hw_set_imr(struct ath5k_hw *ah, enum ath5k_int new_mask); 1207enum ath5k_int ath5k_hw_set_imr(struct ath5k_hw *ah, enum ath5k_int new_mask);
1173void ath5k_hw_update_mib_counters(struct ath5k_hw *ah); 1208void ath5k_hw_update_mib_counters(struct ath5k_hw *ah);
1209/* Init/Stop functions */
1210void ath5k_hw_dma_init(struct ath5k_hw *ah);
1211int ath5k_hw_dma_stop(struct ath5k_hw *ah);
1174 1212
1175/* EEPROM access functions */ 1213/* EEPROM access functions */
1176int ath5k_eeprom_init(struct ath5k_hw *ah); 1214int ath5k_eeprom_init(struct ath5k_hw *ah);
1177void ath5k_eeprom_detach(struct ath5k_hw *ah); 1215void ath5k_eeprom_detach(struct ath5k_hw *ah);
1178int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac); 1216int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac);
1179 1217
1218
1180/* Protocol Control Unit Functions */ 1219/* Protocol Control Unit Functions */
1220/* Helpers */
1221int ath5k_hw_get_frame_duration(struct ath5k_hw *ah,
1222 int len, struct ieee80211_rate *rate);
1223unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah);
1224unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah);
1181extern int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype opmode); 1225extern int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype opmode);
1182void ath5k_hw_set_coverage_class(struct ath5k_hw *ah, u8 coverage_class); 1226void ath5k_hw_set_coverage_class(struct ath5k_hw *ah, u8 coverage_class);
1183/* BSSID Functions */ 1227/* RX filter control*/
1184int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac); 1228int ath5k_hw_set_lladdr(struct ath5k_hw *ah, const u8 *mac);
1185void ath5k_hw_set_bssid(struct ath5k_hw *ah); 1229void ath5k_hw_set_bssid(struct ath5k_hw *ah);
1186void ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask); 1230void ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask);
1187/* Receive start/stop functions */
1188void ath5k_hw_start_rx_pcu(struct ath5k_hw *ah);
1189void ath5k_hw_stop_rx_pcu(struct ath5k_hw *ah);
1190/* RX Filter functions */
1191void ath5k_hw_set_mcast_filter(struct ath5k_hw *ah, u32 filter0, u32 filter1); 1231void ath5k_hw_set_mcast_filter(struct ath5k_hw *ah, u32 filter0, u32 filter1);
1192u32 ath5k_hw_get_rx_filter(struct ath5k_hw *ah); 1232u32 ath5k_hw_get_rx_filter(struct ath5k_hw *ah);
1193void ath5k_hw_set_rx_filter(struct ath5k_hw *ah, u32 filter); 1233void ath5k_hw_set_rx_filter(struct ath5k_hw *ah, u32 filter);
1234/* Receive (DRU) start/stop functions */
1235void ath5k_hw_start_rx_pcu(struct ath5k_hw *ah);
1236void ath5k_hw_stop_rx_pcu(struct ath5k_hw *ah);
1194/* Beacon control functions */ 1237/* Beacon control functions */
1195u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah); 1238u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah);
1196void ath5k_hw_set_tsf64(struct ath5k_hw *ah, u64 tsf64); 1239void ath5k_hw_set_tsf64(struct ath5k_hw *ah, u64 tsf64);
1197void ath5k_hw_reset_tsf(struct ath5k_hw *ah); 1240void ath5k_hw_reset_tsf(struct ath5k_hw *ah);
1198void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval); 1241void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval);
1199bool ath5k_hw_check_beacon_timers(struct ath5k_hw *ah, int intval); 1242bool ath5k_hw_check_beacon_timers(struct ath5k_hw *ah, int intval);
1200/* ACK bit rate */ 1243/* Init function */
1201void ath5k_hw_set_ack_bitrate_high(struct ath5k_hw *ah, bool high); 1244void ath5k_hw_pcu_init(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
1202/* Clock rate related functions */ 1245 u8 mode);
1203unsigned int ath5k_hw_htoclock(struct ath5k_hw *ah, unsigned int usec);
1204unsigned int ath5k_hw_clocktoh(struct ath5k_hw *ah, unsigned int clock);
1205void ath5k_hw_set_clockrate(struct ath5k_hw *ah);
1206 1246
1207/* Queue Control Unit, DFS Control Unit Functions */ 1247/* Queue Control Unit, DFS Control Unit Functions */
1208int ath5k_hw_get_tx_queueprops(struct ath5k_hw *ah, int queue, 1248int ath5k_hw_get_tx_queueprops(struct ath5k_hw *ah, int queue,
@@ -1215,7 +1255,9 @@ int ath5k_hw_setup_tx_queue(struct ath5k_hw *ah,
1215u32 ath5k_hw_num_tx_pending(struct ath5k_hw *ah, unsigned int queue); 1255u32 ath5k_hw_num_tx_pending(struct ath5k_hw *ah, unsigned int queue);
1216void ath5k_hw_release_tx_queue(struct ath5k_hw *ah, unsigned int queue); 1256void ath5k_hw_release_tx_queue(struct ath5k_hw *ah, unsigned int queue);
1217int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue); 1257int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue);
1218int ath5k_hw_set_slot_time(struct ath5k_hw *ah, unsigned int slot_time); 1258int ath5k_hw_set_ifs_intervals(struct ath5k_hw *ah, unsigned int slot_time);
1259/* Init function */
1260int ath5k_hw_init_queues(struct ath5k_hw *ah);
1219 1261
1220/* Hardware Descriptor Functions */ 1262/* Hardware Descriptor Functions */
1221int ath5k_hw_init_desc_functions(struct ath5k_hw *ah); 1263int ath5k_hw_init_desc_functions(struct ath5k_hw *ah);
@@ -1225,6 +1267,7 @@ int ath5k_hw_setup_mrr_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
1225 unsigned int tx_rate1, u_int tx_tries1, u_int tx_rate2, 1267 unsigned int tx_rate1, u_int tx_tries1, u_int tx_rate2,
1226 u_int tx_tries2, unsigned int tx_rate3, u_int tx_tries3); 1268 u_int tx_tries2, unsigned int tx_rate3, u_int tx_tries3);
1227 1269
1270
1228/* GPIO Functions */ 1271/* GPIO Functions */
1229void ath5k_hw_set_ledstate(struct ath5k_hw *ah, unsigned int state); 1272void ath5k_hw_set_ledstate(struct ath5k_hw *ah, unsigned int state);
1230int ath5k_hw_set_gpio_input(struct ath5k_hw *ah, u32 gpio); 1273int ath5k_hw_set_gpio_input(struct ath5k_hw *ah, u32 gpio);
@@ -1234,11 +1277,13 @@ int ath5k_hw_set_gpio(struct ath5k_hw *ah, u32 gpio, u32 val);
1234void ath5k_hw_set_gpio_intr(struct ath5k_hw *ah, unsigned int gpio, 1277void ath5k_hw_set_gpio_intr(struct ath5k_hw *ah, unsigned int gpio,
1235 u32 interrupt_level); 1278 u32 interrupt_level);
1236 1279
1237/* rfkill Functions */ 1280
1281/* RFkill Functions */
1238void ath5k_rfkill_hw_start(struct ath5k_hw *ah); 1282void ath5k_rfkill_hw_start(struct ath5k_hw *ah);
1239void ath5k_rfkill_hw_stop(struct ath5k_hw *ah); 1283void ath5k_rfkill_hw_stop(struct ath5k_hw *ah);
1240 1284
1241/* Misc functions */ 1285
1286/* Misc functions TODO: Cleanup */
1242int ath5k_hw_set_capabilities(struct ath5k_hw *ah); 1287int ath5k_hw_set_capabilities(struct ath5k_hw *ah);
1243int ath5k_hw_get_capability(struct ath5k_hw *ah, 1288int ath5k_hw_get_capability(struct ath5k_hw *ah,
1244 enum ath5k_capability_type cap_type, u32 capability, 1289 enum ath5k_capability_type cap_type, u32 capability,
@@ -1246,19 +1291,20 @@ int ath5k_hw_get_capability(struct ath5k_hw *ah,
1246int ath5k_hw_enable_pspoll(struct ath5k_hw *ah, u8 *bssid, u16 assoc_id); 1291int ath5k_hw_enable_pspoll(struct ath5k_hw *ah, u8 *bssid, u16 assoc_id);
1247int ath5k_hw_disable_pspoll(struct ath5k_hw *ah); 1292int ath5k_hw_disable_pspoll(struct ath5k_hw *ah);
1248 1293
1294
1249/* Initial register settings functions */ 1295/* Initial register settings functions */
1250int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel); 1296int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel);
1251 1297
1252/* Initialize RF */ 1298
1253int ath5k_hw_rfregs_init(struct ath5k_hw *ah, 1299/* PHY functions */
1254 struct ieee80211_channel *channel, 1300/* Misc PHY functions */
1255 unsigned int mode); 1301u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, unsigned int chan);
1256int ath5k_hw_rfgain_init(struct ath5k_hw *ah, unsigned int freq); 1302int ath5k_hw_phy_disable(struct ath5k_hw *ah);
1303/* Gain_F optimization */
1257enum ath5k_rfgain ath5k_hw_gainf_calibrate(struct ath5k_hw *ah); 1304enum ath5k_rfgain ath5k_hw_gainf_calibrate(struct ath5k_hw *ah);
1258int ath5k_hw_rfgain_opt_init(struct ath5k_hw *ah); 1305int ath5k_hw_rfgain_opt_init(struct ath5k_hw *ah);
1259/* PHY/RF channel functions */ 1306/* PHY/RF channel functions */
1260bool ath5k_channel_ok(struct ath5k_hw *ah, u16 freq, unsigned int flags); 1307bool ath5k_channel_ok(struct ath5k_hw *ah, u16 freq, unsigned int flags);
1261int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel);
1262/* PHY calibration */ 1308/* PHY calibration */
1263void ath5k_hw_init_nfcal_hist(struct ath5k_hw *ah); 1309void ath5k_hw_init_nfcal_hist(struct ath5k_hw *ah);
1264int ath5k_hw_phy_calibrate(struct ath5k_hw *ah, 1310int ath5k_hw_phy_calibrate(struct ath5k_hw *ah,
@@ -1267,18 +1313,14 @@ void ath5k_hw_update_noise_floor(struct ath5k_hw *ah);
1267/* Spur mitigation */ 1313/* Spur mitigation */
1268bool ath5k_hw_chan_has_spur_noise(struct ath5k_hw *ah, 1314bool ath5k_hw_chan_has_spur_noise(struct ath5k_hw *ah,
1269 struct ieee80211_channel *channel); 1315 struct ieee80211_channel *channel);
1270void ath5k_hw_set_spur_mitigation_filter(struct ath5k_hw *ah,
1271 struct ieee80211_channel *channel);
1272/* Misc PHY functions */
1273u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, unsigned int chan);
1274int ath5k_hw_phy_disable(struct ath5k_hw *ah);
1275/* Antenna control */ 1316/* Antenna control */
1276void ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode); 1317void ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode);
1277void ath5k_hw_set_antenna_switch(struct ath5k_hw *ah, u8 ee_mode); 1318void ath5k_hw_set_antenna_switch(struct ath5k_hw *ah, u8 ee_mode);
1278/* TX power setup */ 1319/* TX power setup */
1279int ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
1280 u8 ee_mode, u8 txpower);
1281int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower); 1320int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower);
1321/* Init function */
1322int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
1323 u8 mode, u8 ee_mode, u8 freq, bool fast);
1282 1324
1283/* 1325/*
1284 * Functions used internaly 1326 * Functions used internaly
@@ -1294,6 +1336,32 @@ static inline struct ath_regulatory *ath5k_hw_regulatory(struct ath5k_hw *ah)
1294 return &(ath5k_hw_common(ah)->regulatory); 1336 return &(ath5k_hw_common(ah)->regulatory);
1295} 1337}
1296 1338
1339#ifdef CONFIG_ATHEROS_AR231X
1340#define AR5K_AR2315_PCI_BASE ((void __iomem *)0xb0100000)
1341
1342static inline void __iomem *ath5k_ahb_reg(struct ath5k_hw *ah, u16 reg)
1343{
1344 /* On AR2315 and AR2317 the PCI clock domain registers
1345 * are outside of the WMAC register space */
1346 if (unlikely((reg >= 0x4000) && (reg < 0x5000) &&
1347 (ah->ah_mac_srev >= AR5K_SREV_AR2315_R6)))
1348 return AR5K_AR2315_PCI_BASE + reg;
1349
1350 return ah->ah_iobase + reg;
1351}
1352
1353static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
1354{
1355 return __raw_readl(ath5k_ahb_reg(ah, reg));
1356}
1357
1358static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
1359{
1360 __raw_writel(val, ath5k_ahb_reg(ah, reg));
1361}
1362
1363#else
1364
1297static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg) 1365static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
1298{ 1366{
1299 return ioread32(ah->ah_iobase + reg); 1367 return ioread32(ah->ah_iobase + reg);
@@ -1304,6 +1372,24 @@ static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
1304 iowrite32(val, ah->ah_iobase + reg); 1372 iowrite32(val, ah->ah_iobase + reg);
1305} 1373}
1306 1374
1375#endif
1376
1377static inline enum ath_bus_type ath5k_get_bus_type(struct ath5k_hw *ah)
1378{
1379 return ath5k_hw_common(ah)->bus_ops->ath_bus_type;
1380}
1381
1382static inline void ath5k_read_cachesize(struct ath_common *common, int *csz)
1383{
1384 common->bus_ops->read_cachesize(common, csz);
1385}
1386
1387static inline bool ath5k_hw_nvram_read(struct ath5k_hw *ah, u32 off, u16 *data)
1388{
1389 struct ath_common *common = ath5k_hw_common(ah);
1390 return common->bus_ops->eeprom_read(common, off, data);
1391}
1392
1307static inline u32 ath5k_hw_bitswap(u32 val, unsigned int bits) 1393static inline u32 ath5k_hw_bitswap(u32 val, unsigned int bits)
1308{ 1394{
1309 u32 retval = 0, bit, i; 1395 u32 retval = 0, bit, i;
diff --git a/drivers/net/wireless/ath/ath5k/attach.c b/drivers/net/wireless/ath/ath5k/attach.c
index fbe8aca975d8..9dbc1fa81795 100644
--- a/drivers/net/wireless/ath/ath5k/attach.c
+++ b/drivers/net/wireless/ath/ath5k/attach.c
@@ -93,16 +93,16 @@ static int ath5k_hw_post(struct ath5k_hw *ah)
93} 93}
94 94
95/** 95/**
96 * ath5k_hw_attach - Check if hw is supported and init the needed structs 96 * ath5k_hw_init - Check if hw is supported and init the needed structs
97 * 97 *
98 * @sc: The &struct ath5k_softc we got from the driver's attach function 98 * @sc: The &struct ath5k_softc we got from the driver's init_softc function
99 * 99 *
100 * Check if the device is supported, perform a POST and initialize the needed 100 * Check if the device is supported, perform a POST and initialize the needed
101 * structs. Returns -ENOMEM if we don't have memory for the needed structs, 101 * structs. Returns -ENOMEM if we don't have memory for the needed structs,
102 * -ENODEV if the device is not supported or prints an error msg if something 102 * -ENODEV if the device is not supported or prints an error msg if something
103 * else went wrong. 103 * else went wrong.
104 */ 104 */
105int ath5k_hw_attach(struct ath5k_softc *sc) 105int ath5k_hw_init(struct ath5k_softc *sc)
106{ 106{
107 struct ath5k_hw *ah = sc->ah; 107 struct ath5k_hw *ah = sc->ah;
108 struct ath_common *common = ath5k_hw_common(ah); 108 struct ath_common *common = ath5k_hw_common(ah);
@@ -115,7 +115,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc)
115 * HW information 115 * HW information
116 */ 116 */
117 ah->ah_radar.r_enabled = AR5K_TUNE_RADAR_ALERT; 117 ah->ah_radar.r_enabled = AR5K_TUNE_RADAR_ALERT;
118 ah->ah_turbo = false; 118 ah->ah_bwmode = AR5K_BWMODE_DEFAULT;
119 ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER; 119 ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER;
120 ah->ah_imr = 0; 120 ah->ah_imr = 0;
121 ah->ah_limit_tx_retries = AR5K_INIT_TX_RETRY; 121 ah->ah_limit_tx_retries = AR5K_INIT_TX_RETRY;
@@ -128,7 +128,8 @@ int ath5k_hw_attach(struct ath5k_softc *sc)
128 /* 128 /*
129 * Find the mac version 129 * Find the mac version
130 */ 130 */
131 srev = ath5k_hw_reg_read(ah, AR5K_SREV); 131 ath5k_hw_read_srev(ah);
132 srev = ah->ah_mac_srev;
132 if (srev < AR5K_SREV_AR5311) 133 if (srev < AR5K_SREV_AR5311)
133 ah->ah_version = AR5K_AR5210; 134 ah->ah_version = AR5K_AR5210;
134 else if (srev < AR5K_SREV_AR5212) 135 else if (srev < AR5K_SREV_AR5212)
@@ -136,6 +137,10 @@ int ath5k_hw_attach(struct ath5k_softc *sc)
136 else 137 else
137 ah->ah_version = AR5K_AR5212; 138 ah->ah_version = AR5K_AR5212;
138 139
140 /* Get the MAC revision */
141 ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER);
142 ah->ah_mac_revision = AR5K_REG_MS(srev, AR5K_SREV_REV);
143
139 /* Fill the ath5k_hw struct with the needed functions */ 144 /* Fill the ath5k_hw struct with the needed functions */
140 ret = ath5k_hw_init_desc_functions(ah); 145 ret = ath5k_hw_init_desc_functions(ah);
141 if (ret) 146 if (ret)
@@ -146,9 +151,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc)
146 if (ret) 151 if (ret)
147 goto err; 152 goto err;
148 153
149 /* Get MAC, PHY and RADIO revisions */ 154 /* Get PHY and RADIO revisions */
150 ah->ah_mac_srev = srev;
151 ah->ah_mac_version = AR5K_REG_MS(srev, AR5K_SREV_VER);
152 ah->ah_phy_revision = ath5k_hw_reg_read(ah, AR5K_PHY_CHIP_ID) & 155 ah->ah_phy_revision = ath5k_hw_reg_read(ah, AR5K_PHY_CHIP_ID) &
153 0xffffffff; 156 0xffffffff;
154 ah->ah_radio_5ghz_revision = ath5k_hw_radio_revision(ah, 157 ah->ah_radio_5ghz_revision = ath5k_hw_radio_revision(ah,
@@ -273,7 +276,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc)
273 /* 276 /*
274 * Write PCI-E power save settings 277 * Write PCI-E power save settings
275 */ 278 */
276 if ((ah->ah_version == AR5K_AR5212) && (pdev->is_pcie)) { 279 if ((ah->ah_version == AR5K_AR5212) && pdev && (pdev->is_pcie)) {
277 ath5k_hw_reg_write(ah, 0x9248fc00, AR5K_PCIE_SERDES); 280 ath5k_hw_reg_write(ah, 0x9248fc00, AR5K_PCIE_SERDES);
278 ath5k_hw_reg_write(ah, 0x24924924, AR5K_PCIE_SERDES); 281 ath5k_hw_reg_write(ah, 0x24924924, AR5K_PCIE_SERDES);
279 282
@@ -305,8 +308,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc)
305 /* Get misc capabilities */ 308 /* Get misc capabilities */
306 ret = ath5k_hw_set_capabilities(ah); 309 ret = ath5k_hw_set_capabilities(ah);
307 if (ret) { 310 if (ret) {
308 ATH5K_ERR(sc, "unable to get device capabilities: 0x%04x\n", 311 ATH5K_ERR(sc, "unable to get device capabilities\n");
309 sc->pdev->device);
310 goto err; 312 goto err;
311 } 313 }
312 314
@@ -346,11 +348,11 @@ err:
346} 348}
347 349
348/** 350/**
349 * ath5k_hw_detach - Free the ath5k_hw struct 351 * ath5k_hw_deinit - Free the ath5k_hw struct
350 * 352 *
351 * @ah: The &struct ath5k_hw 353 * @ah: The &struct ath5k_hw
352 */ 354 */
353void ath5k_hw_detach(struct ath5k_hw *ah) 355void ath5k_hw_deinit(struct ath5k_hw *ah)
354{ 356{
355 __set_bit(ATH_STAT_INVALID, ah->ah_sc->status); 357 __set_bit(ATH_STAT_INVALID, ah->ah_sc->status);
356 358
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 7f783d9462aa..0a7071a6dd7a 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -47,8 +47,6 @@
47#include <linux/io.h> 47#include <linux/io.h>
48#include <linux/netdevice.h> 48#include <linux/netdevice.h>
49#include <linux/cache.h> 49#include <linux/cache.h>
50#include <linux/pci.h>
51#include <linux/pci-aspm.h>
52#include <linux/ethtool.h> 50#include <linux/ethtool.h>
53#include <linux/uaccess.h> 51#include <linux/uaccess.h>
54#include <linux/slab.h> 52#include <linux/slab.h>
@@ -80,37 +78,24 @@ MODULE_SUPPORTED_DEVICE("Atheros 5xxx WLAN cards");
80MODULE_LICENSE("Dual BSD/GPL"); 78MODULE_LICENSE("Dual BSD/GPL");
81MODULE_VERSION("0.6.0 (EXPERIMENTAL)"); 79MODULE_VERSION("0.6.0 (EXPERIMENTAL)");
82 80
83static int ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan); 81static int ath5k_init(struct ieee80211_hw *hw);
82static int ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan,
83 bool skip_pcu);
84static int ath5k_beacon_update(struct ieee80211_hw *hw, 84static int ath5k_beacon_update(struct ieee80211_hw *hw,
85 struct ieee80211_vif *vif); 85 struct ieee80211_vif *vif);
86static void ath5k_beacon_update_timers(struct ath5k_softc *sc, u64 bc_tsf); 86static void ath5k_beacon_update_timers(struct ath5k_softc *sc, u64 bc_tsf);
87 87
88/* Known PCI ids */
89static DEFINE_PCI_DEVICE_TABLE(ath5k_pci_id_table) = {
90 { PCI_VDEVICE(ATHEROS, 0x0207) }, /* 5210 early */
91 { PCI_VDEVICE(ATHEROS, 0x0007) }, /* 5210 */
92 { PCI_VDEVICE(ATHEROS, 0x0011) }, /* 5311 - this is on AHB bus !*/
93 { PCI_VDEVICE(ATHEROS, 0x0012) }, /* 5211 */
94 { PCI_VDEVICE(ATHEROS, 0x0013) }, /* 5212 */
95 { PCI_VDEVICE(3COM_2, 0x0013) }, /* 3com 5212 */
96 { PCI_VDEVICE(3COM, 0x0013) }, /* 3com 3CRDAG675 5212 */
97 { PCI_VDEVICE(ATHEROS, 0x1014) }, /* IBM minipci 5212 */
98 { PCI_VDEVICE(ATHEROS, 0x0014) }, /* 5212 combatible */
99 { PCI_VDEVICE(ATHEROS, 0x0015) }, /* 5212 combatible */
100 { PCI_VDEVICE(ATHEROS, 0x0016) }, /* 5212 combatible */
101 { PCI_VDEVICE(ATHEROS, 0x0017) }, /* 5212 combatible */
102 { PCI_VDEVICE(ATHEROS, 0x0018) }, /* 5212 combatible */
103 { PCI_VDEVICE(ATHEROS, 0x0019) }, /* 5212 combatible */
104 { PCI_VDEVICE(ATHEROS, 0x001a) }, /* 2413 Griffin-lite */
105 { PCI_VDEVICE(ATHEROS, 0x001b) }, /* 5413 Eagle */
106 { PCI_VDEVICE(ATHEROS, 0x001c) }, /* PCI-E cards */
107 { PCI_VDEVICE(ATHEROS, 0x001d) }, /* 2417 Nala */
108 { 0 }
109};
110MODULE_DEVICE_TABLE(pci, ath5k_pci_id_table);
111
112/* Known SREVs */ 88/* Known SREVs */
113static const struct ath5k_srev_name srev_names[] = { 89static const struct ath5k_srev_name srev_names[] = {
90#ifdef CONFIG_ATHEROS_AR231X
91 { "5312", AR5K_VERSION_MAC, AR5K_SREV_AR5312_R2 },
92 { "5312", AR5K_VERSION_MAC, AR5K_SREV_AR5312_R7 },
93 { "2313", AR5K_VERSION_MAC, AR5K_SREV_AR2313_R8 },
94 { "2315", AR5K_VERSION_MAC, AR5K_SREV_AR2315_R6 },
95 { "2315", AR5K_VERSION_MAC, AR5K_SREV_AR2315_R7 },
96 { "2317", AR5K_VERSION_MAC, AR5K_SREV_AR2317_R1 },
97 { "2317", AR5K_VERSION_MAC, AR5K_SREV_AR2317_R2 },
98#else
114 { "5210", AR5K_VERSION_MAC, AR5K_SREV_AR5210 }, 99 { "5210", AR5K_VERSION_MAC, AR5K_SREV_AR5210 },
115 { "5311", AR5K_VERSION_MAC, AR5K_SREV_AR5311 }, 100 { "5311", AR5K_VERSION_MAC, AR5K_SREV_AR5311 },
116 { "5311A", AR5K_VERSION_MAC, AR5K_SREV_AR5311A }, 101 { "5311A", AR5K_VERSION_MAC, AR5K_SREV_AR5311A },
@@ -129,6 +114,7 @@ static const struct ath5k_srev_name srev_names[] = {
129 { "5418", AR5K_VERSION_MAC, AR5K_SREV_AR5418 }, 114 { "5418", AR5K_VERSION_MAC, AR5K_SREV_AR5418 },
130 { "2425", AR5K_VERSION_MAC, AR5K_SREV_AR2425 }, 115 { "2425", AR5K_VERSION_MAC, AR5K_SREV_AR2425 },
131 { "2417", AR5K_VERSION_MAC, AR5K_SREV_AR2417 }, 116 { "2417", AR5K_VERSION_MAC, AR5K_SREV_AR2417 },
117#endif
132 { "xxxxx", AR5K_VERSION_MAC, AR5K_SREV_UNKNOWN }, 118 { "xxxxx", AR5K_VERSION_MAC, AR5K_SREV_UNKNOWN },
133 { "5110", AR5K_VERSION_RAD, AR5K_SREV_RAD_5110 }, 119 { "5110", AR5K_VERSION_RAD, AR5K_SREV_RAD_5110 },
134 { "5111", AR5K_VERSION_RAD, AR5K_SREV_RAD_5111 }, 120 { "5111", AR5K_VERSION_RAD, AR5K_SREV_RAD_5111 },
@@ -142,10 +128,12 @@ static const struct ath5k_srev_name srev_names[] = {
142 { "2112B", AR5K_VERSION_RAD, AR5K_SREV_RAD_2112B }, 128 { "2112B", AR5K_VERSION_RAD, AR5K_SREV_RAD_2112B },
143 { "2413", AR5K_VERSION_RAD, AR5K_SREV_RAD_2413 }, 129 { "2413", AR5K_VERSION_RAD, AR5K_SREV_RAD_2413 },
144 { "5413", AR5K_VERSION_RAD, AR5K_SREV_RAD_5413 }, 130 { "5413", AR5K_VERSION_RAD, AR5K_SREV_RAD_5413 },
145 { "2316", AR5K_VERSION_RAD, AR5K_SREV_RAD_2316 },
146 { "2317", AR5K_VERSION_RAD, AR5K_SREV_RAD_2317 },
147 { "5424", AR5K_VERSION_RAD, AR5K_SREV_RAD_5424 }, 131 { "5424", AR5K_VERSION_RAD, AR5K_SREV_RAD_5424 },
148 { "5133", AR5K_VERSION_RAD, AR5K_SREV_RAD_5133 }, 132 { "5133", AR5K_VERSION_RAD, AR5K_SREV_RAD_5133 },
133#ifdef CONFIG_ATHEROS_AR231X
134 { "2316", AR5K_VERSION_RAD, AR5K_SREV_RAD_2316 },
135 { "2317", AR5K_VERSION_RAD, AR5K_SREV_RAD_2317 },
136#endif
149 { "xxxxx", AR5K_VERSION_RAD, AR5K_SREV_UNKNOWN }, 137 { "xxxxx", AR5K_VERSION_RAD, AR5K_SREV_UNKNOWN },
150}; 138};
151 139
@@ -197,8 +185,8 @@ static inline void ath5k_txbuf_free_skb(struct ath5k_softc *sc,
197 BUG_ON(!bf); 185 BUG_ON(!bf);
198 if (!bf->skb) 186 if (!bf->skb)
199 return; 187 return;
200 pci_unmap_single(sc->pdev, bf->skbaddr, bf->skb->len, 188 dma_unmap_single(sc->dev, bf->skbaddr, bf->skb->len,
201 PCI_DMA_TODEVICE); 189 DMA_TO_DEVICE);
202 dev_kfree_skb_any(bf->skb); 190 dev_kfree_skb_any(bf->skb);
203 bf->skb = NULL; 191 bf->skb = NULL;
204 bf->skbaddr = 0; 192 bf->skbaddr = 0;
@@ -214,8 +202,8 @@ static inline void ath5k_rxbuf_free_skb(struct ath5k_softc *sc,
214 BUG_ON(!bf); 202 BUG_ON(!bf);
215 if (!bf->skb) 203 if (!bf->skb)
216 return; 204 return;
217 pci_unmap_single(sc->pdev, bf->skbaddr, common->rx_bufsize, 205 dma_unmap_single(sc->dev, bf->skbaddr, common->rx_bufsize,
218 PCI_DMA_FROMDEVICE); 206 DMA_FROM_DEVICE);
219 dev_kfree_skb_any(bf->skb); 207 dev_kfree_skb_any(bf->skb);
220 bf->skb = NULL; 208 bf->skb = NULL;
221 bf->skbaddr = 0; 209 bf->skbaddr = 0;
@@ -233,7 +221,7 @@ static inline u64 ath5k_extend_tsf(struct ath5k_hw *ah, u32 rstamp)
233 return (tsf & ~0x7fff) | rstamp; 221 return (tsf & ~0x7fff) | rstamp;
234} 222}
235 223
236static const char * 224const char *
237ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val) 225ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val)
238{ 226{
239 const char *name = "xxxxx"; 227 const char *name = "xxxxx";
@@ -327,14 +315,12 @@ ath5k_copy_channels(struct ath5k_hw *ah,
327 315
328 switch (mode) { 316 switch (mode) {
329 case AR5K_MODE_11A: 317 case AR5K_MODE_11A:
330 case AR5K_MODE_11A_TURBO:
331 /* 1..220, but 2GHz frequencies are filtered by check_channel */ 318 /* 1..220, but 2GHz frequencies are filtered by check_channel */
332 size = 220 ; 319 size = 220 ;
333 chfreq = CHANNEL_5GHZ; 320 chfreq = CHANNEL_5GHZ;
334 break; 321 break;
335 case AR5K_MODE_11B: 322 case AR5K_MODE_11B:
336 case AR5K_MODE_11G: 323 case AR5K_MODE_11G:
337 case AR5K_MODE_11G_TURBO:
338 size = 26; 324 size = 26;
339 chfreq = CHANNEL_2GHZ; 325 chfreq = CHANNEL_2GHZ;
340 break; 326 break;
@@ -363,11 +349,6 @@ ath5k_copy_channels(struct ath5k_hw *ah,
363 case AR5K_MODE_11G: 349 case AR5K_MODE_11G:
364 channels[count].hw_value = chfreq | CHANNEL_OFDM; 350 channels[count].hw_value = chfreq | CHANNEL_OFDM;
365 break; 351 break;
366 case AR5K_MODE_11A_TURBO:
367 case AR5K_MODE_11G_TURBO:
368 channels[count].hw_value = chfreq |
369 CHANNEL_OFDM | CHANNEL_TURBO;
370 break;
371 case AR5K_MODE_11B: 352 case AR5K_MODE_11B:
372 channels[count].hw_value = CHANNEL_B; 353 channels[count].hw_value = CHANNEL_B;
373 } 354 }
@@ -496,7 +477,7 @@ ath5k_chan_set(struct ath5k_softc *sc, struct ieee80211_channel *chan)
496 * hardware at the new frequency, and then re-enable 477 * hardware at the new frequency, and then re-enable
497 * the relevant bits of the h/w. 478 * the relevant bits of the h/w.
498 */ 479 */
499 return ath5k_reset(sc, chan); 480 return ath5k_reset(sc, chan, true);
500} 481}
501 482
502static void 483static void
@@ -653,10 +634,11 @@ struct sk_buff *ath5k_rx_skb_alloc(struct ath5k_softc *sc, dma_addr_t *skb_addr)
653 return NULL; 634 return NULL;
654 } 635 }
655 636
656 *skb_addr = pci_map_single(sc->pdev, 637 *skb_addr = dma_map_single(sc->dev,
657 skb->data, common->rx_bufsize, 638 skb->data, common->rx_bufsize,
658 PCI_DMA_FROMDEVICE); 639 DMA_FROM_DEVICE);
659 if (unlikely(pci_dma_mapping_error(sc->pdev, *skb_addr))) { 640
641 if (unlikely(dma_mapping_error(sc->dev, *skb_addr))) {
660 ATH5K_ERR(sc, "%s: DMA mapping failed\n", __func__); 642 ATH5K_ERR(sc, "%s: DMA mapping failed\n", __func__);
661 dev_kfree_skb(skb); 643 dev_kfree_skb(skb);
662 return NULL; 644 return NULL;
@@ -752,8 +734,8 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
752 flags = AR5K_TXDESC_INTREQ | AR5K_TXDESC_CLRDMASK; 734 flags = AR5K_TXDESC_INTREQ | AR5K_TXDESC_CLRDMASK;
753 735
754 /* XXX endianness */ 736 /* XXX endianness */
755 bf->skbaddr = pci_map_single(sc->pdev, skb->data, skb->len, 737 bf->skbaddr = dma_map_single(sc->dev, skb->data, skb->len,
756 PCI_DMA_TODEVICE); 738 DMA_TO_DEVICE);
757 739
758 rate = ieee80211_get_tx_rate(sc->hw, info); 740 rate = ieee80211_get_tx_rate(sc->hw, info);
759 if (!rate) { 741 if (!rate) {
@@ -833,7 +815,7 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
833 815
834 return 0; 816 return 0;
835err_unmap: 817err_unmap:
836 pci_unmap_single(sc->pdev, bf->skbaddr, skb->len, PCI_DMA_TODEVICE); 818 dma_unmap_single(sc->dev, bf->skbaddr, skb->len, DMA_TO_DEVICE);
837 return ret; 819 return ret;
838} 820}
839 821
@@ -842,7 +824,7 @@ err_unmap:
842\*******************/ 824\*******************/
843 825
844static int 826static int
845ath5k_desc_alloc(struct ath5k_softc *sc, struct pci_dev *pdev) 827ath5k_desc_alloc(struct ath5k_softc *sc)
846{ 828{
847 struct ath5k_desc *ds; 829 struct ath5k_desc *ds;
848 struct ath5k_buf *bf; 830 struct ath5k_buf *bf;
@@ -853,7 +835,9 @@ ath5k_desc_alloc(struct ath5k_softc *sc, struct pci_dev *pdev)
853 /* allocate descriptors */ 835 /* allocate descriptors */
854 sc->desc_len = sizeof(struct ath5k_desc) * 836 sc->desc_len = sizeof(struct ath5k_desc) *
855 (ATH_TXBUF + ATH_RXBUF + ATH_BCBUF + 1); 837 (ATH_TXBUF + ATH_RXBUF + ATH_BCBUF + 1);
856 sc->desc = pci_alloc_consistent(pdev, sc->desc_len, &sc->desc_daddr); 838
839 sc->desc = dma_alloc_coherent(sc->dev, sc->desc_len,
840 &sc->desc_daddr, GFP_KERNEL);
857 if (sc->desc == NULL) { 841 if (sc->desc == NULL) {
858 ATH5K_ERR(sc, "can't allocate descriptors\n"); 842 ATH5K_ERR(sc, "can't allocate descriptors\n");
859 ret = -ENOMEM; 843 ret = -ENOMEM;
@@ -899,14 +883,14 @@ ath5k_desc_alloc(struct ath5k_softc *sc, struct pci_dev *pdev)
899 883
900 return 0; 884 return 0;
901err_free: 885err_free:
902 pci_free_consistent(pdev, sc->desc_len, sc->desc, sc->desc_daddr); 886 dma_free_coherent(sc->dev, sc->desc_len, sc->desc, sc->desc_daddr);
903err: 887err:
904 sc->desc = NULL; 888 sc->desc = NULL;
905 return ret; 889 return ret;
906} 890}
907 891
908static void 892static void
909ath5k_desc_free(struct ath5k_softc *sc, struct pci_dev *pdev) 893ath5k_desc_free(struct ath5k_softc *sc)
910{ 894{
911 struct ath5k_buf *bf; 895 struct ath5k_buf *bf;
912 896
@@ -918,7 +902,7 @@ ath5k_desc_free(struct ath5k_softc *sc, struct pci_dev *pdev)
918 ath5k_txbuf_free_skb(sc, bf); 902 ath5k_txbuf_free_skb(sc, bf);
919 903
920 /* Free memory associated with all descriptors */ 904 /* Free memory associated with all descriptors */
921 pci_free_consistent(pdev, sc->desc_len, sc->desc, sc->desc_daddr); 905 dma_free_coherent(sc->dev, sc->desc_len, sc->desc, sc->desc_daddr);
922 sc->desc = NULL; 906 sc->desc = NULL;
923 sc->desc_daddr = 0; 907 sc->desc_daddr = 0;
924 908
@@ -1063,62 +1047,44 @@ err:
1063 return ret; 1047 return ret;
1064} 1048}
1065 1049
1050/**
1051 * ath5k_drain_tx_buffs - Empty tx buffers
1052 *
1053 * @sc The &struct ath5k_softc
1054 *
1055 * Empty tx buffers from all queues in preparation
1056 * of a reset or during shutdown.
1057 *
1058 * NB: this assumes output has been stopped and
1059 * we do not need to block ath5k_tx_tasklet
1060 */
1066static void 1061static void
1067ath5k_txq_drainq(struct ath5k_softc *sc, struct ath5k_txq *txq) 1062ath5k_drain_tx_buffs(struct ath5k_softc *sc)
1068{ 1063{
1064 struct ath5k_txq *txq;
1069 struct ath5k_buf *bf, *bf0; 1065 struct ath5k_buf *bf, *bf0;
1066 int i;
1070 1067
1071 /* 1068 for (i = 0; i < ARRAY_SIZE(sc->txqs); i++) {
1072 * NB: this assumes output has been stopped and 1069 if (sc->txqs[i].setup) {
1073 * we do not need to block ath5k_tx_tasklet 1070 txq = &sc->txqs[i];
1074 */ 1071 spin_lock_bh(&txq->lock);
1075 spin_lock_bh(&txq->lock); 1072 list_for_each_entry_safe(bf, bf0, &txq->q, list) {
1076 list_for_each_entry_safe(bf, bf0, &txq->q, list) { 1073 ath5k_debug_printtxbuf(sc, bf);
1077 ath5k_debug_printtxbuf(sc, bf);
1078
1079 ath5k_txbuf_free_skb(sc, bf);
1080
1081 spin_lock_bh(&sc->txbuflock);
1082 list_move_tail(&bf->list, &sc->txbuf);
1083 sc->txbuf_len++;
1084 txq->txq_len--;
1085 spin_unlock_bh(&sc->txbuflock);
1086 }
1087 txq->link = NULL;
1088 txq->txq_poll_mark = false;
1089 spin_unlock_bh(&txq->lock);
1090}
1091 1074
1092/* 1075 ath5k_txbuf_free_skb(sc, bf);
1093 * Drain the transmit queues and reclaim resources.
1094 */
1095static void
1096ath5k_txq_cleanup(struct ath5k_softc *sc)
1097{
1098 struct ath5k_hw *ah = sc->ah;
1099 unsigned int i;
1100 1076
1101 /* XXX return value */ 1077 spin_lock_bh(&sc->txbuflock);
1102 if (likely(!test_bit(ATH_STAT_INVALID, sc->status))) { 1078 list_move_tail(&bf->list, &sc->txbuf);
1103 /* don't touch the hardware if marked invalid */ 1079 sc->txbuf_len++;
1104 ath5k_hw_stop_tx_dma(ah, sc->bhalq); 1080 txq->txq_len--;
1105 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "beacon queue %x\n", 1081 spin_unlock_bh(&sc->txbuflock);
1106 ath5k_hw_get_txdp(ah, sc->bhalq));
1107 for (i = 0; i < ARRAY_SIZE(sc->txqs); i++)
1108 if (sc->txqs[i].setup) {
1109 ath5k_hw_stop_tx_dma(ah, sc->txqs[i].qnum);
1110 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "txq [%u] %x, "
1111 "link %p\n",
1112 sc->txqs[i].qnum,
1113 ath5k_hw_get_txdp(ah,
1114 sc->txqs[i].qnum),
1115 sc->txqs[i].link);
1116 } 1082 }
1083 txq->link = NULL;
1084 txq->txq_poll_mark = false;
1085 spin_unlock_bh(&txq->lock);
1086 }
1117 } 1087 }
1118
1119 for (i = 0; i < ARRAY_SIZE(sc->txqs); i++)
1120 if (sc->txqs[i].setup)
1121 ath5k_txq_drainq(sc, &sc->txqs[i]);
1122} 1088}
1123 1089
1124static void 1090static void
@@ -1178,16 +1144,19 @@ err:
1178} 1144}
1179 1145
1180/* 1146/*
1181 * Disable the receive h/w in preparation for a reset. 1147 * Disable the receive logic on PCU (DRU)
1148 * In preparation for a shutdown.
1149 *
1150 * Note: Doesn't stop rx DMA, ath5k_hw_dma_stop
1151 * does.
1182 */ 1152 */
1183static void 1153static void
1184ath5k_rx_stop(struct ath5k_softc *sc) 1154ath5k_rx_stop(struct ath5k_softc *sc)
1185{ 1155{
1186 struct ath5k_hw *ah = sc->ah; 1156 struct ath5k_hw *ah = sc->ah;
1187 1157
1188 ath5k_hw_stop_rx_pcu(ah); /* disable PCU */
1189 ath5k_hw_set_rx_filter(ah, 0); /* clear recv filter */ 1158 ath5k_hw_set_rx_filter(ah, 0); /* clear recv filter */
1190 ath5k_hw_stop_rx_dma(ah); /* disable DMA engine */ 1159 ath5k_hw_stop_rx_pcu(ah); /* disable PCU */
1191 1160
1192 ath5k_debug_printrxbuffs(sc, ah); 1161 ath5k_debug_printrxbuffs(sc, ah);
1193} 1162}
@@ -1544,9 +1513,9 @@ ath5k_tasklet_rx(unsigned long data)
1544 if (!next_skb) 1513 if (!next_skb)
1545 goto next; 1514 goto next;
1546 1515
1547 pci_unmap_single(sc->pdev, bf->skbaddr, 1516 dma_unmap_single(sc->dev, bf->skbaddr,
1548 common->rx_bufsize, 1517 common->rx_bufsize,
1549 PCI_DMA_FROMDEVICE); 1518 DMA_FROM_DEVICE);
1550 1519
1551 skb_put(skb, rs.rs_datalen); 1520 skb_put(skb, rs.rs_datalen);
1552 1521
@@ -1709,8 +1678,9 @@ ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq)
1709 1678
1710 skb = bf->skb; 1679 skb = bf->skb;
1711 bf->skb = NULL; 1680 bf->skb = NULL;
1712 pci_unmap_single(sc->pdev, bf->skbaddr, skb->len, 1681
1713 PCI_DMA_TODEVICE); 1682 dma_unmap_single(sc->dev, bf->skbaddr, skb->len,
1683 DMA_TO_DEVICE);
1714 ath5k_tx_frame_completed(sc, skb, &ts); 1684 ath5k_tx_frame_completed(sc, skb, &ts);
1715 } 1685 }
1716 1686
@@ -1764,12 +1734,13 @@ ath5k_beacon_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
1764 u32 flags; 1734 u32 flags;
1765 const int padsize = 0; 1735 const int padsize = 0;
1766 1736
1767 bf->skbaddr = pci_map_single(sc->pdev, skb->data, skb->len, 1737 bf->skbaddr = dma_map_single(sc->dev, skb->data, skb->len,
1768 PCI_DMA_TODEVICE); 1738 DMA_TO_DEVICE);
1769 ATH5K_DBG(sc, ATH5K_DEBUG_BEACON, "skb %p [data %p len %u] " 1739 ATH5K_DBG(sc, ATH5K_DEBUG_BEACON, "skb %p [data %p len %u] "
1770 "skbaddr %llx\n", skb, skb->data, skb->len, 1740 "skbaddr %llx\n", skb, skb->data, skb->len,
1771 (unsigned long long)bf->skbaddr); 1741 (unsigned long long)bf->skbaddr);
1772 if (pci_dma_mapping_error(sc->pdev, bf->skbaddr)) { 1742
1743 if (dma_mapping_error(sc->dev, bf->skbaddr)) {
1773 ATH5K_ERR(sc, "beacon DMA mapping failed\n"); 1744 ATH5K_ERR(sc, "beacon DMA mapping failed\n");
1774 return -EIO; 1745 return -EIO;
1775 } 1746 }
@@ -1821,7 +1792,7 @@ ath5k_beacon_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
1821 1792
1822 return 0; 1793 return 0;
1823err_unmap: 1794err_unmap:
1824 pci_unmap_single(sc->pdev, bf->skbaddr, skb->len, PCI_DMA_TODEVICE); 1795 dma_unmap_single(sc->dev, bf->skbaddr, skb->len, DMA_TO_DEVICE);
1825 return ret; 1796 return ret;
1826} 1797}
1827 1798
@@ -1937,7 +1908,7 @@ ath5k_beacon_send(struct ath5k_softc *sc)
1937 * This should never fail since we check above that no frames 1908 * This should never fail since we check above that no frames
1938 * are still pending on the queue. 1909 * are still pending on the queue.
1939 */ 1910 */
1940 if (unlikely(ath5k_hw_stop_tx_dma(ah, sc->bhalq))) { 1911 if (unlikely(ath5k_hw_stop_beacon_queue(ah, sc->bhalq))) {
1941 ATH5K_WARN(sc, "beacon queue %u didn't start/stop ?\n", sc->bhalq); 1912 ATH5K_WARN(sc, "beacon queue %u didn't start/stop ?\n", sc->bhalq);
1942 /* NB: hw still stops DMA, so proceed */ 1913 /* NB: hw still stops DMA, so proceed */
1943 } 1914 }
@@ -2106,7 +2077,7 @@ ath5k_beacon_config(struct ath5k_softc *sc)
2106 } else 2077 } else
2107 ath5k_beacon_update_timers(sc, -1); 2078 ath5k_beacon_update_timers(sc, -1);
2108 } else { 2079 } else {
2109 ath5k_hw_stop_tx_dma(sc->ah, sc->bhalq); 2080 ath5k_hw_stop_beacon_queue(sc->ah, sc->bhalq);
2110 } 2081 }
2111 2082
2112 ath5k_hw_set_imr(ah, sc->imask); 2083 ath5k_hw_set_imr(ah, sc->imask);
@@ -2168,7 +2139,7 @@ ath5k_intr_calibration_poll(struct ath5k_hw *ah)
2168 * AR5K_REG_ENABLE_BITS(ah, AR5K_CR, AR5K_CR_SWI); */ 2139 * AR5K_REG_ENABLE_BITS(ah, AR5K_CR, AR5K_CR_SWI); */
2169} 2140}
2170 2141
2171static irqreturn_t 2142irqreturn_t
2172ath5k_intr(int irq, void *dev_id) 2143ath5k_intr(int irq, void *dev_id)
2173{ 2144{
2174 struct ath5k_softc *sc = dev_id; 2145 struct ath5k_softc *sc = dev_id;
@@ -2177,7 +2148,8 @@ ath5k_intr(int irq, void *dev_id)
2177 unsigned int counter = 1000; 2148 unsigned int counter = 1000;
2178 2149
2179 if (unlikely(test_bit(ATH_STAT_INVALID, sc->status) || 2150 if (unlikely(test_bit(ATH_STAT_INVALID, sc->status) ||
2180 !ath5k_hw_is_intr_pending(ah))) 2151 ((ath5k_get_bus_type(ah) != ATH_AHB) &&
2152 !ath5k_hw_is_intr_pending(ah))))
2181 return IRQ_NONE; 2153 return IRQ_NONE;
2182 2154
2183 do { 2155 do {
@@ -2243,6 +2215,10 @@ ath5k_intr(int irq, void *dev_id)
2243 tasklet_schedule(&sc->rf_kill.toggleq); 2215 tasklet_schedule(&sc->rf_kill.toggleq);
2244 2216
2245 } 2217 }
2218
2219 if (ath5k_get_bus_type(ah) == ATH_AHB)
2220 break;
2221
2246 } while (ath5k_hw_is_intr_pending(ah) && --counter > 0); 2222 } while (ath5k_hw_is_intr_pending(ah) && --counter > 0);
2247 2223
2248 if (unlikely(!counter)) 2224 if (unlikely(!counter))
@@ -2342,7 +2318,7 @@ ath5k_tx_complete_poll_work(struct work_struct *work)
2342 if (needreset) { 2318 if (needreset) {
2343 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, 2319 ATH5K_DBG(sc, ATH5K_DEBUG_RESET,
2344 "TX queues stuck, resetting\n"); 2320 "TX queues stuck, resetting\n");
2345 ath5k_reset(sc, sc->curchan); 2321 ath5k_reset(sc, NULL, true);
2346 } 2322 }
2347 2323
2348 ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 2324 ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work,
@@ -2354,6 +2330,158 @@ ath5k_tx_complete_poll_work(struct work_struct *work)
2354* Initialization routines * 2330* Initialization routines *
2355\*************************/ 2331\*************************/
2356 2332
2333int
2334ath5k_init_softc(struct ath5k_softc *sc, const struct ath_bus_ops *bus_ops)
2335{
2336 struct ieee80211_hw *hw = sc->hw;
2337 struct ath_common *common;
2338 int ret;
2339 int csz;
2340
2341 /* Initialize driver private data */
2342 SET_IEEE80211_DEV(hw, sc->dev);
2343 hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
2344 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
2345 IEEE80211_HW_SIGNAL_DBM;
2346
2347 hw->wiphy->interface_modes =
2348 BIT(NL80211_IFTYPE_AP) |
2349 BIT(NL80211_IFTYPE_STATION) |
2350 BIT(NL80211_IFTYPE_ADHOC) |
2351 BIT(NL80211_IFTYPE_MESH_POINT);
2352
2353 hw->extra_tx_headroom = 2;
2354 hw->channel_change_time = 5000;
2355
2356 /*
2357 * Mark the device as detached to avoid processing
2358 * interrupts until setup is complete.
2359 */
2360 __set_bit(ATH_STAT_INVALID, sc->status);
2361
2362 sc->opmode = NL80211_IFTYPE_STATION;
2363 sc->bintval = 1000;
2364 mutex_init(&sc->lock);
2365 spin_lock_init(&sc->rxbuflock);
2366 spin_lock_init(&sc->txbuflock);
2367 spin_lock_init(&sc->block);
2368
2369
2370 /* Setup interrupt handler */
2371 ret = request_irq(sc->irq, ath5k_intr, IRQF_SHARED, "ath", sc);
2372 if (ret) {
2373 ATH5K_ERR(sc, "request_irq failed\n");
2374 goto err;
2375 }
2376
2377 /* If we passed the test, malloc an ath5k_hw struct */
2378 sc->ah = kzalloc(sizeof(struct ath5k_hw), GFP_KERNEL);
2379 if (!sc->ah) {
2380 ret = -ENOMEM;
2381 ATH5K_ERR(sc, "out of memory\n");
2382 goto err_irq;
2383 }
2384
2385 sc->ah->ah_sc = sc;
2386 sc->ah->ah_iobase = sc->iobase;
2387 common = ath5k_hw_common(sc->ah);
2388 common->ops = &ath5k_common_ops;
2389 common->bus_ops = bus_ops;
2390 common->ah = sc->ah;
2391 common->hw = hw;
2392 common->priv = sc;
2393
2394 /*
2395 * Cache line size is used to size and align various
2396 * structures used to communicate with the hardware.
2397 */
2398 ath5k_read_cachesize(common, &csz);
2399 common->cachelsz = csz << 2; /* convert to bytes */
2400
2401 spin_lock_init(&common->cc_lock);
2402
2403 /* Initialize device */
2404 ret = ath5k_hw_init(sc);
2405 if (ret)
2406 goto err_free_ah;
2407
2408 /* set up multi-rate retry capabilities */
2409 if (sc->ah->ah_version == AR5K_AR5212) {
2410 hw->max_rates = 4;
2411 hw->max_rate_tries = 11;
2412 }
2413
2414 hw->vif_data_size = sizeof(struct ath5k_vif);
2415
2416 /* Finish private driver data initialization */
2417 ret = ath5k_init(hw);
2418 if (ret)
2419 goto err_ah;
2420
2421 ATH5K_INFO(sc, "Atheros AR%s chip found (MAC: 0x%x, PHY: 0x%x)\n",
2422 ath5k_chip_name(AR5K_VERSION_MAC, sc->ah->ah_mac_srev),
2423 sc->ah->ah_mac_srev,
2424 sc->ah->ah_phy_revision);
2425
2426 if (!sc->ah->ah_single_chip) {
2427 /* Single chip radio (!RF5111) */
2428 if (sc->ah->ah_radio_5ghz_revision &&
2429 !sc->ah->ah_radio_2ghz_revision) {
2430 /* No 5GHz support -> report 2GHz radio */
2431 if (!test_bit(AR5K_MODE_11A,
2432 sc->ah->ah_capabilities.cap_mode)) {
2433 ATH5K_INFO(sc, "RF%s 2GHz radio found (0x%x)\n",
2434 ath5k_chip_name(AR5K_VERSION_RAD,
2435 sc->ah->ah_radio_5ghz_revision),
2436 sc->ah->ah_radio_5ghz_revision);
2437 /* No 2GHz support (5110 and some
2438 * 5Ghz only cards) -> report 5Ghz radio */
2439 } else if (!test_bit(AR5K_MODE_11B,
2440 sc->ah->ah_capabilities.cap_mode)) {
2441 ATH5K_INFO(sc, "RF%s 5GHz radio found (0x%x)\n",
2442 ath5k_chip_name(AR5K_VERSION_RAD,
2443 sc->ah->ah_radio_5ghz_revision),
2444 sc->ah->ah_radio_5ghz_revision);
2445 /* Multiband radio */
2446 } else {
2447 ATH5K_INFO(sc, "RF%s multiband radio found"
2448 " (0x%x)\n",
2449 ath5k_chip_name(AR5K_VERSION_RAD,
2450 sc->ah->ah_radio_5ghz_revision),
2451 sc->ah->ah_radio_5ghz_revision);
2452 }
2453 }
2454 /* Multi chip radio (RF5111 - RF2111) ->
2455 * report both 2GHz/5GHz radios */
2456 else if (sc->ah->ah_radio_5ghz_revision &&
2457 sc->ah->ah_radio_2ghz_revision){
2458 ATH5K_INFO(sc, "RF%s 5GHz radio found (0x%x)\n",
2459 ath5k_chip_name(AR5K_VERSION_RAD,
2460 sc->ah->ah_radio_5ghz_revision),
2461 sc->ah->ah_radio_5ghz_revision);
2462 ATH5K_INFO(sc, "RF%s 2GHz radio found (0x%x)\n",
2463 ath5k_chip_name(AR5K_VERSION_RAD,
2464 sc->ah->ah_radio_2ghz_revision),
2465 sc->ah->ah_radio_2ghz_revision);
2466 }
2467 }
2468
2469 ath5k_debug_init_device(sc);
2470
2471 /* ready to process interrupts */
2472 __clear_bit(ATH_STAT_INVALID, sc->status);
2473
2474 return 0;
2475err_ah:
2476 ath5k_hw_deinit(sc->ah);
2477err_free_ah:
2478 kfree(sc->ah);
2479err_irq:
2480 free_irq(sc->irq, sc);
2481err:
2482 return ret;
2483}
2484
2357static int 2485static int
2358ath5k_stop_locked(struct ath5k_softc *sc) 2486ath5k_stop_locked(struct ath5k_softc *sc)
2359{ 2487{
@@ -2382,11 +2510,10 @@ ath5k_stop_locked(struct ath5k_softc *sc)
2382 if (!test_bit(ATH_STAT_INVALID, sc->status)) { 2510 if (!test_bit(ATH_STAT_INVALID, sc->status)) {
2383 ath5k_led_off(sc); 2511 ath5k_led_off(sc);
2384 ath5k_hw_set_imr(ah, 0); 2512 ath5k_hw_set_imr(ah, 0);
2385 synchronize_irq(sc->pdev->irq); 2513 synchronize_irq(sc->irq);
2386 }
2387 ath5k_txq_cleanup(sc);
2388 if (!test_bit(ATH_STAT_INVALID, sc->status)) {
2389 ath5k_rx_stop(sc); 2514 ath5k_rx_stop(sc);
2515 ath5k_hw_dma_stop(ah);
2516 ath5k_drain_tx_buffs(sc);
2390 ath5k_hw_phy_disable(ah); 2517 ath5k_hw_phy_disable(ah);
2391 } 2518 }
2392 2519
@@ -2394,7 +2521,7 @@ ath5k_stop_locked(struct ath5k_softc *sc)
2394} 2521}
2395 2522
2396static int 2523static int
2397ath5k_init(struct ath5k_softc *sc) 2524ath5k_init_hw(struct ath5k_softc *sc)
2398{ 2525{
2399 struct ath5k_hw *ah = sc->ah; 2526 struct ath5k_hw *ah = sc->ah;
2400 struct ath_common *common = ath5k_hw_common(ah); 2527 struct ath_common *common = ath5k_hw_common(ah);
@@ -2423,7 +2550,7 @@ ath5k_init(struct ath5k_softc *sc)
2423 AR5K_INT_RXORN | AR5K_INT_TXDESC | AR5K_INT_TXEOL | 2550 AR5K_INT_RXORN | AR5K_INT_TXDESC | AR5K_INT_TXEOL |
2424 AR5K_INT_FATAL | AR5K_INT_GLOBAL | AR5K_INT_MIB; 2551 AR5K_INT_FATAL | AR5K_INT_GLOBAL | AR5K_INT_MIB;
2425 2552
2426 ret = ath5k_reset(sc, NULL); 2553 ret = ath5k_reset(sc, NULL, false);
2427 if (ret) 2554 if (ret)
2428 goto done; 2555 goto done;
2429 2556
@@ -2436,7 +2563,9 @@ ath5k_init(struct ath5k_softc *sc)
2436 for (i = 0; i < common->keymax; i++) 2563 for (i = 0; i < common->keymax; i++)
2437 ath_hw_keyreset(common, (u16) i); 2564 ath_hw_keyreset(common, (u16) i);
2438 2565
2439 ath5k_hw_set_ack_bitrate_high(ah, true); 2566 /* Use higher rates for acks instead of base
2567 * rate */
2568 ah->ah_ack_bitrate_high = true;
2440 2569
2441 for (i = 0; i < ARRAY_SIZE(sc->bslot); i++) 2570 for (i = 0; i < ARRAY_SIZE(sc->bslot); i++)
2442 sc->bslot[i] = NULL; 2571 sc->bslot[i] = NULL;
@@ -2520,7 +2649,8 @@ ath5k_stop_hw(struct ath5k_softc *sc)
2520 * This should be called with sc->lock. 2649 * This should be called with sc->lock.
2521 */ 2650 */
2522static int 2651static int
2523ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan) 2652ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan,
2653 bool skip_pcu)
2524{ 2654{
2525 struct ath5k_hw *ah = sc->ah; 2655 struct ath5k_hw *ah = sc->ah;
2526 int ret; 2656 int ret;
@@ -2528,17 +2658,17 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan)
2528 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "resetting\n"); 2658 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "resetting\n");
2529 2659
2530 ath5k_hw_set_imr(ah, 0); 2660 ath5k_hw_set_imr(ah, 0);
2531 synchronize_irq(sc->pdev->irq); 2661 synchronize_irq(sc->irq);
2532 stop_tasklets(sc); 2662 stop_tasklets(sc);
2533 2663
2534 if (chan) { 2664 if (chan) {
2535 ath5k_txq_cleanup(sc); 2665 ath5k_drain_tx_buffs(sc);
2536 ath5k_rx_stop(sc);
2537 2666
2538 sc->curchan = chan; 2667 sc->curchan = chan;
2539 sc->curband = &sc->sbands[chan->band]; 2668 sc->curband = &sc->sbands[chan->band];
2540 } 2669 }
2541 ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, chan != NULL); 2670 ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, chan != NULL,
2671 skip_pcu);
2542 if (ret) { 2672 if (ret) {
2543 ATH5K_ERR(sc, "can't reset hardware (%d)\n", ret); 2673 ATH5K_ERR(sc, "can't reset hardware (%d)\n", ret);
2544 goto err; 2674 goto err;
@@ -2584,13 +2714,14 @@ static void ath5k_reset_work(struct work_struct *work)
2584 reset_work); 2714 reset_work);
2585 2715
2586 mutex_lock(&sc->lock); 2716 mutex_lock(&sc->lock);
2587 ath5k_reset(sc, sc->curchan); 2717 ath5k_reset(sc, NULL, true);
2588 mutex_unlock(&sc->lock); 2718 mutex_unlock(&sc->lock);
2589} 2719}
2590 2720
2591static int 2721static int
2592ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw) 2722ath5k_init(struct ieee80211_hw *hw)
2593{ 2723{
2724
2594 struct ath5k_softc *sc = hw->priv; 2725 struct ath5k_softc *sc = hw->priv;
2595 struct ath5k_hw *ah = sc->ah; 2726 struct ath5k_hw *ah = sc->ah;
2596 struct ath_regulatory *regulatory = ath5k_hw_regulatory(ah); 2727 struct ath_regulatory *regulatory = ath5k_hw_regulatory(ah);
@@ -2598,7 +2729,6 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
2598 u8 mac[ETH_ALEN] = {}; 2729 u8 mac[ETH_ALEN] = {};
2599 int ret; 2730 int ret;
2600 2731
2601 ATH5K_DBG(sc, ATH5K_DEBUG_ANY, "devid 0x%x\n", pdev->device);
2602 2732
2603 /* 2733 /*
2604 * Check if the MAC has multi-rate retry support. 2734 * Check if the MAC has multi-rate retry support.
@@ -2635,7 +2765,7 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
2635 /* 2765 /*
2636 * Allocate tx+rx descriptors and populate the lists. 2766 * Allocate tx+rx descriptors and populate the lists.
2637 */ 2767 */
2638 ret = ath5k_desc_alloc(sc, pdev); 2768 ret = ath5k_desc_alloc(sc);
2639 if (ret) { 2769 if (ret) {
2640 ATH5K_ERR(sc, "can't allocate descriptors\n"); 2770 ATH5K_ERR(sc, "can't allocate descriptors\n");
2641 goto err; 2771 goto err;
@@ -2699,8 +2829,7 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
2699 2829
2700 ret = ath5k_eeprom_read_mac(ah, mac); 2830 ret = ath5k_eeprom_read_mac(ah, mac);
2701 if (ret) { 2831 if (ret) {
2702 ATH5K_ERR(sc, "unable to read address from EEPROM: 0x%04x\n", 2832 ATH5K_ERR(sc, "unable to read address from EEPROM\n");
2703 sc->pdev->device);
2704 goto err_queues; 2833 goto err_queues;
2705 } 2834 }
2706 2835
@@ -2735,15 +2864,15 @@ err_queues:
2735err_bhal: 2864err_bhal:
2736 ath5k_hw_release_tx_queue(ah, sc->bhalq); 2865 ath5k_hw_release_tx_queue(ah, sc->bhalq);
2737err_desc: 2866err_desc:
2738 ath5k_desc_free(sc, pdev); 2867 ath5k_desc_free(sc);
2739err: 2868err:
2740 return ret; 2869 return ret;
2741} 2870}
2742 2871
2743static void 2872void
2744ath5k_detach(struct pci_dev *pdev, struct ieee80211_hw *hw) 2873ath5k_deinit_softc(struct ath5k_softc *sc)
2745{ 2874{
2746 struct ath5k_softc *sc = hw->priv; 2875 struct ieee80211_hw *hw = sc->hw;
2747 2876
2748 /* 2877 /*
2749 * NB: the order of these is important: 2878 * NB: the order of these is important:
@@ -2758,8 +2887,9 @@ ath5k_detach(struct pci_dev *pdev, struct ieee80211_hw *hw)
2758 * XXX: ??? detach ath5k_hw ??? 2887 * XXX: ??? detach ath5k_hw ???
2759 * Other than that, it's straightforward... 2888 * Other than that, it's straightforward...
2760 */ 2889 */
2890 ath5k_debug_finish_device(sc);
2761 ieee80211_unregister_hw(hw); 2891 ieee80211_unregister_hw(hw);
2762 ath5k_desc_free(sc, pdev); 2892 ath5k_desc_free(sc);
2763 ath5k_txq_release(sc); 2893 ath5k_txq_release(sc);
2764 ath5k_hw_release_tx_queue(sc->ah, sc->bhalq); 2894 ath5k_hw_release_tx_queue(sc->ah, sc->bhalq);
2765 ath5k_unregister_leds(sc); 2895 ath5k_unregister_leds(sc);
@@ -2770,6 +2900,8 @@ ath5k_detach(struct pci_dev *pdev, struct ieee80211_hw *hw)
2770 * returns because we'll get called back to reclaim node 2900 * returns because we'll get called back to reclaim node
2771 * state and potentially want to use them. 2901 * state and potentially want to use them.
2772 */ 2902 */
2903 ath5k_hw_deinit(sc->ah);
2904 free_irq(sc->irq, sc);
2773} 2905}
2774 2906
2775/********************\ 2907/********************\
@@ -2792,7 +2924,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2792 2924
2793static int ath5k_start(struct ieee80211_hw *hw) 2925static int ath5k_start(struct ieee80211_hw *hw)
2794{ 2926{
2795 return ath5k_init(hw->priv); 2927 return ath5k_init_hw(hw->priv);
2796} 2928}
2797 2929
2798static void ath5k_stop(struct ieee80211_hw *hw) 2930static void ath5k_stop(struct ieee80211_hw *hw)
@@ -3437,7 +3569,7 @@ static int ath5k_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant)
3437 return 0; 3569 return 0;
3438} 3570}
3439 3571
3440static const struct ieee80211_ops ath5k_hw_ops = { 3572const struct ieee80211_ops ath5k_hw_ops = {
3441 .tx = ath5k_tx, 3573 .tx = ath5k_tx,
3442 .start = ath5k_start, 3574 .start = ath5k_start,
3443 .stop = ath5k_stop, 3575 .stop = ath5k_stop,
@@ -3460,340 +3592,3 @@ static const struct ieee80211_ops ath5k_hw_ops = {
3460 .set_antenna = ath5k_set_antenna, 3592 .set_antenna = ath5k_set_antenna,
3461 .get_antenna = ath5k_get_antenna, 3593 .get_antenna = ath5k_get_antenna,
3462}; 3594};
3463
3464/********************\
3465* PCI Initialization *
3466\********************/
3467
3468static int __devinit
3469ath5k_pci_probe(struct pci_dev *pdev,
3470 const struct pci_device_id *id)
3471{
3472 void __iomem *mem;
3473 struct ath5k_softc *sc;
3474 struct ath_common *common;
3475 struct ieee80211_hw *hw;
3476 int ret;
3477 u8 csz;
3478
3479 /*
3480 * L0s needs to be disabled on all ath5k cards.
3481 *
3482 * For distributions shipping with CONFIG_PCIEASPM (this will be enabled
3483 * by default in the future in 2.6.36) this will also mean both L1 and
3484 * L0s will be disabled when a pre 1.1 PCIe device is detected. We do
3485 * know L1 works correctly even for all ath5k pre 1.1 PCIe devices
3486 * though but cannot currently undue the effect of a blacklist, for
3487 * details you can read pcie_aspm_sanity_check() and see how it adjusts
3488 * the device link capability.
3489 *
3490 * It may be possible in the future to implement some PCI API to allow
3491 * drivers to override blacklists for pre 1.1 PCIe but for now it is
3492 * best to accept that both L0s and L1 will be disabled completely for
3493 * distributions shipping with CONFIG_PCIEASPM rather than having this
3494 * issue present. Motivation for adding this new API will be to help
3495 * with power consumption for some of these devices.
3496 */
3497 pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S);
3498
3499 ret = pci_enable_device(pdev);
3500 if (ret) {
3501 dev_err(&pdev->dev, "can't enable device\n");
3502 goto err;
3503 }
3504
3505 /* XXX 32-bit addressing only */
3506 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
3507 if (ret) {
3508 dev_err(&pdev->dev, "32-bit DMA not available\n");
3509 goto err_dis;
3510 }
3511
3512 /*
3513 * Cache line size is used to size and align various
3514 * structures used to communicate with the hardware.
3515 */
3516 pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &csz);
3517 if (csz == 0) {
3518 /*
3519 * Linux 2.4.18 (at least) writes the cache line size
3520 * register as a 16-bit wide register which is wrong.
3521 * We must have this setup properly for rx buffer
3522 * DMA to work so force a reasonable value here if it
3523 * comes up zero.
3524 */
3525 csz = L1_CACHE_BYTES >> 2;
3526 pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, csz);
3527 }
3528 /*
3529 * The default setting of latency timer yields poor results,
3530 * set it to the value used by other systems. It may be worth
3531 * tweaking this setting more.
3532 */
3533 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xa8);
3534
3535 /* Enable bus mastering */
3536 pci_set_master(pdev);
3537
3538 /*
3539 * Disable the RETRY_TIMEOUT register (0x41) to keep
3540 * PCI Tx retries from interfering with C3 CPU state.
3541 */
3542 pci_write_config_byte(pdev, 0x41, 0);
3543
3544 ret = pci_request_region(pdev, 0, "ath5k");
3545 if (ret) {
3546 dev_err(&pdev->dev, "cannot reserve PCI memory region\n");
3547 goto err_dis;
3548 }
3549
3550 mem = pci_iomap(pdev, 0, 0);
3551 if (!mem) {
3552 dev_err(&pdev->dev, "cannot remap PCI memory region\n") ;
3553 ret = -EIO;
3554 goto err_reg;
3555 }
3556
3557 /*
3558 * Allocate hw (mac80211 main struct)
3559 * and hw->priv (driver private data)
3560 */
3561 hw = ieee80211_alloc_hw(sizeof(*sc), &ath5k_hw_ops);
3562 if (hw == NULL) {
3563 dev_err(&pdev->dev, "cannot allocate ieee80211_hw\n");
3564 ret = -ENOMEM;
3565 goto err_map;
3566 }
3567
3568 dev_info(&pdev->dev, "registered as '%s'\n", wiphy_name(hw->wiphy));
3569
3570 /* Initialize driver private data */
3571 SET_IEEE80211_DEV(hw, &pdev->dev);
3572 hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
3573 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
3574 IEEE80211_HW_SIGNAL_DBM;
3575
3576 hw->wiphy->interface_modes =
3577 BIT(NL80211_IFTYPE_AP) |
3578 BIT(NL80211_IFTYPE_STATION) |
3579 BIT(NL80211_IFTYPE_ADHOC) |
3580 BIT(NL80211_IFTYPE_MESH_POINT);
3581
3582 hw->extra_tx_headroom = 2;
3583 hw->channel_change_time = 5000;
3584 sc = hw->priv;
3585 sc->hw = hw;
3586 sc->pdev = pdev;
3587
3588 /*
3589 * Mark the device as detached to avoid processing
3590 * interrupts until setup is complete.
3591 */
3592 __set_bit(ATH_STAT_INVALID, sc->status);
3593
3594 sc->iobase = mem; /* So we can unmap it on detach */
3595 sc->opmode = NL80211_IFTYPE_STATION;
3596 sc->bintval = 1000;
3597 mutex_init(&sc->lock);
3598 spin_lock_init(&sc->rxbuflock);
3599 spin_lock_init(&sc->txbuflock);
3600 spin_lock_init(&sc->block);
3601
3602 /* Set private data */
3603 pci_set_drvdata(pdev, sc);
3604
3605 /* Setup interrupt handler */
3606 ret = request_irq(pdev->irq, ath5k_intr, IRQF_SHARED, "ath", sc);
3607 if (ret) {
3608 ATH5K_ERR(sc, "request_irq failed\n");
3609 goto err_free;
3610 }
3611
3612 /* If we passed the test, malloc an ath5k_hw struct */
3613 sc->ah = kzalloc(sizeof(struct ath5k_hw), GFP_KERNEL);
3614 if (!sc->ah) {
3615 ret = -ENOMEM;
3616 ATH5K_ERR(sc, "out of memory\n");
3617 goto err_irq;
3618 }
3619
3620 sc->ah->ah_sc = sc;
3621 sc->ah->ah_iobase = sc->iobase;
3622 common = ath5k_hw_common(sc->ah);
3623 common->ops = &ath5k_common_ops;
3624 common->ah = sc->ah;
3625 common->hw = hw;
3626 common->cachelsz = csz << 2; /* convert to bytes */
3627 spin_lock_init(&common->cc_lock);
3628
3629 /* Initialize device */
3630 ret = ath5k_hw_attach(sc);
3631 if (ret) {
3632 goto err_free_ah;
3633 }
3634
3635 /* set up multi-rate retry capabilities */
3636 if (sc->ah->ah_version == AR5K_AR5212) {
3637 hw->max_rates = 4;
3638 hw->max_rate_tries = 11;
3639 }
3640
3641 hw->vif_data_size = sizeof(struct ath5k_vif);
3642
3643 /* Finish private driver data initialization */
3644 ret = ath5k_attach(pdev, hw);
3645 if (ret)
3646 goto err_ah;
3647
3648 ATH5K_INFO(sc, "Atheros AR%s chip found (MAC: 0x%x, PHY: 0x%x)\n",
3649 ath5k_chip_name(AR5K_VERSION_MAC, sc->ah->ah_mac_srev),
3650 sc->ah->ah_mac_srev,
3651 sc->ah->ah_phy_revision);
3652
3653 if (!sc->ah->ah_single_chip) {
3654 /* Single chip radio (!RF5111) */
3655 if (sc->ah->ah_radio_5ghz_revision &&
3656 !sc->ah->ah_radio_2ghz_revision) {
3657 /* No 5GHz support -> report 2GHz radio */
3658 if (!test_bit(AR5K_MODE_11A,
3659 sc->ah->ah_capabilities.cap_mode)) {
3660 ATH5K_INFO(sc, "RF%s 2GHz radio found (0x%x)\n",
3661 ath5k_chip_name(AR5K_VERSION_RAD,
3662 sc->ah->ah_radio_5ghz_revision),
3663 sc->ah->ah_radio_5ghz_revision);
3664 /* No 2GHz support (5110 and some
3665 * 5Ghz only cards) -> report 5Ghz radio */
3666 } else if (!test_bit(AR5K_MODE_11B,
3667 sc->ah->ah_capabilities.cap_mode)) {
3668 ATH5K_INFO(sc, "RF%s 5GHz radio found (0x%x)\n",
3669 ath5k_chip_name(AR5K_VERSION_RAD,
3670 sc->ah->ah_radio_5ghz_revision),
3671 sc->ah->ah_radio_5ghz_revision);
3672 /* Multiband radio */
3673 } else {
3674 ATH5K_INFO(sc, "RF%s multiband radio found"
3675 " (0x%x)\n",
3676 ath5k_chip_name(AR5K_VERSION_RAD,
3677 sc->ah->ah_radio_5ghz_revision),
3678 sc->ah->ah_radio_5ghz_revision);
3679 }
3680 }
3681 /* Multi chip radio (RF5111 - RF2111) ->
3682 * report both 2GHz/5GHz radios */
3683 else if (sc->ah->ah_radio_5ghz_revision &&
3684 sc->ah->ah_radio_2ghz_revision){
3685 ATH5K_INFO(sc, "RF%s 5GHz radio found (0x%x)\n",
3686 ath5k_chip_name(AR5K_VERSION_RAD,
3687 sc->ah->ah_radio_5ghz_revision),
3688 sc->ah->ah_radio_5ghz_revision);
3689 ATH5K_INFO(sc, "RF%s 2GHz radio found (0x%x)\n",
3690 ath5k_chip_name(AR5K_VERSION_RAD,
3691 sc->ah->ah_radio_2ghz_revision),
3692 sc->ah->ah_radio_2ghz_revision);
3693 }
3694 }
3695
3696 ath5k_debug_init_device(sc);
3697
3698 /* ready to process interrupts */
3699 __clear_bit(ATH_STAT_INVALID, sc->status);
3700
3701 return 0;
3702err_ah:
3703 ath5k_hw_detach(sc->ah);
3704err_free_ah:
3705 kfree(sc->ah);
3706err_irq:
3707 free_irq(pdev->irq, sc);
3708err_free:
3709 ieee80211_free_hw(hw);
3710err_map:
3711 pci_iounmap(pdev, mem);
3712err_reg:
3713 pci_release_region(pdev, 0);
3714err_dis:
3715 pci_disable_device(pdev);
3716err:
3717 return ret;
3718}
3719
3720static void __devexit
3721ath5k_pci_remove(struct pci_dev *pdev)
3722{
3723 struct ath5k_softc *sc = pci_get_drvdata(pdev);
3724
3725 ath5k_debug_finish_device(sc);
3726 ath5k_detach(pdev, sc->hw);
3727 ath5k_hw_detach(sc->ah);
3728 kfree(sc->ah);
3729 free_irq(pdev->irq, sc);
3730 pci_iounmap(pdev, sc->iobase);
3731 pci_release_region(pdev, 0);
3732 pci_disable_device(pdev);
3733 ieee80211_free_hw(sc->hw);
3734}
3735
3736#ifdef CONFIG_PM_SLEEP
3737static int ath5k_pci_suspend(struct device *dev)
3738{
3739 struct ath5k_softc *sc = pci_get_drvdata(to_pci_dev(dev));
3740
3741 ath5k_led_off(sc);
3742 return 0;
3743}
3744
3745static int ath5k_pci_resume(struct device *dev)
3746{
3747 struct pci_dev *pdev = to_pci_dev(dev);
3748 struct ath5k_softc *sc = pci_get_drvdata(pdev);
3749
3750 /*
3751 * Suspend/Resume resets the PCI configuration space, so we have to
3752 * re-disable the RETRY_TIMEOUT register (0x41) to keep
3753 * PCI Tx retries from interfering with C3 CPU state
3754 */
3755 pci_write_config_byte(pdev, 0x41, 0);
3756
3757 ath5k_led_enable(sc);
3758 return 0;
3759}
3760
3761static SIMPLE_DEV_PM_OPS(ath5k_pm_ops, ath5k_pci_suspend, ath5k_pci_resume);
3762#define ATH5K_PM_OPS (&ath5k_pm_ops)
3763#else
3764#define ATH5K_PM_OPS NULL
3765#endif /* CONFIG_PM_SLEEP */
3766
3767static struct pci_driver ath5k_pci_driver = {
3768 .name = KBUILD_MODNAME,
3769 .id_table = ath5k_pci_id_table,
3770 .probe = ath5k_pci_probe,
3771 .remove = __devexit_p(ath5k_pci_remove),
3772 .driver.pm = ATH5K_PM_OPS,
3773};
3774
3775/*
3776 * Module init/exit functions
3777 */
3778static int __init
3779init_ath5k_pci(void)
3780{
3781 int ret;
3782
3783 ret = pci_register_driver(&ath5k_pci_driver);
3784 if (ret) {
3785 printk(KERN_ERR "ath5k_pci: can't register pci driver\n");
3786 return ret;
3787 }
3788
3789 return 0;
3790}
3791
3792static void __exit
3793exit_ath5k_pci(void)
3794{
3795 pci_unregister_driver(&ath5k_pci_driver);
3796}
3797
3798module_init(init_ath5k_pci);
3799module_exit(exit_ath5k_pci);
diff --git a/drivers/net/wireless/ath/ath5k/base.h b/drivers/net/wireless/ath/ath5k/base.h
index 9a79773cdc2a..aa6c32aafb59 100644
--- a/drivers/net/wireless/ath/ath5k/base.h
+++ b/drivers/net/wireless/ath/ath5k/base.h
@@ -169,7 +169,10 @@ struct ath5k_vif {
169/* Software Carrier, keeps track of the driver state 169/* Software Carrier, keeps track of the driver state
170 * associated with an instance of a device */ 170 * associated with an instance of a device */
171struct ath5k_softc { 171struct ath5k_softc {
172 struct pci_dev *pdev; /* for dma mapping */ 172 struct pci_dev *pdev;
173 struct device *dev; /* for dma mapping */
174 int irq;
175 u16 devid;
173 void __iomem *iobase; /* address of the device */ 176 void __iomem *iobase; /* address of the device */
174 struct mutex lock; /* dev-level lock */ 177 struct mutex lock; /* dev-level lock */
175 struct ieee80211_hw *hw; /* IEEE 802.11 common */ 178 struct ieee80211_hw *hw; /* IEEE 802.11 common */
diff --git a/drivers/net/wireless/ath/ath5k/caps.c b/drivers/net/wireless/ath/ath5k/caps.c
index beae519aa735..31cad80e9b01 100644
--- a/drivers/net/wireless/ath/ath5k/caps.c
+++ b/drivers/net/wireless/ath/ath5k/caps.c
@@ -49,7 +49,6 @@ int ath5k_hw_set_capabilities(struct ath5k_hw *ah)
49 49
50 /* Set supported modes */ 50 /* Set supported modes */
51 __set_bit(AR5K_MODE_11A, ah->ah_capabilities.cap_mode); 51 __set_bit(AR5K_MODE_11A, ah->ah_capabilities.cap_mode);
52 __set_bit(AR5K_MODE_11A_TURBO, ah->ah_capabilities.cap_mode);
53 } else { 52 } else {
54 /* 53 /*
55 * XXX The tranceiver supports frequencies from 4920 to 6100GHz 54 * XXX The tranceiver supports frequencies from 4920 to 6100GHz
@@ -74,11 +73,6 @@ int ath5k_hw_set_capabilities(struct ath5k_hw *ah)
74 /* Set supported modes */ 73 /* Set supported modes */
75 __set_bit(AR5K_MODE_11A, 74 __set_bit(AR5K_MODE_11A,
76 ah->ah_capabilities.cap_mode); 75 ah->ah_capabilities.cap_mode);
77 __set_bit(AR5K_MODE_11A_TURBO,
78 ah->ah_capabilities.cap_mode);
79 if (ah->ah_version == AR5K_AR5212)
80 __set_bit(AR5K_MODE_11G_TURBO,
81 ah->ah_capabilities.cap_mode);
82 } 76 }
83 77
84 /* Enable 802.11b if a 2GHz capable radio (2111/5112) is 78 /* Enable 802.11b if a 2GHz capable radio (2111/5112) is
diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c
index 7d785cb60ce0..5341dd2860d3 100644
--- a/drivers/net/wireless/ath/ath5k/debug.c
+++ b/drivers/net/wireless/ath/ath5k/debug.c
@@ -312,6 +312,7 @@ static const struct {
312 { ATH5K_DEBUG_DUMP_RX, "dumprx", "print received skb content" }, 312 { ATH5K_DEBUG_DUMP_RX, "dumprx", "print received skb content" },
313 { ATH5K_DEBUG_DUMP_TX, "dumptx", "print transmit skb content" }, 313 { ATH5K_DEBUG_DUMP_TX, "dumptx", "print transmit skb content" },
314 { ATH5K_DEBUG_DUMPBANDS, "dumpbands", "dump bands" }, 314 { ATH5K_DEBUG_DUMPBANDS, "dumpbands", "dump bands" },
315 { ATH5K_DEBUG_DMA, "dma", "dma start/stop" },
315 { ATH5K_DEBUG_ANI, "ani", "adaptive noise immunity" }, 316 { ATH5K_DEBUG_ANI, "ani", "adaptive noise immunity" },
316 { ATH5K_DEBUG_DESC, "desc", "descriptor chains" }, 317 { ATH5K_DEBUG_DESC, "desc", "descriptor chains" },
317 { ATH5K_DEBUG_ANY, "all", "show all debug levels" }, 318 { ATH5K_DEBUG_ANY, "all", "show all debug levels" },
diff --git a/drivers/net/wireless/ath/ath5k/debug.h b/drivers/net/wireless/ath/ath5k/debug.h
index 236edbd2507d..3e34428d5126 100644
--- a/drivers/net/wireless/ath/ath5k/debug.h
+++ b/drivers/net/wireless/ath/ath5k/debug.h
@@ -95,6 +95,7 @@ struct ath5k_dbg_info {
95 * @ATH5K_DEBUG_DUMP_RX: print received skb content 95 * @ATH5K_DEBUG_DUMP_RX: print received skb content
96 * @ATH5K_DEBUG_DUMP_TX: print transmit skb content 96 * @ATH5K_DEBUG_DUMP_TX: print transmit skb content
97 * @ATH5K_DEBUG_DUMPBANDS: dump bands 97 * @ATH5K_DEBUG_DUMPBANDS: dump bands
98 * @ATH5K_DEBUG_DMA: debug dma start/stop
98 * @ATH5K_DEBUG_TRACE: trace function calls 99 * @ATH5K_DEBUG_TRACE: trace function calls
99 * @ATH5K_DEBUG_DESC: descriptor setup 100 * @ATH5K_DEBUG_DESC: descriptor setup
100 * @ATH5K_DEBUG_ANY: show at any debug level 101 * @ATH5K_DEBUG_ANY: show at any debug level
@@ -118,6 +119,7 @@ enum ath5k_debug_level {
118 ATH5K_DEBUG_DUMP_RX = 0x00000100, 119 ATH5K_DEBUG_DUMP_RX = 0x00000100,
119 ATH5K_DEBUG_DUMP_TX = 0x00000200, 120 ATH5K_DEBUG_DUMP_TX = 0x00000200,
120 ATH5K_DEBUG_DUMPBANDS = 0x00000400, 121 ATH5K_DEBUG_DUMPBANDS = 0x00000400,
122 ATH5K_DEBUG_DMA = 0x00000800,
121 ATH5K_DEBUG_ANI = 0x00002000, 123 ATH5K_DEBUG_ANI = 0x00002000,
122 ATH5K_DEBUG_DESC = 0x00004000, 124 ATH5K_DEBUG_DESC = 0x00004000,
123 ATH5K_DEBUG_ANY = 0xffffffff 125 ATH5K_DEBUG_ANY = 0xffffffff
diff --git a/drivers/net/wireless/ath/ath5k/desc.c b/drivers/net/wireless/ath/ath5k/desc.c
index 43244382f213..16b44ff7dd3e 100644
--- a/drivers/net/wireless/ath/ath5k/desc.c
+++ b/drivers/net/wireless/ath/ath5k/desc.c
@@ -26,9 +26,10 @@
26#include "debug.h" 26#include "debug.h"
27#include "base.h" 27#include "base.h"
28 28
29/* 29
30 * TX Descriptors 30/************************\
31 */ 31* TX Control descriptors *
32\************************/
32 33
33/* 34/*
34 * Initialize the 2-word tx control descriptor on 5210/5211 35 * Initialize the 2-word tx control descriptor on 5210/5211
@@ -335,6 +336,11 @@ ath5k_hw_setup_mrr_tx_desc(struct ath5k_hw *ah, struct ath5k_desc *desc,
335 return 0; 336 return 0;
336} 337}
337 338
339
340/***********************\
341* TX Status descriptors *
342\***********************/
343
338/* 344/*
339 * Proccess the tx status descriptor on 5210/5211 345 * Proccess the tx status descriptor on 5210/5211
340 */ 346 */
@@ -476,9 +482,10 @@ static int ath5k_hw_proc_4word_tx_status(struct ath5k_hw *ah,
476 return 0; 482 return 0;
477} 483}
478 484
479/* 485
480 * RX Descriptors 486/****************\
481 */ 487* RX Descriptors *
488\****************/
482 489
483/* 490/*
484 * Initialize an rx control descriptor 491 * Initialize an rx control descriptor
@@ -666,6 +673,11 @@ static int ath5k_hw_proc_5212_rx_status(struct ath5k_hw *ah,
666 return 0; 673 return 0;
667} 674}
668 675
676
677/********\
678* Attach *
679\********/
680
669/* 681/*
670 * Init function pointers inside ath5k_hw struct 682 * Init function pointers inside ath5k_hw struct
671 */ 683 */
diff --git a/drivers/net/wireless/ath/ath5k/dma.c b/drivers/net/wireless/ath/ath5k/dma.c
index 923c9ca5c4f0..82541fec9f0e 100644
--- a/drivers/net/wireless/ath/ath5k/dma.c
+++ b/drivers/net/wireless/ath/ath5k/dma.c
@@ -37,6 +37,7 @@
37#include "debug.h" 37#include "debug.h"
38#include "base.h" 38#include "base.h"
39 39
40
40/*********\ 41/*********\
41* Receive * 42* Receive *
42\*********/ 43\*********/
@@ -57,7 +58,7 @@ void ath5k_hw_start_rx_dma(struct ath5k_hw *ah)
57 * 58 *
58 * @ah: The &struct ath5k_hw 59 * @ah: The &struct ath5k_hw
59 */ 60 */
60int ath5k_hw_stop_rx_dma(struct ath5k_hw *ah) 61static int ath5k_hw_stop_rx_dma(struct ath5k_hw *ah)
61{ 62{
62 unsigned int i; 63 unsigned int i;
63 64
@@ -69,7 +70,11 @@ int ath5k_hw_stop_rx_dma(struct ath5k_hw *ah)
69 for (i = 1000; i > 0 && 70 for (i = 1000; i > 0 &&
70 (ath5k_hw_reg_read(ah, AR5K_CR) & AR5K_CR_RXE) != 0; 71 (ath5k_hw_reg_read(ah, AR5K_CR) & AR5K_CR_RXE) != 0;
71 i--) 72 i--)
72 udelay(10); 73 udelay(100);
74
75 if (i)
76 ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA,
77 "failed to stop RX DMA !\n");
73 78
74 return i ? 0 : -EBUSY; 79 return i ? 0 : -EBUSY;
75} 80}
@@ -90,11 +95,18 @@ u32 ath5k_hw_get_rxdp(struct ath5k_hw *ah)
90 * @ah: The &struct ath5k_hw 95 * @ah: The &struct ath5k_hw
91 * @phys_addr: RX descriptor address 96 * @phys_addr: RX descriptor address
92 * 97 *
93 * XXX: Should we check if rx is enabled before setting rxdp ? 98 * Returns -EIO if rx is active
94 */ 99 */
95void ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr) 100int ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr)
96{ 101{
102 if (ath5k_hw_reg_read(ah, AR5K_CR) & AR5K_CR_RXE) {
103 ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA,
104 "tried to set RXDP while rx was active !\n");
105 return -EIO;
106 }
107
97 ath5k_hw_reg_write(ah, phys_addr, AR5K_RXDP); 108 ath5k_hw_reg_write(ah, phys_addr, AR5K_RXDP);
109 return 0;
98} 110}
99 111
100 112
@@ -125,7 +137,7 @@ int ath5k_hw_start_tx_dma(struct ath5k_hw *ah, unsigned int queue)
125 137
126 /* Return if queue is declared inactive */ 138 /* Return if queue is declared inactive */
127 if (ah->ah_txq[queue].tqi_type == AR5K_TX_QUEUE_INACTIVE) 139 if (ah->ah_txq[queue].tqi_type == AR5K_TX_QUEUE_INACTIVE)
128 return -EIO; 140 return -EINVAL;
129 141
130 if (ah->ah_version == AR5K_AR5210) { 142 if (ah->ah_version == AR5K_AR5210) {
131 tx_queue = ath5k_hw_reg_read(ah, AR5K_CR); 143 tx_queue = ath5k_hw_reg_read(ah, AR5K_CR);
@@ -173,10 +185,10 @@ int ath5k_hw_start_tx_dma(struct ath5k_hw *ah, unsigned int queue)
173 * 185 *
174 * Stop DMA transmit on a specific hw queue and drain queue so we don't 186 * Stop DMA transmit on a specific hw queue and drain queue so we don't
175 * have any pending frames. Returns -EBUSY if we still have pending frames, 187 * have any pending frames. Returns -EBUSY if we still have pending frames,
176 * -EINVAL if queue number is out of range. 188 * -EINVAL if queue number is out of range or inactive.
177 * 189 *
178 */ 190 */
179int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue) 191static int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue)
180{ 192{
181 unsigned int i = 40; 193 unsigned int i = 40;
182 u32 tx_queue, pending; 194 u32 tx_queue, pending;
@@ -185,7 +197,7 @@ int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue)
185 197
186 /* Return if queue is declared inactive */ 198 /* Return if queue is declared inactive */
187 if (ah->ah_txq[queue].tqi_type == AR5K_TX_QUEUE_INACTIVE) 199 if (ah->ah_txq[queue].tqi_type == AR5K_TX_QUEUE_INACTIVE)
188 return -EIO; 200 return -EINVAL;
189 201
190 if (ah->ah_version == AR5K_AR5210) { 202 if (ah->ah_version == AR5K_AR5210) {
191 tx_queue = ath5k_hw_reg_read(ah, AR5K_CR); 203 tx_queue = ath5k_hw_reg_read(ah, AR5K_CR);
@@ -211,12 +223,31 @@ int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue)
211 ath5k_hw_reg_write(ah, tx_queue, AR5K_CR); 223 ath5k_hw_reg_write(ah, tx_queue, AR5K_CR);
212 ath5k_hw_reg_read(ah, AR5K_CR); 224 ath5k_hw_reg_read(ah, AR5K_CR);
213 } else { 225 } else {
226
227 /*
228 * Enable DCU early termination to quickly
229 * flush any pending frames from QCU
230 */
231 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue),
232 AR5K_QCU_MISC_DCU_EARLY);
233
214 /* 234 /*
215 * Schedule TX disable and wait until queue is empty 235 * Schedule TX disable and wait until queue is empty
216 */ 236 */
217 AR5K_REG_WRITE_Q(ah, AR5K_QCU_TXD, queue); 237 AR5K_REG_WRITE_Q(ah, AR5K_QCU_TXD, queue);
218 238
219 /*Check for pending frames*/ 239 /* Wait for queue to stop */
240 for (i = 1000; i > 0 &&
241 (AR5K_REG_READ_Q(ah, AR5K_QCU_TXE, queue) != 0);
242 i--)
243 udelay(100);
244
245 if (AR5K_REG_READ_Q(ah, AR5K_QCU_TXE, queue))
246 ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA,
247 "queue %i didn't stop !\n", queue);
248
249 /* Check for pending frames */
250 i = 1000;
220 do { 251 do {
221 pending = ath5k_hw_reg_read(ah, 252 pending = ath5k_hw_reg_read(ah,
222 AR5K_QUEUE_STATUS(queue)) & 253 AR5K_QUEUE_STATUS(queue)) &
@@ -247,12 +278,12 @@ int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue)
247 AR5K_DIAG_SW_CHANNEL_IDLE_HIGH); 278 AR5K_DIAG_SW_CHANNEL_IDLE_HIGH);
248 279
249 /* Wait a while and disable mechanism */ 280 /* Wait a while and disable mechanism */
250 udelay(200); 281 udelay(400);
251 AR5K_REG_DISABLE_BITS(ah, AR5K_QUIET_CTL1, 282 AR5K_REG_DISABLE_BITS(ah, AR5K_QUIET_CTL1,
252 AR5K_QUIET_CTL1_QT_EN); 283 AR5K_QUIET_CTL1_QT_EN);
253 284
254 /* Re-check for pending frames */ 285 /* Re-check for pending frames */
255 i = 40; 286 i = 100;
256 do { 287 do {
257 pending = ath5k_hw_reg_read(ah, 288 pending = ath5k_hw_reg_read(ah,
258 AR5K_QUEUE_STATUS(queue)) & 289 AR5K_QUEUE_STATUS(queue)) &
@@ -262,12 +293,27 @@ int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue)
262 293
263 AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW_5211, 294 AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW_5211,
264 AR5K_DIAG_SW_CHANNEL_IDLE_HIGH); 295 AR5K_DIAG_SW_CHANNEL_IDLE_HIGH);
296
297 if (pending)
298 ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA,
299 "quiet mechanism didn't work q:%i !\n",
300 queue);
265 } 301 }
266 302
303 /*
304 * Disable DCU early termination
305 */
306 AR5K_REG_DISABLE_BITS(ah, AR5K_QUEUE_MISC(queue),
307 AR5K_QCU_MISC_DCU_EARLY);
308
267 /* Clear register */ 309 /* Clear register */
268 ath5k_hw_reg_write(ah, 0, AR5K_QCU_TXD); 310 ath5k_hw_reg_write(ah, 0, AR5K_QCU_TXD);
269 if (pending) 311 if (pending) {
312 ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA,
313 "tx dma didn't stop (q:%i, frm:%i) !\n",
314 queue, pending);
270 return -EBUSY; 315 return -EBUSY;
316 }
271 } 317 }
272 318
273 /* TODO: Check for success on 5210 else return error */ 319 /* TODO: Check for success on 5210 else return error */
@@ -275,6 +321,26 @@ int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue)
275} 321}
276 322
277/** 323/**
324 * ath5k_hw_stop_beacon_queue - Stop beacon queue
325 *
326 * @ah The &struct ath5k_hw
327 * @queue The queue number
328 *
329 * Returns -EIO if queue didn't stop
330 */
331int ath5k_hw_stop_beacon_queue(struct ath5k_hw *ah, unsigned int queue)
332{
333 int ret;
334 ret = ath5k_hw_stop_tx_dma(ah, queue);
335 if (ret) {
336 ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA,
337 "beacon queue didn't stop !\n");
338 return -EIO;
339 }
340 return 0;
341}
342
343/**
278 * ath5k_hw_get_txdp - Get TX Descriptor's address for a specific queue 344 * ath5k_hw_get_txdp - Get TX Descriptor's address for a specific queue
279 * 345 *
280 * @ah: The &struct ath5k_hw 346 * @ah: The &struct ath5k_hw
@@ -427,6 +493,7 @@ done:
427 return ret; 493 return ret;
428} 494}
429 495
496
430/*******************\ 497/*******************\
431* Interrupt masking * 498* Interrupt masking *
432\*******************/ 499\*******************/
@@ -688,3 +755,92 @@ enum ath5k_int ath5k_hw_set_imr(struct ath5k_hw *ah, enum ath5k_int new_mask)
688 return old_mask; 755 return old_mask;
689} 756}
690 757
758
759/********************\
760 Init/Stop functions
761\********************/
762
763/**
764 * ath5k_hw_dma_init - Initialize DMA unit
765 *
766 * @ah: The &struct ath5k_hw
767 *
768 * Set DMA size and pre-enable interrupts
769 * (driver handles tx/rx buffer setup and
770 * dma start/stop)
771 *
772 * XXX: Save/restore RXDP/TXDP registers ?
773 */
774void ath5k_hw_dma_init(struct ath5k_hw *ah)
775{
776 /*
777 * Set Rx/Tx DMA Configuration
778 *
779 * Set standard DMA size (128). Note that
780 * a DMA size of 512 causes rx overruns and tx errors
781 * on pci-e cards (tested on 5424 but since rx overruns
782 * also occur on 5416/5418 with madwifi we set 128
783 * for all PCI-E cards to be safe).
784 *
785 * XXX: need to check 5210 for this
786 * TODO: Check out tx triger level, it's always 64 on dumps but I
787 * guess we can tweak it and see how it goes ;-)
788 */
789 if (ah->ah_version != AR5K_AR5210) {
790 AR5K_REG_WRITE_BITS(ah, AR5K_TXCFG,
791 AR5K_TXCFG_SDMAMR, AR5K_DMASIZE_128B);
792 AR5K_REG_WRITE_BITS(ah, AR5K_RXCFG,
793 AR5K_RXCFG_SDMAMW, AR5K_DMASIZE_128B);
794 }
795
796 /* Pre-enable interrupts on 5211/5212*/
797 if (ah->ah_version != AR5K_AR5210)
798 ath5k_hw_set_imr(ah, ah->ah_imr);
799
800}
801
802/**
803 * ath5k_hw_dma_stop - stop DMA unit
804 *
805 * @ah: The &struct ath5k_hw
806 *
807 * Stop tx/rx DMA and interrupts. Returns
808 * -EBUSY if tx or rx dma failed to stop.
809 *
810 * XXX: Sometimes DMA unit hangs and we have
811 * stuck frames on tx queues, only a reset
812 * can fix that.
813 */
814int ath5k_hw_dma_stop(struct ath5k_hw *ah)
815{
816 int i, qmax, err;
817 err = 0;
818
819 /* Disable interrupts */
820 ath5k_hw_set_imr(ah, 0);
821
822 /* Stop rx dma */
823 err = ath5k_hw_stop_rx_dma(ah);
824 if (err)
825 return err;
826
827 /* Clear any pending interrupts
828 * and disable tx dma */
829 if (ah->ah_version != AR5K_AR5210) {
830 ath5k_hw_reg_write(ah, 0xffffffff, AR5K_PISR);
831 qmax = AR5K_NUM_TX_QUEUES;
832 } else {
833 /* PISR/SISR Not available on 5210 */
834 ath5k_hw_reg_read(ah, AR5K_ISR);
835 qmax = AR5K_NUM_TX_QUEUES_NOQCU;
836 }
837
838 for (i = 0; i < qmax; i++) {
839 err = ath5k_hw_stop_tx_dma(ah, i);
840 /* -EINVAL -> queue inactive */
841 if (err != -EINVAL)
842 return err;
843 }
844
845 return err;
846}
diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c
index 39722dd73e43..97eaa9a4415e 100644
--- a/drivers/net/wireless/ath/ath5k/eeprom.c
+++ b/drivers/net/wireless/ath/ath5k/eeprom.c
@@ -28,45 +28,16 @@
28#include "debug.h" 28#include "debug.h"
29#include "base.h" 29#include "base.h"
30 30
31/*
32 * Read from eeprom
33 */
34static int ath5k_hw_eeprom_read(struct ath5k_hw *ah, u32 offset, u16 *data)
35{
36 u32 status, timeout;
37
38 /*
39 * Initialize EEPROM access
40 */
41 if (ah->ah_version == AR5K_AR5210) {
42 AR5K_REG_ENABLE_BITS(ah, AR5K_PCICFG, AR5K_PCICFG_EEAE);
43 (void)ath5k_hw_reg_read(ah, AR5K_EEPROM_BASE + (4 * offset));
44 } else {
45 ath5k_hw_reg_write(ah, offset, AR5K_EEPROM_BASE);
46 AR5K_REG_ENABLE_BITS(ah, AR5K_EEPROM_CMD,
47 AR5K_EEPROM_CMD_READ);
48 }
49 31
50 for (timeout = AR5K_TUNE_REGISTER_TIMEOUT; timeout > 0; timeout--) { 32/******************\
51 status = ath5k_hw_reg_read(ah, AR5K_EEPROM_STATUS); 33* Helper functions *
52 if (status & AR5K_EEPROM_STAT_RDDONE) { 34\******************/
53 if (status & AR5K_EEPROM_STAT_RDERR)
54 return -EIO;
55 *data = (u16)(ath5k_hw_reg_read(ah, AR5K_EEPROM_DATA) &
56 0xffff);
57 return 0;
58 }
59 udelay(15);
60 }
61
62 return -ETIMEDOUT;
63}
64 35
65/* 36/*
66 * Translate binary channel representation in EEPROM to frequency 37 * Translate binary channel representation in EEPROM to frequency
67 */ 38 */
68static u16 ath5k_eeprom_bin2freq(struct ath5k_eeprom_info *ee, u16 bin, 39static u16 ath5k_eeprom_bin2freq(struct ath5k_eeprom_info *ee, u16 bin,
69 unsigned int mode) 40 unsigned int mode)
70{ 41{
71 u16 val; 42 u16 val;
72 43
@@ -89,6 +60,11 @@ static u16 ath5k_eeprom_bin2freq(struct ath5k_eeprom_info *ee, u16 bin,
89 return val; 60 return val;
90} 61}
91 62
63
64/*********\
65* Parsers *
66\*********/
67
92/* 68/*
93 * Initialize eeprom & capabilities structs 69 * Initialize eeprom & capabilities structs
94 */ 70 */
@@ -198,7 +174,7 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah)
198 * 174 *
199 * XXX: Serdes values seem to be fixed so 175 * XXX: Serdes values seem to be fixed so
200 * no need to read them here, we write them 176 * no need to read them here, we write them
201 * during ath5k_hw_attach */ 177 * during ath5k_hw_init */
202 AR5K_EEPROM_READ(AR5K_EEPROM_PCIE_OFFSET, val); 178 AR5K_EEPROM_READ(AR5K_EEPROM_PCIE_OFFSET, val);
203 ee->ee_serdes = (val == AR5K_EEPROM_PCIE_SERDES_SECTION) ? 179 ee->ee_serdes = (val == AR5K_EEPROM_PCIE_SERDES_SECTION) ?
204 true : false; 180 true : false;
@@ -647,6 +623,7 @@ ath5k_eeprom_init_11bg_2413(struct ath5k_hw *ah, unsigned int mode, int offset)
647 return 0; 623 return 0;
648} 624}
649 625
626
650/* 627/*
651 * Read power calibration for RF5111 chips 628 * Read power calibration for RF5111 chips
652 * 629 *
@@ -1514,6 +1491,7 @@ ath5k_eeprom_read_target_rate_pwr_info(struct ath5k_hw *ah, unsigned int mode)
1514 return 0; 1491 return 0;
1515} 1492}
1516 1493
1494
1517/* 1495/*
1518 * Read per channel calibration info from EEPROM 1496 * Read per channel calibration info from EEPROM
1519 * 1497 *
@@ -1607,15 +1585,6 @@ ath5k_eeprom_free_pcal_info(struct ath5k_hw *ah, int mode)
1607 return 0; 1585 return 0;
1608} 1586}
1609 1587
1610void
1611ath5k_eeprom_detach(struct ath5k_hw *ah)
1612{
1613 u8 mode;
1614
1615 for (mode = AR5K_EEPROM_MODE_11A; mode <= AR5K_EEPROM_MODE_11G; mode++)
1616 ath5k_eeprom_free_pcal_info(ah, mode);
1617}
1618
1619/* Read conformance test limits used for regulatory control */ 1588/* Read conformance test limits used for regulatory control */
1620static int 1589static int
1621ath5k_eeprom_read_ctl_info(struct ath5k_hw *ah) 1590ath5k_eeprom_read_ctl_info(struct ath5k_hw *ah)
@@ -1757,6 +1726,44 @@ ath5k_eeprom_read_spur_chans(struct ath5k_hw *ah)
1757} 1726}
1758 1727
1759/* 1728/*
1729 * Read the MAC address from eeprom
1730 */
1731int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
1732{
1733 u8 mac_d[ETH_ALEN] = {};
1734 u32 total, offset;
1735 u16 data;
1736 int octet, ret;
1737
1738 ret = ath5k_hw_nvram_read(ah, 0x20, &data);
1739 if (ret)
1740 return ret;
1741
1742 for (offset = 0x1f, octet = 0, total = 0; offset >= 0x1d; offset--) {
1743 ret = ath5k_hw_nvram_read(ah, offset, &data);
1744 if (ret)
1745 return ret;
1746
1747 total += data;
1748 mac_d[octet + 1] = data & 0xff;
1749 mac_d[octet] = data >> 8;
1750 octet += 2;
1751 }
1752
1753 if (!total || total == 3 * 0xffff)
1754 return -EINVAL;
1755
1756 memcpy(mac, mac_d, ETH_ALEN);
1757
1758 return 0;
1759}
1760
1761
1762/***********************\
1763* Init/Detach functions *
1764\***********************/
1765
1766/*
1760 * Initialize eeprom data structure 1767 * Initialize eeprom data structure
1761 */ 1768 */
1762int 1769int
@@ -1787,35 +1794,11 @@ ath5k_eeprom_init(struct ath5k_hw *ah)
1787 return 0; 1794 return 0;
1788} 1795}
1789 1796
1790/* 1797void
1791 * Read the MAC address from eeprom 1798ath5k_eeprom_detach(struct ath5k_hw *ah)
1792 */
1793int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
1794{ 1799{
1795 u8 mac_d[ETH_ALEN] = {}; 1800 u8 mode;
1796 u32 total, offset;
1797 u16 data;
1798 int octet, ret;
1799
1800 ret = ath5k_hw_eeprom_read(ah, 0x20, &data);
1801 if (ret)
1802 return ret;
1803
1804 for (offset = 0x1f, octet = 0, total = 0; offset >= 0x1d; offset--) {
1805 ret = ath5k_hw_eeprom_read(ah, offset, &data);
1806 if (ret)
1807 return ret;
1808
1809 total += data;
1810 mac_d[octet + 1] = data & 0xff;
1811 mac_d[octet] = data >> 8;
1812 octet += 2;
1813 }
1814
1815 if (!total || total == 3 * 0xffff)
1816 return -EINVAL;
1817
1818 memcpy(mac, mac_d, ETH_ALEN);
1819 1801
1820 return 0; 1802 for (mode = AR5K_EEPROM_MODE_11A; mode <= AR5K_EEPROM_MODE_11G; mode++)
1803 ath5k_eeprom_free_pcal_info(ah, mode);
1821} 1804}
diff --git a/drivers/net/wireless/ath/ath5k/eeprom.h b/drivers/net/wireless/ath/ath5k/eeprom.h
index c4a6d5f26af4..0017006be841 100644
--- a/drivers/net/wireless/ath/ath5k/eeprom.h
+++ b/drivers/net/wireless/ath/ath5k/eeprom.h
@@ -241,7 +241,7 @@ enum ath5k_eeprom_freq_bands{
241#define AR5K_SPUR_SYMBOL_WIDTH_TURBO_100Hz 6250 241#define AR5K_SPUR_SYMBOL_WIDTH_TURBO_100Hz 6250
242 242
243#define AR5K_EEPROM_READ(_o, _v) do { \ 243#define AR5K_EEPROM_READ(_o, _v) do { \
244 ret = ath5k_hw_eeprom_read(ah, (_o), &(_v)); \ 244 ret = ath5k_hw_nvram_read(ah, (_o), &(_v)); \
245 if (ret) \ 245 if (ret) \
246 return ret; \ 246 return ret; \
247} while (0) 247} while (0)
diff --git a/drivers/net/wireless/ath/ath5k/initvals.c b/drivers/net/wireless/ath/ath5k/initvals.c
index 8fa439308828..e49340d18df4 100644
--- a/drivers/net/wireless/ath/ath5k/initvals.c
+++ b/drivers/net/wireless/ath/ath5k/initvals.c
@@ -44,7 +44,7 @@ struct ath5k_ini {
44 44
45struct ath5k_ini_mode { 45struct ath5k_ini_mode {
46 u16 mode_register; 46 u16 mode_register;
47 u32 mode_value[5]; 47 u32 mode_value[3];
48}; 48};
49 49
50/* Initial register settings for AR5210 */ 50/* Initial register settings for AR5210 */
@@ -391,76 +391,74 @@ static const struct ath5k_ini ar5211_ini[] = {
391 */ 391 */
392static const struct ath5k_ini_mode ar5211_ini_mode[] = { 392static const struct ath5k_ini_mode ar5211_ini_mode[] = {
393 { AR5K_TXCFG, 393 { AR5K_TXCFG,
394 /* a aTurbo b g (OFDM) */ 394 /* A/XR B G */
395 { 0x00000015, 0x00000015, 0x0000001d, 0x00000015 } }, 395 { 0x00000015, 0x0000001d, 0x00000015 } },
396 { AR5K_QUEUE_DFS_LOCAL_IFS(0), 396 { AR5K_QUEUE_DFS_LOCAL_IFS(0),
397 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 397 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
398 { AR5K_QUEUE_DFS_LOCAL_IFS(1), 398 { AR5K_QUEUE_DFS_LOCAL_IFS(1),
399 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 399 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
400 { AR5K_QUEUE_DFS_LOCAL_IFS(2), 400 { AR5K_QUEUE_DFS_LOCAL_IFS(2),
401 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 401 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
402 { AR5K_QUEUE_DFS_LOCAL_IFS(3), 402 { AR5K_QUEUE_DFS_LOCAL_IFS(3),
403 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 403 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
404 { AR5K_QUEUE_DFS_LOCAL_IFS(4), 404 { AR5K_QUEUE_DFS_LOCAL_IFS(4),
405 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 405 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
406 { AR5K_QUEUE_DFS_LOCAL_IFS(5), 406 { AR5K_QUEUE_DFS_LOCAL_IFS(5),
407 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 407 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
408 { AR5K_QUEUE_DFS_LOCAL_IFS(6), 408 { AR5K_QUEUE_DFS_LOCAL_IFS(6),
409 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 409 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
410 { AR5K_QUEUE_DFS_LOCAL_IFS(7), 410 { AR5K_QUEUE_DFS_LOCAL_IFS(7),
411 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 411 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
412 { AR5K_QUEUE_DFS_LOCAL_IFS(8), 412 { AR5K_QUEUE_DFS_LOCAL_IFS(8),
413 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 413 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
414 { AR5K_QUEUE_DFS_LOCAL_IFS(9), 414 { AR5K_QUEUE_DFS_LOCAL_IFS(9),
415 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } }, 415 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
416 { AR5K_DCU_GBL_IFS_SLOT, 416 { AR5K_DCU_GBL_IFS_SLOT,
417 { 0x00000168, 0x000001e0, 0x000001b8, 0x00000168 } }, 417 { 0x00000168, 0x000001b8, 0x00000168 } },
418 { AR5K_DCU_GBL_IFS_SIFS, 418 { AR5K_DCU_GBL_IFS_SIFS,
419 { 0x00000230, 0x000001e0, 0x000000b0, 0x00000230 } }, 419 { 0x00000230, 0x000000b0, 0x00000230 } },
420 { AR5K_DCU_GBL_IFS_EIFS, 420 { AR5K_DCU_GBL_IFS_EIFS,
421 { 0x00000d98, 0x00001180, 0x00001f48, 0x00000d98 } }, 421 { 0x00000d98, 0x00001f48, 0x00000d98 } },
422 { AR5K_DCU_GBL_IFS_MISC, 422 { AR5K_DCU_GBL_IFS_MISC,
423 { 0x0000a0e0, 0x00014068, 0x00005880, 0x0000a0e0 } }, 423 { 0x0000a0e0, 0x00005880, 0x0000a0e0 } },
424 { AR5K_TIME_OUT, 424 { AR5K_TIME_OUT,
425 { 0x04000400, 0x08000800, 0x20003000, 0x04000400 } }, 425 { 0x04000400, 0x20003000, 0x04000400 } },
426 { AR5K_USEC_5211, 426 { AR5K_USEC_5211,
427 { 0x0e8d8fa7, 0x0e8d8fcf, 0x01608f95, 0x0e8d8fa7 } }, 427 { 0x0e8d8fa7, 0x01608f95, 0x0e8d8fa7 } },
428 { AR5K_PHY_TURBO,
429 { 0x00000000, 0x00000003, 0x00000000, 0x00000000 } },
430 { AR5K_PHY(8), 428 { AR5K_PHY(8),
431 { 0x02020200, 0x02020200, 0x02010200, 0x02020200 } }, 429 { 0x02020200, 0x02010200, 0x02020200 } },
432 { AR5K_PHY(9), 430 { AR5K_PHY_RF_CTL2,
433 { 0x00000e0e, 0x00000e0e, 0x00000707, 0x00000e0e } }, 431 { 0x00000e0e, 0x00000707, 0x00000e0e } },
434 { AR5K_PHY(10), 432 { AR5K_PHY_RF_CTL3,
435 { 0x0a020001, 0x0a020001, 0x05010000, 0x0a020001 } }, 433 { 0x0a020001, 0x05010000, 0x0a020001 } },
436 { AR5K_PHY(13), 434 { AR5K_PHY_RF_CTL4,
437 { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } }, 435 { 0x00000e0e, 0x00000e0e, 0x00000e0e } },
438 { AR5K_PHY(14), 436 { AR5K_PHY_PA_CTL,
439 { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b } }, 437 { 0x00000007, 0x0000000b, 0x0000000b } },
440 { AR5K_PHY(17), 438 { AR5K_PHY_SETTLING,
441 { 0x1372169c, 0x137216a5, 0x137216a8, 0x1372169c } }, 439 { 0x1372169c, 0x137216a8, 0x1372169c } },
442 { AR5K_PHY(18), 440 { AR5K_PHY_GAIN,
443 { 0x0018ba67, 0x0018ba67, 0x0018ba69, 0x0018ba69 } }, 441 { 0x0018ba67, 0x0018ba69, 0x0018ba69 } },
444 { AR5K_PHY(20), 442 { AR5K_PHY_DESIRED_SIZE,
445 { 0x0c28b4e0, 0x0c28b4e0, 0x0c28b4e0, 0x0c28b4e0 } }, 443 { 0x0c28b4e0, 0x0c28b4e0, 0x0c28b4e0 } },
446 { AR5K_PHY_SIG, 444 { AR5K_PHY_SIG,
447 { 0x7e800d2e, 0x7e800d2e, 0x7ec00d2e, 0x7e800d2e } }, 445 { 0x7e800d2e, 0x7ec00d2e, 0x7e800d2e } },
448 { AR5K_PHY_AGCCOARSE, 446 { AR5K_PHY_AGCCOARSE,
449 { 0x31375d5e, 0x31375d5e, 0x313a5d5e, 0x31375d5e } }, 447 { 0x31375d5e, 0x313a5d5e, 0x31375d5e } },
450 { AR5K_PHY_AGCCTL, 448 { AR5K_PHY_AGCCTL,
451 { 0x0000bd10, 0x0000bd10, 0x0000bd38, 0x0000bd10 } }, 449 { 0x0000bd10, 0x0000bd38, 0x0000bd10 } },
452 { AR5K_PHY_NF, 450 { AR5K_PHY_NF,
453 { 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 } }, 451 { 0x0001ce00, 0x0001ce00, 0x0001ce00 } },
454 { AR5K_PHY_RX_DELAY, 452 { AR5K_PHY_RX_DELAY,
455 { 0x00002710, 0x00002710, 0x0000157c, 0x00002710 } }, 453 { 0x00002710, 0x0000157c, 0x00002710 } },
456 { AR5K_PHY(70), 454 { AR5K_PHY(70),
457 { 0x00000190, 0x00000190, 0x00000084, 0x00000190 } }, 455 { 0x00000190, 0x00000084, 0x00000190 } },
458 { AR5K_PHY_FRAME_CTL_5211, 456 { AR5K_PHY_FRAME_CTL_5211,
459 { 0x6fe01020, 0x6fe01020, 0x6fe00920, 0x6fe01020 } }, 457 { 0x6fe01020, 0x6fe00920, 0x6fe01020 } },
460 { AR5K_PHY_PCDAC_TXPOWER_BASE, 458 { AR5K_PHY_PCDAC_TXPOWER_BASE,
461 { 0x05ff14ff, 0x05ff14ff, 0x05ff14ff, 0x05ff19ff } }, 459 { 0x05ff14ff, 0x05ff14ff, 0x05ff19ff } },
462 { AR5K_RF_BUFFER_CONTROL_4, 460 { AR5K_RF_BUFFER_CONTROL_4,
463 { 0x00000010, 0x00000014, 0x00000010, 0x00000010 } }, 461 { 0x00000010, 0x00000010, 0x00000010 } },
464}; 462};
465 463
466/* Initial register settings for AR5212 */ 464/* Initial register settings for AR5212 */
@@ -677,89 +675,87 @@ static const struct ath5k_ini ar5212_ini_common_start[] = {
677/* Initial mode-specific settings for AR5212 (Written before ar5212_ini) */ 675/* Initial mode-specific settings for AR5212 (Written before ar5212_ini) */
678static const struct ath5k_ini_mode ar5212_ini_mode_start[] = { 676static const struct ath5k_ini_mode ar5212_ini_mode_start[] = {
679 { AR5K_QUEUE_DFS_LOCAL_IFS(0), 677 { AR5K_QUEUE_DFS_LOCAL_IFS(0),
680 /* a/XR aTurbo b g (DYN) gTurbo */ 678 /* A/XR B G */
681 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 679 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
682 { AR5K_QUEUE_DFS_LOCAL_IFS(1), 680 { AR5K_QUEUE_DFS_LOCAL_IFS(1),
683 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 681 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
684 { AR5K_QUEUE_DFS_LOCAL_IFS(2), 682 { AR5K_QUEUE_DFS_LOCAL_IFS(2),
685 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 683 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
686 { AR5K_QUEUE_DFS_LOCAL_IFS(3), 684 { AR5K_QUEUE_DFS_LOCAL_IFS(3),
687 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 685 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
688 { AR5K_QUEUE_DFS_LOCAL_IFS(4), 686 { AR5K_QUEUE_DFS_LOCAL_IFS(4),
689 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 687 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
690 { AR5K_QUEUE_DFS_LOCAL_IFS(5), 688 { AR5K_QUEUE_DFS_LOCAL_IFS(5),
691 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 689 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
692 { AR5K_QUEUE_DFS_LOCAL_IFS(6), 690 { AR5K_QUEUE_DFS_LOCAL_IFS(6),
693 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 691 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
694 { AR5K_QUEUE_DFS_LOCAL_IFS(7), 692 { AR5K_QUEUE_DFS_LOCAL_IFS(7),
695 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 693 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
696 { AR5K_QUEUE_DFS_LOCAL_IFS(8), 694 { AR5K_QUEUE_DFS_LOCAL_IFS(8),
697 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 695 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
698 { AR5K_QUEUE_DFS_LOCAL_IFS(9), 696 { AR5K_QUEUE_DFS_LOCAL_IFS(9),
699 { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } }, 697 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
700 { AR5K_DCU_GBL_IFS_SIFS, 698 { AR5K_DCU_GBL_IFS_SIFS,
701 { 0x00000230, 0x000001e0, 0x000000b0, 0x00000160, 0x000001e0 } }, 699 { 0x00000230, 0x000000b0, 0x00000160 } },
702 { AR5K_DCU_GBL_IFS_SLOT, 700 { AR5K_DCU_GBL_IFS_SLOT,
703 { 0x00000168, 0x000001e0, 0x000001b8, 0x0000018c, 0x000001e0 } }, 701 { 0x00000168, 0x000001b8, 0x0000018c } },
704 { AR5K_DCU_GBL_IFS_EIFS, 702 { AR5K_DCU_GBL_IFS_EIFS,
705 { 0x00000e60, 0x00001180, 0x00001f1c, 0x00003e38, 0x00001180 } }, 703 { 0x00000e60, 0x00001f1c, 0x00003e38 } },
706 { AR5K_DCU_GBL_IFS_MISC, 704 { AR5K_DCU_GBL_IFS_MISC,
707 { 0x0000a0e0, 0x00014068, 0x00005880, 0x0000b0e0, 0x00014068 } }, 705 { 0x0000a0e0, 0x00005880, 0x0000b0e0 } },
708 { AR5K_TIME_OUT, 706 { AR5K_TIME_OUT,
709 { 0x03e803e8, 0x06e006e0, 0x04200420, 0x08400840, 0x06e006e0 } }, 707 { 0x03e803e8, 0x04200420, 0x08400840 } },
710 { AR5K_PHY_TURBO,
711 { 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000003 } },
712 { AR5K_PHY(8), 708 { AR5K_PHY(8),
713 { 0x02020200, 0x02020200, 0x02010200, 0x02020200, 0x02020200 } }, 709 { 0x02020200, 0x02010200, 0x02020200 } },
714 { AR5K_PHY_RF_CTL2, 710 { AR5K_PHY_RF_CTL2,
715 { 0x00000e0e, 0x00000e0e, 0x00000707, 0x00000e0e, 0x00000e0e } }, 711 { 0x00000e0e, 0x00000707, 0x00000e0e } },
716 { AR5K_PHY_SETTLING, 712 { AR5K_PHY_SETTLING,
717 { 0x1372161c, 0x13721c25, 0x13721722, 0x137216a2, 0x13721c25 } }, 713 { 0x1372161c, 0x13721722, 0x137216a2 } },
718 { AR5K_PHY_AGCCTL, 714 { AR5K_PHY_AGCCTL,
719 { 0x00009d10, 0x00009d10, 0x00009d18, 0x00009d18, 0x00009d10 } }, 715 { 0x00009d10, 0x00009d18, 0x00009d18 } },
720 { AR5K_PHY_NF, 716 { AR5K_PHY_NF,
721 { 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 } }, 717 { 0x0001ce00, 0x0001ce00, 0x0001ce00 } },
722 { AR5K_PHY_WEAK_OFDM_HIGH_THR, 718 { AR5K_PHY_WEAK_OFDM_HIGH_THR,
723 { 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190 } }, 719 { 0x409a4190, 0x409a4190, 0x409a4190 } },
724 { AR5K_PHY(70), 720 { AR5K_PHY(70),
725 { 0x000001b8, 0x000001b8, 0x00000084, 0x00000108, 0x000001b8 } }, 721 { 0x000001b8, 0x00000084, 0x00000108 } },
726 { AR5K_PHY_OFDM_SELFCORR, 722 { AR5K_PHY_OFDM_SELFCORR,
727 { 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05 } }, 723 { 0x10058a05, 0x10058a05, 0x10058a05 } },
728 { 0xa230, 724 { 0xa230,
729 { 0x00000000, 0x00000000, 0x00000000, 0x00000108, 0x00000000 } }, 725 { 0x00000000, 0x00000000, 0x00000108 } },
730}; 726};
731 727
732/* Initial mode-specific settings for AR5212 + RF5111 (Written after ar5212_ini) */ 728/* Initial mode-specific settings for AR5212 + RF5111 (Written after ar5212_ini) */
733static const struct ath5k_ini_mode rf5111_ini_mode_end[] = { 729static const struct ath5k_ini_mode rf5111_ini_mode_end[] = {
734 { AR5K_TXCFG, 730 { AR5K_TXCFG,
735 /* a/XR aTurbo b g (DYN) gTurbo */ 731 /* A/XR B G */
736 { 0x00008015, 0x00008015, 0x00008015, 0x00008015, 0x00008015 } }, 732 { 0x00008015, 0x00008015, 0x00008015 } },
737 { AR5K_USEC_5211, 733 { AR5K_USEC_5211,
738 { 0x128d8fa7, 0x09880fcf, 0x04e00f95, 0x12e00fab, 0x09880fcf } }, 734 { 0x128d8fa7, 0x04e00f95, 0x12e00fab } },
739 { AR5K_PHY_RF_CTL3, 735 { AR5K_PHY_RF_CTL3,
740 { 0x0a020001, 0x0a020001, 0x05010100, 0x0a020001, 0x0a020001 } }, 736 { 0x0a020001, 0x05010100, 0x0a020001 } },
741 { AR5K_PHY_RF_CTL4, 737 { AR5K_PHY_RF_CTL4,
742 { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } }, 738 { 0x00000e0e, 0x00000e0e, 0x00000e0e } },
743 { AR5K_PHY_PA_CTL, 739 { AR5K_PHY_PA_CTL,
744 { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } }, 740 { 0x00000007, 0x0000000b, 0x0000000b } },
745 { AR5K_PHY_GAIN, 741 { AR5K_PHY_GAIN,
746 { 0x0018da5a, 0x0018da5a, 0x0018ca69, 0x0018ca69, 0x0018ca69 } }, 742 { 0x0018da5a, 0x0018ca69, 0x0018ca69 } },
747 { AR5K_PHY_DESIRED_SIZE, 743 { AR5K_PHY_DESIRED_SIZE,
748 { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } }, 744 { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } },
749 { AR5K_PHY_SIG, 745 { AR5K_PHY_SIG,
750 { 0x7e800d2e, 0x7e800d2e, 0x7ee84d2e, 0x7ee84d2e, 0x7e800d2e } }, 746 { 0x7e800d2e, 0x7ee84d2e, 0x7ee84d2e } },
751 { AR5K_PHY_AGCCOARSE, 747 { AR5K_PHY_AGCCOARSE,
752 { 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e, 0x3137615e } }, 748 { 0x3137665e, 0x3137665e, 0x3137665e } },
753 { AR5K_PHY_WEAK_OFDM_LOW_THR, 749 { AR5K_PHY_WEAK_OFDM_LOW_THR,
754 { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb080, 0x050cb080 } }, 750 { 0x050cb081, 0x050cb081, 0x050cb080 } },
755 { AR5K_PHY_RX_DELAY, 751 { AR5K_PHY_RX_DELAY,
756 { 0x00002710, 0x00002710, 0x0000157c, 0x00002af8, 0x00002710 } }, 752 { 0x00002710, 0x0000157c, 0x00002af8 } },
757 { AR5K_PHY_FRAME_CTL_5211, 753 { AR5K_PHY_FRAME_CTL_5211,
758 { 0xf7b81020, 0xf7b81020, 0xf7b80d20, 0xf7b81020, 0xf7b81020 } }, 754 { 0xf7b81020, 0xf7b80d20, 0xf7b81020 } },
759 { AR5K_PHY_GAIN_2GHZ, 755 { AR5K_PHY_GAIN_2GHZ,
760 { 0x642c416a, 0x642c416a, 0x6440416a, 0x6440416a, 0x6440416a } }, 756 { 0x642c416a, 0x6440416a, 0x6440416a } },
761 { AR5K_PHY_CCK_RX_CTL_4, 757 { AR5K_PHY_CCK_RX_CTL_4,
762 { 0x1883800a, 0x1883800a, 0x1873800a, 0x1883800a, 0x1883800a } }, 758 { 0x1883800a, 0x1873800a, 0x1883800a } },
763}; 759};
764 760
765static const struct ath5k_ini rf5111_ini_common_end[] = { 761static const struct ath5k_ini rf5111_ini_common_end[] = {
@@ -782,38 +778,38 @@ static const struct ath5k_ini rf5111_ini_common_end[] = {
782/* Initial mode-specific settings for AR5212 + RF5112 (Written after ar5212_ini) */ 778/* Initial mode-specific settings for AR5212 + RF5112 (Written after ar5212_ini) */
783static const struct ath5k_ini_mode rf5112_ini_mode_end[] = { 779static const struct ath5k_ini_mode rf5112_ini_mode_end[] = {
784 { AR5K_TXCFG, 780 { AR5K_TXCFG,
785 /* a/XR aTurbo b g (DYN) gTurbo */ 781 /* A/XR B G */
786 { 0x00008015, 0x00008015, 0x00008015, 0x00008015, 0x00008015 } }, 782 { 0x00008015, 0x00008015, 0x00008015 } },
787 { AR5K_USEC_5211, 783 { AR5K_USEC_5211,
788 { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } }, 784 { 0x128d93a7, 0x04e01395, 0x12e013ab } },
789 { AR5K_PHY_RF_CTL3, 785 { AR5K_PHY_RF_CTL3,
790 { 0x0a020001, 0x0a020001, 0x05020100, 0x0a020001, 0x0a020001 } }, 786 { 0x0a020001, 0x05020100, 0x0a020001 } },
791 { AR5K_PHY_RF_CTL4, 787 { AR5K_PHY_RF_CTL4,
792 { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } }, 788 { 0x00000e0e, 0x00000e0e, 0x00000e0e } },
793 { AR5K_PHY_PA_CTL, 789 { AR5K_PHY_PA_CTL,
794 { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } }, 790 { 0x00000007, 0x0000000b, 0x0000000b } },
795 { AR5K_PHY_GAIN, 791 { AR5K_PHY_GAIN,
796 { 0x0018da6d, 0x0018da6d, 0x0018ca75, 0x0018ca75, 0x0018ca75 } }, 792 { 0x0018da6d, 0x0018ca75, 0x0018ca75 } },
797 { AR5K_PHY_DESIRED_SIZE, 793 { AR5K_PHY_DESIRED_SIZE,
798 { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } }, 794 { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } },
799 { AR5K_PHY_SIG, 795 { AR5K_PHY_SIG,
800 { 0x7e800d2e, 0x7e800d2e, 0x7ee80d2e, 0x7ee80d2e, 0x7e800d2e } }, 796 { 0x7e800d2e, 0x7ee80d2e, 0x7ee80d2e } },
801 { AR5K_PHY_AGCCOARSE, 797 { AR5K_PHY_AGCCOARSE,
802 { 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e } }, 798 { 0x3137665e, 0x3137665e, 0x3137665e } },
803 { AR5K_PHY_WEAK_OFDM_LOW_THR, 799 { AR5K_PHY_WEAK_OFDM_LOW_THR,
804 { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } }, 800 { 0x050cb081, 0x050cb081, 0x050cb081 } },
805 { AR5K_PHY_RX_DELAY, 801 { AR5K_PHY_RX_DELAY,
806 { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } }, 802 { 0x000007d0, 0x0000044c, 0x00000898 } },
807 { AR5K_PHY_FRAME_CTL_5211, 803 { AR5K_PHY_FRAME_CTL_5211,
808 { 0xf7b81020, 0xf7b81020, 0xf7b80d10, 0xf7b81010, 0xf7b81010 } }, 804 { 0xf7b81020, 0xf7b80d10, 0xf7b81010 } },
809 { AR5K_PHY_CCKTXCTL, 805 { AR5K_PHY_CCKTXCTL,
810 { 0x00000000, 0x00000000, 0x00000008, 0x00000008, 0x00000008 } }, 806 { 0x00000000, 0x00000008, 0x00000008 } },
811 { AR5K_PHY_CCK_CROSSCORR, 807 { AR5K_PHY_CCK_CROSSCORR,
812 { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } }, 808 { 0xd6be6788, 0xd03e6788, 0xd03e6788 } },
813 { AR5K_PHY_GAIN_2GHZ, 809 { AR5K_PHY_GAIN_2GHZ,
814 { 0x642c0140, 0x642c0140, 0x6442c160, 0x6442c160, 0x6442c160 } }, 810 { 0x642c0140, 0x6442c160, 0x6442c160 } },
815 { AR5K_PHY_CCK_RX_CTL_4, 811 { AR5K_PHY_CCK_RX_CTL_4,
816 { 0x1883800a, 0x1883800a, 0x1873800a, 0x1883800a, 0x1883800a } }, 812 { 0x1883800a, 0x1873800a, 0x1883800a } },
817}; 813};
818 814
819static const struct ath5k_ini rf5112_ini_common_end[] = { 815static const struct ath5k_ini rf5112_ini_common_end[] = {
@@ -833,66 +829,66 @@ static const struct ath5k_ini rf5112_ini_common_end[] = {
833/* Initial mode-specific settings for RF5413/5414 (Written after ar5212_ini) */ 829/* Initial mode-specific settings for RF5413/5414 (Written after ar5212_ini) */
834static const struct ath5k_ini_mode rf5413_ini_mode_end[] = { 830static const struct ath5k_ini_mode rf5413_ini_mode_end[] = {
835 { AR5K_TXCFG, 831 { AR5K_TXCFG,
836 /* a/XR aTurbo b g (DYN) gTurbo */ 832 /* A/XR B G */
837 { 0x00000015, 0x00000015, 0x00000015, 0x00000015, 0x00000015 } }, 833 { 0x00000015, 0x00000015, 0x00000015 } },
838 { AR5K_USEC_5211, 834 { AR5K_USEC_5211,
839 { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } }, 835 { 0x128d93a7, 0x04e01395, 0x12e013ab } },
840 { AR5K_PHY_RF_CTL3, 836 { AR5K_PHY_RF_CTL3,
841 { 0x0a020001, 0x0a020001, 0x05020100, 0x0a020001, 0x0a020001 } }, 837 { 0x0a020001, 0x05020100, 0x0a020001 } },
842 { AR5K_PHY_RF_CTL4, 838 { AR5K_PHY_RF_CTL4,
843 { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } }, 839 { 0x00000e0e, 0x00000e0e, 0x00000e0e } },
844 { AR5K_PHY_PA_CTL, 840 { AR5K_PHY_PA_CTL,
845 { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } }, 841 { 0x00000007, 0x0000000b, 0x0000000b } },
846 { AR5K_PHY_GAIN, 842 { AR5K_PHY_GAIN,
847 { 0x0018fa61, 0x0018fa61, 0x001a1a63, 0x001a1a63, 0x001a1a63 } }, 843 { 0x0018fa61, 0x001a1a63, 0x001a1a63 } },
848 { AR5K_PHY_DESIRED_SIZE, 844 { AR5K_PHY_DESIRED_SIZE,
849 { 0x0c98b4e0, 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da, 0x0c98b0da } }, 845 { 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da } },
850 { AR5K_PHY_SIG, 846 { AR5K_PHY_SIG,
851 { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } }, 847 { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } },
852 { AR5K_PHY_AGCCOARSE, 848 { AR5K_PHY_AGCCOARSE,
853 { 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e } }, 849 { 0x3139605e, 0x3139605e, 0x3139605e } },
854 { AR5K_PHY_WEAK_OFDM_LOW_THR, 850 { AR5K_PHY_WEAK_OFDM_LOW_THR,
855 { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } }, 851 { 0x050cb081, 0x050cb081, 0x050cb081 } },
856 { AR5K_PHY_RX_DELAY, 852 { AR5K_PHY_RX_DELAY,
857 { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } }, 853 { 0x000007d0, 0x0000044c, 0x00000898 } },
858 { AR5K_PHY_FRAME_CTL_5211, 854 { AR5K_PHY_FRAME_CTL_5211,
859 { 0xf7b81000, 0xf7b81000, 0xf7b80d00, 0xf7b81000, 0xf7b81000 } }, 855 { 0xf7b81000, 0xf7b80d00, 0xf7b81000 } },
860 { AR5K_PHY_CCKTXCTL, 856 { AR5K_PHY_CCKTXCTL,
861 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 857 { 0x00000000, 0x00000000, 0x00000000 } },
862 { AR5K_PHY_CCK_CROSSCORR, 858 { AR5K_PHY_CCK_CROSSCORR,
863 { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } }, 859 { 0xd6be6788, 0xd03e6788, 0xd03e6788 } },
864 { AR5K_PHY_GAIN_2GHZ, 860 { AR5K_PHY_GAIN_2GHZ,
865 { 0x002ec1e0, 0x002ec1e0, 0x002ac120, 0x002ac120, 0x002ac120 } }, 861 { 0x002ec1e0, 0x002ac120, 0x002ac120 } },
866 { AR5K_PHY_CCK_RX_CTL_4, 862 { AR5K_PHY_CCK_RX_CTL_4,
867 { 0x1883800a, 0x1883800a, 0x1863800a, 0x1883800a, 0x1883800a } }, 863 { 0x1883800a, 0x1863800a, 0x1883800a } },
868 { 0xa300, 864 { 0xa300,
869 { 0x18010000, 0x18010000, 0x18010000, 0x18010000, 0x18010000 } }, 865 { 0x18010000, 0x18010000, 0x18010000 } },
870 { 0xa304, 866 { 0xa304,
871 { 0x30032602, 0x30032602, 0x30032602, 0x30032602, 0x30032602 } }, 867 { 0x30032602, 0x30032602, 0x30032602 } },
872 { 0xa308, 868 { 0xa308,
873 { 0x48073e06, 0x48073e06, 0x48073e06, 0x48073e06, 0x48073e06 } }, 869 { 0x48073e06, 0x48073e06, 0x48073e06 } },
874 { 0xa30c, 870 { 0xa30c,
875 { 0x560b4c0a, 0x560b4c0a, 0x560b4c0a, 0x560b4c0a, 0x560b4c0a } }, 871 { 0x560b4c0a, 0x560b4c0a, 0x560b4c0a } },
876 { 0xa310, 872 { 0xa310,
877 { 0x641a600f, 0x641a600f, 0x641a600f, 0x641a600f, 0x641a600f } }, 873 { 0x641a600f, 0x641a600f, 0x641a600f } },
878 { 0xa314, 874 { 0xa314,
879 { 0x784f6e1b, 0x784f6e1b, 0x784f6e1b, 0x784f6e1b, 0x784f6e1b } }, 875 { 0x784f6e1b, 0x784f6e1b, 0x784f6e1b } },
880 { 0xa318, 876 { 0xa318,
881 { 0x868f7c5a, 0x868f7c5a, 0x868f7c5a, 0x868f7c5a, 0x868f7c5a } }, 877 { 0x868f7c5a, 0x868f7c5a, 0x868f7c5a } },
882 { 0xa31c, 878 { 0xa31c,
883 { 0x90cf865b, 0x90cf865b, 0x8ecf865b, 0x8ecf865b, 0x8ecf865b } }, 879 { 0x90cf865b, 0x8ecf865b, 0x8ecf865b } },
884 { 0xa320, 880 { 0xa320,
885 { 0x9d4f970f, 0x9d4f970f, 0x9b4f970f, 0x9b4f970f, 0x9b4f970f } }, 881 { 0x9d4f970f, 0x9b4f970f, 0x9b4f970f } },
886 { 0xa324, 882 { 0xa324,
887 { 0xa7cfa38f, 0xa7cfa38f, 0xa3cf9f8f, 0xa3cf9f8f, 0xa3cf9f8f } }, 883 { 0xa7cfa38f, 0xa3cf9f8f, 0xa3cf9f8f } },
888 { 0xa328, 884 { 0xa328,
889 { 0xb55faf1f, 0xb55faf1f, 0xb35faf1f, 0xb35faf1f, 0xb35faf1f } }, 885 { 0xb55faf1f, 0xb35faf1f, 0xb35faf1f } },
890 { 0xa32c, 886 { 0xa32c,
891 { 0xbddfb99f, 0xbddfb99f, 0xbbdfb99f, 0xbbdfb99f, 0xbbdfb99f } }, 887 { 0xbddfb99f, 0xbbdfb99f, 0xbbdfb99f } },
892 { 0xa330, 888 { 0xa330,
893 { 0xcb7fc53f, 0xcb7fc53f, 0xcb7fc73f, 0xcb7fc73f, 0xcb7fc73f } }, 889 { 0xcb7fc53f, 0xcb7fc73f, 0xcb7fc73f } },
894 { 0xa334, 890 { 0xa334,
895 { 0xd5ffd1bf, 0xd5ffd1bf, 0xd3ffd1bf, 0xd3ffd1bf, 0xd3ffd1bf } }, 891 { 0xd5ffd1bf, 0xd3ffd1bf, 0xd3ffd1bf } },
896}; 892};
897 893
898static const struct ath5k_ini rf5413_ini_common_end[] = { 894static const struct ath5k_ini rf5413_ini_common_end[] = {
@@ -972,38 +968,38 @@ static const struct ath5k_ini rf5413_ini_common_end[] = {
972/* XXX: a mode ? */ 968/* XXX: a mode ? */
973static const struct ath5k_ini_mode rf2413_ini_mode_end[] = { 969static const struct ath5k_ini_mode rf2413_ini_mode_end[] = {
974 { AR5K_TXCFG, 970 { AR5K_TXCFG,
975 /* a/XR aTurbo b g (DYN) gTurbo */ 971 /* A/XR B G */
976 { 0x00000015, 0x00000015, 0x00000015, 0x00000015, 0x00000015 } }, 972 { 0x00000015, 0x00000015, 0x00000015 } },
977 { AR5K_USEC_5211, 973 { AR5K_USEC_5211,
978 { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } }, 974 { 0x128d93a7, 0x04e01395, 0x12e013ab } },
979 { AR5K_PHY_RF_CTL3, 975 { AR5K_PHY_RF_CTL3,
980 { 0x0a020001, 0x0a020001, 0x05020000, 0x0a020001, 0x0a020001 } }, 976 { 0x0a020001, 0x05020000, 0x0a020001 } },
981 { AR5K_PHY_RF_CTL4, 977 { AR5K_PHY_RF_CTL4,
982 { 0x00000e00, 0x00000e00, 0x00000e00, 0x00000e00, 0x00000e00 } }, 978 { 0x00000e00, 0x00000e00, 0x00000e00 } },
983 { AR5K_PHY_PA_CTL, 979 { AR5K_PHY_PA_CTL,
984 { 0x00000002, 0x00000002, 0x0000000a, 0x0000000a, 0x0000000a } }, 980 { 0x00000002, 0x0000000a, 0x0000000a } },
985 { AR5K_PHY_GAIN, 981 { AR5K_PHY_GAIN,
986 { 0x0018da6d, 0x0018da6d, 0x001a6a64, 0x001a6a64, 0x001a6a64 } }, 982 { 0x0018da6d, 0x001a6a64, 0x001a6a64 } },
987 { AR5K_PHY_DESIRED_SIZE, 983 { AR5K_PHY_DESIRED_SIZE,
988 { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b0da, 0x0c98b0da, 0x0de8b0da } }, 984 { 0x0de8b4e0, 0x0de8b0da, 0x0c98b0da } },
989 { AR5K_PHY_SIG, 985 { AR5K_PHY_SIG,
990 { 0x7e800d2e, 0x7e800d2e, 0x7ee80d2e, 0x7ec80d2e, 0x7e800d2e } }, 986 { 0x7e800d2e, 0x7ee80d2e, 0x7ec80d2e } },
991 { AR5K_PHY_AGCCOARSE, 987 { AR5K_PHY_AGCCOARSE,
992 { 0x3137665e, 0x3137665e, 0x3137665e, 0x3139605e, 0x3137665e } }, 988 { 0x3137665e, 0x3137665e, 0x3139605e } },
993 { AR5K_PHY_WEAK_OFDM_LOW_THR, 989 { AR5K_PHY_WEAK_OFDM_LOW_THR,
994 { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } }, 990 { 0x050cb081, 0x050cb081, 0x050cb081 } },
995 { AR5K_PHY_RX_DELAY, 991 { AR5K_PHY_RX_DELAY,
996 { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } }, 992 { 0x000007d0, 0x0000044c, 0x00000898 } },
997 { AR5K_PHY_FRAME_CTL_5211, 993 { AR5K_PHY_FRAME_CTL_5211,
998 { 0xf7b81000, 0xf7b81000, 0xf7b80d00, 0xf7b81000, 0xf7b81000 } }, 994 { 0xf7b81000, 0xf7b80d00, 0xf7b81000 } },
999 { AR5K_PHY_CCKTXCTL, 995 { AR5K_PHY_CCKTXCTL,
1000 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 996 { 0x00000000, 0x00000000, 0x00000000 } },
1001 { AR5K_PHY_CCK_CROSSCORR, 997 { AR5K_PHY_CCK_CROSSCORR,
1002 { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } }, 998 { 0xd6be6788, 0xd03e6788, 0xd03e6788 } },
1003 { AR5K_PHY_GAIN_2GHZ, 999 { AR5K_PHY_GAIN_2GHZ,
1004 { 0x002c0140, 0x002c0140, 0x0042c140, 0x0042c140, 0x0042c140 } }, 1000 { 0x002c0140, 0x0042c140, 0x0042c140 } },
1005 { AR5K_PHY_CCK_RX_CTL_4, 1001 { AR5K_PHY_CCK_RX_CTL_4,
1006 { 0x1883800a, 0x1883800a, 0x1863800a, 0x1883800a, 0x1883800a } }, 1002 { 0x1883800a, 0x1863800a, 0x1883800a } },
1007}; 1003};
1008 1004
1009static const struct ath5k_ini rf2413_ini_common_end[] = { 1005static const struct ath5k_ini rf2413_ini_common_end[] = {
@@ -1094,52 +1090,50 @@ static const struct ath5k_ini rf2413_ini_common_end[] = {
1094/* XXX: a mode ? */ 1090/* XXX: a mode ? */
1095static const struct ath5k_ini_mode rf2425_ini_mode_end[] = { 1091static const struct ath5k_ini_mode rf2425_ini_mode_end[] = {
1096 { AR5K_TXCFG, 1092 { AR5K_TXCFG,
1097 /* a/XR aTurbo b g (DYN) gTurbo */ 1093 /* A/XR B G */
1098 { 0x00000015, 0x00000015, 0x00000015, 0x00000015, 0x00000015 } }, 1094 { 0x00000015, 0x00000015, 0x00000015 } },
1099 { AR5K_USEC_5211, 1095 { AR5K_USEC_5211,
1100 { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } }, 1096 { 0x128d93a7, 0x04e01395, 0x12e013ab } },
1101 { AR5K_PHY_TURBO,
1102 { 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000001 } },
1103 { AR5K_PHY_RF_CTL3, 1097 { AR5K_PHY_RF_CTL3,
1104 { 0x0a020001, 0x0a020001, 0x05020100, 0x0a020001, 0x0a020001 } }, 1098 { 0x0a020001, 0x05020100, 0x0a020001 } },
1105 { AR5K_PHY_RF_CTL4, 1099 { AR5K_PHY_RF_CTL4,
1106 { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } }, 1100 { 0x00000e0e, 0x00000e0e, 0x00000e0e } },
1107 { AR5K_PHY_PA_CTL, 1101 { AR5K_PHY_PA_CTL,
1108 { 0x00000003, 0x00000003, 0x0000000b, 0x0000000b, 0x0000000b } }, 1102 { 0x00000003, 0x0000000b, 0x0000000b } },
1109 { AR5K_PHY_SETTLING, 1103 { AR5K_PHY_SETTLING,
1110 { 0x1372161c, 0x13721c25, 0x13721722, 0x13721422, 0x13721c25 } }, 1104 { 0x1372161c, 0x13721722, 0x13721422 } },
1111 { AR5K_PHY_GAIN, 1105 { AR5K_PHY_GAIN,
1112 { 0x0018fa61, 0x0018fa61, 0x00199a65, 0x00199a65, 0x00199a65 } }, 1106 { 0x0018fa61, 0x00199a65, 0x00199a65 } },
1113 { AR5K_PHY_DESIRED_SIZE, 1107 { AR5K_PHY_DESIRED_SIZE,
1114 { 0x0c98b4e0, 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da, 0x0c98b0da } }, 1108 { 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da } },
1115 { AR5K_PHY_SIG, 1109 { AR5K_PHY_SIG,
1116 { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } }, 1110 { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } },
1117 { AR5K_PHY_AGCCOARSE, 1111 { AR5K_PHY_AGCCOARSE,
1118 { 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e } }, 1112 { 0x3139605e, 0x3139605e, 0x3139605e } },
1119 { AR5K_PHY_WEAK_OFDM_LOW_THR, 1113 { AR5K_PHY_WEAK_OFDM_LOW_THR,
1120 { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } }, 1114 { 0x050cb081, 0x050cb081, 0x050cb081 } },
1121 { AR5K_PHY_RX_DELAY, 1115 { AR5K_PHY_RX_DELAY,
1122 { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } }, 1116 { 0x000007d0, 0x0000044c, 0x00000898 } },
1123 { AR5K_PHY_FRAME_CTL_5211, 1117 { AR5K_PHY_FRAME_CTL_5211,
1124 { 0xf7b81000, 0xf7b81000, 0xf7b80d00, 0xf7b81000, 0xf7b81000 } }, 1118 { 0xf7b81000, 0xf7b80d00, 0xf7b81000 } },
1125 { AR5K_PHY_CCKTXCTL, 1119 { AR5K_PHY_CCKTXCTL,
1126 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 1120 { 0x00000000, 0x00000000, 0x00000000 } },
1127 { AR5K_PHY_CCK_CROSSCORR, 1121 { AR5K_PHY_CCK_CROSSCORR,
1128 { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } }, 1122 { 0xd6be6788, 0xd03e6788, 0xd03e6788 } },
1129 { AR5K_PHY_GAIN_2GHZ, 1123 { AR5K_PHY_GAIN_2GHZ,
1130 { 0x00000140, 0x00000140, 0x0052c140, 0x0052c140, 0x0052c140 } }, 1124 { 0x00000140, 0x0052c140, 0x0052c140 } },
1131 { AR5K_PHY_CCK_RX_CTL_4, 1125 { AR5K_PHY_CCK_RX_CTL_4,
1132 { 0x1883800a, 0x1883800a, 0x1863800a, 0x1883800a, 0x1883800a } }, 1126 { 0x1883800a, 0x1863800a, 0x1883800a } },
1133 { 0xa324, 1127 { 0xa324,
1134 { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, 1128 { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
1135 { 0xa328, 1129 { 0xa328,
1136 { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, 1130 { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
1137 { 0xa32c, 1131 { 0xa32c,
1138 { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, 1132 { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
1139 { 0xa330, 1133 { 0xa330,
1140 { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, 1134 { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
1141 { 0xa334, 1135 { 0xa334,
1142 { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } }, 1136 { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
1143}; 1137};
1144 1138
1145static const struct ath5k_ini rf2425_ini_common_end[] = { 1139static const struct ath5k_ini rf2425_ini_common_end[] = {
@@ -1368,15 +1362,15 @@ static const struct ath5k_ini rf5112_ini_bbgain[] = {
1368 * Write initial register dump 1362 * Write initial register dump
1369 */ 1363 */
1370static void ath5k_hw_ini_registers(struct ath5k_hw *ah, unsigned int size, 1364static void ath5k_hw_ini_registers(struct ath5k_hw *ah, unsigned int size,
1371 const struct ath5k_ini *ini_regs, bool change_channel) 1365 const struct ath5k_ini *ini_regs, bool skip_pcu)
1372{ 1366{
1373 unsigned int i; 1367 unsigned int i;
1374 1368
1375 /* Write initial registers */ 1369 /* Write initial registers */
1376 for (i = 0; i < size; i++) { 1370 for (i = 0; i < size; i++) {
1377 /* On channel change there is 1371 /* Skip PCU registers if
1378 * no need to mess with PCU */ 1372 * requested */
1379 if (change_channel && 1373 if (skip_pcu &&
1380 ini_regs[i].ini_register >= AR5K_PCU_MIN && 1374 ini_regs[i].ini_register >= AR5K_PCU_MIN &&
1381 ini_regs[i].ini_register <= AR5K_PCU_MAX) 1375 ini_regs[i].ini_register <= AR5K_PCU_MAX)
1382 continue; 1376 continue;
@@ -1409,7 +1403,7 @@ static void ath5k_hw_ini_mode_registers(struct ath5k_hw *ah,
1409 1403
1410} 1404}
1411 1405
1412int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel) 1406int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool skip_pcu)
1413{ 1407{
1414 /* 1408 /*
1415 * Write initial register settings 1409 * Write initial register settings
@@ -1427,7 +1421,7 @@ int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel)
1427 * Write initial settings common for all modes 1421 * Write initial settings common for all modes
1428 */ 1422 */
1429 ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5212_ini_common_start), 1423 ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5212_ini_common_start),
1430 ar5212_ini_common_start, change_channel); 1424 ar5212_ini_common_start, skip_pcu);
1431 1425
1432 /* Second set of mode-specific settings */ 1426 /* Second set of mode-specific settings */
1433 switch (ah->ah_radio) { 1427 switch (ah->ah_radio) {
@@ -1439,12 +1433,12 @@ int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel)
1439 1433
1440 ath5k_hw_ini_registers(ah, 1434 ath5k_hw_ini_registers(ah,
1441 ARRAY_SIZE(rf5111_ini_common_end), 1435 ARRAY_SIZE(rf5111_ini_common_end),
1442 rf5111_ini_common_end, change_channel); 1436 rf5111_ini_common_end, skip_pcu);
1443 1437
1444 /* Baseband gain table */ 1438 /* Baseband gain table */
1445 ath5k_hw_ini_registers(ah, 1439 ath5k_hw_ini_registers(ah,
1446 ARRAY_SIZE(rf5111_ini_bbgain), 1440 ARRAY_SIZE(rf5111_ini_bbgain),
1447 rf5111_ini_bbgain, change_channel); 1441 rf5111_ini_bbgain, skip_pcu);
1448 1442
1449 break; 1443 break;
1450 case AR5K_RF5112: 1444 case AR5K_RF5112:
@@ -1455,11 +1449,11 @@ int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel)
1455 1449
1456 ath5k_hw_ini_registers(ah, 1450 ath5k_hw_ini_registers(ah,
1457 ARRAY_SIZE(rf5112_ini_common_end), 1451 ARRAY_SIZE(rf5112_ini_common_end),
1458 rf5112_ini_common_end, change_channel); 1452 rf5112_ini_common_end, skip_pcu);
1459 1453
1460 ath5k_hw_ini_registers(ah, 1454 ath5k_hw_ini_registers(ah,
1461 ARRAY_SIZE(rf5112_ini_bbgain), 1455 ARRAY_SIZE(rf5112_ini_bbgain),
1462 rf5112_ini_bbgain, change_channel); 1456 rf5112_ini_bbgain, skip_pcu);
1463 1457
1464 break; 1458 break;
1465 case AR5K_RF5413: 1459 case AR5K_RF5413:
@@ -1470,11 +1464,11 @@ int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel)
1470 1464
1471 ath5k_hw_ini_registers(ah, 1465 ath5k_hw_ini_registers(ah,
1472 ARRAY_SIZE(rf5413_ini_common_end), 1466 ARRAY_SIZE(rf5413_ini_common_end),
1473 rf5413_ini_common_end, change_channel); 1467 rf5413_ini_common_end, skip_pcu);
1474 1468
1475 ath5k_hw_ini_registers(ah, 1469 ath5k_hw_ini_registers(ah,
1476 ARRAY_SIZE(rf5112_ini_bbgain), 1470 ARRAY_SIZE(rf5112_ini_bbgain),
1477 rf5112_ini_bbgain, change_channel); 1471 rf5112_ini_bbgain, skip_pcu);
1478 1472
1479 break; 1473 break;
1480 case AR5K_RF2316: 1474 case AR5K_RF2316:
@@ -1486,7 +1480,7 @@ int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel)
1486 1480
1487 ath5k_hw_ini_registers(ah, 1481 ath5k_hw_ini_registers(ah,
1488 ARRAY_SIZE(rf2413_ini_common_end), 1482 ARRAY_SIZE(rf2413_ini_common_end),
1489 rf2413_ini_common_end, change_channel); 1483 rf2413_ini_common_end, skip_pcu);
1490 1484
1491 /* Override settings from rf2413_ini_common_end */ 1485 /* Override settings from rf2413_ini_common_end */
1492 if (ah->ah_radio == AR5K_RF2316) { 1486 if (ah->ah_radio == AR5K_RF2316) {
@@ -1498,9 +1492,32 @@ int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel)
1498 1492
1499 ath5k_hw_ini_registers(ah, 1493 ath5k_hw_ini_registers(ah,
1500 ARRAY_SIZE(rf5112_ini_bbgain), 1494 ARRAY_SIZE(rf5112_ini_bbgain),
1501 rf5112_ini_bbgain, change_channel); 1495 rf5112_ini_bbgain, skip_pcu);
1502 break; 1496 break;
1503 case AR5K_RF2317: 1497 case AR5K_RF2317:
1498
1499 ath5k_hw_ini_mode_registers(ah,
1500 ARRAY_SIZE(rf2413_ini_mode_end),
1501 rf2413_ini_mode_end, mode);
1502
1503 ath5k_hw_ini_registers(ah,
1504 ARRAY_SIZE(rf2425_ini_common_end),
1505 rf2425_ini_common_end, skip_pcu);
1506
1507 /* Override settings from rf2413_ini_mode_end */
1508 ath5k_hw_reg_write(ah, 0x00180a65, AR5K_PHY_GAIN);
1509
1510 /* Override settings from rf2413_ini_common_end */
1511 ath5k_hw_reg_write(ah, 0x00004000, AR5K_PHY_AGC);
1512 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_TPC_RG5,
1513 AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP, 0xa);
1514 ath5k_hw_reg_write(ah, 0x800000a8, 0x8140);
1515 ath5k_hw_reg_write(ah, 0x000000ff, 0x9958);
1516
1517 ath5k_hw_ini_registers(ah,
1518 ARRAY_SIZE(rf5112_ini_bbgain),
1519 rf5112_ini_bbgain, skip_pcu);
1520 break;
1504 case AR5K_RF2425: 1521 case AR5K_RF2425:
1505 1522
1506 ath5k_hw_ini_mode_registers(ah, 1523 ath5k_hw_ini_mode_registers(ah,
@@ -1509,11 +1526,11 @@ int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel)
1509 1526
1510 ath5k_hw_ini_registers(ah, 1527 ath5k_hw_ini_registers(ah,
1511 ARRAY_SIZE(rf2425_ini_common_end), 1528 ARRAY_SIZE(rf2425_ini_common_end),
1512 rf2425_ini_common_end, change_channel); 1529 rf2425_ini_common_end, skip_pcu);
1513 1530
1514 ath5k_hw_ini_registers(ah, 1531 ath5k_hw_ini_registers(ah,
1515 ARRAY_SIZE(rf5112_ini_bbgain), 1532 ARRAY_SIZE(rf5112_ini_bbgain),
1516 rf5112_ini_bbgain, change_channel); 1533 rf5112_ini_bbgain, skip_pcu);
1517 break; 1534 break;
1518 default: 1535 default:
1519 return -EINVAL; 1536 return -EINVAL;
@@ -1538,17 +1555,17 @@ int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel)
1538 * Write initial settings common for all modes 1555 * Write initial settings common for all modes
1539 */ 1556 */
1540 ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5211_ini), 1557 ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5211_ini),
1541 ar5211_ini, change_channel); 1558 ar5211_ini, skip_pcu);
1542 1559
1543 /* AR5211 only comes with 5111 */ 1560 /* AR5211 only comes with 5111 */
1544 1561
1545 /* Baseband gain table */ 1562 /* Baseband gain table */
1546 ath5k_hw_ini_registers(ah, ARRAY_SIZE(rf5111_ini_bbgain), 1563 ath5k_hw_ini_registers(ah, ARRAY_SIZE(rf5111_ini_bbgain),
1547 rf5111_ini_bbgain, change_channel); 1564 rf5111_ini_bbgain, skip_pcu);
1548 /* For AR5210 (for mode settings check out ath5k_hw_reset_tx_queue) */ 1565 /* For AR5210 (for mode settings check out ath5k_hw_reset_tx_queue) */
1549 } else if (ah->ah_version == AR5K_AR5210) { 1566 } else if (ah->ah_version == AR5K_AR5210) {
1550 ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5210_ini), 1567 ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5210_ini),
1551 ar5210_ini, change_channel); 1568 ar5210_ini, skip_pcu);
1552 } 1569 }
1553 1570
1554 return 0; 1571 return 0;
diff --git a/drivers/net/wireless/ath/ath5k/led.c b/drivers/net/wireless/ath/ath5k/led.c
index 67aa52e9bf94..576edf2965dc 100644
--- a/drivers/net/wireless/ath/ath5k/led.c
+++ b/drivers/net/wireless/ath/ath5k/led.c
@@ -133,7 +133,7 @@ ath5k_register_led(struct ath5k_softc *sc, struct ath5k_led *led,
133 led->led_dev.default_trigger = trigger; 133 led->led_dev.default_trigger = trigger;
134 led->led_dev.brightness_set = ath5k_led_brightness_set; 134 led->led_dev.brightness_set = ath5k_led_brightness_set;
135 135
136 err = led_classdev_register(&sc->pdev->dev, &led->led_dev); 136 err = led_classdev_register(sc->dev, &led->led_dev);
137 if (err) { 137 if (err) {
138 ATH5K_WARN(sc, "could not register LED %s\n", name); 138 ATH5K_WARN(sc, "could not register LED %s\n", name);
139 led->sc = NULL; 139 led->sc = NULL;
@@ -161,11 +161,20 @@ int ath5k_init_leds(struct ath5k_softc *sc)
161{ 161{
162 int ret = 0; 162 int ret = 0;
163 struct ieee80211_hw *hw = sc->hw; 163 struct ieee80211_hw *hw = sc->hw;
164#ifndef CONFIG_ATHEROS_AR231X
164 struct pci_dev *pdev = sc->pdev; 165 struct pci_dev *pdev = sc->pdev;
166#endif
165 char name[ATH5K_LED_MAX_NAME_LEN + 1]; 167 char name[ATH5K_LED_MAX_NAME_LEN + 1];
166 const struct pci_device_id *match; 168 const struct pci_device_id *match;
167 169
170 if (!sc->pdev)
171 return 0;
172
173#ifdef CONFIG_ATHEROS_AR231X
174 match = NULL;
175#else
168 match = pci_match_id(&ath5k_led_devices[0], pdev); 176 match = pci_match_id(&ath5k_led_devices[0], pdev);
177#endif
169 if (match) { 178 if (match) {
170 __set_bit(ATH_STAT_LEDSOFT, sc->status); 179 __set_bit(ATH_STAT_LEDSOFT, sc->status);
171 sc->led_pin = ATH_PIN(match->driver_data); 180 sc->led_pin = ATH_PIN(match->driver_data);
diff --git a/drivers/net/wireless/ath/ath5k/pci.c b/drivers/net/wireless/ath/ath5k/pci.c
new file mode 100644
index 000000000000..39f033128c5a
--- /dev/null
+++ b/drivers/net/wireless/ath/ath5k/pci.c
@@ -0,0 +1,326 @@
1/*
2 * Copyright (c) 2008-2009 Atheros Communications Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include <linux/nl80211.h>
18#include <linux/pci.h>
19#include <linux/pci-aspm.h>
20#include "../ath.h"
21#include "ath5k.h"
22#include "debug.h"
23#include "base.h"
24#include "reg.h"
25
26/* Known PCI ids */
27static DEFINE_PCI_DEVICE_TABLE(ath5k_pci_id_table) = {
28 { PCI_VDEVICE(ATHEROS, 0x0207) }, /* 5210 early */
29 { PCI_VDEVICE(ATHEROS, 0x0007) }, /* 5210 */
30 { PCI_VDEVICE(ATHEROS, 0x0011) }, /* 5311 - this is on AHB bus !*/
31 { PCI_VDEVICE(ATHEROS, 0x0012) }, /* 5211 */
32 { PCI_VDEVICE(ATHEROS, 0x0013) }, /* 5212 */
33 { PCI_VDEVICE(3COM_2, 0x0013) }, /* 3com 5212 */
34 { PCI_VDEVICE(3COM, 0x0013) }, /* 3com 3CRDAG675 5212 */
35 { PCI_VDEVICE(ATHEROS, 0x1014) }, /* IBM minipci 5212 */
36 { PCI_VDEVICE(ATHEROS, 0x0014) }, /* 5212 combatible */
37 { PCI_VDEVICE(ATHEROS, 0x0015) }, /* 5212 combatible */
38 { PCI_VDEVICE(ATHEROS, 0x0016) }, /* 5212 combatible */
39 { PCI_VDEVICE(ATHEROS, 0x0017) }, /* 5212 combatible */
40 { PCI_VDEVICE(ATHEROS, 0x0018) }, /* 5212 combatible */
41 { PCI_VDEVICE(ATHEROS, 0x0019) }, /* 5212 combatible */
42 { PCI_VDEVICE(ATHEROS, 0x001a) }, /* 2413 Griffin-lite */
43 { PCI_VDEVICE(ATHEROS, 0x001b) }, /* 5413 Eagle */
44 { PCI_VDEVICE(ATHEROS, 0x001c) }, /* PCI-E cards */
45 { PCI_VDEVICE(ATHEROS, 0x001d) }, /* 2417 Nala */
46 { 0 }
47};
48
49/* return bus cachesize in 4B word units */
50static void ath5k_pci_read_cachesize(struct ath_common *common, int *csz)
51{
52 struct ath5k_softc *sc = (struct ath5k_softc *) common->priv;
53 u8 u8tmp;
54
55 pci_read_config_byte(sc->pdev, PCI_CACHE_LINE_SIZE, &u8tmp);
56 *csz = (int)u8tmp;
57
58 /*
59 * This check was put in to avoid "unplesant" consequences if
60 * the bootrom has not fully initialized all PCI devices.
61 * Sometimes the cache line size register is not set
62 */
63
64 if (*csz == 0)
65 *csz = L1_CACHE_BYTES >> 2; /* Use the default size */
66}
67
68/*
69 * Read from eeprom
70 */
71bool ath5k_pci_eeprom_read(struct ath_common *common, u32 offset, u16 *data)
72{
73 struct ath5k_hw *ah = (struct ath5k_hw *) common->ah;
74 u32 status, timeout;
75
76 /*
77 * Initialize EEPROM access
78 */
79 if (ah->ah_version == AR5K_AR5210) {
80 AR5K_REG_ENABLE_BITS(ah, AR5K_PCICFG, AR5K_PCICFG_EEAE);
81 (void)ath5k_hw_reg_read(ah, AR5K_EEPROM_BASE + (4 * offset));
82 } else {
83 ath5k_hw_reg_write(ah, offset, AR5K_EEPROM_BASE);
84 AR5K_REG_ENABLE_BITS(ah, AR5K_EEPROM_CMD,
85 AR5K_EEPROM_CMD_READ);
86 }
87
88 for (timeout = AR5K_TUNE_REGISTER_TIMEOUT; timeout > 0; timeout--) {
89 status = ath5k_hw_reg_read(ah, AR5K_EEPROM_STATUS);
90 if (status & AR5K_EEPROM_STAT_RDDONE) {
91 if (status & AR5K_EEPROM_STAT_RDERR)
92 return -EIO;
93 *data = (u16)(ath5k_hw_reg_read(ah, AR5K_EEPROM_DATA) &
94 0xffff);
95 return 0;
96 }
97 udelay(15);
98 }
99
100 return -ETIMEDOUT;
101}
102
103int ath5k_hw_read_srev(struct ath5k_hw *ah)
104{
105 ah->ah_mac_srev = ath5k_hw_reg_read(ah, AR5K_SREV);
106 return 0;
107}
108
109/* Common ath_bus_opts structure */
110static const struct ath_bus_ops ath_pci_bus_ops = {
111 .ath_bus_type = ATH_PCI,
112 .read_cachesize = ath5k_pci_read_cachesize,
113 .eeprom_read = ath5k_pci_eeprom_read,
114};
115
116/********************\
117* PCI Initialization *
118\********************/
119
120static int __devinit
121ath5k_pci_probe(struct pci_dev *pdev,
122 const struct pci_device_id *id)
123{
124 void __iomem *mem;
125 struct ath5k_softc *sc;
126 struct ieee80211_hw *hw;
127 int ret;
128 u8 csz;
129
130 /*
131 * L0s needs to be disabled on all ath5k cards.
132 *
133 * For distributions shipping with CONFIG_PCIEASPM (this will be enabled
134 * by default in the future in 2.6.36) this will also mean both L1 and
135 * L0s will be disabled when a pre 1.1 PCIe device is detected. We do
136 * know L1 works correctly even for all ath5k pre 1.1 PCIe devices
137 * though but cannot currently undue the effect of a blacklist, for
138 * details you can read pcie_aspm_sanity_check() and see how it adjusts
139 * the device link capability.
140 *
141 * It may be possible in the future to implement some PCI API to allow
142 * drivers to override blacklists for pre 1.1 PCIe but for now it is
143 * best to accept that both L0s and L1 will be disabled completely for
144 * distributions shipping with CONFIG_PCIEASPM rather than having this
145 * issue present. Motivation for adding this new API will be to help
146 * with power consumption for some of these devices.
147 */
148 pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S);
149
150 ret = pci_enable_device(pdev);
151 if (ret) {
152 dev_err(&pdev->dev, "can't enable device\n");
153 goto err;
154 }
155
156 /* XXX 32-bit addressing only */
157 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
158 if (ret) {
159 dev_err(&pdev->dev, "32-bit DMA not available\n");
160 goto err_dis;
161 }
162
163 /*
164 * Cache line size is used to size and align various
165 * structures used to communicate with the hardware.
166 */
167 pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &csz);
168 if (csz == 0) {
169 /*
170 * Linux 2.4.18 (at least) writes the cache line size
171 * register as a 16-bit wide register which is wrong.
172 * We must have this setup properly for rx buffer
173 * DMA to work so force a reasonable value here if it
174 * comes up zero.
175 */
176 csz = L1_CACHE_BYTES >> 2;
177 pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, csz);
178 }
179 /*
180 * The default setting of latency timer yields poor results,
181 * set it to the value used by other systems. It may be worth
182 * tweaking this setting more.
183 */
184 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xa8);
185
186 /* Enable bus mastering */
187 pci_set_master(pdev);
188
189 /*
190 * Disable the RETRY_TIMEOUT register (0x41) to keep
191 * PCI Tx retries from interfering with C3 CPU state.
192 */
193 pci_write_config_byte(pdev, 0x41, 0);
194
195 ret = pci_request_region(pdev, 0, "ath5k");
196 if (ret) {
197 dev_err(&pdev->dev, "cannot reserve PCI memory region\n");
198 goto err_dis;
199 }
200
201 mem = pci_iomap(pdev, 0, 0);
202 if (!mem) {
203 dev_err(&pdev->dev, "cannot remap PCI memory region\n") ;
204 ret = -EIO;
205 goto err_reg;
206 }
207
208 /*
209 * Allocate hw (mac80211 main struct)
210 * and hw->priv (driver private data)
211 */
212 hw = ieee80211_alloc_hw(sizeof(*sc), &ath5k_hw_ops);
213 if (hw == NULL) {
214 dev_err(&pdev->dev, "cannot allocate ieee80211_hw\n");
215 ret = -ENOMEM;
216 goto err_map;
217 }
218
219 dev_info(&pdev->dev, "registered as '%s'\n", wiphy_name(hw->wiphy));
220
221 sc = hw->priv;
222 sc->hw = hw;
223 sc->pdev = pdev;
224 sc->dev = &pdev->dev;
225 sc->irq = pdev->irq;
226 sc->devid = id->device;
227 sc->iobase = mem; /* So we can unmap it on detach */
228
229 /* Initialize */
230 ret = ath5k_init_softc(sc, &ath_pci_bus_ops);
231 if (ret)
232 goto err_free;
233
234 /* Set private data */
235 pci_set_drvdata(pdev, hw);
236
237 return 0;
238err_free:
239 ieee80211_free_hw(hw);
240err_map:
241 pci_iounmap(pdev, mem);
242err_reg:
243 pci_release_region(pdev, 0);
244err_dis:
245 pci_disable_device(pdev);
246err:
247 return ret;
248}
249
250static void __devexit
251ath5k_pci_remove(struct pci_dev *pdev)
252{
253 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
254 struct ath5k_softc *sc = hw->priv;
255
256 ath5k_deinit_softc(sc);
257 pci_iounmap(pdev, sc->iobase);
258 pci_release_region(pdev, 0);
259 pci_disable_device(pdev);
260 ieee80211_free_hw(hw);
261}
262
263#ifdef CONFIG_PM_SLEEP
264static int ath5k_pci_suspend(struct device *dev)
265{
266 struct ath5k_softc *sc = pci_get_drvdata(to_pci_dev(dev));
267
268 ath5k_led_off(sc);
269 return 0;
270}
271
272static int ath5k_pci_resume(struct device *dev)
273{
274 struct pci_dev *pdev = to_pci_dev(dev);
275 struct ath5k_softc *sc = pci_get_drvdata(pdev);
276
277 /*
278 * Suspend/Resume resets the PCI configuration space, so we have to
279 * re-disable the RETRY_TIMEOUT register (0x41) to keep
280 * PCI Tx retries from interfering with C3 CPU state
281 */
282 pci_write_config_byte(pdev, 0x41, 0);
283
284 ath5k_led_enable(sc);
285 return 0;
286}
287
288static SIMPLE_DEV_PM_OPS(ath5k_pm_ops, ath5k_pci_suspend, ath5k_pci_resume);
289#define ATH5K_PM_OPS (&ath5k_pm_ops)
290#else
291#define ATH5K_PM_OPS NULL
292#endif /* CONFIG_PM_SLEEP */
293
294static struct pci_driver ath5k_pci_driver = {
295 .name = KBUILD_MODNAME,
296 .id_table = ath5k_pci_id_table,
297 .probe = ath5k_pci_probe,
298 .remove = __devexit_p(ath5k_pci_remove),
299 .driver.pm = ATH5K_PM_OPS,
300};
301
302/*
303 * Module init/exit functions
304 */
305static int __init
306init_ath5k_pci(void)
307{
308 int ret;
309
310 ret = pci_register_driver(&ath5k_pci_driver);
311 if (ret) {
312 printk(KERN_ERR "ath5k_pci: can't register pci driver\n");
313 return ret;
314 }
315
316 return 0;
317}
318
319static void __exit
320exit_ath5k_pci(void)
321{
322 pci_unregister_driver(&ath5k_pci_driver);
323}
324
325module_init(init_ath5k_pci);
326module_exit(exit_ath5k_pci);
diff --git a/drivers/net/wireless/ath/ath5k/pcu.c b/drivers/net/wireless/ath/ath5k/pcu.c
index 074b4c644399..e5f2b96a4c63 100644
--- a/drivers/net/wireless/ath/ath5k/pcu.c
+++ b/drivers/net/wireless/ath/ath5k/pcu.c
@@ -31,87 +31,163 @@
31#include "debug.h" 31#include "debug.h"
32#include "base.h" 32#include "base.h"
33 33
34/*
35 * AR5212+ can use higher rates for ack transmition
36 * based on current tx rate instead of the base rate.
37 * It does this to better utilize channel usage.
38 * This is a mapping between G rates (that cover both
39 * CCK and OFDM) and ack rates that we use when setting
40 * rate -> duration table. This mapping is hw-based so
41 * don't change anything.
42 *
43 * To enable this functionality we must set
44 * ah->ah_ack_bitrate_high to true else base rate is
45 * used (1Mb for CCK, 6Mb for OFDM).
46 */
47static const unsigned int ack_rates_high[] =
48/* Tx -> ACK */
49/* 1Mb -> 1Mb */ { 0,
50/* 2MB -> 2Mb */ 1,
51/* 5.5Mb -> 2Mb */ 1,
52/* 11Mb -> 2Mb */ 1,
53/* 6Mb -> 6Mb */ 4,
54/* 9Mb -> 6Mb */ 4,
55/* 12Mb -> 12Mb */ 6,
56/* 18Mb -> 12Mb */ 6,
57/* 24Mb -> 24Mb */ 8,
58/* 36Mb -> 24Mb */ 8,
59/* 48Mb -> 24Mb */ 8,
60/* 54Mb -> 24Mb */ 8 };
61
34/*******************\ 62/*******************\
35* Generic functions * 63* Helper functions *
36\*******************/ 64\*******************/
37 65
38/** 66/**
39 * ath5k_hw_set_opmode - Set PCU operating mode 67 * ath5k_hw_get_frame_duration - Get tx time of a frame
40 * 68 *
41 * @ah: The &struct ath5k_hw 69 * @ah: The &struct ath5k_hw
42 * @op_mode: &enum nl80211_iftype operating mode 70 * @len: Frame's length in bytes
71 * @rate: The @struct ieee80211_rate
43 * 72 *
44 * Initialize PCU for the various operating modes (AP/STA etc) 73 * Calculate tx duration of a frame given it's rate and length
74 * It extends ieee80211_generic_frame_duration for non standard
75 * bwmodes.
45 */ 76 */
46int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype op_mode) 77int ath5k_hw_get_frame_duration(struct ath5k_hw *ah,
78 int len, struct ieee80211_rate *rate)
47{ 79{
48 struct ath_common *common = ath5k_hw_common(ah); 80 struct ath5k_softc *sc = ah->ah_sc;
49 u32 pcu_reg, beacon_reg, low_id, high_id; 81 int sifs, preamble, plcp_bits, sym_time;
82 int bitrate, bits, symbols, symbol_bits;
83 int dur;
84
85 /* Fallback */
86 if (!ah->ah_bwmode) {
87 dur = ieee80211_generic_frame_duration(sc->hw,
88 NULL, len, rate);
89 return dur;
90 }
50 91
51 ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_MODE, "mode %d\n", op_mode); 92 bitrate = rate->bitrate;
93 preamble = AR5K_INIT_OFDM_PREAMPLE_TIME;
94 plcp_bits = AR5K_INIT_OFDM_PLCP_BITS;
95 sym_time = AR5K_INIT_OFDM_SYMBOL_TIME;
52 96
53 /* Preserve rest settings */ 97 switch (ah->ah_bwmode) {
54 pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000; 98 case AR5K_BWMODE_40MHZ:
55 pcu_reg &= ~(AR5K_STA_ID1_ADHOC | AR5K_STA_ID1_AP 99 sifs = AR5K_INIT_SIFS_TURBO;
56 | AR5K_STA_ID1_KEYSRCH_MODE 100 preamble = AR5K_INIT_OFDM_PREAMBLE_TIME_MIN;
57 | (ah->ah_version == AR5K_AR5210 ? 101 break;
58 (AR5K_STA_ID1_PWR_SV | AR5K_STA_ID1_NO_PSPOLL) : 0)); 102 case AR5K_BWMODE_10MHZ:
103 sifs = AR5K_INIT_SIFS_HALF_RATE;
104 preamble *= 2;
105 sym_time *= 2;
106 break;
107 case AR5K_BWMODE_5MHZ:
108 sifs = AR5K_INIT_SIFS_QUARTER_RATE;
109 preamble *= 4;
110 sym_time *= 4;
111 break;
112 default:
113 sifs = AR5K_INIT_SIFS_DEFAULT_BG;
114 break;
115 }
59 116
60 beacon_reg = 0; 117 bits = plcp_bits + (len << 3);
118 /* Bit rate is in 100Kbits */
119 symbol_bits = bitrate * sym_time;
120 symbols = DIV_ROUND_UP(bits * 10, symbol_bits);
61 121
62 switch (op_mode) { 122 dur = sifs + preamble + (sym_time * symbols);
63 case NL80211_IFTYPE_ADHOC:
64 pcu_reg |= AR5K_STA_ID1_ADHOC | AR5K_STA_ID1_KEYSRCH_MODE;
65 beacon_reg |= AR5K_BCR_ADHOC;
66 if (ah->ah_version == AR5K_AR5210)
67 pcu_reg |= AR5K_STA_ID1_NO_PSPOLL;
68 else
69 AR5K_REG_ENABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS);
70 break;
71 123
72 case NL80211_IFTYPE_AP: 124 return dur;
73 case NL80211_IFTYPE_MESH_POINT: 125}
74 pcu_reg |= AR5K_STA_ID1_AP | AR5K_STA_ID1_KEYSRCH_MODE;
75 beacon_reg |= AR5K_BCR_AP;
76 if (ah->ah_version == AR5K_AR5210)
77 pcu_reg |= AR5K_STA_ID1_NO_PSPOLL;
78 else
79 AR5K_REG_DISABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS);
80 break;
81 126
82 case NL80211_IFTYPE_STATION: 127/**
83 pcu_reg |= AR5K_STA_ID1_KEYSRCH_MODE 128 * ath5k_hw_get_default_slottime - Get the default slot time for current mode
84 | (ah->ah_version == AR5K_AR5210 ? 129 *
85 AR5K_STA_ID1_PWR_SV : 0); 130 * @ah: The &struct ath5k_hw
86 case NL80211_IFTYPE_MONITOR: 131 */
87 pcu_reg |= AR5K_STA_ID1_KEYSRCH_MODE 132unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah)
88 | (ah->ah_version == AR5K_AR5210 ? 133{
89 AR5K_STA_ID1_NO_PSPOLL : 0); 134 struct ieee80211_channel *channel = ah->ah_current_channel;
90 break; 135 unsigned int slot_time;
91 136
137 switch (ah->ah_bwmode) {
138 case AR5K_BWMODE_40MHZ:
139 slot_time = AR5K_INIT_SLOT_TIME_TURBO;
140 break;
141 case AR5K_BWMODE_10MHZ:
142 slot_time = AR5K_INIT_SLOT_TIME_HALF_RATE;
143 break;
144 case AR5K_BWMODE_5MHZ:
145 slot_time = AR5K_INIT_SLOT_TIME_QUARTER_RATE;
146 break;
147 case AR5K_BWMODE_DEFAULT:
148 slot_time = AR5K_INIT_SLOT_TIME_DEFAULT;
92 default: 149 default:
93 return -EINVAL; 150 if (channel->hw_value & CHANNEL_CCK)
151 slot_time = AR5K_INIT_SLOT_TIME_B;
152 break;
94 } 153 }
95 154
96 /* 155 return slot_time;
97 * Set PCU registers 156}
98 */
99 low_id = get_unaligned_le32(common->macaddr);
100 high_id = get_unaligned_le16(common->macaddr + 4);
101 ath5k_hw_reg_write(ah, low_id, AR5K_STA_ID0);
102 ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1);
103 157
104 /* 158/**
105 * Set Beacon Control Register on 5210 159 * ath5k_hw_get_default_sifs - Get the default SIFS for current mode
106 */ 160 *
107 if (ah->ah_version == AR5K_AR5210) 161 * @ah: The &struct ath5k_hw
108 ath5k_hw_reg_write(ah, beacon_reg, AR5K_BCR); 162 */
163unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah)
164{
165 struct ieee80211_channel *channel = ah->ah_current_channel;
166 unsigned int sifs;
109 167
110 return 0; 168 switch (ah->ah_bwmode) {
169 case AR5K_BWMODE_40MHZ:
170 sifs = AR5K_INIT_SIFS_TURBO;
171 break;
172 case AR5K_BWMODE_10MHZ:
173 sifs = AR5K_INIT_SIFS_HALF_RATE;
174 break;
175 case AR5K_BWMODE_5MHZ:
176 sifs = AR5K_INIT_SIFS_QUARTER_RATE;
177 break;
178 case AR5K_BWMODE_DEFAULT:
179 sifs = AR5K_INIT_SIFS_DEFAULT_BG;
180 default:
181 if (channel->hw_value & CHANNEL_5GHZ)
182 sifs = AR5K_INIT_SIFS_DEFAULT_A;
183 break;
184 }
185
186 return sifs;
111} 187}
112 188
113/** 189/**
114 * ath5k_hw_update - Update MIB counters (mac layer statistics) 190 * ath5k_hw_update_mib_counters - Update MIB counters (mac layer statistics)
115 * 191 *
116 * @ah: The &struct ath5k_hw 192 * @ah: The &struct ath5k_hw
117 * 193 *
@@ -133,36 +209,88 @@ void ath5k_hw_update_mib_counters(struct ath5k_hw *ah)
133 stats->beacons += ath5k_hw_reg_read(ah, AR5K_BEACON_CNT); 209 stats->beacons += ath5k_hw_reg_read(ah, AR5K_BEACON_CNT);
134} 210}
135 211
212
213/******************\
214* ACK/CTS Timeouts *
215\******************/
216
136/** 217/**
137 * ath5k_hw_set_ack_bitrate - set bitrate for ACKs 218 * ath5k_hw_write_rate_duration - fill rate code to duration table
138 * 219 *
139 * @ah: The &struct ath5k_hw 220 * @ah: the &struct ath5k_hw
140 * @high: Flag to determine if we want to use high transmission rate 221 * @mode: one of enum ath5k_driver_mode
141 * for ACKs or not 222 *
223 * Write the rate code to duration table upon hw reset. This is a helper for
224 * ath5k_hw_pcu_init(). It seems all this is doing is setting an ACK timeout on
225 * the hardware, based on current mode, for each rate. The rates which are
226 * capable of short preamble (802.11b rates 2Mbps, 5.5Mbps, and 11Mbps) have
227 * different rate code so we write their value twice (one for long preamble
228 * and one for short).
229 *
230 * Note: Band doesn't matter here, if we set the values for OFDM it works
231 * on both a and g modes. So all we have to do is set values for all g rates
232 * that include all OFDM and CCK rates.
142 * 233 *
143 * If high flag is set, we tell hw to use a set of control rates based on
144 * the current transmission rate (check out control_rates array inside reset.c).
145 * If not hw just uses the lowest rate available for the current modulation
146 * scheme being used (1Mbit for CCK and 6Mbits for OFDM).
147 */ 234 */
148void ath5k_hw_set_ack_bitrate_high(struct ath5k_hw *ah, bool high) 235static inline void ath5k_hw_write_rate_duration(struct ath5k_hw *ah)
149{ 236{
150 if (ah->ah_version != AR5K_AR5212) 237 struct ath5k_softc *sc = ah->ah_sc;
151 return; 238 struct ieee80211_rate *rate;
152 else { 239 unsigned int i;
153 u32 val = AR5K_STA_ID1_BASE_RATE_11B | AR5K_STA_ID1_ACKCTS_6MB; 240 /* 802.11g covers both OFDM and CCK */
154 if (high) 241 u8 band = IEEE80211_BAND_2GHZ;
155 AR5K_REG_DISABLE_BITS(ah, AR5K_STA_ID1, val); 242
243 /* Write rate duration table */
244 for (i = 0; i < sc->sbands[band].n_bitrates; i++) {
245 u32 reg;
246 u16 tx_time;
247
248 if (ah->ah_ack_bitrate_high)
249 rate = &sc->sbands[band].bitrates[ack_rates_high[i]];
250 /* CCK -> 1Mb */
251 else if (i < 4)
252 rate = &sc->sbands[band].bitrates[0];
253 /* OFDM -> 6Mb */
156 else 254 else
157 AR5K_REG_ENABLE_BITS(ah, AR5K_STA_ID1, val); 255 rate = &sc->sbands[band].bitrates[4];
256
257 /* Set ACK timeout */
258 reg = AR5K_RATE_DUR(rate->hw_value);
259
260 /* An ACK frame consists of 10 bytes. If you add the FCS,
261 * which ieee80211_generic_frame_duration() adds,
262 * its 14 bytes. Note we use the control rate and not the
263 * actual rate for this rate. See mac80211 tx.c
264 * ieee80211_duration() for a brief description of
265 * what rate we should choose to TX ACKs. */
266 tx_time = ath5k_hw_get_frame_duration(ah, 10, rate);
267
268 tx_time = le16_to_cpu(tx_time);
269
270 ath5k_hw_reg_write(ah, tx_time, reg);
271
272 if (!(rate->flags & IEEE80211_RATE_SHORT_PREAMBLE))
273 continue;
274
275 /*
276 * We're not distinguishing short preamble here,
277 * This is true, all we'll get is a longer value here
278 * which is not necessarilly bad. We could use
279 * export ieee80211_frame_duration() but that needs to be
280 * fixed first to be properly used by mac802111 drivers:
281 *
282 * - remove erp stuff and let the routine figure ofdm
283 * erp rates
284 * - remove passing argument ieee80211_local as
285 * drivers don't have access to it
286 * - move drivers using ieee80211_generic_frame_duration()
287 * to this
288 */
289 ath5k_hw_reg_write(ah, tx_time,
290 reg + (AR5K_SET_SHORT_PREAMBLE << 2));
158 } 291 }
159} 292}
160 293
161
162/******************\
163* ACK/CTS Timeouts *
164\******************/
165
166/** 294/**
167 * ath5k_hw_set_ack_timeout - Set ACK timeout on PCU 295 * ath5k_hw_set_ack_timeout - Set ACK timeout on PCU
168 * 296 *
@@ -199,88 +327,10 @@ static int ath5k_hw_set_cts_timeout(struct ath5k_hw *ah, unsigned int timeout)
199 return 0; 327 return 0;
200} 328}
201 329
202/**
203 * ath5k_hw_htoclock - Translate usec to hw clock units
204 *
205 * @ah: The &struct ath5k_hw
206 * @usec: value in microseconds
207 */
208unsigned int ath5k_hw_htoclock(struct ath5k_hw *ah, unsigned int usec)
209{
210 struct ath_common *common = ath5k_hw_common(ah);
211 return usec * common->clockrate;
212}
213
214/**
215 * ath5k_hw_clocktoh - Translate hw clock units to usec
216 * @clock: value in hw clock units
217 */
218unsigned int ath5k_hw_clocktoh(struct ath5k_hw *ah, unsigned int clock)
219{
220 struct ath_common *common = ath5k_hw_common(ah);
221 return clock / common->clockrate;
222}
223
224/**
225 * ath5k_hw_set_clockrate - Set common->clockrate for the current channel
226 *
227 * @ah: The &struct ath5k_hw
228 */
229void ath5k_hw_set_clockrate(struct ath5k_hw *ah)
230{
231 struct ieee80211_channel *channel = ah->ah_current_channel;
232 struct ath_common *common = ath5k_hw_common(ah);
233 int clock;
234
235 if (channel->hw_value & CHANNEL_5GHZ)
236 clock = 40; /* 802.11a */
237 else if (channel->hw_value & CHANNEL_CCK)
238 clock = 22; /* 802.11b */
239 else
240 clock = 44; /* 802.11g */
241
242 /* Clock rate in turbo modes is twice the normal rate */
243 if (channel->hw_value & CHANNEL_TURBO)
244 clock *= 2;
245
246 common->clockrate = clock;
247}
248
249/**
250 * ath5k_hw_get_default_slottime - Get the default slot time for current mode
251 *
252 * @ah: The &struct ath5k_hw
253 */
254static unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah)
255{
256 struct ieee80211_channel *channel = ah->ah_current_channel;
257
258 if (channel->hw_value & CHANNEL_TURBO)
259 return 6; /* both turbo modes */
260
261 if (channel->hw_value & CHANNEL_CCK)
262 return 20; /* 802.11b */
263
264 return 9; /* 802.11 a/g */
265}
266
267/**
268 * ath5k_hw_get_default_sifs - Get the default SIFS for current mode
269 *
270 * @ah: The &struct ath5k_hw
271 */
272static unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah)
273{
274 struct ieee80211_channel *channel = ah->ah_current_channel;
275
276 if (channel->hw_value & CHANNEL_TURBO)
277 return 8; /* both turbo modes */
278 330
279 if (channel->hw_value & CHANNEL_5GHZ) 331/*******************\
280 return 16; /* 802.11a */ 332* RX filter Control *
281 333\*******************/
282 return 10; /* 802.11 b/g */
283}
284 334
285/** 335/**
286 * ath5k_hw_set_lladdr - Set station id 336 * ath5k_hw_set_lladdr - Set station id
@@ -362,39 +412,6 @@ void ath5k_hw_set_bssid_mask(struct ath5k_hw *ah, const u8 *mask)
362 ath_hw_setbssidmask(common); 412 ath_hw_setbssidmask(common);
363} 413}
364 414
365/************\
366* RX Control *
367\************/
368
369/**
370 * ath5k_hw_start_rx_pcu - Start RX engine
371 *
372 * @ah: The &struct ath5k_hw
373 *
374 * Starts RX engine on PCU so that hw can process RXed frames
375 * (ACK etc).
376 *
377 * NOTE: RX DMA should be already enabled using ath5k_hw_start_rx_dma
378 */
379void ath5k_hw_start_rx_pcu(struct ath5k_hw *ah)
380{
381 AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX);
382}
383
384/**
385 * at5k_hw_stop_rx_pcu - Stop RX engine
386 *
387 * @ah: The &struct ath5k_hw
388 *
389 * Stops RX engine on PCU
390 *
391 * TODO: Detach ANI here
392 */
393void ath5k_hw_stop_rx_pcu(struct ath5k_hw *ah)
394{
395 AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX);
396}
397
398/* 415/*
399 * Set multicast filter 416 * Set multicast filter
400 */ 417 */
@@ -746,7 +763,7 @@ ath5k_hw_check_beacon_timers(struct ath5k_hw *ah, int intval)
746 * @ah: The &struct ath5k_hw 763 * @ah: The &struct ath5k_hw
747 * @coverage_class: IEEE 802.11 coverage class number 764 * @coverage_class: IEEE 802.11 coverage class number
748 * 765 *
749 * Sets slot time, ACK timeout and CTS timeout for given coverage class. 766 * Sets IFS intervals and ACK/CTS timeouts for given coverage class.
750 */ 767 */
751void ath5k_hw_set_coverage_class(struct ath5k_hw *ah, u8 coverage_class) 768void ath5k_hw_set_coverage_class(struct ath5k_hw *ah, u8 coverage_class)
752{ 769{
@@ -755,9 +772,175 @@ void ath5k_hw_set_coverage_class(struct ath5k_hw *ah, u8 coverage_class)
755 int ack_timeout = ath5k_hw_get_default_sifs(ah) + slot_time; 772 int ack_timeout = ath5k_hw_get_default_sifs(ah) + slot_time;
756 int cts_timeout = ack_timeout; 773 int cts_timeout = ack_timeout;
757 774
758 ath5k_hw_set_slot_time(ah, slot_time); 775 ath5k_hw_set_ifs_intervals(ah, slot_time);
759 ath5k_hw_set_ack_timeout(ah, ack_timeout); 776 ath5k_hw_set_ack_timeout(ah, ack_timeout);
760 ath5k_hw_set_cts_timeout(ah, cts_timeout); 777 ath5k_hw_set_cts_timeout(ah, cts_timeout);
761 778
762 ah->ah_coverage_class = coverage_class; 779 ah->ah_coverage_class = coverage_class;
763} 780}
781
782/***************************\
783* Init/Start/Stop functions *
784\***************************/
785
786/**
787 * ath5k_hw_start_rx_pcu - Start RX engine
788 *
789 * @ah: The &struct ath5k_hw
790 *
791 * Starts RX engine on PCU so that hw can process RXed frames
792 * (ACK etc).
793 *
794 * NOTE: RX DMA should be already enabled using ath5k_hw_start_rx_dma
795 */
796void ath5k_hw_start_rx_pcu(struct ath5k_hw *ah)
797{
798 AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX);
799}
800
801/**
802 * at5k_hw_stop_rx_pcu - Stop RX engine
803 *
804 * @ah: The &struct ath5k_hw
805 *
806 * Stops RX engine on PCU
807 */
808void ath5k_hw_stop_rx_pcu(struct ath5k_hw *ah)
809{
810 AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX);
811}
812
813/**
814 * ath5k_hw_set_opmode - Set PCU operating mode
815 *
816 * @ah: The &struct ath5k_hw
817 * @op_mode: &enum nl80211_iftype operating mode
818 *
819 * Configure PCU for the various operating modes (AP/STA etc)
820 */
821int ath5k_hw_set_opmode(struct ath5k_hw *ah, enum nl80211_iftype op_mode)
822{
823 struct ath_common *common = ath5k_hw_common(ah);
824 u32 pcu_reg, beacon_reg, low_id, high_id;
825
826 ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_MODE, "mode %d\n", op_mode);
827
828 /* Preserve rest settings */
829 pcu_reg = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 0xffff0000;
830 pcu_reg &= ~(AR5K_STA_ID1_ADHOC | AR5K_STA_ID1_AP
831 | AR5K_STA_ID1_KEYSRCH_MODE
832 | (ah->ah_version == AR5K_AR5210 ?
833 (AR5K_STA_ID1_PWR_SV | AR5K_STA_ID1_NO_PSPOLL) : 0));
834
835 beacon_reg = 0;
836
837 switch (op_mode) {
838 case NL80211_IFTYPE_ADHOC:
839 pcu_reg |= AR5K_STA_ID1_ADHOC | AR5K_STA_ID1_KEYSRCH_MODE;
840 beacon_reg |= AR5K_BCR_ADHOC;
841 if (ah->ah_version == AR5K_AR5210)
842 pcu_reg |= AR5K_STA_ID1_NO_PSPOLL;
843 else
844 AR5K_REG_ENABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS);
845 break;
846
847 case NL80211_IFTYPE_AP:
848 case NL80211_IFTYPE_MESH_POINT:
849 pcu_reg |= AR5K_STA_ID1_AP | AR5K_STA_ID1_KEYSRCH_MODE;
850 beacon_reg |= AR5K_BCR_AP;
851 if (ah->ah_version == AR5K_AR5210)
852 pcu_reg |= AR5K_STA_ID1_NO_PSPOLL;
853 else
854 AR5K_REG_DISABLE_BITS(ah, AR5K_CFG, AR5K_CFG_IBSS);
855 break;
856
857 case NL80211_IFTYPE_STATION:
858 pcu_reg |= AR5K_STA_ID1_KEYSRCH_MODE
859 | (ah->ah_version == AR5K_AR5210 ?
860 AR5K_STA_ID1_PWR_SV : 0);
861 case NL80211_IFTYPE_MONITOR:
862 pcu_reg |= AR5K_STA_ID1_KEYSRCH_MODE
863 | (ah->ah_version == AR5K_AR5210 ?
864 AR5K_STA_ID1_NO_PSPOLL : 0);
865 break;
866
867 default:
868 return -EINVAL;
869 }
870
871 /*
872 * Set PCU registers
873 */
874 low_id = get_unaligned_le32(common->macaddr);
875 high_id = get_unaligned_le16(common->macaddr + 4);
876 ath5k_hw_reg_write(ah, low_id, AR5K_STA_ID0);
877 ath5k_hw_reg_write(ah, pcu_reg | high_id, AR5K_STA_ID1);
878
879 /*
880 * Set Beacon Control Register on 5210
881 */
882 if (ah->ah_version == AR5K_AR5210)
883 ath5k_hw_reg_write(ah, beacon_reg, AR5K_BCR);
884
885 return 0;
886}
887
888void ath5k_hw_pcu_init(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
889 u8 mode)
890{
891 /* Set bssid and bssid mask */
892 ath5k_hw_set_bssid(ah);
893
894 /* Set PCU config */
895 ath5k_hw_set_opmode(ah, op_mode);
896
897 /* Write rate duration table only on AR5212 and if
898 * virtual interface has already been brought up
899 * XXX: rethink this after new mode changes to
900 * mac80211 are integrated */
901 if (ah->ah_version == AR5K_AR5212 &&
902 ah->ah_sc->nvifs)
903 ath5k_hw_write_rate_duration(ah);
904
905 /* Set RSSI/BRSSI thresholds
906 *
907 * Note: If we decide to set this value
908 * dynamicaly, have in mind that when AR5K_RSSI_THR
909 * register is read it might return 0x40 if we haven't
910 * wrote anything to it plus BMISS RSSI threshold is zeroed.
911 * So doing a save/restore procedure here isn't the right
912 * choice. Instead store it on ath5k_hw */
913 ath5k_hw_reg_write(ah, (AR5K_TUNE_RSSI_THRES |
914 AR5K_TUNE_BMISS_THRES <<
915 AR5K_RSSI_THR_BMISS_S),
916 AR5K_RSSI_THR);
917
918 /* MIC QoS support */
919 if (ah->ah_mac_srev >= AR5K_SREV_AR2413) {
920 ath5k_hw_reg_write(ah, 0x000100aa, AR5K_MIC_QOS_CTL);
921 ath5k_hw_reg_write(ah, 0x00003210, AR5K_MIC_QOS_SEL);
922 }
923
924 /* QoS NOACK Policy */
925 if (ah->ah_version == AR5K_AR5212) {
926 ath5k_hw_reg_write(ah,
927 AR5K_REG_SM(2, AR5K_QOS_NOACK_2BIT_VALUES) |
928 AR5K_REG_SM(5, AR5K_QOS_NOACK_BIT_OFFSET) |
929 AR5K_REG_SM(0, AR5K_QOS_NOACK_BYTE_OFFSET),
930 AR5K_QOS_NOACK);
931 }
932
933 /* Restore slot time and ACK timeouts */
934 if (ah->ah_coverage_class > 0)
935 ath5k_hw_set_coverage_class(ah, ah->ah_coverage_class);
936
937 /* Set ACK bitrate mode (see ack_rates_high) */
938 if (ah->ah_version == AR5K_AR5212) {
939 u32 val = AR5K_STA_ID1_BASE_RATE_11B | AR5K_STA_ID1_ACKCTS_6MB;
940 if (ah->ah_ack_bitrate_high)
941 AR5K_REG_DISABLE_BITS(ah, AR5K_STA_ID1, val);
942 else
943 AR5K_REG_ENABLE_BITS(ah, AR5K_STA_ID1, val);
944 }
945 return;
946}
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 6b43f535ff53..df5cd0fd69d6 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -29,6 +29,95 @@
29#include "rfbuffer.h" 29#include "rfbuffer.h"
30#include "rfgain.h" 30#include "rfgain.h"
31 31
32
33/******************\
34* Helper functions *
35\******************/
36
37/*
38 * Get the PHY Chip revision
39 */
40u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, unsigned int chan)
41{
42 unsigned int i;
43 u32 srev;
44 u16 ret;
45
46 /*
47 * Set the radio chip access register
48 */
49 switch (chan) {
50 case CHANNEL_2GHZ:
51 ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_2GHZ, AR5K_PHY(0));
52 break;
53 case CHANNEL_5GHZ:
54 ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_5GHZ, AR5K_PHY(0));
55 break;
56 default:
57 return 0;
58 }
59
60 mdelay(2);
61
62 /* ...wait until PHY is ready and read the selected radio revision */
63 ath5k_hw_reg_write(ah, 0x00001c16, AR5K_PHY(0x34));
64
65 for (i = 0; i < 8; i++)
66 ath5k_hw_reg_write(ah, 0x00010000, AR5K_PHY(0x20));
67
68 if (ah->ah_version == AR5K_AR5210) {
69 srev = ath5k_hw_reg_read(ah, AR5K_PHY(256) >> 28) & 0xf;
70 ret = (u16)ath5k_hw_bitswap(srev, 4) + 1;
71 } else {
72 srev = (ath5k_hw_reg_read(ah, AR5K_PHY(0x100)) >> 24) & 0xff;
73 ret = (u16)ath5k_hw_bitswap(((srev & 0xf0) >> 4) |
74 ((srev & 0x0f) << 4), 8);
75 }
76
77 /* Reset to the 5GHz mode */
78 ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_5GHZ, AR5K_PHY(0));
79
80 return ret;
81}
82
83/*
84 * Check if a channel is supported
85 */
86bool ath5k_channel_ok(struct ath5k_hw *ah, u16 freq, unsigned int flags)
87{
88 /* Check if the channel is in our supported range */
89 if (flags & CHANNEL_2GHZ) {
90 if ((freq >= ah->ah_capabilities.cap_range.range_2ghz_min) &&
91 (freq <= ah->ah_capabilities.cap_range.range_2ghz_max))
92 return true;
93 } else if (flags & CHANNEL_5GHZ)
94 if ((freq >= ah->ah_capabilities.cap_range.range_5ghz_min) &&
95 (freq <= ah->ah_capabilities.cap_range.range_5ghz_max))
96 return true;
97
98 return false;
99}
100
101bool ath5k_hw_chan_has_spur_noise(struct ath5k_hw *ah,
102 struct ieee80211_channel *channel)
103{
104 u8 refclk_freq;
105
106 if ((ah->ah_radio == AR5K_RF5112) ||
107 (ah->ah_radio == AR5K_RF5413) ||
108 (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4)))
109 refclk_freq = 40;
110 else
111 refclk_freq = 32;
112
113 if ((channel->center_freq % refclk_freq != 0) &&
114 ((channel->center_freq % refclk_freq < 10) ||
115 (channel->center_freq % refclk_freq > 22)))
116 return true;
117 else
118 return false;
119}
120
32/* 121/*
33 * Used to modify RF Banks before writing them to AR5K_RF_BUFFER 122 * Used to modify RF Banks before writing them to AR5K_RF_BUFFER
34 */ 123 */
@@ -110,6 +199,90 @@ static unsigned int ath5k_hw_rfb_op(struct ath5k_hw *ah,
110 return data; 199 return data;
111} 200}
112 201
202/**
203 * ath5k_hw_write_ofdm_timings - set OFDM timings on AR5212
204 *
205 * @ah: the &struct ath5k_hw
206 * @channel: the currently set channel upon reset
207 *
208 * Write the delta slope coefficient (used on pilot tracking ?) for OFDM
209 * operation on the AR5212 upon reset. This is a helper for ath5k_hw_phy_init.
210 *
211 * Since delta slope is floating point we split it on its exponent and
212 * mantissa and provide these values on hw.
213 *
214 * For more infos i think this patent is related
215 * http://www.freepatentsonline.com/7184495.html
216 */
217static inline int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah,
218 struct ieee80211_channel *channel)
219{
220 /* Get exponent and mantissa and set it */
221 u32 coef_scaled, coef_exp, coef_man,
222 ds_coef_exp, ds_coef_man, clock;
223
224 BUG_ON(!(ah->ah_version == AR5K_AR5212) ||
225 !(channel->hw_value & CHANNEL_OFDM));
226
227 /* Get coefficient
228 * ALGO: coef = (5 * clock / carrier_freq) / 2
229 * we scale coef by shifting clock value by 24 for
230 * better precision since we use integers */
231 switch (ah->ah_bwmode) {
232 case AR5K_BWMODE_40MHZ:
233 clock = 40 * 2;
234 break;
235 case AR5K_BWMODE_10MHZ:
236 clock = 40 / 2;
237 break;
238 case AR5K_BWMODE_5MHZ:
239 clock = 40 / 4;
240 break;
241 default:
242 clock = 40;
243 break;
244 }
245 coef_scaled = ((5 * (clock << 24)) / 2) / channel->center_freq;
246
247 /* Get exponent
248 * ALGO: coef_exp = 14 - highest set bit position */
249 coef_exp = ilog2(coef_scaled);
250
251 /* Doesn't make sense if it's zero*/
252 if (!coef_scaled || !coef_exp)
253 return -EINVAL;
254
255 /* Note: we've shifted coef_scaled by 24 */
256 coef_exp = 14 - (coef_exp - 24);
257
258
259 /* Get mantissa (significant digits)
260 * ALGO: coef_mant = floor(coef_scaled* 2^coef_exp+0.5) */
261 coef_man = coef_scaled +
262 (1 << (24 - coef_exp - 1));
263
264 /* Calculate delta slope coefficient exponent
265 * and mantissa (remove scaling) and set them on hw */
266 ds_coef_man = coef_man >> (24 - coef_exp);
267 ds_coef_exp = coef_exp - 16;
268
269 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_TIMING_3,
270 AR5K_PHY_TIMING_3_DSC_MAN, ds_coef_man);
271 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_TIMING_3,
272 AR5K_PHY_TIMING_3_DSC_EXP, ds_coef_exp);
273
274 return 0;
275}
276
277int ath5k_hw_phy_disable(struct ath5k_hw *ah)
278{
279 /*Just a try M.F.*/
280 ath5k_hw_reg_write(ah, AR5K_PHY_ACT_DISABLE, AR5K_PHY_ACT);
281
282 return 0;
283}
284
285
113/**********************\ 286/**********************\
114* RF Gain optimization * 287* RF Gain optimization *
115\**********************/ 288\**********************/
@@ -436,7 +609,7 @@ done:
436/* Write initial RF gain table to set the RF sensitivity 609/* Write initial RF gain table to set the RF sensitivity
437 * this one works on all RF chips and has nothing to do 610 * this one works on all RF chips and has nothing to do
438 * with gain_F calibration */ 611 * with gain_F calibration */
439int ath5k_hw_rfgain_init(struct ath5k_hw *ah, unsigned int freq) 612static int ath5k_hw_rfgain_init(struct ath5k_hw *ah, unsigned int freq)
440{ 613{
441 const struct ath5k_ini_rfgain *ath5k_rfg; 614 const struct ath5k_ini_rfgain *ath5k_rfg;
442 unsigned int i, size; 615 unsigned int i, size;
@@ -494,12 +667,11 @@ int ath5k_hw_rfgain_init(struct ath5k_hw *ah, unsigned int freq)
494* RF Registers setup * 667* RF Registers setup *
495\********************/ 668\********************/
496 669
497
498/* 670/*
499 * Setup RF registers by writing RF buffer on hw 671 * Setup RF registers by writing RF buffer on hw
500 */ 672 */
501int ath5k_hw_rfregs_init(struct ath5k_hw *ah, struct ieee80211_channel *channel, 673static int ath5k_hw_rfregs_init(struct ath5k_hw *ah,
502 unsigned int mode) 674 struct ieee80211_channel *channel, unsigned int mode)
503{ 675{
504 const struct ath5k_rf_reg *rf_regs; 676 const struct ath5k_rf_reg *rf_regs;
505 const struct ath5k_ini_rfbuffer *ini_rfb; 677 const struct ath5k_ini_rfbuffer *ini_rfb;
@@ -652,6 +824,11 @@ int ath5k_hw_rfregs_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
652 824
653 g_step = &go->go_step[ah->ah_gain.g_step_idx]; 825 g_step = &go->go_step[ah->ah_gain.g_step_idx];
654 826
827 /* Set turbo mode (N/A on RF5413) */
828 if ((ah->ah_bwmode == AR5K_BWMODE_40MHZ) &&
829 (ah->ah_radio != AR5K_RF5413))
830 ath5k_hw_rfb_op(ah, rf_regs, 1, AR5K_RF_TURBO, false);
831
655 /* Bank Modifications (chip-specific) */ 832 /* Bank Modifications (chip-specific) */
656 if (ah->ah_radio == AR5K_RF5111) { 833 if (ah->ah_radio == AR5K_RF5111) {
657 834
@@ -691,7 +868,23 @@ int ath5k_hw_rfregs_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
691 ath5k_hw_rfb_op(ah, rf_regs, ee->ee_xpd[ee_mode], 868 ath5k_hw_rfb_op(ah, rf_regs, ee->ee_xpd[ee_mode],
692 AR5K_RF_PLO_SEL, true); 869 AR5K_RF_PLO_SEL, true);
693 870
694 /* TODO: Half/quarter channel support */ 871 /* Tweak power detectors for half/quarter rate support */
872 if (ah->ah_bwmode == AR5K_BWMODE_5MHZ ||
873 ah->ah_bwmode == AR5K_BWMODE_10MHZ) {
874 u8 wait_i;
875
876 ath5k_hw_rfb_op(ah, rf_regs, 0x1f,
877 AR5K_RF_WAIT_S, true);
878
879 wait_i = (ah->ah_bwmode == AR5K_BWMODE_5MHZ) ?
880 0x1f : 0x10;
881
882 ath5k_hw_rfb_op(ah, rf_regs, wait_i,
883 AR5K_RF_WAIT_I, true);
884 ath5k_hw_rfb_op(ah, rf_regs, 3,
885 AR5K_RF_MAX_TIME, true);
886
887 }
695 } 888 }
696 889
697 if (ah->ah_radio == AR5K_RF5112) { 890 if (ah->ah_radio == AR5K_RF5112) {
@@ -789,8 +982,20 @@ int ath5k_hw_rfregs_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
789 ath5k_hw_rfb_op(ah, rf_regs, ee->ee_i_gain[ee_mode], 982 ath5k_hw_rfb_op(ah, rf_regs, ee->ee_i_gain[ee_mode],
790 AR5K_RF_GAIN_I, true); 983 AR5K_RF_GAIN_I, true);
791 984
792 /* TODO: Half/quarter channel support */ 985 /* Tweak power detector for half/quarter rates */
986 if (ah->ah_bwmode == AR5K_BWMODE_5MHZ ||
987 ah->ah_bwmode == AR5K_BWMODE_10MHZ) {
988 u8 pd_delay;
793 989
990 pd_delay = (ah->ah_bwmode == AR5K_BWMODE_5MHZ) ?
991 0xf : 0x8;
992
993 ath5k_hw_rfb_op(ah, rf_regs, pd_delay,
994 AR5K_RF_PD_PERIOD_A, true);
995 ath5k_hw_rfb_op(ah, rf_regs, 0xf,
996 AR5K_RF_PD_DELAY_A, true);
997
998 }
794 } 999 }
795 1000
796 if (ah->ah_radio == AR5K_RF5413 && 1001 if (ah->ah_radio == AR5K_RF5413 &&
@@ -822,24 +1027,6 @@ int ath5k_hw_rfregs_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
822\**************************/ 1027\**************************/
823 1028
824/* 1029/*
825 * Check if a channel is supported
826 */
827bool ath5k_channel_ok(struct ath5k_hw *ah, u16 freq, unsigned int flags)
828{
829 /* Check if the channel is in our supported range */
830 if (flags & CHANNEL_2GHZ) {
831 if ((freq >= ah->ah_capabilities.cap_range.range_2ghz_min) &&
832 (freq <= ah->ah_capabilities.cap_range.range_2ghz_max))
833 return true;
834 } else if (flags & CHANNEL_5GHZ)
835 if ((freq >= ah->ah_capabilities.cap_range.range_5ghz_min) &&
836 (freq <= ah->ah_capabilities.cap_range.range_5ghz_max))
837 return true;
838
839 return false;
840}
841
842/*
843 * Convertion needed for RF5110 1030 * Convertion needed for RF5110
844 */ 1031 */
845static u32 ath5k_hw_rf5110_chan2athchan(struct ieee80211_channel *channel) 1032static u32 ath5k_hw_rf5110_chan2athchan(struct ieee80211_channel *channel)
@@ -1045,7 +1232,8 @@ static int ath5k_hw_rf2425_channel(struct ath5k_hw *ah,
1045/* 1232/*
1046 * Set a channel on the radio chip 1233 * Set a channel on the radio chip
1047 */ 1234 */
1048int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel) 1235static int ath5k_hw_channel(struct ath5k_hw *ah,
1236 struct ieee80211_channel *channel)
1049{ 1237{
1050 int ret; 1238 int ret;
1051 /* 1239 /*
@@ -1092,8 +1280,6 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel)
1092 } 1280 }
1093 1281
1094 ah->ah_current_channel = channel; 1282 ah->ah_current_channel = channel;
1095 ah->ah_turbo = channel->hw_value == CHANNEL_T ? true : false;
1096 ath5k_hw_set_clockrate(ah);
1097 1283
1098 return 0; 1284 return 0;
1099} 1285}
@@ -1177,12 +1363,10 @@ void ath5k_hw_update_noise_floor(struct ath5k_hw *ah)
1177 1363
1178 switch (ah->ah_current_channel->hw_value & CHANNEL_MODES) { 1364 switch (ah->ah_current_channel->hw_value & CHANNEL_MODES) {
1179 case CHANNEL_A: 1365 case CHANNEL_A:
1180 case CHANNEL_T:
1181 case CHANNEL_XR: 1366 case CHANNEL_XR:
1182 ee_mode = AR5K_EEPROM_MODE_11A; 1367 ee_mode = AR5K_EEPROM_MODE_11A;
1183 break; 1368 break;
1184 case CHANNEL_G: 1369 case CHANNEL_G:
1185 case CHANNEL_TG:
1186 ee_mode = AR5K_EEPROM_MODE_11G; 1370 ee_mode = AR5K_EEPROM_MODE_11G;
1187 break; 1371 break;
1188 default: 1372 default:
@@ -1419,31 +1603,12 @@ int ath5k_hw_phy_calibrate(struct ath5k_hw *ah,
1419 return ret; 1603 return ret;
1420} 1604}
1421 1605
1606
1422/***************************\ 1607/***************************\
1423* Spur mitigation functions * 1608* Spur mitigation functions *
1424\***************************/ 1609\***************************/
1425 1610
1426bool ath5k_hw_chan_has_spur_noise(struct ath5k_hw *ah, 1611static void
1427 struct ieee80211_channel *channel)
1428{
1429 u8 refclk_freq;
1430
1431 if ((ah->ah_radio == AR5K_RF5112) ||
1432 (ah->ah_radio == AR5K_RF5413) ||
1433 (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4)))
1434 refclk_freq = 40;
1435 else
1436 refclk_freq = 32;
1437
1438 if ((channel->center_freq % refclk_freq != 0) &&
1439 ((channel->center_freq % refclk_freq < 10) ||
1440 (channel->center_freq % refclk_freq > 22)))
1441 return true;
1442 else
1443 return false;
1444}
1445
1446void
1447ath5k_hw_set_spur_mitigation_filter(struct ath5k_hw *ah, 1612ath5k_hw_set_spur_mitigation_filter(struct ath5k_hw *ah,
1448 struct ieee80211_channel *channel) 1613 struct ieee80211_channel *channel)
1449{ 1614{
@@ -1472,7 +1637,7 @@ ath5k_hw_set_spur_mitigation_filter(struct ath5k_hw *ah,
1472 spur_chan_fbin = AR5K_EEPROM_NO_SPUR; 1637 spur_chan_fbin = AR5K_EEPROM_NO_SPUR;
1473 spur_detection_window = AR5K_SPUR_CHAN_WIDTH; 1638 spur_detection_window = AR5K_SPUR_CHAN_WIDTH;
1474 /* XXX: Half/Quarter channels ?*/ 1639 /* XXX: Half/Quarter channels ?*/
1475 if (channel->hw_value & CHANNEL_TURBO) 1640 if (ah->ah_bwmode == AR5K_BWMODE_40MHZ)
1476 spur_detection_window *= 2; 1641 spur_detection_window *= 2;
1477 1642
1478 for (i = 0; i < AR5K_EEPROM_N_SPUR_CHANS; i++) { 1643 for (i = 0; i < AR5K_EEPROM_N_SPUR_CHANS; i++) {
@@ -1501,32 +1666,43 @@ ath5k_hw_set_spur_mitigation_filter(struct ath5k_hw *ah,
1501 * Calculate deltas: 1666 * Calculate deltas:
1502 * spur_freq_sigma_delta -> spur_offset / sample_freq << 21 1667 * spur_freq_sigma_delta -> spur_offset / sample_freq << 21
1503 * spur_delta_phase -> spur_offset / chip_freq << 11 1668 * spur_delta_phase -> spur_offset / chip_freq << 11
1504 * Note: Both values have 100KHz resolution 1669 * Note: Both values have 100Hz resolution
1505 */ 1670 */
1506 /* XXX: Half/Quarter rate channels ? */ 1671 switch (ah->ah_bwmode) {
1507 switch (channel->hw_value) { 1672 case AR5K_BWMODE_40MHZ:
1508 case CHANNEL_A:
1509 /* Both sample_freq and chip_freq are 40MHz */
1510 spur_delta_phase = (spur_offset << 17) / 25;
1511 spur_freq_sigma_delta = (spur_delta_phase >> 10);
1512 symbol_width = AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz;
1513 break;
1514 case CHANNEL_G:
1515 /* sample_freq -> 40MHz chip_freq -> 44MHz
1516 * (for b compatibility) */
1517 spur_freq_sigma_delta = (spur_offset << 8) / 55;
1518 spur_delta_phase = (spur_offset << 17) / 25;
1519 symbol_width = AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz;
1520 break;
1521 case CHANNEL_T:
1522 case CHANNEL_TG:
1523 /* Both sample_freq and chip_freq are 80MHz */ 1673 /* Both sample_freq and chip_freq are 80MHz */
1524 spur_delta_phase = (spur_offset << 16) / 25; 1674 spur_delta_phase = (spur_offset << 16) / 25;
1525 spur_freq_sigma_delta = (spur_delta_phase >> 10); 1675 spur_freq_sigma_delta = (spur_delta_phase >> 10);
1526 symbol_width = AR5K_SPUR_SYMBOL_WIDTH_TURBO_100Hz; 1676 symbol_width = AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz * 2;
1527 break; 1677 break;
1678 case AR5K_BWMODE_10MHZ:
1679 /* Both sample_freq and chip_freq are 20MHz (?) */
1680 spur_delta_phase = (spur_offset << 18) / 25;
1681 spur_freq_sigma_delta = (spur_delta_phase >> 10);
1682 symbol_width = AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz / 2;
1683 case AR5K_BWMODE_5MHZ:
1684 /* Both sample_freq and chip_freq are 10MHz (?) */
1685 spur_delta_phase = (spur_offset << 19) / 25;
1686 spur_freq_sigma_delta = (spur_delta_phase >> 10);
1687 symbol_width = AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz / 4;
1528 default: 1688 default:
1529 return; 1689 if (channel->hw_value == CHANNEL_A) {
1690 /* Both sample_freq and chip_freq are 40MHz */
1691 spur_delta_phase = (spur_offset << 17) / 25;
1692 spur_freq_sigma_delta =
1693 (spur_delta_phase >> 10);
1694 symbol_width =
1695 AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz;
1696 } else {
1697 /* sample_freq -> 40MHz chip_freq -> 44MHz
1698 * (for b compatibility) */
1699 spur_delta_phase = (spur_offset << 17) / 25;
1700 spur_freq_sigma_delta =
1701 (spur_offset << 8) / 55;
1702 symbol_width =
1703 AR5K_SPUR_SYMBOL_WIDTH_BASE_100Hz;
1704 }
1705 break;
1530 } 1706 }
1531 1707
1532 /* Calculate pilot and magnitude masks */ 1708 /* Calculate pilot and magnitude masks */
@@ -1666,63 +1842,6 @@ ath5k_hw_set_spur_mitigation_filter(struct ath5k_hw *ah,
1666 } 1842 }
1667} 1843}
1668 1844
1669/********************\
1670 Misc PHY functions
1671\********************/
1672
1673int ath5k_hw_phy_disable(struct ath5k_hw *ah)
1674{
1675 /*Just a try M.F.*/
1676 ath5k_hw_reg_write(ah, AR5K_PHY_ACT_DISABLE, AR5K_PHY_ACT);
1677
1678 return 0;
1679}
1680
1681/*
1682 * Get the PHY Chip revision
1683 */
1684u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, unsigned int chan)
1685{
1686 unsigned int i;
1687 u32 srev;
1688 u16 ret;
1689
1690 /*
1691 * Set the radio chip access register
1692 */
1693 switch (chan) {
1694 case CHANNEL_2GHZ:
1695 ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_2GHZ, AR5K_PHY(0));
1696 break;
1697 case CHANNEL_5GHZ:
1698 ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_5GHZ, AR5K_PHY(0));
1699 break;
1700 default:
1701 return 0;
1702 }
1703
1704 mdelay(2);
1705
1706 /* ...wait until PHY is ready and read the selected radio revision */
1707 ath5k_hw_reg_write(ah, 0x00001c16, AR5K_PHY(0x34));
1708
1709 for (i = 0; i < 8; i++)
1710 ath5k_hw_reg_write(ah, 0x00010000, AR5K_PHY(0x20));
1711
1712 if (ah->ah_version == AR5K_AR5210) {
1713 srev = ath5k_hw_reg_read(ah, AR5K_PHY(256) >> 28) & 0xf;
1714 ret = (u16)ath5k_hw_bitswap(srev, 4) + 1;
1715 } else {
1716 srev = (ath5k_hw_reg_read(ah, AR5K_PHY(0x100)) >> 24) & 0xff;
1717 ret = (u16)ath5k_hw_bitswap(((srev & 0xf0) >> 4) |
1718 ((srev & 0x0f) << 4), 8);
1719 }
1720
1721 /* Reset to the 5GHz mode */
1722 ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_5GHZ, AR5K_PHY(0));
1723
1724 return ret;
1725}
1726 1845
1727/*****************\ 1846/*****************\
1728* Antenna control * 1847* Antenna control *
@@ -1830,12 +1949,10 @@ ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode)
1830 1949
1831 switch (channel->hw_value & CHANNEL_MODES) { 1950 switch (channel->hw_value & CHANNEL_MODES) {
1832 case CHANNEL_A: 1951 case CHANNEL_A:
1833 case CHANNEL_T:
1834 case CHANNEL_XR: 1952 case CHANNEL_XR:
1835 ee_mode = AR5K_EEPROM_MODE_11A; 1953 ee_mode = AR5K_EEPROM_MODE_11A;
1836 break; 1954 break;
1837 case CHANNEL_G: 1955 case CHANNEL_G:
1838 case CHANNEL_TG:
1839 ee_mode = AR5K_EEPROM_MODE_11G; 1956 ee_mode = AR5K_EEPROM_MODE_11G;
1840 break; 1957 break;
1841 case CHANNEL_B: 1958 case CHANNEL_B:
@@ -2269,20 +2386,20 @@ ath5k_get_max_ctl_power(struct ath5k_hw *ah,
2269 2386
2270 switch (channel->hw_value & CHANNEL_MODES) { 2387 switch (channel->hw_value & CHANNEL_MODES) {
2271 case CHANNEL_A: 2388 case CHANNEL_A:
2272 ctl_mode |= AR5K_CTL_11A; 2389 if (ah->ah_bwmode == AR5K_BWMODE_40MHZ)
2390 ctl_mode |= AR5K_CTL_TURBO;
2391 else
2392 ctl_mode |= AR5K_CTL_11A;
2273 break; 2393 break;
2274 case CHANNEL_G: 2394 case CHANNEL_G:
2275 ctl_mode |= AR5K_CTL_11G; 2395 if (ah->ah_bwmode == AR5K_BWMODE_40MHZ)
2396 ctl_mode |= AR5K_CTL_TURBOG;
2397 else
2398 ctl_mode |= AR5K_CTL_11G;
2276 break; 2399 break;
2277 case CHANNEL_B: 2400 case CHANNEL_B:
2278 ctl_mode |= AR5K_CTL_11B; 2401 ctl_mode |= AR5K_CTL_11B;
2279 break; 2402 break;
2280 case CHANNEL_T:
2281 ctl_mode |= AR5K_CTL_TURBO;
2282 break;
2283 case CHANNEL_TG:
2284 ctl_mode |= AR5K_CTL_TURBOG;
2285 break;
2286 case CHANNEL_XR: 2403 case CHANNEL_XR:
2287 /* Fall through */ 2404 /* Fall through */
2288 default: 2405 default:
@@ -2984,9 +3101,9 @@ ath5k_setup_rate_powertable(struct ath5k_hw *ah, u16 max_pwr,
2984/* 3101/*
2985 * Set transmission power 3102 * Set transmission power
2986 */ 3103 */
2987int 3104static int
2988ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel, 3105ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
2989 u8 ee_mode, u8 txpower) 3106 u8 ee_mode, u8 txpower, bool fast)
2990{ 3107{
2991 struct ath5k_rate_pcal_info rate_info; 3108 struct ath5k_rate_pcal_info rate_info;
2992 u8 type; 3109 u8 type;
@@ -3005,6 +3122,9 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
3005 3122
3006 /* Initialize TX power table */ 3123 /* Initialize TX power table */
3007 switch (ah->ah_radio) { 3124 switch (ah->ah_radio) {
3125 case AR5K_RF5110:
3126 /* TODO */
3127 return 0;
3008 case AR5K_RF5111: 3128 case AR5K_RF5111:
3009 type = AR5K_PWRTABLE_PWR_TO_PCDAC; 3129 type = AR5K_PWRTABLE_PWR_TO_PCDAC;
3010 break; 3130 break;
@@ -3022,10 +3142,15 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
3022 return -EINVAL; 3142 return -EINVAL;
3023 } 3143 }
3024 3144
3025 /* FIXME: Only on channel/mode change */ 3145 /* If fast is set it means we are on the same channel/mode
3026 ret = ath5k_setup_channel_powertable(ah, channel, ee_mode, type); 3146 * so there is no need to recalculate the powertable, we 'll
3027 if (ret) 3147 * just use the cached one */
3028 return ret; 3148 if (!fast) {
3149 ret = ath5k_setup_channel_powertable(ah, channel,
3150 ee_mode, type);
3151 if (ret)
3152 return ret;
3153 }
3029 3154
3030 /* Limit max power if we have a CTL available */ 3155 /* Limit max power if we have a CTL available */
3031 ath5k_get_max_ctl_power(ah, channel); 3156 ath5k_get_max_ctl_power(ah, channel);
@@ -3086,12 +3211,10 @@ int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower)
3086 3211
3087 switch (channel->hw_value & CHANNEL_MODES) { 3212 switch (channel->hw_value & CHANNEL_MODES) {
3088 case CHANNEL_A: 3213 case CHANNEL_A:
3089 case CHANNEL_T:
3090 case CHANNEL_XR: 3214 case CHANNEL_XR:
3091 ee_mode = AR5K_EEPROM_MODE_11A; 3215 ee_mode = AR5K_EEPROM_MODE_11A;
3092 break; 3216 break;
3093 case CHANNEL_G: 3217 case CHANNEL_G:
3094 case CHANNEL_TG:
3095 ee_mode = AR5K_EEPROM_MODE_11G; 3218 ee_mode = AR5K_EEPROM_MODE_11G;
3096 break; 3219 break;
3097 case CHANNEL_B: 3220 case CHANNEL_B:
@@ -3106,5 +3229,229 @@ int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower)
3106 ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_TXPOWER, 3229 ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_TXPOWER,
3107 "changing txpower to %d\n", txpower); 3230 "changing txpower to %d\n", txpower);
3108 3231
3109 return ath5k_hw_txpower(ah, channel, ee_mode, txpower); 3232 return ath5k_hw_txpower(ah, channel, ee_mode, txpower, true);
3233}
3234
3235/*************\
3236 Init function
3237\*************/
3238
3239int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
3240 u8 mode, u8 ee_mode, u8 freq, bool fast)
3241{
3242 struct ieee80211_channel *curr_channel;
3243 int ret, i;
3244 u32 phy_tst1;
3245 bool fast_txp;
3246 ret = 0;
3247
3248 /*
3249 * Sanity check for fast flag
3250 * Don't try fast channel change when changing modulation
3251 * mode/band. We check for chip compatibility on
3252 * ath5k_hw_reset.
3253 */
3254 curr_channel = ah->ah_current_channel;
3255 if (fast && (channel->hw_value != curr_channel->hw_value))
3256 return -EINVAL;
3257
3258 /*
3259 * On fast channel change we only set the synth parameters
3260 * while PHY is running, enable calibration and skip the rest.
3261 */
3262 if (fast) {
3263 AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_RFBUS_REQ,
3264 AR5K_PHY_RFBUS_REQ_REQUEST);
3265 for (i = 0; i < 100; i++) {
3266 if (ath5k_hw_reg_read(ah, AR5K_PHY_RFBUS_GRANT))
3267 break;
3268 udelay(5);
3269 }
3270 /* Failed */
3271 if (i >= 100)
3272 return -EIO;
3273 }
3274
3275 /*
3276 * If we don't change channel/mode skip
3277 * tx powertable calculation and use the
3278 * cached one.
3279 */
3280 if ((channel->hw_value == curr_channel->hw_value) &&
3281 (channel->center_freq == curr_channel->center_freq))
3282 fast_txp = true;
3283 else
3284 fast_txp = false;
3285
3286 /*
3287 * Set TX power
3288 *
3289 * Note: We need to do that before we set
3290 * RF buffer settings on 5211/5212+ so that we
3291 * properly set curve indices.
3292 */
3293 ret = ath5k_hw_txpower(ah, channel, ee_mode,
3294 ah->ah_txpower.txp_max_pwr / 2,
3295 fast_txp);
3296 if (ret)
3297 return ret;
3298
3299 /*
3300 * For 5210 we do all initialization using
3301 * initvals, so we don't have to modify
3302 * any settings (5210 also only supports
3303 * a/aturbo modes)
3304 */
3305 if ((ah->ah_version != AR5K_AR5210) && !fast) {
3306
3307 /*
3308 * Write initial RF gain settings
3309 * This should work for both 5111/5112
3310 */
3311 ret = ath5k_hw_rfgain_init(ah, freq);
3312 if (ret)
3313 return ret;
3314
3315 mdelay(1);
3316
3317 /*
3318 * Write RF buffer
3319 */
3320 ret = ath5k_hw_rfregs_init(ah, channel, mode);
3321 if (ret)
3322 return ret;
3323
3324 /* Write OFDM timings on 5212*/
3325 if (ah->ah_version == AR5K_AR5212 &&
3326 channel->hw_value & CHANNEL_OFDM) {
3327
3328 ret = ath5k_hw_write_ofdm_timings(ah, channel);
3329 if (ret)
3330 return ret;
3331
3332 /* Spur info is available only from EEPROM versions
3333 * greater than 5.3, but the EEPROM routines will use
3334 * static values for older versions */
3335 if (ah->ah_mac_srev >= AR5K_SREV_AR5424)
3336 ath5k_hw_set_spur_mitigation_filter(ah,
3337 channel);
3338 }
3339
3340 /*Enable/disable 802.11b mode on 5111
3341 (enable 2111 frequency converter + CCK)*/
3342 if (ah->ah_radio == AR5K_RF5111) {
3343 if (mode == AR5K_MODE_11B)
3344 AR5K_REG_ENABLE_BITS(ah, AR5K_TXCFG,
3345 AR5K_TXCFG_B_MODE);
3346 else
3347 AR5K_REG_DISABLE_BITS(ah, AR5K_TXCFG,
3348 AR5K_TXCFG_B_MODE);
3349 }
3350
3351 } else if (ah->ah_version == AR5K_AR5210) {
3352 mdelay(1);
3353 /* Disable phy and wait */
3354 ath5k_hw_reg_write(ah, AR5K_PHY_ACT_DISABLE, AR5K_PHY_ACT);
3355 mdelay(1);
3356 }
3357
3358 /* Set channel on PHY */
3359 ret = ath5k_hw_channel(ah, channel);
3360 if (ret)
3361 return ret;
3362
3363 /*
3364 * Enable the PHY and wait until completion
3365 * This includes BaseBand and Synthesizer
3366 * activation.
3367 */
3368 ath5k_hw_reg_write(ah, AR5K_PHY_ACT_ENABLE, AR5K_PHY_ACT);
3369
3370 /*
3371 * On 5211+ read activation -> rx delay
3372 * and use it.
3373 */
3374 if (ah->ah_version != AR5K_AR5210) {
3375 u32 delay;
3376 delay = ath5k_hw_reg_read(ah, AR5K_PHY_RX_DELAY) &
3377 AR5K_PHY_RX_DELAY_M;
3378 delay = (channel->hw_value & CHANNEL_CCK) ?
3379 ((delay << 2) / 22) : (delay / 10);
3380 if (ah->ah_bwmode == AR5K_BWMODE_10MHZ)
3381 delay = delay << 1;
3382 if (ah->ah_bwmode == AR5K_BWMODE_5MHZ)
3383 delay = delay << 2;
3384 /* XXX: /2 on turbo ? Let's be safe
3385 * for now */
3386 udelay(100 + delay);
3387 } else {
3388 mdelay(1);
3389 }
3390
3391 if (fast)
3392 /*
3393 * Release RF Bus grant
3394 */
3395 AR5K_REG_DISABLE_BITS(ah, AR5K_PHY_RFBUS_REQ,
3396 AR5K_PHY_RFBUS_REQ_REQUEST);
3397 else {
3398 /*
3399 * Perform ADC test to see if baseband is ready
3400 * Set tx hold and check adc test register
3401 */
3402 phy_tst1 = ath5k_hw_reg_read(ah, AR5K_PHY_TST1);
3403 ath5k_hw_reg_write(ah, AR5K_PHY_TST1_TXHOLD, AR5K_PHY_TST1);
3404 for (i = 0; i <= 20; i++) {
3405 if (!(ath5k_hw_reg_read(ah, AR5K_PHY_ADC_TEST) & 0x10))
3406 break;
3407 udelay(200);
3408 }
3409 ath5k_hw_reg_write(ah, phy_tst1, AR5K_PHY_TST1);
3410 }
3411
3412 /*
3413 * Start automatic gain control calibration
3414 *
3415 * During AGC calibration RX path is re-routed to
3416 * a power detector so we don't receive anything.
3417 *
3418 * This method is used to calibrate some static offsets
3419 * used together with on-the fly I/Q calibration (the
3420 * one performed via ath5k_hw_phy_calibrate), which doesn't
3421 * interrupt rx path.
3422 *
3423 * While rx path is re-routed to the power detector we also
3424 * start a noise floor calibration to measure the
3425 * card's noise floor (the noise we measure when we are not
3426 * transmitting or receiving anything).
3427 *
3428 * If we are in a noisy environment, AGC calibration may time
3429 * out and/or noise floor calibration might timeout.
3430 */
3431 AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL,
3432 AR5K_PHY_AGCCTL_CAL | AR5K_PHY_AGCCTL_NF);
3433
3434 /* At the same time start I/Q calibration for QAM constellation
3435 * -no need for CCK- */
3436 ah->ah_calibration = false;
3437 if (!(mode == AR5K_MODE_11B)) {
3438 ah->ah_calibration = true;
3439 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ,
3440 AR5K_PHY_IQ_CAL_NUM_LOG_MAX, 15);
3441 AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ,
3442 AR5K_PHY_IQ_RUN);
3443 }
3444
3445 /* Wait for gain calibration to finish (we check for I/Q calibration
3446 * during ath5k_phy_calibrate) */
3447 if (ath5k_hw_register_timeout(ah, AR5K_PHY_AGCCTL,
3448 AR5K_PHY_AGCCTL_CAL, 0, false)) {
3449 ATH5K_ERR(ah->ah_sc, "gain calibration timeout (%uMHz)\n",
3450 channel->center_freq);
3451 }
3452
3453 /* Restore antenna mode */
3454 ath5k_hw_set_antenna_mode(ah, ah->ah_ant_mode);
3455
3456 return ret;
3110} 3457}
diff --git a/drivers/net/wireless/ath/ath5k/qcu.c b/drivers/net/wireless/ath/ath5k/qcu.c
index 84c717ded1c5..1849eee8235c 100644
--- a/drivers/net/wireless/ath/ath5k/qcu.c
+++ b/drivers/net/wireless/ath/ath5k/qcu.c
@@ -25,14 +25,52 @@ Queue Control Unit, DFS Control Unit Functions
25#include "debug.h" 25#include "debug.h"
26#include "base.h" 26#include "base.h"
27 27
28
29/******************\
30* Helper functions *
31\******************/
32
28/* 33/*
29 * Get properties for a transmit queue 34 * Get number of pending frames
35 * for a specific queue [5211+]
30 */ 36 */
31int ath5k_hw_get_tx_queueprops(struct ath5k_hw *ah, int queue, 37u32 ath5k_hw_num_tx_pending(struct ath5k_hw *ah, unsigned int queue)
32 struct ath5k_txq_info *queue_info)
33{ 38{
34 memcpy(queue_info, &ah->ah_txq[queue], sizeof(struct ath5k_txq_info)); 39 u32 pending;
35 return 0; 40 AR5K_ASSERT_ENTRY(queue, ah->ah_capabilities.cap_queues.q_tx_num);
41
42 /* Return if queue is declared inactive */
43 if (ah->ah_txq[queue].tqi_type == AR5K_TX_QUEUE_INACTIVE)
44 return false;
45
46 /* XXX: How about AR5K_CFG_TXCNT ? */
47 if (ah->ah_version == AR5K_AR5210)
48 return false;
49
50 pending = ath5k_hw_reg_read(ah, AR5K_QUEUE_STATUS(queue));
51 pending &= AR5K_QCU_STS_FRMPENDCNT;
52
53 /* It's possible to have no frames pending even if TXE
54 * is set. To indicate that q has not stopped return
55 * true */
56 if (!pending && AR5K_REG_READ_Q(ah, AR5K_QCU_TXE, queue))
57 return true;
58
59 return pending;
60}
61
62/*
63 * Set a transmit queue inactive
64 */
65void ath5k_hw_release_tx_queue(struct ath5k_hw *ah, unsigned int queue)
66{
67 if (WARN_ON(queue >= ah->ah_capabilities.cap_queues.q_tx_num))
68 return;
69
70 /* This queue will be skipped in further operations */
71 ah->ah_txq[queue].tqi_type = AR5K_TX_QUEUE_INACTIVE;
72 /*For SIMR setup*/
73 AR5K_Q_DISABLE_BITS(ah->ah_txq_status, queue);
36} 74}
37 75
38/* 76/*
@@ -50,6 +88,16 @@ static u16 ath5k_cw_validate(u16 cw_req)
50} 88}
51 89
52/* 90/*
91 * Get properties for a transmit queue
92 */
93int ath5k_hw_get_tx_queueprops(struct ath5k_hw *ah, int queue,
94 struct ath5k_txq_info *queue_info)
95{
96 memcpy(queue_info, &ah->ah_txq[queue], sizeof(struct ath5k_txq_info));
97 return 0;
98}
99
100/*
53 * Set properties for a transmit queue 101 * Set properties for a transmit queue
54 */ 102 */
55int ath5k_hw_set_tx_queueprops(struct ath5k_hw *ah, int queue, 103int ath5k_hw_set_tx_queueprops(struct ath5k_hw *ah, int queue,
@@ -172,113 +220,18 @@ int ath5k_hw_setup_tx_queue(struct ath5k_hw *ah, enum ath5k_tx_queue queue_type,
172 return queue; 220 return queue;
173} 221}
174 222
175/*
176 * Get number of pending frames
177 * for a specific queue [5211+]
178 */
179u32 ath5k_hw_num_tx_pending(struct ath5k_hw *ah, unsigned int queue)
180{
181 u32 pending;
182 AR5K_ASSERT_ENTRY(queue, ah->ah_capabilities.cap_queues.q_tx_num);
183
184 /* Return if queue is declared inactive */
185 if (ah->ah_txq[queue].tqi_type == AR5K_TX_QUEUE_INACTIVE)
186 return false;
187
188 /* XXX: How about AR5K_CFG_TXCNT ? */
189 if (ah->ah_version == AR5K_AR5210)
190 return false;
191
192 pending = ath5k_hw_reg_read(ah, AR5K_QUEUE_STATUS(queue));
193 pending &= AR5K_QCU_STS_FRMPENDCNT;
194
195 /* It's possible to have no frames pending even if TXE
196 * is set. To indicate that q has not stopped return
197 * true */
198 if (!pending && AR5K_REG_READ_Q(ah, AR5K_QCU_TXE, queue))
199 return true;
200
201 return pending;
202}
203
204/*
205 * Set a transmit queue inactive
206 */
207void ath5k_hw_release_tx_queue(struct ath5k_hw *ah, unsigned int queue)
208{
209 if (WARN_ON(queue >= ah->ah_capabilities.cap_queues.q_tx_num))
210 return;
211 223
212 /* This queue will be skipped in further operations */ 224/*******************************\
213 ah->ah_txq[queue].tqi_type = AR5K_TX_QUEUE_INACTIVE; 225* Single QCU/DCU initialization *
214 /*For SIMR setup*/ 226\*******************************/
215 AR5K_Q_DISABLE_BITS(ah->ah_txq_status, queue);
216}
217 227
218/* 228/*
219 * Set DFS properties for a transmit queue on DCU 229 * Set tx retry limits on DCU
220 */ 230 */
221int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue) 231static void ath5k_hw_set_tx_retry_limits(struct ath5k_hw *ah,
232 unsigned int queue)
222{ 233{
223 u32 retry_lg, retry_sh; 234 u32 retry_lg, retry_sh;
224 struct ath5k_txq_info *tq = &ah->ah_txq[queue];
225
226 AR5K_ASSERT_ENTRY(queue, ah->ah_capabilities.cap_queues.q_tx_num);
227
228 tq = &ah->ah_txq[queue];
229
230 if (tq->tqi_type == AR5K_TX_QUEUE_INACTIVE)
231 return 0;
232
233 if (ah->ah_version == AR5K_AR5210) {
234 /* Only handle data queues, others will be ignored */
235 if (tq->tqi_type != AR5K_TX_QUEUE_DATA)
236 return 0;
237
238 /* Set Slot time */
239 ath5k_hw_reg_write(ah, ah->ah_turbo ?
240 AR5K_INIT_SLOT_TIME_TURBO : AR5K_INIT_SLOT_TIME,
241 AR5K_SLOT_TIME);
242 /* Set ACK_CTS timeout */
243 ath5k_hw_reg_write(ah, ah->ah_turbo ?
244 AR5K_INIT_ACK_CTS_TIMEOUT_TURBO :
245 AR5K_INIT_ACK_CTS_TIMEOUT, AR5K_SLOT_TIME);
246 /* Set Transmit Latency */
247 ath5k_hw_reg_write(ah, ah->ah_turbo ?
248 AR5K_INIT_TRANSMIT_LATENCY_TURBO :
249 AR5K_INIT_TRANSMIT_LATENCY, AR5K_USEC_5210);
250
251 /* Set IFS0 */
252 if (ah->ah_turbo) {
253 ath5k_hw_reg_write(ah, ((AR5K_INIT_SIFS_TURBO +
254 tq->tqi_aifs * AR5K_INIT_SLOT_TIME_TURBO) <<
255 AR5K_IFS0_DIFS_S) | AR5K_INIT_SIFS_TURBO,
256 AR5K_IFS0);
257 } else {
258 ath5k_hw_reg_write(ah, ((AR5K_INIT_SIFS +
259 tq->tqi_aifs * AR5K_INIT_SLOT_TIME) <<
260 AR5K_IFS0_DIFS_S) |
261 AR5K_INIT_SIFS, AR5K_IFS0);
262 }
263
264 /* Set IFS1 */
265 ath5k_hw_reg_write(ah, ah->ah_turbo ?
266 AR5K_INIT_PROTO_TIME_CNTRL_TURBO :
267 AR5K_INIT_PROTO_TIME_CNTRL, AR5K_IFS1);
268 /* Set AR5K_PHY_SETTLING */
269 ath5k_hw_reg_write(ah, ah->ah_turbo ?
270 (ath5k_hw_reg_read(ah, AR5K_PHY_SETTLING) & ~0x7F)
271 | 0x38 :
272 (ath5k_hw_reg_read(ah, AR5K_PHY_SETTLING) & ~0x7F)
273 | 0x1C,
274 AR5K_PHY_SETTLING);
275 /* Set Frame Control Register */
276 ath5k_hw_reg_write(ah, ah->ah_turbo ?
277 (AR5K_PHY_FRAME_CTL_INI | AR5K_PHY_TURBO_MODE |
278 AR5K_PHY_TURBO_SHORT | 0x2020) :
279 (AR5K_PHY_FRAME_CTL_INI | 0x1020),
280 AR5K_PHY_FRAME_CTL_5210);
281 }
282 235
283 /* 236 /*
284 * Calculate and set retry limits 237 * Calculate and set retry limits
@@ -293,8 +246,13 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue)
293 retry_sh = AR5K_INIT_SH_RETRY; 246 retry_sh = AR5K_INIT_SH_RETRY;
294 } 247 }
295 248
296 /*No QCU/DCU [5210]*/ 249 /* Single data queue on AR5210 */
297 if (ah->ah_version == AR5K_AR5210) { 250 if (ah->ah_version == AR5K_AR5210) {
251 struct ath5k_txq_info *tq = &ah->ah_txq[queue];
252
253 if (queue > 0)
254 return;
255
298 ath5k_hw_reg_write(ah, 256 ath5k_hw_reg_write(ah,
299 (tq->tqi_cw_min << AR5K_NODCU_RETRY_LMT_CW_MIN_S) 257 (tq->tqi_cw_min << AR5K_NODCU_RETRY_LMT_CW_MIN_S)
300 | AR5K_REG_SM(AR5K_INIT_SLG_RETRY, 258 | AR5K_REG_SM(AR5K_INIT_SLG_RETRY,
@@ -304,8 +262,8 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue)
304 | AR5K_REG_SM(retry_lg, AR5K_NODCU_RETRY_LMT_LG_RETRY) 262 | AR5K_REG_SM(retry_lg, AR5K_NODCU_RETRY_LMT_LG_RETRY)
305 | AR5K_REG_SM(retry_sh, AR5K_NODCU_RETRY_LMT_SH_RETRY), 263 | AR5K_REG_SM(retry_sh, AR5K_NODCU_RETRY_LMT_SH_RETRY),
306 AR5K_NODCU_RETRY_LMT); 264 AR5K_NODCU_RETRY_LMT);
265 /* DCU on AR5211+ */
307 } else { 266 } else {
308 /*QCU/DCU [5211+]*/
309 ath5k_hw_reg_write(ah, 267 ath5k_hw_reg_write(ah,
310 AR5K_REG_SM(AR5K_INIT_SLG_RETRY, 268 AR5K_REG_SM(AR5K_INIT_SLG_RETRY,
311 AR5K_DCU_RETRY_LMT_SLG_RETRY) | 269 AR5K_DCU_RETRY_LMT_SLG_RETRY) |
@@ -314,219 +272,393 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue)
314 AR5K_REG_SM(retry_lg, AR5K_DCU_RETRY_LMT_LG_RETRY) | 272 AR5K_REG_SM(retry_lg, AR5K_DCU_RETRY_LMT_LG_RETRY) |
315 AR5K_REG_SM(retry_sh, AR5K_DCU_RETRY_LMT_SH_RETRY), 273 AR5K_REG_SM(retry_sh, AR5K_DCU_RETRY_LMT_SH_RETRY),
316 AR5K_QUEUE_DFS_RETRY_LIMIT(queue)); 274 AR5K_QUEUE_DFS_RETRY_LIMIT(queue));
275 }
276 return;
277}
278
279/**
280 * ath5k_hw_reset_tx_queue - Initialize a single hw queue
281 *
282 * @ah The &struct ath5k_hw
283 * @queue The hw queue number
284 *
285 * Set DFS properties for the given transmit queue on DCU
286 * and configures all queue-specific parameters.
287 */
288int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue)
289{
290 struct ath5k_txq_info *tq = &ah->ah_txq[queue];
317 291
318 /*===Rest is also for QCU/DCU only [5211+]===*/ 292 AR5K_ASSERT_ENTRY(queue, ah->ah_capabilities.cap_queues.q_tx_num);
319 293
320 /* 294 tq = &ah->ah_txq[queue];
321 * Set contention window (cw_min/cw_max) 295
322 * and arbitrated interframe space (aifs)... 296 /* Skip if queue inactive or if we are on AR5210
323 */ 297 * that doesn't have QCU/DCU */
324 ath5k_hw_reg_write(ah, 298 if ((ah->ah_version == AR5K_AR5210) ||
325 AR5K_REG_SM(tq->tqi_cw_min, AR5K_DCU_LCL_IFS_CW_MIN) | 299 (tq->tqi_type == AR5K_TX_QUEUE_INACTIVE))
326 AR5K_REG_SM(tq->tqi_cw_max, AR5K_DCU_LCL_IFS_CW_MAX) | 300 return 0;
327 AR5K_REG_SM(tq->tqi_aifs, AR5K_DCU_LCL_IFS_AIFS), 301
328 AR5K_QUEUE_DFS_LOCAL_IFS(queue)); 302 /*
329 303 * Set contention window (cw_min/cw_max)
330 /* 304 * and arbitrated interframe space (aifs)...
331 * Set misc registers 305 */
332 */ 306 ath5k_hw_reg_write(ah,
333 /* Enable DCU early termination for this queue */ 307 AR5K_REG_SM(tq->tqi_cw_min, AR5K_DCU_LCL_IFS_CW_MIN) |
334 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), 308 AR5K_REG_SM(tq->tqi_cw_max, AR5K_DCU_LCL_IFS_CW_MAX) |
335 AR5K_QCU_MISC_DCU_EARLY); 309 AR5K_REG_SM(tq->tqi_aifs, AR5K_DCU_LCL_IFS_AIFS),
310 AR5K_QUEUE_DFS_LOCAL_IFS(queue));
311
312 /*
313 * Set tx retry limits for this queue
314 */
315 ath5k_hw_set_tx_retry_limits(ah, queue);
316
317
318 /*
319 * Set misc registers
320 */
321
322 /* Enable DCU to wait for next fragment from QCU */
323 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue),
324 AR5K_DCU_MISC_FRAG_WAIT);
336 325
337 /* Enable DCU to wait for next fragment from QCU */ 326 /* On Maui and Spirit use the global seqnum on DCU */
327 if (ah->ah_mac_version < AR5K_SREV_AR5211)
338 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue), 328 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue),
339 AR5K_DCU_MISC_FRAG_WAIT); 329 AR5K_DCU_MISC_SEQNUM_CTL);
340 330
341 /* On Maui and Spirit use the global seqnum on DCU */ 331 /* Constant bit rate period */
342 if (ah->ah_mac_version < AR5K_SREV_AR5211) 332 if (tq->tqi_cbr_period) {
343 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue), 333 ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_cbr_period,
344 AR5K_DCU_MISC_SEQNUM_CTL); 334 AR5K_QCU_CBRCFG_INTVAL) |
345 335 AR5K_REG_SM(tq->tqi_cbr_overflow_limit,
346 if (tq->tqi_cbr_period) { 336 AR5K_QCU_CBRCFG_ORN_THRES),
347 ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_cbr_period, 337 AR5K_QUEUE_CBRCFG(queue));
348 AR5K_QCU_CBRCFG_INTVAL) | 338
349 AR5K_REG_SM(tq->tqi_cbr_overflow_limit, 339 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue),
350 AR5K_QCU_CBRCFG_ORN_THRES), 340 AR5K_QCU_MISC_FRSHED_CBR);
351 AR5K_QUEUE_CBRCFG(queue)); 341
342 if (tq->tqi_cbr_overflow_limit)
352 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), 343 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue),
353 AR5K_QCU_MISC_FRSHED_CBR);
354 if (tq->tqi_cbr_overflow_limit)
355 AR5K_REG_ENABLE_BITS(ah,
356 AR5K_QUEUE_MISC(queue),
357 AR5K_QCU_MISC_CBR_THRES_ENABLE); 344 AR5K_QCU_MISC_CBR_THRES_ENABLE);
358 } 345 }
359 346
360 if (tq->tqi_ready_time && 347 /* Ready time interval */
361 (tq->tqi_type != AR5K_TX_QUEUE_CAB)) 348 if (tq->tqi_ready_time && (tq->tqi_type != AR5K_TX_QUEUE_CAB))
362 ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_ready_time, 349 ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_ready_time,
363 AR5K_QCU_RDYTIMECFG_INTVAL) | 350 AR5K_QCU_RDYTIMECFG_INTVAL) |
364 AR5K_QCU_RDYTIMECFG_ENABLE, 351 AR5K_QCU_RDYTIMECFG_ENABLE,
365 AR5K_QUEUE_RDYTIMECFG(queue)); 352 AR5K_QUEUE_RDYTIMECFG(queue));
366 353
367 if (tq->tqi_burst_time) { 354 if (tq->tqi_burst_time) {
368 ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_burst_time, 355 ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_burst_time,
369 AR5K_DCU_CHAN_TIME_DUR) | 356 AR5K_DCU_CHAN_TIME_DUR) |
370 AR5K_DCU_CHAN_TIME_ENABLE, 357 AR5K_DCU_CHAN_TIME_ENABLE,
371 AR5K_QUEUE_DFS_CHANNEL_TIME(queue)); 358 AR5K_QUEUE_DFS_CHANNEL_TIME(queue));
372 359
373 if (tq->tqi_flags 360 if (tq->tqi_flags & AR5K_TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE)
374 & AR5K_TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE) 361 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue),
375 AR5K_REG_ENABLE_BITS(ah,
376 AR5K_QUEUE_MISC(queue),
377 AR5K_QCU_MISC_RDY_VEOL_POLICY); 362 AR5K_QCU_MISC_RDY_VEOL_POLICY);
378 } 363 }
379 364
380 if (tq->tqi_flags & AR5K_TXQ_FLAG_BACKOFF_DISABLE) 365 /* Enable/disable Post frame backoff */
381 ath5k_hw_reg_write(ah, AR5K_DCU_MISC_POST_FR_BKOFF_DIS, 366 if (tq->tqi_flags & AR5K_TXQ_FLAG_BACKOFF_DISABLE)
382 AR5K_QUEUE_DFS_MISC(queue)); 367 ath5k_hw_reg_write(ah, AR5K_DCU_MISC_POST_FR_BKOFF_DIS,
368 AR5K_QUEUE_DFS_MISC(queue));
383 369
384 if (tq->tqi_flags & AR5K_TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE) 370 /* Enable/disable fragmentation burst backoff */
385 ath5k_hw_reg_write(ah, AR5K_DCU_MISC_BACKOFF_FRAG, 371 if (tq->tqi_flags & AR5K_TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE)
386 AR5K_QUEUE_DFS_MISC(queue)); 372 ath5k_hw_reg_write(ah, AR5K_DCU_MISC_BACKOFF_FRAG,
373 AR5K_QUEUE_DFS_MISC(queue));
387 374
388 /* 375 /*
389 * Set registers by queue type 376 * Set registers by queue type
390 */ 377 */
391 switch (tq->tqi_type) { 378 switch (tq->tqi_type) {
392 case AR5K_TX_QUEUE_BEACON: 379 case AR5K_TX_QUEUE_BEACON:
393 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), 380 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue),
394 AR5K_QCU_MISC_FRSHED_DBA_GT | 381 AR5K_QCU_MISC_FRSHED_DBA_GT |
395 AR5K_QCU_MISC_CBREXP_BCN_DIS | 382 AR5K_QCU_MISC_CBREXP_BCN_DIS |
396 AR5K_QCU_MISC_BCN_ENABLE); 383 AR5K_QCU_MISC_BCN_ENABLE);
397 384
398 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue), 385 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue),
399 (AR5K_DCU_MISC_ARBLOCK_CTL_GLOBAL << 386 (AR5K_DCU_MISC_ARBLOCK_CTL_GLOBAL <<
400 AR5K_DCU_MISC_ARBLOCK_CTL_S) | 387 AR5K_DCU_MISC_ARBLOCK_CTL_S) |
401 AR5K_DCU_MISC_ARBLOCK_IGNORE | 388 AR5K_DCU_MISC_ARBLOCK_IGNORE |
402 AR5K_DCU_MISC_POST_FR_BKOFF_DIS | 389 AR5K_DCU_MISC_POST_FR_BKOFF_DIS |
403 AR5K_DCU_MISC_BCN_ENABLE); 390 AR5K_DCU_MISC_BCN_ENABLE);
404 break; 391 break;
405 392
406 case AR5K_TX_QUEUE_CAB: 393 case AR5K_TX_QUEUE_CAB:
407 /* XXX: use BCN_SENT_GT, if we can figure out how */ 394 /* XXX: use BCN_SENT_GT, if we can figure out how */
408 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), 395 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue),
409 AR5K_QCU_MISC_FRSHED_DBA_GT | 396 AR5K_QCU_MISC_FRSHED_DBA_GT |
410 AR5K_QCU_MISC_CBREXP_DIS | 397 AR5K_QCU_MISC_CBREXP_DIS |
411 AR5K_QCU_MISC_CBREXP_BCN_DIS); 398 AR5K_QCU_MISC_CBREXP_BCN_DIS);
412 399
413 ath5k_hw_reg_write(ah, ((tq->tqi_ready_time - 400 ath5k_hw_reg_write(ah, ((tq->tqi_ready_time -
414 (AR5K_TUNE_SW_BEACON_RESP - 401 (AR5K_TUNE_SW_BEACON_RESP -
415 AR5K_TUNE_DMA_BEACON_RESP) - 402 AR5K_TUNE_DMA_BEACON_RESP) -
416 AR5K_TUNE_ADDITIONAL_SWBA_BACKOFF) * 1024) | 403 AR5K_TUNE_ADDITIONAL_SWBA_BACKOFF) * 1024) |
417 AR5K_QCU_RDYTIMECFG_ENABLE, 404 AR5K_QCU_RDYTIMECFG_ENABLE,
418 AR5K_QUEUE_RDYTIMECFG(queue)); 405 AR5K_QUEUE_RDYTIMECFG(queue));
419 406
420 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue), 407 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue),
421 (AR5K_DCU_MISC_ARBLOCK_CTL_GLOBAL << 408 (AR5K_DCU_MISC_ARBLOCK_CTL_GLOBAL <<
422 AR5K_DCU_MISC_ARBLOCK_CTL_S)); 409 AR5K_DCU_MISC_ARBLOCK_CTL_S));
423 break; 410 break;
424 411
425 case AR5K_TX_QUEUE_UAPSD: 412 case AR5K_TX_QUEUE_UAPSD:
426 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue), 413 AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue),
427 AR5K_QCU_MISC_CBREXP_DIS); 414 AR5K_QCU_MISC_CBREXP_DIS);
428 break; 415 break;
429 416
430 case AR5K_TX_QUEUE_DATA: 417 case AR5K_TX_QUEUE_DATA:
431 default: 418 default:
432 break; 419 break;
433 }
434
435 /* TODO: Handle frame compression */
436
437 /*
438 * Enable interrupts for this tx queue
439 * in the secondary interrupt mask registers
440 */
441 if (tq->tqi_flags & AR5K_TXQ_FLAG_TXOKINT_ENABLE)
442 AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txok, queue);
443
444 if (tq->tqi_flags & AR5K_TXQ_FLAG_TXERRINT_ENABLE)
445 AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txerr, queue);
446
447 if (tq->tqi_flags & AR5K_TXQ_FLAG_TXURNINT_ENABLE)
448 AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txurn, queue);
449
450 if (tq->tqi_flags & AR5K_TXQ_FLAG_TXDESCINT_ENABLE)
451 AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txdesc, queue);
452
453 if (tq->tqi_flags & AR5K_TXQ_FLAG_TXEOLINT_ENABLE)
454 AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txeol, queue);
455
456 if (tq->tqi_flags & AR5K_TXQ_FLAG_CBRORNINT_ENABLE)
457 AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_cbrorn, queue);
458
459 if (tq->tqi_flags & AR5K_TXQ_FLAG_CBRURNINT_ENABLE)
460 AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_cbrurn, queue);
461
462 if (tq->tqi_flags & AR5K_TXQ_FLAG_QTRIGINT_ENABLE)
463 AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_qtrig, queue);
464
465 if (tq->tqi_flags & AR5K_TXQ_FLAG_TXNOFRMINT_ENABLE)
466 AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_nofrm, queue);
467
468 /* Update secondary interrupt mask registers */
469
470 /* Filter out inactive queues */
471 ah->ah_txq_imr_txok &= ah->ah_txq_status;
472 ah->ah_txq_imr_txerr &= ah->ah_txq_status;
473 ah->ah_txq_imr_txurn &= ah->ah_txq_status;
474 ah->ah_txq_imr_txdesc &= ah->ah_txq_status;
475 ah->ah_txq_imr_txeol &= ah->ah_txq_status;
476 ah->ah_txq_imr_cbrorn &= ah->ah_txq_status;
477 ah->ah_txq_imr_cbrurn &= ah->ah_txq_status;
478 ah->ah_txq_imr_qtrig &= ah->ah_txq_status;
479 ah->ah_txq_imr_nofrm &= ah->ah_txq_status;
480
481 ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_txok,
482 AR5K_SIMR0_QCU_TXOK) |
483 AR5K_REG_SM(ah->ah_txq_imr_txdesc,
484 AR5K_SIMR0_QCU_TXDESC), AR5K_SIMR0);
485 ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_txerr,
486 AR5K_SIMR1_QCU_TXERR) |
487 AR5K_REG_SM(ah->ah_txq_imr_txeol,
488 AR5K_SIMR1_QCU_TXEOL), AR5K_SIMR1);
489 /* Update simr2 but don't overwrite rest simr2 settings */
490 AR5K_REG_DISABLE_BITS(ah, AR5K_SIMR2, AR5K_SIMR2_QCU_TXURN);
491 AR5K_REG_ENABLE_BITS(ah, AR5K_SIMR2,
492 AR5K_REG_SM(ah->ah_txq_imr_txurn,
493 AR5K_SIMR2_QCU_TXURN));
494 ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_cbrorn,
495 AR5K_SIMR3_QCBRORN) |
496 AR5K_REG_SM(ah->ah_txq_imr_cbrurn,
497 AR5K_SIMR3_QCBRURN), AR5K_SIMR3);
498 ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_qtrig,
499 AR5K_SIMR4_QTRIG), AR5K_SIMR4);
500 /* Set TXNOFRM_QCU for the queues with TXNOFRM enabled */
501 ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_nofrm,
502 AR5K_TXNOFRM_QCU), AR5K_TXNOFRM);
503 /* No queue has TXNOFRM enabled, disable the interrupt
504 * by setting AR5K_TXNOFRM to zero */
505 if (ah->ah_txq_imr_nofrm == 0)
506 ath5k_hw_reg_write(ah, 0, AR5K_TXNOFRM);
507
508 /* Set QCU mask for this DCU to save power */
509 AR5K_REG_WRITE_Q(ah, AR5K_QUEUE_QCUMASK(queue), queue);
510 } 420 }
511 421
422 /* TODO: Handle frame compression */
423
424 /*
425 * Enable interrupts for this tx queue
426 * in the secondary interrupt mask registers
427 */
428 if (tq->tqi_flags & AR5K_TXQ_FLAG_TXOKINT_ENABLE)
429 AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txok, queue);
430
431 if (tq->tqi_flags & AR5K_TXQ_FLAG_TXERRINT_ENABLE)
432 AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txerr, queue);
433
434 if (tq->tqi_flags & AR5K_TXQ_FLAG_TXURNINT_ENABLE)
435 AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txurn, queue);
436
437 if (tq->tqi_flags & AR5K_TXQ_FLAG_TXDESCINT_ENABLE)
438 AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txdesc, queue);
439
440 if (tq->tqi_flags & AR5K_TXQ_FLAG_TXEOLINT_ENABLE)
441 AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_txeol, queue);
442
443 if (tq->tqi_flags & AR5K_TXQ_FLAG_CBRORNINT_ENABLE)
444 AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_cbrorn, queue);
445
446 if (tq->tqi_flags & AR5K_TXQ_FLAG_CBRURNINT_ENABLE)
447 AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_cbrurn, queue);
448
449 if (tq->tqi_flags & AR5K_TXQ_FLAG_QTRIGINT_ENABLE)
450 AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_qtrig, queue);
451
452 if (tq->tqi_flags & AR5K_TXQ_FLAG_TXNOFRMINT_ENABLE)
453 AR5K_Q_ENABLE_BITS(ah->ah_txq_imr_nofrm, queue);
454
455 /* Update secondary interrupt mask registers */
456
457 /* Filter out inactive queues */
458 ah->ah_txq_imr_txok &= ah->ah_txq_status;
459 ah->ah_txq_imr_txerr &= ah->ah_txq_status;
460 ah->ah_txq_imr_txurn &= ah->ah_txq_status;
461 ah->ah_txq_imr_txdesc &= ah->ah_txq_status;
462 ah->ah_txq_imr_txeol &= ah->ah_txq_status;
463 ah->ah_txq_imr_cbrorn &= ah->ah_txq_status;
464 ah->ah_txq_imr_cbrurn &= ah->ah_txq_status;
465 ah->ah_txq_imr_qtrig &= ah->ah_txq_status;
466 ah->ah_txq_imr_nofrm &= ah->ah_txq_status;
467
468 ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_txok,
469 AR5K_SIMR0_QCU_TXOK) |
470 AR5K_REG_SM(ah->ah_txq_imr_txdesc,
471 AR5K_SIMR0_QCU_TXDESC),
472 AR5K_SIMR0);
473
474 ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_txerr,
475 AR5K_SIMR1_QCU_TXERR) |
476 AR5K_REG_SM(ah->ah_txq_imr_txeol,
477 AR5K_SIMR1_QCU_TXEOL),
478 AR5K_SIMR1);
479
480 /* Update SIMR2 but don't overwrite rest simr2 settings */
481 AR5K_REG_DISABLE_BITS(ah, AR5K_SIMR2, AR5K_SIMR2_QCU_TXURN);
482 AR5K_REG_ENABLE_BITS(ah, AR5K_SIMR2,
483 AR5K_REG_SM(ah->ah_txq_imr_txurn,
484 AR5K_SIMR2_QCU_TXURN));
485
486 ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_cbrorn,
487 AR5K_SIMR3_QCBRORN) |
488 AR5K_REG_SM(ah->ah_txq_imr_cbrurn,
489 AR5K_SIMR3_QCBRURN),
490 AR5K_SIMR3);
491
492 ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_qtrig,
493 AR5K_SIMR4_QTRIG), AR5K_SIMR4);
494
495 /* Set TXNOFRM_QCU for the queues with TXNOFRM enabled */
496 ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txq_imr_nofrm,
497 AR5K_TXNOFRM_QCU), AR5K_TXNOFRM);
498
499 /* No queue has TXNOFRM enabled, disable the interrupt
500 * by setting AR5K_TXNOFRM to zero */
501 if (ah->ah_txq_imr_nofrm == 0)
502 ath5k_hw_reg_write(ah, 0, AR5K_TXNOFRM);
503
504 /* Set QCU mask for this DCU to save power */
505 AR5K_REG_WRITE_Q(ah, AR5K_QUEUE_QCUMASK(queue), queue);
506
512 return 0; 507 return 0;
513} 508}
514 509
515/* 510
516 * Set slot time on DCU 511/**************************\
512* Global QCU/DCU functions *
513\**************************/
514
515/**
516 * ath5k_hw_set_ifs_intervals - Set global inter-frame spaces on DCU
517 *
518 * @ah The &struct ath5k_hw
519 * @slot_time Slot time in us
520 *
521 * Sets the global IFS intervals on DCU (also works on AR5210) for
522 * the given slot time and the current bwmode.
517 */ 523 */
518int ath5k_hw_set_slot_time(struct ath5k_hw *ah, unsigned int slot_time) 524int ath5k_hw_set_ifs_intervals(struct ath5k_hw *ah, unsigned int slot_time)
519{ 525{
526 struct ieee80211_channel *channel = ah->ah_current_channel;
527 struct ath5k_softc *sc = ah->ah_sc;
528 struct ieee80211_rate *rate;
529 u32 ack_tx_time, eifs, eifs_clock, sifs, sifs_clock;
520 u32 slot_time_clock = ath5k_hw_htoclock(ah, slot_time); 530 u32 slot_time_clock = ath5k_hw_htoclock(ah, slot_time);
521 531
522 if (slot_time < 6 || slot_time_clock > AR5K_SLOT_TIME_MAX) 532 if (slot_time < 6 || slot_time_clock > AR5K_SLOT_TIME_MAX)
523 return -EINVAL; 533 return -EINVAL;
524 534
525 if (ah->ah_version == AR5K_AR5210) 535 sifs = ath5k_hw_get_default_sifs(ah);
526 ath5k_hw_reg_write(ah, slot_time_clock, AR5K_SLOT_TIME); 536 sifs_clock = ath5k_hw_htoclock(ah, sifs);
537
538 /* EIFS
539 * Txtime of ack at lowest rate + SIFS + DIFS
540 * (DIFS = SIFS + 2 * Slot time)
541 *
542 * Note: HAL has some predefined values for EIFS
543 * Turbo: (37 + 2 * 6)
544 * Default: (74 + 2 * 9)
545 * Half: (149 + 2 * 13)
546 * Quarter: (298 + 2 * 21)
547 *
548 * (74 + 2 * 6) for AR5210 default and turbo !
549 *
550 * According to the formula we have
551 * ack_tx_time = 25 for turbo and
552 * ack_tx_time = 42.5 * clock multiplier
553 * for default/half/quarter.
554 *
555 * This can't be right, 42 is what we would get
556 * from ath5k_hw_get_frame_dur_for_bwmode or
557 * ieee80211_generic_frame_duration for zero frame
558 * length and without SIFS !
559 *
560 * Also we have different lowest rate for 802.11a
561 */
562 if (channel->hw_value & CHANNEL_5GHZ)
563 rate = &sc->sbands[IEEE80211_BAND_5GHZ].bitrates[0];
527 else 564 else
528 ath5k_hw_reg_write(ah, slot_time_clock, AR5K_DCU_GBL_IFS_SLOT); 565 rate = &sc->sbands[IEEE80211_BAND_2GHZ].bitrates[0];
566
567 ack_tx_time = ath5k_hw_get_frame_duration(ah, 10, rate);
568
569 /* ack_tx_time includes an SIFS already */
570 eifs = ack_tx_time + sifs + 2 * slot_time;
571 eifs_clock = ath5k_hw_htoclock(ah, eifs);
572
573 /* Set IFS settings on AR5210 */
574 if (ah->ah_version == AR5K_AR5210) {
575 u32 pifs, pifs_clock, difs, difs_clock;
576
577 /* Set slot time */
578 ath5k_hw_reg_write(ah, slot_time_clock, AR5K_SLOT_TIME);
579
580 /* Set EIFS */
581 eifs_clock = AR5K_REG_SM(eifs_clock, AR5K_IFS1_EIFS);
582
583 /* PIFS = Slot time + SIFS */
584 pifs = slot_time + sifs;
585 pifs_clock = ath5k_hw_htoclock(ah, pifs);
586 pifs_clock = AR5K_REG_SM(pifs_clock, AR5K_IFS1_PIFS);
587
588 /* DIFS = SIFS + 2 * Slot time */
589 difs = sifs + 2 * slot_time;
590 difs_clock = ath5k_hw_htoclock(ah, difs);
591
592 /* Set SIFS/DIFS */
593 ath5k_hw_reg_write(ah, (difs_clock <<
594 AR5K_IFS0_DIFS_S) | sifs_clock,
595 AR5K_IFS0);
596
597 /* Set PIFS/EIFS and preserve AR5K_INIT_CARR_SENSE_EN */
598 ath5k_hw_reg_write(ah, pifs_clock | eifs_clock |
599 (AR5K_INIT_CARR_SENSE_EN << AR5K_IFS1_CS_EN_S),
600 AR5K_IFS1);
601
602 return 0;
603 }
604
605 /* Set IFS slot time */
606 ath5k_hw_reg_write(ah, slot_time_clock, AR5K_DCU_GBL_IFS_SLOT);
607
608 /* Set EIFS interval */
609 ath5k_hw_reg_write(ah, eifs_clock, AR5K_DCU_GBL_IFS_EIFS);
610
611 /* Set SIFS interval in usecs */
612 AR5K_REG_WRITE_BITS(ah, AR5K_DCU_GBL_IFS_MISC,
613 AR5K_DCU_GBL_IFS_MISC_SIFS_DUR_USEC,
614 sifs);
615
616 /* Set SIFS interval in clock cycles */
617 ath5k_hw_reg_write(ah, sifs_clock, AR5K_DCU_GBL_IFS_SIFS);
529 618
530 return 0; 619 return 0;
531} 620}
532 621
622
623int ath5k_hw_init_queues(struct ath5k_hw *ah)
624{
625 int i, ret;
626
627 /* TODO: HW Compression support for data queues */
628 /* TODO: Burst prefetch for data queues */
629
630 /*
631 * Reset queues and start beacon timers at the end of the reset routine
632 * This also sets QCU mask on each DCU for 1:1 qcu to dcu mapping
633 * Note: If we want we can assign multiple qcus on one dcu.
634 */
635 if (ah->ah_version != AR5K_AR5210)
636 for (i = 0; i < ah->ah_capabilities.cap_queues.q_tx_num; i++) {
637 ret = ath5k_hw_reset_tx_queue(ah, i);
638 if (ret) {
639 ATH5K_ERR(ah->ah_sc,
640 "failed to reset TX queue #%d\n", i);
641 return ret;
642 }
643 }
644 else
645 /* No QCU/DCU on AR5210, just set tx
646 * retry limits. We set IFS parameters
647 * on ath5k_hw_set_ifs_intervals */
648 ath5k_hw_set_tx_retry_limits(ah, 0);
649
650 /* Set the turbo flag when operating on 40MHz */
651 if (ah->ah_bwmode == AR5K_BWMODE_40MHZ)
652 AR5K_REG_ENABLE_BITS(ah, AR5K_DCU_GBL_IFS_MISC,
653 AR5K_DCU_GBL_IFS_MISC_TURBO_MODE);
654
655 /* If we didn't set IFS timings through
656 * ath5k_hw_set_coverage_class make sure
657 * we set them here */
658 if (!ah->ah_coverage_class) {
659 unsigned int slot_time = ath5k_hw_get_default_slottime(ah);
660 ath5k_hw_set_ifs_intervals(ah, slot_time);
661 }
662
663 return 0;
664}
diff --git a/drivers/net/wireless/ath/ath5k/reg.h b/drivers/net/wireless/ath/ath5k/reg.h
index ca79ecd832fd..7ad05d401ab5 100644
--- a/drivers/net/wireless/ath/ath5k/reg.h
+++ b/drivers/net/wireless/ath/ath5k/reg.h
@@ -787,6 +787,7 @@
787#define AR5K_DCU_GBL_IFS_MISC_LFSR_SLICE 0x00000007 /* LFSR Slice Select */ 787#define AR5K_DCU_GBL_IFS_MISC_LFSR_SLICE 0x00000007 /* LFSR Slice Select */
788#define AR5K_DCU_GBL_IFS_MISC_TURBO_MODE 0x00000008 /* Turbo mode */ 788#define AR5K_DCU_GBL_IFS_MISC_TURBO_MODE 0x00000008 /* Turbo mode */
789#define AR5K_DCU_GBL_IFS_MISC_SIFS_DUR_USEC 0x000003f0 /* SIFS Duration mask */ 789#define AR5K_DCU_GBL_IFS_MISC_SIFS_DUR_USEC 0x000003f0 /* SIFS Duration mask */
790#define AR5K_DCU_GBL_IFS_MISC_SIFS_DUR_USEC_S 4
790#define AR5K_DCU_GBL_IFS_MISC_USEC_DUR 0x000ffc00 /* USEC Duration mask */ 791#define AR5K_DCU_GBL_IFS_MISC_USEC_DUR 0x000ffc00 /* USEC Duration mask */
791#define AR5K_DCU_GBL_IFS_MISC_USEC_DUR_S 10 792#define AR5K_DCU_GBL_IFS_MISC_USEC_DUR_S 10
792#define AR5K_DCU_GBL_IFS_MISC_DCU_ARB_DELAY 0x00300000 /* DCU Arbiter delay mask */ 793#define AR5K_DCU_GBL_IFS_MISC_DCU_ARB_DELAY 0x00300000 /* DCU Arbiter delay mask */
@@ -1311,7 +1312,7 @@
1311#define AR5K_IFS1_EIFS 0x03fff000 1312#define AR5K_IFS1_EIFS 0x03fff000
1312#define AR5K_IFS1_EIFS_S 12 1313#define AR5K_IFS1_EIFS_S 12
1313#define AR5K_IFS1_CS_EN 0x04000000 1314#define AR5K_IFS1_CS_EN 0x04000000
1314 1315#define AR5K_IFS1_CS_EN_S 26
1315 1316
1316/* 1317/*
1317 * CFP duration register 1318 * CFP duration register
@@ -2058,6 +2059,7 @@
2058 2059
2059#define AR5K_PHY_SCAL 0x9878 2060#define AR5K_PHY_SCAL 0x9878
2060#define AR5K_PHY_SCAL_32MHZ 0x0000000e 2061#define AR5K_PHY_SCAL_32MHZ 0x0000000e
2062#define AR5K_PHY_SCAL_32MHZ_5311 0x00000008
2061#define AR5K_PHY_SCAL_32MHZ_2417 0x0000000a 2063#define AR5K_PHY_SCAL_32MHZ_2417 0x0000000a
2062#define AR5K_PHY_SCAL_32MHZ_HB63 0x00000032 2064#define AR5K_PHY_SCAL_32MHZ_HB63 0x00000032
2063 2065
@@ -2244,6 +2246,8 @@
2244#define AR5K_PHY_FRAME_CTL (ah->ah_version == AR5K_AR5210 ? \ 2246#define AR5K_PHY_FRAME_CTL (ah->ah_version == AR5K_AR5210 ? \
2245 AR5K_PHY_FRAME_CTL_5210 : AR5K_PHY_FRAME_CTL_5211) 2247 AR5K_PHY_FRAME_CTL_5210 : AR5K_PHY_FRAME_CTL_5211)
2246/*---[5111+]---*/ 2248/*---[5111+]---*/
2249#define AR5K_PHY_FRAME_CTL_WIN_LEN 0x00000003 /* Force window length (?) */
2250#define AR5K_PHY_FRAME_CTL_WIN_LEN_S 0
2247#define AR5K_PHY_FRAME_CTL_TX_CLIP 0x00000038 /* Mask for tx clip (?) */ 2251#define AR5K_PHY_FRAME_CTL_TX_CLIP 0x00000038 /* Mask for tx clip (?) */
2248#define AR5K_PHY_FRAME_CTL_TX_CLIP_S 3 2252#define AR5K_PHY_FRAME_CTL_TX_CLIP_S 3
2249#define AR5K_PHY_FRAME_CTL_PREP_CHINFO 0x00010000 /* Prepend chan info */ 2253#define AR5K_PHY_FRAME_CTL_PREP_CHINFO 0x00010000 /* Prepend chan info */
@@ -2558,3 +2562,28 @@
2558 */ 2562 */
2559#define AR5K_PHY_PDADC_TXPOWER_BASE 0xa280 2563#define AR5K_PHY_PDADC_TXPOWER_BASE 0xa280
2560#define AR5K_PHY_PDADC_TXPOWER(_n) (AR5K_PHY_PDADC_TXPOWER_BASE + ((_n) << 2)) 2564#define AR5K_PHY_PDADC_TXPOWER(_n) (AR5K_PHY_PDADC_TXPOWER_BASE + ((_n) << 2))
2565
2566/*
2567 * Platform registers for WiSoC
2568 */
2569#define AR5K_AR5312_RESET 0xbc003020
2570#define AR5K_AR5312_RESET_BB0_COLD 0x00000004
2571#define AR5K_AR5312_RESET_BB1_COLD 0x00000200
2572#define AR5K_AR5312_RESET_WMAC0 0x00002000
2573#define AR5K_AR5312_RESET_BB0_WARM 0x00004000
2574#define AR5K_AR5312_RESET_WMAC1 0x00020000
2575#define AR5K_AR5312_RESET_BB1_WARM 0x00040000
2576
2577#define AR5K_AR5312_ENABLE 0xbc003080
2578#define AR5K_AR5312_ENABLE_WLAN0 0x00000001
2579#define AR5K_AR5312_ENABLE_WLAN1 0x00000008
2580
2581#define AR5K_AR2315_RESET 0xb1000004
2582#define AR5K_AR2315_RESET_WMAC 0x00000001
2583#define AR5K_AR2315_RESET_BB_WARM 0x00000002
2584
2585#define AR5K_AR2315_AHB_ARB_CTL 0xb1000008
2586#define AR5K_AR2315_AHB_ARB_CTL_WLAN 0x00000002
2587
2588#define AR5K_AR2315_BYTESWAP 0xb100000c
2589#define AR5K_AR2315_BYTESWAP_WMAC 0x00000002
diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c
index 5b179d01f97d..bc84aaa31446 100644
--- a/drivers/net/wireless/ath/ath5k/reset.c
+++ b/drivers/net/wireless/ath/ath5k/reset.c
@@ -27,11 +27,17 @@
27 27
28#include <linux/pci.h> /* To determine if a card is pci-e */ 28#include <linux/pci.h> /* To determine if a card is pci-e */
29#include <linux/log2.h> 29#include <linux/log2.h>
30#include <linux/platform_device.h>
30#include "ath5k.h" 31#include "ath5k.h"
31#include "reg.h" 32#include "reg.h"
32#include "base.h" 33#include "base.h"
33#include "debug.h" 34#include "debug.h"
34 35
36
37/******************\
38* Helper functions *
39\******************/
40
35/* 41/*
36 * Check if a register write has been completed 42 * Check if a register write has been completed
37 */ 43 */
@@ -53,146 +59,267 @@ int ath5k_hw_register_timeout(struct ath5k_hw *ah, u32 reg, u32 flag, u32 val,
53 return (i <= 0) ? -EAGAIN : 0; 59 return (i <= 0) ? -EAGAIN : 0;
54} 60}
55 61
62
63/*************************\
64* Clock related functions *
65\*************************/
66
56/** 67/**
57 * ath5k_hw_write_ofdm_timings - set OFDM timings on AR5212 68 * ath5k_hw_htoclock - Translate usec to hw clock units
58 * 69 *
59 * @ah: the &struct ath5k_hw 70 * @ah: The &struct ath5k_hw
60 * @channel: the currently set channel upon reset 71 * @usec: value in microseconds
61 * 72 */
62 * Write the delta slope coefficient (used on pilot tracking ?) for OFDM 73unsigned int ath5k_hw_htoclock(struct ath5k_hw *ah, unsigned int usec)
63 * operation on the AR5212 upon reset. This is a helper for ath5k_hw_reset(). 74{
75 struct ath_common *common = ath5k_hw_common(ah);
76 return usec * common->clockrate;
77}
78
79/**
80 * ath5k_hw_clocktoh - Translate hw clock units to usec
81 * @clock: value in hw clock units
82 */
83unsigned int ath5k_hw_clocktoh(struct ath5k_hw *ah, unsigned int clock)
84{
85 struct ath_common *common = ath5k_hw_common(ah);
86 return clock / common->clockrate;
87}
88
89/**
90 * ath5k_hw_init_core_clock - Initialize core clock
64 * 91 *
65 * Since delta slope is floating point we split it on its exponent and 92 * @ah The &struct ath5k_hw
66 * mantissa and provide these values on hw.
67 * 93 *
68 * For more infos i think this patent is related 94 * Initialize core clock parameters (usec, usec32, latencies etc).
69 * http://www.freepatentsonline.com/7184495.html
70 */ 95 */
71static inline int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah, 96static void ath5k_hw_init_core_clock(struct ath5k_hw *ah)
72 struct ieee80211_channel *channel)
73{ 97{
74 /* Get exponent and mantissa and set it */ 98 struct ieee80211_channel *channel = ah->ah_current_channel;
75 u32 coef_scaled, coef_exp, coef_man, 99 struct ath_common *common = ath5k_hw_common(ah);
76 ds_coef_exp, ds_coef_man, clock; 100 u32 usec_reg, txlat, rxlat, usec, clock, sclock, txf2txs;
77 101
78 BUG_ON(!(ah->ah_version == AR5K_AR5212) || 102 /*
79 !(channel->hw_value & CHANNEL_OFDM)); 103 * Set core clock frequency
80 104 */
81 /* Get coefficient 105 if (channel->hw_value & CHANNEL_5GHZ)
82 * ALGO: coef = (5 * clock / carrier_freq) / 2 106 clock = 40; /* 802.11a */
83 * we scale coef by shifting clock value by 24 for 107 else if (channel->hw_value & CHANNEL_CCK)
84 * better precision since we use integers */ 108 clock = 22; /* 802.11b */
85 /* TODO: Half/quarter rate */ 109 else
86 clock = (channel->hw_value & CHANNEL_TURBO) ? 80 : 40; 110 clock = 44; /* 802.11g */
87 coef_scaled = ((5 * (clock << 24)) / 2) / channel->center_freq; 111
88 112 /* Use clock multiplier for non-default
89 /* Get exponent 113 * bwmode */
90 * ALGO: coef_exp = 14 - highest set bit position */ 114 switch (ah->ah_bwmode) {
91 coef_exp = ilog2(coef_scaled); 115 case AR5K_BWMODE_40MHZ:
92 116 clock *= 2;
93 /* Doesn't make sense if it's zero*/ 117 break;
94 if (!coef_scaled || !coef_exp) 118 case AR5K_BWMODE_10MHZ:
95 return -EINVAL; 119 clock /= 2;
120 break;
121 case AR5K_BWMODE_5MHZ:
122 clock /= 4;
123 break;
124 default:
125 break;
126 }
96 127
97 /* Note: we've shifted coef_scaled by 24 */ 128 common->clockrate = clock;
98 coef_exp = 14 - (coef_exp - 24);
99 129
130 /*
131 * Set USEC parameters
132 */
133 /* Set USEC counter on PCU*/
134 usec = clock - 1;
135 usec = AR5K_REG_SM(usec, AR5K_USEC_1);
100 136
101 /* Get mantissa (significant digits) 137 /* Set usec duration on DCU */
102 * ALGO: coef_mant = floor(coef_scaled* 2^coef_exp+0.5) */ 138 if (ah->ah_version != AR5K_AR5210)
103 coef_man = coef_scaled + 139 AR5K_REG_WRITE_BITS(ah, AR5K_DCU_GBL_IFS_MISC,
104 (1 << (24 - coef_exp - 1)); 140 AR5K_DCU_GBL_IFS_MISC_USEC_DUR,
141 clock);
105 142
106 /* Calculate delta slope coefficient exponent 143 /* Set 32MHz USEC counter */
107 * and mantissa (remove scaling) and set them on hw */ 144 if ((ah->ah_radio == AR5K_RF5112) ||
108 ds_coef_man = coef_man >> (24 - coef_exp); 145 (ah->ah_radio == AR5K_RF5413) ||
109 ds_coef_exp = coef_exp - 16; 146 (ah->ah_radio == AR5K_RF2316) ||
147 (ah->ah_radio == AR5K_RF2317))
148 /* Remain on 40MHz clock ? */
149 sclock = 40 - 1;
150 else
151 sclock = 32 - 1;
152 sclock = AR5K_REG_SM(sclock, AR5K_USEC_32);
110 153
111 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_TIMING_3, 154 /*
112 AR5K_PHY_TIMING_3_DSC_MAN, ds_coef_man); 155 * Set tx/rx latencies
113 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_TIMING_3, 156 */
114 AR5K_PHY_TIMING_3_DSC_EXP, ds_coef_exp); 157 usec_reg = ath5k_hw_reg_read(ah, AR5K_USEC_5211);
158 txlat = AR5K_REG_MS(usec_reg, AR5K_USEC_TX_LATENCY_5211);
159 rxlat = AR5K_REG_MS(usec_reg, AR5K_USEC_RX_LATENCY_5211);
115 160
116 return 0; 161 /*
117} 162 * 5210 initvals don't include usec settings
163 * so we need to use magic values here for
164 * tx/rx latencies
165 */
166 if (ah->ah_version == AR5K_AR5210) {
167 /* same for turbo */
168 txlat = AR5K_INIT_TX_LATENCY_5210;
169 rxlat = AR5K_INIT_RX_LATENCY_5210;
170 }
118 171
172 if (ah->ah_mac_srev < AR5K_SREV_AR5211) {
173 /* 5311 has different tx/rx latency masks
174 * from 5211, since we deal 5311 the same
175 * as 5211 when setting initvals, shift
176 * values here to their proper locations
177 *
178 * Note: Initvals indicate tx/rx/ latencies
179 * are the same for turbo mode */
180 txlat = AR5K_REG_SM(txlat, AR5K_USEC_TX_LATENCY_5210);
181 rxlat = AR5K_REG_SM(rxlat, AR5K_USEC_RX_LATENCY_5210);
182 } else
183 switch (ah->ah_bwmode) {
184 case AR5K_BWMODE_10MHZ:
185 txlat = AR5K_REG_SM(txlat * 2,
186 AR5K_USEC_TX_LATENCY_5211);
187 rxlat = AR5K_REG_SM(AR5K_INIT_RX_LAT_MAX,
188 AR5K_USEC_RX_LATENCY_5211);
189 txf2txs = AR5K_INIT_TXF2TXD_START_DELAY_10MHZ;
190 break;
191 case AR5K_BWMODE_5MHZ:
192 txlat = AR5K_REG_SM(txlat * 4,
193 AR5K_USEC_TX_LATENCY_5211);
194 rxlat = AR5K_REG_SM(AR5K_INIT_RX_LAT_MAX,
195 AR5K_USEC_RX_LATENCY_5211);
196 txf2txs = AR5K_INIT_TXF2TXD_START_DELAY_5MHZ;
197 break;
198 case AR5K_BWMODE_40MHZ:
199 txlat = AR5K_INIT_TX_LAT_MIN;
200 rxlat = AR5K_REG_SM(rxlat / 2,
201 AR5K_USEC_RX_LATENCY_5211);
202 txf2txs = AR5K_INIT_TXF2TXD_START_DEFAULT;
203 break;
204 default:
205 break;
206 }
119 207
120/* 208 usec_reg = (usec | sclock | txlat | rxlat);
121 * index into rates for control rates, we can set it up like this because 209 ath5k_hw_reg_write(ah, usec_reg, AR5K_USEC);
122 * this is only used for AR5212 and we know it supports G mode
123 */
124static const unsigned int control_rates[] =
125 { 0, 1, 1, 1, 4, 4, 6, 6, 8, 8, 8, 8 };
126 210
127/** 211 /* On 5112 set tx frane to tx data start delay */
128 * ath5k_hw_write_rate_duration - fill rate code to duration table 212 if (ah->ah_radio == AR5K_RF5112) {
129 * 213 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_RF_CTL2,
130 * @ah: the &struct ath5k_hw 214 AR5K_PHY_RF_CTL2_TXF2TXD_START,
131 * @mode: one of enum ath5k_driver_mode 215 txf2txs);
132 * 216 }
133 * Write the rate code to duration table upon hw reset. This is a helper for 217}
134 * ath5k_hw_reset(). It seems all this is doing is setting an ACK timeout on 218
135 * the hardware, based on current mode, for each rate. The rates which are 219/*
136 * capable of short preamble (802.11b rates 2Mbps, 5.5Mbps, and 11Mbps) have 220 * If there is an external 32KHz crystal available, use it
137 * different rate code so we write their value twice (one for long preample 221 * as ref. clock instead of 32/40MHz clock and baseband clocks
138 * and one for short). 222 * to save power during sleep or restore normal 32/40MHz
223 * operation.
139 * 224 *
140 * Note: Band doesn't matter here, if we set the values for OFDM it works 225 * XXX: When operating on 32KHz certain PHY registers (27 - 31,
141 * on both a and g modes. So all we have to do is set values for all g rates 226 * 123 - 127) require delay on access.
142 * that include all OFDM and CCK rates. If we operate in turbo or xr/half/
143 * quarter rate mode, we need to use another set of bitrates (that's why we
144 * need the mode parameter) but we don't handle these proprietary modes yet.
145 */ 227 */
146static inline void ath5k_hw_write_rate_duration(struct ath5k_hw *ah, 228static void ath5k_hw_set_sleep_clock(struct ath5k_hw *ah, bool enable)
147 unsigned int mode)
148{ 229{
149 struct ath5k_softc *sc = ah->ah_sc; 230 struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
150 struct ieee80211_rate *rate; 231 u32 scal, spending;
151 unsigned int i;
152 232
153 /* Write rate duration table */ 233 /* Only set 32KHz settings if we have an external
154 for (i = 0; i < sc->sbands[IEEE80211_BAND_2GHZ].n_bitrates; i++) { 234 * 32KHz crystal present */
155 u32 reg; 235 if ((AR5K_EEPROM_HAS32KHZCRYSTAL(ee->ee_misc1) ||
156 u16 tx_time; 236 AR5K_EEPROM_HAS32KHZCRYSTAL_OLD(ee->ee_misc1)) &&
237 enable) {
157 238
158 rate = &sc->sbands[IEEE80211_BAND_2GHZ].bitrates[control_rates[i]]; 239 /* 1 usec/cycle */
240 AR5K_REG_WRITE_BITS(ah, AR5K_USEC_5211, AR5K_USEC_32, 1);
241 /* Set up tsf increment on each cycle */
242 AR5K_REG_WRITE_BITS(ah, AR5K_TSF_PARM, AR5K_TSF_PARM_INC, 61);
159 243
160 /* Set ACK timeout */ 244 /* Set baseband sleep control registers
161 reg = AR5K_RATE_DUR(rate->hw_value); 245 * and sleep control rate */
246 ath5k_hw_reg_write(ah, 0x1f, AR5K_PHY_SCR);
162 247
163 /* An ACK frame consists of 10 bytes. If you add the FCS, 248 if ((ah->ah_radio == AR5K_RF5112) ||
164 * which ieee80211_generic_frame_duration() adds, 249 (ah->ah_radio == AR5K_RF5413) ||
165 * its 14 bytes. Note we use the control rate and not the 250 (ah->ah_radio == AR5K_RF2316) ||
166 * actual rate for this rate. See mac80211 tx.c 251 (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4)))
167 * ieee80211_duration() for a brief description of 252 spending = 0x14;
168 * what rate we should choose to TX ACKs. */ 253 else
169 tx_time = le16_to_cpu(ieee80211_generic_frame_duration(sc->hw, 254 spending = 0x18;
170 NULL, 10, rate)); 255 ath5k_hw_reg_write(ah, spending, AR5K_PHY_SPENDING);
171 256
172 ath5k_hw_reg_write(ah, tx_time, reg); 257 if ((ah->ah_radio == AR5K_RF5112) ||
258 (ah->ah_radio == AR5K_RF5413) ||
259 (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) {
260 ath5k_hw_reg_write(ah, 0x26, AR5K_PHY_SLMT);
261 ath5k_hw_reg_write(ah, 0x0d, AR5K_PHY_SCAL);
262 ath5k_hw_reg_write(ah, 0x07, AR5K_PHY_SCLOCK);
263 ath5k_hw_reg_write(ah, 0x3f, AR5K_PHY_SDELAY);
264 AR5K_REG_WRITE_BITS(ah, AR5K_PCICFG,
265 AR5K_PCICFG_SLEEP_CLOCK_RATE, 0x02);
266 } else {
267 ath5k_hw_reg_write(ah, 0x0a, AR5K_PHY_SLMT);
268 ath5k_hw_reg_write(ah, 0x0c, AR5K_PHY_SCAL);
269 ath5k_hw_reg_write(ah, 0x03, AR5K_PHY_SCLOCK);
270 ath5k_hw_reg_write(ah, 0x20, AR5K_PHY_SDELAY);
271 AR5K_REG_WRITE_BITS(ah, AR5K_PCICFG,
272 AR5K_PCICFG_SLEEP_CLOCK_RATE, 0x03);
273 }
173 274
174 if (!(rate->flags & IEEE80211_RATE_SHORT_PREAMBLE)) 275 /* Enable sleep clock operation */
175 continue; 276 AR5K_REG_ENABLE_BITS(ah, AR5K_PCICFG,
277 AR5K_PCICFG_SLEEP_CLOCK_EN);
176 278
177 /* 279 } else {
178 * We're not distinguishing short preamble here, 280
179 * This is true, all we'll get is a longer value here 281 /* Disable sleep clock operation and
180 * which is not necessarilly bad. We could use 282 * restore default parameters */
181 * export ieee80211_frame_duration() but that needs to be 283 AR5K_REG_DISABLE_BITS(ah, AR5K_PCICFG,
182 * fixed first to be properly used by mac802111 drivers: 284 AR5K_PCICFG_SLEEP_CLOCK_EN);
183 * 285
184 * - remove erp stuff and let the routine figure ofdm 286 AR5K_REG_WRITE_BITS(ah, AR5K_PCICFG,
185 * erp rates 287 AR5K_PCICFG_SLEEP_CLOCK_RATE, 0);
186 * - remove passing argument ieee80211_local as 288
187 * drivers don't have access to it 289 /* Set DAC/ADC delays */
188 * - move drivers using ieee80211_generic_frame_duration() 290 ath5k_hw_reg_write(ah, 0x1f, AR5K_PHY_SCR);
189 * to this 291 ath5k_hw_reg_write(ah, AR5K_PHY_SLMT_32MHZ, AR5K_PHY_SLMT);
190 */ 292
191 ath5k_hw_reg_write(ah, tx_time, 293 if (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))
192 reg + (AR5K_SET_SHORT_PREAMBLE << 2)); 294 scal = AR5K_PHY_SCAL_32MHZ_2417;
295 else if (ee->ee_is_hb63)
296 scal = AR5K_PHY_SCAL_32MHZ_HB63;
297 else
298 scal = AR5K_PHY_SCAL_32MHZ;
299 ath5k_hw_reg_write(ah, scal, AR5K_PHY_SCAL);
300
301 ath5k_hw_reg_write(ah, AR5K_PHY_SCLOCK_32MHZ, AR5K_PHY_SCLOCK);
302 ath5k_hw_reg_write(ah, AR5K_PHY_SDELAY_32MHZ, AR5K_PHY_SDELAY);
303
304 if ((ah->ah_radio == AR5K_RF5112) ||
305 (ah->ah_radio == AR5K_RF5413) ||
306 (ah->ah_radio == AR5K_RF2316) ||
307 (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4)))
308 spending = 0x14;
309 else
310 spending = 0x18;
311 ath5k_hw_reg_write(ah, spending, AR5K_PHY_SPENDING);
312
313 /* Set up tsf increment on each cycle */
314 AR5K_REG_WRITE_BITS(ah, AR5K_TSF_PARM, AR5K_TSF_PARM_INC, 1);
193 } 315 }
194} 316}
195 317
318
319/*********************\
320* Reset/Sleep control *
321\*********************/
322
196/* 323/*
197 * Reset chipset 324 * Reset chipset
198 */ 325 */
@@ -236,6 +363,64 @@ static int ath5k_hw_nic_reset(struct ath5k_hw *ah, u32 val)
236} 363}
237 364
238/* 365/*
366 * Reset AHB chipset
367 * AR5K_RESET_CTL_PCU flag resets WMAC
368 * AR5K_RESET_CTL_BASEBAND flag resets WBB
369 */
370static int ath5k_hw_wisoc_reset(struct ath5k_hw *ah, u32 flags)
371{
372 u32 mask = flags ? flags : ~0U;
373 volatile u32 *reg;
374 u32 regval;
375 u32 val = 0;
376
377 /* ah->ah_mac_srev is not available at this point yet */
378 if (ah->ah_sc->devid >= AR5K_SREV_AR2315_R6) {
379 reg = (u32 *) AR5K_AR2315_RESET;
380 if (mask & AR5K_RESET_CTL_PCU)
381 val |= AR5K_AR2315_RESET_WMAC;
382 if (mask & AR5K_RESET_CTL_BASEBAND)
383 val |= AR5K_AR2315_RESET_BB_WARM;
384 } else {
385 reg = (u32 *) AR5K_AR5312_RESET;
386 if (to_platform_device(ah->ah_sc->dev)->id == 0) {
387 if (mask & AR5K_RESET_CTL_PCU)
388 val |= AR5K_AR5312_RESET_WMAC0;
389 if (mask & AR5K_RESET_CTL_BASEBAND)
390 val |= AR5K_AR5312_RESET_BB0_COLD |
391 AR5K_AR5312_RESET_BB0_WARM;
392 } else {
393 if (mask & AR5K_RESET_CTL_PCU)
394 val |= AR5K_AR5312_RESET_WMAC1;
395 if (mask & AR5K_RESET_CTL_BASEBAND)
396 val |= AR5K_AR5312_RESET_BB1_COLD |
397 AR5K_AR5312_RESET_BB1_WARM;
398 }
399 }
400
401 /* Put BB/MAC into reset */
402 regval = __raw_readl(reg);
403 __raw_writel(regval | val, reg);
404 regval = __raw_readl(reg);
405 udelay(100);
406
407 /* Bring BB/MAC out of reset */
408 __raw_writel(regval & ~val, reg);
409 regval = __raw_readl(reg);
410
411 /*
412 * Reset configuration register (for hw byte-swap). Note that this
413 * is only set for big endian. We do the necessary magic in
414 * AR5K_INIT_CFG.
415 */
416 if ((flags & AR5K_RESET_CTL_PCU) == 0)
417 ath5k_hw_reg_write(ah, AR5K_INIT_CFG, AR5K_CFG);
418
419 return 0;
420}
421
422
423/*
239 * Sleep control 424 * Sleep control
240 */ 425 */
241static int ath5k_hw_set_power(struct ath5k_hw *ah, enum ath5k_power_mode mode, 426static int ath5k_hw_set_power(struct ath5k_hw *ah, enum ath5k_power_mode mode,
@@ -334,6 +519,9 @@ int ath5k_hw_on_hold(struct ath5k_hw *ah)
334 u32 bus_flags; 519 u32 bus_flags;
335 int ret; 520 int ret;
336 521
522 if (ath5k_get_bus_type(ah) == ATH_AHB)
523 return 0;
524
337 /* Make sure device is awake */ 525 /* Make sure device is awake */
338 ret = ath5k_hw_set_power(ah, AR5K_PM_AWAKE, true, 0); 526 ret = ath5k_hw_set_power(ah, AR5K_PM_AWAKE, true, 0);
339 if (ret) { 527 if (ret) {
@@ -349,7 +537,7 @@ int ath5k_hw_on_hold(struct ath5k_hw *ah)
349 * we ingore that flag for PCI-E cards. On PCI cards 537 * we ingore that flag for PCI-E cards. On PCI cards
350 * this flag gets cleared after 64 PCI clocks. 538 * this flag gets cleared after 64 PCI clocks.
351 */ 539 */
352 bus_flags = (pdev->is_pcie) ? 0 : AR5K_RESET_CTL_PCI; 540 bus_flags = (pdev && pdev->is_pcie) ? 0 : AR5K_RESET_CTL_PCI;
353 541
354 if (ah->ah_version == AR5K_AR5210) { 542 if (ah->ah_version == AR5K_AR5210) {
355 ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | 543 ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU |
@@ -378,7 +566,6 @@ int ath5k_hw_on_hold(struct ath5k_hw *ah)
378 566
379/* 567/*
380 * Bring up MAC + PHY Chips and program PLL 568 * Bring up MAC + PHY Chips and program PLL
381 * TODO: Half/Quarter rate support
382 */ 569 */
383int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) 570int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
384{ 571{
@@ -390,11 +577,13 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
390 mode = 0; 577 mode = 0;
391 clock = 0; 578 clock = 0;
392 579
393 /* Wakeup the device */ 580 if ((ath5k_get_bus_type(ah) != ATH_AHB) || !initial) {
394 ret = ath5k_hw_set_power(ah, AR5K_PM_AWAKE, true, 0); 581 /* Wakeup the device */
395 if (ret) { 582 ret = ath5k_hw_set_power(ah, AR5K_PM_AWAKE, true, 0);
396 ATH5K_ERR(ah->ah_sc, "failed to wakeup the MAC Chip\n"); 583 if (ret) {
397 return ret; 584 ATH5K_ERR(ah->ah_sc, "failed to wakeup the MAC Chip\n");
585 return ret;
586 }
398 } 587 }
399 588
400 /* 589 /*
@@ -405,7 +594,7 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
405 * we ingore that flag for PCI-E cards. On PCI cards 594 * we ingore that flag for PCI-E cards. On PCI cards
406 * this flag gets cleared after 64 PCI clocks. 595 * this flag gets cleared after 64 PCI clocks.
407 */ 596 */
408 bus_flags = (pdev->is_pcie) ? 0 : AR5K_RESET_CTL_PCI; 597 bus_flags = (pdev && pdev->is_pcie) ? 0 : AR5K_RESET_CTL_PCI;
409 598
410 if (ah->ah_version == AR5K_AR5210) { 599 if (ah->ah_version == AR5K_AR5210) {
411 ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | 600 ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU |
@@ -413,8 +602,12 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
413 AR5K_RESET_CTL_PHY | AR5K_RESET_CTL_PCI); 602 AR5K_RESET_CTL_PHY | AR5K_RESET_CTL_PCI);
414 mdelay(2); 603 mdelay(2);
415 } else { 604 } else {
416 ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU | 605 if (ath5k_get_bus_type(ah) == ATH_AHB)
417 AR5K_RESET_CTL_BASEBAND | bus_flags); 606 ret = ath5k_hw_wisoc_reset(ah, AR5K_RESET_CTL_PCU |
607 AR5K_RESET_CTL_BASEBAND);
608 else
609 ret = ath5k_hw_nic_reset(ah, AR5K_RESET_CTL_PCU |
610 AR5K_RESET_CTL_BASEBAND | bus_flags);
418 } 611 }
419 612
420 if (ret) { 613 if (ret) {
@@ -429,9 +622,15 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
429 return ret; 622 return ret;
430 } 623 }
431 624
432 /* ...clear reset control register and pull device out of 625 /* ...reset configuration regiter on Wisoc ...
433 * warm reset */ 626 * ...clear reset control register and pull device out of
434 if (ath5k_hw_nic_reset(ah, 0)) { 627 * warm reset on others */
628 if (ath5k_get_bus_type(ah) == ATH_AHB)
629 ret = ath5k_hw_wisoc_reset(ah, 0);
630 else
631 ret = ath5k_hw_nic_reset(ah, 0);
632
633 if (ret) {
435 ATH5K_ERR(ah->ah_sc, "failed to warm reset the MAC Chip\n"); 634 ATH5K_ERR(ah->ah_sc, "failed to warm reset the MAC Chip\n");
436 return -EIO; 635 return -EIO;
437 } 636 }
@@ -466,7 +665,8 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
466 * CCK headers) operation. We need to test 665 * CCK headers) operation. We need to test
467 * this, 5211 might support ofdm-only g after 666 * this, 5211 might support ofdm-only g after
468 * all, there are also initial register values 667 * all, there are also initial register values
469 * in the code for g mode (see initvals.c). */ 668 * in the code for g mode (see initvals.c).
669 */
470 if (ah->ah_version == AR5K_AR5211) 670 if (ah->ah_version == AR5K_AR5211)
471 mode |= AR5K_PHY_MODE_MOD_OFDM; 671 mode |= AR5K_PHY_MODE_MOD_OFDM;
472 else 672 else
@@ -479,6 +679,7 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
479 } else if (flags & CHANNEL_5GHZ) { 679 } else if (flags & CHANNEL_5GHZ) {
480 mode |= AR5K_PHY_MODE_FREQ_5GHZ; 680 mode |= AR5K_PHY_MODE_FREQ_5GHZ;
481 681
682 /* Different PLL setting for 5413 */
482 if (ah->ah_radio == AR5K_RF5413) 683 if (ah->ah_radio == AR5K_RF5413)
483 clock = AR5K_PHY_PLL_40MHZ_5413; 684 clock = AR5K_PHY_PLL_40MHZ_5413;
484 else 685 else
@@ -496,12 +697,29 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
496 return -EINVAL; 697 return -EINVAL;
497 } 698 }
498 699
499 if (flags & CHANNEL_TURBO) 700 /*XXX: Can bwmode be used with dynamic mode ?
500 turbo = AR5K_PHY_TURBO_MODE | AR5K_PHY_TURBO_SHORT; 701 * (I don't think it supports 44MHz) */
702 /* On 2425 initvals TURBO_SHORT is not pressent */
703 if (ah->ah_bwmode == AR5K_BWMODE_40MHZ) {
704 turbo = AR5K_PHY_TURBO_MODE |
705 (ah->ah_radio == AR5K_RF2425) ? 0 :
706 AR5K_PHY_TURBO_SHORT;
707 } else if (ah->ah_bwmode != AR5K_BWMODE_DEFAULT) {
708 if (ah->ah_radio == AR5K_RF5413) {
709 mode |= (ah->ah_bwmode == AR5K_BWMODE_10MHZ) ?
710 AR5K_PHY_MODE_HALF_RATE :
711 AR5K_PHY_MODE_QUARTER_RATE;
712 } else if (ah->ah_version == AR5K_AR5212) {
713 clock |= (ah->ah_bwmode == AR5K_BWMODE_10MHZ) ?
714 AR5K_PHY_PLL_HALF_RATE :
715 AR5K_PHY_PLL_QUARTER_RATE;
716 }
717 }
718
501 } else { /* Reset the device */ 719 } else { /* Reset the device */
502 720
503 /* ...enable Atheros turbo mode if requested */ 721 /* ...enable Atheros turbo mode if requested */
504 if (flags & CHANNEL_TURBO) 722 if (ah->ah_bwmode == AR5K_BWMODE_40MHZ)
505 ath5k_hw_reg_write(ah, AR5K_PHY_TURBO_MODE, 723 ath5k_hw_reg_write(ah, AR5K_PHY_TURBO_MODE,
506 AR5K_PHY_TURBO); 724 AR5K_PHY_TURBO);
507 } 725 }
@@ -522,107 +740,10 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
522 return 0; 740 return 0;
523} 741}
524 742
525/*
526 * If there is an external 32KHz crystal available, use it
527 * as ref. clock instead of 32/40MHz clock and baseband clocks
528 * to save power during sleep or restore normal 32/40MHz
529 * operation.
530 *
531 * XXX: When operating on 32KHz certain PHY registers (27 - 31,
532 * 123 - 127) require delay on access.
533 */
534static void ath5k_hw_set_sleep_clock(struct ath5k_hw *ah, bool enable)
535{
536 struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
537 u32 scal, spending, usec32;
538
539 /* Only set 32KHz settings if we have an external
540 * 32KHz crystal present */
541 if ((AR5K_EEPROM_HAS32KHZCRYSTAL(ee->ee_misc1) ||
542 AR5K_EEPROM_HAS32KHZCRYSTAL_OLD(ee->ee_misc1)) &&
543 enable) {
544
545 /* 1 usec/cycle */
546 AR5K_REG_WRITE_BITS(ah, AR5K_USEC_5211, AR5K_USEC_32, 1);
547 /* Set up tsf increment on each cycle */
548 AR5K_REG_WRITE_BITS(ah, AR5K_TSF_PARM, AR5K_TSF_PARM_INC, 61);
549
550 /* Set baseband sleep control registers
551 * and sleep control rate */
552 ath5k_hw_reg_write(ah, 0x1f, AR5K_PHY_SCR);
553
554 if ((ah->ah_radio == AR5K_RF5112) ||
555 (ah->ah_radio == AR5K_RF5413) ||
556 (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4)))
557 spending = 0x14;
558 else
559 spending = 0x18;
560 ath5k_hw_reg_write(ah, spending, AR5K_PHY_SPENDING);
561
562 if ((ah->ah_radio == AR5K_RF5112) ||
563 (ah->ah_radio == AR5K_RF5413) ||
564 (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) {
565 ath5k_hw_reg_write(ah, 0x26, AR5K_PHY_SLMT);
566 ath5k_hw_reg_write(ah, 0x0d, AR5K_PHY_SCAL);
567 ath5k_hw_reg_write(ah, 0x07, AR5K_PHY_SCLOCK);
568 ath5k_hw_reg_write(ah, 0x3f, AR5K_PHY_SDELAY);
569 AR5K_REG_WRITE_BITS(ah, AR5K_PCICFG,
570 AR5K_PCICFG_SLEEP_CLOCK_RATE, 0x02);
571 } else {
572 ath5k_hw_reg_write(ah, 0x0a, AR5K_PHY_SLMT);
573 ath5k_hw_reg_write(ah, 0x0c, AR5K_PHY_SCAL);
574 ath5k_hw_reg_write(ah, 0x03, AR5K_PHY_SCLOCK);
575 ath5k_hw_reg_write(ah, 0x20, AR5K_PHY_SDELAY);
576 AR5K_REG_WRITE_BITS(ah, AR5K_PCICFG,
577 AR5K_PCICFG_SLEEP_CLOCK_RATE, 0x03);
578 }
579
580 /* Enable sleep clock operation */
581 AR5K_REG_ENABLE_BITS(ah, AR5K_PCICFG,
582 AR5K_PCICFG_SLEEP_CLOCK_EN);
583
584 } else {
585
586 /* Disable sleep clock operation and
587 * restore default parameters */
588 AR5K_REG_DISABLE_BITS(ah, AR5K_PCICFG,
589 AR5K_PCICFG_SLEEP_CLOCK_EN);
590
591 AR5K_REG_WRITE_BITS(ah, AR5K_PCICFG,
592 AR5K_PCICFG_SLEEP_CLOCK_RATE, 0);
593
594 ath5k_hw_reg_write(ah, 0x1f, AR5K_PHY_SCR);
595 ath5k_hw_reg_write(ah, AR5K_PHY_SLMT_32MHZ, AR5K_PHY_SLMT);
596
597 if (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))
598 scal = AR5K_PHY_SCAL_32MHZ_2417;
599 else if (ee->ee_is_hb63)
600 scal = AR5K_PHY_SCAL_32MHZ_HB63;
601 else
602 scal = AR5K_PHY_SCAL_32MHZ;
603 ath5k_hw_reg_write(ah, scal, AR5K_PHY_SCAL);
604
605 ath5k_hw_reg_write(ah, AR5K_PHY_SCLOCK_32MHZ, AR5K_PHY_SCLOCK);
606 ath5k_hw_reg_write(ah, AR5K_PHY_SDELAY_32MHZ, AR5K_PHY_SDELAY);
607 743
608 if ((ah->ah_radio == AR5K_RF5112) || 744/**************************************\
609 (ah->ah_radio == AR5K_RF5413) || 745* Post-initvals register modifications *
610 (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) 746\**************************************/
611 spending = 0x14;
612 else
613 spending = 0x18;
614 ath5k_hw_reg_write(ah, spending, AR5K_PHY_SPENDING);
615
616 if ((ah->ah_radio == AR5K_RF5112) ||
617 (ah->ah_radio == AR5K_RF5413))
618 usec32 = 39;
619 else
620 usec32 = 31;
621 AR5K_REG_WRITE_BITS(ah, AR5K_USEC_5211, AR5K_USEC_32, usec32);
622
623 AR5K_REG_WRITE_BITS(ah, AR5K_TSF_PARM, AR5K_TSF_PARM_INC, 1);
624 }
625}
626 747
627/* TODO: Half/Quarter rate */ 748/* TODO: Half/Quarter rate */
628static void ath5k_hw_tweak_initval_settings(struct ath5k_hw *ah, 749static void ath5k_hw_tweak_initval_settings(struct ath5k_hw *ah,
@@ -663,22 +784,10 @@ static void ath5k_hw_tweak_initval_settings(struct ath5k_hw *ah,
663 AR5K_REG_DISABLE_BITS(ah, AR5K_TXCFG, 784 AR5K_REG_DISABLE_BITS(ah, AR5K_TXCFG,
664 AR5K_TXCFG_DCU_DBL_BUF_DIS); 785 AR5K_TXCFG_DCU_DBL_BUF_DIS);
665 786
666 /* Set DAC/ADC delays */
667 if (ah->ah_version == AR5K_AR5212) {
668 u32 scal;
669 struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
670 if (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))
671 scal = AR5K_PHY_SCAL_32MHZ_2417;
672 else if (ee->ee_is_hb63)
673 scal = AR5K_PHY_SCAL_32MHZ_HB63;
674 else
675 scal = AR5K_PHY_SCAL_32MHZ;
676 ath5k_hw_reg_write(ah, scal, AR5K_PHY_SCAL);
677 }
678
679 /* Set fast ADC */ 787 /* Set fast ADC */
680 if ((ah->ah_radio == AR5K_RF5413) || 788 if ((ah->ah_radio == AR5K_RF5413) ||
681 (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) { 789 (ah->ah_radio == AR5K_RF2317) ||
790 (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) {
682 u32 fast_adc = true; 791 u32 fast_adc = true;
683 792
684 if (channel->center_freq == 2462 || 793 if (channel->center_freq == 2462 ||
@@ -706,26 +815,54 @@ static void ath5k_hw_tweak_initval_settings(struct ath5k_hw *ah,
706 } 815 }
707 816
708 if (ah->ah_mac_srev < AR5K_SREV_AR5211) { 817 if (ah->ah_mac_srev < AR5K_SREV_AR5211) {
709 u32 usec_reg;
710 /* 5311 has different tx/rx latency masks
711 * from 5211, since we deal 5311 the same
712 * as 5211 when setting initvals, shift
713 * values here to their proper locations */
714 usec_reg = ath5k_hw_reg_read(ah, AR5K_USEC_5211);
715 ath5k_hw_reg_write(ah, usec_reg & (AR5K_USEC_1 |
716 AR5K_USEC_32 |
717 AR5K_USEC_TX_LATENCY_5211 |
718 AR5K_REG_SM(29,
719 AR5K_USEC_RX_LATENCY_5210)),
720 AR5K_USEC_5211);
721 /* Clear QCU/DCU clock gating register */ 818 /* Clear QCU/DCU clock gating register */
722 ath5k_hw_reg_write(ah, 0, AR5K_QCUDCU_CLKGT); 819 ath5k_hw_reg_write(ah, 0, AR5K_QCUDCU_CLKGT);
723 /* Set DAC/ADC delays */ 820 /* Set DAC/ADC delays */
724 ath5k_hw_reg_write(ah, 0x08, AR5K_PHY_SCAL); 821 ath5k_hw_reg_write(ah, AR5K_PHY_SCAL_32MHZ_5311,
822 AR5K_PHY_SCAL);
725 /* Enable PCU FIFO corruption ECO */ 823 /* Enable PCU FIFO corruption ECO */
726 AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW_5211, 824 AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW_5211,
727 AR5K_DIAG_SW_ECO_ENABLE); 825 AR5K_DIAG_SW_ECO_ENABLE);
728 } 826 }
827
828 if (ah->ah_bwmode) {
829 /* Increase PHY switch and AGC settling time
830 * on turbo mode (ath5k_hw_commit_eeprom_settings
831 * will override settling time if available) */
832 if (ah->ah_bwmode == AR5K_BWMODE_40MHZ) {
833
834 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SETTLING,
835 AR5K_PHY_SETTLING_AGC,
836 AR5K_AGC_SETTLING_TURBO);
837
838 /* XXX: Initvals indicate we only increase
839 * switch time on AR5212, 5211 and 5210
840 * only change agc time (bug?) */
841 if (ah->ah_version == AR5K_AR5212)
842 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SETTLING,
843 AR5K_PHY_SETTLING_SWITCH,
844 AR5K_SWITCH_SETTLING_TURBO);
845
846 if (ah->ah_version == AR5K_AR5210) {
847 /* Set Frame Control Register */
848 ath5k_hw_reg_write(ah,
849 (AR5K_PHY_FRAME_CTL_INI |
850 AR5K_PHY_TURBO_MODE |
851 AR5K_PHY_TURBO_SHORT | 0x2020),
852 AR5K_PHY_FRAME_CTL_5210);
853 }
854 /* On 5413 PHY force window length for half/quarter rate*/
855 } else if ((ah->ah_mac_srev >= AR5K_SREV_AR5424) &&
856 (ah->ah_mac_srev <= AR5K_SREV_AR5414)) {
857 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_FRAME_CTL_5211,
858 AR5K_PHY_FRAME_CTL_WIN_LEN,
859 3);
860 }
861 } else if (ah->ah_version == AR5K_AR5210) {
862 /* Set Frame Control Register for normal operation */
863 ath5k_hw_reg_write(ah, (AR5K_PHY_FRAME_CTL_INI | 0x1020),
864 AR5K_PHY_FRAME_CTL_5210);
865 }
729} 866}
730 867
731static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah, 868static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
@@ -734,6 +871,10 @@ static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
734 struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; 871 struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
735 s16 cck_ofdm_pwr_delta; 872 s16 cck_ofdm_pwr_delta;
736 873
874 /* TODO: Add support for AR5210 EEPROM */
875 if (ah->ah_version == AR5K_AR5210)
876 return;
877
737 /* Adjust power delta for channel 14 */ 878 /* Adjust power delta for channel 14 */
738 if (channel->center_freq == 2484) 879 if (channel->center_freq == 2484)
739 cck_ofdm_pwr_delta = 880 cck_ofdm_pwr_delta =
@@ -772,7 +913,7 @@ static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
772 AR5K_PHY_NF_SVAL(ee->ee_noise_floor_thr[ee_mode]), 913 AR5K_PHY_NF_SVAL(ee->ee_noise_floor_thr[ee_mode]),
773 AR5K_PHY_NFTHRES); 914 AR5K_PHY_NFTHRES);
774 915
775 if ((channel->hw_value & CHANNEL_TURBO) && 916 if ((ah->ah_bwmode == AR5K_BWMODE_40MHZ) &&
776 (ah->ah_ee_version >= AR5K_EEPROM_VERSION_5_0)) { 917 (ah->ah_ee_version >= AR5K_EEPROM_VERSION_5_0)) {
777 /* Switch settling time (Turbo) */ 918 /* Switch settling time (Turbo) */
778 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SETTLING, 919 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SETTLING,
@@ -870,143 +1011,183 @@ static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
870 ath5k_hw_reg_write(ah, 0, AR5K_PHY_HEAVY_CLIP_ENABLE); 1011 ath5k_hw_reg_write(ah, 0, AR5K_PHY_HEAVY_CLIP_ENABLE);
871} 1012}
872 1013
873/* 1014
874 * Main reset function 1015/*********************\
875 */ 1016* Main reset function *
1017\*********************/
1018
876int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, 1019int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
877 struct ieee80211_channel *channel, bool change_channel) 1020 struct ieee80211_channel *channel, bool fast, bool skip_pcu)
878{ 1021{
879 struct ath_common *common = ath5k_hw_common(ah); 1022 u32 s_seq[10], s_led[3], tsf_up, tsf_lo;
880 u32 s_seq[10], s_led[3], staid1_flags, tsf_up, tsf_lo;
881 u32 phy_tst1;
882 u8 mode, freq, ee_mode; 1023 u8 mode, freq, ee_mode;
883 int i, ret; 1024 int i, ret;
884 1025
885 ee_mode = 0; 1026 ee_mode = 0;
886 staid1_flags = 0;
887 tsf_up = 0; 1027 tsf_up = 0;
888 tsf_lo = 0; 1028 tsf_lo = 0;
889 freq = 0; 1029 freq = 0;
890 mode = 0; 1030 mode = 0;
891 1031
892 /* 1032 /*
893 * Save some registers before a reset 1033 * Sanity check for fast flag
1034 * Fast channel change only available
1035 * on AR2413/AR5413.
894 */ 1036 */
895 /*DCU/Antenna selection not available on 5210*/ 1037 if (fast && (ah->ah_radio != AR5K_RF2413) &&
896 if (ah->ah_version != AR5K_AR5210) { 1038 (ah->ah_radio != AR5K_RF5413))
1039 fast = 0;
897 1040
898 switch (channel->hw_value & CHANNEL_MODES) { 1041 /* Disable sleep clock operation
899 case CHANNEL_A: 1042 * to avoid register access delay on certain
900 mode = AR5K_MODE_11A; 1043 * PHY registers */
901 freq = AR5K_INI_RFGAIN_5GHZ; 1044 if (ah->ah_version == AR5K_AR5212)
902 ee_mode = AR5K_EEPROM_MODE_11A; 1045 ath5k_hw_set_sleep_clock(ah, false);
903 break; 1046
904 case CHANNEL_G: 1047 /*
905 mode = AR5K_MODE_11G; 1048 * Stop PCU
906 freq = AR5K_INI_RFGAIN_2GHZ; 1049 */
907 ee_mode = AR5K_EEPROM_MODE_11G; 1050 ath5k_hw_stop_rx_pcu(ah);
908 break; 1051
909 case CHANNEL_B: 1052 /*
910 mode = AR5K_MODE_11B; 1053 * Stop DMA
911 freq = AR5K_INI_RFGAIN_2GHZ; 1054 *
912 ee_mode = AR5K_EEPROM_MODE_11B; 1055 * Note: If DMA didn't stop continue
913 break; 1056 * since only a reset will fix it.
914 case CHANNEL_T: 1057 */
915 mode = AR5K_MODE_11A_TURBO; 1058 ret = ath5k_hw_dma_stop(ah);
916 freq = AR5K_INI_RFGAIN_5GHZ; 1059
917 ee_mode = AR5K_EEPROM_MODE_11A; 1060 /* RF Bus grant won't work if we have pending
918 break; 1061 * frames */
919 case CHANNEL_TG: 1062 if (ret && fast) {
920 if (ah->ah_version == AR5K_AR5211) { 1063 ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_RESET,
921 ATH5K_ERR(ah->ah_sc, 1064 "DMA didn't stop, falling back to normal reset\n");
922 "TurboG mode not available on 5211"); 1065 fast = 0;
923 return -EINVAL; 1066 /* Non fatal, just continue with
924 } 1067 * normal reset */
925 mode = AR5K_MODE_11G_TURBO; 1068 ret = 0;
926 freq = AR5K_INI_RFGAIN_2GHZ; 1069 }
927 ee_mode = AR5K_EEPROM_MODE_11G; 1070
928 break; 1071 switch (channel->hw_value & CHANNEL_MODES) {
929 case CHANNEL_XR: 1072 case CHANNEL_A:
930 if (ah->ah_version == AR5K_AR5211) { 1073 mode = AR5K_MODE_11A;
931 ATH5K_ERR(ah->ah_sc, 1074 freq = AR5K_INI_RFGAIN_5GHZ;
932 "XR mode not available on 5211"); 1075 ee_mode = AR5K_EEPROM_MODE_11A;
933 return -EINVAL; 1076 break;
934 } 1077 case CHANNEL_G:
935 mode = AR5K_MODE_XR; 1078
936 freq = AR5K_INI_RFGAIN_5GHZ; 1079 if (ah->ah_version <= AR5K_AR5211) {
937 ee_mode = AR5K_EEPROM_MODE_11A;
938 break;
939 default:
940 ATH5K_ERR(ah->ah_sc, 1080 ATH5K_ERR(ah->ah_sc,
941 "invalid channel: %d\n", channel->center_freq); 1081 "G mode not available on 5210/5211");
942 return -EINVAL; 1082 return -EINVAL;
943 } 1083 }
944 1084
945 if (change_channel) { 1085 mode = AR5K_MODE_11G;
946 /* 1086 freq = AR5K_INI_RFGAIN_2GHZ;
947 * Save frame sequence count 1087 ee_mode = AR5K_EEPROM_MODE_11G;
948 * For revs. after Oahu, only save 1088 break;
949 * seq num for DCU 0 (Global seq num) 1089 case CHANNEL_B:
950 */
951 if (ah->ah_mac_srev < AR5K_SREV_AR5211) {
952
953 for (i = 0; i < 10; i++)
954 s_seq[i] = ath5k_hw_reg_read(ah,
955 AR5K_QUEUE_DCU_SEQNUM(i));
956 1090
957 } else { 1091 if (ah->ah_version < AR5K_AR5211) {
958 s_seq[0] = ath5k_hw_reg_read(ah, 1092 ATH5K_ERR(ah->ah_sc,
959 AR5K_QUEUE_DCU_SEQNUM(0)); 1093 "B mode not available on 5210");
960 } 1094 return -EINVAL;
1095 }
961 1096
962 /* TSF accelerates on AR5211 during reset 1097 mode = AR5K_MODE_11B;
963 * As a workaround save it here and restore 1098 freq = AR5K_INI_RFGAIN_2GHZ;
964 * it later so that it's back in time after 1099 ee_mode = AR5K_EEPROM_MODE_11B;
965 * reset. This way it'll get re-synced on the 1100 break;
966 * next beacon without breaking ad-hoc. 1101 case CHANNEL_XR:
967 * 1102 if (ah->ah_version == AR5K_AR5211) {
968 * On AR5212 TSF is almost preserved across a 1103 ATH5K_ERR(ah->ah_sc,
969 * reset so it stays back in time anyway and 1104 "XR mode not available on 5211");
970 * we don't have to save/restore it. 1105 return -EINVAL;
971 *
972 * XXX: Since this breaks power saving we have
973 * to disable power saving until we receive the
974 * next beacon, so we can resync beacon timers */
975 if (ah->ah_version == AR5K_AR5211) {
976 tsf_up = ath5k_hw_reg_read(ah, AR5K_TSF_U32);
977 tsf_lo = ath5k_hw_reg_read(ah, AR5K_TSF_L32);
978 }
979 } 1106 }
1107 mode = AR5K_MODE_XR;
1108 freq = AR5K_INI_RFGAIN_5GHZ;
1109 ee_mode = AR5K_EEPROM_MODE_11A;
1110 break;
1111 default:
1112 ATH5K_ERR(ah->ah_sc,
1113 "invalid channel: %d\n", channel->center_freq);
1114 return -EINVAL;
1115 }
980 1116
981 if (ah->ah_version == AR5K_AR5212) { 1117 /*
982 /* Restore normal 32/40MHz clock operation 1118 * If driver requested fast channel change and DMA has stopped
983 * to avoid register access delay on certain 1119 * go on. If it fails continue with a normal reset.
984 * PHY registers */ 1120 */
985 ath5k_hw_set_sleep_clock(ah, false); 1121 if (fast) {
1122 ret = ath5k_hw_phy_init(ah, channel, mode,
1123 ee_mode, freq, true);
1124 if (ret) {
1125 ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_RESET,
1126 "fast chan change failed, falling back to normal reset\n");
1127 /* Non fatal, can happen eg.
1128 * on mode change */
1129 ret = 0;
1130 } else
1131 return 0;
1132 }
986 1133
987 /* Since we are going to write rf buffer 1134 /*
988 * check if we have any pending gain_F 1135 * Save some registers before a reset
989 * optimization settings */ 1136 */
990 if (change_channel && ah->ah_rf_banks != NULL) 1137 if (ah->ah_version != AR5K_AR5210) {
991 ath5k_hw_gainf_calibrate(ah); 1138 /*
1139 * Save frame sequence count
1140 * For revs. after Oahu, only save
1141 * seq num for DCU 0 (Global seq num)
1142 */
1143 if (ah->ah_mac_srev < AR5K_SREV_AR5211) {
1144
1145 for (i = 0; i < 10; i++)
1146 s_seq[i] = ath5k_hw_reg_read(ah,
1147 AR5K_QUEUE_DCU_SEQNUM(i));
1148
1149 } else {
1150 s_seq[0] = ath5k_hw_reg_read(ah,
1151 AR5K_QUEUE_DCU_SEQNUM(0));
1152 }
1153
1154 /* TSF accelerates on AR5211 during reset
1155 * As a workaround save it here and restore
1156 * it later so that it's back in time after
1157 * reset. This way it'll get re-synced on the
1158 * next beacon without breaking ad-hoc.
1159 *
1160 * On AR5212 TSF is almost preserved across a
1161 * reset so it stays back in time anyway and
1162 * we don't have to save/restore it.
1163 *
1164 * XXX: Since this breaks power saving we have
1165 * to disable power saving until we receive the
1166 * next beacon, so we can resync beacon timers */
1167 if (ah->ah_version == AR5K_AR5211) {
1168 tsf_up = ath5k_hw_reg_read(ah, AR5K_TSF_U32);
1169 tsf_lo = ath5k_hw_reg_read(ah, AR5K_TSF_L32);
992 } 1170 }
993 } 1171 }
994 1172
1173
995 /*GPIOs*/ 1174 /*GPIOs*/
996 s_led[0] = ath5k_hw_reg_read(ah, AR5K_PCICFG) & 1175 s_led[0] = ath5k_hw_reg_read(ah, AR5K_PCICFG) &
997 AR5K_PCICFG_LEDSTATE; 1176 AR5K_PCICFG_LEDSTATE;
998 s_led[1] = ath5k_hw_reg_read(ah, AR5K_GPIOCR); 1177 s_led[1] = ath5k_hw_reg_read(ah, AR5K_GPIOCR);
999 s_led[2] = ath5k_hw_reg_read(ah, AR5K_GPIODO); 1178 s_led[2] = ath5k_hw_reg_read(ah, AR5K_GPIODO);
1000 1179
1001 /* AR5K_STA_ID1 flags, only preserve antenna 1180
1002 * settings and ack/cts rate mode */ 1181 /*
1003 staid1_flags = ath5k_hw_reg_read(ah, AR5K_STA_ID1) & 1182 * Since we are going to write rf buffer
1004 (AR5K_STA_ID1_DEFAULT_ANTENNA | 1183 * check if we have any pending gain_F
1005 AR5K_STA_ID1_DESC_ANTENNA | 1184 * optimization settings
1006 AR5K_STA_ID1_RTS_DEF_ANTENNA | 1185 */
1007 AR5K_STA_ID1_ACKCTS_6MB | 1186 if (ah->ah_version == AR5K_AR5212 &&
1008 AR5K_STA_ID1_BASE_RATE_11B | 1187 (ah->ah_radio <= AR5K_RF5112)) {
1009 AR5K_STA_ID1_SELFGEN_DEF_ANT); 1188 if (!fast && ah->ah_rf_banks != NULL)
1189 ath5k_hw_gainf_calibrate(ah);
1190 }
1010 1191
1011 /* Wakeup the device */ 1192 /* Wakeup the device */
1012 ret = ath5k_hw_nic_wakeup(ah, channel->hw_value, false); 1193 ret = ath5k_hw_nic_wakeup(ah, channel->hw_value, false);
@@ -1021,121 +1202,42 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
1021 AR5K_PHY(0)); 1202 AR5K_PHY(0));
1022 1203
1023 /* Write initial settings */ 1204 /* Write initial settings */
1024 ret = ath5k_hw_write_initvals(ah, mode, change_channel); 1205 ret = ath5k_hw_write_initvals(ah, mode, skip_pcu);
1025 if (ret) 1206 if (ret)
1026 return ret; 1207 return ret;
1027 1208
1209 /* Initialize core clock settings */
1210 ath5k_hw_init_core_clock(ah);
1211
1028 /* 1212 /*
1029 * 5211/5212 Specific 1213 * Tweak initval settings for revised
1214 * chipsets and add some more config
1215 * bits
1030 */ 1216 */
1031 if (ah->ah_version != AR5K_AR5210) { 1217 ath5k_hw_tweak_initval_settings(ah, channel);
1032
1033 /*
1034 * Write initial RF gain settings
1035 * This should work for both 5111/5112
1036 */
1037 ret = ath5k_hw_rfgain_init(ah, freq);
1038 if (ret)
1039 return ret;
1040
1041 mdelay(1);
1042
1043 /*
1044 * Tweak initval settings for revised
1045 * chipsets and add some more config
1046 * bits
1047 */
1048 ath5k_hw_tweak_initval_settings(ah, channel);
1049
1050 /*
1051 * Set TX power
1052 */
1053 ret = ath5k_hw_txpower(ah, channel, ee_mode,
1054 ah->ah_txpower.txp_max_pwr / 2);
1055 if (ret)
1056 return ret;
1057 1218
1058 /* Write rate duration table only on AR5212 and if 1219 /* Commit values from EEPROM */
1059 * virtual interface has already been brought up 1220 ath5k_hw_commit_eeprom_settings(ah, channel, ee_mode);
1060 * XXX: rethink this after new mode changes to
1061 * mac80211 are integrated */
1062 if (ah->ah_version == AR5K_AR5212 &&
1063 ah->ah_sc->nvifs)
1064 ath5k_hw_write_rate_duration(ah, mode);
1065 1221
1066 /*
1067 * Write RF buffer
1068 */
1069 ret = ath5k_hw_rfregs_init(ah, channel, mode);
1070 if (ret)
1071 return ret;
1072
1073
1074 /* Write OFDM timings on 5212*/
1075 if (ah->ah_version == AR5K_AR5212 &&
1076 channel->hw_value & CHANNEL_OFDM) {
1077
1078 ret = ath5k_hw_write_ofdm_timings(ah, channel);
1079 if (ret)
1080 return ret;
1081
1082 /* Spur info is available only from EEPROM versions
1083 * greater than 5.3, but the EEPROM routines will use
1084 * static values for older versions */
1085 if (ah->ah_mac_srev >= AR5K_SREV_AR5424)
1086 ath5k_hw_set_spur_mitigation_filter(ah,
1087 channel);
1088 }
1089
1090 /*Enable/disable 802.11b mode on 5111
1091 (enable 2111 frequency converter + CCK)*/
1092 if (ah->ah_radio == AR5K_RF5111) {
1093 if (mode == AR5K_MODE_11B)
1094 AR5K_REG_ENABLE_BITS(ah, AR5K_TXCFG,
1095 AR5K_TXCFG_B_MODE);
1096 else
1097 AR5K_REG_DISABLE_BITS(ah, AR5K_TXCFG,
1098 AR5K_TXCFG_B_MODE);
1099 }
1100
1101 /* Commit values from EEPROM */
1102 ath5k_hw_commit_eeprom_settings(ah, channel, ee_mode);
1103
1104 } else {
1105 /*
1106 * For 5210 we do all initialization using
1107 * initvals, so we don't have to modify
1108 * any settings (5210 also only supports
1109 * a/aturbo modes)
1110 */
1111 mdelay(1);
1112 /* Disable phy and wait */
1113 ath5k_hw_reg_write(ah, AR5K_PHY_ACT_DISABLE, AR5K_PHY_ACT);
1114 mdelay(1);
1115 }
1116 1222
1117 /* 1223 /*
1118 * Restore saved values 1224 * Restore saved values
1119 */ 1225 */
1120 1226
1121 /*DCU/Antenna selection not available on 5210*/ 1227 /* Seqnum, TSF */
1122 if (ah->ah_version != AR5K_AR5210) { 1228 if (ah->ah_version != AR5K_AR5210) {
1229 if (ah->ah_mac_srev < AR5K_SREV_AR5211) {
1230 for (i = 0; i < 10; i++)
1231 ath5k_hw_reg_write(ah, s_seq[i],
1232 AR5K_QUEUE_DCU_SEQNUM(i));
1233 } else {
1234 ath5k_hw_reg_write(ah, s_seq[0],
1235 AR5K_QUEUE_DCU_SEQNUM(0));
1236 }
1123 1237
1124 if (change_channel) { 1238 if (ah->ah_version == AR5K_AR5211) {
1125 if (ah->ah_mac_srev < AR5K_SREV_AR5211) { 1239 ath5k_hw_reg_write(ah, tsf_up, AR5K_TSF_U32);
1126 for (i = 0; i < 10; i++) 1240 ath5k_hw_reg_write(ah, tsf_lo, AR5K_TSF_L32);
1127 ath5k_hw_reg_write(ah, s_seq[i],
1128 AR5K_QUEUE_DCU_SEQNUM(i));
1129 } else {
1130 ath5k_hw_reg_write(ah, s_seq[0],
1131 AR5K_QUEUE_DCU_SEQNUM(0));
1132 }
1133
1134
1135 if (ah->ah_version == AR5K_AR5211) {
1136 ath5k_hw_reg_write(ah, tsf_up, AR5K_TSF_U32);
1137 ath5k_hw_reg_write(ah, tsf_lo, AR5K_TSF_L32);
1138 }
1139 } 1241 }
1140 } 1242 }
1141 1243
@@ -1146,203 +1248,34 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
1146 ath5k_hw_reg_write(ah, s_led[1], AR5K_GPIOCR); 1248 ath5k_hw_reg_write(ah, s_led[1], AR5K_GPIOCR);
1147 ath5k_hw_reg_write(ah, s_led[2], AR5K_GPIODO); 1249 ath5k_hw_reg_write(ah, s_led[2], AR5K_GPIODO);
1148 1250
1149 /* Restore sta_id flags and preserve our mac address*/
1150 ath5k_hw_reg_write(ah,
1151 get_unaligned_le32(common->macaddr),
1152 AR5K_STA_ID0);
1153 ath5k_hw_reg_write(ah,
1154 staid1_flags | get_unaligned_le16(common->macaddr + 4),
1155 AR5K_STA_ID1);
1156
1157
1158 /* 1251 /*
1159 * Configure PCU 1252 * Initialize PCU
1160 */ 1253 */
1161 1254 ath5k_hw_pcu_init(ah, op_mode, mode);
1162 /* Restore bssid and bssid mask */
1163 ath5k_hw_set_bssid(ah);
1164
1165 /* Set PCU config */
1166 ath5k_hw_set_opmode(ah, op_mode);
1167
1168 /* Clear any pending interrupts
1169 * PISR/SISR Not available on 5210 */
1170 if (ah->ah_version != AR5K_AR5210)
1171 ath5k_hw_reg_write(ah, 0xffffffff, AR5K_PISR);
1172
1173 /* Set RSSI/BRSSI thresholds
1174 *
1175 * Note: If we decide to set this value
1176 * dynamically, keep in mind that when AR5K_RSSI_THR
1177 * register is read, it might return 0x40 if we haven't
1178 * written anything to it. Also, BMISS RSSI threshold is zeroed.
1179 * So doing a save/restore procedure here isn't the right
1180 * choice. Instead, store it in ath5k_hw */
1181 ath5k_hw_reg_write(ah, (AR5K_TUNE_RSSI_THRES |
1182 AR5K_TUNE_BMISS_THRES <<
1183 AR5K_RSSI_THR_BMISS_S),
1184 AR5K_RSSI_THR);
1185
1186 /* MIC QoS support */
1187 if (ah->ah_mac_srev >= AR5K_SREV_AR2413) {
1188 ath5k_hw_reg_write(ah, 0x000100aa, AR5K_MIC_QOS_CTL);
1189 ath5k_hw_reg_write(ah, 0x00003210, AR5K_MIC_QOS_SEL);
1190 }
1191
1192 /* QoS NOACK Policy */
1193 if (ah->ah_version == AR5K_AR5212) {
1194 ath5k_hw_reg_write(ah,
1195 AR5K_REG_SM(2, AR5K_QOS_NOACK_2BIT_VALUES) |
1196 AR5K_REG_SM(5, AR5K_QOS_NOACK_BIT_OFFSET) |
1197 AR5K_REG_SM(0, AR5K_QOS_NOACK_BYTE_OFFSET),
1198 AR5K_QOS_NOACK);
1199 }
1200
1201 1255
1202 /* 1256 /*
1203 * Configure PHY 1257 * Initialize PHY
1204 */ 1258 */
1205 1259 ret = ath5k_hw_phy_init(ah, channel, mode, ee_mode, freq, false);
1206 /* Set channel on PHY */ 1260 if (ret) {
1207 ret = ath5k_hw_channel(ah, channel); 1261 ATH5K_ERR(ah->ah_sc,
1208 if (ret) 1262 "failed to initialize PHY (%i) !\n", ret);
1209 return ret; 1263 return ret;
1210
1211 /*
1212 * Enable the PHY and wait until completion
1213 * This includes BaseBand and Synthesizer
1214 * activation.
1215 */
1216 ath5k_hw_reg_write(ah, AR5K_PHY_ACT_ENABLE, AR5K_PHY_ACT);
1217
1218 /*
1219 * On 5211+ read activation -> rx delay
1220 * and use it.
1221 *
1222 * TODO: Half/quarter rate support
1223 */
1224 if (ah->ah_version != AR5K_AR5210) {
1225 u32 delay;
1226 delay = ath5k_hw_reg_read(ah, AR5K_PHY_RX_DELAY) &
1227 AR5K_PHY_RX_DELAY_M;
1228 delay = (channel->hw_value & CHANNEL_CCK) ?
1229 ((delay << 2) / 22) : (delay / 10);
1230
1231 udelay(100 + (2 * delay));
1232 } else {
1233 mdelay(1);
1234 } 1264 }
1235 1265
1236 /* 1266 /*
1237 * Perform ADC test to see if baseband is ready
1238 * Set TX hold and check ADC test register
1239 */
1240 phy_tst1 = ath5k_hw_reg_read(ah, AR5K_PHY_TST1);
1241 ath5k_hw_reg_write(ah, AR5K_PHY_TST1_TXHOLD, AR5K_PHY_TST1);
1242 for (i = 0; i <= 20; i++) {
1243 if (!(ath5k_hw_reg_read(ah, AR5K_PHY_ADC_TEST) & 0x10))
1244 break;
1245 udelay(200);
1246 }
1247 ath5k_hw_reg_write(ah, phy_tst1, AR5K_PHY_TST1);
1248
1249 /*
1250 * Start automatic gain control calibration
1251 *
1252 * During AGC calibration RX path is re-routed to
1253 * a power detector so we don't receive anything.
1254 *
1255 * This method is used to calibrate some static offsets
1256 * used together with on-the fly I/Q calibration (the
1257 * one performed via ath5k_hw_phy_calibrate), which doesn't
1258 * interrupt rx path.
1259 *
1260 * While rx path is re-routed to the power detector we also
1261 * start a noise floor calibration to measure the
1262 * card's noise floor (the noise we measure when we are not
1263 * transmitting or receiving anything).
1264 *
1265 * If we are in a noisy environment, AGC calibration may time
1266 * out and/or noise floor calibration might timeout.
1267 */
1268 AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL,
1269 AR5K_PHY_AGCCTL_CAL | AR5K_PHY_AGCCTL_NF);
1270
1271 /* At the same time start I/Q calibration for QAM constellation
1272 * -no need for CCK- */
1273 ah->ah_calibration = false;
1274 if (!(mode == AR5K_MODE_11B)) {
1275 ah->ah_calibration = true;
1276 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ,
1277 AR5K_PHY_IQ_CAL_NUM_LOG_MAX, 15);
1278 AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ,
1279 AR5K_PHY_IQ_RUN);
1280 }
1281
1282 /* Wait for gain calibration to finish (we check for I/Q calibration
1283 * during ath5k_phy_calibrate) */
1284 if (ath5k_hw_register_timeout(ah, AR5K_PHY_AGCCTL,
1285 AR5K_PHY_AGCCTL_CAL, 0, false)) {
1286 ATH5K_ERR(ah->ah_sc, "gain calibration timeout (%uMHz)\n",
1287 channel->center_freq);
1288 }
1289
1290 /* Restore antenna mode */
1291 ath5k_hw_set_antenna_mode(ah, ah->ah_ant_mode);
1292
1293 /* Restore slot time and ACK timeouts */
1294 if (ah->ah_coverage_class > 0)
1295 ath5k_hw_set_coverage_class(ah, ah->ah_coverage_class);
1296
1297 /*
1298 * Configure QCUs/DCUs 1267 * Configure QCUs/DCUs
1299 */ 1268 */
1269 ret = ath5k_hw_init_queues(ah);
1270 if (ret)
1271 return ret;
1300 1272
1301 /* TODO: HW Compression support for data queues */
1302 /* TODO: Burst prefetch for data queues */
1303
1304 /*
1305 * Reset queues and start beacon timers at the end of the reset routine
1306 * This also sets QCU mask on each DCU for 1:1 qcu to dcu mapping
1307 * Note: If we want we can assign multiple qcus on one dcu.
1308 */
1309 for (i = 0; i < ah->ah_capabilities.cap_queues.q_tx_num; i++) {
1310 ret = ath5k_hw_reset_tx_queue(ah, i);
1311 if (ret) {
1312 ATH5K_ERR(ah->ah_sc,
1313 "failed to reset TX queue #%d\n", i);
1314 return ret;
1315 }
1316 }
1317
1318
1319 /*
1320 * Configure DMA/Interrupts
1321 */
1322 1273
1323 /* 1274 /*
1324 * Set Rx/Tx DMA Configuration 1275 * Initialize DMA/Interrupts
1325 *
1326 * Set standard DMA size (128). Note that
1327 * a DMA size of 512 causes rx overruns and tx errors
1328 * on pci-e cards (tested on 5424 but since rx overruns
1329 * also occur on 5416/5418 with madwifi we set 128
1330 * for all PCI-E cards to be safe).
1331 *
1332 * XXX: need to check 5210 for this
1333 * TODO: Check out tx triger level, it's always 64 on dumps but I
1334 * guess we can tweak it and see how it goes ;-)
1335 */ 1276 */
1336 if (ah->ah_version != AR5K_AR5210) { 1277 ath5k_hw_dma_init(ah);
1337 AR5K_REG_WRITE_BITS(ah, AR5K_TXCFG,
1338 AR5K_TXCFG_SDMAMR, AR5K_DMASIZE_128B);
1339 AR5K_REG_WRITE_BITS(ah, AR5K_RXCFG,
1340 AR5K_RXCFG_SDMAMW, AR5K_DMASIZE_128B);
1341 }
1342 1278
1343 /* Pre-enable interrupts on 5211/5212*/
1344 if (ah->ah_version != AR5K_AR5210)
1345 ath5k_hw_set_imr(ah, ah->ah_imr);
1346 1279
1347 /* Enable 32KHz clock function for AR5212+ chips 1280 /* Enable 32KHz clock function for AR5212+ chips
1348 * Set clocks to 32KHz operation and use an 1281 * Set clocks to 32KHz operation and use an
diff --git a/drivers/net/wireless/ath/ath5k/rfbuffer.h b/drivers/net/wireless/ath/ath5k/rfbuffer.h
index 3ac4cff4239d..16b67e84906d 100644
--- a/drivers/net/wireless/ath/ath5k/rfbuffer.h
+++ b/drivers/net/wireless/ath/ath5k/rfbuffer.h
@@ -51,7 +51,7 @@
51struct ath5k_ini_rfbuffer { 51struct ath5k_ini_rfbuffer {
52 u8 rfb_bank; /* RF Bank number */ 52 u8 rfb_bank; /* RF Bank number */
53 u16 rfb_ctrl_register; /* RF Buffer control register */ 53 u16 rfb_ctrl_register; /* RF Buffer control register */
54 u32 rfb_mode_data[5]; /* RF Buffer data for each mode */ 54 u32 rfb_mode_data[3]; /* RF Buffer data for each mode */
55}; 55};
56 56
57/* 57/*
@@ -79,8 +79,10 @@ struct ath5k_rf_reg {
79 * life easier by using an index for each register 79 * life easier by using an index for each register
80 * instead of a full rfb_field */ 80 * instead of a full rfb_field */
81enum ath5k_rf_regs_idx { 81enum ath5k_rf_regs_idx {
82 /* BANK 2 */
83 AR5K_RF_TURBO = 0,
82 /* BANK 6 */ 84 /* BANK 6 */
83 AR5K_RF_OB_2GHZ = 0, 85 AR5K_RF_OB_2GHZ,
84 AR5K_RF_OB_5GHZ, 86 AR5K_RF_OB_5GHZ,
85 AR5K_RF_DB_2GHZ, 87 AR5K_RF_DB_2GHZ,
86 AR5K_RF_DB_5GHZ, 88 AR5K_RF_DB_5GHZ,
@@ -134,6 +136,9 @@ enum ath5k_rf_regs_idx {
134* RF5111 (Sombrero) * 136* RF5111 (Sombrero) *
135\*******************/ 137\*******************/
136 138
139/* BANK 2 len pos col */
140#define AR5K_RF5111_RF_TURBO { 1, 3, 0 }
141
137/* BANK 6 len pos col */ 142/* BANK 6 len pos col */
138#define AR5K_RF5111_OB_2GHZ { 3, 119, 0 } 143#define AR5K_RF5111_OB_2GHZ { 3, 119, 0 }
139#define AR5K_RF5111_DB_2GHZ { 3, 122, 0 } 144#define AR5K_RF5111_DB_2GHZ { 3, 122, 0 }
@@ -158,6 +163,7 @@ enum ath5k_rf_regs_idx {
158#define AR5K_RF5111_MAX_TIME { 2, 49, 0 } 163#define AR5K_RF5111_MAX_TIME { 2, 49, 0 }
159 164
160static const struct ath5k_rf_reg rf_regs_5111[] = { 165static const struct ath5k_rf_reg rf_regs_5111[] = {
166 {2, AR5K_RF_TURBO, AR5K_RF5111_RF_TURBO},
161 {6, AR5K_RF_OB_2GHZ, AR5K_RF5111_OB_2GHZ}, 167 {6, AR5K_RF_OB_2GHZ, AR5K_RF5111_OB_2GHZ},
162 {6, AR5K_RF_DB_2GHZ, AR5K_RF5111_DB_2GHZ}, 168 {6, AR5K_RF_DB_2GHZ, AR5K_RF5111_DB_2GHZ},
163 {6, AR5K_RF_OB_5GHZ, AR5K_RF5111_OB_5GHZ}, 169 {6, AR5K_RF_OB_5GHZ, AR5K_RF5111_OB_5GHZ},
@@ -177,97 +183,52 @@ static const struct ath5k_rf_reg rf_regs_5111[] = {
177 183
178/* Default mode specific settings */ 184/* Default mode specific settings */
179static const struct ath5k_ini_rfbuffer rfb_5111[] = { 185static const struct ath5k_ini_rfbuffer rfb_5111[] = {
180 { 0, 0x989c, 186 /* BANK / C.R. A/XR B G */
181 /* mode a/XR mode aTurbo mode b mode g mode gTurbo */ 187 { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
182 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 188 { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
183 { 0, 0x989c, 189 { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
184 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 190 { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
185 { 0, 0x989c, 191 { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
186 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 192 { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
187 { 0, 0x989c, 193 { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
188 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 194 { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
189 { 0, 0x989c, 195 { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
190 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 196 { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
191 { 0, 0x989c, 197 { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
192 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 198 { 0, 0x989c, { 0x00380000, 0x00380000, 0x00380000 } },
193 { 0, 0x989c, 199 { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
194 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 200 { 0, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
195 { 0, 0x989c, 201 { 0, 0x989c, { 0x00000000, 0x000000c0, 0x00000080 } },
196 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 202 { 0, 0x989c, { 0x000400f9, 0x000400ff, 0x000400fd } },
197 { 0, 0x989c, 203 { 0, 0x98d4, { 0x00000000, 0x00000004, 0x00000004 } },
198 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 204 { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } },
199 { 0, 0x989c, 205 { 2, 0x98d4, { 0x00000010, 0x00000010, 0x00000010 } },
200 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 206 { 3, 0x98d8, { 0x00601068, 0x00601068, 0x00601068 } },
201 { 0, 0x989c, 207 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
202 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 208 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
203 { 0, 0x989c, 209 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
204 { 0x00380000, 0x00380000, 0x00380000, 0x00380000, 0x00380000 } }, 210 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
205 { 0, 0x989c, 211 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
206 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 212 { 6, 0x989c, { 0x10000000, 0x10000000, 0x10000000 } },
207 { 0, 0x989c, 213 { 6, 0x989c, { 0x04000000, 0x04000000, 0x04000000 } },
208 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 214 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
209 { 0, 0x989c, 215 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
210 { 0x00000000, 0x00000000, 0x000000c0, 0x00000080, 0x00000080 } }, 216 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
211 { 0, 0x989c, 217 { 6, 0x989c, { 0x00000000, 0x0a000000, 0x00000000 } },
212 { 0x000400f9, 0x000400f9, 0x000400ff, 0x000400fd, 0x000400fd } }, 218 { 6, 0x989c, { 0x003800c0, 0x023800c0, 0x003800c0 } },
213 { 0, 0x98d4, 219 { 6, 0x989c, { 0x00020006, 0x00000006, 0x00020006 } },
214 { 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000004 } }, 220 { 6, 0x989c, { 0x00000089, 0x00000089, 0x00000089 } },
215 { 1, 0x98d4, 221 { 6, 0x989c, { 0x000000a0, 0x000000a0, 0x000000a0 } },
216 { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, 222 { 6, 0x989c, { 0x00040007, 0x00040007, 0x00040007 } },
217 { 2, 0x98d4, 223 { 6, 0x98d4, { 0x0000001a, 0x0000001a, 0x0000001a } },
218 { 0x00000010, 0x00000014, 0x00000010, 0x00000010, 0x00000014 } }, 224 { 7, 0x989c, { 0x00000040, 0x00000040, 0x00000040 } },
219 { 3, 0x98d8, 225 { 7, 0x989c, { 0x00000010, 0x00000010, 0x00000010 } },
220 { 0x00601068, 0x00601068, 0x00601068, 0x00601068, 0x00601068 } }, 226 { 7, 0x989c, { 0x00000008, 0x00000008, 0x00000008 } },
221 { 6, 0x989c, 227 { 7, 0x989c, { 0x0000004f, 0x0000004f, 0x0000004f } },
222 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 228 { 7, 0x989c, { 0x000000f1, 0x00000061, 0x000000f1 } },
223 { 6, 0x989c, 229 { 7, 0x989c, { 0x0000904f, 0x0000904c, 0x0000904f } },
224 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 230 { 7, 0x989c, { 0x0000125a, 0x0000129a, 0x0000125a } },
225 { 6, 0x989c, 231 { 7, 0x98cc, { 0x0000000e, 0x0000000f, 0x0000000e } },
226 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
227 { 6, 0x989c,
228 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
229 { 6, 0x989c,
230 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
231 { 6, 0x989c,
232 { 0x10000000, 0x10000000, 0x10000000, 0x10000000, 0x10000000 } },
233 { 6, 0x989c,
234 { 0x04000000, 0x04000000, 0x04000000, 0x04000000, 0x04000000 } },
235 { 6, 0x989c,
236 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
237 { 6, 0x989c,
238 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
239 { 6, 0x989c,
240 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
241 { 6, 0x989c,
242 { 0x00000000, 0x00000000, 0x0a000000, 0x00000000, 0x00000000 } },
243 { 6, 0x989c,
244 { 0x003800c0, 0x00380080, 0x023800c0, 0x003800c0, 0x003800c0 } },
245 { 6, 0x989c,
246 { 0x00020006, 0x00020006, 0x00000006, 0x00020006, 0x00020006 } },
247 { 6, 0x989c,
248 { 0x00000089, 0x00000089, 0x00000089, 0x00000089, 0x00000089 } },
249 { 6, 0x989c,
250 { 0x000000a0, 0x000000a0, 0x000000a0, 0x000000a0, 0x000000a0 } },
251 { 6, 0x989c,
252 { 0x00040007, 0x00040007, 0x00040007, 0x00040007, 0x00040007 } },
253 { 6, 0x98d4,
254 { 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a } },
255 { 7, 0x989c,
256 { 0x00000040, 0x00000048, 0x00000040, 0x00000040, 0x00000040 } },
257 { 7, 0x989c,
258 { 0x00000010, 0x00000010, 0x00000010, 0x00000010, 0x00000010 } },
259 { 7, 0x989c,
260 { 0x00000008, 0x00000008, 0x00000008, 0x00000008, 0x00000008 } },
261 { 7, 0x989c,
262 { 0x0000004f, 0x0000004f, 0x0000004f, 0x0000004f, 0x0000004f } },
263 { 7, 0x989c,
264 { 0x000000f1, 0x000000f1, 0x00000061, 0x000000f1, 0x000000f1 } },
265 { 7, 0x989c,
266 { 0x0000904f, 0x0000904f, 0x0000904c, 0x0000904f, 0x0000904f } },
267 { 7, 0x989c,
268 { 0x0000125a, 0x0000125a, 0x0000129a, 0x0000125a, 0x0000125a } },
269 { 7, 0x98cc,
270 { 0x0000000e, 0x0000000e, 0x0000000f, 0x0000000e, 0x0000000e } },
271}; 232};
272 233
273 234
@@ -276,6 +237,9 @@ static const struct ath5k_ini_rfbuffer rfb_5111[] = {
276* RF5112/RF2112 (Derby) * 237* RF5112/RF2112 (Derby) *
277\***********************/ 238\***********************/
278 239
240/* BANK 2 (Common) len pos col */
241#define AR5K_RF5112X_RF_TURBO { 1, 1, 2 }
242
279/* BANK 7 (Common) len pos col */ 243/* BANK 7 (Common) len pos col */
280#define AR5K_RF5112X_GAIN_I { 6, 14, 0 } 244#define AR5K_RF5112X_GAIN_I { 6, 14, 0 }
281#define AR5K_RF5112X_MIXVGA_OVR { 1, 36, 0 } 245#define AR5K_RF5112X_MIXVGA_OVR { 1, 36, 0 }
@@ -307,6 +271,7 @@ static const struct ath5k_ini_rfbuffer rfb_5111[] = {
307#define AR5K_RF5112_PWD(_n) { 1, (302 - _n), 3 } 271#define AR5K_RF5112_PWD(_n) { 1, (302 - _n), 3 }
308 272
309static const struct ath5k_rf_reg rf_regs_5112[] = { 273static const struct ath5k_rf_reg rf_regs_5112[] = {
274 {2, AR5K_RF_TURBO, AR5K_RF5112X_RF_TURBO},
310 {6, AR5K_RF_OB_2GHZ, AR5K_RF5112_OB_2GHZ}, 275 {6, AR5K_RF_OB_2GHZ, AR5K_RF5112_OB_2GHZ},
311 {6, AR5K_RF_DB_2GHZ, AR5K_RF5112_DB_2GHZ}, 276 {6, AR5K_RF_DB_2GHZ, AR5K_RF5112_DB_2GHZ},
312 {6, AR5K_RF_OB_5GHZ, AR5K_RF5112_OB_5GHZ}, 277 {6, AR5K_RF_OB_5GHZ, AR5K_RF5112_OB_5GHZ},
@@ -335,115 +300,61 @@ static const struct ath5k_rf_reg rf_regs_5112[] = {
335 300
336/* Default mode specific settings */ 301/* Default mode specific settings */
337static const struct ath5k_ini_rfbuffer rfb_5112[] = { 302static const struct ath5k_ini_rfbuffer rfb_5112[] = {
338 { 1, 0x98d4, 303 /* BANK / C.R. A/XR B G */
339 /* mode a/XR mode aTurbo mode b mode g mode gTurbo */ 304 { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } },
340 { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, 305 { 2, 0x98d0, { 0x03060408, 0x03060408, 0x03060408 } },
341 { 2, 0x98d0, 306 { 3, 0x98dc, { 0x00a0c0c0, 0x00e0c0c0, 0x00e0c0c0 } },
342 { 0x03060408, 0x03070408, 0x03060408, 0x03060408, 0x03070408 } }, 307 { 6, 0x989c, { 0x00a00000, 0x00a00000, 0x00a00000 } },
343 { 3, 0x98dc, 308 { 6, 0x989c, { 0x000a0000, 0x000a0000, 0x000a0000 } },
344 { 0x00a0c0c0, 0x00a0c0c0, 0x00e0c0c0, 0x00e0c0c0, 0x00e0c0c0 } }, 309 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
345 { 6, 0x989c, 310 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
346 { 0x00a00000, 0x00a00000, 0x00a00000, 0x00a00000, 0x00a00000 } }, 311 { 6, 0x989c, { 0x00660000, 0x00660000, 0x00660000 } },
347 { 6, 0x989c, 312 { 6, 0x989c, { 0x00db0000, 0x00db0000, 0x00db0000 } },
348 { 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000 } }, 313 { 6, 0x989c, { 0x00f10000, 0x00f10000, 0x00f10000 } },
349 { 6, 0x989c, 314 { 6, 0x989c, { 0x00120000, 0x00120000, 0x00120000 } },
350 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 315 { 6, 0x989c, { 0x00120000, 0x00120000, 0x00120000 } },
351 { 6, 0x989c, 316 { 6, 0x989c, { 0x00730000, 0x00730000, 0x00730000 } },
352 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 317 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
353 { 6, 0x989c, 318 { 6, 0x989c, { 0x000c0000, 0x000c0000, 0x000c0000 } },
354 { 0x00660000, 0x00660000, 0x00660000, 0x00660000, 0x00660000 } }, 319 { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
355 { 6, 0x989c, 320 { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
356 { 0x00db0000, 0x00db0000, 0x00db0000, 0x00db0000, 0x00db0000 } }, 321 { 6, 0x989c, { 0x008b0000, 0x008b0000, 0x008b0000 } },
357 { 6, 0x989c, 322 { 6, 0x989c, { 0x00600000, 0x00600000, 0x00600000 } },
358 { 0x00f10000, 0x00f10000, 0x00f10000, 0x00f10000, 0x00f10000 } }, 323 { 6, 0x989c, { 0x000c0000, 0x000c0000, 0x000c0000 } },
359 { 6, 0x989c, 324 { 6, 0x989c, { 0x00840000, 0x00840000, 0x00840000 } },
360 { 0x00120000, 0x00120000, 0x00120000, 0x00120000, 0x00120000 } }, 325 { 6, 0x989c, { 0x00640000, 0x00640000, 0x00640000 } },
361 { 6, 0x989c, 326 { 6, 0x989c, { 0x00200000, 0x00200000, 0x00200000 } },
362 { 0x00120000, 0x00120000, 0x00120000, 0x00120000, 0x00120000 } }, 327 { 6, 0x989c, { 0x00240000, 0x00240000, 0x00240000 } },
363 { 6, 0x989c, 328 { 6, 0x989c, { 0x00250000, 0x00250000, 0x00250000 } },
364 { 0x00730000, 0x00730000, 0x00730000, 0x00730000, 0x00730000 } }, 329 { 6, 0x989c, { 0x00110000, 0x00110000, 0x00110000 } },
365 { 6, 0x989c, 330 { 6, 0x989c, { 0x00110000, 0x00110000, 0x00110000 } },
366 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 331 { 6, 0x989c, { 0x00510000, 0x00510000, 0x00510000 } },
367 { 6, 0x989c, 332 { 6, 0x989c, { 0x1c040000, 0x1c040000, 0x1c040000 } },
368 { 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000 } }, 333 { 6, 0x989c, { 0x000a0000, 0x000a0000, 0x000a0000 } },
369 { 6, 0x989c, 334 { 6, 0x989c, { 0x00a10000, 0x00a10000, 0x00a10000 } },
370 { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 335 { 6, 0x989c, { 0x00400000, 0x00400000, 0x00400000 } },
371 { 6, 0x989c, 336 { 6, 0x989c, { 0x03090000, 0x03090000, 0x03090000 } },
372 { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 337 { 6, 0x989c, { 0x06000000, 0x06000000, 0x06000000 } },
373 { 6, 0x989c, 338 { 6, 0x989c, { 0x000000b0, 0x000000a8, 0x000000a8 } },
374 { 0x008b0000, 0x008b0000, 0x008b0000, 0x008b0000, 0x008b0000 } }, 339 { 6, 0x989c, { 0x0000002e, 0x0000002e, 0x0000002e } },
375 { 6, 0x989c, 340 { 6, 0x989c, { 0x006c4a41, 0x006c4af1, 0x006c4a61 } },
376 { 0x00600000, 0x00600000, 0x00600000, 0x00600000, 0x00600000 } }, 341 { 6, 0x989c, { 0x0050892a, 0x0050892b, 0x0050892b } },
377 { 6, 0x989c, 342 { 6, 0x989c, { 0x00842400, 0x00842400, 0x00842400 } },
378 { 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000 } }, 343 { 6, 0x989c, { 0x00c69200, 0x00c69200, 0x00c69200 } },
379 { 6, 0x989c, 344 { 6, 0x98d0, { 0x0002000c, 0x0002000c, 0x0002000c } },
380 { 0x00840000, 0x00840000, 0x00840000, 0x00840000, 0x00840000 } }, 345 { 7, 0x989c, { 0x00000094, 0x00000094, 0x00000094 } },
381 { 6, 0x989c, 346 { 7, 0x989c, { 0x00000091, 0x00000091, 0x00000091 } },
382 { 0x00640000, 0x00640000, 0x00640000, 0x00640000, 0x00640000 } }, 347 { 7, 0x989c, { 0x0000000a, 0x00000012, 0x00000012 } },
383 { 6, 0x989c, 348 { 7, 0x989c, { 0x00000080, 0x00000080, 0x00000080 } },
384 { 0x00200000, 0x00200000, 0x00200000, 0x00200000, 0x00200000 } }, 349 { 7, 0x989c, { 0x000000c1, 0x000000c1, 0x000000c1 } },
385 { 6, 0x989c, 350 { 7, 0x989c, { 0x00000060, 0x00000060, 0x00000060 } },
386 { 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0x00240000 } }, 351 { 7, 0x989c, { 0x000000f0, 0x000000f0, 0x000000f0 } },
387 { 6, 0x989c, 352 { 7, 0x989c, { 0x00000022, 0x00000022, 0x00000022 } },
388 { 0x00250000, 0x00250000, 0x00250000, 0x00250000, 0x00250000 } }, 353 { 7, 0x989c, { 0x00000092, 0x00000092, 0x00000092 } },
389 { 6, 0x989c, 354 { 7, 0x989c, { 0x000000d4, 0x000000d4, 0x000000d4 } },
390 { 0x00110000, 0x00110000, 0x00110000, 0x00110000, 0x00110000 } }, 355 { 7, 0x989c, { 0x000014cc, 0x000014cc, 0x000014cc } },
391 { 6, 0x989c, 356 { 7, 0x989c, { 0x0000048c, 0x0000048c, 0x0000048c } },
392 { 0x00110000, 0x00110000, 0x00110000, 0x00110000, 0x00110000 } }, 357 { 7, 0x98c4, { 0x00000003, 0x00000003, 0x00000003 } },
393 { 6, 0x989c,
394 { 0x00510000, 0x00510000, 0x00510000, 0x00510000, 0x00510000 } },
395 { 6, 0x989c,
396 { 0x1c040000, 0x1c040000, 0x1c040000, 0x1c040000, 0x1c040000 } },
397 { 6, 0x989c,
398 { 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000 } },
399 { 6, 0x989c,
400 { 0x00a10000, 0x00a10000, 0x00a10000, 0x00a10000, 0x00a10000 } },
401 { 6, 0x989c,
402 { 0x00400000, 0x00400000, 0x00400000, 0x00400000, 0x00400000 } },
403 { 6, 0x989c,
404 { 0x03090000, 0x03090000, 0x03090000, 0x03090000, 0x03090000 } },
405 { 6, 0x989c,
406 { 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000 } },
407 { 6, 0x989c,
408 { 0x000000b0, 0x000000b0, 0x000000a8, 0x000000a8, 0x000000a8 } },
409 { 6, 0x989c,
410 { 0x0000002e, 0x0000002e, 0x0000002e, 0x0000002e, 0x0000002e } },
411 { 6, 0x989c,
412 { 0x006c4a41, 0x006c4a41, 0x006c4af1, 0x006c4a61, 0x006c4a61 } },
413 { 6, 0x989c,
414 { 0x0050892a, 0x0050892a, 0x0050892b, 0x0050892b, 0x0050892b } },
415 { 6, 0x989c,
416 { 0x00842400, 0x00842400, 0x00842400, 0x00842400, 0x00842400 } },
417 { 6, 0x989c,
418 { 0x00c69200, 0x00c69200, 0x00c69200, 0x00c69200, 0x00c69200 } },
419 { 6, 0x98d0,
420 { 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c } },
421 { 7, 0x989c,
422 { 0x00000094, 0x00000094, 0x00000094, 0x00000094, 0x00000094 } },
423 { 7, 0x989c,
424 { 0x00000091, 0x00000091, 0x00000091, 0x00000091, 0x00000091 } },
425 { 7, 0x989c,
426 { 0x0000000a, 0x0000000a, 0x00000012, 0x00000012, 0x00000012 } },
427 { 7, 0x989c,
428 { 0x00000080, 0x00000080, 0x00000080, 0x00000080, 0x00000080 } },
429 { 7, 0x989c,
430 { 0x000000c1, 0x000000c1, 0x000000c1, 0x000000c1, 0x000000c1 } },
431 { 7, 0x989c,
432 { 0x00000060, 0x00000060, 0x00000060, 0x00000060, 0x00000060 } },
433 { 7, 0x989c,
434 { 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0 } },
435 { 7, 0x989c,
436 { 0x00000022, 0x00000022, 0x00000022, 0x00000022, 0x00000022 } },
437 { 7, 0x989c,
438 { 0x00000092, 0x00000092, 0x00000092, 0x00000092, 0x00000092 } },
439 { 7, 0x989c,
440 { 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4 } },
441 { 7, 0x989c,
442 { 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc } },
443 { 7, 0x989c,
444 { 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c } },
445 { 7, 0x98c4,
446 { 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003 } },
447}; 358};
448 359
449/* RFX112A (Derby 2) */ 360/* RFX112A (Derby 2) */
@@ -477,6 +388,7 @@ static const struct ath5k_ini_rfbuffer rfb_5112[] = {
477#define AR5K_RF5112A_XB5_LVL { 2, 3, 3 } 388#define AR5K_RF5112A_XB5_LVL { 2, 3, 3 }
478 389
479static const struct ath5k_rf_reg rf_regs_5112a[] = { 390static const struct ath5k_rf_reg rf_regs_5112a[] = {
391 {2, AR5K_RF_TURBO, AR5K_RF5112X_RF_TURBO},
480 {6, AR5K_RF_OB_2GHZ, AR5K_RF5112A_OB_2GHZ}, 392 {6, AR5K_RF_OB_2GHZ, AR5K_RF5112A_OB_2GHZ},
481 {6, AR5K_RF_DB_2GHZ, AR5K_RF5112A_DB_2GHZ}, 393 {6, AR5K_RF_DB_2GHZ, AR5K_RF5112A_DB_2GHZ},
482 {6, AR5K_RF_OB_5GHZ, AR5K_RF5112A_OB_5GHZ}, 394 {6, AR5K_RF_OB_5GHZ, AR5K_RF5112A_OB_5GHZ},
@@ -515,119 +427,63 @@ static const struct ath5k_rf_reg rf_regs_5112a[] = {
515 427
516/* Default mode specific settings */ 428/* Default mode specific settings */
517static const struct ath5k_ini_rfbuffer rfb_5112a[] = { 429static const struct ath5k_ini_rfbuffer rfb_5112a[] = {
518 { 1, 0x98d4, 430 /* BANK / C.R. A/XR B G */
519 /* mode a/XR mode aTurbo mode b mode g mode gTurbo */ 431 { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } },
520 { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, 432 { 2, 0x98d0, { 0x03060408, 0x03060408, 0x03060408 } },
521 { 2, 0x98d0, 433 { 3, 0x98dc, { 0x00a020c0, 0x00e020c0, 0x00e020c0 } },
522 { 0x03060408, 0x03070408, 0x03060408, 0x03060408, 0x03070408 } }, 434 { 6, 0x989c, { 0x0f000000, 0x0f000000, 0x0f000000 } },
523 { 3, 0x98dc, 435 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
524 { 0x00a020c0, 0x00a020c0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } }, 436 { 6, 0x989c, { 0x00800000, 0x00800000, 0x00800000 } },
525 { 6, 0x989c, 437 { 6, 0x989c, { 0x002a0000, 0x002a0000, 0x002a0000 } },
526 { 0x0f000000, 0x0f000000, 0x0f000000, 0x0f000000, 0x0f000000 } }, 438 { 6, 0x989c, { 0x00010000, 0x00010000, 0x00010000 } },
527 { 6, 0x989c, 439 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
528 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 440 { 6, 0x989c, { 0x00180000, 0x00180000, 0x00180000 } },
529 { 6, 0x989c, 441 { 6, 0x989c, { 0x00600000, 0x006e0000, 0x006e0000 } },
530 { 0x00800000, 0x00800000, 0x00800000, 0x00800000, 0x00800000 } }, 442 { 6, 0x989c, { 0x00c70000, 0x00c70000, 0x00c70000 } },
531 { 6, 0x989c, 443 { 6, 0x989c, { 0x004b0000, 0x004b0000, 0x004b0000 } },
532 { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } }, 444 { 6, 0x989c, { 0x04480000, 0x04480000, 0x04480000 } },
533 { 6, 0x989c, 445 { 6, 0x989c, { 0x004c0000, 0x004c0000, 0x004c0000 } },
534 { 0x00010000, 0x00010000, 0x00010000, 0x00010000, 0x00010000 } }, 446 { 6, 0x989c, { 0x00e40000, 0x00e40000, 0x00e40000 } },
535 { 6, 0x989c, 447 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
536 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 448 { 6, 0x989c, { 0x00fc0000, 0x00fc0000, 0x00fc0000 } },
537 { 6, 0x989c, 449 { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
538 { 0x00180000, 0x00180000, 0x00180000, 0x00180000, 0x00180000 } }, 450 { 6, 0x989c, { 0x043f0000, 0x043f0000, 0x043f0000 } },
539 { 6, 0x989c, 451 { 6, 0x989c, { 0x000c0000, 0x000c0000, 0x000c0000 } },
540 { 0x00600000, 0x00600000, 0x006e0000, 0x006e0000, 0x006e0000 } }, 452 { 6, 0x989c, { 0x02190000, 0x02190000, 0x02190000 } },
541 { 6, 0x989c, 453 { 6, 0x989c, { 0x00240000, 0x00240000, 0x00240000 } },
542 { 0x00c70000, 0x00c70000, 0x00c70000, 0x00c70000, 0x00c70000 } }, 454 { 6, 0x989c, { 0x00b40000, 0x00b40000, 0x00b40000 } },
543 { 6, 0x989c, 455 { 6, 0x989c, { 0x00990000, 0x00990000, 0x00990000 } },
544 { 0x004b0000, 0x004b0000, 0x004b0000, 0x004b0000, 0x004b0000 } }, 456 { 6, 0x989c, { 0x00500000, 0x00500000, 0x00500000 } },
545 { 6, 0x989c, 457 { 6, 0x989c, { 0x002a0000, 0x002a0000, 0x002a0000 } },
546 { 0x04480000, 0x04480000, 0x04480000, 0x04480000, 0x04480000 } }, 458 { 6, 0x989c, { 0x00120000, 0x00120000, 0x00120000 } },
547 { 6, 0x989c, 459 { 6, 0x989c, { 0xc0320000, 0xc0320000, 0xc0320000 } },
548 { 0x004c0000, 0x004c0000, 0x004c0000, 0x004c0000, 0x004c0000 } }, 460 { 6, 0x989c, { 0x01740000, 0x01740000, 0x01740000 } },
549 { 6, 0x989c, 461 { 6, 0x989c, { 0x00110000, 0x00110000, 0x00110000 } },
550 { 0x00e40000, 0x00e40000, 0x00e40000, 0x00e40000, 0x00e40000 } }, 462 { 6, 0x989c, { 0x86280000, 0x86280000, 0x86280000 } },
551 { 6, 0x989c, 463 { 6, 0x989c, { 0x31840000, 0x31840000, 0x31840000 } },
552 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 464 { 6, 0x989c, { 0x00f20080, 0x00f20080, 0x00f20080 } },
553 { 6, 0x989c, 465 { 6, 0x989c, { 0x00270019, 0x00270019, 0x00270019 } },
554 { 0x00fc0000, 0x00fc0000, 0x00fc0000, 0x00fc0000, 0x00fc0000 } }, 466 { 6, 0x989c, { 0x00000003, 0x00000003, 0x00000003 } },
555 { 6, 0x989c, 467 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
556 { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 468 { 6, 0x989c, { 0x000000b2, 0x000000b2, 0x000000b2 } },
557 { 6, 0x989c, 469 { 6, 0x989c, { 0x00b02084, 0x00b02084, 0x00b02084 } },
558 { 0x043f0000, 0x043f0000, 0x043f0000, 0x043f0000, 0x043f0000 } }, 470 { 6, 0x989c, { 0x004125a4, 0x004125a4, 0x004125a4 } },
559 { 6, 0x989c, 471 { 6, 0x989c, { 0x00119220, 0x00119220, 0x00119220 } },
560 { 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000 } }, 472 { 6, 0x989c, { 0x001a4800, 0x001a4800, 0x001a4800 } },
561 { 6, 0x989c, 473 { 6, 0x98d8, { 0x000b0230, 0x000b0230, 0x000b0230 } },
562 { 0x02190000, 0x02190000, 0x02190000, 0x02190000, 0x02190000 } }, 474 { 7, 0x989c, { 0x00000094, 0x00000094, 0x00000094 } },
563 { 6, 0x989c, 475 { 7, 0x989c, { 0x00000091, 0x00000091, 0x00000091 } },
564 { 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0x00240000 } }, 476 { 7, 0x989c, { 0x00000012, 0x00000012, 0x00000012 } },
565 { 6, 0x989c, 477 { 7, 0x989c, { 0x00000080, 0x00000080, 0x00000080 } },
566 { 0x00b40000, 0x00b40000, 0x00b40000, 0x00b40000, 0x00b40000 } }, 478 { 7, 0x989c, { 0x000000d9, 0x000000d9, 0x000000d9 } },
567 { 6, 0x989c, 479 { 7, 0x989c, { 0x00000060, 0x00000060, 0x00000060 } },
568 { 0x00990000, 0x00990000, 0x00990000, 0x00990000, 0x00990000 } }, 480 { 7, 0x989c, { 0x000000f0, 0x000000f0, 0x000000f0 } },
569 { 6, 0x989c, 481 { 7, 0x989c, { 0x000000a2, 0x000000a2, 0x000000a2 } },
570 { 0x00500000, 0x00500000, 0x00500000, 0x00500000, 0x00500000 } }, 482 { 7, 0x989c, { 0x00000052, 0x00000052, 0x00000052 } },
571 { 6, 0x989c, 483 { 7, 0x989c, { 0x000000d4, 0x000000d4, 0x000000d4 } },
572 { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } }, 484 { 7, 0x989c, { 0x000014cc, 0x000014cc, 0x000014cc } },
573 { 6, 0x989c, 485 { 7, 0x989c, { 0x0000048c, 0x0000048c, 0x0000048c } },
574 { 0x00120000, 0x00120000, 0x00120000, 0x00120000, 0x00120000 } }, 486 { 7, 0x98c4, { 0x00000003, 0x00000003, 0x00000003 } },
575 { 6, 0x989c,
576 { 0xc0320000, 0xc0320000, 0xc0320000, 0xc0320000, 0xc0320000 } },
577 { 6, 0x989c,
578 { 0x01740000, 0x01740000, 0x01740000, 0x01740000, 0x01740000 } },
579 { 6, 0x989c,
580 { 0x00110000, 0x00110000, 0x00110000, 0x00110000, 0x00110000 } },
581 { 6, 0x989c,
582 { 0x86280000, 0x86280000, 0x86280000, 0x86280000, 0x86280000 } },
583 { 6, 0x989c,
584 { 0x31840000, 0x31840000, 0x31840000, 0x31840000, 0x31840000 } },
585 { 6, 0x989c,
586 { 0x00f20080, 0x00f20080, 0x00f20080, 0x00f20080, 0x00f20080 } },
587 { 6, 0x989c,
588 { 0x00270019, 0x00270019, 0x00270019, 0x00270019, 0x00270019 } },
589 { 6, 0x989c,
590 { 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003 } },
591 { 6, 0x989c,
592 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
593 { 6, 0x989c,
594 { 0x000000b2, 0x000000b2, 0x000000b2, 0x000000b2, 0x000000b2 } },
595 { 6, 0x989c,
596 { 0x00b02084, 0x00b02084, 0x00b02084, 0x00b02084, 0x00b02084 } },
597 { 6, 0x989c,
598 { 0x004125a4, 0x004125a4, 0x004125a4, 0x004125a4, 0x004125a4 } },
599 { 6, 0x989c,
600 { 0x00119220, 0x00119220, 0x00119220, 0x00119220, 0x00119220 } },
601 { 6, 0x989c,
602 { 0x001a4800, 0x001a4800, 0x001a4800, 0x001a4800, 0x001a4800 } },
603 { 6, 0x98d8,
604 { 0x000b0230, 0x000b0230, 0x000b0230, 0x000b0230, 0x000b0230 } },
605 { 7, 0x989c,
606 { 0x00000094, 0x00000094, 0x00000094, 0x00000094, 0x00000094 } },
607 { 7, 0x989c,
608 { 0x00000091, 0x00000091, 0x00000091, 0x00000091, 0x00000091 } },
609 { 7, 0x989c,
610 { 0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012 } },
611 { 7, 0x989c,
612 { 0x00000080, 0x00000080, 0x00000080, 0x00000080, 0x00000080 } },
613 { 7, 0x989c,
614 { 0x000000d9, 0x000000d9, 0x000000d9, 0x000000d9, 0x000000d9 } },
615 { 7, 0x989c,
616 { 0x00000060, 0x00000060, 0x00000060, 0x00000060, 0x00000060 } },
617 { 7, 0x989c,
618 { 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0 } },
619 { 7, 0x989c,
620 { 0x000000a2, 0x000000a2, 0x000000a2, 0x000000a2, 0x000000a2 } },
621 { 7, 0x989c,
622 { 0x00000052, 0x00000052, 0x00000052, 0x00000052, 0x00000052 } },
623 { 7, 0x989c,
624 { 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4 } },
625 { 7, 0x989c,
626 { 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc } },
627 { 7, 0x989c,
628 { 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c } },
629 { 7, 0x98c4,
630 { 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003 } },
631}; 487};
632 488
633 489
@@ -636,11 +492,15 @@ static const struct ath5k_ini_rfbuffer rfb_5112a[] = {
636* RF2413 (Griffin) * 492* RF2413 (Griffin) *
637\******************/ 493\******************/
638 494
495/* BANK 2 len pos col */
496#define AR5K_RF2413_RF_TURBO { 1, 1, 2 }
497
639/* BANK 6 len pos col */ 498/* BANK 6 len pos col */
640#define AR5K_RF2413_OB_2GHZ { 3, 168, 0 } 499#define AR5K_RF2413_OB_2GHZ { 3, 168, 0 }
641#define AR5K_RF2413_DB_2GHZ { 3, 165, 0 } 500#define AR5K_RF2413_DB_2GHZ { 3, 165, 0 }
642 501
643static const struct ath5k_rf_reg rf_regs_2413[] = { 502static const struct ath5k_rf_reg rf_regs_2413[] = {
503 {2, AR5K_RF_TURBO, AR5K_RF2413_RF_TURBO},
644 {6, AR5K_RF_OB_2GHZ, AR5K_RF2413_OB_2GHZ}, 504 {6, AR5K_RF_OB_2GHZ, AR5K_RF2413_OB_2GHZ},
645 {6, AR5K_RF_DB_2GHZ, AR5K_RF2413_DB_2GHZ}, 505 {6, AR5K_RF_DB_2GHZ, AR5K_RF2413_DB_2GHZ},
646}; 506};
@@ -649,73 +509,40 @@ static const struct ath5k_rf_reg rf_regs_2413[] = {
649 * XXX: a/aTurbo ??? 509 * XXX: a/aTurbo ???
650 */ 510 */
651static const struct ath5k_ini_rfbuffer rfb_2413[] = { 511static const struct ath5k_ini_rfbuffer rfb_2413[] = {
652 { 1, 0x98d4, 512 /* BANK / C.R. A/XR B G */
653 /* mode a/XR mode aTurbo mode b mode g mode gTurbo */ 513 { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } },
654 { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, 514 { 2, 0x98d0, { 0x02001408, 0x02001408, 0x02001408 } },
655 { 2, 0x98d0, 515 { 3, 0x98dc, { 0x00a020c0, 0x00e020c0, 0x00e020c0 } },
656 { 0x02001408, 0x02011408, 0x02001408, 0x02001408, 0x02011408 } }, 516 { 6, 0x989c, { 0xf0000000, 0xf0000000, 0xf0000000 } },
657 { 3, 0x98dc, 517 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
658 { 0x00a020c0, 0x00a020c0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } }, 518 { 6, 0x989c, { 0x03000000, 0x03000000, 0x03000000 } },
659 { 6, 0x989c, 519 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
660 { 0xf0000000, 0xf0000000, 0xf0000000, 0xf0000000, 0xf0000000 } }, 520 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
661 { 6, 0x989c, 521 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
662 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 522 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
663 { 6, 0x989c, 523 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
664 { 0x03000000, 0x03000000, 0x03000000, 0x03000000, 0x03000000 } }, 524 { 6, 0x989c, { 0x40400000, 0x40400000, 0x40400000 } },
665 { 6, 0x989c, 525 { 6, 0x989c, { 0x65050000, 0x65050000, 0x65050000 } },
666 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 526 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
667 { 6, 0x989c, 527 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
668 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 528 { 6, 0x989c, { 0x00420000, 0x00420000, 0x00420000 } },
669 { 6, 0x989c, 529 { 6, 0x989c, { 0x00b50000, 0x00b50000, 0x00b50000 } },
670 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 530 { 6, 0x989c, { 0x00030000, 0x00030000, 0x00030000 } },
671 { 6, 0x989c, 531 { 6, 0x989c, { 0x00f70000, 0x00f70000, 0x00f70000 } },
672 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 532 { 6, 0x989c, { 0x009d0000, 0x009d0000, 0x009d0000 } },
673 { 6, 0x989c, 533 { 6, 0x989c, { 0x00220000, 0x00220000, 0x00220000 } },
674 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 534 { 6, 0x989c, { 0x04220000, 0x04220000, 0x04220000 } },
675 { 6, 0x989c, 535 { 6, 0x989c, { 0x00230018, 0x00230018, 0x00230018 } },
676 { 0x40400000, 0x40400000, 0x40400000, 0x40400000, 0x40400000 } }, 536 { 6, 0x989c, { 0x00280000, 0x00280060, 0x00280060 } },
677 { 6, 0x989c, 537 { 6, 0x989c, { 0x005000c0, 0x005000c3, 0x005000c3 } },
678 { 0x65050000, 0x65050000, 0x65050000, 0x65050000, 0x65050000 } }, 538 { 6, 0x989c, { 0x0004007f, 0x0004007f, 0x0004007f } },
679 { 6, 0x989c, 539 { 6, 0x989c, { 0x00000458, 0x00000458, 0x00000458 } },
680 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 540 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
681 { 6, 0x989c, 541 { 6, 0x989c, { 0x0000c000, 0x0000c000, 0x0000c000 } },
682 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 542 { 6, 0x98d8, { 0x00400230, 0x00400230, 0x00400230 } },
683 { 6, 0x989c, 543 { 7, 0x989c, { 0x00006400, 0x00006400, 0x00006400 } },
684 { 0x00420000, 0x00420000, 0x00420000, 0x00420000, 0x00420000 } }, 544 { 7, 0x989c, { 0x00000800, 0x00000800, 0x00000800 } },
685 { 6, 0x989c, 545 { 7, 0x98cc, { 0x0000000e, 0x0000000e, 0x0000000e } },
686 { 0x00b50000, 0x00b50000, 0x00b50000, 0x00b50000, 0x00b50000 } },
687 { 6, 0x989c,
688 { 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000 } },
689 { 6, 0x989c,
690 { 0x00f70000, 0x00f70000, 0x00f70000, 0x00f70000, 0x00f70000 } },
691 { 6, 0x989c,
692 { 0x009d0000, 0x009d0000, 0x009d0000, 0x009d0000, 0x009d0000 } },
693 { 6, 0x989c,
694 { 0x00220000, 0x00220000, 0x00220000, 0x00220000, 0x00220000 } },
695 { 6, 0x989c,
696 { 0x04220000, 0x04220000, 0x04220000, 0x04220000, 0x04220000 } },
697 { 6, 0x989c,
698 { 0x00230018, 0x00230018, 0x00230018, 0x00230018, 0x00230018 } },
699 { 6, 0x989c,
700 { 0x00280000, 0x00280000, 0x00280060, 0x00280060, 0x00280060 } },
701 { 6, 0x989c,
702 { 0x005000c0, 0x005000c0, 0x005000c3, 0x005000c3, 0x005000c3 } },
703 { 6, 0x989c,
704 { 0x0004007f, 0x0004007f, 0x0004007f, 0x0004007f, 0x0004007f } },
705 { 6, 0x989c,
706 { 0x00000458, 0x00000458, 0x00000458, 0x00000458, 0x00000458 } },
707 { 6, 0x989c,
708 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
709 { 6, 0x989c,
710 { 0x0000c000, 0x0000c000, 0x0000c000, 0x0000c000, 0x0000c000 } },
711 { 6, 0x98d8,
712 { 0x00400230, 0x00400230, 0x00400230, 0x00400230, 0x00400230 } },
713 { 7, 0x989c,
714 { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } },
715 { 7, 0x989c,
716 { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } },
717 { 7, 0x98cc,
718 { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } },
719}; 546};
720 547
721 548
@@ -724,88 +551,57 @@ static const struct ath5k_ini_rfbuffer rfb_2413[] = {
724* RF2315/RF2316 (Cobra SoC) * 551* RF2315/RF2316 (Cobra SoC) *
725\***************************/ 552\***************************/
726 553
554/* BANK 2 len pos col */
555#define AR5K_RF2316_RF_TURBO { 1, 1, 2 }
556
727/* BANK 6 len pos col */ 557/* BANK 6 len pos col */
728#define AR5K_RF2316_OB_2GHZ { 3, 178, 0 } 558#define AR5K_RF2316_OB_2GHZ { 3, 178, 0 }
729#define AR5K_RF2316_DB_2GHZ { 3, 175, 0 } 559#define AR5K_RF2316_DB_2GHZ { 3, 175, 0 }
730 560
731static const struct ath5k_rf_reg rf_regs_2316[] = { 561static const struct ath5k_rf_reg rf_regs_2316[] = {
562 {2, AR5K_RF_TURBO, AR5K_RF2316_RF_TURBO},
732 {6, AR5K_RF_OB_2GHZ, AR5K_RF2316_OB_2GHZ}, 563 {6, AR5K_RF_OB_2GHZ, AR5K_RF2316_OB_2GHZ},
733 {6, AR5K_RF_DB_2GHZ, AR5K_RF2316_DB_2GHZ}, 564 {6, AR5K_RF_DB_2GHZ, AR5K_RF2316_DB_2GHZ},
734}; 565};
735 566
736/* Default mode specific settings */ 567/* Default mode specific settings */
737static const struct ath5k_ini_rfbuffer rfb_2316[] = { 568static const struct ath5k_ini_rfbuffer rfb_2316[] = {
738 { 1, 0x98d4, 569 /* BANK / C.R. A/XR B G */
739 /* mode a/XR mode aTurbo mode b mode g mode gTurbo */ 570 { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } },
740 { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, 571 { 2, 0x98d0, { 0x02001408, 0x02001408, 0x02001408 } },
741 { 2, 0x98d0, 572 { 3, 0x98dc, { 0x00a020c0, 0x00e020c0, 0x00e020c0 } },
742 { 0x02001408, 0x02011408, 0x02001408, 0x02001408, 0x02011408 } }, 573 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
743 { 3, 0x98dc, 574 { 6, 0x989c, { 0xc0000000, 0xc0000000, 0xc0000000 } },
744 { 0x00a020c0, 0x00a020c0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } }, 575 { 6, 0x989c, { 0x0f000000, 0x0f000000, 0x0f000000 } },
745 { 6, 0x989c, 576 { 6, 0x989c, { 0x02000000, 0x02000000, 0x02000000 } },
746 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 577 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
747 { 6, 0x989c, 578 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
748 { 0xc0000000, 0xc0000000, 0xc0000000, 0xc0000000, 0xc0000000 } }, 579 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
749 { 6, 0x989c, 580 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
750 { 0x0f000000, 0x0f000000, 0x0f000000, 0x0f000000, 0x0f000000 } }, 581 { 6, 0x989c, { 0xf8000000, 0xf8000000, 0xf8000000 } },
751 { 6, 0x989c, 582 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
752 { 0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000 } }, 583 { 6, 0x989c, { 0x95150000, 0x95150000, 0x95150000 } },
753 { 6, 0x989c, 584 { 6, 0x989c, { 0xc1000000, 0xc1000000, 0xc1000000 } },
754 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 585 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
755 { 6, 0x989c, 586 { 6, 0x989c, { 0x00080000, 0x00080000, 0x00080000 } },
756 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 587 { 6, 0x989c, { 0x00d50000, 0x00d50000, 0x00d50000 } },
757 { 6, 0x989c, 588 { 6, 0x989c, { 0x000e0000, 0x000e0000, 0x000e0000 } },
758 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 589 { 6, 0x989c, { 0x00dc0000, 0x00dc0000, 0x00dc0000 } },
759 { 6, 0x989c, 590 { 6, 0x989c, { 0x00770000, 0x00770000, 0x00770000 } },
760 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 591 { 6, 0x989c, { 0x008a0000, 0x008a0000, 0x008a0000 } },
761 { 6, 0x989c, 592 { 6, 0x989c, { 0x10880000, 0x10880000, 0x10880000 } },
762 { 0xf8000000, 0xf8000000, 0xf8000000, 0xf8000000, 0xf8000000 } }, 593 { 6, 0x989c, { 0x008c0060, 0x008c0060, 0x008c0060 } },
763 { 6, 0x989c, 594 { 6, 0x989c, { 0x00a00000, 0x00a00080, 0x00a00080 } },
764 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 595 { 6, 0x989c, { 0x00400000, 0x0040000d, 0x0040000d } },
765 { 6, 0x989c, 596 { 6, 0x989c, { 0x00110400, 0x00110400, 0x00110400 } },
766 { 0x95150000, 0x95150000, 0x95150000, 0x95150000, 0x95150000 } }, 597 { 6, 0x989c, { 0x00000060, 0x00000060, 0x00000060 } },
767 { 6, 0x989c, 598 { 6, 0x989c, { 0x00000001, 0x00000001, 0x00000001 } },
768 { 0xc1000000, 0xc1000000, 0xc1000000, 0xc1000000, 0xc1000000 } }, 599 { 6, 0x989c, { 0x00000b00, 0x00000b00, 0x00000b00 } },
769 { 6, 0x989c, 600 { 6, 0x989c, { 0x00000be8, 0x00000be8, 0x00000be8 } },
770 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 601 { 6, 0x98c0, { 0x00010000, 0x00010000, 0x00010000 } },
771 { 6, 0x989c, 602 { 7, 0x989c, { 0x00006400, 0x00006400, 0x00006400 } },
772 { 0x00080000, 0x00080000, 0x00080000, 0x00080000, 0x00080000 } }, 603 { 7, 0x989c, { 0x00000800, 0x00000800, 0x00000800 } },
773 { 6, 0x989c, 604 { 7, 0x98cc, { 0x0000000e, 0x0000000e, 0x0000000e } },
774 { 0x00d50000, 0x00d50000, 0x00d50000, 0x00d50000, 0x00d50000 } },
775 { 6, 0x989c,
776 { 0x000e0000, 0x000e0000, 0x000e0000, 0x000e0000, 0x000e0000 } },
777 { 6, 0x989c,
778 { 0x00dc0000, 0x00dc0000, 0x00dc0000, 0x00dc0000, 0x00dc0000 } },
779 { 6, 0x989c,
780 { 0x00770000, 0x00770000, 0x00770000, 0x00770000, 0x00770000 } },
781 { 6, 0x989c,
782 { 0x008a0000, 0x008a0000, 0x008a0000, 0x008a0000, 0x008a0000 } },
783 { 6, 0x989c,
784 { 0x10880000, 0x10880000, 0x10880000, 0x10880000, 0x10880000 } },
785 { 6, 0x989c,
786 { 0x008c0060, 0x008c0060, 0x008c0060, 0x008c0060, 0x008c0060 } },
787 { 6, 0x989c,
788 { 0x00a00000, 0x00a00000, 0x00a00080, 0x00a00080, 0x00a00080 } },
789 { 6, 0x989c,
790 { 0x00400000, 0x00400000, 0x0040000d, 0x0040000d, 0x0040000d } },
791 { 6, 0x989c,
792 { 0x00110400, 0x00110400, 0x00110400, 0x00110400, 0x00110400 } },
793 { 6, 0x989c,
794 { 0x00000060, 0x00000060, 0x00000060, 0x00000060, 0x00000060 } },
795 { 6, 0x989c,
796 { 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001 } },
797 { 6, 0x989c,
798 { 0x00000b00, 0x00000b00, 0x00000b00, 0x00000b00, 0x00000b00 } },
799 { 6, 0x989c,
800 { 0x00000be8, 0x00000be8, 0x00000be8, 0x00000be8, 0x00000be8 } },
801 { 6, 0x98c0,
802 { 0x00010000, 0x00010000, 0x00010000, 0x00010000, 0x00010000 } },
803 { 7, 0x989c,
804 { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } },
805 { 7, 0x989c,
806 { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } },
807 { 7, 0x98cc,
808 { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } },
809}; 605};
810 606
811 607
@@ -835,93 +631,50 @@ static const struct ath5k_rf_reg rf_regs_5413[] = {
835 631
836/* Default mode specific settings */ 632/* Default mode specific settings */
837static const struct ath5k_ini_rfbuffer rfb_5413[] = { 633static const struct ath5k_ini_rfbuffer rfb_5413[] = {
838 { 1, 0x98d4, 634 /* BANK / C.R. A/XR B G */
839 /* mode a/XR mode aTurbo mode b mode g mode gTurbo */ 635 { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } },
840 { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, 636 { 2, 0x98d0, { 0x00000008, 0x00000008, 0x00000008 } },
841 { 2, 0x98d0, 637 { 3, 0x98dc, { 0x00a000c0, 0x00e000c0, 0x00e000c0 } },
842 { 0x00000008, 0x00000008, 0x00000008, 0x00000008, 0x00000008 } }, 638 { 6, 0x989c, { 0x33000000, 0x33000000, 0x33000000 } },
843 { 3, 0x98dc, 639 { 6, 0x989c, { 0x01000000, 0x01000000, 0x01000000 } },
844 { 0x00a000c0, 0x00a000c0, 0x00e000c0, 0x00e000c0, 0x00e000c0 } }, 640 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
845 { 6, 0x989c, 641 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
846 { 0x33000000, 0x33000000, 0x33000000, 0x33000000, 0x33000000 } }, 642 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
847 { 6, 0x989c, 643 { 6, 0x989c, { 0x1f000000, 0x1f000000, 0x1f000000 } },
848 { 0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000 } }, 644 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
849 { 6, 0x989c, 645 { 6, 0x989c, { 0x00b80000, 0x00b80000, 0x00b80000 } },
850 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 646 { 6, 0x989c, { 0x00b70000, 0x00b70000, 0x00b70000 } },
851 { 6, 0x989c, 647 { 6, 0x989c, { 0x00840000, 0x00840000, 0x00840000 } },
852 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 648 { 6, 0x989c, { 0x00980000, 0x00980000, 0x00980000 } },
853 { 6, 0x989c, 649 { 6, 0x989c, { 0x00c00000, 0x00c00000, 0x00c00000 } },
854 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 650 { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
855 { 6, 0x989c, 651 { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
856 { 0x1f000000, 0x1f000000, 0x1f000000, 0x1f000000, 0x1f000000 } }, 652 { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
857 { 6, 0x989c, 653 { 6, 0x989c, { 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
858 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 654 { 6, 0x989c, { 0x00d70000, 0x00d70000, 0x00d70000 } },
859 { 6, 0x989c, 655 { 6, 0x989c, { 0x00610000, 0x00610000, 0x00610000 } },
860 { 0x00b80000, 0x00b80000, 0x00b80000, 0x00b80000, 0x00b80000 } }, 656 { 6, 0x989c, { 0x00fe0000, 0x00fe0000, 0x00fe0000 } },
861 { 6, 0x989c, 657 { 6, 0x989c, { 0x00de0000, 0x00de0000, 0x00de0000 } },
862 { 0x00b70000, 0x00b70000, 0x00b70000, 0x00b70000, 0x00b70000 } }, 658 { 6, 0x989c, { 0x007f0000, 0x007f0000, 0x007f0000 } },
863 { 6, 0x989c, 659 { 6, 0x989c, { 0x043d0000, 0x043d0000, 0x043d0000 } },
864 { 0x00840000, 0x00840000, 0x00840000, 0x00840000, 0x00840000 } }, 660 { 6, 0x989c, { 0x00770000, 0x00770000, 0x00770000 } },
865 { 6, 0x989c, 661 { 6, 0x989c, { 0x00440000, 0x00440000, 0x00440000 } },
866 { 0x00980000, 0x00980000, 0x00980000, 0x00980000, 0x00980000 } }, 662 { 6, 0x989c, { 0x00980000, 0x00980000, 0x00980000 } },
867 { 6, 0x989c, 663 { 6, 0x989c, { 0x00100080, 0x00100080, 0x00100080 } },
868 { 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000 } }, 664 { 6, 0x989c, { 0x0005c034, 0x0005c034, 0x0005c034 } },
869 { 6, 0x989c, 665 { 6, 0x989c, { 0x003100f0, 0x003100f0, 0x003100f0 } },
870 { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 666 { 6, 0x989c, { 0x000c011f, 0x000c011f, 0x000c011f } },
871 { 6, 0x989c, 667 { 6, 0x989c, { 0x00510040, 0x00510040, 0x00510040 } },
872 { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 668 { 6, 0x989c, { 0x005000da, 0x005000da, 0x005000da } },
873 { 6, 0x989c, 669 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
874 { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 670 { 6, 0x989c, { 0x00004044, 0x00004044, 0x00004044 } },
875 { 6, 0x989c, 671 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
876 { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } }, 672 { 6, 0x989c, { 0x000060c0, 0x000060c0, 0x000060c0 } },
877 { 6, 0x989c, 673 { 6, 0x989c, { 0x00002c00, 0x00003600, 0x00003600 } },
878 { 0x00d70000, 0x00d70000, 0x00d70000, 0x00d70000, 0x00d70000 } }, 674 { 6, 0x98c8, { 0x00000403, 0x00040403, 0x00040403 } },
879 { 6, 0x989c, 675 { 7, 0x989c, { 0x00006400, 0x00006400, 0x00006400 } },
880 { 0x00610000, 0x00610000, 0x00610000, 0x00610000, 0x00610000 } }, 676 { 7, 0x989c, { 0x00000800, 0x00000800, 0x00000800 } },
881 { 6, 0x989c, 677 { 7, 0x98cc, { 0x0000000e, 0x0000000e, 0x0000000e } },
882 { 0x00fe0000, 0x00fe0000, 0x00fe0000, 0x00fe0000, 0x00fe0000 } },
883 { 6, 0x989c,
884 { 0x00de0000, 0x00de0000, 0x00de0000, 0x00de0000, 0x00de0000 } },
885 { 6, 0x989c,
886 { 0x007f0000, 0x007f0000, 0x007f0000, 0x007f0000, 0x007f0000 } },
887 { 6, 0x989c,
888 { 0x043d0000, 0x043d0000, 0x043d0000, 0x043d0000, 0x043d0000 } },
889 { 6, 0x989c,
890 { 0x00770000, 0x00770000, 0x00770000, 0x00770000, 0x00770000 } },
891 { 6, 0x989c,
892 { 0x00440000, 0x00440000, 0x00440000, 0x00440000, 0x00440000 } },
893 { 6, 0x989c,
894 { 0x00980000, 0x00980000, 0x00980000, 0x00980000, 0x00980000 } },
895 { 6, 0x989c,
896 { 0x00100080, 0x00100080, 0x00100080, 0x00100080, 0x00100080 } },
897 { 6, 0x989c,
898 { 0x0005c034, 0x0005c034, 0x0005c034, 0x0005c034, 0x0005c034 } },
899 { 6, 0x989c,
900 { 0x003100f0, 0x003100f0, 0x003100f0, 0x003100f0, 0x003100f0 } },
901 { 6, 0x989c,
902 { 0x000c011f, 0x000c011f, 0x000c011f, 0x000c011f, 0x000c011f } },
903 { 6, 0x989c,
904 { 0x00510040, 0x00510040, 0x00510040, 0x00510040, 0x00510040 } },
905 { 6, 0x989c,
906 { 0x005000da, 0x005000da, 0x005000da, 0x005000da, 0x005000da } },
907 { 6, 0x989c,
908 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
909 { 6, 0x989c,
910 { 0x00004044, 0x00004044, 0x00004044, 0x00004044, 0x00004044 } },
911 { 6, 0x989c,
912 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
913 { 6, 0x989c,
914 { 0x000060c0, 0x000060c0, 0x000060c0, 0x000060c0, 0x000060c0 } },
915 { 6, 0x989c,
916 { 0x00002c00, 0x00002c00, 0x00003600, 0x00003600, 0x00002c00 } },
917 { 6, 0x98c8,
918 { 0x00000403, 0x00000403, 0x00040403, 0x00040403, 0x00040403 } },
919 { 7, 0x989c,
920 { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } },
921 { 7, 0x989c,
922 { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } },
923 { 7, 0x98cc,
924 { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } },
925}; 678};
926 679
927 680
@@ -931,92 +684,59 @@ static const struct ath5k_ini_rfbuffer rfb_5413[] = {
931* AR2317 (Spider SoC) * 684* AR2317 (Spider SoC) *
932\***************************/ 685\***************************/
933 686
687/* BANK 2 len pos col */
688#define AR5K_RF2425_RF_TURBO { 1, 1, 2 }
689
934/* BANK 6 len pos col */ 690/* BANK 6 len pos col */
935#define AR5K_RF2425_OB_2GHZ { 3, 193, 0 } 691#define AR5K_RF2425_OB_2GHZ { 3, 193, 0 }
936#define AR5K_RF2425_DB_2GHZ { 3, 190, 0 } 692#define AR5K_RF2425_DB_2GHZ { 3, 190, 0 }
937 693
938static const struct ath5k_rf_reg rf_regs_2425[] = { 694static const struct ath5k_rf_reg rf_regs_2425[] = {
695 {2, AR5K_RF_TURBO, AR5K_RF2425_RF_TURBO},
939 {6, AR5K_RF_OB_2GHZ, AR5K_RF2425_OB_2GHZ}, 696 {6, AR5K_RF_OB_2GHZ, AR5K_RF2425_OB_2GHZ},
940 {6, AR5K_RF_DB_2GHZ, AR5K_RF2425_DB_2GHZ}, 697 {6, AR5K_RF_DB_2GHZ, AR5K_RF2425_DB_2GHZ},
941}; 698};
942 699
943/* Default mode specific settings 700/* Default mode specific settings
944 * XXX: a/aTurbo ?
945 */ 701 */
946static const struct ath5k_ini_rfbuffer rfb_2425[] = { 702static const struct ath5k_ini_rfbuffer rfb_2425[] = {
947 { 1, 0x98d4, 703 /* BANK / C.R. A/XR B G */
948 /* mode a/XR mode aTurbo mode b mode g mode gTurbo */ 704 { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } },
949 { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, 705 { 2, 0x98d0, { 0x02001408, 0x02001408, 0x02001408 } },
950 { 2, 0x98d0, 706 { 3, 0x98dc, { 0x00a020c0, 0x00e020c0, 0x00e020c0 } },
951 { 0x02001408, 0x02001408, 0x02001408, 0x02001408, 0x02001408 } }, 707 { 6, 0x989c, { 0x10000000, 0x10000000, 0x10000000 } },
952 { 3, 0x98dc, 708 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
953 { 0x00a020c0, 0x00a020c0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } }, 709 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
954 { 6, 0x989c, 710 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
955 { 0x10000000, 0x10000000, 0x10000000, 0x10000000, 0x10000000 } }, 711 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
956 { 6, 0x989c, 712 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
957 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 713 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
958 { 6, 0x989c, 714 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
959 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 715 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
960 { 6, 0x989c, 716 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
961 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 717 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
962 { 6, 0x989c, 718 { 6, 0x989c, { 0x002a0000, 0x002a0000, 0x002a0000 } },
963 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 719 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
964 { 6, 0x989c, 720 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
965 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 721 { 6, 0x989c, { 0x00100000, 0x00100000, 0x00100000 } },
966 { 6, 0x989c, 722 { 6, 0x989c, { 0x00020000, 0x00020000, 0x00020000 } },
967 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 723 { 6, 0x989c, { 0x00730000, 0x00730000, 0x00730000 } },
968 { 6, 0x989c, 724 { 6, 0x989c, { 0x00f80000, 0x00f80000, 0x00f80000 } },
969 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 725 { 6, 0x989c, { 0x00e70000, 0x00e70000, 0x00e70000 } },
970 { 6, 0x989c, 726 { 6, 0x989c, { 0x00140000, 0x00140000, 0x00140000 } },
971 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 727 { 6, 0x989c, { 0x00910040, 0x00910040, 0x00910040 } },
972 { 6, 0x989c, 728 { 6, 0x989c, { 0x0007001a, 0x0007001a, 0x0007001a } },
973 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 729 { 6, 0x989c, { 0x00410000, 0x00410000, 0x00410000 } },
974 { 6, 0x989c, 730 { 6, 0x989c, { 0x00810000, 0x00810060, 0x00810060 } },
975 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 731 { 6, 0x989c, { 0x00020800, 0x00020803, 0x00020803 } },
976 { 6, 0x989c, 732 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
977 { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } }, 733 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
978 { 6, 0x989c, 734 { 6, 0x989c, { 0x00001660, 0x00001660, 0x00001660 } },
979 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 735 { 6, 0x989c, { 0x00001688, 0x00001688, 0x00001688 } },
980 { 6, 0x989c, 736 { 6, 0x98c4, { 0x00000001, 0x00000001, 0x00000001 } },
981 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 737 { 7, 0x989c, { 0x00006400, 0x00006400, 0x00006400 } },
982 { 6, 0x989c, 738 { 7, 0x989c, { 0x00000800, 0x00000800, 0x00000800 } },
983 { 0x00100000, 0x00100000, 0x00100000, 0x00100000, 0x00100000 } }, 739 { 7, 0x98cc, { 0x0000000e, 0x0000000e, 0x0000000e } },
984 { 6, 0x989c,
985 { 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000 } },
986 { 6, 0x989c,
987 { 0x00730000, 0x00730000, 0x00730000, 0x00730000, 0x00730000 } },
988 { 6, 0x989c,
989 { 0x00f80000, 0x00f80000, 0x00f80000, 0x00f80000, 0x00f80000 } },
990 { 6, 0x989c,
991 { 0x00e70000, 0x00e70000, 0x00e70000, 0x00e70000, 0x00e70000 } },
992 { 6, 0x989c,
993 { 0x00140000, 0x00140000, 0x00140000, 0x00140000, 0x00140000 } },
994 { 6, 0x989c,
995 { 0x00910040, 0x00910040, 0x00910040, 0x00910040, 0x00910040 } },
996 { 6, 0x989c,
997 { 0x0007001a, 0x0007001a, 0x0007001a, 0x0007001a, 0x0007001a } },
998 { 6, 0x989c,
999 { 0x00410000, 0x00410000, 0x00410000, 0x00410000, 0x00410000 } },
1000 { 6, 0x989c,
1001 { 0x00810000, 0x00810000, 0x00810060, 0x00810060, 0x00810060 } },
1002 { 6, 0x989c,
1003 { 0x00020800, 0x00020800, 0x00020803, 0x00020803, 0x00020803 } },
1004 { 6, 0x989c,
1005 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
1006 { 6, 0x989c,
1007 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
1008 { 6, 0x989c,
1009 { 0x00001660, 0x00001660, 0x00001660, 0x00001660, 0x00001660 } },
1010 { 6, 0x989c,
1011 { 0x00001688, 0x00001688, 0x00001688, 0x00001688, 0x00001688 } },
1012 { 6, 0x98c4,
1013 { 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001 } },
1014 { 7, 0x989c,
1015 { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } },
1016 { 7, 0x989c,
1017 { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } },
1018 { 7, 0x98cc,
1019 { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } },
1020}; 740};
1021 741
1022/* 742/*
@@ -1024,158 +744,85 @@ static const struct ath5k_ini_rfbuffer rfb_2425[] = {
1024 * bank modification and get rid of this 744 * bank modification and get rid of this
1025 */ 745 */
1026static const struct ath5k_ini_rfbuffer rfb_2317[] = { 746static const struct ath5k_ini_rfbuffer rfb_2317[] = {
1027 { 1, 0x98d4, 747 /* BANK / C.R. A/XR B G */
1028 /* mode a/XR mode aTurbo mode b mode g mode gTurbo */ 748 { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } },
1029 { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, 749 { 2, 0x98d0, { 0x02001408, 0x02001408, 0x02001408 } },
1030 { 2, 0x98d0, 750 { 3, 0x98dc, { 0x00a020c0, 0x00e020c0, 0x00e020c0 } },
1031 { 0x02001408, 0x02011408, 0x02001408, 0x02001408, 0x02011408 } }, 751 { 6, 0x989c, { 0x10000000, 0x10000000, 0x10000000 } },
1032 { 3, 0x98dc, 752 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1033 { 0x00a020c0, 0x00a020c0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } }, 753 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1034 { 6, 0x989c, 754 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1035 { 0x10000000, 0x10000000, 0x10000000, 0x10000000, 0x10000000 } }, 755 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1036 { 6, 0x989c, 756 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1037 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 757 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1038 { 6, 0x989c, 758 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1039 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 759 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1040 { 6, 0x989c, 760 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1041 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 761 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1042 { 6, 0x989c, 762 { 6, 0x989c, { 0x002a0000, 0x002a0000, 0x002a0000 } },
1043 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 763 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1044 { 6, 0x989c, 764 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1045 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 765 { 6, 0x989c, { 0x00100000, 0x00100000, 0x00100000 } },
1046 { 6, 0x989c, 766 { 6, 0x989c, { 0x00020000, 0x00020000, 0x00020000 } },
1047 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 767 { 6, 0x989c, { 0x00730000, 0x00730000, 0x00730000 } },
1048 { 6, 0x989c, 768 { 6, 0x989c, { 0x00f80000, 0x00f80000, 0x00f80000 } },
1049 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 769 { 6, 0x989c, { 0x00e70000, 0x00e70000, 0x00e70000 } },
1050 { 6, 0x989c, 770 { 6, 0x989c, { 0x00140100, 0x00140100, 0x00140100 } },
1051 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 771 { 6, 0x989c, { 0x00910040, 0x00910040, 0x00910040 } },
1052 { 6, 0x989c, 772 { 6, 0x989c, { 0x0007001a, 0x0007001a, 0x0007001a } },
1053 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 773 { 6, 0x989c, { 0x00410000, 0x00410000, 0x00410000 } },
1054 { 6, 0x989c, 774 { 6, 0x989c, { 0x00810000, 0x00810060, 0x00810060 } },
1055 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 775 { 6, 0x989c, { 0x00020800, 0x00020803, 0x00020803 } },
1056 { 6, 0x989c, 776 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1057 { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } }, 777 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1058 { 6, 0x989c, 778 { 6, 0x989c, { 0x00001660, 0x00001660, 0x00001660 } },
1059 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 779 { 6, 0x989c, { 0x00009688, 0x00009688, 0x00009688 } },
1060 { 6, 0x989c, 780 { 6, 0x98c4, { 0x00000001, 0x00000001, 0x00000001 } },
1061 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 781 { 7, 0x989c, { 0x00006400, 0x00006400, 0x00006400 } },
1062 { 6, 0x989c, 782 { 7, 0x989c, { 0x00000800, 0x00000800, 0x00000800 } },
1063 { 0x00100000, 0x00100000, 0x00100000, 0x00100000, 0x00100000 } }, 783 { 7, 0x98cc, { 0x0000000e, 0x0000000e, 0x0000000e } },
1064 { 6, 0x989c,
1065 { 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000 } },
1066 { 6, 0x989c,
1067 { 0x00730000, 0x00730000, 0x00730000, 0x00730000, 0x00730000 } },
1068 { 6, 0x989c,
1069 { 0x00f80000, 0x00f80000, 0x00f80000, 0x00f80000, 0x00f80000 } },
1070 { 6, 0x989c,
1071 { 0x00e70000, 0x00e70000, 0x00e70000, 0x00e70000, 0x00e70000 } },
1072 { 6, 0x989c,
1073 { 0x00140100, 0x00140100, 0x00140100, 0x00140100, 0x00140100 } },
1074 { 6, 0x989c,
1075 { 0x00910040, 0x00910040, 0x00910040, 0x00910040, 0x00910040 } },
1076 { 6, 0x989c,
1077 { 0x0007001a, 0x0007001a, 0x0007001a, 0x0007001a, 0x0007001a } },
1078 { 6, 0x989c,
1079 { 0x00410000, 0x00410000, 0x00410000, 0x00410000, 0x00410000 } },
1080 { 6, 0x989c,
1081 { 0x00810000, 0x00810000, 0x00810060, 0x00810060, 0x00810060 } },
1082 { 6, 0x989c,
1083 { 0x00020800, 0x00020800, 0x00020803, 0x00020803, 0x00020803 } },
1084 { 6, 0x989c,
1085 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
1086 { 6, 0x989c,
1087 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
1088 { 6, 0x989c,
1089 { 0x00001660, 0x00001660, 0x00001660, 0x00001660, 0x00001660 } },
1090 { 6, 0x989c,
1091 { 0x00009688, 0x00009688, 0x00009688, 0x00009688, 0x00009688 } },
1092 { 6, 0x98c4,
1093 { 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001 } },
1094 { 7, 0x989c,
1095 { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } },
1096 { 7, 0x989c,
1097 { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } },
1098 { 7, 0x98cc,
1099 { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } },
1100}; 784};
1101 785
1102/* 786/*
1103 * TODO: Handle the few differences with swan during 787 * TODO: Handle the few differences with swan during
1104 * bank modification and get rid of this 788 * bank modification and get rid of this
1105 * XXX: a/aTurbo ?
1106 */ 789 */
1107static const struct ath5k_ini_rfbuffer rfb_2417[] = { 790static const struct ath5k_ini_rfbuffer rfb_2417[] = {
1108 { 1, 0x98d4, 791 /* BANK / C.R. A/XR B G */
1109 /* mode a/XR mode aTurbo mode b mode g mode gTurbo */ 792 { 1, 0x98d4, { 0x00000020, 0x00000020, 0x00000020 } },
1110 { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } }, 793 { 2, 0x98d0, { 0x02001408, 0x02001408, 0x02001408 } },
1111 { 2, 0x98d0, 794 { 3, 0x98dc, { 0x00a020c0, 0x00e020c0, 0x00e020c0 } },
1112 { 0x02001408, 0x02001408, 0x02001408, 0x02001408, 0x02001408 } }, 795 { 6, 0x989c, { 0x10000000, 0x10000000, 0x10000000 } },
1113 { 3, 0x98dc, 796 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1114 { 0x00a020c0, 0x00a020c0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } }, 797 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1115 { 6, 0x989c, 798 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1116 { 0x10000000, 0x10000000, 0x10000000, 0x10000000, 0x10000000 } }, 799 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1117 { 6, 0x989c, 800 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1118 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 801 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1119 { 6, 0x989c, 802 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1120 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 803 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1121 { 6, 0x989c, 804 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1122 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 805 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1123 { 6, 0x989c, 806 { 6, 0x989c, { 0x002a0000, 0x002a0000, 0x002a0000 } },
1124 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 807 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1125 { 6, 0x989c, 808 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1126 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 809 { 6, 0x989c, { 0x00100000, 0x00100000, 0x00100000 } },
1127 { 6, 0x989c, 810 { 6, 0x989c, { 0x00020000, 0x00020000, 0x00020000 } },
1128 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 811 { 6, 0x989c, { 0x00730000, 0x00730000, 0x00730000 } },
1129 { 6, 0x989c, 812 { 6, 0x989c, { 0x00f80000, 0x00f80000, 0x00f80000 } },
1130 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 813 { 6, 0x989c, { 0x00e70000, 0x80e70000, 0x80e70000 } },
1131 { 6, 0x989c, 814 { 6, 0x989c, { 0x00140000, 0x00140000, 0x00140000 } },
1132 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 815 { 6, 0x989c, { 0x00910040, 0x00910040, 0x00910040 } },
1133 { 6, 0x989c, 816 { 6, 0x989c, { 0x0007001a, 0x0207001a, 0x0207001a } },
1134 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 817 { 6, 0x989c, { 0x00410000, 0x00410000, 0x00410000 } },
1135 { 6, 0x989c, 818 { 6, 0x989c, { 0x00810000, 0x00810060, 0x00810060 } },
1136 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 819 { 6, 0x989c, { 0x00020800, 0x00020803, 0x00020803 } },
1137 { 6, 0x989c, 820 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1138 { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } }, 821 { 6, 0x989c, { 0x00000000, 0x00000000, 0x00000000 } },
1139 { 6, 0x989c, 822 { 6, 0x989c, { 0x00001660, 0x00001660, 0x00001660 } },
1140 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 823 { 6, 0x989c, { 0x00001688, 0x00001688, 0x00001688 } },
1141 { 6, 0x989c, 824 { 6, 0x98c4, { 0x00000001, 0x00000001, 0x00000001 } },
1142 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }, 825 { 7, 0x989c, { 0x00006400, 0x00006400, 0x00006400 } },
1143 { 6, 0x989c, 826 { 7, 0x989c, { 0x00000800, 0x00000800, 0x00000800 } },
1144 { 0x00100000, 0x00100000, 0x00100000, 0x00100000, 0x00100000 } }, 827 { 7, 0x98cc, { 0x0000000e, 0x0000000e, 0x0000000e } },
1145 { 6, 0x989c,
1146 { 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000 } },
1147 { 6, 0x989c,
1148 { 0x00730000, 0x00730000, 0x00730000, 0x00730000, 0x00730000 } },
1149 { 6, 0x989c,
1150 { 0x00f80000, 0x00f80000, 0x00f80000, 0x00f80000, 0x00f80000 } },
1151 { 6, 0x989c,
1152 { 0x00e70000, 0x00e70000, 0x80e70000, 0x80e70000, 0x00e70000 } },
1153 { 6, 0x989c,
1154 { 0x00140000, 0x00140000, 0x00140000, 0x00140000, 0x00140000 } },
1155 { 6, 0x989c,
1156 { 0x00910040, 0x00910040, 0x00910040, 0x00910040, 0x00910040 } },
1157 { 6, 0x989c,
1158 { 0x0007001a, 0x0007001a, 0x0207001a, 0x0207001a, 0x0007001a } },
1159 { 6, 0x989c,
1160 { 0x00410000, 0x00410000, 0x00410000, 0x00410000, 0x00410000 } },
1161 { 6, 0x989c,
1162 { 0x00810000, 0x00810000, 0x00810060, 0x00810060, 0x00810060 } },
1163 { 6, 0x989c,
1164 { 0x00020800, 0x00020800, 0x00020803, 0x00020803, 0x00020803 } },
1165 { 6, 0x989c,
1166 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
1167 { 6, 0x989c,
1168 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
1169 { 6, 0x989c,
1170 { 0x00001660, 0x00001660, 0x00001660, 0x00001660, 0x00001660 } },
1171 { 6, 0x989c,
1172 { 0x00001688, 0x00001688, 0x00001688, 0x00001688, 0x00001688 } },
1173 { 6, 0x98c4,
1174 { 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001 } },
1175 { 7, 0x989c,
1176 { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } },
1177 { 7, 0x989c,
1178 { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } },
1179 { 7, 0x98cc,
1180 { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } },
1181}; 828};
diff --git a/drivers/net/wireless/ath/ath5k/sysfs.c b/drivers/net/wireless/ath/ath5k/sysfs.c
index 90757de7bf59..929c68cdf8ab 100644
--- a/drivers/net/wireless/ath/ath5k/sysfs.c
+++ b/drivers/net/wireless/ath/ath5k/sysfs.c
@@ -95,7 +95,7 @@ static struct attribute_group ath5k_attribute_group_ani = {
95int 95int
96ath5k_sysfs_register(struct ath5k_softc *sc) 96ath5k_sysfs_register(struct ath5k_softc *sc)
97{ 97{
98 struct device *dev = &sc->pdev->dev; 98 struct device *dev = sc->dev;
99 int err; 99 int err;
100 100
101 err = sysfs_create_group(&dev->kobj, &ath5k_attribute_group_ani); 101 err = sysfs_create_group(&dev->kobj, &ath5k_attribute_group_ani);
@@ -110,7 +110,7 @@ ath5k_sysfs_register(struct ath5k_softc *sc)
110void 110void
111ath5k_sysfs_unregister(struct ath5k_softc *sc) 111ath5k_sysfs_unregister(struct ath5k_softc *sc)
112{ 112{
113 struct device *dev = &sc->pdev->dev; 113 struct device *dev = sc->dev;
114 114
115 sysfs_remove_group(&dev->kobj, &ath5k_attribute_group_ani); 115 sysfs_remove_group(&dev->kobj, &ath5k_attribute_group_ani);
116} 116}
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index f2eec388693b..73a8014cacb2 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -57,10 +57,11 @@
57#define SUB_NUM_CTL_MODES_AT_5G_40 2 /* excluding HT40, EXT-OFDM */ 57#define SUB_NUM_CTL_MODES_AT_5G_40 2 /* excluding HT40, EXT-OFDM */
58#define SUB_NUM_CTL_MODES_AT_2G_40 3 /* excluding HT40, EXT-OFDM, EXT-CCK */ 58#define SUB_NUM_CTL_MODES_AT_2G_40 3 /* excluding HT40, EXT-OFDM, EXT-CCK */
59 59
60#define CTL(_tpower, _flag) ((_tpower) | ((_flag) << 6))
61
60static int ar9003_hw_power_interpolate(int32_t x, 62static int ar9003_hw_power_interpolate(int32_t x,
61 int32_t *px, int32_t *py, u_int16_t np); 63 int32_t *px, int32_t *py, u_int16_t np);
62 64
63#define CTL(_tpower, _flag) ((_tpower) | ((_flag) << 6))
64 65
65static const struct ar9300_eeprom ar9300_default = { 66static const struct ar9300_eeprom ar9300_default = {
66 .eepromVersion = 2, 67 .eepromVersion = 2,
@@ -3032,6 +3033,8 @@ static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah,
3032 return le32_to_cpu(pBase->swreg); 3033 return le32_to_cpu(pBase->swreg);
3033 case EEP_PAPRD: 3034 case EEP_PAPRD:
3034 return !!(pBase->featureEnable & BIT(5)); 3035 return !!(pBase->featureEnable & BIT(5));
3036 case EEP_CHAIN_MASK_REDUCE:
3037 return (pBase->miscConfiguration >> 0x3) & 0x1;
3035 default: 3038 default:
3036 return 0; 3039 return 0;
3037 } 3040 }
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index 656d8ce251a7..b34a9e91edd8 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -487,7 +487,11 @@ void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx)
487 break; 487 break;
488 } 488 }
489 489
490 REG_WRITE(ah, AR_SELFGEN_MASK, tx); 490 if ((ah->caps.hw_caps & ATH9K_HW_CAP_APM) && (tx == 0x7))
491 REG_WRITE(ah, AR_SELFGEN_MASK, 0x3);
492 else
493 REG_WRITE(ah, AR_SELFGEN_MASK, tx);
494
491 if (tx == 0x5) { 495 if (tx == 0x5) {
492 REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, 496 REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP,
493 AR_PHY_SWAP_ALT_CHAIN); 497 AR_PHY_SWAP_ALT_CHAIN);
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 0b4b4704b1f0..4210a9306955 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -545,6 +545,7 @@ struct ath_ant_comb {
545#define SC_OP_BT_PRIORITY_DETECTED BIT(12) 545#define SC_OP_BT_PRIORITY_DETECTED BIT(12)
546#define SC_OP_BT_SCAN BIT(13) 546#define SC_OP_BT_SCAN BIT(13)
547#define SC_OP_ANI_RUN BIT(14) 547#define SC_OP_ANI_RUN BIT(14)
548#define SC_OP_ENABLE_APM BIT(15)
548 549
549/* Powersave flags */ 550/* Powersave flags */
550#define PS_WAIT_FOR_BEACON BIT(0) 551#define PS_WAIT_FOR_BEACON BIT(0)
@@ -697,6 +698,8 @@ static inline void ath_ahb_exit(void) {};
697void ath9k_ps_wakeup(struct ath_softc *sc); 698void ath9k_ps_wakeup(struct ath_softc *sc);
698void ath9k_ps_restore(struct ath_softc *sc); 699void ath9k_ps_restore(struct ath_softc *sc);
699 700
701u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate);
702
700void ath9k_set_bssid_mask(struct ieee80211_hw *hw, struct ieee80211_vif *vif); 703void ath9k_set_bssid_mask(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
701int ath9k_wiphy_add(struct ath_softc *sc); 704int ath9k_wiphy_add(struct ath_softc *sc);
702int ath9k_wiphy_del(struct ath_wiphy *aphy); 705int ath9k_wiphy_del(struct ath_wiphy *aphy);
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index 30724a4e8bb2..47bedd82e9a9 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -103,7 +103,8 @@ static void ath_beacon_setup(struct ath_softc *sc, struct ath_vif *avp,
103 memset(series, 0, sizeof(struct ath9k_11n_rate_series) * 4); 103 memset(series, 0, sizeof(struct ath9k_11n_rate_series) * 4);
104 series[0].Tries = 1; 104 series[0].Tries = 1;
105 series[0].Rate = rate; 105 series[0].Rate = rate;
106 series[0].ChSel = common->tx_chainmask; 106 series[0].ChSel = ath_txchainmask_reduction(sc,
107 common->tx_chainmask, series[0].Rate);
107 series[0].RateFlags = (ctsrate) ? ATH9K_RATESERIES_RTS_CTS : 0; 108 series[0].RateFlags = (ctsrate) ? ATH9K_RATESERIES_RTS_CTS : 0;
108 ath9k_hw_set11n_ratescenario(ah, ds, ds, 0, ctsrate, ctsduration, 109 ath9k_hw_set11n_ratescenario(ah, ds, ds, 0, ctsrate, ctsduration,
109 series, 4, 0); 110 series, 4, 0);
diff --git a/drivers/net/wireless/ath/ath9k/btcoex.c b/drivers/net/wireless/ath/ath9k/btcoex.c
index 6a92e57fddf0..d33bf204c995 100644
--- a/drivers/net/wireless/ath/ath9k/btcoex.c
+++ b/drivers/net/wireless/ath/ath9k/btcoex.c
@@ -35,29 +35,6 @@ struct ath_btcoex_config {
35 bool bt_hold_rx_clear; 35 bool bt_hold_rx_clear;
36}; 36};
37 37
38static const u16 ath_subsysid_tbl[] = {
39 AR9280_COEX2WIRE_SUBSYSID,
40 AT9285_COEX3WIRE_SA_SUBSYSID,
41 AT9285_COEX3WIRE_DA_SUBSYSID
42};
43
44/*
45 * Checks the subsystem id of the device to see if it
46 * supports btcoex
47 */
48bool ath9k_hw_btcoex_supported(struct ath_hw *ah)
49{
50 int i;
51
52 if (!ah->hw_version.subsysid)
53 return false;
54
55 for (i = 0; i < ARRAY_SIZE(ath_subsysid_tbl); i++)
56 if (ah->hw_version.subsysid == ath_subsysid_tbl[i])
57 return true;
58
59 return false;
60}
61 38
62void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum) 39void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum)
63{ 40{
diff --git a/drivers/net/wireless/ath/ath9k/btcoex.h b/drivers/net/wireless/ath/ath9k/btcoex.h
index 1ee5a15ccbb1..588dfd464dd1 100644
--- a/drivers/net/wireless/ath/ath9k/btcoex.h
+++ b/drivers/net/wireless/ath/ath9k/btcoex.h
@@ -49,7 +49,6 @@ struct ath_btcoex_hw {
49 u32 bt_coex_mode2; /* Register setting for AR_BT_COEX_MODE2 */ 49 u32 bt_coex_mode2; /* Register setting for AR_BT_COEX_MODE2 */
50}; 50};
51 51
52bool ath9k_hw_btcoex_supported(struct ath_hw *ah);
53void ath9k_hw_btcoex_init_2wire(struct ath_hw *ah); 52void ath9k_hw_btcoex_init_2wire(struct ath_hw *ah);
54void ath9k_hw_btcoex_init_3wire(struct ath_hw *ah); 53void ath9k_hw_btcoex_init_3wire(struct ath_hw *ah);
55void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum); 54void ath9k_hw_init_btcoex_hw(struct ath_hw *ah, int qnum);
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 0c3c74c157fb..3586c43077a7 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -24,8 +24,6 @@
24#define REG_READ_D(_ah, _reg) \ 24#define REG_READ_D(_ah, _reg) \
25 ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) 25 ath9k_hw_common(_ah)->ops->read((_ah), (_reg))
26 26
27static struct dentry *ath9k_debugfs_root;
28
29static int ath9k_debugfs_open(struct inode *inode, struct file *file) 27static int ath9k_debugfs_open(struct inode *inode, struct file *file)
30{ 28{
31 file->private_data = inode->i_private; 29 file->private_data = inode->i_private;
@@ -878,11 +876,8 @@ int ath9k_init_debug(struct ath_hw *ah)
878 struct ath_common *common = ath9k_hw_common(ah); 876 struct ath_common *common = ath9k_hw_common(ah);
879 struct ath_softc *sc = (struct ath_softc *) common->priv; 877 struct ath_softc *sc = (struct ath_softc *) common->priv;
880 878
881 if (!ath9k_debugfs_root) 879 sc->debug.debugfs_phy = debugfs_create_dir("ath9k",
882 return -ENOENT; 880 sc->hw->wiphy->debugfsdir);
883
884 sc->debug.debugfs_phy = debugfs_create_dir(wiphy_name(sc->hw->wiphy),
885 ath9k_debugfs_root);
886 if (!sc->debug.debugfs_phy) 881 if (!sc->debug.debugfs_phy)
887 return -ENOMEM; 882 return -ENOMEM;
888 883
@@ -935,29 +930,7 @@ int ath9k_init_debug(struct ath_hw *ah)
935 sc->debug.regidx = 0; 930 sc->debug.regidx = 0;
936 return 0; 931 return 0;
937err: 932err:
938 ath9k_exit_debug(ah);
939 return -ENOMEM;
940}
941
942void ath9k_exit_debug(struct ath_hw *ah)
943{
944 struct ath_common *common = ath9k_hw_common(ah);
945 struct ath_softc *sc = (struct ath_softc *) common->priv;
946
947 debugfs_remove_recursive(sc->debug.debugfs_phy); 933 debugfs_remove_recursive(sc->debug.debugfs_phy);
948} 934 sc->debug.debugfs_phy = NULL;
949 935 return -ENOMEM;
950int ath9k_debug_create_root(void)
951{
952 ath9k_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
953 if (!ath9k_debugfs_root)
954 return -ENOENT;
955
956 return 0;
957}
958
959void ath9k_debug_remove_root(void)
960{
961 debugfs_remove(ath9k_debugfs_root);
962 ath9k_debugfs_root = NULL;
963} 936}
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h
index 646ff7e04c88..1e5078bd0344 100644
--- a/drivers/net/wireless/ath/ath9k/debug.h
+++ b/drivers/net/wireless/ath/ath9k/debug.h
@@ -164,10 +164,7 @@ struct ath9k_debug {
164}; 164};
165 165
166int ath9k_init_debug(struct ath_hw *ah); 166int ath9k_init_debug(struct ath_hw *ah);
167void ath9k_exit_debug(struct ath_hw *ah);
168 167
169int ath9k_debug_create_root(void);
170void ath9k_debug_remove_root(void);
171void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status); 168void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
172void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, 169void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
173 struct ath_tx_status *ts); 170 struct ath_tx_status *ts);
@@ -180,19 +177,6 @@ static inline int ath9k_init_debug(struct ath_hw *ah)
180 return 0; 177 return 0;
181} 178}
182 179
183static inline void ath9k_exit_debug(struct ath_hw *ah)
184{
185}
186
187static inline int ath9k_debug_create_root(void)
188{
189 return 0;
190}
191
192static inline void ath9k_debug_remove_root(void)
193{
194}
195
196static inline void ath_debug_stat_interrupt(struct ath_softc *sc, 180static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
197 enum ath9k_int status) 181 enum ath9k_int status)
198{ 182{
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h
index 8a644fced5c9..8b9885b5243f 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.h
+++ b/drivers/net/wireless/ath/ath9k/eeprom.h
@@ -280,6 +280,7 @@ enum eeprom_param {
280 EEP_PAPRD, 280 EEP_PAPRD,
281 EEP_MODAL_VER, 281 EEP_MODAL_VER,
282 EEP_ANT_DIV_CTL1, 282 EEP_ANT_DIV_CTL1,
283 EEP_CHAIN_MASK_REDUCE
283}; 284};
284 285
285enum ar5416_rates { 286enum ar5416_rates {
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index ae842dbf9b50..8946e8ad1b85 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -363,9 +363,9 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
363 struct sk_buff *skb) 363 struct sk_buff *skb)
364{ 364{
365 struct sk_buff *nskb, *skb_pool[MAX_PKT_NUM_IN_TRANSFER]; 365 struct sk_buff *nskb, *skb_pool[MAX_PKT_NUM_IN_TRANSFER];
366 int index = 0, i = 0, chk_idx, len = skb->len; 366 int index = 0, i = 0, len = skb->len;
367 int rx_remain_len = 0, rx_pkt_len = 0; 367 int rx_remain_len, rx_pkt_len;
368 u16 pkt_len, pkt_tag, pool_index = 0; 368 u16 pool_index = 0;
369 u8 *ptr; 369 u8 *ptr;
370 370
371 spin_lock(&hif_dev->rx_lock); 371 spin_lock(&hif_dev->rx_lock);
@@ -399,64 +399,64 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
399 spin_unlock(&hif_dev->rx_lock); 399 spin_unlock(&hif_dev->rx_lock);
400 400
401 while (index < len) { 401 while (index < len) {
402 u16 pkt_len;
403 u16 pkt_tag;
404 u16 pad_len;
405 int chk_idx;
406
402 ptr = (u8 *) skb->data; 407 ptr = (u8 *) skb->data;
403 408
404 pkt_len = ptr[index] + (ptr[index+1] << 8); 409 pkt_len = ptr[index] + (ptr[index+1] << 8);
405 pkt_tag = ptr[index+2] + (ptr[index+3] << 8); 410 pkt_tag = ptr[index+2] + (ptr[index+3] << 8);
406 411
407 if (pkt_tag == ATH_USB_RX_STREAM_MODE_TAG) { 412 if (pkt_tag != ATH_USB_RX_STREAM_MODE_TAG) {
408 u16 pad_len; 413 RX_STAT_INC(skb_dropped);
409 414 return;
410 pad_len = 4 - (pkt_len & 0x3); 415 }
411 if (pad_len == 4) 416
412 pad_len = 0; 417 pad_len = 4 - (pkt_len & 0x3);
413 418 if (pad_len == 4)
414 chk_idx = index; 419 pad_len = 0;
415 index = index + 4 + pkt_len + pad_len; 420
416 421 chk_idx = index;
417 if (index > MAX_RX_BUF_SIZE) { 422 index = index + 4 + pkt_len + pad_len;
418 spin_lock(&hif_dev->rx_lock); 423
419 hif_dev->rx_remain_len = index - MAX_RX_BUF_SIZE; 424 if (index > MAX_RX_BUF_SIZE) {
420 hif_dev->rx_transfer_len = 425 spin_lock(&hif_dev->rx_lock);
421 MAX_RX_BUF_SIZE - chk_idx - 4; 426 hif_dev->rx_remain_len = index - MAX_RX_BUF_SIZE;
422 hif_dev->rx_pad_len = pad_len; 427 hif_dev->rx_transfer_len =
423 428 MAX_RX_BUF_SIZE - chk_idx - 4;
424 nskb = __dev_alloc_skb(pkt_len + 32, 429 hif_dev->rx_pad_len = pad_len;
425 GFP_ATOMIC); 430
426 if (!nskb) { 431 nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC);
427 dev_err(&hif_dev->udev->dev, 432 if (!nskb) {
428 "ath9k_htc: RX memory allocation" 433 dev_err(&hif_dev->udev->dev,
429 " error\n"); 434 "ath9k_htc: RX memory allocation error\n");
430 spin_unlock(&hif_dev->rx_lock);
431 goto err;
432 }
433 skb_reserve(nskb, 32);
434 RX_STAT_INC(skb_allocated);
435
436 memcpy(nskb->data, &(skb->data[chk_idx+4]),
437 hif_dev->rx_transfer_len);
438
439 /* Record the buffer pointer */
440 hif_dev->remain_skb = nskb;
441 spin_unlock(&hif_dev->rx_lock); 435 spin_unlock(&hif_dev->rx_lock);
442 } else { 436 goto err;
443 nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC);
444 if (!nskb) {
445 dev_err(&hif_dev->udev->dev,
446 "ath9k_htc: RX memory allocation"
447 " error\n");
448 goto err;
449 }
450 skb_reserve(nskb, 32);
451 RX_STAT_INC(skb_allocated);
452
453 memcpy(nskb->data, &(skb->data[chk_idx+4]), pkt_len);
454 skb_put(nskb, pkt_len);
455 skb_pool[pool_index++] = nskb;
456 } 437 }
438 skb_reserve(nskb, 32);
439 RX_STAT_INC(skb_allocated);
440
441 memcpy(nskb->data, &(skb->data[chk_idx+4]),
442 hif_dev->rx_transfer_len);
443
444 /* Record the buffer pointer */
445 hif_dev->remain_skb = nskb;
446 spin_unlock(&hif_dev->rx_lock);
457 } else { 447 } else {
458 RX_STAT_INC(skb_dropped); 448 nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC);
459 return; 449 if (!nskb) {
450 dev_err(&hif_dev->udev->dev,
451 "ath9k_htc: RX memory allocation error\n");
452 goto err;
453 }
454 skb_reserve(nskb, 32);
455 RX_STAT_INC(skb_allocated);
456
457 memcpy(nskb->data, &(skb->data[chk_idx+4]), pkt_len);
458 skb_put(nskb, pkt_len);
459 skb_pool[pool_index++] = nskb;
460 } 460 }
461 } 461 }
462 462
@@ -471,7 +471,7 @@ err:
471static void ath9k_hif_usb_rx_cb(struct urb *urb) 471static void ath9k_hif_usb_rx_cb(struct urb *urb)
472{ 472{
473 struct sk_buff *skb = (struct sk_buff *) urb->context; 473 struct sk_buff *skb = (struct sk_buff *) urb->context;
474 struct hif_device_usb *hif_dev = (struct hif_device_usb *) 474 struct hif_device_usb *hif_dev =
475 usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); 475 usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
476 int ret; 476 int ret;
477 477
@@ -518,7 +518,7 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
518{ 518{
519 struct sk_buff *skb = (struct sk_buff *) urb->context; 519 struct sk_buff *skb = (struct sk_buff *) urb->context;
520 struct sk_buff *nskb; 520 struct sk_buff *nskb;
521 struct hif_device_usb *hif_dev = (struct hif_device_usb *) 521 struct hif_device_usb *hif_dev =
522 usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); 522 usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
523 int ret; 523 int ret;
524 524
@@ -993,8 +993,7 @@ static void ath9k_hif_usb_reboot(struct usb_device *udev)
993static void ath9k_hif_usb_disconnect(struct usb_interface *interface) 993static void ath9k_hif_usb_disconnect(struct usb_interface *interface)
994{ 994{
995 struct usb_device *udev = interface_to_usbdev(interface); 995 struct usb_device *udev = interface_to_usbdev(interface);
996 struct hif_device_usb *hif_dev = 996 struct hif_device_usb *hif_dev = usb_get_intfdata(interface);
997 (struct hif_device_usb *) usb_get_intfdata(interface);
998 997
999 if (hif_dev) { 998 if (hif_dev) {
1000 ath9k_htc_hw_deinit(hif_dev->htc_handle, 999 ath9k_htc_hw_deinit(hif_dev->htc_handle,
@@ -1016,8 +1015,7 @@ static void ath9k_hif_usb_disconnect(struct usb_interface *interface)
1016static int ath9k_hif_usb_suspend(struct usb_interface *interface, 1015static int ath9k_hif_usb_suspend(struct usb_interface *interface,
1017 pm_message_t message) 1016 pm_message_t message)
1018{ 1017{
1019 struct hif_device_usb *hif_dev = 1018 struct hif_device_usb *hif_dev = usb_get_intfdata(interface);
1020 (struct hif_device_usb *) usb_get_intfdata(interface);
1021 1019
1022 ath9k_hif_usb_dealloc_urbs(hif_dev); 1020 ath9k_hif_usb_dealloc_urbs(hif_dev);
1023 1021
@@ -1026,8 +1024,7 @@ static int ath9k_hif_usb_suspend(struct usb_interface *interface,
1026 1024
1027static int ath9k_hif_usb_resume(struct usb_interface *interface) 1025static int ath9k_hif_usb_resume(struct usb_interface *interface)
1028{ 1026{
1029 struct hif_device_usb *hif_dev = 1027 struct hif_device_usb *hif_dev = usb_get_intfdata(interface);
1030 (struct hif_device_usb *) usb_get_intfdata(interface);
1031 struct htc_target *htc_handle = hif_dev->htc_handle; 1028 struct htc_target *htc_handle = hif_dev->htc_handle;
1032 int ret; 1029 int ret;
1033 1030
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index e9761c2c8700..8266ce1f02e3 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -184,6 +184,47 @@ err:
184 return ret; 184 return ret;
185} 185}
186 186
187static int ath9k_htc_add_monitor_interface(struct ath9k_htc_priv *priv)
188{
189 struct ath_common *common = ath9k_hw_common(priv->ah);
190 struct ath9k_htc_target_vif hvif;
191 int ret = 0;
192 u8 cmd_rsp;
193
194 if (priv->nvifs > 0)
195 return -ENOBUFS;
196
197 memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif));
198 memcpy(&hvif.myaddr, common->macaddr, ETH_ALEN);
199
200 hvif.opmode = cpu_to_be32(HTC_M_MONITOR);
201 priv->ah->opmode = NL80211_IFTYPE_MONITOR;
202 hvif.index = priv->nvifs;
203
204 WMI_CMD_BUF(WMI_VAP_CREATE_CMDID, &hvif);
205 if (ret)
206 return ret;
207
208 priv->nvifs++;
209 return 0;
210}
211
212static int ath9k_htc_remove_monitor_interface(struct ath9k_htc_priv *priv)
213{
214 struct ath_common *common = ath9k_hw_common(priv->ah);
215 struct ath9k_htc_target_vif hvif;
216 int ret = 0;
217 u8 cmd_rsp;
218
219 memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif));
220 memcpy(&hvif.myaddr, common->macaddr, ETH_ALEN);
221 hvif.index = 0; /* Should do for now */
222 WMI_CMD_BUF(WMI_VAP_REMOVE_CMDID, &hvif);
223 priv->nvifs--;
224
225 return ret;
226}
227
187static int ath9k_htc_add_station(struct ath9k_htc_priv *priv, 228static int ath9k_htc_add_station(struct ath9k_htc_priv *priv,
188 struct ieee80211_vif *vif, 229 struct ieee80211_vif *vif,
189 struct ieee80211_sta *sta) 230 struct ieee80211_sta *sta)
@@ -1199,6 +1240,16 @@ static void ath9k_htc_stop(struct ieee80211_hw *hw)
1199 WMI_CMD(WMI_STOP_RECV_CMDID); 1240 WMI_CMD(WMI_STOP_RECV_CMDID);
1200 skb_queue_purge(&priv->tx_queue); 1241 skb_queue_purge(&priv->tx_queue);
1201 1242
1243 /* Remove monitor interface here */
1244 if (ah->opmode == NL80211_IFTYPE_MONITOR) {
1245 if (ath9k_htc_remove_monitor_interface(priv))
1246 ath_print(common, ATH_DBG_FATAL,
1247 "Unable to remove monitor interface\n");
1248 else
1249 ath_print(common, ATH_DBG_CONFIG,
1250 "Monitor interface removed\n");
1251 }
1252
1202 if (ah->btcoex_hw.enabled) { 1253 if (ah->btcoex_hw.enabled) {
1203 ath9k_hw_btcoex_disable(ah); 1254 ath9k_hw_btcoex_disable(ah);
1204 if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) 1255 if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE)
@@ -1372,13 +1423,16 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed)
1372 } 1423 }
1373 } 1424 }
1374 1425
1375 if (changed & IEEE80211_CONF_CHANGE_MONITOR) 1426 if (changed & IEEE80211_CONF_CHANGE_MONITOR) {
1376 if (conf->flags & IEEE80211_CONF_MONITOR) { 1427 if (conf->flags & IEEE80211_CONF_MONITOR) {
1377 ath_print(common, ATH_DBG_CONFIG, 1428 if (ath9k_htc_add_monitor_interface(priv))
1378 "HW opmode set to Monitor mode\n"); 1429 ath_print(common, ATH_DBG_FATAL,
1379 priv->ah->opmode = NL80211_IFTYPE_MONITOR; 1430 "Failed to set monitor mode\n");
1431 else
1432 ath_print(common, ATH_DBG_CONFIG,
1433 "HW opmode set to Monitor mode\n");
1380 } 1434 }
1381 1435 }
1382 1436
1383 if (changed & IEEE80211_CONF_CHANGE_IDLE) { 1437 if (changed & IEEE80211_CONF_CHANGE_IDLE) {
1384 mutex_lock(&priv->htc_pm_lock); 1438 mutex_lock(&priv->htc_pm_lock);
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.h b/drivers/net/wireless/ath/ath9k/htc_hst.h
index 6fc1b21faa5d..ecd018798c47 100644
--- a/drivers/net/wireless/ath/ath9k/htc_hst.h
+++ b/drivers/net/wireless/ath/ath9k/htc_hst.h
@@ -77,20 +77,6 @@ struct htc_config_pipe_msg {
77 u8 credits; 77 u8 credits;
78} __packed; 78} __packed;
79 79
80struct htc_packet {
81 void *pktcontext;
82 u8 *buf;
83 u8 *buf_payload;
84 u32 buflen;
85 u32 payload_len;
86
87 int endpoint;
88 int status;
89
90 void *context;
91 u32 reserved;
92};
93
94struct htc_ep_callbacks { 80struct htc_ep_callbacks {
95 void *priv; 81 void *priv;
96 void (*tx) (void *, struct sk_buff *, enum htc_endpoint_id, bool txok); 82 void (*tx) (void *, struct sk_buff *, enum htc_endpoint_id, bool txok);
@@ -123,11 +109,6 @@ struct htc_endpoint {
123#define HTC_CONTROL_BUFFER_SIZE \ 109#define HTC_CONTROL_BUFFER_SIZE \
124 (HTC_MAX_CONTROL_MESSAGE_LENGTH + sizeof(struct htc_frame_hdr)) 110 (HTC_MAX_CONTROL_MESSAGE_LENGTH + sizeof(struct htc_frame_hdr))
125 111
126struct htc_control_buf {
127 struct htc_packet htc_pkt;
128 u8 buf[HTC_CONTROL_BUFFER_SIZE];
129};
130
131#define HTC_OP_START_WAIT BIT(0) 112#define HTC_OP_START_WAIT BIT(0)
132#define HTC_OP_CONFIG_PIPE_CREDITS BIT(1) 113#define HTC_OP_CONFIG_PIPE_CREDITS BIT(1)
133 114
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 380d0c651137..9b1ee7fc05c1 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1925,8 +1925,7 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
1925 pCap->num_antcfg_2ghz = 1925 pCap->num_antcfg_2ghz =
1926 ah->eep_ops->get_num_ant_config(ah, ATH9K_HAL_FREQ_BAND_2GHZ); 1926 ah->eep_ops->get_num_ant_config(ah, ATH9K_HAL_FREQ_BAND_2GHZ);
1927 1927
1928 if (AR_SREV_9280_20_OR_LATER(ah) && 1928 if (AR_SREV_9280_20_OR_LATER(ah) && common->btcoex_enabled) {
1929 ath9k_hw_btcoex_supported(ah)) {
1930 btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO; 1929 btcoex_hw->btactive_gpio = ATH_BTACTIVE_GPIO;
1931 btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO; 1930 btcoex_hw->wlanactive_gpio = ATH_WLANACTIVE_GPIO;
1932 1931
@@ -1975,6 +1974,12 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
1975 if ((ant_div_ctl1 & 0x1) && ((ant_div_ctl1 >> 3) & 0x1)) 1974 if ((ant_div_ctl1 & 0x1) && ((ant_div_ctl1 >> 3) & 0x1))
1976 pCap->hw_caps |= ATH9K_HW_CAP_ANT_DIV_COMB; 1975 pCap->hw_caps |= ATH9K_HW_CAP_ANT_DIV_COMB;
1977 } 1976 }
1977 if (AR_SREV_9300_20_OR_LATER(ah)) {
1978 if (ah->eep_ops->get_eeprom(ah, EEP_CHAIN_MASK_REDUCE))
1979 pCap->hw_caps |= ATH9K_HW_CAP_APM;
1980 }
1981
1982
1978 1983
1979 return 0; 1984 return 0;
1980} 1985}
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index cc8f3b9af71f..5fcfa48a45df 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -187,6 +187,7 @@ enum ath9k_hw_caps {
187 ATH9K_HW_CAP_ANT_DIV_COMB = BIT(12), 187 ATH9K_HW_CAP_ANT_DIV_COMB = BIT(12),
188 ATH9K_HW_CAP_2GHZ = BIT(13), 188 ATH9K_HW_CAP_2GHZ = BIT(13),
189 ATH9K_HW_CAP_5GHZ = BIT(14), 189 ATH9K_HW_CAP_5GHZ = BIT(14),
190 ATH9K_HW_CAP_APM = BIT(15),
190}; 191};
191 192
192struct ath9k_hw_capabilities { 193struct ath9k_hw_capabilities {
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 84e19e504dd0..918308a28410 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -37,6 +37,10 @@ int led_blink;
37module_param_named(blink, led_blink, int, 0444); 37module_param_named(blink, led_blink, int, 0444);
38MODULE_PARM_DESC(blink, "Enable LED blink on activity"); 38MODULE_PARM_DESC(blink, "Enable LED blink on activity");
39 39
40static int ath9k_btcoex_enable;
41module_param_named(btcoex_enable, ath9k_btcoex_enable, int, 0444);
42MODULE_PARM_DESC(btcoex_enable, "Enable wifi-BT coexistence");
43
40/* We use the hw_value as an index into our private channel structure */ 44/* We use the hw_value as an index into our private channel structure */
41 45
42#define CHAN2G(_freq, _idx) { \ 46#define CHAN2G(_freq, _idx) { \
@@ -540,6 +544,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
540 common->hw = sc->hw; 544 common->hw = sc->hw;
541 common->priv = sc; 545 common->priv = sc;
542 common->debug_mask = ath9k_debug; 546 common->debug_mask = ath9k_debug;
547 common->btcoex_enabled = ath9k_btcoex_enable == 1;
543 spin_lock_init(&common->cc_lock); 548 spin_lock_init(&common->cc_lock);
544 549
545 spin_lock_init(&sc->wiphy_lock); 550 spin_lock_init(&sc->wiphy_lock);
@@ -562,13 +567,6 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
562 if (ret) 567 if (ret)
563 goto err_hw; 568 goto err_hw;
564 569
565 ret = ath9k_init_debug(ah);
566 if (ret) {
567 ath_print(common, ATH_DBG_FATAL,
568 "Unable to create debugfs files\n");
569 goto err_debug;
570 }
571
572 ret = ath9k_init_queues(sc); 570 ret = ath9k_init_queues(sc);
573 if (ret) 571 if (ret)
574 goto err_queues; 572 goto err_queues;
@@ -591,8 +589,6 @@ err_btcoex:
591 if (ATH_TXQ_SETUP(sc, i)) 589 if (ATH_TXQ_SETUP(sc, i))
592 ath_tx_cleanupq(sc, &sc->tx.txq[i]); 590 ath_tx_cleanupq(sc, &sc->tx.txq[i]);
593err_queues: 591err_queues:
594 ath9k_exit_debug(ah);
595err_debug:
596 ath9k_hw_deinit(ah); 592 ath9k_hw_deinit(ah);
597err_hw: 593err_hw:
598 tasklet_kill(&sc->intr_tq); 594 tasklet_kill(&sc->intr_tq);
@@ -738,6 +734,13 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, u16 subsysid,
738 if (error) 734 if (error)
739 goto error_register; 735 goto error_register;
740 736
737 error = ath9k_init_debug(ah);
738 if (error) {
739 ath_print(common, ATH_DBG_FATAL,
740 "Unable to create debugfs files\n");
741 goto error_world;
742 }
743
741 /* Handle world regulatory */ 744 /* Handle world regulatory */
742 if (!ath_is_world_regd(reg)) { 745 if (!ath_is_world_regd(reg)) {
743 error = regulatory_hint(hw->wiphy, reg->alpha2); 746 error = regulatory_hint(hw->wiphy, reg->alpha2);
@@ -796,7 +799,6 @@ static void ath9k_deinit_softc(struct ath_softc *sc)
796 if (ATH_TXQ_SETUP(sc, i)) 799 if (ATH_TXQ_SETUP(sc, i))
797 ath_tx_cleanupq(sc, &sc->tx.txq[i]); 800 ath_tx_cleanupq(sc, &sc->tx.txq[i]);
798 801
799 ath9k_exit_debug(sc->sc_ah);
800 ath9k_hw_deinit(sc->sc_ah); 802 ath9k_hw_deinit(sc->sc_ah);
801 803
802 tasklet_kill(&sc->intr_tq); 804 tasklet_kill(&sc->intr_tq);
@@ -863,20 +865,12 @@ static int __init ath9k_init(void)
863 goto err_out; 865 goto err_out;
864 } 866 }
865 867
866 error = ath9k_debug_create_root();
867 if (error) {
868 printk(KERN_ERR
869 "ath9k: Unable to create debugfs root: %d\n",
870 error);
871 goto err_rate_unregister;
872 }
873
874 error = ath_pci_init(); 868 error = ath_pci_init();
875 if (error < 0) { 869 if (error < 0) {
876 printk(KERN_ERR 870 printk(KERN_ERR
877 "ath9k: No PCI devices found, driver not installed.\n"); 871 "ath9k: No PCI devices found, driver not installed.\n");
878 error = -ENODEV; 872 error = -ENODEV;
879 goto err_remove_root; 873 goto err_rate_unregister;
880 } 874 }
881 875
882 error = ath_ahb_init(); 876 error = ath_ahb_init();
@@ -890,8 +884,6 @@ static int __init ath9k_init(void)
890 err_pci_exit: 884 err_pci_exit:
891 ath_pci_exit(); 885 ath_pci_exit();
892 886
893 err_remove_root:
894 ath9k_debug_remove_root();
895 err_rate_unregister: 887 err_rate_unregister:
896 ath_rate_control_unregister(); 888 ath_rate_control_unregister();
897 err_out: 889 err_out:
@@ -903,7 +895,6 @@ static void __exit ath9k_exit(void)
903{ 895{
904 ath_ahb_exit(); 896 ath_ahb_exit();
905 ath_pci_exit(); 897 ath_pci_exit();
906 ath9k_debug_remove_root();
907 ath_rate_control_unregister(); 898 ath_rate_control_unregister();
908 printk(KERN_INFO "%s: Driver unloaded\n", dev_info); 899 printk(KERN_INFO "%s: Driver unloaded\n", dev_info);
909} 900}
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 7acd6b0ca011..f026a031713b 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -553,9 +553,12 @@ void ath_update_chainmask(struct ath_softc *sc, int is_ht)
553static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta) 553static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta)
554{ 554{
555 struct ath_node *an; 555 struct ath_node *an;
556 556 struct ath_hw *ah = sc->sc_ah;
557 an = (struct ath_node *)sta->drv_priv; 557 an = (struct ath_node *)sta->drv_priv;
558 558
559 if ((ah->caps.hw_caps) & ATH9K_HW_CAP_APM)
560 sc->sc_flags |= SC_OP_ENABLE_APM;
561
559 if (sc->sc_flags & SC_OP_TXAGGR) { 562 if (sc->sc_flags & SC_OP_TXAGGR) {
560 ath_tx_node_init(sc, an); 563 ath_tx_node_init(sc, an);
561 an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + 564 an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR +
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 495432ec85a9..821d3679c6ff 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -250,11 +250,11 @@ static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq,
250static void ath_tx_set_retry(struct ath_softc *sc, struct ath_txq *txq, 250static void ath_tx_set_retry(struct ath_softc *sc, struct ath_txq *txq,
251 struct sk_buff *skb) 251 struct sk_buff *skb)
252{ 252{
253 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); 253 struct ath_frame_info *fi = get_frame_info(skb);
254 struct ieee80211_hdr *hdr; 254 struct ieee80211_hdr *hdr;
255 255
256 TX_STAT_INC(txq->axq_qnum, a_retries); 256 TX_STAT_INC(txq->axq_qnum, a_retries);
257 if (tx_info->control.rates[4].count++ > 0) 257 if (fi->retries++ > 0)
258 return; 258 return;
259 259
260 hdr = (struct ieee80211_hdr *)skb->data; 260 hdr = (struct ieee80211_hdr *)skb->data;
@@ -1506,6 +1506,18 @@ static u32 ath_pkt_duration(struct ath_softc *sc, u8 rix, int pktlen,
1506 return duration; 1506 return duration;
1507} 1507}
1508 1508
1509u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate)
1510{
1511 struct ath_hw *ah = sc->sc_ah;
1512 struct ath9k_channel *curchan = ah->curchan;
1513 if ((sc->sc_flags & SC_OP_ENABLE_APM) &&
1514 (curchan->channelFlags & CHANNEL_5GHZ) &&
1515 (chainmask == 0x7) && (rate < 0x90))
1516 return 0x3;
1517 else
1518 return chainmask;
1519}
1520
1509static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len) 1521static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len)
1510{ 1522{
1511 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1523 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
@@ -1546,7 +1558,6 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len)
1546 1558
1547 rix = rates[i].idx; 1559 rix = rates[i].idx;
1548 series[i].Tries = rates[i].count; 1560 series[i].Tries = rates[i].count;
1549 series[i].ChSel = common->tx_chainmask;
1550 1561
1551 if ((sc->config.ath_aggr_prot && bf_isaggr(bf)) || 1562 if ((sc->config.ath_aggr_prot && bf_isaggr(bf)) ||
1552 (rates[i].flags & IEEE80211_TX_RC_USE_RTS_CTS)) { 1563 (rates[i].flags & IEEE80211_TX_RC_USE_RTS_CTS)) {
@@ -1569,6 +1580,8 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len)
1569 if (rates[i].flags & IEEE80211_TX_RC_MCS) { 1580 if (rates[i].flags & IEEE80211_TX_RC_MCS) {
1570 /* MCS rates */ 1581 /* MCS rates */
1571 series[i].Rate = rix | 0x80; 1582 series[i].Rate = rix | 0x80;
1583 series[i].ChSel = ath_txchainmask_reduction(sc,
1584 common->tx_chainmask, series[i].Rate);
1572 series[i].PktDuration = ath_pkt_duration(sc, rix, len, 1585 series[i].PktDuration = ath_pkt_duration(sc, rix, len,
1573 is_40, is_sgi, is_sp); 1586 is_40, is_sgi, is_sp);
1574 if (rix < 8 && (tx_info->flags & IEEE80211_TX_CTL_STBC)) 1587 if (rix < 8 && (tx_info->flags & IEEE80211_TX_CTL_STBC))
@@ -1576,7 +1589,7 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len)
1576 continue; 1589 continue;
1577 } 1590 }
1578 1591
1579 /* legcay rates */ 1592 /* legacy rates */
1580 if ((tx_info->band == IEEE80211_BAND_2GHZ) && 1593 if ((tx_info->band == IEEE80211_BAND_2GHZ) &&
1581 !(rate->flags & IEEE80211_RATE_ERP_G)) 1594 !(rate->flags & IEEE80211_RATE_ERP_G))
1582 phy = WLAN_RC_PHY_CCK; 1595 phy = WLAN_RC_PHY_CCK;
@@ -1592,6 +1605,12 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int len)
1592 is_sp = false; 1605 is_sp = false;
1593 } 1606 }
1594 1607
1608 if (bf->bf_state.bfs_paprd)
1609 series[i].ChSel = common->tx_chainmask;
1610 else
1611 series[i].ChSel = ath_txchainmask_reduction(sc,
1612 common->tx_chainmask, series[i].Rate);
1613
1595 series[i].PktDuration = ath9k_hw_computetxtime(sc->sc_ah, 1614 series[i].PktDuration = ath9k_hw_computetxtime(sc->sc_ah,
1596 phy, rate->bitrate * 100, len, rix, is_sp); 1615 phy, rate->bitrate * 100, len, rix, is_sp);
1597 } 1616 }
diff --git a/drivers/net/wireless/ath/carl9170/usb.c b/drivers/net/wireless/ath/carl9170/usb.c
index a268053e18e5..2d947a30d29e 100644
--- a/drivers/net/wireless/ath/carl9170/usb.c
+++ b/drivers/net/wireless/ath/carl9170/usb.c
@@ -160,8 +160,7 @@ err_acc:
160 160
161static void carl9170_usb_tx_data_complete(struct urb *urb) 161static void carl9170_usb_tx_data_complete(struct urb *urb)
162{ 162{
163 struct ar9170 *ar = (struct ar9170 *) 163 struct ar9170 *ar = usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
164 usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
165 164
166 if (WARN_ON_ONCE(!ar)) { 165 if (WARN_ON_ONCE(!ar)) {
167 dev_kfree_skb_irq(urb->context); 166 dev_kfree_skb_irq(urb->context);
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 9769483156e7..905f1d7bac20 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -67,6 +67,18 @@ enum b43_nphy_rf_sequence {
67 B43_RFSEQ_UPDATE_GAINU, 67 B43_RFSEQ_UPDATE_GAINU,
68}; 68};
69 69
70enum b43_nphy_rssi_type {
71 B43_NPHY_RSSI_X = 0,
72 B43_NPHY_RSSI_Y,
73 B43_NPHY_RSSI_Z,
74 B43_NPHY_RSSI_PWRDET,
75 B43_NPHY_RSSI_TSSI_I,
76 B43_NPHY_RSSI_TSSI_Q,
77 B43_NPHY_RSSI_TBD,
78};
79
80static void b43_nphy_stay_in_carrier_search(struct b43_wldev *dev,
81 bool enable);
70static void b43_nphy_set_rf_sequence(struct b43_wldev *dev, u8 cmd, 82static void b43_nphy_set_rf_sequence(struct b43_wldev *dev, u8 cmd,
71 u8 *events, u8 *delays, u8 length); 83 u8 *events, u8 *delays, u8 length);
72static void b43_nphy_force_rf_sequence(struct b43_wldev *dev, 84static void b43_nphy_force_rf_sequence(struct b43_wldev *dev,
@@ -145,9 +157,153 @@ static void b43_chantab_phy_upload(struct b43_wldev *dev,
145 b43_phy_write(dev, B43_NPHY_BW6, e->phy_bw6); 157 b43_phy_write(dev, B43_NPHY_BW6, e->phy_bw6);
146} 158}
147 159
160/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlEnable */
161static void b43_nphy_tx_power_ctrl(struct b43_wldev *dev, bool enable)
162{
163 struct b43_phy_n *nphy = dev->phy.n;
164 u8 i;
165 u16 tmp;
166
167 if (nphy->hang_avoid)
168 b43_nphy_stay_in_carrier_search(dev, 1);
169
170 nphy->txpwrctrl = enable;
171 if (!enable) {
172 if (dev->phy.rev >= 3)
173 ; /* TODO */
174
175 b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x6840);
176 for (i = 0; i < 84; i++)
177 b43_phy_write(dev, B43_NPHY_TABLE_DATALO, 0);
178
179 b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x6C40);
180 for (i = 0; i < 84; i++)
181 b43_phy_write(dev, B43_NPHY_TABLE_DATALO, 0);
182
183 tmp = B43_NPHY_TXPCTL_CMD_COEFF | B43_NPHY_TXPCTL_CMD_HWPCTLEN;
184 if (dev->phy.rev >= 3)
185 tmp |= B43_NPHY_TXPCTL_CMD_PCTLEN;
186 b43_phy_mask(dev, B43_NPHY_TXPCTL_CMD, ~tmp);
187
188 if (dev->phy.rev >= 3) {
189 b43_phy_set(dev, B43_NPHY_AFECTL_OVER1, 0x0100);
190 b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x0100);
191 } else {
192 b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x4000);
193 }
194
195 if (dev->phy.rev == 2)
196 b43_phy_maskset(dev, B43_NPHY_BPHY_CTL3,
197 ~B43_NPHY_BPHY_CTL3_SCALE, 0x53);
198 else if (dev->phy.rev < 2)
199 b43_phy_maskset(dev, B43_NPHY_BPHY_CTL3,
200 ~B43_NPHY_BPHY_CTL3_SCALE, 0x5A);
201
202 if (dev->phy.rev < 2 && 0)
203 ; /* TODO */
204 } else {
205 b43err(dev->wl, "enabling tx pwr ctrl not implemented yet\n");
206 }
207
208 if (nphy->hang_avoid)
209 b43_nphy_stay_in_carrier_search(dev, 0);
210}
211
212/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrFix */
148static void b43_nphy_tx_power_fix(struct b43_wldev *dev) 213static void b43_nphy_tx_power_fix(struct b43_wldev *dev)
149{ 214{
150 //TODO 215 struct b43_phy_n *nphy = dev->phy.n;
216 struct ssb_sprom *sprom = &(dev->dev->bus->sprom);
217
218 u8 txpi[2], bbmult, i;
219 u16 tmp, radio_gain, dac_gain;
220 u16 freq = dev->phy.channel_freq;
221 u32 txgain;
222 /* u32 gaintbl; rev3+ */
223
224 if (nphy->hang_avoid)
225 b43_nphy_stay_in_carrier_search(dev, 1);
226
227 if (dev->phy.rev >= 3) {
228 txpi[0] = 40;
229 txpi[1] = 40;
230 } else if (sprom->revision < 4) {
231 txpi[0] = 72;
232 txpi[1] = 72;
233 } else {
234 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
235 txpi[0] = sprom->txpid2g[0];
236 txpi[1] = sprom->txpid2g[1];
237 } else if (freq >= 4900 && freq < 5100) {
238 txpi[0] = sprom->txpid5gl[0];
239 txpi[1] = sprom->txpid5gl[1];
240 } else if (freq >= 5100 && freq < 5500) {
241 txpi[0] = sprom->txpid5g[0];
242 txpi[1] = sprom->txpid5g[1];
243 } else if (freq >= 5500) {
244 txpi[0] = sprom->txpid5gh[0];
245 txpi[1] = sprom->txpid5gh[1];
246 } else {
247 txpi[0] = 91;
248 txpi[1] = 91;
249 }
250 }
251
252 /*
253 for (i = 0; i < 2; i++) {
254 nphy->txpwrindex[i].index_internal = txpi[i];
255 nphy->txpwrindex[i].index_internal_save = txpi[i];
256 }
257 */
258
259 for (i = 0; i < 2; i++) {
260 if (dev->phy.rev >= 3) {
261 /* TODO */
262 radio_gain = (txgain >> 16) & 0x1FFFF;
263 } else {
264 txgain = b43_ntab_tx_gain_rev0_1_2[txpi[i]];
265 radio_gain = (txgain >> 16) & 0x1FFF;
266 }
267
268 dac_gain = (txgain >> 8) & 0x3F;
269 bbmult = txgain & 0xFF;
270
271 if (dev->phy.rev >= 3) {
272 if (i == 0)
273 b43_phy_set(dev, B43_NPHY_AFECTL_OVER1, 0x0100);
274 else
275 b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x0100);
276 } else {
277 b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x4000);
278 }
279
280 if (i == 0)
281 b43_phy_write(dev, B43_NPHY_AFECTL_DACGAIN1, dac_gain);
282 else
283 b43_phy_write(dev, B43_NPHY_AFECTL_DACGAIN2, dac_gain);
284
285 b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x1D10 + i);
286 b43_phy_write(dev, B43_NPHY_TABLE_DATALO, radio_gain);
287
288 b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x3C57);
289 tmp = b43_phy_read(dev, B43_NPHY_TABLE_DATALO);
290
291 if (i == 0)
292 tmp = (tmp & 0x00FF) | (bbmult << 8);
293 else
294 tmp = (tmp & 0xFF00) | bbmult;
295
296 b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x3C57);
297 b43_phy_write(dev, B43_NPHY_TABLE_DATALO, tmp);
298
299 if (0)
300 ; /* TODO */
301 }
302
303 b43_phy_mask(dev, B43_NPHY_BPHY_CTL2, ~B43_NPHY_BPHY_CTL2_LUT);
304
305 if (nphy->hang_avoid)
306 b43_nphy_stay_in_carrier_search(dev, 0);
151} 307}
152 308
153 309
@@ -1593,7 +1749,8 @@ static void b43_nphy_bphy_init(struct b43_wldev *dev)
1593 1749
1594/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ScaleOffsetRssi */ 1750/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ScaleOffsetRssi */
1595static void b43_nphy_scale_offset_rssi(struct b43_wldev *dev, u16 scale, 1751static void b43_nphy_scale_offset_rssi(struct b43_wldev *dev, u16 scale,
1596 s8 offset, u8 core, u8 rail, u8 type) 1752 s8 offset, u8 core, u8 rail,
1753 enum b43_nphy_rssi_type type)
1597{ 1754{
1598 u16 tmp; 1755 u16 tmp;
1599 bool core1or5 = (core == 1) || (core == 5); 1756 bool core1or5 = (core == 1) || (core == 5);
@@ -1602,53 +1759,59 @@ static void b43_nphy_scale_offset_rssi(struct b43_wldev *dev, u16 scale,
1602 offset = clamp_val(offset, -32, 31); 1759 offset = clamp_val(offset, -32, 31);
1603 tmp = ((scale & 0x3F) << 8) | (offset & 0x3F); 1760 tmp = ((scale & 0x3F) << 8) | (offset & 0x3F);
1604 1761
1605 if (core1or5 && (rail == 0) && (type == 2)) 1762 if (core1or5 && (rail == 0) && (type == B43_NPHY_RSSI_Z))
1606 b43_phy_write(dev, B43_NPHY_RSSIMC_0I_RSSI_Z, tmp); 1763 b43_phy_write(dev, B43_NPHY_RSSIMC_0I_RSSI_Z, tmp);
1607 if (core1or5 && (rail == 1) && (type == 2)) 1764 if (core1or5 && (rail == 1) && (type == B43_NPHY_RSSI_Z))
1608 b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_RSSI_Z, tmp); 1765 b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_RSSI_Z, tmp);
1609 if (core2or5 && (rail == 0) && (type == 2)) 1766 if (core2or5 && (rail == 0) && (type == B43_NPHY_RSSI_Z))
1610 b43_phy_write(dev, B43_NPHY_RSSIMC_1I_RSSI_Z, tmp); 1767 b43_phy_write(dev, B43_NPHY_RSSIMC_1I_RSSI_Z, tmp);
1611 if (core2or5 && (rail == 1) && (type == 2)) 1768 if (core2or5 && (rail == 1) && (type == B43_NPHY_RSSI_Z))
1612 b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_RSSI_Z, tmp); 1769 b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_RSSI_Z, tmp);
1613 if (core1or5 && (rail == 0) && (type == 0)) 1770
1771 if (core1or5 && (rail == 0) && (type == B43_NPHY_RSSI_X))
1614 b43_phy_write(dev, B43_NPHY_RSSIMC_0I_RSSI_X, tmp); 1772 b43_phy_write(dev, B43_NPHY_RSSIMC_0I_RSSI_X, tmp);
1615 if (core1or5 && (rail == 1) && (type == 0)) 1773 if (core1or5 && (rail == 1) && (type == B43_NPHY_RSSI_X))
1616 b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_RSSI_X, tmp); 1774 b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_RSSI_X, tmp);
1617 if (core2or5 && (rail == 0) && (type == 0)) 1775 if (core2or5 && (rail == 0) && (type == B43_NPHY_RSSI_X))
1618 b43_phy_write(dev, B43_NPHY_RSSIMC_1I_RSSI_X, tmp); 1776 b43_phy_write(dev, B43_NPHY_RSSIMC_1I_RSSI_X, tmp);
1619 if (core2or5 && (rail == 1) && (type == 0)) 1777 if (core2or5 && (rail == 1) && (type == B43_NPHY_RSSI_X))
1620 b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_RSSI_X, tmp); 1778 b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_RSSI_X, tmp);
1621 if (core1or5 && (rail == 0) && (type == 1)) 1779
1780 if (core1or5 && (rail == 0) && (type == B43_NPHY_RSSI_Y))
1622 b43_phy_write(dev, B43_NPHY_RSSIMC_0I_RSSI_Y, tmp); 1781 b43_phy_write(dev, B43_NPHY_RSSIMC_0I_RSSI_Y, tmp);
1623 if (core1or5 && (rail == 1) && (type == 1)) 1782 if (core1or5 && (rail == 1) && (type == B43_NPHY_RSSI_Y))
1624 b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_RSSI_Y, tmp); 1783 b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_RSSI_Y, tmp);
1625 if (core2or5 && (rail == 0) && (type == 1)) 1784 if (core2or5 && (rail == 0) && (type == B43_NPHY_RSSI_Y))
1626 b43_phy_write(dev, B43_NPHY_RSSIMC_1I_RSSI_Y, tmp); 1785 b43_phy_write(dev, B43_NPHY_RSSIMC_1I_RSSI_Y, tmp);
1627 if (core2or5 && (rail == 1) && (type == 1)) 1786 if (core2or5 && (rail == 1) && (type == B43_NPHY_RSSI_Y))
1628 b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_RSSI_Y, tmp); 1787 b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_RSSI_Y, tmp);
1629 if (core1or5 && (rail == 0) && (type == 6)) 1788
1789 if (core1or5 && (rail == 0) && (type == B43_NPHY_RSSI_TBD))
1630 b43_phy_write(dev, B43_NPHY_RSSIMC_0I_TBD, tmp); 1790 b43_phy_write(dev, B43_NPHY_RSSIMC_0I_TBD, tmp);
1631 if (core1or5 && (rail == 1) && (type == 6)) 1791 if (core1or5 && (rail == 1) && (type == B43_NPHY_RSSI_TBD))
1632 b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_TBD, tmp); 1792 b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_TBD, tmp);
1633 if (core2or5 && (rail == 0) && (type == 6)) 1793 if (core2or5 && (rail == 0) && (type == B43_NPHY_RSSI_TBD))
1634 b43_phy_write(dev, B43_NPHY_RSSIMC_1I_TBD, tmp); 1794 b43_phy_write(dev, B43_NPHY_RSSIMC_1I_TBD, tmp);
1635 if (core2or5 && (rail == 1) && (type == 6)) 1795 if (core2or5 && (rail == 1) && (type == B43_NPHY_RSSI_TBD))
1636 b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_TBD, tmp); 1796 b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_TBD, tmp);
1637 if (core1or5 && (rail == 0) && (type == 3)) 1797
1798 if (core1or5 && (rail == 0) && (type == B43_NPHY_RSSI_PWRDET))
1638 b43_phy_write(dev, B43_NPHY_RSSIMC_0I_PWRDET, tmp); 1799 b43_phy_write(dev, B43_NPHY_RSSIMC_0I_PWRDET, tmp);
1639 if (core1or5 && (rail == 1) && (type == 3)) 1800 if (core1or5 && (rail == 1) && (type == B43_NPHY_RSSI_PWRDET))
1640 b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_PWRDET, tmp); 1801 b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_PWRDET, tmp);
1641 if (core2or5 && (rail == 0) && (type == 3)) 1802 if (core2or5 && (rail == 0) && (type == B43_NPHY_RSSI_PWRDET))
1642 b43_phy_write(dev, B43_NPHY_RSSIMC_1I_PWRDET, tmp); 1803 b43_phy_write(dev, B43_NPHY_RSSIMC_1I_PWRDET, tmp);
1643 if (core2or5 && (rail == 1) && (type == 3)) 1804 if (core2or5 && (rail == 1) && (type == B43_NPHY_RSSI_PWRDET))
1644 b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_PWRDET, tmp); 1805 b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_PWRDET, tmp);
1645 if (core1or5 && (type == 4)) 1806
1807 if (core1or5 && (type == B43_NPHY_RSSI_TSSI_I))
1646 b43_phy_write(dev, B43_NPHY_RSSIMC_0I_TSSI, tmp); 1808 b43_phy_write(dev, B43_NPHY_RSSIMC_0I_TSSI, tmp);
1647 if (core2or5 && (type == 4)) 1809 if (core2or5 && (type == B43_NPHY_RSSI_TSSI_I))
1648 b43_phy_write(dev, B43_NPHY_RSSIMC_1I_TSSI, tmp); 1810 b43_phy_write(dev, B43_NPHY_RSSIMC_1I_TSSI, tmp);
1649 if (core1or5 && (type == 5)) 1811
1812 if (core1or5 && (type == B43_NPHY_RSSI_TSSI_Q))
1650 b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_TSSI, tmp); 1813 b43_phy_write(dev, B43_NPHY_RSSIMC_0Q_TSSI, tmp);
1651 if (core2or5 && (type == 5)) 1814 if (core2or5 && (type == B43_NPHY_RSSI_TSSI_Q))
1652 b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_TSSI, tmp); 1815 b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_TSSI, tmp);
1653} 1816}
1654 1817
@@ -1676,27 +1839,39 @@ static void b43_nphy_rev2_rssi_select(struct b43_wldev *dev, u8 code, u8 type)
1676 (type + 1) << 4); 1839 (type + 1) << 4);
1677 } 1840 }
1678 1841
1679 /* TODO use some definitions */
1680 if (code == 0) { 1842 if (code == 0) {
1681 b43_phy_maskset(dev, B43_NPHY_AFECTL_OVER, 0xCFFF, 0); 1843 b43_phy_mask(dev, B43_NPHY_AFECTL_OVER, ~0x3000);
1682 if (type < 3) { 1844 if (type < 3) {
1683 b43_phy_maskset(dev, B43_NPHY_RFCTL_CMD, 0xFEC7, 0); 1845 b43_phy_mask(dev, B43_NPHY_RFCTL_CMD,
1684 b43_phy_maskset(dev, B43_NPHY_RFCTL_OVER, 0xEFDC, 0); 1846 ~(B43_NPHY_RFCTL_CMD_RXEN |
1685 b43_phy_maskset(dev, B43_NPHY_RFCTL_CMD, 0xFFFE, 0); 1847 B43_NPHY_RFCTL_CMD_CORESEL));
1848 b43_phy_mask(dev, B43_NPHY_RFCTL_OVER,
1849 ~(0x1 << 12 |
1850 0x1 << 5 |
1851 0x1 << 1 |
1852 0x1));
1853 b43_phy_mask(dev, B43_NPHY_RFCTL_CMD,
1854 ~B43_NPHY_RFCTL_CMD_START);
1686 udelay(20); 1855 udelay(20);
1687 b43_phy_maskset(dev, B43_NPHY_RFCTL_OVER, 0xFFFE, 0); 1856 b43_phy_mask(dev, B43_NPHY_RFCTL_OVER, ~0x1);
1688 } 1857 }
1689 } else { 1858 } else {
1690 b43_phy_maskset(dev, B43_NPHY_AFECTL_OVER, 0xCFFF, 1859 b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x3000);
1691 0x3000);
1692 if (type < 3) { 1860 if (type < 3) {
1693 b43_phy_maskset(dev, B43_NPHY_RFCTL_CMD, 1861 b43_phy_maskset(dev, B43_NPHY_RFCTL_CMD,
1694 0xFEC7, 0x0180); 1862 ~(B43_NPHY_RFCTL_CMD_RXEN |
1695 b43_phy_maskset(dev, B43_NPHY_RFCTL_OVER, 1863 B43_NPHY_RFCTL_CMD_CORESEL),
1696 0xEFDC, (code << 1 | 0x1021)); 1864 (B43_NPHY_RFCTL_CMD_RXEN |
1697 b43_phy_maskset(dev, B43_NPHY_RFCTL_CMD, 0xFFFE, 0x1); 1865 code << B43_NPHY_RFCTL_CMD_CORESEL_SHIFT));
1866 b43_phy_set(dev, B43_NPHY_RFCTL_OVER,
1867 (0x1 << 12 |
1868 0x1 << 5 |
1869 0x1 << 1 |
1870 0x1));
1871 b43_phy_set(dev, B43_NPHY_RFCTL_CMD,
1872 B43_NPHY_RFCTL_CMD_START);
1698 udelay(20); 1873 udelay(20);
1699 b43_phy_maskset(dev, B43_NPHY_RFCTL_OVER, 0xFFFE, 0); 1874 b43_phy_mask(dev, B43_NPHY_RFCTL_OVER, ~0x1);
1700 } 1875 }
1701 } 1876 }
1702} 1877}
@@ -1918,7 +2093,10 @@ static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type)
1918 u16 class, override; 2093 u16 class, override;
1919 u8 regs_save_radio[2]; 2094 u8 regs_save_radio[2];
1920 u16 regs_save_phy[2]; 2095 u16 regs_save_phy[2];
2096
1921 s8 offset[4]; 2097 s8 offset[4];
2098 u8 core;
2099 u8 rail;
1922 2100
1923 u16 clip_state[2]; 2101 u16 clip_state[2];
1924 u16 clip_off[2] = { 0xFFFF, 0xFFFF }; 2102 u16 clip_off[2] = { 0xFFFF, 0xFFFF };
@@ -2019,12 +2197,11 @@ static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type)
2019 if (results_min[i] == 248) 2197 if (results_min[i] == 248)
2020 offset[i] = code - 32; 2198 offset[i] = code - 32;
2021 2199
2022 if (i % 2 == 0) 2200 core = (i / 2) ? 2 : 1;
2023 b43_nphy_scale_offset_rssi(dev, 0, offset[i], 1, 0, 2201 rail = (i % 2) ? 1 : 0;
2024 type); 2202
2025 else 2203 b43_nphy_scale_offset_rssi(dev, 0, offset[i], core, rail,
2026 b43_nphy_scale_offset_rssi(dev, 0, offset[i], 2, 1, 2204 type);
2027 type);
2028 } 2205 }
2029 2206
2030 b43_radio_maskset(dev, B2055_C1_PD_RSSIMISC, 0xF8, state[0]); 2207 b43_radio_maskset(dev, B2055_C1_PD_RSSIMISC, 0xF8, state[0]);
@@ -2066,6 +2243,9 @@ static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type)
2066 2243
2067 b43_nphy_classifier(dev, 7, class); 2244 b43_nphy_classifier(dev, 7, class);
2068 b43_nphy_write_clip_detection(dev, clip_state); 2245 b43_nphy_write_clip_detection(dev, clip_state);
2246 /* Specs don't say about reset here, but it makes wl and b43 dumps
2247 identical, it really seems wl performs this */
2248 b43_nphy_reset_cca(dev);
2069} 2249}
2070 2250
2071/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICalRev3 */ 2251/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICalRev3 */
@@ -2083,9 +2263,9 @@ static void b43_nphy_rssi_cal(struct b43_wldev *dev)
2083 if (dev->phy.rev >= 3) { 2263 if (dev->phy.rev >= 3) {
2084 b43_nphy_rev3_rssi_cal(dev); 2264 b43_nphy_rev3_rssi_cal(dev);
2085 } else { 2265 } else {
2086 b43_nphy_rev2_rssi_cal(dev, 2); 2266 b43_nphy_rev2_rssi_cal(dev, B43_NPHY_RSSI_Z);
2087 b43_nphy_rev2_rssi_cal(dev, 0); 2267 b43_nphy_rev2_rssi_cal(dev, B43_NPHY_RSSI_X);
2088 b43_nphy_rev2_rssi_cal(dev, 1); 2268 b43_nphy_rev2_rssi_cal(dev, B43_NPHY_RSSI_Y);
2089 } 2269 }
2090} 2270}
2091 2271
@@ -2351,7 +2531,7 @@ static struct nphy_txgains b43_nphy_get_tx_gains(struct b43_wldev *dev)
2351 struct nphy_txgains target; 2531 struct nphy_txgains target;
2352 const u32 *table = NULL; 2532 const u32 *table = NULL;
2353 2533
2354 if (nphy->txpwrctrl == 0) { 2534 if (!nphy->txpwrctrl) {
2355 int i; 2535 int i;
2356 2536
2357 if (nphy->hang_avoid) 2537 if (nphy->hang_avoid)
@@ -3260,9 +3440,8 @@ int b43_phy_initn(struct b43_wldev *dev)
3260 b43_nphy_bphy_init(dev); 3440 b43_nphy_bphy_init(dev);
3261 3441
3262 tx_pwr_state = nphy->txpwrctrl; 3442 tx_pwr_state = nphy->txpwrctrl;
3263 /* TODO N PHY TX power control with argument 0 3443 b43_nphy_tx_power_ctrl(dev, false);
3264 (turning off power control) */ 3444 b43_nphy_tx_power_fix(dev);
3265 /* TODO Fix the TX Power Settings */
3266 /* TODO N PHY TX Power Control Idle TSSI */ 3445 /* TODO N PHY TX Power Control Idle TSSI */
3267 /* TODO N PHY TX Power Control Setup */ 3446 /* TODO N PHY TX Power Control Setup */
3268 3447
@@ -3319,21 +3498,18 @@ int b43_phy_initn(struct b43_wldev *dev)
3319 /* TODO N PHY Pre Calibrate TX Gain */ 3498 /* TODO N PHY Pre Calibrate TX Gain */
3320 target = b43_nphy_get_tx_gains(dev); 3499 target = b43_nphy_get_tx_gains(dev);
3321 } 3500 }
3322 } 3501 if (!b43_nphy_cal_tx_iq_lo(dev, target, true, false))
3502 if (b43_nphy_cal_rx_iq(dev, target, 2, 0) == 0)
3503 b43_nphy_save_cal(dev);
3504 } else if (nphy->mphase_cal_phase_id == 0)
3505 ;/* N PHY Periodic Calibration with arg 3 */
3506 } else {
3507 b43_nphy_restore_cal(dev);
3323 } 3508 }
3324 } 3509 }
3325 3510
3326 if (!b43_nphy_cal_tx_iq_lo(dev, target, true, false)) {
3327 if (b43_nphy_cal_rx_iq(dev, target, 2, 0) == 0)
3328 b43_nphy_save_cal(dev);
3329 else if (nphy->mphase_cal_phase_id == 0)
3330 ;/* N PHY Periodic Calibration with argument 3 */
3331 } else {
3332 b43_nphy_restore_cal(dev);
3333 }
3334
3335 b43_nphy_tx_pwr_ctrl_coef_setup(dev); 3511 b43_nphy_tx_pwr_ctrl_coef_setup(dev);
3336 /* TODO N PHY TX Power Control Enable with argument tx_pwr_state */ 3512 b43_nphy_tx_power_ctrl(dev, tx_pwr_state);
3337 b43_phy_write(dev, B43_NPHY_TXMACIF_HOLDOFF, 0x0015); 3513 b43_phy_write(dev, B43_NPHY_TXMACIF_HOLDOFF, 0x0015);
3338 b43_phy_write(dev, B43_NPHY_TXMACDELAY, 0x0320); 3514 b43_phy_write(dev, B43_NPHY_TXMACDELAY, 0x0320);
3339 if (phy->rev >= 3 && phy->rev <= 6) 3515 if (phy->rev >= 3 && phy->rev <= 6)
@@ -3384,7 +3560,7 @@ static void b43_nphy_channel_setup(struct b43_wldev *dev,
3384 b43_phy_mask(dev, B43_PHY_B_TEST, ~0x840); 3560 b43_phy_mask(dev, B43_PHY_B_TEST, ~0x840);
3385 } 3561 }
3386 3562
3387 if (nphy->txpwrctrl) 3563 if (!nphy->txpwrctrl)
3388 b43_nphy_tx_power_fix(dev); 3564 b43_nphy_tx_power_fix(dev);
3389 3565
3390 if (dev->phy.rev < 3) 3566 if (dev->phy.rev < 3)
@@ -3480,6 +3656,7 @@ static void b43_nphy_op_prepare_structs(struct b43_wldev *dev)
3480 nphy->gain_boost = true; /* this way we follow wl, assume it is true */ 3656 nphy->gain_boost = true; /* this way we follow wl, assume it is true */
3481 nphy->txrx_chain = 2; /* sth different than 0 and 1 for now */ 3657 nphy->txrx_chain = 2; /* sth different than 0 and 1 for now */
3482 nphy->phyrxchain = 3; /* to avoid b43_nphy_set_rx_core_state like wl */ 3658 nphy->phyrxchain = 3; /* to avoid b43_nphy_set_rx_core_state like wl */
3659 nphy->perical = 2; /* avoid additional rssi cal on init (like wl) */
3483} 3660}
3484 3661
3485static void b43_nphy_op_free(struct b43_wldev *dev) 3662static void b43_nphy_op_free(struct b43_wldev *dev)
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h
index c144e59a708b..001e841f118c 100644
--- a/drivers/net/wireless/b43/phy_n.h
+++ b/drivers/net/wireless/b43/phy_n.h
@@ -782,7 +782,7 @@ struct b43_phy_n {
782 u16 mphase_txcal_numcmds; 782 u16 mphase_txcal_numcmds;
783 u16 mphase_txcal_bestcoeffs[11]; 783 u16 mphase_txcal_bestcoeffs[11];
784 784
785 u8 txpwrctrl; 785 bool txpwrctrl;
786 u16 txcal_bbmult; 786 u16 txcal_bbmult;
787 u16 txiqlocal_bestc[11]; 787 u16 txiqlocal_bestc[11];
788 bool txiqlocal_coeffsvalid; 788 bool txiqlocal_coeffsvalid;
diff --git a/drivers/net/wireless/b43/radio_2055.c b/drivers/net/wireless/b43/radio_2055.c
index 10910dc4184b..44c6dea66882 100644
--- a/drivers/net/wireless/b43/radio_2055.c
+++ b/drivers/net/wireless/b43/radio_2055.c
@@ -304,7 +304,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
304 { .channel = 184, 304 { .channel = 184,
305 .freq = 4920, /* MHz */ 305 .freq = 4920, /* MHz */
306 .unk2 = 3280, 306 .unk2 = 3280,
307 RADIOREGS(0x71, 0x01, 0xEC, 0x0F, 0xFF, 0x01, 0x04, 0x0A, 307 RADIOREGS(0x71, 0xEC, 0x01, 0x0F, 0xFF, 0x01, 0x04, 0x0A,
308 0x00, 0x8F, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x0F, 308 0x00, 0x8F, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x0F,
309 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 309 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F),
310 PHYREGS(0x07B4, 0x07B0, 0x07AC, 0x0214, 0x0215, 0x0216), 310 PHYREGS(0x07B4, 0x07B0, 0x07AC, 0x0214, 0x0215, 0x0216),
@@ -312,7 +312,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
312 { .channel = 186, 312 { .channel = 186,
313 .freq = 4930, /* MHz */ 313 .freq = 4930, /* MHz */
314 .unk2 = 3287, 314 .unk2 = 3287,
315 RADIOREGS(0x71, 0x01, 0xED, 0x0F, 0xFF, 0x01, 0x04, 0x0A, 315 RADIOREGS(0x71, 0xED, 0x01, 0x0F, 0xFF, 0x01, 0x04, 0x0A,
316 0x00, 0x8F, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x0F, 316 0x00, 0x8F, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0x0F,
317 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 317 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F),
318 PHYREGS(0x07B8, 0x07B4, 0x07B0, 0x0213, 0x0214, 0x0215), 318 PHYREGS(0x07B8, 0x07B4, 0x07B0, 0x0213, 0x0214, 0x0215),
@@ -320,7 +320,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
320 { .channel = 188, 320 { .channel = 188,
321 .freq = 4940, /* MHz */ 321 .freq = 4940, /* MHz */
322 .unk2 = 3293, 322 .unk2 = 3293,
323 RADIOREGS(0x71, 0x01, 0xEE, 0x0F, 0xFF, 0x01, 0x04, 0x0A, 323 RADIOREGS(0x71, 0xEE, 0x01, 0x0F, 0xFF, 0x01, 0x04, 0x0A,
324 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F, 324 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F,
325 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 325 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F),
326 PHYREGS(0x07BC, 0x07B8, 0x07B4, 0x0212, 0x0213, 0x0214), 326 PHYREGS(0x07BC, 0x07B8, 0x07B4, 0x0212, 0x0213, 0x0214),
@@ -328,7 +328,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
328 { .channel = 190, 328 { .channel = 190,
329 .freq = 4950, /* MHz */ 329 .freq = 4950, /* MHz */
330 .unk2 = 3300, 330 .unk2 = 3300,
331 RADIOREGS(0x71, 0x01, 0xEF, 0x0F, 0xFF, 0x01, 0x04, 0x0A, 331 RADIOREGS(0x71, 0xEF, 0x01, 0x0F, 0xFF, 0x01, 0x04, 0x0A,
332 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F, 332 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F,
333 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 333 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F),
334 PHYREGS(0x07C0, 0x07BC, 0x07B8, 0x0211, 0x0212, 0x0213), 334 PHYREGS(0x07C0, 0x07BC, 0x07B8, 0x0211, 0x0212, 0x0213),
@@ -336,7 +336,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
336 { .channel = 192, 336 { .channel = 192,
337 .freq = 4960, /* MHz */ 337 .freq = 4960, /* MHz */
338 .unk2 = 3307, 338 .unk2 = 3307,
339 RADIOREGS(0x71, 0x01, 0xF0, 0x0F, 0xFF, 0x01, 0x04, 0x0A, 339 RADIOREGS(0x71, 0xF0, 0x01, 0x0F, 0xFF, 0x01, 0x04, 0x0A,
340 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F, 340 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F,
341 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 341 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F),
342 PHYREGS(0x07C4, 0x07C0, 0x07BC, 0x020F, 0x0211, 0x0212), 342 PHYREGS(0x07C4, 0x07C0, 0x07BC, 0x020F, 0x0211, 0x0212),
@@ -344,7 +344,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
344 { .channel = 194, 344 { .channel = 194,
345 .freq = 4970, /* MHz */ 345 .freq = 4970, /* MHz */
346 .unk2 = 3313, 346 .unk2 = 3313,
347 RADIOREGS(0x71, 0x01, 0xF1, 0x0F, 0xFF, 0x01, 0x04, 0x0A, 347 RADIOREGS(0x71, 0xF1, 0x01, 0x0F, 0xFF, 0x01, 0x04, 0x0A,
348 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F, 348 0x00, 0x8F, 0xEE, 0xEE, 0xFF, 0x00, 0x0F, 0x0F,
349 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 349 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F),
350 PHYREGS(0x07C8, 0x07C4, 0x07C0, 0x020E, 0x020F, 0x0211), 350 PHYREGS(0x07C8, 0x07C4, 0x07C0, 0x020E, 0x020F, 0x0211),
@@ -352,7 +352,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
352 { .channel = 196, 352 { .channel = 196,
353 .freq = 4980, /* MHz */ 353 .freq = 4980, /* MHz */
354 .unk2 = 3320, 354 .unk2 = 3320,
355 RADIOREGS(0x71, 0x01, 0xF2, 0x0E, 0xFF, 0x01, 0x04, 0x0A, 355 RADIOREGS(0x71, 0xF2, 0x01, 0x0E, 0xFF, 0x01, 0x04, 0x0A,
356 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F, 356 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F,
357 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 357 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F),
358 PHYREGS(0x07CC, 0x07C8, 0x07C4, 0x020D, 0x020E, 0x020F), 358 PHYREGS(0x07CC, 0x07C8, 0x07C4, 0x020D, 0x020E, 0x020F),
@@ -360,7 +360,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
360 { .channel = 198, 360 { .channel = 198,
361 .freq = 4990, /* MHz */ 361 .freq = 4990, /* MHz */
362 .unk2 = 3327, 362 .unk2 = 3327,
363 RADIOREGS(0x71, 0x01, 0xF3, 0x0E, 0xFF, 0x01, 0x04, 0x0A, 363 RADIOREGS(0x71, 0xF3, 0x01, 0x0E, 0xFF, 0x01, 0x04, 0x0A,
364 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F, 364 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F,
365 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 365 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F),
366 PHYREGS(0x07D0, 0x07CC, 0x07C8, 0x020C, 0x020D, 0x020E), 366 PHYREGS(0x07D0, 0x07CC, 0x07C8, 0x020C, 0x020D, 0x020E),
@@ -368,7 +368,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
368 { .channel = 200, 368 { .channel = 200,
369 .freq = 5000, /* MHz */ 369 .freq = 5000, /* MHz */
370 .unk2 = 3333, 370 .unk2 = 3333,
371 RADIOREGS(0x71, 0x01, 0xF4, 0x0E, 0xFF, 0x01, 0x04, 0x0A, 371 RADIOREGS(0x71, 0xF4, 0x01, 0x0E, 0xFF, 0x01, 0x04, 0x0A,
372 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F, 372 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F,
373 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 373 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F),
374 PHYREGS(0x07D4, 0x07D0, 0x07CC, 0x020B, 0x020C, 0x020D), 374 PHYREGS(0x07D4, 0x07D0, 0x07CC, 0x020B, 0x020C, 0x020D),
@@ -376,7 +376,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
376 { .channel = 202, 376 { .channel = 202,
377 .freq = 5010, /* MHz */ 377 .freq = 5010, /* MHz */
378 .unk2 = 3340, 378 .unk2 = 3340,
379 RADIOREGS(0x71, 0x01, 0xF5, 0x0E, 0xFF, 0x01, 0x04, 0x0A, 379 RADIOREGS(0x71, 0xF5, 0x01, 0x0E, 0xFF, 0x01, 0x04, 0x0A,
380 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F, 380 0x00, 0x8F, 0xDD, 0xDD, 0xFF, 0x00, 0x0F, 0x0F,
381 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 381 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F),
382 PHYREGS(0x07D8, 0x07D4, 0x07D0, 0x020A, 0x020B, 0x020C), 382 PHYREGS(0x07D8, 0x07D4, 0x07D0, 0x020A, 0x020B, 0x020C),
@@ -384,7 +384,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
384 { .channel = 204, 384 { .channel = 204,
385 .freq = 5020, /* MHz */ 385 .freq = 5020, /* MHz */
386 .unk2 = 3347, 386 .unk2 = 3347,
387 RADIOREGS(0x71, 0x01, 0xF6, 0x0E, 0xF7, 0x01, 0x04, 0x0A, 387 RADIOREGS(0x71, 0xF6, 0x01, 0x0E, 0xF7, 0x01, 0x04, 0x0A,
388 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F, 388 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F,
389 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 389 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F),
390 PHYREGS(0x07DC, 0x07D8, 0x07D4, 0x0209, 0x020A, 0x020B), 390 PHYREGS(0x07DC, 0x07D8, 0x07D4, 0x0209, 0x020A, 0x020B),
@@ -392,7 +392,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
392 { .channel = 206, 392 { .channel = 206,
393 .freq = 5030, /* MHz */ 393 .freq = 5030, /* MHz */
394 .unk2 = 3353, 394 .unk2 = 3353,
395 RADIOREGS(0x71, 0x01, 0xF7, 0x0E, 0xF7, 0x01, 0x04, 0x0A, 395 RADIOREGS(0x71, 0xF7, 0x01, 0x0E, 0xF7, 0x01, 0x04, 0x0A,
396 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F, 396 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F,
397 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 397 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F),
398 PHYREGS(0x07E0, 0x07DC, 0x07D8, 0x0208, 0x0209, 0x020A), 398 PHYREGS(0x07E0, 0x07DC, 0x07D8, 0x0208, 0x0209, 0x020A),
@@ -400,7 +400,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
400 { .channel = 208, 400 { .channel = 208,
401 .freq = 5040, /* MHz */ 401 .freq = 5040, /* MHz */
402 .unk2 = 3360, 402 .unk2 = 3360,
403 RADIOREGS(0x71, 0x01, 0xF8, 0x0D, 0xEF, 0x01, 0x04, 0x0A, 403 RADIOREGS(0x71, 0xF8, 0x01, 0x0D, 0xEF, 0x01, 0x04, 0x0A,
404 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F, 404 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F,
405 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 405 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F),
406 PHYREGS(0x07E4, 0x07E0, 0x07DC, 0x0207, 0x0208, 0x0209), 406 PHYREGS(0x07E4, 0x07E0, 0x07DC, 0x0207, 0x0208, 0x0209),
@@ -408,7 +408,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
408 { .channel = 210, 408 { .channel = 210,
409 .freq = 5050, /* MHz */ 409 .freq = 5050, /* MHz */
410 .unk2 = 3367, 410 .unk2 = 3367,
411 RADIOREGS(0x71, 0x01, 0xF9, 0x0D, 0xEF, 0x01, 0x04, 0x0A, 411 RADIOREGS(0x71, 0xF9, 0x01, 0x0D, 0xEF, 0x01, 0x04, 0x0A,
412 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F, 412 0x00, 0x8F, 0xCC, 0xCC, 0xFF, 0x00, 0x0F, 0x0F,
413 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F), 413 0x8F, 0xFF, 0x00, 0x0F, 0x0F, 0x8F),
414 PHYREGS(0x07E8, 0x07E4, 0x07E0, 0x0206, 0x0207, 0x0208), 414 PHYREGS(0x07E8, 0x07E4, 0x07E0, 0x0206, 0x0207, 0x0208),
@@ -416,7 +416,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
416 { .channel = 212, 416 { .channel = 212,
417 .freq = 5060, /* MHz */ 417 .freq = 5060, /* MHz */
418 .unk2 = 3373, 418 .unk2 = 3373,
419 RADIOREGS(0x71, 0x01, 0xFA, 0x0D, 0xE6, 0x01, 0x04, 0x0A, 419 RADIOREGS(0x71, 0xFA, 0x01, 0x0D, 0xE6, 0x01, 0x04, 0x0A,
420 0x00, 0x8F, 0xBB, 0xBB, 0xFF, 0x00, 0x0E, 0x0F, 420 0x00, 0x8F, 0xBB, 0xBB, 0xFF, 0x00, 0x0E, 0x0F,
421 0x8E, 0xFF, 0x00, 0x0E, 0x0F, 0x8E), 421 0x8E, 0xFF, 0x00, 0x0E, 0x0F, 0x8E),
422 PHYREGS(0x07EC, 0x07E8, 0x07E4, 0x0205, 0x0206, 0x0207), 422 PHYREGS(0x07EC, 0x07E8, 0x07E4, 0x0205, 0x0206, 0x0207),
@@ -424,7 +424,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
424 { .channel = 214, 424 { .channel = 214,
425 .freq = 5070, /* MHz */ 425 .freq = 5070, /* MHz */
426 .unk2 = 3380, 426 .unk2 = 3380,
427 RADIOREGS(0x71, 0x01, 0xFB, 0x0D, 0xE6, 0x01, 0x04, 0x0A, 427 RADIOREGS(0x71, 0xFB, 0x01, 0x0D, 0xE6, 0x01, 0x04, 0x0A,
428 0x00, 0x8F, 0xBB, 0xBB, 0xFF, 0x00, 0x0E, 0x0F, 428 0x00, 0x8F, 0xBB, 0xBB, 0xFF, 0x00, 0x0E, 0x0F,
429 0x8E, 0xFF, 0x00, 0x0E, 0x0F, 0x8E), 429 0x8E, 0xFF, 0x00, 0x0E, 0x0F, 0x8E),
430 PHYREGS(0x07F0, 0x07EC, 0x07E8, 0x0204, 0x0205, 0x0206), 430 PHYREGS(0x07F0, 0x07EC, 0x07E8, 0x0204, 0x0205, 0x0206),
@@ -432,7 +432,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
432 { .channel = 216, 432 { .channel = 216,
433 .freq = 5080, /* MHz */ 433 .freq = 5080, /* MHz */
434 .unk2 = 3387, 434 .unk2 = 3387,
435 RADIOREGS(0x71, 0x01, 0xFC, 0x0D, 0xDE, 0x01, 0x04, 0x0A, 435 RADIOREGS(0x71, 0xFC, 0x01, 0x0D, 0xDE, 0x01, 0x04, 0x0A,
436 0x00, 0x8E, 0xBB, 0xBB, 0xEE, 0x00, 0x0E, 0x0F, 436 0x00, 0x8E, 0xBB, 0xBB, 0xEE, 0x00, 0x0E, 0x0F,
437 0x8D, 0xEE, 0x00, 0x0E, 0x0F, 0x8D), 437 0x8D, 0xEE, 0x00, 0x0E, 0x0F, 0x8D),
438 PHYREGS(0x07F4, 0x07F0, 0x07EC, 0x0203, 0x0204, 0x0205), 438 PHYREGS(0x07F4, 0x07F0, 0x07EC, 0x0203, 0x0204, 0x0205),
@@ -440,7 +440,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
440 { .channel = 218, 440 { .channel = 218,
441 .freq = 5090, /* MHz */ 441 .freq = 5090, /* MHz */
442 .unk2 = 3393, 442 .unk2 = 3393,
443 RADIOREGS(0x71, 0x01, 0xFD, 0x0D, 0xDE, 0x01, 0x04, 0x0A, 443 RADIOREGS(0x71, 0xFD, 0x01, 0x0D, 0xDE, 0x01, 0x04, 0x0A,
444 0x00, 0x8E, 0xBB, 0xBB, 0xEE, 0x00, 0x0E, 0x0F, 444 0x00, 0x8E, 0xBB, 0xBB, 0xEE, 0x00, 0x0E, 0x0F,
445 0x8D, 0xEE, 0x00, 0x0E, 0x0F, 0x8D), 445 0x8D, 0xEE, 0x00, 0x0E, 0x0F, 0x8D),
446 PHYREGS(0x07F8, 0x07F4, 0x07F0, 0x0202, 0x0203, 0x0204), 446 PHYREGS(0x07F8, 0x07F4, 0x07F0, 0x0202, 0x0203, 0x0204),
@@ -448,7 +448,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
448 { .channel = 220, 448 { .channel = 220,
449 .freq = 5100, /* MHz */ 449 .freq = 5100, /* MHz */
450 .unk2 = 3400, 450 .unk2 = 3400,
451 RADIOREGS(0x71, 0x01, 0xFE, 0x0C, 0xD6, 0x01, 0x04, 0x0A, 451 RADIOREGS(0x71, 0xFE, 0x01, 0x0C, 0xD6, 0x01, 0x04, 0x0A,
452 0x00, 0x8E, 0xAA, 0xAA, 0xEE, 0x00, 0x0D, 0x0F, 452 0x00, 0x8E, 0xAA, 0xAA, 0xEE, 0x00, 0x0D, 0x0F,
453 0x8D, 0xEE, 0x00, 0x0D, 0x0F, 0x8D), 453 0x8D, 0xEE, 0x00, 0x0D, 0x0F, 0x8D),
454 PHYREGS(0x07FC, 0x07F8, 0x07F4, 0x0201, 0x0202, 0x0203), 454 PHYREGS(0x07FC, 0x07F8, 0x07F4, 0x0201, 0x0202, 0x0203),
@@ -456,7 +456,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
456 { .channel = 222, 456 { .channel = 222,
457 .freq = 5110, /* MHz */ 457 .freq = 5110, /* MHz */
458 .unk2 = 3407, 458 .unk2 = 3407,
459 RADIOREGS(0x71, 0x01, 0xFF, 0x0C, 0xD6, 0x01, 0x04, 0x0A, 459 RADIOREGS(0x71, 0xFF, 0x01, 0x0C, 0xD6, 0x01, 0x04, 0x0A,
460 0x00, 0x8E, 0xAA, 0xAA, 0xEE, 0x00, 0x0D, 0x0F, 460 0x00, 0x8E, 0xAA, 0xAA, 0xEE, 0x00, 0x0D, 0x0F,
461 0x8D, 0xEE, 0x00, 0x0D, 0x0F, 0x8D), 461 0x8D, 0xEE, 0x00, 0x0D, 0x0F, 0x8D),
462 PHYREGS(0x0800, 0x07FC, 0x07F8, 0x0200, 0x0201, 0x0202), 462 PHYREGS(0x0800, 0x07FC, 0x07F8, 0x0200, 0x0201, 0x0202),
@@ -464,7 +464,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
464 { .channel = 224, 464 { .channel = 224,
465 .freq = 5120, /* MHz */ 465 .freq = 5120, /* MHz */
466 .unk2 = 3413, 466 .unk2 = 3413,
467 RADIOREGS(0x71, 0x02, 0x00, 0x0C, 0xCE, 0x01, 0x04, 0x0A, 467 RADIOREGS(0x71, 0x00, 0x02, 0x0C, 0xCE, 0x01, 0x04, 0x0A,
468 0x00, 0x8D, 0xAA, 0xAA, 0xDD, 0x00, 0x0D, 0x0F, 468 0x00, 0x8D, 0xAA, 0xAA, 0xDD, 0x00, 0x0D, 0x0F,
469 0x8C, 0xDD, 0x00, 0x0D, 0x0F, 0x8C), 469 0x8C, 0xDD, 0x00, 0x0D, 0x0F, 0x8C),
470 PHYREGS(0x0804, 0x0800, 0x07FC, 0x01FF, 0x0200, 0x0201), 470 PHYREGS(0x0804, 0x0800, 0x07FC, 0x01FF, 0x0200, 0x0201),
@@ -472,7 +472,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
472 { .channel = 226, 472 { .channel = 226,
473 .freq = 5130, /* MHz */ 473 .freq = 5130, /* MHz */
474 .unk2 = 3420, 474 .unk2 = 3420,
475 RADIOREGS(0x71, 0x02, 0x01, 0x0C, 0xCE, 0x01, 0x04, 0x0A, 475 RADIOREGS(0x71, 0x01, 0x02, 0x0C, 0xCE, 0x01, 0x04, 0x0A,
476 0x00, 0x8D, 0xAA, 0xAA, 0xDD, 0x00, 0x0D, 0x0F, 476 0x00, 0x8D, 0xAA, 0xAA, 0xDD, 0x00, 0x0D, 0x0F,
477 0x8C, 0xDD, 0x00, 0x0D, 0x0F, 0x8C), 477 0x8C, 0xDD, 0x00, 0x0D, 0x0F, 0x8C),
478 PHYREGS(0x0808, 0x0804, 0x0800, 0x01FE, 0x01FF, 0x0200), 478 PHYREGS(0x0808, 0x0804, 0x0800, 0x01FE, 0x01FF, 0x0200),
@@ -488,7 +488,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
488 { .channel = 32, 488 { .channel = 32,
489 .freq = 5160, /* MHz */ 489 .freq = 5160, /* MHz */
490 .unk2 = 3440, 490 .unk2 = 3440,
491 RADIOREGS(0x71, 0x02, 0x04, 0x0B, 0xBE, 0x01, 0x04, 0x0A, 491 RADIOREGS(0x71, 0x04, 0x02, 0x0B, 0xBE, 0x01, 0x04, 0x0A,
492 0x00, 0x8C, 0x99, 0x99, 0xCC, 0x00, 0x0B, 0x0D, 492 0x00, 0x8C, 0x99, 0x99, 0xCC, 0x00, 0x0B, 0x0D,
493 0x8A, 0xCC, 0x00, 0x0B, 0x0D, 0x8A), 493 0x8A, 0xCC, 0x00, 0x0B, 0x0D, 0x8A),
494 PHYREGS(0x0814, 0x0810, 0x080C, 0x01FB, 0x01FC, 0x01FD), 494 PHYREGS(0x0814, 0x0810, 0x080C, 0x01FB, 0x01FC, 0x01FD),
@@ -496,7 +496,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
496 { .channel = 34, 496 { .channel = 34,
497 .freq = 5170, /* MHz */ 497 .freq = 5170, /* MHz */
498 .unk2 = 3447, 498 .unk2 = 3447,
499 RADIOREGS(0x71, 0x02, 0x05, 0x0B, 0xBE, 0x01, 0x04, 0x0A, 499 RADIOREGS(0x71, 0x05, 0x02, 0x0B, 0xBE, 0x01, 0x04, 0x0A,
500 0x00, 0x8C, 0x99, 0x99, 0xCC, 0x00, 0x0B, 0x0D, 500 0x00, 0x8C, 0x99, 0x99, 0xCC, 0x00, 0x0B, 0x0D,
501 0x8A, 0xCC, 0x00, 0x0B, 0x0D, 0x8A), 501 0x8A, 0xCC, 0x00, 0x0B, 0x0D, 0x8A),
502 PHYREGS(0x0818, 0x0814, 0x0810, 0x01FA, 0x01FB, 0x01FC), 502 PHYREGS(0x0818, 0x0814, 0x0810, 0x01FA, 0x01FB, 0x01FC),
@@ -504,7 +504,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
504 { .channel = 36, 504 { .channel = 36,
505 .freq = 5180, /* MHz */ 505 .freq = 5180, /* MHz */
506 .unk2 = 3453, 506 .unk2 = 3453,
507 RADIOREGS(0x71, 0x02, 0x06, 0x0B, 0xB6, 0x01, 0x04, 0x0A, 507 RADIOREGS(0x71, 0x06, 0x02, 0x0B, 0xB6, 0x01, 0x04, 0x0A,
508 0x00, 0x8C, 0x88, 0x88, 0xCC, 0x00, 0x0B, 0x0C, 508 0x00, 0x8C, 0x88, 0x88, 0xCC, 0x00, 0x0B, 0x0C,
509 0x89, 0xCC, 0x00, 0x0B, 0x0C, 0x89), 509 0x89, 0xCC, 0x00, 0x0B, 0x0C, 0x89),
510 PHYREGS(0x081C, 0x0818, 0x0814, 0x01F9, 0x01FA, 0x01FB), 510 PHYREGS(0x081C, 0x0818, 0x0814, 0x01F9, 0x01FA, 0x01FB),
@@ -512,7 +512,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
512 { .channel = 38, 512 { .channel = 38,
513 .freq = 5190, /* MHz */ 513 .freq = 5190, /* MHz */
514 .unk2 = 3460, 514 .unk2 = 3460,
515 RADIOREGS(0x71, 0x02, 0x07, 0x0B, 0xB6, 0x01, 0x04, 0x0A, 515 RADIOREGS(0x71, 0x07, 0x02, 0x0B, 0xB6, 0x01, 0x04, 0x0A,
516 0x00, 0x8C, 0x88, 0x88, 0xCC, 0x00, 0x0B, 0x0C, 516 0x00, 0x8C, 0x88, 0x88, 0xCC, 0x00, 0x0B, 0x0C,
517 0x89, 0xCC, 0x00, 0x0B, 0x0C, 0x89), 517 0x89, 0xCC, 0x00, 0x0B, 0x0C, 0x89),
518 PHYREGS(0x0820, 0x081C, 0x0818, 0x01F8, 0x01F9, 0x01FA), 518 PHYREGS(0x0820, 0x081C, 0x0818, 0x01F8, 0x01F9, 0x01FA),
@@ -520,7 +520,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
520 { .channel = 40, 520 { .channel = 40,
521 .freq = 5200, /* MHz */ 521 .freq = 5200, /* MHz */
522 .unk2 = 3467, 522 .unk2 = 3467,
523 RADIOREGS(0x71, 0x02, 0x08, 0x0B, 0xAF, 0x01, 0x04, 0x0A, 523 RADIOREGS(0x71, 0x08, 0x02, 0x0B, 0xAF, 0x01, 0x04, 0x0A,
524 0x00, 0x8B, 0x88, 0x88, 0xBB, 0x00, 0x0A, 0x0B, 524 0x00, 0x8B, 0x88, 0x88, 0xBB, 0x00, 0x0A, 0x0B,
525 0x89, 0xBB, 0x00, 0x0A, 0x0B, 0x89), 525 0x89, 0xBB, 0x00, 0x0A, 0x0B, 0x89),
526 PHYREGS(0x0824, 0x0820, 0x081C, 0x01F7, 0x01F8, 0x01F9), 526 PHYREGS(0x0824, 0x0820, 0x081C, 0x01F7, 0x01F8, 0x01F9),
@@ -528,7 +528,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
528 { .channel = 42, 528 { .channel = 42,
529 .freq = 5210, /* MHz */ 529 .freq = 5210, /* MHz */
530 .unk2 = 3473, 530 .unk2 = 3473,
531 RADIOREGS(0x71, 0x02, 0x09, 0x0B, 0xAF, 0x01, 0x04, 0x0A, 531 RADIOREGS(0x71, 0x09, 0x02, 0x0B, 0xAF, 0x01, 0x04, 0x0A,
532 0x00, 0x8B, 0x88, 0x88, 0xBB, 0x00, 0x0A, 0x0B, 532 0x00, 0x8B, 0x88, 0x88, 0xBB, 0x00, 0x0A, 0x0B,
533 0x89, 0xBB, 0x00, 0x0A, 0x0B, 0x89), 533 0x89, 0xBB, 0x00, 0x0A, 0x0B, 0x89),
534 PHYREGS(0x0828, 0x0824, 0x0820, 0x01F6, 0x01F7, 0x01F8), 534 PHYREGS(0x0828, 0x0824, 0x0820, 0x01F6, 0x01F7, 0x01F8),
@@ -536,7 +536,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
536 { .channel = 44, 536 { .channel = 44,
537 .freq = 5220, /* MHz */ 537 .freq = 5220, /* MHz */
538 .unk2 = 3480, 538 .unk2 = 3480,
539 RADIOREGS(0x71, 0x02, 0x0A, 0x0A, 0xA7, 0x01, 0x04, 0x0A, 539 RADIOREGS(0x71, 0x0A, 0x02, 0x0A, 0xA7, 0x01, 0x04, 0x0A,
540 0x00, 0x8B, 0x77, 0x77, 0xBB, 0x00, 0x09, 0x0A, 540 0x00, 0x8B, 0x77, 0x77, 0xBB, 0x00, 0x09, 0x0A,
541 0x88, 0xBB, 0x00, 0x09, 0x0A, 0x88), 541 0x88, 0xBB, 0x00, 0x09, 0x0A, 0x88),
542 PHYREGS(0x082C, 0x0828, 0x0824, 0x01F5, 0x01F6, 0x01F7), 542 PHYREGS(0x082C, 0x0828, 0x0824, 0x01F5, 0x01F6, 0x01F7),
@@ -544,7 +544,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
544 { .channel = 46, 544 { .channel = 46,
545 .freq = 5230, /* MHz */ 545 .freq = 5230, /* MHz */
546 .unk2 = 3487, 546 .unk2 = 3487,
547 RADIOREGS(0x71, 0x02, 0x0B, 0x0A, 0xA7, 0x01, 0x04, 0x0A, 547 RADIOREGS(0x71, 0x0B, 0x02, 0x0A, 0xA7, 0x01, 0x04, 0x0A,
548 0x00, 0x8B, 0x77, 0x77, 0xBB, 0x00, 0x09, 0x0A, 548 0x00, 0x8B, 0x77, 0x77, 0xBB, 0x00, 0x09, 0x0A,
549 0x88, 0xBB, 0x00, 0x09, 0x0A, 0x88), 549 0x88, 0xBB, 0x00, 0x09, 0x0A, 0x88),
550 PHYREGS(0x0830, 0x082C, 0x0828, 0x01F4, 0x01F5, 0x01F6), 550 PHYREGS(0x0830, 0x082C, 0x0828, 0x01F4, 0x01F5, 0x01F6),
@@ -552,7 +552,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
552 { .channel = 48, 552 { .channel = 48,
553 .freq = 5240, /* MHz */ 553 .freq = 5240, /* MHz */
554 .unk2 = 3493, 554 .unk2 = 3493,
555 RADIOREGS(0x71, 0x02, 0x0C, 0x0A, 0xA0, 0x01, 0x04, 0x0A, 555 RADIOREGS(0x71, 0x0C, 0x02, 0x0A, 0xA0, 0x01, 0x04, 0x0A,
556 0x00, 0x8A, 0x77, 0x77, 0xAA, 0x00, 0x09, 0x0A, 556 0x00, 0x8A, 0x77, 0x77, 0xAA, 0x00, 0x09, 0x0A,
557 0x87, 0xAA, 0x00, 0x09, 0x0A, 0x87), 557 0x87, 0xAA, 0x00, 0x09, 0x0A, 0x87),
558 PHYREGS(0x0834, 0x0830, 0x082C, 0x01F3, 0x01F4, 0x01F5), 558 PHYREGS(0x0834, 0x0830, 0x082C, 0x01F3, 0x01F4, 0x01F5),
@@ -560,7 +560,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
560 { .channel = 50, 560 { .channel = 50,
561 .freq = 5250, /* MHz */ 561 .freq = 5250, /* MHz */
562 .unk2 = 3500, 562 .unk2 = 3500,
563 RADIOREGS(0x71, 0x02, 0x0D, 0x0A, 0xA0, 0x01, 0x04, 0x0A, 563 RADIOREGS(0x71, 0x0D, 0x02, 0x0A, 0xA0, 0x01, 0x04, 0x0A,
564 0x00, 0x8A, 0x77, 0x77, 0xAA, 0x00, 0x09, 0x0A, 564 0x00, 0x8A, 0x77, 0x77, 0xAA, 0x00, 0x09, 0x0A,
565 0x87, 0xAA, 0x00, 0x09, 0x0A, 0x87), 565 0x87, 0xAA, 0x00, 0x09, 0x0A, 0x87),
566 PHYREGS(0x0838, 0x0834, 0x0830, 0x01F2, 0x01F3, 0x01F4), 566 PHYREGS(0x0838, 0x0834, 0x0830, 0x01F2, 0x01F3, 0x01F4),
@@ -568,7 +568,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
568 { .channel = 52, 568 { .channel = 52,
569 .freq = 5260, /* MHz */ 569 .freq = 5260, /* MHz */
570 .unk2 = 3507, 570 .unk2 = 3507,
571 RADIOREGS(0x71, 0x02, 0x0E, 0x0A, 0x98, 0x01, 0x04, 0x0A, 571 RADIOREGS(0x71, 0x0E, 0x02, 0x0A, 0x98, 0x01, 0x04, 0x0A,
572 0x00, 0x8A, 0x66, 0x66, 0xAA, 0x00, 0x08, 0x09, 572 0x00, 0x8A, 0x66, 0x66, 0xAA, 0x00, 0x08, 0x09,
573 0x87, 0xAA, 0x00, 0x08, 0x09, 0x87), 573 0x87, 0xAA, 0x00, 0x08, 0x09, 0x87),
574 PHYREGS(0x083C, 0x0838, 0x0834, 0x01F1, 0x01F2, 0x01F3), 574 PHYREGS(0x083C, 0x0838, 0x0834, 0x01F1, 0x01F2, 0x01F3),
@@ -576,7 +576,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
576 { .channel = 54, 576 { .channel = 54,
577 .freq = 5270, /* MHz */ 577 .freq = 5270, /* MHz */
578 .unk2 = 3513, 578 .unk2 = 3513,
579 RADIOREGS(0x71, 0x02, 0x0F, 0x0A, 0x98, 0x01, 0x04, 0x0A, 579 RADIOREGS(0x71, 0x0F, 0x02, 0x0A, 0x98, 0x01, 0x04, 0x0A,
580 0x00, 0x8A, 0x66, 0x66, 0xAA, 0x00, 0x08, 0x09, 580 0x00, 0x8A, 0x66, 0x66, 0xAA, 0x00, 0x08, 0x09,
581 0x87, 0xAA, 0x00, 0x08, 0x09, 0x87), 581 0x87, 0xAA, 0x00, 0x08, 0x09, 0x87),
582 PHYREGS(0x0840, 0x083C, 0x0838, 0x01F0, 0x01F1, 0x01F2), 582 PHYREGS(0x0840, 0x083C, 0x0838, 0x01F0, 0x01F1, 0x01F2),
@@ -584,7 +584,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
584 { .channel = 56, 584 { .channel = 56,
585 .freq = 5280, /* MHz */ 585 .freq = 5280, /* MHz */
586 .unk2 = 3520, 586 .unk2 = 3520,
587 RADIOREGS(0x71, 0x02, 0x10, 0x09, 0x91, 0x01, 0x04, 0x0A, 587 RADIOREGS(0x71, 0x10, 0x02, 0x09, 0x91, 0x01, 0x04, 0x0A,
588 0x00, 0x89, 0x66, 0x66, 0x99, 0x00, 0x08, 0x08, 588 0x00, 0x89, 0x66, 0x66, 0x99, 0x00, 0x08, 0x08,
589 0x86, 0x99, 0x00, 0x08, 0x08, 0x86), 589 0x86, 0x99, 0x00, 0x08, 0x08, 0x86),
590 PHYREGS(0x0844, 0x0840, 0x083C, 0x01F0, 0x01F0, 0x01F1), 590 PHYREGS(0x0844, 0x0840, 0x083C, 0x01F0, 0x01F0, 0x01F1),
@@ -592,7 +592,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
592 { .channel = 58, 592 { .channel = 58,
593 .freq = 5290, /* MHz */ 593 .freq = 5290, /* MHz */
594 .unk2 = 3527, 594 .unk2 = 3527,
595 RADIOREGS(0x71, 0x02, 0x11, 0x09, 0x91, 0x01, 0x04, 0x0A, 595 RADIOREGS(0x71, 0x11, 0x02, 0x09, 0x91, 0x01, 0x04, 0x0A,
596 0x00, 0x89, 0x66, 0x66, 0x99, 0x00, 0x08, 0x08, 596 0x00, 0x89, 0x66, 0x66, 0x99, 0x00, 0x08, 0x08,
597 0x86, 0x99, 0x00, 0x08, 0x08, 0x86), 597 0x86, 0x99, 0x00, 0x08, 0x08, 0x86),
598 PHYREGS(0x0848, 0x0844, 0x0840, 0x01EF, 0x01F0, 0x01F0), 598 PHYREGS(0x0848, 0x0844, 0x0840, 0x01EF, 0x01F0, 0x01F0),
@@ -600,7 +600,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
600 { .channel = 60, 600 { .channel = 60,
601 .freq = 5300, /* MHz */ 601 .freq = 5300, /* MHz */
602 .unk2 = 3533, 602 .unk2 = 3533,
603 RADIOREGS(0x71, 0x02, 0x12, 0x09, 0x8A, 0x01, 0x04, 0x0A, 603 RADIOREGS(0x71, 0x12, 0x02, 0x09, 0x8A, 0x01, 0x04, 0x0A,
604 0x00, 0x89, 0x55, 0x55, 0x99, 0x00, 0x08, 0x07, 604 0x00, 0x89, 0x55, 0x55, 0x99, 0x00, 0x08, 0x07,
605 0x85, 0x99, 0x00, 0x08, 0x07, 0x85), 605 0x85, 0x99, 0x00, 0x08, 0x07, 0x85),
606 PHYREGS(0x084C, 0x0848, 0x0844, 0x01EE, 0x01EF, 0x01F0), 606 PHYREGS(0x084C, 0x0848, 0x0844, 0x01EE, 0x01EF, 0x01F0),
@@ -608,7 +608,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
608 { .channel = 62, 608 { .channel = 62,
609 .freq = 5310, /* MHz */ 609 .freq = 5310, /* MHz */
610 .unk2 = 3540, 610 .unk2 = 3540,
611 RADIOREGS(0x71, 0x02, 0x13, 0x09, 0x8A, 0x01, 0x04, 0x0A, 611 RADIOREGS(0x71, 0x13, 0x02, 0x09, 0x8A, 0x01, 0x04, 0x0A,
612 0x00, 0x89, 0x55, 0x55, 0x99, 0x00, 0x08, 0x07, 612 0x00, 0x89, 0x55, 0x55, 0x99, 0x00, 0x08, 0x07,
613 0x85, 0x99, 0x00, 0x08, 0x07, 0x85), 613 0x85, 0x99, 0x00, 0x08, 0x07, 0x85),
614 PHYREGS(0x0850, 0x084C, 0x0848, 0x01ED, 0x01EE, 0x01EF), 614 PHYREGS(0x0850, 0x084C, 0x0848, 0x01ED, 0x01EE, 0x01EF),
@@ -616,7 +616,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
616 { .channel = 64, 616 { .channel = 64,
617 .freq = 5320, /* MHz */ 617 .freq = 5320, /* MHz */
618 .unk2 = 3547, 618 .unk2 = 3547,
619 RADIOREGS(0x71, 0x02, 0x14, 0x09, 0x83, 0x01, 0x04, 0x0A, 619 RADIOREGS(0x71, 0x14, 0x02, 0x09, 0x83, 0x01, 0x04, 0x0A,
620 0x00, 0x88, 0x55, 0x55, 0x88, 0x00, 0x07, 0x07, 620 0x00, 0x88, 0x55, 0x55, 0x88, 0x00, 0x07, 0x07,
621 0x84, 0x88, 0x00, 0x07, 0x07, 0x84), 621 0x84, 0x88, 0x00, 0x07, 0x07, 0x84),
622 PHYREGS(0x0854, 0x0850, 0x084C, 0x01EC, 0x01ED, 0x01EE), 622 PHYREGS(0x0854, 0x0850, 0x084C, 0x01EC, 0x01ED, 0x01EE),
@@ -624,7 +624,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
624 { .channel = 66, 624 { .channel = 66,
625 .freq = 5330, /* MHz */ 625 .freq = 5330, /* MHz */
626 .unk2 = 3553, 626 .unk2 = 3553,
627 RADIOREGS(0x71, 0x02, 0x15, 0x09, 0x83, 0x01, 0x04, 0x0A, 627 RADIOREGS(0x71, 0x15, 0x02, 0x09, 0x83, 0x01, 0x04, 0x0A,
628 0x00, 0x88, 0x55, 0x55, 0x88, 0x00, 0x07, 0x07, 628 0x00, 0x88, 0x55, 0x55, 0x88, 0x00, 0x07, 0x07,
629 0x84, 0x88, 0x00, 0x07, 0x07, 0x84), 629 0x84, 0x88, 0x00, 0x07, 0x07, 0x84),
630 PHYREGS(0x0858, 0x0854, 0x0850, 0x01EB, 0x01EC, 0x01ED), 630 PHYREGS(0x0858, 0x0854, 0x0850, 0x01EB, 0x01EC, 0x01ED),
@@ -632,7 +632,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
632 { .channel = 68, 632 { .channel = 68,
633 .freq = 5340, /* MHz */ 633 .freq = 5340, /* MHz */
634 .unk2 = 3560, 634 .unk2 = 3560,
635 RADIOREGS(0x71, 0x02, 0x16, 0x08, 0x7C, 0x01, 0x04, 0x0A, 635 RADIOREGS(0x71, 0x16, 0x02, 0x08, 0x7C, 0x01, 0x04, 0x0A,
636 0x00, 0x88, 0x44, 0x44, 0x88, 0x00, 0x07, 0x06, 636 0x00, 0x88, 0x44, 0x44, 0x88, 0x00, 0x07, 0x06,
637 0x84, 0x88, 0x00, 0x07, 0x06, 0x84), 637 0x84, 0x88, 0x00, 0x07, 0x06, 0x84),
638 PHYREGS(0x085C, 0x0858, 0x0854, 0x01EA, 0x01EB, 0x01EC), 638 PHYREGS(0x085C, 0x0858, 0x0854, 0x01EA, 0x01EB, 0x01EC),
@@ -640,7 +640,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
640 { .channel = 70, 640 { .channel = 70,
641 .freq = 5350, /* MHz */ 641 .freq = 5350, /* MHz */
642 .unk2 = 3567, 642 .unk2 = 3567,
643 RADIOREGS(0x71, 0x02, 0x17, 0x08, 0x7C, 0x01, 0x04, 0x0A, 643 RADIOREGS(0x71, 0x17, 0x02, 0x08, 0x7C, 0x01, 0x04, 0x0A,
644 0x00, 0x88, 0x44, 0x44, 0x88, 0x00, 0x07, 0x06, 644 0x00, 0x88, 0x44, 0x44, 0x88, 0x00, 0x07, 0x06,
645 0x84, 0x88, 0x00, 0x07, 0x06, 0x84), 645 0x84, 0x88, 0x00, 0x07, 0x06, 0x84),
646 PHYREGS(0x0860, 0x085C, 0x0858, 0x01E9, 0x01EA, 0x01EB), 646 PHYREGS(0x0860, 0x085C, 0x0858, 0x01E9, 0x01EA, 0x01EB),
@@ -648,7 +648,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
648 { .channel = 72, 648 { .channel = 72,
649 .freq = 5360, /* MHz */ 649 .freq = 5360, /* MHz */
650 .unk2 = 3573, 650 .unk2 = 3573,
651 RADIOREGS(0x71, 0x02, 0x18, 0x08, 0x75, 0x01, 0x04, 0x0A, 651 RADIOREGS(0x71, 0x18, 0x02, 0x08, 0x75, 0x01, 0x04, 0x0A,
652 0x00, 0x87, 0x44, 0x44, 0x77, 0x00, 0x06, 0x05, 652 0x00, 0x87, 0x44, 0x44, 0x77, 0x00, 0x06, 0x05,
653 0x83, 0x77, 0x00, 0x06, 0x05, 0x83), 653 0x83, 0x77, 0x00, 0x06, 0x05, 0x83),
654 PHYREGS(0x0864, 0x0860, 0x085C, 0x01E8, 0x01E9, 0x01EA), 654 PHYREGS(0x0864, 0x0860, 0x085C, 0x01E8, 0x01E9, 0x01EA),
@@ -656,7 +656,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
656 { .channel = 74, 656 { .channel = 74,
657 .freq = 5370, /* MHz */ 657 .freq = 5370, /* MHz */
658 .unk2 = 3580, 658 .unk2 = 3580,
659 RADIOREGS(0x71, 0x02, 0x19, 0x08, 0x75, 0x01, 0x04, 0x0A, 659 RADIOREGS(0x71, 0x19, 0x02, 0x08, 0x75, 0x01, 0x04, 0x0A,
660 0x00, 0x87, 0x44, 0x44, 0x77, 0x00, 0x06, 0x05, 660 0x00, 0x87, 0x44, 0x44, 0x77, 0x00, 0x06, 0x05,
661 0x83, 0x77, 0x00, 0x06, 0x05, 0x83), 661 0x83, 0x77, 0x00, 0x06, 0x05, 0x83),
662 PHYREGS(0x0868, 0x0864, 0x0860, 0x01E7, 0x01E8, 0x01E9), 662 PHYREGS(0x0868, 0x0864, 0x0860, 0x01E7, 0x01E8, 0x01E9),
@@ -664,7 +664,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
664 { .channel = 76, 664 { .channel = 76,
665 .freq = 5380, /* MHz */ 665 .freq = 5380, /* MHz */
666 .unk2 = 3587, 666 .unk2 = 3587,
667 RADIOREGS(0x71, 0x02, 0x1A, 0x08, 0x6E, 0x01, 0x04, 0x0A, 667 RADIOREGS(0x71, 0x1A, 0x02, 0x08, 0x6E, 0x01, 0x04, 0x0A,
668 0x00, 0x87, 0x33, 0x33, 0x77, 0x00, 0x06, 0x04, 668 0x00, 0x87, 0x33, 0x33, 0x77, 0x00, 0x06, 0x04,
669 0x82, 0x77, 0x00, 0x06, 0x04, 0x82), 669 0x82, 0x77, 0x00, 0x06, 0x04, 0x82),
670 PHYREGS(0x086C, 0x0868, 0x0864, 0x01E6, 0x01E7, 0x01E8), 670 PHYREGS(0x086C, 0x0868, 0x0864, 0x01E6, 0x01E7, 0x01E8),
@@ -672,7 +672,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
672 { .channel = 78, 672 { .channel = 78,
673 .freq = 5390, /* MHz */ 673 .freq = 5390, /* MHz */
674 .unk2 = 3593, 674 .unk2 = 3593,
675 RADIOREGS(0x71, 0x02, 0x1B, 0x08, 0x6E, 0x01, 0x04, 0x0A, 675 RADIOREGS(0x71, 0x1B, 0x02, 0x08, 0x6E, 0x01, 0x04, 0x0A,
676 0x00, 0x87, 0x33, 0x33, 0x77, 0x00, 0x06, 0x04, 676 0x00, 0x87, 0x33, 0x33, 0x77, 0x00, 0x06, 0x04,
677 0x82, 0x77, 0x00, 0x06, 0x04, 0x82), 677 0x82, 0x77, 0x00, 0x06, 0x04, 0x82),
678 PHYREGS(0x0870, 0x086C, 0x0868, 0x01E5, 0x01E6, 0x01E7), 678 PHYREGS(0x0870, 0x086C, 0x0868, 0x01E5, 0x01E6, 0x01E7),
@@ -680,7 +680,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
680 { .channel = 80, 680 { .channel = 80,
681 .freq = 5400, /* MHz */ 681 .freq = 5400, /* MHz */
682 .unk2 = 3600, 682 .unk2 = 3600,
683 RADIOREGS(0x71, 0x02, 0x1C, 0x07, 0x67, 0x01, 0x04, 0x0A, 683 RADIOREGS(0x71, 0x1C, 0x02, 0x07, 0x67, 0x01, 0x04, 0x0A,
684 0x00, 0x86, 0x33, 0x33, 0x66, 0x00, 0x05, 0x04, 684 0x00, 0x86, 0x33, 0x33, 0x66, 0x00, 0x05, 0x04,
685 0x81, 0x66, 0x00, 0x05, 0x04, 0x81), 685 0x81, 0x66, 0x00, 0x05, 0x04, 0x81),
686 PHYREGS(0x0874, 0x0870, 0x086C, 0x01E5, 0x01E5, 0x01E6), 686 PHYREGS(0x0874, 0x0870, 0x086C, 0x01E5, 0x01E5, 0x01E6),
@@ -688,7 +688,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
688 { .channel = 82, 688 { .channel = 82,
689 .freq = 5410, /* MHz */ 689 .freq = 5410, /* MHz */
690 .unk2 = 3607, 690 .unk2 = 3607,
691 RADIOREGS(0x71, 0x02, 0x1D, 0x07, 0x67, 0x01, 0x04, 0x0A, 691 RADIOREGS(0x71, 0x1D, 0x02, 0x07, 0x67, 0x01, 0x04, 0x0A,
692 0x00, 0x86, 0x33, 0x33, 0x66, 0x00, 0x05, 0x04, 692 0x00, 0x86, 0x33, 0x33, 0x66, 0x00, 0x05, 0x04,
693 0x81, 0x66, 0x00, 0x05, 0x04, 0x81), 693 0x81, 0x66, 0x00, 0x05, 0x04, 0x81),
694 PHYREGS(0x0878, 0x0874, 0x0870, 0x01E4, 0x01E5, 0x01E5), 694 PHYREGS(0x0878, 0x0874, 0x0870, 0x01E4, 0x01E5, 0x01E5),
@@ -696,7 +696,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
696 { .channel = 84, 696 { .channel = 84,
697 .freq = 5420, /* MHz */ 697 .freq = 5420, /* MHz */
698 .unk2 = 3613, 698 .unk2 = 3613,
699 RADIOREGS(0x71, 0x02, 0x1E, 0x07, 0x61, 0x01, 0x04, 0x0A, 699 RADIOREGS(0x71, 0x1E, 0x02, 0x07, 0x61, 0x01, 0x04, 0x0A,
700 0x00, 0x86, 0x22, 0x22, 0x66, 0x00, 0x05, 0x03, 700 0x00, 0x86, 0x22, 0x22, 0x66, 0x00, 0x05, 0x03,
701 0x80, 0x66, 0x00, 0x05, 0x03, 0x80), 701 0x80, 0x66, 0x00, 0x05, 0x03, 0x80),
702 PHYREGS(0x087C, 0x0878, 0x0874, 0x01E3, 0x01E4, 0x01E5), 702 PHYREGS(0x087C, 0x0878, 0x0874, 0x01E3, 0x01E4, 0x01E5),
@@ -704,7 +704,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
704 { .channel = 86, 704 { .channel = 86,
705 .freq = 5430, /* MHz */ 705 .freq = 5430, /* MHz */
706 .unk2 = 3620, 706 .unk2 = 3620,
707 RADIOREGS(0x71, 0x02, 0x1F, 0x07, 0x61, 0x01, 0x04, 0x0A, 707 RADIOREGS(0x71, 0x1F, 0x02, 0x07, 0x61, 0x01, 0x04, 0x0A,
708 0x00, 0x86, 0x22, 0x22, 0x66, 0x00, 0x05, 0x03, 708 0x00, 0x86, 0x22, 0x22, 0x66, 0x00, 0x05, 0x03,
709 0x80, 0x66, 0x00, 0x05, 0x03, 0x80), 709 0x80, 0x66, 0x00, 0x05, 0x03, 0x80),
710 PHYREGS(0x0880, 0x087C, 0x0878, 0x01E2, 0x01E3, 0x01E4), 710 PHYREGS(0x0880, 0x087C, 0x0878, 0x01E2, 0x01E3, 0x01E4),
@@ -712,7 +712,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
712 { .channel = 88, 712 { .channel = 88,
713 .freq = 5440, /* MHz */ 713 .freq = 5440, /* MHz */
714 .unk2 = 3627, 714 .unk2 = 3627,
715 RADIOREGS(0x71, 0x02, 0x20, 0x07, 0x5A, 0x01, 0x04, 0x0A, 715 RADIOREGS(0x71, 0x20, 0x02, 0x07, 0x5A, 0x01, 0x04, 0x0A,
716 0x00, 0x85, 0x22, 0x22, 0x55, 0x00, 0x04, 0x02, 716 0x00, 0x85, 0x22, 0x22, 0x55, 0x00, 0x04, 0x02,
717 0x80, 0x55, 0x00, 0x04, 0x02, 0x80), 717 0x80, 0x55, 0x00, 0x04, 0x02, 0x80),
718 PHYREGS(0x0884, 0x0880, 0x087C, 0x01E1, 0x01E2, 0x01E3), 718 PHYREGS(0x0884, 0x0880, 0x087C, 0x01E1, 0x01E2, 0x01E3),
@@ -720,7 +720,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
720 { .channel = 90, 720 { .channel = 90,
721 .freq = 5450, /* MHz */ 721 .freq = 5450, /* MHz */
722 .unk2 = 3633, 722 .unk2 = 3633,
723 RADIOREGS(0x71, 0x02, 0x21, 0x07, 0x5A, 0x01, 0x04, 0x0A, 723 RADIOREGS(0x71, 0x21, 0x02, 0x07, 0x5A, 0x01, 0x04, 0x0A,
724 0x00, 0x85, 0x22, 0x22, 0x55, 0x00, 0x04, 0x02, 724 0x00, 0x85, 0x22, 0x22, 0x55, 0x00, 0x04, 0x02,
725 0x80, 0x55, 0x00, 0x04, 0x02, 0x80), 725 0x80, 0x55, 0x00, 0x04, 0x02, 0x80),
726 PHYREGS(0x0888, 0x0884, 0x0880, 0x01E0, 0x01E1, 0x01E2), 726 PHYREGS(0x0888, 0x0884, 0x0880, 0x01E0, 0x01E1, 0x01E2),
@@ -728,7 +728,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
728 { .channel = 92, 728 { .channel = 92,
729 .freq = 5460, /* MHz */ 729 .freq = 5460, /* MHz */
730 .unk2 = 3640, 730 .unk2 = 3640,
731 RADIOREGS(0x71, 0x02, 0x22, 0x06, 0x53, 0x01, 0x04, 0x0A, 731 RADIOREGS(0x71, 0x22, 0x02, 0x06, 0x53, 0x01, 0x04, 0x0A,
732 0x00, 0x85, 0x11, 0x11, 0x55, 0x00, 0x04, 0x01, 732 0x00, 0x85, 0x11, 0x11, 0x55, 0x00, 0x04, 0x01,
733 0x80, 0x55, 0x00, 0x04, 0x01, 0x80), 733 0x80, 0x55, 0x00, 0x04, 0x01, 0x80),
734 PHYREGS(0x088C, 0x0888, 0x0884, 0x01DF, 0x01E0, 0x01E1), 734 PHYREGS(0x088C, 0x0888, 0x0884, 0x01DF, 0x01E0, 0x01E1),
@@ -736,7 +736,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
736 { .channel = 94, 736 { .channel = 94,
737 .freq = 5470, /* MHz */ 737 .freq = 5470, /* MHz */
738 .unk2 = 3647, 738 .unk2 = 3647,
739 RADIOREGS(0x71, 0x02, 0x23, 0x06, 0x53, 0x01, 0x04, 0x0A, 739 RADIOREGS(0x71, 0x23, 0x02, 0x06, 0x53, 0x01, 0x04, 0x0A,
740 0x00, 0x85, 0x11, 0x11, 0x55, 0x00, 0x04, 0x01, 740 0x00, 0x85, 0x11, 0x11, 0x55, 0x00, 0x04, 0x01,
741 0x80, 0x55, 0x00, 0x04, 0x01, 0x80), 741 0x80, 0x55, 0x00, 0x04, 0x01, 0x80),
742 PHYREGS(0x0890, 0x088C, 0x0888, 0x01DE, 0x01DF, 0x01E0), 742 PHYREGS(0x0890, 0x088C, 0x0888, 0x01DE, 0x01DF, 0x01E0),
@@ -744,7 +744,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
744 { .channel = 96, 744 { .channel = 96,
745 .freq = 5480, /* MHz */ 745 .freq = 5480, /* MHz */
746 .unk2 = 3653, 746 .unk2 = 3653,
747 RADIOREGS(0x71, 0x02, 0x24, 0x06, 0x4D, 0x01, 0x04, 0x0A, 747 RADIOREGS(0x71, 0x24, 0x02, 0x06, 0x4D, 0x01, 0x04, 0x0A,
748 0x00, 0x84, 0x11, 0x11, 0x44, 0x00, 0x03, 0x00, 748 0x00, 0x84, 0x11, 0x11, 0x44, 0x00, 0x03, 0x00,
749 0x80, 0x44, 0x00, 0x03, 0x00, 0x80), 749 0x80, 0x44, 0x00, 0x03, 0x00, 0x80),
750 PHYREGS(0x0894, 0x0890, 0x088C, 0x01DD, 0x01DE, 0x01DF), 750 PHYREGS(0x0894, 0x0890, 0x088C, 0x01DD, 0x01DE, 0x01DF),
@@ -752,7 +752,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
752 { .channel = 98, 752 { .channel = 98,
753 .freq = 5490, /* MHz */ 753 .freq = 5490, /* MHz */
754 .unk2 = 3660, 754 .unk2 = 3660,
755 RADIOREGS(0x71, 0x02, 0x25, 0x06, 0x4D, 0x01, 0x04, 0x0A, 755 RADIOREGS(0x71, 0x25, 0x02, 0x06, 0x4D, 0x01, 0x04, 0x0A,
756 0x00, 0x84, 0x11, 0x11, 0x44, 0x00, 0x03, 0x00, 756 0x00, 0x84, 0x11, 0x11, 0x44, 0x00, 0x03, 0x00,
757 0x80, 0x44, 0x00, 0x03, 0x00, 0x80), 757 0x80, 0x44, 0x00, 0x03, 0x00, 0x80),
758 PHYREGS(0x0898, 0x0894, 0x0890, 0x01DD, 0x01DD, 0x01DE), 758 PHYREGS(0x0898, 0x0894, 0x0890, 0x01DD, 0x01DD, 0x01DE),
@@ -760,7 +760,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
760 { .channel = 100, 760 { .channel = 100,
761 .freq = 5500, /* MHz */ 761 .freq = 5500, /* MHz */
762 .unk2 = 3667, 762 .unk2 = 3667,
763 RADIOREGS(0x71, 0x02, 0x26, 0x06, 0x47, 0x01, 0x04, 0x0A, 763 RADIOREGS(0x71, 0x26, 0x02, 0x06, 0x47, 0x01, 0x04, 0x0A,
764 0x00, 0x84, 0x00, 0x00, 0x44, 0x00, 0x03, 0x00, 764 0x00, 0x84, 0x00, 0x00, 0x44, 0x00, 0x03, 0x00,
765 0x80, 0x44, 0x00, 0x03, 0x00, 0x80), 765 0x80, 0x44, 0x00, 0x03, 0x00, 0x80),
766 PHYREGS(0x089C, 0x0898, 0x0894, 0x01DC, 0x01DD, 0x01DD), 766 PHYREGS(0x089C, 0x0898, 0x0894, 0x01DC, 0x01DD, 0x01DD),
@@ -768,7 +768,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
768 { .channel = 102, 768 { .channel = 102,
769 .freq = 5510, /* MHz */ 769 .freq = 5510, /* MHz */
770 .unk2 = 3673, 770 .unk2 = 3673,
771 RADIOREGS(0x71, 0x02, 0x27, 0x06, 0x47, 0x01, 0x04, 0x0A, 771 RADIOREGS(0x71, 0x27, 0x02, 0x06, 0x47, 0x01, 0x04, 0x0A,
772 0x00, 0x84, 0x00, 0x00, 0x44, 0x00, 0x03, 0x00, 772 0x00, 0x84, 0x00, 0x00, 0x44, 0x00, 0x03, 0x00,
773 0x80, 0x44, 0x00, 0x03, 0x00, 0x80), 773 0x80, 0x44, 0x00, 0x03, 0x00, 0x80),
774 PHYREGS(0x08A0, 0x089C, 0x0898, 0x01DB, 0x01DC, 0x01DD), 774 PHYREGS(0x08A0, 0x089C, 0x0898, 0x01DB, 0x01DC, 0x01DD),
@@ -776,7 +776,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
776 { .channel = 104, 776 { .channel = 104,
777 .freq = 5520, /* MHz */ 777 .freq = 5520, /* MHz */
778 .unk2 = 3680, 778 .unk2 = 3680,
779 RADIOREGS(0x71, 0x02, 0x28, 0x05, 0x40, 0x01, 0x04, 0x0A, 779 RADIOREGS(0x71, 0x28, 0x02, 0x05, 0x40, 0x01, 0x04, 0x0A,
780 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00, 780 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00,
781 0x80, 0x33, 0x00, 0x02, 0x00, 0x80), 781 0x80, 0x33, 0x00, 0x02, 0x00, 0x80),
782 PHYREGS(0x08A4, 0x08A0, 0x089C, 0x01DA, 0x01DB, 0x01DC), 782 PHYREGS(0x08A4, 0x08A0, 0x089C, 0x01DA, 0x01DB, 0x01DC),
@@ -784,7 +784,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
784 { .channel = 106, 784 { .channel = 106,
785 .freq = 5530, /* MHz */ 785 .freq = 5530, /* MHz */
786 .unk2 = 3687, 786 .unk2 = 3687,
787 RADIOREGS(0x71, 0x02, 0x29, 0x05, 0x40, 0x01, 0x04, 0x0A, 787 RADIOREGS(0x71, 0x29, 0x02, 0x05, 0x40, 0x01, 0x04, 0x0A,
788 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00, 788 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00,
789 0x80, 0x33, 0x00, 0x02, 0x00, 0x80), 789 0x80, 0x33, 0x00, 0x02, 0x00, 0x80),
790 PHYREGS(0x08A8, 0x08A4, 0x08A0, 0x01D9, 0x01DA, 0x01DB), 790 PHYREGS(0x08A8, 0x08A4, 0x08A0, 0x01D9, 0x01DA, 0x01DB),
@@ -792,7 +792,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
792 { .channel = 108, 792 { .channel = 108,
793 .freq = 5540, /* MHz */ 793 .freq = 5540, /* MHz */
794 .unk2 = 3693, 794 .unk2 = 3693,
795 RADIOREGS(0x71, 0x02, 0x2A, 0x05, 0x3A, 0x01, 0x04, 0x0A, 795 RADIOREGS(0x71, 0x2A, 0x02, 0x05, 0x3A, 0x01, 0x04, 0x0A,
796 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00, 796 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00,
797 0x80, 0x33, 0x00, 0x02, 0x00, 0x80), 797 0x80, 0x33, 0x00, 0x02, 0x00, 0x80),
798 PHYREGS(0x08AC, 0x08A8, 0x08A4, 0x01D8, 0x01D9, 0x01DA), 798 PHYREGS(0x08AC, 0x08A8, 0x08A4, 0x01D8, 0x01D9, 0x01DA),
@@ -800,7 +800,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
800 { .channel = 110, 800 { .channel = 110,
801 .freq = 5550, /* MHz */ 801 .freq = 5550, /* MHz */
802 .unk2 = 3700, 802 .unk2 = 3700,
803 RADIOREGS(0x71, 0x02, 0x2B, 0x05, 0x3A, 0x01, 0x04, 0x0A, 803 RADIOREGS(0x71, 0x2B, 0x02, 0x05, 0x3A, 0x01, 0x04, 0x0A,
804 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00, 804 0x00, 0x83, 0x00, 0x00, 0x33, 0x00, 0x02, 0x00,
805 0x80, 0x33, 0x00, 0x02, 0x00, 0x80), 805 0x80, 0x33, 0x00, 0x02, 0x00, 0x80),
806 PHYREGS(0x08B0, 0x08AC, 0x08A8, 0x01D7, 0x01D8, 0x01D9), 806 PHYREGS(0x08B0, 0x08AC, 0x08A8, 0x01D7, 0x01D8, 0x01D9),
@@ -808,7 +808,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
808 { .channel = 112, 808 { .channel = 112,
809 .freq = 5560, /* MHz */ 809 .freq = 5560, /* MHz */
810 .unk2 = 3707, 810 .unk2 = 3707,
811 RADIOREGS(0x71, 0x02, 0x2C, 0x05, 0x34, 0x01, 0x04, 0x0A, 811 RADIOREGS(0x71, 0x2C, 0x02, 0x05, 0x34, 0x01, 0x04, 0x0A,
812 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, 812 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00,
813 0x80, 0x22, 0x00, 0x01, 0x00, 0x80), 813 0x80, 0x22, 0x00, 0x01, 0x00, 0x80),
814 PHYREGS(0x08B4, 0x08B0, 0x08AC, 0x01D7, 0x01D7, 0x01D8), 814 PHYREGS(0x08B4, 0x08B0, 0x08AC, 0x01D7, 0x01D7, 0x01D8),
@@ -816,7 +816,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
816 { .channel = 114, 816 { .channel = 114,
817 .freq = 5570, /* MHz */ 817 .freq = 5570, /* MHz */
818 .unk2 = 3713, 818 .unk2 = 3713,
819 RADIOREGS(0x71, 0x02, 0x2D, 0x05, 0x34, 0x01, 0x04, 0x0A, 819 RADIOREGS(0x71, 0x2D, 0x02, 0x05, 0x34, 0x01, 0x04, 0x0A,
820 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, 820 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00,
821 0x80, 0x22, 0x00, 0x01, 0x00, 0x80), 821 0x80, 0x22, 0x00, 0x01, 0x00, 0x80),
822 PHYREGS(0x08B8, 0x08B4, 0x08B0, 0x01D6, 0x01D7, 0x01D7), 822 PHYREGS(0x08B8, 0x08B4, 0x08B0, 0x01D6, 0x01D7, 0x01D7),
@@ -824,7 +824,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
824 { .channel = 116, 824 { .channel = 116,
825 .freq = 5580, /* MHz */ 825 .freq = 5580, /* MHz */
826 .unk2 = 3720, 826 .unk2 = 3720,
827 RADIOREGS(0x71, 0x02, 0x2E, 0x04, 0x2E, 0x01, 0x04, 0x0A, 827 RADIOREGS(0x71, 0x2E, 0x02, 0x04, 0x2E, 0x01, 0x04, 0x0A,
828 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, 828 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00,
829 0x80, 0x22, 0x00, 0x01, 0x00, 0x80), 829 0x80, 0x22, 0x00, 0x01, 0x00, 0x80),
830 PHYREGS(0x08BC, 0x08B8, 0x08B4, 0x01D5, 0x01D6, 0x01D7), 830 PHYREGS(0x08BC, 0x08B8, 0x08B4, 0x01D5, 0x01D6, 0x01D7),
@@ -832,7 +832,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
832 { .channel = 118, 832 { .channel = 118,
833 .freq = 5590, /* MHz */ 833 .freq = 5590, /* MHz */
834 .unk2 = 3727, 834 .unk2 = 3727,
835 RADIOREGS(0x71, 0x02, 0x2F, 0x04, 0x2E, 0x01, 0x04, 0x0A, 835 RADIOREGS(0x71, 0x2F, 0x02, 0x04, 0x2E, 0x01, 0x04, 0x0A,
836 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, 836 0x00, 0x82, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00,
837 0x80, 0x22, 0x00, 0x01, 0x00, 0x80), 837 0x80, 0x22, 0x00, 0x01, 0x00, 0x80),
838 PHYREGS(0x08C0, 0x08BC, 0x08B8, 0x01D4, 0x01D5, 0x01D6), 838 PHYREGS(0x08C0, 0x08BC, 0x08B8, 0x01D4, 0x01D5, 0x01D6),
@@ -840,7 +840,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
840 { .channel = 120, 840 { .channel = 120,
841 .freq = 5600, /* MHz */ 841 .freq = 5600, /* MHz */
842 .unk2 = 3733, 842 .unk2 = 3733,
843 RADIOREGS(0x71, 0x02, 0x30, 0x04, 0x28, 0x01, 0x04, 0x0A, 843 RADIOREGS(0x71, 0x30, 0x02, 0x04, 0x28, 0x01, 0x04, 0x0A,
844 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x01, 0x00, 844 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x01, 0x00,
845 0x80, 0x11, 0x00, 0x01, 0x00, 0x80), 845 0x80, 0x11, 0x00, 0x01, 0x00, 0x80),
846 PHYREGS(0x08C4, 0x08C0, 0x08BC, 0x01D3, 0x01D4, 0x01D5), 846 PHYREGS(0x08C4, 0x08C0, 0x08BC, 0x01D3, 0x01D4, 0x01D5),
@@ -848,7 +848,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
848 { .channel = 122, 848 { .channel = 122,
849 .freq = 5610, /* MHz */ 849 .freq = 5610, /* MHz */
850 .unk2 = 3740, 850 .unk2 = 3740,
851 RADIOREGS(0x71, 0x02, 0x31, 0x04, 0x28, 0x01, 0x04, 0x0A, 851 RADIOREGS(0x71, 0x31, 0x02, 0x04, 0x28, 0x01, 0x04, 0x0A,
852 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x01, 0x00, 852 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x01, 0x00,
853 0x80, 0x11, 0x00, 0x01, 0x00, 0x80), 853 0x80, 0x11, 0x00, 0x01, 0x00, 0x80),
854 PHYREGS(0x08C8, 0x08C4, 0x08C0, 0x01D2, 0x01D3, 0x01D4), 854 PHYREGS(0x08C8, 0x08C4, 0x08C0, 0x01D2, 0x01D3, 0x01D4),
@@ -856,7 +856,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
856 { .channel = 124, 856 { .channel = 124,
857 .freq = 5620, /* MHz */ 857 .freq = 5620, /* MHz */
858 .unk2 = 3747, 858 .unk2 = 3747,
859 RADIOREGS(0x71, 0x02, 0x32, 0x04, 0x21, 0x01, 0x04, 0x0A, 859 RADIOREGS(0x71, 0x32, 0x02, 0x04, 0x21, 0x01, 0x04, 0x0A,
860 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 860 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00,
861 0x80, 0x11, 0x00, 0x00, 0x00, 0x80), 861 0x80, 0x11, 0x00, 0x00, 0x00, 0x80),
862 PHYREGS(0x08CC, 0x08C8, 0x08C4, 0x01D2, 0x01D2, 0x01D3), 862 PHYREGS(0x08CC, 0x08C8, 0x08C4, 0x01D2, 0x01D2, 0x01D3),
@@ -864,7 +864,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
864 { .channel = 126, 864 { .channel = 126,
865 .freq = 5630, /* MHz */ 865 .freq = 5630, /* MHz */
866 .unk2 = 3753, 866 .unk2 = 3753,
867 RADIOREGS(0x71, 0x02, 0x33, 0x04, 0x21, 0x01, 0x04, 0x0A, 867 RADIOREGS(0x71, 0x33, 0x02, 0x04, 0x21, 0x01, 0x04, 0x0A,
868 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 868 0x00, 0x81, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00,
869 0x80, 0x11, 0x00, 0x00, 0x00, 0x80), 869 0x80, 0x11, 0x00, 0x00, 0x00, 0x80),
870 PHYREGS(0x08D0, 0x08CC, 0x08C8, 0x01D1, 0x01D2, 0x01D2), 870 PHYREGS(0x08D0, 0x08CC, 0x08C8, 0x01D1, 0x01D2, 0x01D2),
@@ -872,7 +872,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
872 { .channel = 128, 872 { .channel = 128,
873 .freq = 5640, /* MHz */ 873 .freq = 5640, /* MHz */
874 .unk2 = 3760, 874 .unk2 = 3760,
875 RADIOREGS(0x71, 0x02, 0x34, 0x03, 0x1C, 0x01, 0x04, 0x0A, 875 RADIOREGS(0x71, 0x34, 0x02, 0x03, 0x1C, 0x01, 0x04, 0x0A,
876 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 876 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
877 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 877 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
878 PHYREGS(0x08D4, 0x08D0, 0x08CC, 0x01D0, 0x01D1, 0x01D2), 878 PHYREGS(0x08D4, 0x08D0, 0x08CC, 0x01D0, 0x01D1, 0x01D2),
@@ -880,7 +880,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
880 { .channel = 130, 880 { .channel = 130,
881 .freq = 5650, /* MHz */ 881 .freq = 5650, /* MHz */
882 .unk2 = 3767, 882 .unk2 = 3767,
883 RADIOREGS(0x71, 0x02, 0x35, 0x03, 0x1C, 0x01, 0x04, 0x0A, 883 RADIOREGS(0x71, 0x35, 0x02, 0x03, 0x1C, 0x01, 0x04, 0x0A,
884 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 884 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
885 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 885 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
886 PHYREGS(0x08D8, 0x08D4, 0x08D0, 0x01CF, 0x01D0, 0x01D1), 886 PHYREGS(0x08D8, 0x08D4, 0x08D0, 0x01CF, 0x01D0, 0x01D1),
@@ -888,7 +888,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
888 { .channel = 132, 888 { .channel = 132,
889 .freq = 5660, /* MHz */ 889 .freq = 5660, /* MHz */
890 .unk2 = 3773, 890 .unk2 = 3773,
891 RADIOREGS(0x71, 0x02, 0x36, 0x03, 0x16, 0x01, 0x04, 0x0A, 891 RADIOREGS(0x71, 0x36, 0x02, 0x03, 0x16, 0x01, 0x04, 0x0A,
892 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 892 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
893 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 893 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
894 PHYREGS(0x08DC, 0x08D8, 0x08D4, 0x01CE, 0x01CF, 0x01D0), 894 PHYREGS(0x08DC, 0x08D8, 0x08D4, 0x01CE, 0x01CF, 0x01D0),
@@ -896,7 +896,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
896 { .channel = 134, 896 { .channel = 134,
897 .freq = 5670, /* MHz */ 897 .freq = 5670, /* MHz */
898 .unk2 = 3780, 898 .unk2 = 3780,
899 RADIOREGS(0x71, 0x02, 0x37, 0x03, 0x16, 0x01, 0x04, 0x0A, 899 RADIOREGS(0x71, 0x37, 0x02, 0x03, 0x16, 0x01, 0x04, 0x0A,
900 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 900 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
901 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 901 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
902 PHYREGS(0x08E0, 0x08DC, 0x08D8, 0x01CE, 0x01CE, 0x01CF), 902 PHYREGS(0x08E0, 0x08DC, 0x08D8, 0x01CE, 0x01CE, 0x01CF),
@@ -904,7 +904,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
904 { .channel = 136, 904 { .channel = 136,
905 .freq = 5680, /* MHz */ 905 .freq = 5680, /* MHz */
906 .unk2 = 3787, 906 .unk2 = 3787,
907 RADIOREGS(0x71, 0x02, 0x38, 0x03, 0x10, 0x01, 0x04, 0x0A, 907 RADIOREGS(0x71, 0x38, 0x02, 0x03, 0x10, 0x01, 0x04, 0x0A,
908 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 908 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
909 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 909 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
910 PHYREGS(0x08E4, 0x08E0, 0x08DC, 0x01CD, 0x01CE, 0x01CE), 910 PHYREGS(0x08E4, 0x08E0, 0x08DC, 0x01CD, 0x01CE, 0x01CE),
@@ -912,7 +912,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
912 { .channel = 138, 912 { .channel = 138,
913 .freq = 5690, /* MHz */ 913 .freq = 5690, /* MHz */
914 .unk2 = 3793, 914 .unk2 = 3793,
915 RADIOREGS(0x71, 0x02, 0x39, 0x03, 0x10, 0x01, 0x04, 0x0A, 915 RADIOREGS(0x71, 0x39, 0x02, 0x03, 0x10, 0x01, 0x04, 0x0A,
916 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 916 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
917 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 917 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
918 PHYREGS(0x08E8, 0x08E4, 0x08E0, 0x01CC, 0x01CD, 0x01CE), 918 PHYREGS(0x08E8, 0x08E4, 0x08E0, 0x01CC, 0x01CD, 0x01CE),
@@ -920,7 +920,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
920 { .channel = 140, 920 { .channel = 140,
921 .freq = 5700, /* MHz */ 921 .freq = 5700, /* MHz */
922 .unk2 = 3800, 922 .unk2 = 3800,
923 RADIOREGS(0x71, 0x02, 0x3A, 0x02, 0x0A, 0x01, 0x04, 0x0A, 923 RADIOREGS(0x71, 0x3A, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A,
924 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 924 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
925 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 925 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
926 PHYREGS(0x08EC, 0x08E8, 0x08E4, 0x01CB, 0x01CC, 0x01CD), 926 PHYREGS(0x08EC, 0x08E8, 0x08E4, 0x01CB, 0x01CC, 0x01CD),
@@ -928,7 +928,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
928 { .channel = 142, 928 { .channel = 142,
929 .freq = 5710, /* MHz */ 929 .freq = 5710, /* MHz */
930 .unk2 = 3807, 930 .unk2 = 3807,
931 RADIOREGS(0x71, 0x02, 0x3B, 0x02, 0x0A, 0x01, 0x04, 0x0A, 931 RADIOREGS(0x71, 0x3B, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A,
932 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 932 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
933 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 933 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
934 PHYREGS(0x08F0, 0x08EC, 0x08E8, 0x01CA, 0x01CB, 0x01CC), 934 PHYREGS(0x08F0, 0x08EC, 0x08E8, 0x01CA, 0x01CB, 0x01CC),
@@ -936,7 +936,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
936 { .channel = 144, 936 { .channel = 144,
937 .freq = 5720, /* MHz */ 937 .freq = 5720, /* MHz */
938 .unk2 = 3813, 938 .unk2 = 3813,
939 RADIOREGS(0x71, 0x02, 0x3C, 0x02, 0x0A, 0x01, 0x04, 0x0A, 939 RADIOREGS(0x71, 0x3C, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A,
940 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 940 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
941 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 941 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
942 PHYREGS(0x08F4, 0x08F0, 0x08EC, 0x01C9, 0x01CA, 0x01CB), 942 PHYREGS(0x08F4, 0x08F0, 0x08EC, 0x01C9, 0x01CA, 0x01CB),
@@ -944,7 +944,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
944 { .channel = 145, 944 { .channel = 145,
945 .freq = 5725, /* MHz */ 945 .freq = 5725, /* MHz */
946 .unk2 = 3817, 946 .unk2 = 3817,
947 RADIOREGS(0x72, 0x04, 0x79, 0x02, 0x03, 0x01, 0x03, 0x14, 947 RADIOREGS(0x72, 0x79, 0x04, 0x02, 0x03, 0x01, 0x03, 0x14,
948 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 948 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
949 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 949 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
950 PHYREGS(0x08F6, 0x08F2, 0x08EE, 0x01C9, 0x01CA, 0x01CB), 950 PHYREGS(0x08F6, 0x08F2, 0x08EE, 0x01C9, 0x01CA, 0x01CB),
@@ -952,7 +952,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
952 { .channel = 146, 952 { .channel = 146,
953 .freq = 5730, /* MHz */ 953 .freq = 5730, /* MHz */
954 .unk2 = 3820, 954 .unk2 = 3820,
955 RADIOREGS(0x71, 0x02, 0x3D, 0x02, 0x0A, 0x01, 0x04, 0x0A, 955 RADIOREGS(0x71, 0x3D, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A,
956 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 956 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
957 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 957 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
958 PHYREGS(0x08F8, 0x08F4, 0x08F0, 0x01C9, 0x01C9, 0x01CA), 958 PHYREGS(0x08F8, 0x08F4, 0x08F0, 0x01C9, 0x01C9, 0x01CA),
@@ -960,7 +960,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
960 { .channel = 147, 960 { .channel = 147,
961 .freq = 5735, /* MHz */ 961 .freq = 5735, /* MHz */
962 .unk2 = 3823, 962 .unk2 = 3823,
963 RADIOREGS(0x72, 0x04, 0x7B, 0x02, 0x03, 0x01, 0x03, 0x14, 963 RADIOREGS(0x72, 0x7B, 0x04, 0x02, 0x03, 0x01, 0x03, 0x14,
964 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 964 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
965 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 965 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
966 PHYREGS(0x08FA, 0x08F6, 0x08F2, 0x01C8, 0x01C9, 0x01CA), 966 PHYREGS(0x08FA, 0x08F6, 0x08F2, 0x01C8, 0x01C9, 0x01CA),
@@ -968,7 +968,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
968 { .channel = 148, 968 { .channel = 148,
969 .freq = 5740, /* MHz */ 969 .freq = 5740, /* MHz */
970 .unk2 = 3827, 970 .unk2 = 3827,
971 RADIOREGS(0x71, 0x02, 0x3E, 0x02, 0x0A, 0x01, 0x04, 0x0A, 971 RADIOREGS(0x71, 0x3E, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A,
972 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 972 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
973 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 973 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
974 PHYREGS(0x08FC, 0x08F8, 0x08F4, 0x01C8, 0x01C9, 0x01C9), 974 PHYREGS(0x08FC, 0x08F8, 0x08F4, 0x01C8, 0x01C9, 0x01C9),
@@ -976,7 +976,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
976 { .channel = 149, 976 { .channel = 149,
977 .freq = 5745, /* MHz */ 977 .freq = 5745, /* MHz */
978 .unk2 = 3830, 978 .unk2 = 3830,
979 RADIOREGS(0x72, 0x04, 0x7D, 0x02, 0xFE, 0x00, 0x03, 0x14, 979 RADIOREGS(0x72, 0x7D, 0x04, 0x02, 0xFE, 0x00, 0x03, 0x14,
980 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 980 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
981 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 981 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
982 PHYREGS(0x08FE, 0x08FA, 0x08F6, 0x01C8, 0x01C8, 0x01C9), 982 PHYREGS(0x08FE, 0x08FA, 0x08F6, 0x01C8, 0x01C8, 0x01C9),
@@ -984,7 +984,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
984 { .channel = 150, 984 { .channel = 150,
985 .freq = 5750, /* MHz */ 985 .freq = 5750, /* MHz */
986 .unk2 = 3833, 986 .unk2 = 3833,
987 RADIOREGS(0x71, 0x02, 0x3F, 0x02, 0x0A, 0x01, 0x04, 0x0A, 987 RADIOREGS(0x71, 0x3F, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A,
988 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 988 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
989 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 989 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
990 PHYREGS(0x0900, 0x08FC, 0x08F8, 0x01C7, 0x01C8, 0x01C9), 990 PHYREGS(0x0900, 0x08FC, 0x08F8, 0x01C7, 0x01C8, 0x01C9),
@@ -992,7 +992,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
992 { .channel = 151, 992 { .channel = 151,
993 .freq = 5755, /* MHz */ 993 .freq = 5755, /* MHz */
994 .unk2 = 3837, 994 .unk2 = 3837,
995 RADIOREGS(0x72, 0x04, 0x7F, 0x02, 0xFE, 0x00, 0x03, 0x14, 995 RADIOREGS(0x72, 0x7F, 0x04, 0x02, 0xFE, 0x00, 0x03, 0x14,
996 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 996 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
997 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 997 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
998 PHYREGS(0x0902, 0x08FE, 0x08FA, 0x01C7, 0x01C8, 0x01C8), 998 PHYREGS(0x0902, 0x08FE, 0x08FA, 0x01C7, 0x01C8, 0x01C8),
@@ -1000,7 +1000,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1000 { .channel = 152, 1000 { .channel = 152,
1001 .freq = 5760, /* MHz */ 1001 .freq = 5760, /* MHz */
1002 .unk2 = 3840, 1002 .unk2 = 3840,
1003 RADIOREGS(0x71, 0x02, 0x40, 0x02, 0x0A, 0x01, 0x04, 0x0A, 1003 RADIOREGS(0x71, 0x40, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A,
1004 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1004 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1005 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1005 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1006 PHYREGS(0x0904, 0x0900, 0x08FC, 0x01C6, 0x01C7, 0x01C8), 1006 PHYREGS(0x0904, 0x0900, 0x08FC, 0x01C6, 0x01C7, 0x01C8),
@@ -1008,7 +1008,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1008 { .channel = 153, 1008 { .channel = 153,
1009 .freq = 5765, /* MHz */ 1009 .freq = 5765, /* MHz */
1010 .unk2 = 3843, 1010 .unk2 = 3843,
1011 RADIOREGS(0x72, 0x04, 0x81, 0x02, 0xF8, 0x00, 0x03, 0x14, 1011 RADIOREGS(0x72, 0x81, 0x04, 0x02, 0xF8, 0x00, 0x03, 0x14,
1012 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1012 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1013 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1013 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1014 PHYREGS(0x0906, 0x0902, 0x08FE, 0x01C6, 0x01C7, 0x01C8), 1014 PHYREGS(0x0906, 0x0902, 0x08FE, 0x01C6, 0x01C7, 0x01C8),
@@ -1016,7 +1016,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1016 { .channel = 154, 1016 { .channel = 154,
1017 .freq = 5770, /* MHz */ 1017 .freq = 5770, /* MHz */
1018 .unk2 = 3847, 1018 .unk2 = 3847,
1019 RADIOREGS(0x71, 0x02, 0x41, 0x02, 0x0A, 0x01, 0x04, 0x0A, 1019 RADIOREGS(0x71, 0x41, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A,
1020 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1020 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1021 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1021 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1022 PHYREGS(0x0908, 0x0904, 0x0900, 0x01C6, 0x01C6, 0x01C7), 1022 PHYREGS(0x0908, 0x0904, 0x0900, 0x01C6, 0x01C6, 0x01C7),
@@ -1024,7 +1024,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1024 { .channel = 155, 1024 { .channel = 155,
1025 .freq = 5775, /* MHz */ 1025 .freq = 5775, /* MHz */
1026 .unk2 = 3850, 1026 .unk2 = 3850,
1027 RADIOREGS(0x72, 0x04, 0x83, 0x02, 0xF8, 0x00, 0x03, 0x14, 1027 RADIOREGS(0x72, 0x83, 0x04, 0x02, 0xF8, 0x00, 0x03, 0x14,
1028 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1028 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1029 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1029 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1030 PHYREGS(0x090A, 0x0906, 0x0902, 0x01C5, 0x01C6, 0x01C7), 1030 PHYREGS(0x090A, 0x0906, 0x0902, 0x01C5, 0x01C6, 0x01C7),
@@ -1032,7 +1032,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1032 { .channel = 156, 1032 { .channel = 156,
1033 .freq = 5780, /* MHz */ 1033 .freq = 5780, /* MHz */
1034 .unk2 = 3853, 1034 .unk2 = 3853,
1035 RADIOREGS(0x71, 0x02, 0x42, 0x02, 0x0A, 0x01, 0x04, 0x0A, 1035 RADIOREGS(0x71, 0x42, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A,
1036 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1036 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1037 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1037 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1038 PHYREGS(0x090C, 0x0908, 0x0904, 0x01C5, 0x01C6, 0x01C6), 1038 PHYREGS(0x090C, 0x0908, 0x0904, 0x01C5, 0x01C6, 0x01C6),
@@ -1040,7 +1040,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1040 { .channel = 157, 1040 { .channel = 157,
1041 .freq = 5785, /* MHz */ 1041 .freq = 5785, /* MHz */
1042 .unk2 = 3857, 1042 .unk2 = 3857,
1043 RADIOREGS(0x72, 0x04, 0x85, 0x02, 0xF2, 0x00, 0x03, 0x14, 1043 RADIOREGS(0x72, 0x85, 0x04, 0x02, 0xF2, 0x00, 0x03, 0x14,
1044 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1044 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1045 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1045 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1046 PHYREGS(0x090E, 0x090A, 0x0906, 0x01C4, 0x01C5, 0x01C6), 1046 PHYREGS(0x090E, 0x090A, 0x0906, 0x01C4, 0x01C5, 0x01C6),
@@ -1048,7 +1048,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1048 { .channel = 158, 1048 { .channel = 158,
1049 .freq = 5790, /* MHz */ 1049 .freq = 5790, /* MHz */
1050 .unk2 = 3860, 1050 .unk2 = 3860,
1051 RADIOREGS(0x71, 0x02, 0x43, 0x02, 0x0A, 0x01, 0x04, 0x0A, 1051 RADIOREGS(0x71, 0x43, 0x02, 0x02, 0x0A, 0x01, 0x04, 0x0A,
1052 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1052 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1053 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1053 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1054 PHYREGS(0x0910, 0x090C, 0x0908, 0x01C4, 0x01C5, 0x01C6), 1054 PHYREGS(0x0910, 0x090C, 0x0908, 0x01C4, 0x01C5, 0x01C6),
@@ -1056,7 +1056,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1056 { .channel = 159, 1056 { .channel = 159,
1057 .freq = 5795, /* MHz */ 1057 .freq = 5795, /* MHz */
1058 .unk2 = 3863, 1058 .unk2 = 3863,
1059 RADIOREGS(0x72, 0x04, 0x87, 0x02, 0xF2, 0x00, 0x03, 0x14, 1059 RADIOREGS(0x72, 0x87, 0x04, 0x02, 0xF2, 0x00, 0x03, 0x14,
1060 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1060 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1061 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1061 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1062 PHYREGS(0x0912, 0x090E, 0x090A, 0x01C4, 0x01C4, 0x01C5), 1062 PHYREGS(0x0912, 0x090E, 0x090A, 0x01C4, 0x01C4, 0x01C5),
@@ -1064,7 +1064,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1064 { .channel = 160, 1064 { .channel = 160,
1065 .freq = 5800, /* MHz */ 1065 .freq = 5800, /* MHz */
1066 .unk2 = 3867, 1066 .unk2 = 3867,
1067 RADIOREGS(0x71, 0x02, 0x44, 0x01, 0x0A, 0x01, 0x04, 0x0A, 1067 RADIOREGS(0x71, 0x44, 0x02, 0x01, 0x0A, 0x01, 0x04, 0x0A,
1068 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1068 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1069 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1069 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1070 PHYREGS(0x0914, 0x0910, 0x090C, 0x01C3, 0x01C4, 0x01C5), 1070 PHYREGS(0x0914, 0x0910, 0x090C, 0x01C3, 0x01C4, 0x01C5),
@@ -1072,7 +1072,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1072 { .channel = 161, 1072 { .channel = 161,
1073 .freq = 5805, /* MHz */ 1073 .freq = 5805, /* MHz */
1074 .unk2 = 3870, 1074 .unk2 = 3870,
1075 RADIOREGS(0x72, 0x04, 0x89, 0x01, 0xED, 0x00, 0x03, 0x14, 1075 RADIOREGS(0x72, 0x89, 0x04, 0x01, 0xED, 0x00, 0x03, 0x14,
1076 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1076 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1077 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1077 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1078 PHYREGS(0x0916, 0x0912, 0x090E, 0x01C3, 0x01C4, 0x01C4), 1078 PHYREGS(0x0916, 0x0912, 0x090E, 0x01C3, 0x01C4, 0x01C4),
@@ -1080,7 +1080,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1080 { .channel = 162, 1080 { .channel = 162,
1081 .freq = 5810, /* MHz */ 1081 .freq = 5810, /* MHz */
1082 .unk2 = 3873, 1082 .unk2 = 3873,
1083 RADIOREGS(0x71, 0x02, 0x45, 0x01, 0x0A, 0x01, 0x04, 0x0A, 1083 RADIOREGS(0x71, 0x45, 0x02, 0x01, 0x0A, 0x01, 0x04, 0x0A,
1084 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1084 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1085 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1085 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1086 PHYREGS(0x0918, 0x0914, 0x0910, 0x01C2, 0x01C3, 0x01C4), 1086 PHYREGS(0x0918, 0x0914, 0x0910, 0x01C2, 0x01C3, 0x01C4),
@@ -1088,7 +1088,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1088 { .channel = 163, 1088 { .channel = 163,
1089 .freq = 5815, /* MHz */ 1089 .freq = 5815, /* MHz */
1090 .unk2 = 3877, 1090 .unk2 = 3877,
1091 RADIOREGS(0x72, 0x04, 0x8B, 0x01, 0xED, 0x00, 0x03, 0x14, 1091 RADIOREGS(0x72, 0x8B, 0x04, 0x01, 0xED, 0x00, 0x03, 0x14,
1092 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1092 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1093 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1093 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1094 PHYREGS(0x091A, 0x0916, 0x0912, 0x01C2, 0x01C3, 0x01C4), 1094 PHYREGS(0x091A, 0x0916, 0x0912, 0x01C2, 0x01C3, 0x01C4),
@@ -1096,7 +1096,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1096 { .channel = 164, 1096 { .channel = 164,
1097 .freq = 5820, /* MHz */ 1097 .freq = 5820, /* MHz */
1098 .unk2 = 3880, 1098 .unk2 = 3880,
1099 RADIOREGS(0x71, 0x02, 0x46, 0x01, 0x0A, 0x01, 0x04, 0x0A, 1099 RADIOREGS(0x71, 0x46, 0x02, 0x01, 0x0A, 0x01, 0x04, 0x0A,
1100 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1100 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1101 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1101 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1102 PHYREGS(0x091C, 0x0918, 0x0914, 0x01C2, 0x01C2, 0x01C3), 1102 PHYREGS(0x091C, 0x0918, 0x0914, 0x01C2, 0x01C2, 0x01C3),
@@ -1104,7 +1104,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1104 { .channel = 165, 1104 { .channel = 165,
1105 .freq = 5825, /* MHz */ 1105 .freq = 5825, /* MHz */
1106 .unk2 = 3883, 1106 .unk2 = 3883,
1107 RADIOREGS(0x72, 0x04, 0x8D, 0x01, 0xED, 0x00, 0x03, 0x14, 1107 RADIOREGS(0x72, 0x8D, 0x04, 0x01, 0xED, 0x00, 0x03, 0x14,
1108 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1108 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1109 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1109 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1110 PHYREGS(0x091E, 0x091A, 0x0916, 0x01C1, 0x01C2, 0x01C3), 1110 PHYREGS(0x091E, 0x091A, 0x0916, 0x01C1, 0x01C2, 0x01C3),
@@ -1112,7 +1112,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1112 { .channel = 166, 1112 { .channel = 166,
1113 .freq = 5830, /* MHz */ 1113 .freq = 5830, /* MHz */
1114 .unk2 = 3887, 1114 .unk2 = 3887,
1115 RADIOREGS(0x71, 0x02, 0x47, 0x01, 0x0A, 0x01, 0x04, 0x0A, 1115 RADIOREGS(0x71, 0x47, 0x02, 0x01, 0x0A, 0x01, 0x04, 0x0A,
1116 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1116 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1117 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1117 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1118 PHYREGS(0x0920, 0x091C, 0x0918, 0x01C1, 0x01C2, 0x01C2), 1118 PHYREGS(0x0920, 0x091C, 0x0918, 0x01C1, 0x01C2, 0x01C2),
@@ -1120,7 +1120,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1120 { .channel = 168, 1120 { .channel = 168,
1121 .freq = 5840, /* MHz */ 1121 .freq = 5840, /* MHz */
1122 .unk2 = 3893, 1122 .unk2 = 3893,
1123 RADIOREGS(0x71, 0x02, 0x48, 0x01, 0x0A, 0x01, 0x04, 0x0A, 1123 RADIOREGS(0x71, 0x48, 0x02, 0x01, 0x0A, 0x01, 0x04, 0x0A,
1124 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1124 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1125 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1125 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1126 PHYREGS(0x0924, 0x0920, 0x091C, 0x01C0, 0x01C1, 0x01C2), 1126 PHYREGS(0x0924, 0x0920, 0x091C, 0x01C0, 0x01C1, 0x01C2),
@@ -1128,7 +1128,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1128 { .channel = 170, 1128 { .channel = 170,
1129 .freq = 5850, /* MHz */ 1129 .freq = 5850, /* MHz */
1130 .unk2 = 3900, 1130 .unk2 = 3900,
1131 RADIOREGS(0x71, 0x02, 0x49, 0x01, 0xE0, 0x00, 0x04, 0x0A, 1131 RADIOREGS(0x71, 0x49, 0x02, 0x01, 0xE0, 0x00, 0x04, 0x0A,
1132 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1132 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1133 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1133 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1134 PHYREGS(0x0928, 0x0924, 0x0920, 0x01BF, 0x01C0, 0x01C1), 1134 PHYREGS(0x0928, 0x0924, 0x0920, 0x01BF, 0x01C0, 0x01C1),
@@ -1136,7 +1136,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1136 { .channel = 172, 1136 { .channel = 172,
1137 .freq = 5860, /* MHz */ 1137 .freq = 5860, /* MHz */
1138 .unk2 = 3907, 1138 .unk2 = 3907,
1139 RADIOREGS(0x71, 0x02, 0x4A, 0x01, 0xDE, 0x00, 0x04, 0x0A, 1139 RADIOREGS(0x71, 0x4A, 0x02, 0x01, 0xDE, 0x00, 0x04, 0x0A,
1140 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1140 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1141 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1141 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1142 PHYREGS(0x092C, 0x0928, 0x0924, 0x01BF, 0x01BF, 0x01C0), 1142 PHYREGS(0x092C, 0x0928, 0x0924, 0x01BF, 0x01BF, 0x01C0),
@@ -1144,7 +1144,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1144 { .channel = 174, 1144 { .channel = 174,
1145 .freq = 5870, /* MHz */ 1145 .freq = 5870, /* MHz */
1146 .unk2 = 3913, 1146 .unk2 = 3913,
1147 RADIOREGS(0x71, 0x02, 0x4B, 0x00, 0xDB, 0x00, 0x04, 0x0A, 1147 RADIOREGS(0x71, 0x4B, 0x02, 0x00, 0xDB, 0x00, 0x04, 0x0A,
1148 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1148 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1149 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1149 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1150 PHYREGS(0x0930, 0x092C, 0x0928, 0x01BE, 0x01BF, 0x01BF), 1150 PHYREGS(0x0930, 0x092C, 0x0928, 0x01BE, 0x01BF, 0x01BF),
@@ -1152,7 +1152,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1152 { .channel = 176, 1152 { .channel = 176,
1153 .freq = 5880, /* MHz */ 1153 .freq = 5880, /* MHz */
1154 .unk2 = 3920, 1154 .unk2 = 3920,
1155 RADIOREGS(0x71, 0x02, 0x4C, 0x00, 0xD8, 0x00, 0x04, 0x0A, 1155 RADIOREGS(0x71, 0x4C, 0x02, 0x00, 0xD8, 0x00, 0x04, 0x0A,
1156 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1156 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1157 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1157 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1158 PHYREGS(0x0934, 0x0930, 0x092C, 0x01BD, 0x01BE, 0x01BF), 1158 PHYREGS(0x0934, 0x0930, 0x092C, 0x01BD, 0x01BE, 0x01BF),
@@ -1160,7 +1160,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1160 { .channel = 178, 1160 { .channel = 178,
1161 .freq = 5890, /* MHz */ 1161 .freq = 5890, /* MHz */
1162 .unk2 = 3927, 1162 .unk2 = 3927,
1163 RADIOREGS(0x71, 0x02, 0x4D, 0x00, 0xD6, 0x00, 0x04, 0x0A, 1163 RADIOREGS(0x71, 0x4D, 0x02, 0x00, 0xD6, 0x00, 0x04, 0x0A,
1164 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1164 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1165 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1165 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1166 PHYREGS(0x0938, 0x0934, 0x0930, 0x01BC, 0x01BD, 0x01BE), 1166 PHYREGS(0x0938, 0x0934, 0x0930, 0x01BC, 0x01BD, 0x01BE),
@@ -1168,7 +1168,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1168 { .channel = 180, 1168 { .channel = 180,
1169 .freq = 5900, /* MHz */ 1169 .freq = 5900, /* MHz */
1170 .unk2 = 3933, 1170 .unk2 = 3933,
1171 RADIOREGS(0x71, 0x02, 0x4E, 0x00, 0xD3, 0x00, 0x04, 0x0A, 1171 RADIOREGS(0x71, 0x4E, 0x02, 0x00, 0xD3, 0x00, 0x04, 0x0A,
1172 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1172 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1173 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1173 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1174 PHYREGS(0x093C, 0x0938, 0x0934, 0x01BC, 0x01BC, 0x01BD), 1174 PHYREGS(0x093C, 0x0938, 0x0934, 0x01BC, 0x01BC, 0x01BD),
@@ -1176,7 +1176,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1176 { .channel = 182, 1176 { .channel = 182,
1177 .freq = 5910, /* MHz */ 1177 .freq = 5910, /* MHz */
1178 .unk2 = 3940, 1178 .unk2 = 3940,
1179 RADIOREGS(0x71, 0x02, 0x4F, 0x00, 0xD6, 0x00, 0x04, 0x0A, 1179 RADIOREGS(0x71, 0x4F, 0x02, 0x00, 0xD6, 0x00, 0x04, 0x0A,
1180 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1180 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1181 0x80, 0x00, 0x00, 0x00, 0x00, 0x80), 1181 0x80, 0x00, 0x00, 0x00, 0x00, 0x80),
1182 PHYREGS(0x0940, 0x093C, 0x0938, 0x01BB, 0x01BC, 0x01BC), 1182 PHYREGS(0x0940, 0x093C, 0x0938, 0x01BB, 0x01BC, 0x01BC),
@@ -1184,7 +1184,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1184 { .channel = 1, 1184 { .channel = 1,
1185 .freq = 2412, /* MHz */ 1185 .freq = 2412, /* MHz */
1186 .unk2 = 3216, 1186 .unk2 = 3216,
1187 RADIOREGS(0x73, 0x09, 0x6C, 0x0F, 0x00, 0x01, 0x07, 0x15, 1187 RADIOREGS(0x73, 0x6C, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15,
1188 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0D, 0x0C, 1188 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0D, 0x0C,
1189 0x80, 0xFF, 0x88, 0x0D, 0x0C, 0x80), 1189 0x80, 0xFF, 0x88, 0x0D, 0x0C, 0x80),
1190 PHYREGS(0x03C9, 0x03C5, 0x03C1, 0x043A, 0x043F, 0x0443), 1190 PHYREGS(0x03C9, 0x03C5, 0x03C1, 0x043A, 0x043F, 0x0443),
@@ -1192,7 +1192,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1192 { .channel = 2, 1192 { .channel = 2,
1193 .freq = 2417, /* MHz */ 1193 .freq = 2417, /* MHz */
1194 .unk2 = 3223, 1194 .unk2 = 3223,
1195 RADIOREGS(0x73, 0x09, 0x71, 0x0F, 0x00, 0x01, 0x07, 0x15, 1195 RADIOREGS(0x73, 0x71, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15,
1196 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x0B, 1196 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x0B,
1197 0x80, 0xFF, 0x88, 0x0C, 0x0B, 0x80), 1197 0x80, 0xFF, 0x88, 0x0C, 0x0B, 0x80),
1198 PHYREGS(0x03CB, 0x03C7, 0x03C3, 0x0438, 0x043D, 0x0441), 1198 PHYREGS(0x03CB, 0x03C7, 0x03C3, 0x0438, 0x043D, 0x0441),
@@ -1200,7 +1200,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1200 { .channel = 3, 1200 { .channel = 3,
1201 .freq = 2422, /* MHz */ 1201 .freq = 2422, /* MHz */
1202 .unk2 = 3229, 1202 .unk2 = 3229,
1203 RADIOREGS(0x73, 0x09, 0x76, 0x0F, 0x00, 0x01, 0x07, 0x15, 1203 RADIOREGS(0x73, 0x76, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15,
1204 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x0A, 1204 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x0A,
1205 0x80, 0xFF, 0x88, 0x0C, 0x0A, 0x80), 1205 0x80, 0xFF, 0x88, 0x0C, 0x0A, 0x80),
1206 PHYREGS(0x03CD, 0x03C9, 0x03C5, 0x0436, 0x043A, 0x043F), 1206 PHYREGS(0x03CD, 0x03C9, 0x03C5, 0x0436, 0x043A, 0x043F),
@@ -1208,7 +1208,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1208 { .channel = 4, 1208 { .channel = 4,
1209 .freq = 2427, /* MHz */ 1209 .freq = 2427, /* MHz */
1210 .unk2 = 3236, 1210 .unk2 = 3236,
1211 RADIOREGS(0x73, 0x09, 0x7B, 0x0F, 0x00, 0x01, 0x07, 0x15, 1211 RADIOREGS(0x73, 0x7B, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15,
1212 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x0A, 1212 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x0A,
1213 0x80, 0xFF, 0x88, 0x0C, 0x0A, 0x80), 1213 0x80, 0xFF, 0x88, 0x0C, 0x0A, 0x80),
1214 PHYREGS(0x03CF, 0x03CB, 0x03C7, 0x0434, 0x0438, 0x043D), 1214 PHYREGS(0x03CF, 0x03CB, 0x03C7, 0x0434, 0x0438, 0x043D),
@@ -1216,7 +1216,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1216 { .channel = 5, 1216 { .channel = 5,
1217 .freq = 2432, /* MHz */ 1217 .freq = 2432, /* MHz */
1218 .unk2 = 3243, 1218 .unk2 = 3243,
1219 RADIOREGS(0x73, 0x09, 0x80, 0x0F, 0x00, 0x01, 0x07, 0x15, 1219 RADIOREGS(0x73, 0x80, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15,
1220 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x09, 1220 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0C, 0x09,
1221 0x80, 0xFF, 0x88, 0x0C, 0x09, 0x80), 1221 0x80, 0xFF, 0x88, 0x0C, 0x09, 0x80),
1222 PHYREGS(0x03D1, 0x03CD, 0x03C9, 0x0431, 0x0436, 0x043A), 1222 PHYREGS(0x03D1, 0x03CD, 0x03C9, 0x0431, 0x0436, 0x043A),
@@ -1224,7 +1224,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1224 { .channel = 6, 1224 { .channel = 6,
1225 .freq = 2437, /* MHz */ 1225 .freq = 2437, /* MHz */
1226 .unk2 = 3249, 1226 .unk2 = 3249,
1227 RADIOREGS(0x73, 0x09, 0x85, 0x0F, 0x00, 0x01, 0x07, 0x15, 1227 RADIOREGS(0x73, 0x85, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15,
1228 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0B, 0x08, 1228 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0B, 0x08,
1229 0x80, 0xFF, 0x88, 0x0B, 0x08, 0x80), 1229 0x80, 0xFF, 0x88, 0x0B, 0x08, 0x80),
1230 PHYREGS(0x03D3, 0x03CF, 0x03CB, 0x042F, 0x0434, 0x0438), 1230 PHYREGS(0x03D3, 0x03CF, 0x03CB, 0x042F, 0x0434, 0x0438),
@@ -1232,7 +1232,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1232 { .channel = 7, 1232 { .channel = 7,
1233 .freq = 2442, /* MHz */ 1233 .freq = 2442, /* MHz */
1234 .unk2 = 3256, 1234 .unk2 = 3256,
1235 RADIOREGS(0x73, 0x09, 0x8A, 0x0F, 0x00, 0x01, 0x07, 0x15, 1235 RADIOREGS(0x73, 0x8A, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15,
1236 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0A, 0x07, 1236 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0A, 0x07,
1237 0x80, 0xFF, 0x88, 0x0A, 0x07, 0x80), 1237 0x80, 0xFF, 0x88, 0x0A, 0x07, 0x80),
1238 PHYREGS(0x03D5, 0x03D1, 0x03CD, 0x042D, 0x0431, 0x0436), 1238 PHYREGS(0x03D5, 0x03D1, 0x03CD, 0x042D, 0x0431, 0x0436),
@@ -1240,7 +1240,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1240 { .channel = 8, 1240 { .channel = 8,
1241 .freq = 2447, /* MHz */ 1241 .freq = 2447, /* MHz */
1242 .unk2 = 3263, 1242 .unk2 = 3263,
1243 RADIOREGS(0x73, 0x09, 0x8F, 0x0F, 0x00, 0x01, 0x07, 0x15, 1243 RADIOREGS(0x73, 0x8F, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15,
1244 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0A, 0x06, 1244 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x0A, 0x06,
1245 0x80, 0xFF, 0x88, 0x0A, 0x06, 0x80), 1245 0x80, 0xFF, 0x88, 0x0A, 0x06, 0x80),
1246 PHYREGS(0x03D7, 0x03D3, 0x03CF, 0x042B, 0x042F, 0x0434), 1246 PHYREGS(0x03D7, 0x03D3, 0x03CF, 0x042B, 0x042F, 0x0434),
@@ -1248,7 +1248,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1248 { .channel = 9, 1248 { .channel = 9,
1249 .freq = 2452, /* MHz */ 1249 .freq = 2452, /* MHz */
1250 .unk2 = 3269, 1250 .unk2 = 3269,
1251 RADIOREGS(0x73, 0x09, 0x94, 0x0F, 0x00, 0x01, 0x07, 0x15, 1251 RADIOREGS(0x73, 0x94, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15,
1252 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x09, 0x06, 1252 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x09, 0x06,
1253 0x80, 0xFF, 0x88, 0x09, 0x06, 0x80), 1253 0x80, 0xFF, 0x88, 0x09, 0x06, 0x80),
1254 PHYREGS(0x03D9, 0x03D5, 0x03D1, 0x0429, 0x042D, 0x0431), 1254 PHYREGS(0x03D9, 0x03D5, 0x03D1, 0x0429, 0x042D, 0x0431),
@@ -1256,7 +1256,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1256 { .channel = 10, 1256 { .channel = 10,
1257 .freq = 2457, /* MHz */ 1257 .freq = 2457, /* MHz */
1258 .unk2 = 3276, 1258 .unk2 = 3276,
1259 RADIOREGS(0x73, 0x09, 0x99, 0x0F, 0x00, 0x01, 0x07, 0x15, 1259 RADIOREGS(0x73, 0x99, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15,
1260 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x08, 0x05, 1260 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x08, 0x05,
1261 0x80, 0xFF, 0x88, 0x08, 0x05, 0x80), 1261 0x80, 0xFF, 0x88, 0x08, 0x05, 0x80),
1262 PHYREGS(0x03DB, 0x03D7, 0x03D3, 0x0427, 0x042B, 0x042F), 1262 PHYREGS(0x03DB, 0x03D7, 0x03D3, 0x0427, 0x042B, 0x042F),
@@ -1264,7 +1264,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1264 { .channel = 11, 1264 { .channel = 11,
1265 .freq = 2462, /* MHz */ 1265 .freq = 2462, /* MHz */
1266 .unk2 = 3283, 1266 .unk2 = 3283,
1267 RADIOREGS(0x73, 0x09, 0x9E, 0x0F, 0x00, 0x01, 0x07, 0x15, 1267 RADIOREGS(0x73, 0x9E, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15,
1268 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x08, 0x04, 1268 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x08, 0x04,
1269 0x80, 0xFF, 0x88, 0x08, 0x04, 0x80), 1269 0x80, 0xFF, 0x88, 0x08, 0x04, 0x80),
1270 PHYREGS(0x03DD, 0x03D9, 0x03D5, 0x0424, 0x0429, 0x042D), 1270 PHYREGS(0x03DD, 0x03D9, 0x03D5, 0x0424, 0x0429, 0x042D),
@@ -1272,7 +1272,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1272 { .channel = 12, 1272 { .channel = 12,
1273 .freq = 2467, /* MHz */ 1273 .freq = 2467, /* MHz */
1274 .unk2 = 3289, 1274 .unk2 = 3289,
1275 RADIOREGS(0x73, 0x09, 0xA3, 0x0F, 0x00, 0x01, 0x07, 0x15, 1275 RADIOREGS(0x73, 0xA3, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15,
1276 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x08, 0x03, 1276 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x08, 0x03,
1277 0x80, 0xFF, 0x88, 0x08, 0x03, 0x80), 1277 0x80, 0xFF, 0x88, 0x08, 0x03, 0x80),
1278 PHYREGS(0x03DF, 0x03DB, 0x03D7, 0x0422, 0x0427, 0x042B), 1278 PHYREGS(0x03DF, 0x03DB, 0x03D7, 0x0422, 0x0427, 0x042B),
@@ -1280,7 +1280,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1280 { .channel = 13, 1280 { .channel = 13,
1281 .freq = 2472, /* MHz */ 1281 .freq = 2472, /* MHz */
1282 .unk2 = 3296, 1282 .unk2 = 3296,
1283 RADIOREGS(0x73, 0x09, 0xA8, 0x0F, 0x00, 0x01, 0x07, 0x15, 1283 RADIOREGS(0x73, 0xA8, 0x09, 0x0F, 0x00, 0x01, 0x07, 0x15,
1284 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x07, 0x03, 1284 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x07, 0x03,
1285 0x80, 0xFF, 0x88, 0x07, 0x03, 0x80), 1285 0x80, 0xFF, 0x88, 0x07, 0x03, 0x80),
1286 PHYREGS(0x03E1, 0x03DD, 0x03D9, 0x0420, 0x0424, 0x0429), 1286 PHYREGS(0x03E1, 0x03DD, 0x03D9, 0x0420, 0x0424, 0x0429),
@@ -1288,7 +1288,7 @@ static const struct b43_nphy_channeltab_entry_rev2 b43_nphy_channeltab_rev2[] =
1288 { .channel = 14, 1288 { .channel = 14,
1289 .freq = 2484, /* MHz */ 1289 .freq = 2484, /* MHz */
1290 .unk2 = 3312, 1290 .unk2 = 3312,
1291 RADIOREGS(0x73, 0x09, 0xB4, 0x0F, 0xFF, 0x01, 0x07, 0x15, 1291 RADIOREGS(0x73, 0xB4, 0x09, 0x0F, 0xFF, 0x01, 0x07, 0x15,
1292 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x07, 0x01, 1292 0x01, 0x8F, 0xFF, 0xFF, 0xFF, 0x88, 0x07, 0x01,
1293 0x80, 0xFF, 0x88, 0x07, 0x01, 0x80), 1293 0x80, 0xFF, 0x88, 0x07, 0x01, 0x80),
1294 PHYREGS(0x03E6, 0x03E2, 0x03DE, 0x041B, 0x041F, 0x0424), 1294 PHYREGS(0x03E6, 0x03E2, 0x03DE, 0x041B, 0x041F, 0x0424),
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index 3100a72b9b44..fb3e3713bae4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -278,8 +278,6 @@ struct iwl_cfg iwl1000_bgn_cfg = {
278 .fw_name_pre = IWL1000_FW_PRE, 278 .fw_name_pre = IWL1000_FW_PRE,
279 .ucode_api_max = IWL1000_UCODE_API_MAX, 279 .ucode_api_max = IWL1000_UCODE_API_MAX,
280 .ucode_api_min = IWL1000_UCODE_API_MIN, 280 .ucode_api_min = IWL1000_UCODE_API_MIN,
281 .valid_tx_ant = ANT_A,
282 .valid_rx_ant = ANT_AB,
283 .eeprom_ver = EEPROM_1000_EEPROM_VERSION, 281 .eeprom_ver = EEPROM_1000_EEPROM_VERSION,
284 .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION, 282 .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION,
285 .ops = &iwl1000_ops, 283 .ops = &iwl1000_ops,
@@ -294,8 +292,6 @@ struct iwl_cfg iwl1000_bg_cfg = {
294 .fw_name_pre = IWL1000_FW_PRE, 292 .fw_name_pre = IWL1000_FW_PRE,
295 .ucode_api_max = IWL1000_UCODE_API_MAX, 293 .ucode_api_max = IWL1000_UCODE_API_MAX,
296 .ucode_api_min = IWL1000_UCODE_API_MIN, 294 .ucode_api_min = IWL1000_UCODE_API_MIN,
297 .valid_tx_ant = ANT_A,
298 .valid_rx_ant = ANT_AB,
299 .eeprom_ver = EEPROM_1000_EEPROM_VERSION, 295 .eeprom_ver = EEPROM_1000_EEPROM_VERSION,
300 .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION, 296 .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION,
301 .ops = &iwl1000_ops, 297 .ops = &iwl1000_ops,
@@ -305,12 +301,10 @@ struct iwl_cfg iwl1000_bg_cfg = {
305}; 301};
306 302
307struct iwl_cfg iwl100_bgn_cfg = { 303struct iwl_cfg iwl100_bgn_cfg = {
308 .name = "Intel(R) 100 Series 1x1 BGN", 304 .name = "Intel(R) Centrino(R) Wireless-N 100 BGN",
309 .fw_name_pre = IWL100_FW_PRE, 305 .fw_name_pre = IWL100_FW_PRE,
310 .ucode_api_max = IWL100_UCODE_API_MAX, 306 .ucode_api_max = IWL100_UCODE_API_MAX,
311 .ucode_api_min = IWL100_UCODE_API_MIN, 307 .ucode_api_min = IWL100_UCODE_API_MIN,
312 .valid_tx_ant = ANT_A,
313 .valid_rx_ant = ANT_A,
314 .eeprom_ver = EEPROM_1000_EEPROM_VERSION, 308 .eeprom_ver = EEPROM_1000_EEPROM_VERSION,
315 .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION, 309 .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION,
316 .ops = &iwl1000_ops, 310 .ops = &iwl1000_ops,
@@ -321,12 +315,10 @@ struct iwl_cfg iwl100_bgn_cfg = {
321}; 315};
322 316
323struct iwl_cfg iwl100_bg_cfg = { 317struct iwl_cfg iwl100_bg_cfg = {
324 .name = "Intel(R) 100 Series 1x1 BG", 318 .name = "Intel(R) Centrino(R) Wireless-N 100 BG",
325 .fw_name_pre = IWL100_FW_PRE, 319 .fw_name_pre = IWL100_FW_PRE,
326 .ucode_api_max = IWL100_UCODE_API_MAX, 320 .ucode_api_max = IWL100_UCODE_API_MAX,
327 .ucode_api_min = IWL100_UCODE_API_MIN, 321 .ucode_api_min = IWL100_UCODE_API_MIN,
328 .valid_tx_ant = ANT_A,
329 .valid_rx_ant = ANT_A,
330 .eeprom_ver = EEPROM_1000_EEPROM_VERSION, 322 .eeprom_ver = EEPROM_1000_EEPROM_VERSION,
331 .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION, 323 .eeprom_calib_ver = EEPROM_1000_TX_POWER_VERSION,
332 .ops = &iwl1000_ops, 324 .ops = &iwl1000_ops,
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 3ee0f7c035cf..cf74edb82a70 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -527,8 +527,6 @@ struct iwl_cfg iwl5300_agn_cfg = {
527 .fw_name_pre = IWL5000_FW_PRE, 527 .fw_name_pre = IWL5000_FW_PRE,
528 .ucode_api_max = IWL5000_UCODE_API_MAX, 528 .ucode_api_max = IWL5000_UCODE_API_MAX,
529 .ucode_api_min = IWL5000_UCODE_API_MIN, 529 .ucode_api_min = IWL5000_UCODE_API_MIN,
530 .valid_tx_ant = ANT_ABC,
531 .valid_rx_ant = ANT_ABC,
532 .eeprom_ver = EEPROM_5000_EEPROM_VERSION, 530 .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
533 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 531 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
534 .ops = &iwl5000_ops, 532 .ops = &iwl5000_ops,
@@ -543,8 +541,8 @@ struct iwl_cfg iwl5100_bgn_cfg = {
543 .fw_name_pre = IWL5000_FW_PRE, 541 .fw_name_pre = IWL5000_FW_PRE,
544 .ucode_api_max = IWL5000_UCODE_API_MAX, 542 .ucode_api_max = IWL5000_UCODE_API_MAX,
545 .ucode_api_min = IWL5000_UCODE_API_MIN, 543 .ucode_api_min = IWL5000_UCODE_API_MIN,
546 .valid_tx_ant = ANT_B, 544 .valid_tx_ant = ANT_B, /* .cfg overwrite */
547 .valid_rx_ant = ANT_AB, 545 .valid_rx_ant = ANT_AB, /* .cfg overwrite */
548 .eeprom_ver = EEPROM_5000_EEPROM_VERSION, 546 .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
549 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 547 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
550 .ops = &iwl5000_ops, 548 .ops = &iwl5000_ops,
@@ -559,8 +557,8 @@ struct iwl_cfg iwl5100_abg_cfg = {
559 .fw_name_pre = IWL5000_FW_PRE, 557 .fw_name_pre = IWL5000_FW_PRE,
560 .ucode_api_max = IWL5000_UCODE_API_MAX, 558 .ucode_api_max = IWL5000_UCODE_API_MAX,
561 .ucode_api_min = IWL5000_UCODE_API_MIN, 559 .ucode_api_min = IWL5000_UCODE_API_MIN,
562 .valid_tx_ant = ANT_B, 560 .valid_tx_ant = ANT_B, /* .cfg overwrite */
563 .valid_rx_ant = ANT_AB, 561 .valid_rx_ant = ANT_AB, /* .cfg overwrite */
564 .eeprom_ver = EEPROM_5000_EEPROM_VERSION, 562 .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
565 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 563 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
566 .ops = &iwl5000_ops, 564 .ops = &iwl5000_ops,
@@ -574,8 +572,8 @@ struct iwl_cfg iwl5100_agn_cfg = {
574 .fw_name_pre = IWL5000_FW_PRE, 572 .fw_name_pre = IWL5000_FW_PRE,
575 .ucode_api_max = IWL5000_UCODE_API_MAX, 573 .ucode_api_max = IWL5000_UCODE_API_MAX,
576 .ucode_api_min = IWL5000_UCODE_API_MIN, 574 .ucode_api_min = IWL5000_UCODE_API_MIN,
577 .valid_tx_ant = ANT_B, 575 .valid_tx_ant = ANT_B, /* .cfg overwrite */
578 .valid_rx_ant = ANT_AB, 576 .valid_rx_ant = ANT_AB, /* .cfg overwrite */
579 .eeprom_ver = EEPROM_5000_EEPROM_VERSION, 577 .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
580 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 578 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
581 .ops = &iwl5000_ops, 579 .ops = &iwl5000_ops,
@@ -590,8 +588,6 @@ struct iwl_cfg iwl5350_agn_cfg = {
590 .fw_name_pre = IWL5000_FW_PRE, 588 .fw_name_pre = IWL5000_FW_PRE,
591 .ucode_api_max = IWL5000_UCODE_API_MAX, 589 .ucode_api_max = IWL5000_UCODE_API_MAX,
592 .ucode_api_min = IWL5000_UCODE_API_MIN, 590 .ucode_api_min = IWL5000_UCODE_API_MIN,
593 .valid_tx_ant = ANT_ABC,
594 .valid_rx_ant = ANT_ABC,
595 .eeprom_ver = EEPROM_5050_EEPROM_VERSION, 591 .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
596 .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION, 592 .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
597 .ops = &iwl5000_ops, 593 .ops = &iwl5000_ops,
@@ -606,8 +602,6 @@ struct iwl_cfg iwl5150_agn_cfg = {
606 .fw_name_pre = IWL5150_FW_PRE, 602 .fw_name_pre = IWL5150_FW_PRE,
607 .ucode_api_max = IWL5150_UCODE_API_MAX, 603 .ucode_api_max = IWL5150_UCODE_API_MAX,
608 .ucode_api_min = IWL5150_UCODE_API_MIN, 604 .ucode_api_min = IWL5150_UCODE_API_MIN,
609 .valid_tx_ant = ANT_A,
610 .valid_rx_ant = ANT_AB,
611 .eeprom_ver = EEPROM_5050_EEPROM_VERSION, 605 .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
612 .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION, 606 .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
613 .ops = &iwl5150_ops, 607 .ops = &iwl5150_ops,
@@ -623,8 +617,6 @@ struct iwl_cfg iwl5150_abg_cfg = {
623 .fw_name_pre = IWL5150_FW_PRE, 617 .fw_name_pre = IWL5150_FW_PRE,
624 .ucode_api_max = IWL5150_UCODE_API_MAX, 618 .ucode_api_max = IWL5150_UCODE_API_MAX,
625 .ucode_api_min = IWL5150_UCODE_API_MIN, 619 .ucode_api_min = IWL5150_UCODE_API_MIN,
626 .valid_tx_ant = ANT_A,
627 .valid_rx_ant = ANT_AB,
628 .eeprom_ver = EEPROM_5050_EEPROM_VERSION, 620 .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
629 .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION, 621 .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
630 .ops = &iwl5150_ops, 622 .ops = &iwl5150_ops,
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 93e3fe92f389..ec41f2725292 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -553,12 +553,10 @@ static struct iwl_bt_params iwl6000_bt_params = {
553}; 553};
554 554
555struct iwl_cfg iwl6000g2a_2agn_cfg = { 555struct iwl_cfg iwl6000g2a_2agn_cfg = {
556 .name = "6000 Series 2x2 AGN Gen2a", 556 .name = "Intel(R) Centrino(R) Advanced-N 6205 AGN",
557 .fw_name_pre = IWL6000G2A_FW_PRE, 557 .fw_name_pre = IWL6000G2A_FW_PRE,
558 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 558 .ucode_api_max = IWL6000G2_UCODE_API_MAX,
559 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 559 .ucode_api_min = IWL6000G2_UCODE_API_MIN,
560 .valid_tx_ant = ANT_AB,
561 .valid_rx_ant = ANT_AB,
562 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 560 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
563 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 561 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
564 .ops = &iwl6000_ops, 562 .ops = &iwl6000_ops,
@@ -571,12 +569,10 @@ struct iwl_cfg iwl6000g2a_2agn_cfg = {
571}; 569};
572 570
573struct iwl_cfg iwl6000g2a_2abg_cfg = { 571struct iwl_cfg iwl6000g2a_2abg_cfg = {
574 .name = "6000 Series 2x2 ABG Gen2a", 572 .name = "Intel(R) Centrino(R) Advanced-N 6205 ABG",
575 .fw_name_pre = IWL6000G2A_FW_PRE, 573 .fw_name_pre = IWL6000G2A_FW_PRE,
576 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 574 .ucode_api_max = IWL6000G2_UCODE_API_MAX,
577 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 575 .ucode_api_min = IWL6000G2_UCODE_API_MIN,
578 .valid_tx_ant = ANT_AB,
579 .valid_rx_ant = ANT_AB,
580 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 576 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
581 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 577 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
582 .ops = &iwl6000_ops, 578 .ops = &iwl6000_ops,
@@ -588,12 +584,10 @@ struct iwl_cfg iwl6000g2a_2abg_cfg = {
588}; 584};
589 585
590struct iwl_cfg iwl6000g2a_2bg_cfg = { 586struct iwl_cfg iwl6000g2a_2bg_cfg = {
591 .name = "6000 Series 2x2 BG Gen2a", 587 .name = "Intel(R) Centrino(R) Advanced-N 6205 BG",
592 .fw_name_pre = IWL6000G2A_FW_PRE, 588 .fw_name_pre = IWL6000G2A_FW_PRE,
593 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 589 .ucode_api_max = IWL6000G2_UCODE_API_MAX,
594 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 590 .ucode_api_min = IWL6000G2_UCODE_API_MIN,
595 .valid_tx_ant = ANT_AB,
596 .valid_rx_ant = ANT_AB,
597 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 591 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
598 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 592 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
599 .ops = &iwl6000_ops, 593 .ops = &iwl6000_ops,
@@ -605,12 +599,10 @@ struct iwl_cfg iwl6000g2a_2bg_cfg = {
605}; 599};
606 600
607struct iwl_cfg iwl6000g2b_2agn_cfg = { 601struct iwl_cfg iwl6000g2b_2agn_cfg = {
608 .name = "6000 Series 2x2 AGN Gen2b", 602 .name = "Intel(R) Centrino(R) Advanced-N 6230 AGN",
609 .fw_name_pre = IWL6000G2B_FW_PRE, 603 .fw_name_pre = IWL6000G2B_FW_PRE,
610 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 604 .ucode_api_max = IWL6000G2_UCODE_API_MAX,
611 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 605 .ucode_api_min = IWL6000G2_UCODE_API_MIN,
612 .valid_tx_ant = ANT_AB,
613 .valid_rx_ant = ANT_AB,
614 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 606 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
615 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 607 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
616 .ops = &iwl6000g2b_ops, 608 .ops = &iwl6000g2b_ops,
@@ -627,12 +619,10 @@ struct iwl_cfg iwl6000g2b_2agn_cfg = {
627}; 619};
628 620
629struct iwl_cfg iwl6000g2b_2abg_cfg = { 621struct iwl_cfg iwl6000g2b_2abg_cfg = {
630 .name = "6000 Series 2x2 ABG Gen2b", 622 .name = "Intel(R) Centrino(R) Advanced-N 6230 ABG",
631 .fw_name_pre = IWL6000G2B_FW_PRE, 623 .fw_name_pre = IWL6000G2B_FW_PRE,
632 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 624 .ucode_api_max = IWL6000G2_UCODE_API_MAX,
633 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 625 .ucode_api_min = IWL6000G2_UCODE_API_MIN,
634 .valid_tx_ant = ANT_AB,
635 .valid_rx_ant = ANT_AB,
636 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 626 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
637 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 627 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
638 .ops = &iwl6000g2b_ops, 628 .ops = &iwl6000g2b_ops,
@@ -648,12 +638,10 @@ struct iwl_cfg iwl6000g2b_2abg_cfg = {
648}; 638};
649 639
650struct iwl_cfg iwl6000g2b_2bgn_cfg = { 640struct iwl_cfg iwl6000g2b_2bgn_cfg = {
651 .name = "6000 Series 2x2 BGN Gen2b", 641 .name = "Intel(R) Centrino(R) Advanced-N 6230 BGN",
652 .fw_name_pre = IWL6000G2B_FW_PRE, 642 .fw_name_pre = IWL6000G2B_FW_PRE,
653 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 643 .ucode_api_max = IWL6000G2_UCODE_API_MAX,
654 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 644 .ucode_api_min = IWL6000G2_UCODE_API_MIN,
655 .valid_tx_ant = ANT_AB,
656 .valid_rx_ant = ANT_AB,
657 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 645 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
658 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 646 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
659 .ops = &iwl6000g2b_ops, 647 .ops = &iwl6000g2b_ops,
@@ -670,12 +658,10 @@ struct iwl_cfg iwl6000g2b_2bgn_cfg = {
670}; 658};
671 659
672struct iwl_cfg iwl6000g2b_2bg_cfg = { 660struct iwl_cfg iwl6000g2b_2bg_cfg = {
673 .name = "6000 Series 2x2 BG Gen2b", 661 .name = "Intel(R) Centrino(R) Advanced-N 6230 BG",
674 .fw_name_pre = IWL6000G2B_FW_PRE, 662 .fw_name_pre = IWL6000G2B_FW_PRE,
675 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 663 .ucode_api_max = IWL6000G2_UCODE_API_MAX,
676 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 664 .ucode_api_min = IWL6000G2_UCODE_API_MIN,
677 .valid_tx_ant = ANT_AB,
678 .valid_rx_ant = ANT_AB,
679 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 665 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
680 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 666 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
681 .ops = &iwl6000g2b_ops, 667 .ops = &iwl6000g2b_ops,
@@ -691,12 +677,10 @@ struct iwl_cfg iwl6000g2b_2bg_cfg = {
691}; 677};
692 678
693struct iwl_cfg iwl6000g2b_bgn_cfg = { 679struct iwl_cfg iwl6000g2b_bgn_cfg = {
694 .name = "6000 Series 1x2 BGN Gen2b", 680 .name = "Intel(R) Centrino(R) Wireless-N 1030 BGN",
695 .fw_name_pre = IWL6000G2B_FW_PRE, 681 .fw_name_pre = IWL6000G2B_FW_PRE,
696 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 682 .ucode_api_max = IWL6000G2_UCODE_API_MAX,
697 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 683 .ucode_api_min = IWL6000G2_UCODE_API_MIN,
698 .valid_tx_ant = ANT_A,
699 .valid_rx_ant = ANT_AB,
700 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 684 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
701 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 685 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
702 .ops = &iwl6000g2b_ops, 686 .ops = &iwl6000g2b_ops,
@@ -713,12 +697,10 @@ struct iwl_cfg iwl6000g2b_bgn_cfg = {
713}; 697};
714 698
715struct iwl_cfg iwl6000g2b_bg_cfg = { 699struct iwl_cfg iwl6000g2b_bg_cfg = {
716 .name = "6000 Series 1x2 BG Gen2b", 700 .name = "Intel(R) Centrino(R) Wireless-N 1030 BG",
717 .fw_name_pre = IWL6000G2B_FW_PRE, 701 .fw_name_pre = IWL6000G2B_FW_PRE,
718 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 702 .ucode_api_max = IWL6000G2_UCODE_API_MAX,
719 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 703 .ucode_api_min = IWL6000G2_UCODE_API_MIN,
720 .valid_tx_ant = ANT_A,
721 .valid_rx_ant = ANT_AB,
722 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 704 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
723 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 705 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
724 .ops = &iwl6000g2b_ops, 706 .ops = &iwl6000g2b_ops,
@@ -741,8 +723,8 @@ struct iwl_cfg iwl6000i_2agn_cfg = {
741 .fw_name_pre = IWL6000_FW_PRE, 723 .fw_name_pre = IWL6000_FW_PRE,
742 .ucode_api_max = IWL6000_UCODE_API_MAX, 724 .ucode_api_max = IWL6000_UCODE_API_MAX,
743 .ucode_api_min = IWL6000_UCODE_API_MIN, 725 .ucode_api_min = IWL6000_UCODE_API_MIN,
744 .valid_tx_ant = ANT_BC, 726 .valid_tx_ant = ANT_BC, /* .cfg overwrite */
745 .valid_rx_ant = ANT_BC, 727 .valid_rx_ant = ANT_BC, /* .cfg overwrite */
746 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 728 .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
747 .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION, 729 .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
748 .ops = &iwl6000_ops, 730 .ops = &iwl6000_ops,
@@ -758,8 +740,8 @@ struct iwl_cfg iwl6000i_2abg_cfg = {
758 .fw_name_pre = IWL6000_FW_PRE, 740 .fw_name_pre = IWL6000_FW_PRE,
759 .ucode_api_max = IWL6000_UCODE_API_MAX, 741 .ucode_api_max = IWL6000_UCODE_API_MAX,
760 .ucode_api_min = IWL6000_UCODE_API_MIN, 742 .ucode_api_min = IWL6000_UCODE_API_MIN,
761 .valid_tx_ant = ANT_BC, 743 .valid_tx_ant = ANT_BC, /* .cfg overwrite */
762 .valid_rx_ant = ANT_BC, 744 .valid_rx_ant = ANT_BC, /* .cfg overwrite */
763 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 745 .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
764 .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION, 746 .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
765 .ops = &iwl6000_ops, 747 .ops = &iwl6000_ops,
@@ -774,8 +756,8 @@ struct iwl_cfg iwl6000i_2bg_cfg = {
774 .fw_name_pre = IWL6000_FW_PRE, 756 .fw_name_pre = IWL6000_FW_PRE,
775 .ucode_api_max = IWL6000_UCODE_API_MAX, 757 .ucode_api_max = IWL6000_UCODE_API_MAX,
776 .ucode_api_min = IWL6000_UCODE_API_MIN, 758 .ucode_api_min = IWL6000_UCODE_API_MIN,
777 .valid_tx_ant = ANT_BC, 759 .valid_tx_ant = ANT_BC, /* .cfg overwrite */
778 .valid_rx_ant = ANT_BC, 760 .valid_rx_ant = ANT_BC, /* .cfg overwrite */
779 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 761 .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
780 .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION, 762 .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
781 .ops = &iwl6000_ops, 763 .ops = &iwl6000_ops,
@@ -790,8 +772,6 @@ struct iwl_cfg iwl6050_2agn_cfg = {
790 .fw_name_pre = IWL6050_FW_PRE, 772 .fw_name_pre = IWL6050_FW_PRE,
791 .ucode_api_max = IWL6050_UCODE_API_MAX, 773 .ucode_api_max = IWL6050_UCODE_API_MAX,
792 .ucode_api_min = IWL6050_UCODE_API_MIN, 774 .ucode_api_min = IWL6050_UCODE_API_MIN,
793 .valid_tx_ant = ANT_AB,
794 .valid_rx_ant = ANT_AB,
795 .ops = &iwl6050_ops, 775 .ops = &iwl6050_ops,
796 .eeprom_ver = EEPROM_6050_EEPROM_VERSION, 776 .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
797 .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION, 777 .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,
@@ -803,12 +783,10 @@ struct iwl_cfg iwl6050_2agn_cfg = {
803}; 783};
804 784
805struct iwl_cfg iwl6050g2_bgn_cfg = { 785struct iwl_cfg iwl6050g2_bgn_cfg = {
806 .name = "6050 Series 1x2 BGN Gen2", 786 .name = "Intel(R) Centrino(R) Wireless-N + WiMAX 6150 BGN",
807 .fw_name_pre = IWL6050_FW_PRE, 787 .fw_name_pre = IWL6050_FW_PRE,
808 .ucode_api_max = IWL6050_UCODE_API_MAX, 788 .ucode_api_max = IWL6050_UCODE_API_MAX,
809 .ucode_api_min = IWL6050_UCODE_API_MIN, 789 .ucode_api_min = IWL6050_UCODE_API_MIN,
810 .valid_tx_ant = ANT_A,
811 .valid_rx_ant = ANT_AB,
812 .eeprom_ver = EEPROM_6050G2_EEPROM_VERSION, 790 .eeprom_ver = EEPROM_6050G2_EEPROM_VERSION,
813 .eeprom_calib_ver = EEPROM_6050G2_TX_POWER_VERSION, 791 .eeprom_calib_ver = EEPROM_6050G2_TX_POWER_VERSION,
814 .ops = &iwl6050g2_ops, 792 .ops = &iwl6050g2_ops,
@@ -824,8 +802,6 @@ struct iwl_cfg iwl6050_2abg_cfg = {
824 .fw_name_pre = IWL6050_FW_PRE, 802 .fw_name_pre = IWL6050_FW_PRE,
825 .ucode_api_max = IWL6050_UCODE_API_MAX, 803 .ucode_api_max = IWL6050_UCODE_API_MAX,
826 .ucode_api_min = IWL6050_UCODE_API_MIN, 804 .ucode_api_min = IWL6050_UCODE_API_MIN,
827 .valid_tx_ant = ANT_AB,
828 .valid_rx_ant = ANT_AB,
829 .eeprom_ver = EEPROM_6050_EEPROM_VERSION, 805 .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
830 .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION, 806 .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION,
831 .ops = &iwl6050_ops, 807 .ops = &iwl6050_ops,
@@ -840,8 +816,6 @@ struct iwl_cfg iwl6000_3agn_cfg = {
840 .fw_name_pre = IWL6000_FW_PRE, 816 .fw_name_pre = IWL6000_FW_PRE,
841 .ucode_api_max = IWL6000_UCODE_API_MAX, 817 .ucode_api_max = IWL6000_UCODE_API_MAX,
842 .ucode_api_min = IWL6000_UCODE_API_MIN, 818 .ucode_api_min = IWL6000_UCODE_API_MIN,
843 .valid_tx_ant = ANT_ABC,
844 .valid_rx_ant = ANT_ABC,
845 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 819 .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
846 .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION, 820 .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
847 .ops = &iwl6000_ops, 821 .ops = &iwl6000_ops,
@@ -853,12 +827,10 @@ struct iwl_cfg iwl6000_3agn_cfg = {
853}; 827};
854 828
855struct iwl_cfg iwl130_bgn_cfg = { 829struct iwl_cfg iwl130_bgn_cfg = {
856 .name = "Intel(R) 130 Series 1x1 BGN", 830 .name = "Intel(R) Centrino(R) Wireless-N 130 BGN",
857 .fw_name_pre = IWL6000G2B_FW_PRE, 831 .fw_name_pre = IWL6000G2B_FW_PRE,
858 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 832 .ucode_api_max = IWL6000G2_UCODE_API_MAX,
859 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 833 .ucode_api_min = IWL6000G2_UCODE_API_MIN,
860 .valid_tx_ant = ANT_A,
861 .valid_rx_ant = ANT_A,
862 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 834 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
863 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 835 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
864 .ops = &iwl6000g2b_ops, 836 .ops = &iwl6000g2b_ops,
@@ -874,12 +846,10 @@ struct iwl_cfg iwl130_bgn_cfg = {
874}; 846};
875 847
876struct iwl_cfg iwl130_bg_cfg = { 848struct iwl_cfg iwl130_bg_cfg = {
877 .name = "Intel(R) 130 Series 1x2 BG", 849 .name = "Intel(R) Centrino(R) Wireless-N 130 BG",
878 .fw_name_pre = IWL6000G2B_FW_PRE, 850 .fw_name_pre = IWL6000G2B_FW_PRE,
879 .ucode_api_max = IWL6000G2_UCODE_API_MAX, 851 .ucode_api_max = IWL6000G2_UCODE_API_MAX,
880 .ucode_api_min = IWL6000G2_UCODE_API_MIN, 852 .ucode_api_min = IWL6000G2_UCODE_API_MIN,
881 .valid_tx_ant = ANT_A,
882 .valid_rx_ant = ANT_A,
883 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION, 853 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
884 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, 854 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
885 .ops = &iwl6000g2b_ops, 855 .ops = &iwl6000g2b_ops,
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
index 8a4d3acb9b79..dbada761624d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
@@ -251,6 +251,7 @@ err:
251int iwl_eeprom_check_sku(struct iwl_priv *priv) 251int iwl_eeprom_check_sku(struct iwl_priv *priv)
252{ 252{
253 u16 eeprom_sku; 253 u16 eeprom_sku;
254 u16 radio_cfg;
254 255
255 eeprom_sku = iwl_eeprom_query16(priv, EEPROM_SKU_CAP); 256 eeprom_sku = iwl_eeprom_query16(priv, EEPROM_SKU_CAP);
256 257
@@ -266,6 +267,25 @@ int iwl_eeprom_check_sku(struct iwl_priv *priv)
266 267
267 IWL_INFO(priv, "Device SKU: 0X%x\n", priv->cfg->sku); 268 IWL_INFO(priv, "Device SKU: 0X%x\n", priv->cfg->sku);
268 269
270 if (!priv->cfg->valid_tx_ant && !priv->cfg->valid_rx_ant) {
271 /* not using .cfg overwrite */
272 radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
273 priv->cfg->valid_tx_ant = EEPROM_RF_CFG_TX_ANT_MSK(radio_cfg);
274 priv->cfg->valid_rx_ant = EEPROM_RF_CFG_TX_ANT_MSK(radio_cfg);
275 if (!priv->cfg->valid_tx_ant || !priv->cfg->valid_rx_ant) {
276 IWL_ERR(priv, "Invalid chain (0X%x, 0X%x)\n",
277 priv->cfg->valid_tx_ant,
278 priv->cfg->valid_rx_ant);
279 return -EINVAL;
280 }
281 IWL_INFO(priv, "Valid Tx ant: 0X%x, Valid Rx ant: 0X%x\n",
282 priv->cfg->valid_tx_ant, priv->cfg->valid_rx_ant);
283 }
284 /*
285 * for some special cases,
286 * EEPROM did not reflect the correct antenna setting
287 * so overwrite the valid tx/rx antenna from .cfg
288 */
269 return 0; 289 return 0;
270} 290}
271 291
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index f8fe5f44e19f..407f0bb8422a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -1778,7 +1778,7 @@ static const __le32 iwlagn_def_3w_lookup[12] = {
1778 cpu_to_le32(0xc0004000), 1778 cpu_to_le32(0xc0004000),
1779 cpu_to_le32(0x00004000), 1779 cpu_to_le32(0x00004000),
1780 cpu_to_le32(0xf0005000), 1780 cpu_to_le32(0xf0005000),
1781 cpu_to_le32(0xf0004000), 1781 cpu_to_le32(0xf0005000),
1782}; 1782};
1783 1783
1784static const __le32 iwlagn_concurrent_lookup[12] = { 1784static const __le32 iwlagn_concurrent_lookup[12] = {
@@ -1814,6 +1814,7 @@ void iwlagn_send_advance_bt_config(struct iwl_priv *priv)
1814 bt_cmd.prio_boost = 0; 1814 bt_cmd.prio_boost = 0;
1815 bt_cmd.kill_ack_mask = priv->kill_ack_mask; 1815 bt_cmd.kill_ack_mask = priv->kill_ack_mask;
1816 bt_cmd.kill_cts_mask = priv->kill_cts_mask; 1816 bt_cmd.kill_cts_mask = priv->kill_cts_mask;
1817
1817 bt_cmd.valid = priv->bt_valid; 1818 bt_cmd.valid = priv->bt_valid;
1818 bt_cmd.tx_prio_boost = 0; 1819 bt_cmd.tx_prio_boost = 0;
1819 bt_cmd.rx_prio_boost = 0; 1820 bt_cmd.rx_prio_boost = 0;
@@ -1996,24 +1997,29 @@ static void iwlagn_print_uartmsg(struct iwl_priv *priv,
1996 BT_UART_MSG_FRAME7CONNECTABLE_POS); 1997 BT_UART_MSG_FRAME7CONNECTABLE_POS);
1997} 1998}
1998 1999
1999static void iwlagn_set_kill_ack_msk(struct iwl_priv *priv, 2000static void iwlagn_set_kill_msk(struct iwl_priv *priv,
2000 struct iwl_bt_uart_msg *uart_msg) 2001 struct iwl_bt_uart_msg *uart_msg)
2001{ 2002{
2002 u8 kill_ack_msk; 2003 u8 kill_msk;
2003 static const __le32 bt_kill_ack_msg[2] = { 2004 static const __le32 bt_kill_ack_msg[2] = {
2004 cpu_to_le32(0xFFFFFFF), cpu_to_le32(0xFFFFFC00) }; 2005 IWLAGN_BT_KILL_ACK_MASK_DEFAULT,
2005 2006 IWLAGN_BT_KILL_ACK_CTS_MASK_SCO };
2006 kill_ack_msk = (((BT_UART_MSG_FRAME3A2DP_MSK | 2007 static const __le32 bt_kill_cts_msg[2] = {
2007 BT_UART_MSG_FRAME3SNIFF_MSK | 2008 IWLAGN_BT_KILL_CTS_MASK_DEFAULT,
2008 BT_UART_MSG_FRAME3SCOESCO_MSK) & 2009 IWLAGN_BT_KILL_ACK_CTS_MASK_SCO };
2009 uart_msg->frame3) == 0) ? 1 : 0; 2010
2010 if (priv->kill_ack_mask != bt_kill_ack_msg[kill_ack_msk]) { 2011 kill_msk = (BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3)
2012 ? 1 : 0;
2013 if (priv->kill_ack_mask != bt_kill_ack_msg[kill_msk] ||
2014 priv->kill_cts_mask != bt_kill_cts_msg[kill_msk]) {
2011 priv->bt_valid |= IWLAGN_BT_VALID_KILL_ACK_MASK; 2015 priv->bt_valid |= IWLAGN_BT_VALID_KILL_ACK_MASK;
2012 priv->kill_ack_mask = bt_kill_ack_msg[kill_ack_msk]; 2016 priv->kill_ack_mask = bt_kill_ack_msg[kill_msk];
2017 priv->bt_valid |= IWLAGN_BT_VALID_KILL_CTS_MASK;
2018 priv->kill_cts_mask = bt_kill_cts_msg[kill_msk];
2019
2013 /* schedule to send runtime bt_config */ 2020 /* schedule to send runtime bt_config */
2014 queue_work(priv->workqueue, &priv->bt_runtime_config); 2021 queue_work(priv->workqueue, &priv->bt_runtime_config);
2015 } 2022 }
2016
2017} 2023}
2018 2024
2019void iwlagn_bt_coex_profile_notif(struct iwl_priv *priv, 2025void iwlagn_bt_coex_profile_notif(struct iwl_priv *priv,
@@ -2064,7 +2070,7 @@ void iwlagn_bt_coex_profile_notif(struct iwl_priv *priv,
2064 } 2070 }
2065 } 2071 }
2066 2072
2067 iwlagn_set_kill_ack_msk(priv, uart_msg); 2073 iwlagn_set_kill_msk(priv, uart_msg);
2068 2074
2069 /* FIXME: based on notification, adjust the prio_boost */ 2075 /* FIXME: based on notification, adjust the prio_boost */
2070 2076
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index 07bbc915529a..72b1f262796c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -67,8 +67,14 @@
67 */ 67 */
68 68
69static const u8 tid_to_ac[] = { 69static const u8 tid_to_ac[] = {
70 /* this matches the mac80211 numbers */ 70 IEEE80211_AC_BE,
71 2, 3, 3, 2, 1, 1, 0, 0 71 IEEE80211_AC_BK,
72 IEEE80211_AC_BK,
73 IEEE80211_AC_BE,
74 IEEE80211_AC_VI,
75 IEEE80211_AC_VI,
76 IEEE80211_AC_VO,
77 IEEE80211_AC_VO
72}; 78};
73 79
74static inline int get_ac_from_tid(u16 tid) 80static inline int get_ac_from_tid(u16 tid)
@@ -531,6 +537,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
531 u8 tid = 0; 537 u8 tid = 0;
532 u8 *qc = NULL; 538 u8 *qc = NULL;
533 unsigned long flags; 539 unsigned long flags;
540 bool is_agg = false;
534 541
535 if (info->control.vif) 542 if (info->control.vif)
536 ctx = iwl_rxon_ctx_from_vif(info->control.vif); 543 ctx = iwl_rxon_ctx_from_vif(info->control.vif);
@@ -567,8 +574,8 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
567 if (sta) 574 if (sta)
568 sta_priv = (void *)sta->drv_priv; 575 sta_priv = (void *)sta->drv_priv;
569 576
570 if (sta_priv && sta_priv->asleep) { 577 if (sta_priv && sta_priv->asleep &&
571 WARN_ON(!(info->flags & IEEE80211_TX_CTL_PSPOLL_RESPONSE)); 578 (info->flags & IEEE80211_TX_CTL_PSPOLL_RESPONSE)) {
572 /* 579 /*
573 * This sends an asynchronous command to the device, 580 * This sends an asynchronous command to the device,
574 * but we can rely on it being processed before the 581 * but we can rely on it being processed before the
@@ -616,6 +623,7 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
616 if (info->flags & IEEE80211_TX_CTL_AMPDU && 623 if (info->flags & IEEE80211_TX_CTL_AMPDU &&
617 priv->stations[sta_id].tid[tid].agg.state == IWL_AGG_ON) { 624 priv->stations[sta_id].tid[tid].agg.state == IWL_AGG_ON) {
618 txq_id = priv->stations[sta_id].tid[tid].agg.txq_id; 625 txq_id = priv->stations[sta_id].tid[tid].agg.txq_id;
626 is_agg = true;
619 } 627 }
620 } 628 }
621 629
@@ -763,8 +771,14 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
763 * whether or not we should update the write pointer. 771 * whether or not we should update the write pointer.
764 */ 772 */
765 773
766 /* avoid atomic ops if it isn't an associated client */ 774 /*
767 if (sta_priv && sta_priv->client) 775 * Avoid atomic ops if it isn't an associated client.
776 * Also, if this is a packet for aggregation, don't
777 * increase the counter because the ucode will stop
778 * aggregation queues when their respective station
779 * goes to sleep.
780 */
781 if (sta_priv && sta_priv->client && !is_agg)
768 atomic_inc(&sta_priv->pending_frames); 782 atomic_inc(&sta_priv->pending_frames);
769 783
770 if ((iwl_queue_space(q) < q->high_mark) && priv->mac80211_registered) { 784 if ((iwl_queue_space(q) < q->high_mark) && priv->mac80211_registered) {
@@ -1143,14 +1157,15 @@ int iwlagn_txq_check_empty(struct iwl_priv *priv,
1143 return 0; 1157 return 0;
1144} 1158}
1145 1159
1146static void iwlagn_tx_status(struct iwl_priv *priv, struct iwl_tx_info *tx_info) 1160static void iwlagn_non_agg_tx_status(struct iwl_priv *priv,
1161 struct iwl_rxon_context *ctx,
1162 const u8 *addr1)
1147{ 1163{
1148 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx_info->skb->data;
1149 struct ieee80211_sta *sta; 1164 struct ieee80211_sta *sta;
1150 struct iwl_station_priv *sta_priv; 1165 struct iwl_station_priv *sta_priv;
1151 1166
1152 rcu_read_lock(); 1167 rcu_read_lock();
1153 sta = ieee80211_find_sta(tx_info->ctx->vif, hdr->addr1); 1168 sta = ieee80211_find_sta(ctx->vif, addr1);
1154 if (sta) { 1169 if (sta) {
1155 sta_priv = (void *)sta->drv_priv; 1170 sta_priv = (void *)sta->drv_priv;
1156 /* avoid atomic ops if this isn't a client */ 1171 /* avoid atomic ops if this isn't a client */
@@ -1159,6 +1174,15 @@ static void iwlagn_tx_status(struct iwl_priv *priv, struct iwl_tx_info *tx_info)
1159 ieee80211_sta_block_awake(priv->hw, sta, false); 1174 ieee80211_sta_block_awake(priv->hw, sta, false);
1160 } 1175 }
1161 rcu_read_unlock(); 1176 rcu_read_unlock();
1177}
1178
1179static void iwlagn_tx_status(struct iwl_priv *priv, struct iwl_tx_info *tx_info,
1180 bool is_agg)
1181{
1182 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx_info->skb->data;
1183
1184 if (!is_agg)
1185 iwlagn_non_agg_tx_status(priv, tx_info->ctx, hdr->addr1);
1162 1186
1163 ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb); 1187 ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb);
1164} 1188}
@@ -1183,7 +1207,8 @@ int iwlagn_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
1183 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { 1207 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
1184 1208
1185 tx_info = &txq->txb[txq->q.read_ptr]; 1209 tx_info = &txq->txb[txq->q.read_ptr];
1186 iwlagn_tx_status(priv, tx_info); 1210 iwlagn_tx_status(priv, tx_info,
1211 txq_id >= IWLAGN_FIRST_AMPDU_QUEUE);
1187 1212
1188 hdr = (struct ieee80211_hdr *)tx_info->skb->data; 1213 hdr = (struct ieee80211_hdr *)tx_info->skb->data;
1189 if (hdr && ieee80211_is_data_qos(hdr->frame_control)) 1214 if (hdr && ieee80211_is_data_qos(hdr->frame_control))
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
index 411a7a20450a..0bdd2bb0bbd3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
@@ -47,10 +47,10 @@ struct queue_to_fifo_ac {
47}; 47};
48 48
49static const struct queue_to_fifo_ac iwlagn_default_queue_to_tx_fifo[] = { 49static const struct queue_to_fifo_ac iwlagn_default_queue_to_tx_fifo[] = {
50 { IWL_TX_FIFO_VO, 0, }, 50 { IWL_TX_FIFO_VO, IEEE80211_AC_VO, },
51 { IWL_TX_FIFO_VI, 1, }, 51 { IWL_TX_FIFO_VI, IEEE80211_AC_VI, },
52 { IWL_TX_FIFO_BE, 2, }, 52 { IWL_TX_FIFO_BE, IEEE80211_AC_BE, },
53 { IWL_TX_FIFO_BK, 3, }, 53 { IWL_TX_FIFO_BK, IEEE80211_AC_BK, },
54 { IWLAGN_CMD_FIFO_NUM, IWL_AC_UNSET, }, 54 { IWLAGN_CMD_FIFO_NUM, IWL_AC_UNSET, },
55 { IWL_TX_FIFO_UNUSED, IWL_AC_UNSET, }, 55 { IWL_TX_FIFO_UNUSED, IWL_AC_UNSET, },
56 { IWL_TX_FIFO_UNUSED, IWL_AC_UNSET, }, 56 { IWL_TX_FIFO_UNUSED, IWL_AC_UNSET, },
@@ -60,14 +60,14 @@ static const struct queue_to_fifo_ac iwlagn_default_queue_to_tx_fifo[] = {
60}; 60};
61 61
62static const struct queue_to_fifo_ac iwlagn_ipan_queue_to_tx_fifo[] = { 62static const struct queue_to_fifo_ac iwlagn_ipan_queue_to_tx_fifo[] = {
63 { IWL_TX_FIFO_VO, 0, }, 63 { IWL_TX_FIFO_VO, IEEE80211_AC_VO, },
64 { IWL_TX_FIFO_VI, 1, }, 64 { IWL_TX_FIFO_VI, IEEE80211_AC_VI, },
65 { IWL_TX_FIFO_BE, 2, }, 65 { IWL_TX_FIFO_BE, IEEE80211_AC_BE, },
66 { IWL_TX_FIFO_BK, 3, }, 66 { IWL_TX_FIFO_BK, IEEE80211_AC_BK, },
67 { IWL_TX_FIFO_BK_IPAN, 3, }, 67 { IWL_TX_FIFO_BK_IPAN, IEEE80211_AC_BK, },
68 { IWL_TX_FIFO_BE_IPAN, 2, }, 68 { IWL_TX_FIFO_BE_IPAN, IEEE80211_AC_BE, },
69 { IWL_TX_FIFO_VI_IPAN, 1, }, 69 { IWL_TX_FIFO_VI_IPAN, IEEE80211_AC_VI, },
70 { IWL_TX_FIFO_VO_IPAN, 0, }, 70 { IWL_TX_FIFO_VO_IPAN, IEEE80211_AC_VO, },
71 { IWL_TX_FIFO_BE_IPAN, 2, }, 71 { IWL_TX_FIFO_BE_IPAN, 2, },
72 { IWLAGN_CMD_FIFO_NUM, IWL_AC_UNSET, }, 72 { IWLAGN_CMD_FIFO_NUM, IWL_AC_UNSET, },
73}; 73};
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 5b96b0d80091..50cee2b5a6b7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3175,7 +3175,8 @@ static int iwl_mac_setup_register(struct iwl_priv *priv,
3175 hw->flags = IEEE80211_HW_SIGNAL_DBM | 3175 hw->flags = IEEE80211_HW_SIGNAL_DBM |
3176 IEEE80211_HW_AMPDU_AGGREGATION | 3176 IEEE80211_HW_AMPDU_AGGREGATION |
3177 IEEE80211_HW_NEED_DTIM_PERIOD | 3177 IEEE80211_HW_NEED_DTIM_PERIOD |
3178 IEEE80211_HW_SPECTRUM_MGMT; 3178 IEEE80211_HW_SPECTRUM_MGMT |
3179 IEEE80211_HW_REPORTS_TX_ACK_STATUS;
3179 3180
3180 if (!priv->cfg->base_params->broken_powersave) 3181 if (!priv->cfg->base_params->broken_powersave)
3181 hw->flags |= IEEE80211_HW_SUPPORTS_PS | 3182 hw->flags |= IEEE80211_HW_SUPPORTS_PS |
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index c9448cba1e20..f893d4a6aa87 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -2453,6 +2453,7 @@ struct iwl_bt_cmd {
2453 2453
2454#define IWLAGN_BT_KILL_ACK_MASK_DEFAULT cpu_to_le32(0xffff0000) 2454#define IWLAGN_BT_KILL_ACK_MASK_DEFAULT cpu_to_le32(0xffff0000)
2455#define IWLAGN_BT_KILL_CTS_MASK_DEFAULT cpu_to_le32(0xffff0000) 2455#define IWLAGN_BT_KILL_CTS_MASK_DEFAULT cpu_to_le32(0xffff0000)
2456#define IWLAGN_BT_KILL_ACK_CTS_MASK_SCO cpu_to_le32(0xffffffff)
2456 2457
2457#define IWLAGN_BT3_PRIO_SAMPLE_DEFAULT 2 2458#define IWLAGN_BT3_PRIO_SAMPLE_DEFAULT 2
2458 2459
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
index e87be1e551aa..583916db46e4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
@@ -410,7 +410,6 @@ struct iwl_eeprom_calib_info {
410#define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */ 410#define EEPROM_OEM_MODE (2*0x46) /* 2 bytes */
411#define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */ 411#define EEPROM_WOWLAN_MODE (2*0x47) /* 2 bytes */
412#define EEPROM_RADIO_CONFIG (2*0x48) /* 2 bytes */ 412#define EEPROM_RADIO_CONFIG (2*0x48) /* 2 bytes */
413#define EEPROM_3945_M_VERSION (2*0x4A) /* 1 bytes */
414#define EEPROM_NUM_MAC_ADDRESS (2*0x4C) /* 2 bytes */ 413#define EEPROM_NUM_MAC_ADDRESS (2*0x4C) /* 2 bytes */
415 414
416/* The following masks are to be applied on EEPROM_RADIO_CONFIG */ 415/* The following masks are to be applied on EEPROM_RADIO_CONFIG */
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index d5bc21e5a02c..dd4d8fc9ad7a 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -183,7 +183,7 @@ static void p54u_rx_cb(struct urb *urb)
183static void p54u_tx_cb(struct urb *urb) 183static void p54u_tx_cb(struct urb *urb)
184{ 184{
185 struct sk_buff *skb = urb->context; 185 struct sk_buff *skb = urb->context;
186 struct ieee80211_hw *dev = (struct ieee80211_hw *) 186 struct ieee80211_hw *dev =
187 usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); 187 usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
188 188
189 p54_free_skb(dev, skb); 189 p54_free_skb(dev, skb);
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 2b1cbba90a84..0764d1a30d13 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -1776,11 +1776,8 @@ static void ray_update_multi_list(struct net_device *dev, int all)
1776 /* Copy the kernel's list of MC addresses to card */ 1776 /* Copy the kernel's list of MC addresses to card */
1777 netdev_for_each_mc_addr(ha, dev) { 1777 netdev_for_each_mc_addr(ha, dev) {
1778 memcpy_toio(p, ha->addr, ETH_ALEN); 1778 memcpy_toio(p, ha->addr, ETH_ALEN);
1779 dev_dbg(&link->dev, 1779 dev_dbg(&link->dev, "ray_update_multi add addr %pm\n",
1780 "ray_update_multi add addr %02x%02x%02x%02x%02x%02x\n", 1780 ha->addr);
1781 ha->addr[0], ha->addr[1],
1782 ha->addr[2], ha->addr[3],
1783 ha->addr[4], ha->addr[5]);
1784 p += ETH_ALEN; 1781 p += ETH_ALEN;
1785 i++; 1782 i++;
1786 } 1783 }
@@ -2015,11 +2012,8 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
2015 memcpy_fromio(&local->bss_id, 2012 memcpy_fromio(&local->bss_id,
2016 prcs->var.rejoin_net_complete. 2013 prcs->var.rejoin_net_complete.
2017 bssid, ADDRLEN); 2014 bssid, ADDRLEN);
2018 dev_dbg(&link->dev, 2015 dev_dbg(&link->dev, "ray_cs new BSSID = %pm\n",
2019 "ray_cs new BSSID = %02x%02x%02x%02x%02x%02x\n", 2016 local->bss_id);
2020 local->bss_id[0], local->bss_id[1],
2021 local->bss_id[2], local->bss_id[3],
2022 local->bss_id[4], local->bss_id[5]);
2023 if (!sniffer) 2017 if (!sniffer)
2024 authenticate(local); 2018 authenticate(local);
2025 } 2019 }
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index 433c7f3ef837..b989b0d3ed49 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -911,6 +911,7 @@ static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev)
911 __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags); 911 __set_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags);
912 __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags); 912 __set_bit(DRIVER_REQUIRE_L2PAD, &rt2x00dev->flags);
913 __set_bit(DRIVER_REQUIRE_TXSTATUS_FIFO, &rt2x00dev->flags); 913 __set_bit(DRIVER_REQUIRE_TXSTATUS_FIFO, &rt2x00dev->flags);
914 __set_bit(DRIVER_REQUIRE_TASKLET_CONTEXT, &rt2x00dev->flags);
914 if (!modparam_nohwcrypt) 915 if (!modparam_nohwcrypt)
915 __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags); 916 __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags);
916 __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags); 917 __set_bit(DRIVER_SUPPORT_LINK_TUNING, &rt2x00dev->flags);
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 0a55eeff871e..e72117f3fdf5 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -664,6 +664,7 @@ enum rt2x00_flags {
664 DRIVER_REQUIRE_COPY_IV, 664 DRIVER_REQUIRE_COPY_IV,
665 DRIVER_REQUIRE_L2PAD, 665 DRIVER_REQUIRE_L2PAD,
666 DRIVER_REQUIRE_TXSTATUS_FIFO, 666 DRIVER_REQUIRE_TXSTATUS_FIFO,
667 DRIVER_REQUIRE_TASKLET_CONTEXT,
667 668
668 /* 669 /*
669 * Driver features 670 * Driver features
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index c879f9a7037c..bd3afc92f434 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -379,9 +379,12 @@ void rt2x00lib_txdone(struct queue_entry *entry,
379 * through a mac80211 library call (RTS/CTS) then we should not 379 * through a mac80211 library call (RTS/CTS) then we should not
380 * send the status report back. 380 * send the status report back.
381 */ 381 */
382 if (!(skbdesc_flags & SKBDESC_NOT_MAC80211)) 382 if (!(skbdesc_flags & SKBDESC_NOT_MAC80211)) {
383 ieee80211_tx_status(rt2x00dev->hw, entry->skb); 383 if (test_bit(DRIVER_REQUIRE_TASKLET_CONTEXT, &rt2x00dev->flags))
384 else 384 ieee80211_tx_status(rt2x00dev->hw, entry->skb);
385 else
386 ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb);
387 } else
385 dev_kfree_skb_any(entry->skb); 388 dev_kfree_skb_any(entry->skb);
386 389
387 /* 390 /*
diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c
index b97aa9c78a96..415eec401e2e 100644
--- a/drivers/net/wireless/zd1201.c
+++ b/drivers/net/wireless/zd1201.c
@@ -1830,7 +1830,7 @@ err_zd:
1830 1830
1831static void zd1201_disconnect(struct usb_interface *interface) 1831static void zd1201_disconnect(struct usb_interface *interface)
1832{ 1832{
1833 struct zd1201 *zd=(struct zd1201 *)usb_get_intfdata(interface); 1833 struct zd1201 *zd = usb_get_intfdata(interface);
1834 struct hlist_node *node, *node2; 1834 struct hlist_node *node, *node2;
1835 struct zd1201_frag *frag; 1835 struct zd1201_frag *frag;
1836 1836
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index c68b3dc19e11..3918d2cc5856 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -383,6 +383,35 @@ static int ssb_device_uevent(struct device *dev, struct kobj_uevent_env *env)
383 ssb_dev->id.revision); 383 ssb_dev->id.revision);
384} 384}
385 385
386#define ssb_config_attr(attrib, field, format_string) \
387static ssize_t \
388attrib##_show(struct device *dev, struct device_attribute *attr, char *buf) \
389{ \
390 return sprintf(buf, format_string, dev_to_ssb_dev(dev)->field); \
391}
392
393ssb_config_attr(core_num, core_index, "%u\n")
394ssb_config_attr(coreid, id.coreid, "0x%04x\n")
395ssb_config_attr(vendor, id.vendor, "0x%04x\n")
396ssb_config_attr(revision, id.revision, "%u\n")
397ssb_config_attr(irq, irq, "%u\n")
398static ssize_t
399name_show(struct device *dev, struct device_attribute *attr, char *buf)
400{
401 return sprintf(buf, "%s\n",
402 ssb_core_name(dev_to_ssb_dev(dev)->id.coreid));
403}
404
405static struct device_attribute ssb_device_attrs[] = {
406 __ATTR_RO(name),
407 __ATTR_RO(core_num),
408 __ATTR_RO(coreid),
409 __ATTR_RO(vendor),
410 __ATTR_RO(revision),
411 __ATTR_RO(irq),
412 __ATTR_NULL,
413};
414
386static struct bus_type ssb_bustype = { 415static struct bus_type ssb_bustype = {
387 .name = "ssb", 416 .name = "ssb",
388 .match = ssb_bus_match, 417 .match = ssb_bus_match,
@@ -392,6 +421,7 @@ static struct bus_type ssb_bustype = {
392 .suspend = ssb_device_suspend, 421 .suspend = ssb_device_suspend,
393 .resume = ssb_device_resume, 422 .resume = ssb_device_resume,
394 .uevent = ssb_device_uevent, 423 .uevent = ssb_device_uevent,
424 .dev_attrs = ssb_device_attrs,
395}; 425};
396 426
397static void ssb_buses_lock(void) 427static void ssb_buses_lock(void)
diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
index f52966305e05..158449e55044 100644
--- a/drivers/ssb/pci.c
+++ b/drivers/ssb/pci.c
@@ -406,6 +406,46 @@ static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in)
406 out->antenna_gain.ghz5.a3 = gain; 406 out->antenna_gain.ghz5.a3 = gain;
407} 407}
408 408
409/* Revs 4 5 and 8 have partially shared layout */
410static void sprom_extract_r458(struct ssb_sprom *out, const u16 *in)
411{
412 SPEX(txpid2g[0], SSB_SPROM4_TXPID2G01,
413 SSB_SPROM4_TXPID2G0, SSB_SPROM4_TXPID2G0_SHIFT);
414 SPEX(txpid2g[1], SSB_SPROM4_TXPID2G01,
415 SSB_SPROM4_TXPID2G1, SSB_SPROM4_TXPID2G1_SHIFT);
416 SPEX(txpid2g[2], SSB_SPROM4_TXPID2G23,
417 SSB_SPROM4_TXPID2G2, SSB_SPROM4_TXPID2G2_SHIFT);
418 SPEX(txpid2g[3], SSB_SPROM4_TXPID2G23,
419 SSB_SPROM4_TXPID2G3, SSB_SPROM4_TXPID2G3_SHIFT);
420
421 SPEX(txpid5gl[0], SSB_SPROM4_TXPID5GL01,
422 SSB_SPROM4_TXPID5GL0, SSB_SPROM4_TXPID5GL0_SHIFT);
423 SPEX(txpid5gl[1], SSB_SPROM4_TXPID5GL01,
424 SSB_SPROM4_TXPID5GL1, SSB_SPROM4_TXPID5GL1_SHIFT);
425 SPEX(txpid5gl[2], SSB_SPROM4_TXPID5GL23,
426 SSB_SPROM4_TXPID5GL2, SSB_SPROM4_TXPID5GL2_SHIFT);
427 SPEX(txpid5gl[3], SSB_SPROM4_TXPID5GL23,
428 SSB_SPROM4_TXPID5GL3, SSB_SPROM4_TXPID5GL3_SHIFT);
429
430 SPEX(txpid5g[0], SSB_SPROM4_TXPID5G01,
431 SSB_SPROM4_TXPID5G0, SSB_SPROM4_TXPID5G0_SHIFT);
432 SPEX(txpid5g[1], SSB_SPROM4_TXPID5G01,
433 SSB_SPROM4_TXPID5G1, SSB_SPROM4_TXPID5G1_SHIFT);
434 SPEX(txpid5g[2], SSB_SPROM4_TXPID5G23,
435 SSB_SPROM4_TXPID5G2, SSB_SPROM4_TXPID5G2_SHIFT);
436 SPEX(txpid5g[3], SSB_SPROM4_TXPID5G23,
437 SSB_SPROM4_TXPID5G3, SSB_SPROM4_TXPID5G3_SHIFT);
438
439 SPEX(txpid5gh[0], SSB_SPROM4_TXPID5GH01,
440 SSB_SPROM4_TXPID5GH0, SSB_SPROM4_TXPID5GH0_SHIFT);
441 SPEX(txpid5gh[1], SSB_SPROM4_TXPID5GH01,
442 SSB_SPROM4_TXPID5GH1, SSB_SPROM4_TXPID5GH1_SHIFT);
443 SPEX(txpid5gh[2], SSB_SPROM4_TXPID5GH23,
444 SSB_SPROM4_TXPID5GH2, SSB_SPROM4_TXPID5GH2_SHIFT);
445 SPEX(txpid5gh[3], SSB_SPROM4_TXPID5GH23,
446 SSB_SPROM4_TXPID5GH3, SSB_SPROM4_TXPID5GH3_SHIFT);
447}
448
409static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in) 449static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in)
410{ 450{
411 int i; 451 int i;
@@ -471,6 +511,8 @@ static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in)
471 memcpy(&out->antenna_gain.ghz5, &out->antenna_gain.ghz24, 511 memcpy(&out->antenna_gain.ghz5, &out->antenna_gain.ghz24,
472 sizeof(out->antenna_gain.ghz5)); 512 sizeof(out->antenna_gain.ghz5));
473 513
514 sprom_extract_r458(out, in);
515
474 /* TODO - get remaining rev 4 stuff needed */ 516 /* TODO - get remaining rev 4 stuff needed */
475} 517}
476 518
@@ -561,6 +603,8 @@ static void sprom_extract_r8(struct ssb_sprom *out, const u16 *in)
561 memcpy(&out->antenna_gain.ghz5, &out->antenna_gain.ghz24, 603 memcpy(&out->antenna_gain.ghz5, &out->antenna_gain.ghz24,
562 sizeof(out->antenna_gain.ghz5)); 604 sizeof(out->antenna_gain.ghz5));
563 605
606 sprom_extract_r458(out, in);
607
564 /* TODO - get remaining rev 8 stuff needed */ 608 /* TODO - get remaining rev 8 stuff needed */
565} 609}
566 610
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index d706bf3badc8..5cfa579df476 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -358,11 +358,16 @@
358 * user space application). %NL80211_ATTR_FRAME is used to specify the 358 * user space application). %NL80211_ATTR_FRAME is used to specify the
359 * frame contents (including header). %NL80211_ATTR_WIPHY_FREQ (and 359 * frame contents (including header). %NL80211_ATTR_WIPHY_FREQ (and
360 * optionally %NL80211_ATTR_WIPHY_CHANNEL_TYPE) is used to indicate on 360 * optionally %NL80211_ATTR_WIPHY_CHANNEL_TYPE) is used to indicate on
361 * which channel the frame is to be transmitted or was received. This 361 * which channel the frame is to be transmitted or was received. If this
362 * channel has to be the current channel (remain-on-channel or the 362 * channel is not the current channel (remain-on-channel or the
363 * operational channel). When called, this operation returns a cookie 363 * operational channel) the device will switch to the given channel and
364 * (%NL80211_ATTR_COOKIE) that will be included with the TX status event 364 * transmit the frame, optionally waiting for a response for the time
365 * pertaining to the TX request. 365 * specified using %NL80211_ATTR_DURATION. When called, this operation
366 * returns a cookie (%NL80211_ATTR_COOKIE) that will be included with the
367 * TX status event pertaining to the TX request.
368 * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this
369 * command may be used with the corresponding cookie to cancel the wait
370 * time if it is known that it is no longer necessary.
366 * @NL80211_CMD_ACTION: Alias for @NL80211_CMD_FRAME for backward compatibility. 371 * @NL80211_CMD_ACTION: Alias for @NL80211_CMD_FRAME for backward compatibility.
367 * @NL80211_CMD_FRAME_TX_STATUS: Report TX status of a management frame 372 * @NL80211_CMD_FRAME_TX_STATUS: Report TX status of a management frame
368 * transmitted with %NL80211_CMD_FRAME. %NL80211_ATTR_COOKIE identifies 373 * transmitted with %NL80211_CMD_FRAME. %NL80211_ATTR_COOKIE identifies
@@ -493,6 +498,8 @@ enum nl80211_commands {
493 NL80211_CMD_SET_CHANNEL, 498 NL80211_CMD_SET_CHANNEL,
494 NL80211_CMD_SET_WDS_PEER, 499 NL80211_CMD_SET_WDS_PEER,
495 500
501 NL80211_CMD_FRAME_WAIT_CANCEL,
502
496 /* add new commands above here */ 503 /* add new commands above here */
497 504
498 /* used to define NL80211_CMD_MAX below */ 505 /* used to define NL80211_CMD_MAX below */
@@ -828,6 +835,12 @@ enum nl80211_commands {
828 * 835 *
829 * @NL80211_ATTR_MCAST_RATE: Multicast tx rate (in 100 kbps) for IBSS 836 * @NL80211_ATTR_MCAST_RATE: Multicast tx rate (in 100 kbps) for IBSS
830 * 837 *
838 * @NL80211_ATTR_OFFCHANNEL_TX_OK: For management frame TX, the frame may be
839 * transmitted on another channel when the channel given doesn't match
840 * the current channel. If the current channel doesn't match and this
841 * flag isn't set, the frame will be rejected. This is also used as an
842 * nl80211 capability flag.
843 *
831 * @NL80211_ATTR_MAX: highest attribute number currently defined 844 * @NL80211_ATTR_MAX: highest attribute number currently defined
832 * @__NL80211_ATTR_AFTER_LAST: internal use 845 * @__NL80211_ATTR_AFTER_LAST: internal use
833 */ 846 */
@@ -1002,6 +1015,8 @@ enum nl80211_attrs {
1002 1015
1003 NL80211_ATTR_MCAST_RATE, 1016 NL80211_ATTR_MCAST_RATE,
1004 1017
1018 NL80211_ATTR_OFFCHANNEL_TX_OK,
1019
1005 /* add attributes here, update the policy in nl80211.c */ 1020 /* add attributes here, update the policy in nl80211.c */
1006 1021
1007 __NL80211_ATTR_AFTER_LAST, 1022 __NL80211_ATTR_AFTER_LAST,
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 623b704fdc42..9659eff52ca2 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -55,6 +55,10 @@ struct ssb_sprom {
55 u8 tri5gl; /* 5.2GHz TX isolation */ 55 u8 tri5gl; /* 5.2GHz TX isolation */
56 u8 tri5g; /* 5.3GHz TX isolation */ 56 u8 tri5g; /* 5.3GHz TX isolation */
57 u8 tri5gh; /* 5.8GHz TX isolation */ 57 u8 tri5gh; /* 5.8GHz TX isolation */
58 u8 txpid2g[4]; /* 2GHz TX power index */
59 u8 txpid5gl[4]; /* 4.9 - 5.1GHz TX power index */
60 u8 txpid5g[4]; /* 5.1 - 5.5GHz TX power index */
61 u8 txpid5gh[4]; /* 5.5 - ...GHz TX power index */
58 u8 rxpo2g; /* 2GHz RX power offset */ 62 u8 rxpo2g; /* 2GHz RX power offset */
59 u8 rxpo5g; /* 5GHz RX power offset */ 63 u8 rxpo5g; /* 5GHz RX power offset */
60 u8 rssisav2g; /* 2GHz RSSI params */ 64 u8 rssisav2g; /* 2GHz RSSI params */
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 11daf9c140e7..489f7b6d61c5 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -299,6 +299,46 @@
299#define SSB_SPROM4_AGAIN2_SHIFT 0 299#define SSB_SPROM4_AGAIN2_SHIFT 0
300#define SSB_SPROM4_AGAIN3 0xFF00 /* Antenna 3 */ 300#define SSB_SPROM4_AGAIN3 0xFF00 /* Antenna 3 */
301#define SSB_SPROM4_AGAIN3_SHIFT 8 301#define SSB_SPROM4_AGAIN3_SHIFT 8
302#define SSB_SPROM4_TXPID2G01 0x0062 /* TX Power Index 2GHz */
303#define SSB_SPROM4_TXPID2G0 0x00FF
304#define SSB_SPROM4_TXPID2G0_SHIFT 0
305#define SSB_SPROM4_TXPID2G1 0xFF00
306#define SSB_SPROM4_TXPID2G1_SHIFT 8
307#define SSB_SPROM4_TXPID2G23 0x0064 /* TX Power Index 2GHz */
308#define SSB_SPROM4_TXPID2G2 0x00FF
309#define SSB_SPROM4_TXPID2G2_SHIFT 0
310#define SSB_SPROM4_TXPID2G3 0xFF00
311#define SSB_SPROM4_TXPID2G3_SHIFT 8
312#define SSB_SPROM4_TXPID5G01 0x0066 /* TX Power Index 5GHz middle subband */
313#define SSB_SPROM4_TXPID5G0 0x00FF
314#define SSB_SPROM4_TXPID5G0_SHIFT 0
315#define SSB_SPROM4_TXPID5G1 0xFF00
316#define SSB_SPROM4_TXPID5G1_SHIFT 8
317#define SSB_SPROM4_TXPID5G23 0x0068 /* TX Power Index 5GHz middle subband */
318#define SSB_SPROM4_TXPID5G2 0x00FF
319#define SSB_SPROM4_TXPID5G2_SHIFT 0
320#define SSB_SPROM4_TXPID5G3 0xFF00
321#define SSB_SPROM4_TXPID5G3_SHIFT 8
322#define SSB_SPROM4_TXPID5GL01 0x006A /* TX Power Index 5GHz low subband */
323#define SSB_SPROM4_TXPID5GL0 0x00FF
324#define SSB_SPROM4_TXPID5GL0_SHIFT 0
325#define SSB_SPROM4_TXPID5GL1 0xFF00
326#define SSB_SPROM4_TXPID5GL1_SHIFT 8
327#define SSB_SPROM4_TXPID5GL23 0x006C /* TX Power Index 5GHz low subband */
328#define SSB_SPROM4_TXPID5GL2 0x00FF
329#define SSB_SPROM4_TXPID5GL2_SHIFT 0
330#define SSB_SPROM4_TXPID5GL3 0xFF00
331#define SSB_SPROM4_TXPID5GL3_SHIFT 8
332#define SSB_SPROM4_TXPID5GH01 0x006E /* TX Power Index 5GHz high subband */
333#define SSB_SPROM4_TXPID5GH0 0x00FF
334#define SSB_SPROM4_TXPID5GH0_SHIFT 0
335#define SSB_SPROM4_TXPID5GH1 0xFF00
336#define SSB_SPROM4_TXPID5GH1_SHIFT 8
337#define SSB_SPROM4_TXPID5GH23 0x0070 /* TX Power Index 5GHz high subband */
338#define SSB_SPROM4_TXPID5GH2 0x00FF
339#define SSB_SPROM4_TXPID5GH2_SHIFT 0
340#define SSB_SPROM4_TXPID5GH3 0xFF00
341#define SSB_SPROM4_TXPID5GH3_SHIFT 8
302#define SSB_SPROM4_MAXP_BG 0x0080 /* Max Power BG in path 1 */ 342#define SSB_SPROM4_MAXP_BG 0x0080 /* Max Power BG in path 1 */
303#define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */ 343#define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */
304#define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ 344#define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index e30e00834340..f3c5ed6d7bda 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -1,4 +1,4 @@
1/* 1/*
2 BlueZ - Bluetooth protocol stack for Linux 2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated 3 Copyright (C) 2000-2001 Qualcomm Incorporated
4 4
@@ -12,13 +12,13 @@
12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
15 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 15 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 19
20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
22 SOFTWARE IS DISCLAIMED. 22 SOFTWARE IS DISCLAIMED.
23*/ 23*/
24 24
@@ -489,7 +489,7 @@ struct hci_rp_read_local_name {
489 489
490#define HCI_OP_WRITE_PG_TIMEOUT 0x0c18 490#define HCI_OP_WRITE_PG_TIMEOUT 0x0c18
491 491
492#define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a 492#define HCI_OP_WRITE_SCAN_ENABLE 0x0c1a
493 #define SCAN_DISABLED 0x00 493 #define SCAN_DISABLED 0x00
494 #define SCAN_INQUIRY 0x01 494 #define SCAN_INQUIRY 0x01
495 #define SCAN_PAGE 0x02 495 #define SCAN_PAGE 0x02
@@ -874,7 +874,7 @@ struct hci_ev_si_security {
874 874
875struct hci_command_hdr { 875struct hci_command_hdr {
876 __le16 opcode; /* OCF & OGF */ 876 __le16 opcode; /* OCF & OGF */
877 __u8 plen; 877 __u8 plen;
878} __packed; 878} __packed;
879 879
880struct hci_event_hdr { 880struct hci_event_hdr {
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index ebec8c9a929d..9c08625617a1 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -44,15 +44,15 @@ struct inquiry_data {
44}; 44};
45 45
46struct inquiry_entry { 46struct inquiry_entry {
47 struct inquiry_entry *next; 47 struct inquiry_entry *next;
48 __u32 timestamp; 48 __u32 timestamp;
49 struct inquiry_data data; 49 struct inquiry_data data;
50}; 50};
51 51
52struct inquiry_cache { 52struct inquiry_cache {
53 spinlock_t lock; 53 spinlock_t lock;
54 __u32 timestamp; 54 __u32 timestamp;
55 struct inquiry_entry *list; 55 struct inquiry_entry *list;
56}; 56};
57 57
58struct hci_conn_hash { 58struct hci_conn_hash {
@@ -141,7 +141,7 @@ struct hci_dev {
141 void *driver_data; 141 void *driver_data;
142 void *core_data; 142 void *core_data;
143 143
144 atomic_t promisc; 144 atomic_t promisc;
145 145
146 struct dentry *debugfs; 146 struct dentry *debugfs;
147 147
@@ -150,7 +150,7 @@ struct hci_dev {
150 150
151 struct rfkill *rfkill; 151 struct rfkill *rfkill;
152 152
153 struct module *owner; 153 struct module *owner;
154 154
155 int (*open)(struct hci_dev *hdev); 155 int (*open)(struct hci_dev *hdev);
156 int (*close)(struct hci_dev *hdev); 156 int (*close)(struct hci_dev *hdev);
@@ -215,8 +215,8 @@ extern rwlock_t hci_dev_list_lock;
215extern rwlock_t hci_cb_list_lock; 215extern rwlock_t hci_cb_list_lock;
216 216
217/* ----- Inquiry cache ----- */ 217/* ----- Inquiry cache ----- */
218#define INQUIRY_CACHE_AGE_MAX (HZ*30) // 30 seconds 218#define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */
219#define INQUIRY_ENTRY_AGE_MAX (HZ*60) // 60 seconds 219#define INQUIRY_ENTRY_AGE_MAX (HZ*60) /* 60 seconds */
220 220
221#define inquiry_cache_lock(c) spin_lock(&c->lock) 221#define inquiry_cache_lock(c) spin_lock(&c->lock)
222#define inquiry_cache_unlock(c) spin_unlock(&c->lock) 222#define inquiry_cache_unlock(c) spin_unlock(&c->lock)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index c819c8bf9b68..7ad25ca60ec0 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -1,4 +1,4 @@
1/* 1/*
2 BlueZ - Bluetooth protocol stack for Linux 2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated 3 Copyright (C) 2000-2001 Qualcomm Incorporated
4 Copyright (C) 2009-2010 Gustavo F. Padovan <gustavo@padovan.org> 4 Copyright (C) 2009-2010 Gustavo F. Padovan <gustavo@padovan.org>
@@ -14,13 +14,13 @@
14 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 15 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
16 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 16 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
17 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 17 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
18 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 18 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 19 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 21
22 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 22 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
23 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 23 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
24 SOFTWARE IS DISCLAIMED. 24 SOFTWARE IS DISCLAIMED.
25*/ 25*/
26 26
@@ -417,11 +417,11 @@ static inline int l2cap_tx_window_full(struct sock *sk)
417 return sub == pi->remote_tx_win; 417 return sub == pi->remote_tx_win;
418} 418}
419 419
420#define __get_txseq(ctrl) ((ctrl) & L2CAP_CTRL_TXSEQ) >> 1 420#define __get_txseq(ctrl) (((ctrl) & L2CAP_CTRL_TXSEQ) >> 1)
421#define __get_reqseq(ctrl) ((ctrl) & L2CAP_CTRL_REQSEQ) >> 8 421#define __get_reqseq(ctrl) (((ctrl) & L2CAP_CTRL_REQSEQ) >> 8)
422#define __is_iframe(ctrl) !((ctrl) & L2CAP_CTRL_FRAME_TYPE) 422#define __is_iframe(ctrl) (!((ctrl) & L2CAP_CTRL_FRAME_TYPE))
423#define __is_sframe(ctrl) (ctrl) & L2CAP_CTRL_FRAME_TYPE 423#define __is_sframe(ctrl) ((ctrl) & L2CAP_CTRL_FRAME_TYPE)
424#define __is_sar_start(ctrl) ((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START 424#define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START)
425 425
426void l2cap_load(void); 426void l2cap_load(void);
427 427
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index 71047bc0af84..6eac4a760c3b 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -1,5 +1,5 @@
1/* 1/*
2 RFCOMM implementation for Linux Bluetooth stack (BlueZ). 2 RFCOMM implementation for Linux Bluetooth stack (BlueZ)
3 Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> 3 Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
4 Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> 4 Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org>
5 5
@@ -11,13 +11,13 @@
11 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 12 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
13 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 13 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
14 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 14 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
15 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 18
19 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 19 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
20 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 20 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
21 SOFTWARE IS DISCLAIMED. 21 SOFTWARE IS DISCLAIMED.
22*/ 22*/
23 23
@@ -105,7 +105,7 @@
105struct rfcomm_hdr { 105struct rfcomm_hdr {
106 u8 addr; 106 u8 addr;
107 u8 ctrl; 107 u8 ctrl;
108 u8 len; // Actual size can be 2 bytes 108 u8 len; /* Actual size can be 2 bytes */
109} __packed; 109} __packed;
110 110
111struct rfcomm_cmd { 111struct rfcomm_cmd {
@@ -228,7 +228,7 @@ struct rfcomm_dlc {
228/* ---- RFCOMM SEND RPN ---- */ 228/* ---- RFCOMM SEND RPN ---- */
229int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, 229int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci,
230 u8 bit_rate, u8 data_bits, u8 stop_bits, 230 u8 bit_rate, u8 data_bits, u8 stop_bits,
231 u8 parity, u8 flow_ctrl_settings, 231 u8 parity, u8 flow_ctrl_settings,
232 u8 xon_char, u8 xoff_char, u16 param_mask); 232 u8 xon_char, u8 xoff_char, u16 param_mask);
233 233
234/* ---- RFCOMM DLCs (channels) ---- */ 234/* ---- RFCOMM DLCs (channels) ---- */
diff --git a/include/net/bluetooth/sco.h b/include/net/bluetooth/sco.h
index e28a2a771471..1e35c43657c8 100644
--- a/include/net/bluetooth/sco.h
+++ b/include/net/bluetooth/sco.h
@@ -1,4 +1,4 @@
1/* 1/*
2 BlueZ - Bluetooth protocol stack for Linux 2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated 3 Copyright (C) 2000-2001 Qualcomm Incorporated
4 4
@@ -12,13 +12,13 @@
12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. 13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY 14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
15 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 15 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 19
20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
22 SOFTWARE IS DISCLAIMED. 22 SOFTWARE IS DISCLAIMED.
23*/ 23*/
24 24
@@ -55,11 +55,11 @@ struct sco_conninfo {
55struct sco_conn { 55struct sco_conn {
56 struct hci_conn *hcon; 56 struct hci_conn *hcon;
57 57
58 bdaddr_t *dst; 58 bdaddr_t *dst;
59 bdaddr_t *src; 59 bdaddr_t *src;
60 60
61 spinlock_t lock; 61 spinlock_t lock;
62 struct sock *sk; 62 struct sock *sk;
63 63
64 unsigned int mtu; 64 unsigned int mtu;
65}; 65};
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 0663945cfa48..6b2af7aeddd3 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1134,7 +1134,9 @@ struct cfg80211_pmksa {
1134 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. 1134 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
1135 * This allows the operation to be terminated prior to timeout based on 1135 * This allows the operation to be terminated prior to timeout based on
1136 * the duration value. 1136 * the duration value.
1137 * @mgmt_tx: Transmit a management frame 1137 * @mgmt_tx: Transmit a management frame.
1138 * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
1139 * frame on another channel
1138 * 1140 *
1139 * @testmode_cmd: run a test mode command 1141 * @testmode_cmd: run a test mode command
1140 * 1142 *
@@ -1152,6 +1154,13 @@ struct cfg80211_pmksa {
1152 * @mgmt_frame_register: Notify driver that a management frame type was 1154 * @mgmt_frame_register: Notify driver that a management frame type was
1153 * registered. Note that this callback may not sleep, and cannot run 1155 * registered. Note that this callback may not sleep, and cannot run
1154 * concurrently with itself. 1156 * concurrently with itself.
1157 *
1158 * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
1159 * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
1160 * reject TX/RX mask combinations they cannot support by returning -EINVAL
1161 * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
1162 *
1163 * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
1155 */ 1164 */
1156struct cfg80211_ops { 1165struct cfg80211_ops {
1157 int (*suspend)(struct wiphy *wiphy); 1166 int (*suspend)(struct wiphy *wiphy);
@@ -1291,10 +1300,13 @@ struct cfg80211_ops {
1291 u64 cookie); 1300 u64 cookie);
1292 1301
1293 int (*mgmt_tx)(struct wiphy *wiphy, struct net_device *dev, 1302 int (*mgmt_tx)(struct wiphy *wiphy, struct net_device *dev,
1294 struct ieee80211_channel *chan, 1303 struct ieee80211_channel *chan, bool offchan,
1295 enum nl80211_channel_type channel_type, 1304 enum nl80211_channel_type channel_type,
1296 bool channel_type_valid, 1305 bool channel_type_valid, unsigned int wait,
1297 const u8 *buf, size_t len, u64 *cookie); 1306 const u8 *buf, size_t len, u64 *cookie);
1307 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
1308 struct net_device *dev,
1309 u64 cookie);
1298 1310
1299 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 1311 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
1300 bool enabled, int timeout); 1312 bool enabled, int timeout);
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index eaa4affd40cd..e411cf87fb41 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2055,8 +2055,8 @@ static inline void ieee80211_rx_ni(struct ieee80211_hw *hw,
2055 * 2055 *
2056 * This function may not be called in IRQ context. Calls to this function 2056 * This function may not be called in IRQ context. Calls to this function
2057 * for a single hardware must be synchronized against each other. Calls 2057 * for a single hardware must be synchronized against each other. Calls
2058 * to this function and ieee80211_tx_status_irqsafe() may not be mixed 2058 * to this function, ieee80211_tx_status_ni() and ieee80211_tx_status_irqsafe()
2059 * for a single hardware. 2059 * may not be mixed for a single hardware.
2060 * 2060 *
2061 * @hw: the hardware the frame was transmitted by 2061 * @hw: the hardware the frame was transmitted by
2062 * @skb: the frame that was transmitted, owned by mac80211 after this call 2062 * @skb: the frame that was transmitted, owned by mac80211 after this call
@@ -2065,13 +2065,33 @@ void ieee80211_tx_status(struct ieee80211_hw *hw,
2065 struct sk_buff *skb); 2065 struct sk_buff *skb);
2066 2066
2067/** 2067/**
2068 * ieee80211_tx_status_ni - transmit status callback (in process context)
2069 *
2070 * Like ieee80211_tx_status() but can be called in process context.
2071 *
2072 * Calls to this function, ieee80211_tx_status() and
2073 * ieee80211_tx_status_irqsafe() may not be mixed
2074 * for a single hardware.
2075 *
2076 * @hw: the hardware the frame was transmitted by
2077 * @skb: the frame that was transmitted, owned by mac80211 after this call
2078 */
2079static inline void ieee80211_tx_status_ni(struct ieee80211_hw *hw,
2080 struct sk_buff *skb)
2081{
2082 local_bh_disable();
2083 ieee80211_tx_status(hw, skb);
2084 local_bh_enable();
2085}
2086
2087/**
2068 * ieee80211_tx_status_irqsafe - IRQ-safe transmit status callback 2088 * ieee80211_tx_status_irqsafe - IRQ-safe transmit status callback
2069 * 2089 *
2070 * Like ieee80211_tx_status() but can be called in IRQ context 2090 * Like ieee80211_tx_status() but can be called in IRQ context
2071 * (internally defers to a tasklet.) 2091 * (internally defers to a tasklet.)
2072 * 2092 *
2073 * Calls to this function and ieee80211_tx_status() may not be mixed for a 2093 * Calls to this function, ieee80211_tx_status() and
2074 * single hardware. 2094 * ieee80211_tx_status_ni() may not be mixed for a single hardware.
2075 * 2095 *
2076 * @hw: the hardware the frame was transmitted by 2096 * @hw: the hardware the frame was transmitted by
2077 * @skb: the frame that was transmitted, owned by mac80211 after this call 2097 * @skb: the frame that was transmitted, owned by mac80211 after this call
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index f10b41fb05a0..5868597534e5 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -648,6 +648,7 @@ int bnep_del_connection(struct bnep_conndel_req *req)
648 648
649static void __bnep_copy_ci(struct bnep_conninfo *ci, struct bnep_session *s) 649static void __bnep_copy_ci(struct bnep_conninfo *ci, struct bnep_session *s)
650{ 650{
651 memset(ci, 0, sizeof(*ci));
651 memcpy(ci->dst, s->eh.h_source, ETH_ALEN); 652 memcpy(ci->dst, s->eh.h_source, ETH_ALEN);
652 strcpy(ci->device, s->dev->name); 653 strcpy(ci->device, s->dev->name);
653 ci->flags = s->flags; 654 ci->flags = s->flags;
diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c
index ec0a1347f933..8e5f292529ac 100644
--- a/net/bluetooth/cmtp/core.c
+++ b/net/bluetooth/cmtp/core.c
@@ -78,6 +78,7 @@ static void __cmtp_unlink_session(struct cmtp_session *session)
78 78
79static void __cmtp_copy_session(struct cmtp_session *session, struct cmtp_conninfo *ci) 79static void __cmtp_copy_session(struct cmtp_session *session, struct cmtp_conninfo *ci)
80{ 80{
81 memset(ci, 0, sizeof(*ci));
81 bacpy(&ci->bdaddr, &session->bdaddr); 82 bacpy(&ci->bdaddr, &session->bdaddr);
82 83
83 ci->flags = session->flags; 84 ci->flags = session->flags;
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 0b1e460fe440..6b90a4191734 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -39,7 +39,7 @@
39#include <net/sock.h> 39#include <net/sock.h>
40 40
41#include <asm/system.h> 41#include <asm/system.h>
42#include <asm/uaccess.h> 42#include <linux/uaccess.h>
43#include <asm/unaligned.h> 43#include <asm/unaligned.h>
44 44
45#include <net/bluetooth/bluetooth.h> 45#include <net/bluetooth/bluetooth.h>
@@ -66,7 +66,8 @@ void hci_acl_connect(struct hci_conn *conn)
66 bacpy(&cp.bdaddr, &conn->dst); 66 bacpy(&cp.bdaddr, &conn->dst);
67 cp.pscan_rep_mode = 0x02; 67 cp.pscan_rep_mode = 0x02;
68 68
69 if ((ie = hci_inquiry_cache_lookup(hdev, &conn->dst))) { 69 ie = hci_inquiry_cache_lookup(hdev, &conn->dst);
70 if (ie) {
70 if (inquiry_entry_age(ie) <= INQUIRY_ENTRY_AGE_MAX) { 71 if (inquiry_entry_age(ie) <= INQUIRY_ENTRY_AGE_MAX) {
71 cp.pscan_rep_mode = ie->data.pscan_rep_mode; 72 cp.pscan_rep_mode = ie->data.pscan_rep_mode;
72 cp.pscan_mode = ie->data.pscan_mode; 73 cp.pscan_mode = ie->data.pscan_mode;
@@ -368,8 +369,10 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8
368 369
369 BT_DBG("%s dst %s", hdev->name, batostr(dst)); 370 BT_DBG("%s dst %s", hdev->name, batostr(dst));
370 371
371 if (!(acl = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst))) { 372 acl = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
372 if (!(acl = hci_conn_add(hdev, ACL_LINK, dst))) 373 if (!acl) {
374 acl = hci_conn_add(hdev, ACL_LINK, dst);
375 if (!acl)
373 return NULL; 376 return NULL;
374 } 377 }
375 378
@@ -389,8 +392,10 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8
389 if (type == ACL_LINK) 392 if (type == ACL_LINK)
390 return acl; 393 return acl;
391 394
392 if (!(sco = hci_conn_hash_lookup_ba(hdev, type, dst))) { 395 sco = hci_conn_hash_lookup_ba(hdev, type, dst);
393 if (!(sco = hci_conn_add(hdev, type, dst))) { 396 if (!sco) {
397 sco = hci_conn_add(hdev, type, dst);
398 if (!sco) {
394 hci_conn_put(acl); 399 hci_conn_put(acl);
395 return NULL; 400 return NULL;
396 } 401 }
@@ -647,10 +652,12 @@ int hci_get_conn_list(void __user *arg)
647 652
648 size = sizeof(req) + req.conn_num * sizeof(*ci); 653 size = sizeof(req) + req.conn_num * sizeof(*ci);
649 654
650 if (!(cl = kmalloc(size, GFP_KERNEL))) 655 cl = kmalloc(size, GFP_KERNEL);
656 if (!cl)
651 return -ENOMEM; 657 return -ENOMEM;
652 658
653 if (!(hdev = hci_dev_get(req.dev_id))) { 659 hdev = hci_dev_get(req.dev_id);
660 if (!hdev) {
654 kfree(cl); 661 kfree(cl);
655 return -ENODEV; 662 return -ENODEV;
656 } 663 }
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index bc2a052e518b..51c61f75a797 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -44,7 +44,7 @@
44#include <net/sock.h> 44#include <net/sock.h>
45 45
46#include <asm/system.h> 46#include <asm/system.h>
47#include <asm/uaccess.h> 47#include <linux/uaccess.h>
48#include <asm/unaligned.h> 48#include <asm/unaligned.h>
49 49
50#include <net/bluetooth/bluetooth.h> 50#include <net/bluetooth/bluetooth.h>
@@ -349,20 +349,23 @@ struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, bdaddr_t *b
349void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data) 349void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data)
350{ 350{
351 struct inquiry_cache *cache = &hdev->inq_cache; 351 struct inquiry_cache *cache = &hdev->inq_cache;
352 struct inquiry_entry *e; 352 struct inquiry_entry *ie;
353 353
354 BT_DBG("cache %p, %s", cache, batostr(&data->bdaddr)); 354 BT_DBG("cache %p, %s", cache, batostr(&data->bdaddr));
355 355
356 if (!(e = hci_inquiry_cache_lookup(hdev, &data->bdaddr))) { 356 ie = hci_inquiry_cache_lookup(hdev, &data->bdaddr);
357 if (!ie) {
357 /* Entry not in the cache. Add new one. */ 358 /* Entry not in the cache. Add new one. */
358 if (!(e = kzalloc(sizeof(struct inquiry_entry), GFP_ATOMIC))) 359 ie = kzalloc(sizeof(struct inquiry_entry), GFP_ATOMIC);
360 if (!ie)
359 return; 361 return;
360 e->next = cache->list; 362
361 cache->list = e; 363 ie->next = cache->list;
364 cache->list = ie;
362 } 365 }
363 366
364 memcpy(&e->data, data, sizeof(*data)); 367 memcpy(&ie->data, data, sizeof(*data));
365 e->timestamp = jiffies; 368 ie->timestamp = jiffies;
366 cache->timestamp = jiffies; 369 cache->timestamp = jiffies;
367} 370}
368 371
@@ -422,16 +425,20 @@ int hci_inquiry(void __user *arg)
422 425
423 hci_dev_lock_bh(hdev); 426 hci_dev_lock_bh(hdev);
424 if (inquiry_cache_age(hdev) > INQUIRY_CACHE_AGE_MAX || 427 if (inquiry_cache_age(hdev) > INQUIRY_CACHE_AGE_MAX ||
425 inquiry_cache_empty(hdev) || 428 inquiry_cache_empty(hdev) ||
426 ir.flags & IREQ_CACHE_FLUSH) { 429 ir.flags & IREQ_CACHE_FLUSH) {
427 inquiry_cache_flush(hdev); 430 inquiry_cache_flush(hdev);
428 do_inquiry = 1; 431 do_inquiry = 1;
429 } 432 }
430 hci_dev_unlock_bh(hdev); 433 hci_dev_unlock_bh(hdev);
431 434
432 timeo = ir.length * msecs_to_jiffies(2000); 435 timeo = ir.length * msecs_to_jiffies(2000);
433 if (do_inquiry && (err = hci_request(hdev, hci_inq_req, (unsigned long)&ir, timeo)) < 0) 436
434 goto done; 437 if (do_inquiry) {
438 err = hci_request(hdev, hci_inq_req, (unsigned long)&ir, timeo);
439 if (err < 0)
440 goto done;
441 }
435 442
436 /* for unlimited number of responses we will use buffer with 255 entries */ 443 /* for unlimited number of responses we will use buffer with 255 entries */
437 max_rsp = (ir.num_rsp == 0) ? 255 : ir.num_rsp; 444 max_rsp = (ir.num_rsp == 0) ? 255 : ir.num_rsp;
@@ -439,7 +446,8 @@ int hci_inquiry(void __user *arg)
439 /* cache_dump can't sleep. Therefore we allocate temp buffer and then 446 /* cache_dump can't sleep. Therefore we allocate temp buffer and then
440 * copy it to the user space. 447 * copy it to the user space.
441 */ 448 */
442 if (!(buf = kmalloc(sizeof(struct inquiry_info) * max_rsp, GFP_KERNEL))) { 449 buf = kmalloc(sizeof(struct inquiry_info) *max_rsp, GFP_KERNEL);
450 if (!buf) {
443 err = -ENOMEM; 451 err = -ENOMEM;
444 goto done; 452 goto done;
445 } 453 }
@@ -611,7 +619,8 @@ int hci_dev_close(__u16 dev)
611 struct hci_dev *hdev; 619 struct hci_dev *hdev;
612 int err; 620 int err;
613 621
614 if (!(hdev = hci_dev_get(dev))) 622 hdev = hci_dev_get(dev);
623 if (!hdev)
615 return -ENODEV; 624 return -ENODEV;
616 err = hci_dev_do_close(hdev); 625 err = hci_dev_do_close(hdev);
617 hci_dev_put(hdev); 626 hci_dev_put(hdev);
@@ -623,7 +632,8 @@ int hci_dev_reset(__u16 dev)
623 struct hci_dev *hdev; 632 struct hci_dev *hdev;
624 int ret = 0; 633 int ret = 0;
625 634
626 if (!(hdev = hci_dev_get(dev))) 635 hdev = hci_dev_get(dev);
636 if (!hdev)
627 return -ENODEV; 637 return -ENODEV;
628 638
629 hci_req_lock(hdev); 639 hci_req_lock(hdev);
@@ -663,7 +673,8 @@ int hci_dev_reset_stat(__u16 dev)
663 struct hci_dev *hdev; 673 struct hci_dev *hdev;
664 int ret = 0; 674 int ret = 0;
665 675
666 if (!(hdev = hci_dev_get(dev))) 676 hdev = hci_dev_get(dev);
677 if (!hdev)
667 return -ENODEV; 678 return -ENODEV;
668 679
669 memset(&hdev->stat, 0, sizeof(struct hci_dev_stats)); 680 memset(&hdev->stat, 0, sizeof(struct hci_dev_stats));
@@ -682,7 +693,8 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg)
682 if (copy_from_user(&dr, arg, sizeof(dr))) 693 if (copy_from_user(&dr, arg, sizeof(dr)))
683 return -EFAULT; 694 return -EFAULT;
684 695
685 if (!(hdev = hci_dev_get(dr.dev_id))) 696 hdev = hci_dev_get(dr.dev_id);
697 if (!hdev)
686 return -ENODEV; 698 return -ENODEV;
687 699
688 switch (cmd) { 700 switch (cmd) {
@@ -763,7 +775,8 @@ int hci_get_dev_list(void __user *arg)
763 775
764 size = sizeof(*dl) + dev_num * sizeof(*dr); 776 size = sizeof(*dl) + dev_num * sizeof(*dr);
765 777
766 if (!(dl = kzalloc(size, GFP_KERNEL))) 778 dl = kzalloc(size, GFP_KERNEL);
779 if (!dl)
767 return -ENOMEM; 780 return -ENOMEM;
768 781
769 dr = dl->dev_req; 782 dr = dl->dev_req;
@@ -797,7 +810,8 @@ int hci_get_dev_info(void __user *arg)
797 if (copy_from_user(&di, arg, sizeof(di))) 810 if (copy_from_user(&di, arg, sizeof(di)))
798 return -EFAULT; 811 return -EFAULT;
799 812
800 if (!(hdev = hci_dev_get(di.dev_id))) 813 hdev = hci_dev_get(di.dev_id);
814 if (!hdev)
801 return -ENODEV; 815 return -ENODEV;
802 816
803 strcpy(di.name, hdev->name); 817 strcpy(di.name, hdev->name);
@@ -905,7 +919,7 @@ int hci_register_dev(struct hci_dev *hdev)
905 hdev->sniff_max_interval = 800; 919 hdev->sniff_max_interval = 800;
906 hdev->sniff_min_interval = 80; 920 hdev->sniff_min_interval = 80;
907 921
908 tasklet_init(&hdev->cmd_task, hci_cmd_task,(unsigned long) hdev); 922 tasklet_init(&hdev->cmd_task, hci_cmd_task, (unsigned long) hdev);
909 tasklet_init(&hdev->rx_task, hci_rx_task, (unsigned long) hdev); 923 tasklet_init(&hdev->rx_task, hci_rx_task, (unsigned long) hdev);
910 tasklet_init(&hdev->tx_task, hci_tx_task, (unsigned long) hdev); 924 tasklet_init(&hdev->tx_task, hci_tx_task, (unsigned long) hdev);
911 925
@@ -1368,7 +1382,8 @@ void hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags)
1368 bt_cb(skb)->pkt_type = HCI_ACLDATA_PKT; 1382 bt_cb(skb)->pkt_type = HCI_ACLDATA_PKT;
1369 hci_add_acl_hdr(skb, conn->handle, flags | ACL_START); 1383 hci_add_acl_hdr(skb, conn->handle, flags | ACL_START);
1370 1384
1371 if (!(list = skb_shinfo(skb)->frag_list)) { 1385 list = skb_shinfo(skb)->frag_list;
1386 if (!list) {
1372 /* Non fragmented */ 1387 /* Non fragmented */
1373 BT_DBG("%s nonfrag skb %p len %d", hdev->name, skb, skb->len); 1388 BT_DBG("%s nonfrag skb %p len %d", hdev->name, skb, skb->len);
1374 1389
@@ -1609,7 +1624,8 @@ static inline void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
1609 hci_conn_enter_active_mode(conn); 1624 hci_conn_enter_active_mode(conn);
1610 1625
1611 /* Send to upper protocol */ 1626 /* Send to upper protocol */
1612 if ((hp = hci_proto[HCI_PROTO_L2CAP]) && hp->recv_acldata) { 1627 hp = hci_proto[HCI_PROTO_L2CAP];
1628 if (hp && hp->recv_acldata) {
1613 hp->recv_acldata(conn, skb, flags); 1629 hp->recv_acldata(conn, skb, flags);
1614 return; 1630 return;
1615 } 1631 }
@@ -1644,7 +1660,8 @@ static inline void hci_scodata_packet(struct hci_dev *hdev, struct sk_buff *skb)
1644 register struct hci_proto *hp; 1660 register struct hci_proto *hp;
1645 1661
1646 /* Send to upper protocol */ 1662 /* Send to upper protocol */
1647 if ((hp = hci_proto[HCI_PROTO_SCO]) && hp->recv_scodata) { 1663 hp = hci_proto[HCI_PROTO_SCO];
1664 if (hp && hp->recv_scodata) {
1648 hp->recv_scodata(conn, skb); 1665 hp->recv_scodata(conn, skb);
1649 return; 1666 return;
1650 } 1667 }
@@ -1727,7 +1744,8 @@ static void hci_cmd_task(unsigned long arg)
1727 if (atomic_read(&hdev->cmd_cnt) && (skb = skb_dequeue(&hdev->cmd_q))) { 1744 if (atomic_read(&hdev->cmd_cnt) && (skb = skb_dequeue(&hdev->cmd_q))) {
1728 kfree_skb(hdev->sent_cmd); 1745 kfree_skb(hdev->sent_cmd);
1729 1746
1730 if ((hdev->sent_cmd = skb_clone(skb, GFP_ATOMIC))) { 1747 hdev->sent_cmd = skb_clone(skb, GFP_ATOMIC);
1748 if (hdev->sent_cmd) {
1731 atomic_dec(&hdev->cmd_cnt); 1749 atomic_dec(&hdev->cmd_cnt);
1732 hci_send_frame(skb); 1750 hci_send_frame(skb);
1733 hdev->cmd_last_tx = jiffies; 1751 hdev->cmd_last_tx = jiffies;
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 84093b0000b9..8923b36a67a2 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -39,7 +39,7 @@
39#include <net/sock.h> 39#include <net/sock.h>
40 40
41#include <asm/system.h> 41#include <asm/system.h>
42#include <asm/uaccess.h> 42#include <linux/uaccess.h>
43#include <asm/unaligned.h> 43#include <asm/unaligned.h>
44 44
45#include <net/bluetooth/bluetooth.h> 45#include <net/bluetooth/bluetooth.h>
@@ -677,9 +677,50 @@ static void hci_cs_set_conn_encrypt(struct hci_dev *hdev, __u8 status)
677 hci_dev_unlock(hdev); 677 hci_dev_unlock(hdev);
678} 678}
679 679
680static int hci_outgoing_auth_needed(struct hci_dev *hdev,
681 struct hci_conn *conn)
682{
683 if (conn->state != BT_CONFIG || !conn->out)
684 return 0;
685
686 if (conn->sec_level == BT_SECURITY_SDP)
687 return 0;
688
689 /* Only request authentication for SSP connections or non-SSP
690 * devices with sec_level HIGH */
691 if (!(hdev->ssp_mode > 0 && conn->ssp_mode > 0) &&
692 conn->sec_level != BT_SECURITY_HIGH)
693 return 0;
694
695 return 1;
696}
697
680static void hci_cs_remote_name_req(struct hci_dev *hdev, __u8 status) 698static void hci_cs_remote_name_req(struct hci_dev *hdev, __u8 status)
681{ 699{
700 struct hci_cp_remote_name_req *cp;
701 struct hci_conn *conn;
702
682 BT_DBG("%s status 0x%x", hdev->name, status); 703 BT_DBG("%s status 0x%x", hdev->name, status);
704
705 /* If successful wait for the name req complete event before
706 * checking for the need to do authentication */
707 if (!status)
708 return;
709
710 cp = hci_sent_cmd_data(hdev, HCI_OP_REMOTE_NAME_REQ);
711 if (!cp)
712 return;
713
714 hci_dev_lock(hdev);
715
716 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr);
717 if (conn && hci_outgoing_auth_needed(hdev, conn)) {
718 struct hci_cp_auth_requested cp;
719 cp.handle = __cpu_to_le16(conn->handle);
720 hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp);
721 }
722
723 hci_dev_unlock(hdev);
683} 724}
684 725
685static void hci_cs_read_remote_features(struct hci_dev *hdev, __u8 status) 726static void hci_cs_read_remote_features(struct hci_dev *hdev, __u8 status)
@@ -955,12 +996,14 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk
955 996
956 hci_dev_lock(hdev); 997 hci_dev_lock(hdev);
957 998
958 if ((ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr))) 999 ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr);
1000 if (ie)
959 memcpy(ie->data.dev_class, ev->dev_class, 3); 1001 memcpy(ie->data.dev_class, ev->dev_class, 3);
960 1002
961 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr); 1003 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr);
962 if (!conn) { 1004 if (!conn) {
963 if (!(conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr))) { 1005 conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr);
1006 if (!conn) {
964 BT_ERR("No memory for new connection"); 1007 BT_ERR("No memory for new connection");
965 hci_dev_unlock(hdev); 1008 hci_dev_unlock(hdev);
966 return; 1009 return;
@@ -1090,9 +1133,23 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
1090 1133
1091static inline void hci_remote_name_evt(struct hci_dev *hdev, struct sk_buff *skb) 1134static inline void hci_remote_name_evt(struct hci_dev *hdev, struct sk_buff *skb)
1092{ 1135{
1136 struct hci_ev_remote_name *ev = (void *) skb->data;
1137 struct hci_conn *conn;
1138
1093 BT_DBG("%s", hdev->name); 1139 BT_DBG("%s", hdev->name);
1094 1140
1095 hci_conn_check_pending(hdev); 1141 hci_conn_check_pending(hdev);
1142
1143 hci_dev_lock(hdev);
1144
1145 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr);
1146 if (conn && hci_outgoing_auth_needed(hdev, conn)) {
1147 struct hci_cp_auth_requested cp;
1148 cp.handle = __cpu_to_le16(conn->handle);
1149 hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED, sizeof(cp), &cp);
1150 }
1151
1152 hci_dev_unlock(hdev);
1096} 1153}
1097 1154
1098static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *skb) 1155static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *skb)
@@ -1162,33 +1219,39 @@ static inline void hci_remote_features_evt(struct hci_dev *hdev, struct sk_buff
1162 hci_dev_lock(hdev); 1219 hci_dev_lock(hdev);
1163 1220
1164 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 1221 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle));
1165 if (conn) { 1222 if (!conn)
1166 if (!ev->status) 1223 goto unlock;
1167 memcpy(conn->features, ev->features, 8);
1168 1224
1169 if (conn->state == BT_CONFIG) { 1225 if (!ev->status)
1170 if (!ev->status && lmp_ssp_capable(hdev) && 1226 memcpy(conn->features, ev->features, 8);
1171 lmp_ssp_capable(conn)) { 1227
1172 struct hci_cp_read_remote_ext_features cp; 1228 if (conn->state != BT_CONFIG)
1173 cp.handle = ev->handle; 1229 goto unlock;
1174 cp.page = 0x01; 1230
1175 hci_send_cmd(hdev, 1231 if (!ev->status && lmp_ssp_capable(hdev) && lmp_ssp_capable(conn)) {
1176 HCI_OP_READ_REMOTE_EXT_FEATURES, 1232 struct hci_cp_read_remote_ext_features cp;
1177 sizeof(cp), &cp); 1233 cp.handle = ev->handle;
1178 } else if (!ev->status && conn->out && 1234 cp.page = 0x01;
1179 conn->sec_level == BT_SECURITY_HIGH) { 1235 hci_send_cmd(hdev, HCI_OP_READ_REMOTE_EXT_FEATURES,
1180 struct hci_cp_auth_requested cp;
1181 cp.handle = ev->handle;
1182 hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED,
1183 sizeof(cp), &cp); 1236 sizeof(cp), &cp);
1184 } else { 1237 goto unlock;
1185 conn->state = BT_CONNECTED; 1238 }
1186 hci_proto_connect_cfm(conn, ev->status); 1239
1187 hci_conn_put(conn); 1240 if (!ev->status) {
1188 } 1241 struct hci_cp_remote_name_req cp;
1189 } 1242 memset(&cp, 0, sizeof(cp));
1243 bacpy(&cp.bdaddr, &conn->dst);
1244 cp.pscan_rep_mode = 0x02;
1245 hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp);
1190 } 1246 }
1191 1247
1248 if (!hci_outgoing_auth_needed(hdev, conn)) {
1249 conn->state = BT_CONNECTED;
1250 hci_proto_connect_cfm(conn, ev->status);
1251 hci_conn_put(conn);
1252 }
1253
1254unlock:
1192 hci_dev_unlock(hdev); 1255 hci_dev_unlock(hdev);
1193} 1256}
1194 1257
@@ -1449,10 +1512,12 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s
1449 conn->sent -= count; 1512 conn->sent -= count;
1450 1513
1451 if (conn->type == ACL_LINK) { 1514 if (conn->type == ACL_LINK) {
1452 if ((hdev->acl_cnt += count) > hdev->acl_pkts) 1515 hdev->acl_cnt += count;
1516 if (hdev->acl_cnt > hdev->acl_pkts)
1453 hdev->acl_cnt = hdev->acl_pkts; 1517 hdev->acl_cnt = hdev->acl_pkts;
1454 } else { 1518 } else {
1455 if ((hdev->sco_cnt += count) > hdev->sco_pkts) 1519 hdev->sco_cnt += count;
1520 if (hdev->sco_cnt > hdev->sco_pkts)
1456 hdev->sco_cnt = hdev->sco_pkts; 1521 hdev->sco_cnt = hdev->sco_pkts;
1457 } 1522 }
1458 } 1523 }
@@ -1547,7 +1612,8 @@ static inline void hci_clock_offset_evt(struct hci_dev *hdev, struct sk_buff *sk
1547 if (conn && !ev->status) { 1612 if (conn && !ev->status) {
1548 struct inquiry_entry *ie; 1613 struct inquiry_entry *ie;
1549 1614
1550 if ((ie = hci_inquiry_cache_lookup(hdev, &conn->dst))) { 1615 ie = hci_inquiry_cache_lookup(hdev, &conn->dst);
1616 if (ie) {
1551 ie->data.clock_offset = ev->clock_offset; 1617 ie->data.clock_offset = ev->clock_offset;
1552 ie->timestamp = jiffies; 1618 ie->timestamp = jiffies;
1553 } 1619 }
@@ -1581,7 +1647,8 @@ static inline void hci_pscan_rep_mode_evt(struct hci_dev *hdev, struct sk_buff *
1581 1647
1582 hci_dev_lock(hdev); 1648 hci_dev_lock(hdev);
1583 1649
1584 if ((ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr))) { 1650 ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr);
1651 if (ie) {
1585 ie->data.pscan_rep_mode = ev->pscan_rep_mode; 1652 ie->data.pscan_rep_mode = ev->pscan_rep_mode;
1586 ie->timestamp = jiffies; 1653 ie->timestamp = jiffies;
1587 } 1654 }
@@ -1646,32 +1713,37 @@ static inline void hci_remote_ext_features_evt(struct hci_dev *hdev, struct sk_b
1646 hci_dev_lock(hdev); 1713 hci_dev_lock(hdev);
1647 1714
1648 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 1715 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle));
1649 if (conn) { 1716 if (!conn)
1650 if (!ev->status && ev->page == 0x01) { 1717 goto unlock;
1651 struct inquiry_entry *ie;
1652 1718
1653 if ((ie = hci_inquiry_cache_lookup(hdev, &conn->dst))) 1719 if (!ev->status && ev->page == 0x01) {
1654 ie->data.ssp_mode = (ev->features[0] & 0x01); 1720 struct inquiry_entry *ie;
1655 1721
1656 conn->ssp_mode = (ev->features[0] & 0x01); 1722 ie = hci_inquiry_cache_lookup(hdev, &conn->dst);
1657 } 1723 if (ie)
1724 ie->data.ssp_mode = (ev->features[0] & 0x01);
1658 1725
1659 if (conn->state == BT_CONFIG) { 1726 conn->ssp_mode = (ev->features[0] & 0x01);
1660 if (!ev->status && hdev->ssp_mode > 0 &&
1661 conn->ssp_mode > 0 && conn->out &&
1662 conn->sec_level != BT_SECURITY_SDP) {
1663 struct hci_cp_auth_requested cp;
1664 cp.handle = ev->handle;
1665 hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED,
1666 sizeof(cp), &cp);
1667 } else {
1668 conn->state = BT_CONNECTED;
1669 hci_proto_connect_cfm(conn, ev->status);
1670 hci_conn_put(conn);
1671 }
1672 }
1673 } 1727 }
1674 1728
1729 if (conn->state != BT_CONFIG)
1730 goto unlock;
1731
1732 if (!ev->status) {
1733 struct hci_cp_remote_name_req cp;
1734 memset(&cp, 0, sizeof(cp));
1735 bacpy(&cp.bdaddr, &conn->dst);
1736 cp.pscan_rep_mode = 0x02;
1737 hci_send_cmd(hdev, HCI_OP_REMOTE_NAME_REQ, sizeof(cp), &cp);
1738 }
1739
1740 if (!hci_outgoing_auth_needed(hdev, conn)) {
1741 conn->state = BT_CONNECTED;
1742 hci_proto_connect_cfm(conn, ev->status);
1743 hci_conn_put(conn);
1744 }
1745
1746unlock:
1675 hci_dev_unlock(hdev); 1747 hci_dev_unlock(hdev);
1676} 1748}
1677 1749
@@ -1821,7 +1893,8 @@ static inline void hci_remote_host_features_evt(struct hci_dev *hdev, struct sk_
1821 1893
1822 hci_dev_lock(hdev); 1894 hci_dev_lock(hdev);
1823 1895
1824 if ((ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr))) 1896 ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr);
1897 if (ie)
1825 ie->data.ssp_mode = (ev->features[0] & 0x01); 1898 ie->data.ssp_mode = (ev->features[0] & 0x01);
1826 1899
1827 hci_dev_unlock(hdev); 1900 hci_dev_unlock(hdev);
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 83acd164d39e..b3753bad2a55 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -43,7 +43,7 @@
43#include <net/sock.h> 43#include <net/sock.h>
44 44
45#include <asm/system.h> 45#include <asm/system.h>
46#include <asm/uaccess.h> 46#include <linux/uaccess.h>
47#include <asm/unaligned.h> 47#include <asm/unaligned.h>
48 48
49#include <net/bluetooth/bluetooth.h> 49#include <net/bluetooth/bluetooth.h>
@@ -125,7 +125,8 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
125 continue; 125 continue;
126 } 126 }
127 127
128 if (!(nskb = skb_clone(skb, GFP_ATOMIC))) 128 nskb = skb_clone(skb, GFP_ATOMIC);
129 if (!nskb)
129 continue; 130 continue;
130 131
131 /* Put type byte before the data */ 132 /* Put type byte before the data */
@@ -370,7 +371,8 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le
370 } 371 }
371 372
372 if (haddr->hci_dev != HCI_DEV_NONE) { 373 if (haddr->hci_dev != HCI_DEV_NONE) {
373 if (!(hdev = hci_dev_get(haddr->hci_dev))) { 374 hdev = hci_dev_get(haddr->hci_dev);
375 if (!hdev) {
374 err = -ENODEV; 376 err = -ENODEV;
375 goto done; 377 goto done;
376 } 378 }
@@ -457,7 +459,8 @@ static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
457 if (sk->sk_state == BT_CLOSED) 459 if (sk->sk_state == BT_CLOSED)
458 return 0; 460 return 0;
459 461
460 if (!(skb = skb_recv_datagram(sk, flags, noblock, &err))) 462 skb = skb_recv_datagram(sk, flags, noblock, &err);
463 if (!skb)
461 return err; 464 return err;
462 465
463 msg->msg_namelen = 0; 466 msg->msg_namelen = 0;
@@ -499,7 +502,8 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
499 502
500 lock_sock(sk); 503 lock_sock(sk);
501 504
502 if (!(hdev = hci_pi(sk)->hdev)) { 505 hdev = hci_pi(sk)->hdev;
506 if (!hdev) {
503 err = -EBADFD; 507 err = -EBADFD;
504 goto done; 508 goto done;
505 } 509 }
@@ -509,7 +513,8 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
509 goto done; 513 goto done;
510 } 514 }
511 515
512 if (!(skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err))) 516 skb = bt_skb_send_alloc(sk, len, msg->msg_flags & MSG_DONTWAIT, &err);
517 if (!skb)
513 goto done; 518 goto done;
514 519
515 if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) { 520 if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) {
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index c0ee8b3928ed..29544c21f4b5 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -107,6 +107,7 @@ static void __hidp_unlink_session(struct hidp_session *session)
107 107
108static void __hidp_copy_session(struct hidp_session *session, struct hidp_conninfo *ci) 108static void __hidp_copy_session(struct hidp_session *session, struct hidp_conninfo *ci)
109{ 109{
110 memset(ci, 0, sizeof(*ci));
110 bacpy(&ci->bdaddr, &session->bdaddr); 111 bacpy(&ci->bdaddr, &session->bdaddr);
111 112
112 ci->flags = session->flags; 113 ci->flags = session->flags;
@@ -115,7 +116,6 @@ static void __hidp_copy_session(struct hidp_session *session, struct hidp_connin
115 ci->vendor = 0x0000; 116 ci->vendor = 0x0000;
116 ci->product = 0x0000; 117 ci->product = 0x0000;
117 ci->version = 0x0000; 118 ci->version = 0x0000;
118 memset(ci->name, 0, 128);
119 119
120 if (session->input) { 120 if (session->input) {
121 ci->vendor = session->input->id.vendor; 121 ci->vendor = session->input->id.vendor;
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index cd8f6ea03841..c12eccfdfe01 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -57,7 +57,7 @@
57 57
58#define VERSION "2.15" 58#define VERSION "2.15"
59 59
60static int disable_ertm = 0; 60static int disable_ertm;
61 61
62static u32 l2cap_feat_mask = L2CAP_FEAT_FIXED_CHAN; 62static u32 l2cap_feat_mask = L2CAP_FEAT_FIXED_CHAN;
63static u8 l2cap_fixed_chan[8] = { 0x02, }; 63static u8 l2cap_fixed_chan[8] = { 0x02, };
@@ -83,6 +83,18 @@ static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn,
83static int l2cap_ertm_data_rcv(struct sock *sk, struct sk_buff *skb); 83static int l2cap_ertm_data_rcv(struct sock *sk, struct sk_buff *skb);
84 84
85/* ---- L2CAP timers ---- */ 85/* ---- L2CAP timers ---- */
86static void l2cap_sock_set_timer(struct sock *sk, long timeout)
87{
88 BT_DBG("sk %p state %d timeout %ld", sk, sk->sk_state, timeout);
89 sk_reset_timer(sk, &sk->sk_timer, jiffies + timeout);
90}
91
92static void l2cap_sock_clear_timer(struct sock *sk)
93{
94 BT_DBG("sock %p state %d", sk, sk->sk_state);
95 sk_stop_timer(sk, &sk->sk_timer);
96}
97
86static void l2cap_sock_timeout(unsigned long arg) 98static void l2cap_sock_timeout(unsigned long arg)
87{ 99{
88 struct sock *sk = (struct sock *) arg; 100 struct sock *sk = (struct sock *) arg;
@@ -92,6 +104,14 @@ static void l2cap_sock_timeout(unsigned long arg)
92 104
93 bh_lock_sock(sk); 105 bh_lock_sock(sk);
94 106
107 if (sock_owned_by_user(sk)) {
108 /* sk is owned by user. Try again later */
109 l2cap_sock_set_timer(sk, HZ / 5);
110 bh_unlock_sock(sk);
111 sock_put(sk);
112 return;
113 }
114
95 if (sk->sk_state == BT_CONNECTED || sk->sk_state == BT_CONFIG) 115 if (sk->sk_state == BT_CONNECTED || sk->sk_state == BT_CONFIG)
96 reason = ECONNREFUSED; 116 reason = ECONNREFUSED;
97 else if (sk->sk_state == BT_CONNECT && 117 else if (sk->sk_state == BT_CONNECT &&
@@ -108,18 +128,6 @@ static void l2cap_sock_timeout(unsigned long arg)
108 sock_put(sk); 128 sock_put(sk);
109} 129}
110 130
111static void l2cap_sock_set_timer(struct sock *sk, long timeout)
112{
113 BT_DBG("sk %p state %d timeout %ld", sk, sk->sk_state, timeout);
114 sk_reset_timer(sk, &sk->sk_timer, jiffies + timeout);
115}
116
117static void l2cap_sock_clear_timer(struct sock *sk)
118{
119 BT_DBG("sock %p state %d", sk, sk->sk_state);
120 sk_stop_timer(sk, &sk->sk_timer);
121}
122
123/* ---- L2CAP channels ---- */ 131/* ---- L2CAP channels ---- */
124static struct sock *__l2cap_get_chan_by_dcid(struct l2cap_chan_list *l, u16 cid) 132static struct sock *__l2cap_get_chan_by_dcid(struct l2cap_chan_list *l, u16 cid)
125{ 133{
@@ -743,11 +751,13 @@ found:
743/* Find socket with psm and source bdaddr. 751/* Find socket with psm and source bdaddr.
744 * Returns closest match. 752 * Returns closest match.
745 */ 753 */
746static struct sock *__l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src) 754static struct sock *l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src)
747{ 755{
748 struct sock *sk = NULL, *sk1 = NULL; 756 struct sock *sk = NULL, *sk1 = NULL;
749 struct hlist_node *node; 757 struct hlist_node *node;
750 758
759 read_lock(&l2cap_sk_list.lock);
760
751 sk_for_each(sk, node, &l2cap_sk_list.head) { 761 sk_for_each(sk, node, &l2cap_sk_list.head) {
752 if (state && sk->sk_state != state) 762 if (state && sk->sk_state != state)
753 continue; 763 continue;
@@ -762,20 +772,10 @@ static struct sock *__l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src
762 sk1 = sk; 772 sk1 = sk;
763 } 773 }
764 } 774 }
765 return node ? sk : sk1;
766}
767 775
768/* Find socket with given address (psm, src).
769 * Returns locked socket */
770static inline struct sock *l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src)
771{
772 struct sock *s;
773 read_lock(&l2cap_sk_list.lock);
774 s = __l2cap_get_sock_by_psm(state, psm, src);
775 if (s)
776 bh_lock_sock(s);
777 read_unlock(&l2cap_sk_list.lock); 776 read_unlock(&l2cap_sk_list.lock);
778 return s; 777
778 return node ? sk : sk1;
779} 779}
780 780
781static void l2cap_sock_destruct(struct sock *sk) 781static void l2cap_sock_destruct(struct sock *sk)
@@ -2926,6 +2926,8 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd
2926 goto sendresp; 2926 goto sendresp;
2927 } 2927 }
2928 2928
2929 bh_lock_sock(parent);
2930
2929 /* Check if the ACL is secure enough (if not SDP) */ 2931 /* Check if the ACL is secure enough (if not SDP) */
2930 if (psm != cpu_to_le16(0x0001) && 2932 if (psm != cpu_to_le16(0x0001) &&
2931 !hci_conn_check_link_mode(conn->hcon)) { 2933 !hci_conn_check_link_mode(conn->hcon)) {
@@ -3078,6 +3080,14 @@ static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hd
3078 break; 3080 break;
3079 3081
3080 default: 3082 default:
3083 /* don't delete l2cap channel if sk is owned by user */
3084 if (sock_owned_by_user(sk)) {
3085 sk->sk_state = BT_DISCONN;
3086 l2cap_sock_clear_timer(sk);
3087 l2cap_sock_set_timer(sk, HZ / 5);
3088 break;
3089 }
3090
3081 l2cap_chan_del(sk, ECONNREFUSED); 3091 l2cap_chan_del(sk, ECONNREFUSED);
3082 break; 3092 break;
3083 } 3093 }
@@ -3283,6 +3293,15 @@ static inline int l2cap_disconnect_req(struct l2cap_conn *conn, struct l2cap_cmd
3283 3293
3284 sk->sk_shutdown = SHUTDOWN_MASK; 3294 sk->sk_shutdown = SHUTDOWN_MASK;
3285 3295
3296 /* don't delete l2cap channel if sk is owned by user */
3297 if (sock_owned_by_user(sk)) {
3298 sk->sk_state = BT_DISCONN;
3299 l2cap_sock_clear_timer(sk);
3300 l2cap_sock_set_timer(sk, HZ / 5);
3301 bh_unlock_sock(sk);
3302 return 0;
3303 }
3304
3286 l2cap_chan_del(sk, ECONNRESET); 3305 l2cap_chan_del(sk, ECONNRESET);
3287 bh_unlock_sock(sk); 3306 bh_unlock_sock(sk);
3288 3307
@@ -3305,6 +3324,15 @@ static inline int l2cap_disconnect_rsp(struct l2cap_conn *conn, struct l2cap_cmd
3305 if (!sk) 3324 if (!sk)
3306 return 0; 3325 return 0;
3307 3326
3327 /* don't delete l2cap channel if sk is owned by user */
3328 if (sock_owned_by_user(sk)) {
3329 sk->sk_state = BT_DISCONN;
3330 l2cap_sock_clear_timer(sk);
3331 l2cap_sock_set_timer(sk, HZ / 5);
3332 bh_unlock_sock(sk);
3333 return 0;
3334 }
3335
3308 l2cap_chan_del(sk, 0); 3336 l2cap_chan_del(sk, 0);
3309 bh_unlock_sock(sk); 3337 bh_unlock_sock(sk);
3310 3338
@@ -4134,11 +4162,10 @@ static inline void l2cap_data_channel_rrframe(struct sock *sk, u16 rx_control)
4134 __mod_retrans_timer(); 4162 __mod_retrans_timer();
4135 4163
4136 pi->conn_state &= ~L2CAP_CONN_REMOTE_BUSY; 4164 pi->conn_state &= ~L2CAP_CONN_REMOTE_BUSY;
4137 if (pi->conn_state & L2CAP_CONN_SREJ_SENT) { 4165 if (pi->conn_state & L2CAP_CONN_SREJ_SENT)
4138 l2cap_send_ack(pi); 4166 l2cap_send_ack(pi);
4139 } else { 4167 else
4140 l2cap_ertm_send(sk); 4168 l2cap_ertm_send(sk);
4141 }
4142 } 4169 }
4143} 4170}
4144 4171
@@ -4430,6 +4457,8 @@ static inline int l2cap_conless_channel(struct l2cap_conn *conn, __le16 psm, str
4430 if (!sk) 4457 if (!sk)
4431 goto drop; 4458 goto drop;
4432 4459
4460 bh_lock_sock(sk);
4461
4433 BT_DBG("sk %p, len %d", sk, skb->len); 4462 BT_DBG("sk %p, len %d", sk, skb->len);
4434 4463
4435 if (sk->sk_state != BT_BOUND && sk->sk_state != BT_CONNECTED) 4464 if (sk->sk_state != BT_BOUND && sk->sk_state != BT_CONNECTED)
@@ -4841,8 +4870,10 @@ static int __init l2cap_init(void)
4841 return err; 4870 return err;
4842 4871
4843 _busy_wq = create_singlethread_workqueue("l2cap"); 4872 _busy_wq = create_singlethread_workqueue("l2cap");
4844 if (!_busy_wq) 4873 if (!_busy_wq) {
4845 goto error; 4874 proto_unregister(&l2cap_proto);
4875 return -ENOMEM;
4876 }
4846 4877
4847 err = bt_sock_register(BTPROTO_L2CAP, &l2cap_sock_family_ops); 4878 err = bt_sock_register(BTPROTO_L2CAP, &l2cap_sock_family_ops);
4848 if (err < 0) { 4879 if (err < 0) {
@@ -4870,6 +4901,7 @@ static int __init l2cap_init(void)
4870 return 0; 4901 return 0;
4871 4902
4872error: 4903error:
4904 destroy_workqueue(_busy_wq);
4873 proto_unregister(&l2cap_proto); 4905 proto_unregister(&l2cap_proto);
4874 return err; 4906 return err;
4875} 4907}
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index fa642aa652bd..c1e2bbafb549 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -41,7 +41,7 @@
41#include <linux/slab.h> 41#include <linux/slab.h>
42 42
43#include <net/sock.h> 43#include <net/sock.h>
44#include <asm/uaccess.h> 44#include <linux/uaccess.h>
45#include <asm/unaligned.h> 45#include <asm/unaligned.h>
46 46
47#include <net/bluetooth/bluetooth.h> 47#include <net/bluetooth/bluetooth.h>
@@ -51,10 +51,10 @@
51 51
52#define VERSION "1.11" 52#define VERSION "1.11"
53 53
54static int disable_cfc = 0; 54static int disable_cfc;
55static int l2cap_ertm;
55static int channel_mtu = -1; 56static int channel_mtu = -1;
56static unsigned int l2cap_mtu = RFCOMM_MAX_L2CAP_MTU; 57static unsigned int l2cap_mtu = RFCOMM_MAX_L2CAP_MTU;
57static int l2cap_ertm = 0;
58 58
59static struct task_struct *rfcomm_thread; 59static struct task_struct *rfcomm_thread;
60 60
@@ -1901,7 +1901,7 @@ static inline void rfcomm_check_connection(struct rfcomm_session *s)
1901 1901
1902 BT_DBG("%p state %ld", s, s->state); 1902 BT_DBG("%p state %ld", s, s->state);
1903 1903
1904 switch(sk->sk_state) { 1904 switch (sk->sk_state) {
1905 case BT_CONNECTED: 1905 case BT_CONNECTED:
1906 s->state = BT_CONNECT; 1906 s->state = BT_CONNECT;
1907 1907
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index aec505f934df..66cc1f0c3df8 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -45,7 +45,7 @@
45#include <net/sock.h> 45#include <net/sock.h>
46 46
47#include <asm/system.h> 47#include <asm/system.h>
48#include <asm/uaccess.h> 48#include <linux/uaccess.h>
49 49
50#include <net/bluetooth/bluetooth.h> 50#include <net/bluetooth/bluetooth.h>
51#include <net/bluetooth/hci_core.h> 51#include <net/bluetooth/hci_core.h>
@@ -140,11 +140,13 @@ static struct sock *__rfcomm_get_sock_by_addr(u8 channel, bdaddr_t *src)
140/* Find socket with channel and source bdaddr. 140/* Find socket with channel and source bdaddr.
141 * Returns closest match. 141 * Returns closest match.
142 */ 142 */
143static struct sock *__rfcomm_get_sock_by_channel(int state, u8 channel, bdaddr_t *src) 143static struct sock *rfcomm_get_sock_by_channel(int state, u8 channel, bdaddr_t *src)
144{ 144{
145 struct sock *sk = NULL, *sk1 = NULL; 145 struct sock *sk = NULL, *sk1 = NULL;
146 struct hlist_node *node; 146 struct hlist_node *node;
147 147
148 read_lock(&rfcomm_sk_list.lock);
149
148 sk_for_each(sk, node, &rfcomm_sk_list.head) { 150 sk_for_each(sk, node, &rfcomm_sk_list.head) {
149 if (state && sk->sk_state != state) 151 if (state && sk->sk_state != state)
150 continue; 152 continue;
@@ -159,19 +161,10 @@ static struct sock *__rfcomm_get_sock_by_channel(int state, u8 channel, bdaddr_t
159 sk1 = sk; 161 sk1 = sk;
160 } 162 }
161 } 163 }
162 return node ? sk : sk1;
163}
164 164
165/* Find socket with given address (channel, src).
166 * Returns locked socket */
167static inline struct sock *rfcomm_get_sock_by_channel(int state, u8 channel, bdaddr_t *src)
168{
169 struct sock *s;
170 read_lock(&rfcomm_sk_list.lock);
171 s = __rfcomm_get_sock_by_channel(state, channel, src);
172 if (s) bh_lock_sock(s);
173 read_unlock(&rfcomm_sk_list.lock); 165 read_unlock(&rfcomm_sk_list.lock);
174 return s; 166
167 return node ? sk : sk1;
175} 168}
176 169
177static void rfcomm_sock_destruct(struct sock *sk) 170static void rfcomm_sock_destruct(struct sock *sk)
@@ -895,7 +888,8 @@ static int rfcomm_sock_shutdown(struct socket *sock, int how)
895 888
896 BT_DBG("sock %p, sk %p", sock, sk); 889 BT_DBG("sock %p, sk %p", sock, sk);
897 890
898 if (!sk) return 0; 891 if (!sk)
892 return 0;
899 893
900 lock_sock(sk); 894 lock_sock(sk);
901 if (!sk->sk_shutdown) { 895 if (!sk->sk_shutdown) {
@@ -945,6 +939,8 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc *
945 if (!parent) 939 if (!parent)
946 return 0; 940 return 0;
947 941
942 bh_lock_sock(parent);
943
948 /* Check for backlog size */ 944 /* Check for backlog size */
949 if (sk_acceptq_is_full(parent)) { 945 if (sk_acceptq_is_full(parent)) {
950 BT_DBG("backlog full %d", parent->sk_ack_backlog); 946 BT_DBG("backlog full %d", parent->sk_ack_backlog);
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index a9b81f5dacd1..2575c2db6404 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -58,9 +58,9 @@ struct rfcomm_dev {
58 58
59 bdaddr_t src; 59 bdaddr_t src;
60 bdaddr_t dst; 60 bdaddr_t dst;
61 u8 channel; 61 u8 channel;
62 62
63 uint modem_status; 63 uint modem_status;
64 64
65 struct rfcomm_dlc *dlc; 65 struct rfcomm_dlc *dlc;
66 struct tty_struct *tty; 66 struct tty_struct *tty;
@@ -69,7 +69,7 @@ struct rfcomm_dev {
69 69
70 struct device *tty_dev; 70 struct device *tty_dev;
71 71
72 atomic_t wmem_alloc; 72 atomic_t wmem_alloc;
73 73
74 struct sk_buff_head pending; 74 struct sk_buff_head pending;
75}; 75};
@@ -431,7 +431,8 @@ static int rfcomm_release_dev(void __user *arg)
431 431
432 BT_DBG("dev_id %d flags 0x%x", req.dev_id, req.flags); 432 BT_DBG("dev_id %d flags 0x%x", req.dev_id, req.flags);
433 433
434 if (!(dev = rfcomm_dev_get(req.dev_id))) 434 dev = rfcomm_dev_get(req.dev_id);
435 if (!dev)
435 return -ENODEV; 436 return -ENODEV;
436 437
437 if (dev->flags != NOCAP_FLAGS && !capable(CAP_NET_ADMIN)) { 438 if (dev->flags != NOCAP_FLAGS && !capable(CAP_NET_ADMIN)) {
@@ -470,7 +471,8 @@ static int rfcomm_get_dev_list(void __user *arg)
470 471
471 size = sizeof(*dl) + dev_num * sizeof(*di); 472 size = sizeof(*dl) + dev_num * sizeof(*di);
472 473
473 if (!(dl = kmalloc(size, GFP_KERNEL))) 474 dl = kmalloc(size, GFP_KERNEL);
475 if (!dl)
474 return -ENOMEM; 476 return -ENOMEM;
475 477
476 di = dl->dev_info; 478 di = dl->dev_info;
@@ -513,7 +515,8 @@ static int rfcomm_get_dev_info(void __user *arg)
513 if (copy_from_user(&di, arg, sizeof(di))) 515 if (copy_from_user(&di, arg, sizeof(di)))
514 return -EFAULT; 516 return -EFAULT;
515 517
516 if (!(dev = rfcomm_dev_get(di.id))) 518 dev = rfcomm_dev_get(di.id);
519 if (!dev)
517 return -ENODEV; 520 return -ENODEV;
518 521
519 di.flags = dev->flags; 522 di.flags = dev->flags;
@@ -561,7 +564,8 @@ static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb)
561 return; 564 return;
562 } 565 }
563 566
564 if (!(tty = dev->tty) || !skb_queue_empty(&dev->pending)) { 567 tty = dev->tty;
568 if (!tty || !skb_queue_empty(&dev->pending)) {
565 skb_queue_tail(&dev->pending, skb); 569 skb_queue_tail(&dev->pending, skb);
566 return; 570 return;
567 } 571 }
@@ -796,7 +800,8 @@ static int rfcomm_tty_write(struct tty_struct *tty, const unsigned char *buf, in
796 800
797 memcpy(skb_put(skb, size), buf + sent, size); 801 memcpy(skb_put(skb, size), buf + sent, size);
798 802
799 if ((err = rfcomm_dlc_send(dlc, skb)) < 0) { 803 err = rfcomm_dlc_send(dlc, skb);
804 if (err < 0) {
800 kfree_skb(skb); 805 kfree_skb(skb);
801 break; 806 break;
802 } 807 }
@@ -892,7 +897,7 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
892 897
893 /* Parity on/off and when on, odd/even */ 898 /* Parity on/off and when on, odd/even */
894 if (((old->c_cflag & PARENB) != (new->c_cflag & PARENB)) || 899 if (((old->c_cflag & PARENB) != (new->c_cflag & PARENB)) ||
895 ((old->c_cflag & PARODD) != (new->c_cflag & PARODD)) ) { 900 ((old->c_cflag & PARODD) != (new->c_cflag & PARODD))) {
896 changes |= RFCOMM_RPN_PM_PARITY; 901 changes |= RFCOMM_RPN_PM_PARITY;
897 BT_DBG("Parity change detected."); 902 BT_DBG("Parity change detected.");
898 } 903 }
@@ -937,11 +942,10 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
937 /* POSIX does not support 1.5 stop bits and RFCOMM does not 942 /* POSIX does not support 1.5 stop bits and RFCOMM does not
938 * support 2 stop bits. So a request for 2 stop bits gets 943 * support 2 stop bits. So a request for 2 stop bits gets
939 * translated to 1.5 stop bits */ 944 * translated to 1.5 stop bits */
940 if (new->c_cflag & CSTOPB) { 945 if (new->c_cflag & CSTOPB)
941 stop_bits = RFCOMM_RPN_STOP_15; 946 stop_bits = RFCOMM_RPN_STOP_15;
942 } else { 947 else
943 stop_bits = RFCOMM_RPN_STOP_1; 948 stop_bits = RFCOMM_RPN_STOP_1;
944 }
945 949
946 /* Handle number of data bits [5-8] */ 950 /* Handle number of data bits [5-8] */
947 if ((old->c_cflag & CSIZE) != (new->c_cflag & CSIZE)) 951 if ((old->c_cflag & CSIZE) != (new->c_cflag & CSIZE))
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 66b9e5c0523a..960c6d1637da 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -44,7 +44,7 @@
44#include <net/sock.h> 44#include <net/sock.h>
45 45
46#include <asm/system.h> 46#include <asm/system.h>
47#include <asm/uaccess.h> 47#include <linux/uaccess.h>
48 48
49#include <net/bluetooth/bluetooth.h> 49#include <net/bluetooth/bluetooth.h>
50#include <net/bluetooth/hci_core.h> 50#include <net/bluetooth/hci_core.h>
@@ -52,7 +52,7 @@
52 52
53#define VERSION "0.6" 53#define VERSION "0.6"
54 54
55static int disable_esco = 0; 55static int disable_esco;
56 56
57static const struct proto_ops sco_sock_ops; 57static const struct proto_ops sco_sock_ops;
58 58
@@ -138,16 +138,17 @@ static inline struct sock *sco_chan_get(struct sco_conn *conn)
138 138
139static int sco_conn_del(struct hci_conn *hcon, int err) 139static int sco_conn_del(struct hci_conn *hcon, int err)
140{ 140{
141 struct sco_conn *conn; 141 struct sco_conn *conn = hcon->sco_data;
142 struct sock *sk; 142 struct sock *sk;
143 143
144 if (!(conn = hcon->sco_data)) 144 if (!conn)
145 return 0; 145 return 0;
146 146
147 BT_DBG("hcon %p conn %p, err %d", hcon, conn, err); 147 BT_DBG("hcon %p conn %p, err %d", hcon, conn, err);
148 148
149 /* Kill socket */ 149 /* Kill socket */
150 if ((sk = sco_chan_get(conn))) { 150 sk = sco_chan_get(conn);
151 if (sk) {
151 bh_lock_sock(sk); 152 bh_lock_sock(sk);
152 sco_sock_clear_timer(sk); 153 sco_sock_clear_timer(sk);
153 sco_chan_del(sk, err); 154 sco_chan_del(sk, err);
@@ -185,7 +186,8 @@ static int sco_connect(struct sock *sk)
185 186
186 BT_DBG("%s -> %s", batostr(src), batostr(dst)); 187 BT_DBG("%s -> %s", batostr(src), batostr(dst));
187 188
188 if (!(hdev = hci_get_route(dst, src))) 189 hdev = hci_get_route(dst, src);
190 if (!hdev)
189 return -EHOSTUNREACH; 191 return -EHOSTUNREACH;
190 192
191 hci_dev_lock_bh(hdev); 193 hci_dev_lock_bh(hdev);
@@ -510,7 +512,8 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen
510 /* Set destination address and psm */ 512 /* Set destination address and psm */
511 bacpy(&bt_sk(sk)->dst, &sa->sco_bdaddr); 513 bacpy(&bt_sk(sk)->dst, &sa->sco_bdaddr);
512 514
513 if ((err = sco_connect(sk))) 515 err = sco_connect(sk);
516 if (err)
514 goto done; 517 goto done;
515 518
516 err = bt_sock_wait_state(sk, BT_CONNECTED, 519 err = bt_sock_wait_state(sk, BT_CONNECTED,
@@ -828,13 +831,14 @@ static void sco_chan_del(struct sock *sk, int err)
828 831
829static void sco_conn_ready(struct sco_conn *conn) 832static void sco_conn_ready(struct sco_conn *conn)
830{ 833{
831 struct sock *parent, *sk; 834 struct sock *parent;
835 struct sock *sk = conn->sk;
832 836
833 BT_DBG("conn %p", conn); 837 BT_DBG("conn %p", conn);
834 838
835 sco_conn_lock(conn); 839 sco_conn_lock(conn);
836 840
837 if ((sk = conn->sk)) { 841 if (sk) {
838 sco_sock_clear_timer(sk); 842 sco_sock_clear_timer(sk);
839 bh_lock_sock(sk); 843 bh_lock_sock(sk);
840 sk->sk_state = BT_CONNECTED; 844 sk->sk_state = BT_CONNECTED;
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index 720b7a84af59..f138b195d657 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -129,9 +129,7 @@ static void sta_rx_agg_reorder_timer_expired(unsigned long data)
129 timer_to_tid[0]); 129 timer_to_tid[0]);
130 130
131 rcu_read_lock(); 131 rcu_read_lock();
132 spin_lock(&sta->lock);
133 ieee80211_release_reorder_timeout(sta, *ptid); 132 ieee80211_release_reorder_timeout(sta, *ptid);
134 spin_unlock(&sta->lock);
135 rcu_read_unlock(); 133 rcu_read_unlock();
136} 134}
137 135
@@ -256,7 +254,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
256 } 254 }
257 255
258 /* prepare A-MPDU MLME for Rx aggregation */ 256 /* prepare A-MPDU MLME for Rx aggregation */
259 tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_ATOMIC); 257 tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL);
260 if (!tid_agg_rx) { 258 if (!tid_agg_rx) {
261#ifdef CONFIG_MAC80211_HT_DEBUG 259#ifdef CONFIG_MAC80211_HT_DEBUG
262 if (net_ratelimit()) 260 if (net_ratelimit())
@@ -280,9 +278,9 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
280 278
281 /* prepare reordering buffer */ 279 /* prepare reordering buffer */
282 tid_agg_rx->reorder_buf = 280 tid_agg_rx->reorder_buf =
283 kcalloc(buf_size, sizeof(struct sk_buff *), GFP_ATOMIC); 281 kcalloc(buf_size, sizeof(struct sk_buff *), GFP_KERNEL);
284 tid_agg_rx->reorder_time = 282 tid_agg_rx->reorder_time =
285 kcalloc(buf_size, sizeof(unsigned long), GFP_ATOMIC); 283 kcalloc(buf_size, sizeof(unsigned long), GFP_KERNEL);
286 if (!tid_agg_rx->reorder_buf || !tid_agg_rx->reorder_time) { 284 if (!tid_agg_rx->reorder_buf || !tid_agg_rx->reorder_time) {
287#ifdef CONFIG_MAC80211_HT_DEBUG 285#ifdef CONFIG_MAC80211_HT_DEBUG
288 if (net_ratelimit()) 286 if (net_ratelimit())
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 0c544074479e..db134b500caa 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1551,27 +1551,54 @@ static int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy,
1551 return ieee80211_wk_cancel_remain_on_channel(sdata, cookie); 1551 return ieee80211_wk_cancel_remain_on_channel(sdata, cookie);
1552} 1552}
1553 1553
1554static enum work_done_result
1555ieee80211_offchan_tx_done(struct ieee80211_work *wk, struct sk_buff *skb)
1556{
1557 /*
1558 * Use the data embedded in the work struct for reporting
1559 * here so if the driver mangled the SKB before dropping
1560 * it (which is the only way we really should get here)
1561 * then we don't report mangled data.
1562 *
1563 * If there was no wait time, then by the time we get here
1564 * the driver will likely not have reported the status yet,
1565 * so in that case userspace will have to deal with it.
1566 */
1567
1568 if (wk->offchan_tx.wait && wk->offchan_tx.frame)
1569 cfg80211_mgmt_tx_status(wk->sdata->dev,
1570 (unsigned long) wk->offchan_tx.frame,
1571 wk->ie, wk->ie_len, false, GFP_KERNEL);
1572
1573 return WORK_DONE_DESTROY;
1574}
1575
1554static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev, 1576static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev,
1555 struct ieee80211_channel *chan, 1577 struct ieee80211_channel *chan, bool offchan,
1556 enum nl80211_channel_type channel_type, 1578 enum nl80211_channel_type channel_type,
1557 bool channel_type_valid, 1579 bool channel_type_valid, unsigned int wait,
1558 const u8 *buf, size_t len, u64 *cookie) 1580 const u8 *buf, size_t len, u64 *cookie)
1559{ 1581{
1560 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1582 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1561 struct ieee80211_local *local = sdata->local; 1583 struct ieee80211_local *local = sdata->local;
1562 struct sk_buff *skb; 1584 struct sk_buff *skb;
1563 struct sta_info *sta; 1585 struct sta_info *sta;
1586 struct ieee80211_work *wk;
1564 const struct ieee80211_mgmt *mgmt = (void *)buf; 1587 const struct ieee80211_mgmt *mgmt = (void *)buf;
1565 u32 flags = IEEE80211_TX_INTFL_NL80211_FRAME_TX | 1588 u32 flags = IEEE80211_TX_INTFL_NL80211_FRAME_TX |
1566 IEEE80211_TX_CTL_REQ_TX_STATUS; 1589 IEEE80211_TX_CTL_REQ_TX_STATUS;
1590 bool is_offchan = false;
1567 1591
1568 /* Check that we are on the requested channel for transmission */ 1592 /* Check that we are on the requested channel for transmission */
1569 if (chan != local->tmp_channel && 1593 if (chan != local->tmp_channel &&
1570 chan != local->oper_channel) 1594 chan != local->oper_channel)
1571 return -EBUSY; 1595 is_offchan = true;
1572 if (channel_type_valid && 1596 if (channel_type_valid &&
1573 (channel_type != local->tmp_channel_type && 1597 (channel_type != local->tmp_channel_type &&
1574 channel_type != local->_oper_channel_type)) 1598 channel_type != local->_oper_channel_type))
1599 is_offchan = true;
1600
1601 if (is_offchan && !offchan)
1575 return -EBUSY; 1602 return -EBUSY;
1576 1603
1577 switch (sdata->vif.type) { 1604 switch (sdata->vif.type) {
@@ -1605,12 +1632,70 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev,
1605 IEEE80211_SKB_CB(skb)->flags = flags; 1632 IEEE80211_SKB_CB(skb)->flags = flags;
1606 1633
1607 skb->dev = sdata->dev; 1634 skb->dev = sdata->dev;
1608 ieee80211_tx_skb(sdata, skb);
1609 1635
1610 *cookie = (unsigned long) skb; 1636 *cookie = (unsigned long) skb;
1637
1638 /*
1639 * Can transmit right away if the channel was the
1640 * right one and there's no wait involved... If a
1641 * wait is involved, we might otherwise not be on
1642 * the right channel for long enough!
1643 */
1644 if (!is_offchan && !wait && !sdata->vif.bss_conf.idle) {
1645 ieee80211_tx_skb(sdata, skb);
1646 return 0;
1647 }
1648
1649 wk = kzalloc(sizeof(*wk) + len, GFP_KERNEL);
1650 if (!wk) {
1651 kfree_skb(skb);
1652 return -ENOMEM;
1653 }
1654
1655 wk->type = IEEE80211_WORK_OFFCHANNEL_TX;
1656 wk->chan = chan;
1657 wk->sdata = sdata;
1658 wk->done = ieee80211_offchan_tx_done;
1659 wk->offchan_tx.frame = skb;
1660 wk->offchan_tx.wait = wait;
1661 wk->ie_len = len;
1662 memcpy(wk->ie, buf, len);
1663
1664 ieee80211_add_work(wk);
1611 return 0; 1665 return 0;
1612} 1666}
1613 1667
1668static int ieee80211_mgmt_tx_cancel_wait(struct wiphy *wiphy,
1669 struct net_device *dev,
1670 u64 cookie)
1671{
1672 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1673 struct ieee80211_local *local = sdata->local;
1674 struct ieee80211_work *wk;
1675 int ret = -ENOENT;
1676
1677 mutex_lock(&local->mtx);
1678 list_for_each_entry(wk, &local->work_list, list) {
1679 if (wk->sdata != sdata)
1680 continue;
1681
1682 if (wk->type != IEEE80211_WORK_OFFCHANNEL_TX)
1683 continue;
1684
1685 if (cookie != (unsigned long) wk->offchan_tx.frame)
1686 continue;
1687
1688 wk->timeout = jiffies;
1689
1690 ieee80211_queue_work(&local->hw, &local->work_work);
1691 ret = 0;
1692 break;
1693 }
1694 mutex_unlock(&local->mtx);
1695
1696 return ret;
1697}
1698
1614static void ieee80211_mgmt_frame_register(struct wiphy *wiphy, 1699static void ieee80211_mgmt_frame_register(struct wiphy *wiphy,
1615 struct net_device *dev, 1700 struct net_device *dev,
1616 u16 frame_type, bool reg) 1701 u16 frame_type, bool reg)
@@ -1695,6 +1780,7 @@ struct cfg80211_ops mac80211_config_ops = {
1695 .remain_on_channel = ieee80211_remain_on_channel, 1780 .remain_on_channel = ieee80211_remain_on_channel,
1696 .cancel_remain_on_channel = ieee80211_cancel_remain_on_channel, 1781 .cancel_remain_on_channel = ieee80211_cancel_remain_on_channel,
1697 .mgmt_tx = ieee80211_mgmt_tx, 1782 .mgmt_tx = ieee80211_mgmt_tx,
1783 .mgmt_tx_cancel_wait = ieee80211_mgmt_tx_cancel_wait,
1698 .set_cqm_rssi_config = ieee80211_set_cqm_rssi_config, 1784 .set_cqm_rssi_config = ieee80211_set_cqm_rssi_config,
1699 .mgmt_frame_register = ieee80211_mgmt_frame_register, 1785 .mgmt_frame_register = ieee80211_mgmt_frame_register,
1700 .set_antenna = ieee80211_set_antenna, 1786 .set_antenna = ieee80211_set_antenna,
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index f0fce37f4069..8bb5af85f469 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -112,34 +112,35 @@ static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf,
112 char buf[71 + STA_TID_NUM * 40], *p = buf; 112 char buf[71 + STA_TID_NUM * 40], *p = buf;
113 int i; 113 int i;
114 struct sta_info *sta = file->private_data; 114 struct sta_info *sta = file->private_data;
115 struct tid_ampdu_rx *tid_rx;
116 struct tid_ampdu_tx *tid_tx;
117
118 rcu_read_lock();
115 119
116 spin_lock_bh(&sta->lock);
117 p += scnprintf(p, sizeof(buf) + buf - p, "next dialog_token: %#02x\n", 120 p += scnprintf(p, sizeof(buf) + buf - p, "next dialog_token: %#02x\n",
118 sta->ampdu_mlme.dialog_token_allocator + 1); 121 sta->ampdu_mlme.dialog_token_allocator + 1);
119 p += scnprintf(p, sizeof(buf) + buf - p, 122 p += scnprintf(p, sizeof(buf) + buf - p,
120 "TID\t\tRX active\tDTKN\tSSN\t\tTX\tDTKN\tpending\n"); 123 "TID\t\tRX active\tDTKN\tSSN\t\tTX\tDTKN\tpending\n");
124
121 for (i = 0; i < STA_TID_NUM; i++) { 125 for (i = 0; i < STA_TID_NUM; i++) {
126 tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[i]);
127 tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[i]);
128
122 p += scnprintf(p, sizeof(buf) + buf - p, "%02d", i); 129 p += scnprintf(p, sizeof(buf) + buf - p, "%02d", i);
123 p += scnprintf(p, sizeof(buf) + buf - p, "\t\t%x", 130 p += scnprintf(p, sizeof(buf) + buf - p, "\t\t%x", !!tid_rx);
124 !!sta->ampdu_mlme.tid_rx[i]);
125 p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.2x", 131 p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.2x",
126 sta->ampdu_mlme.tid_rx[i] ? 132 tid_rx ? tid_rx->dialog_token : 0);
127 sta->ampdu_mlme.tid_rx[i]->dialog_token : 0);
128 p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.3x", 133 p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.3x",
129 sta->ampdu_mlme.tid_rx[i] ? 134 tid_rx ? tid_rx->ssn : 0);
130 sta->ampdu_mlme.tid_rx[i]->ssn : 0);
131 135
132 p += scnprintf(p, sizeof(buf) + buf - p, "\t\t%x", 136 p += scnprintf(p, sizeof(buf) + buf - p, "\t\t%x", !!tid_tx);
133 !!sta->ampdu_mlme.tid_tx[i]);
134 p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.2x", 137 p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.2x",
135 sta->ampdu_mlme.tid_tx[i] ? 138 tid_tx ? tid_tx->dialog_token : 0);
136 sta->ampdu_mlme.tid_tx[i]->dialog_token : 0);
137 p += scnprintf(p, sizeof(buf) + buf - p, "\t%03d", 139 p += scnprintf(p, sizeof(buf) + buf - p, "\t%03d",
138 sta->ampdu_mlme.tid_tx[i] ? 140 tid_tx ? skb_queue_len(&tid_tx->pending) : 0);
139 skb_queue_len(&sta->ampdu_mlme.tid_tx[i]->pending) : 0);
140 p += scnprintf(p, sizeof(buf) + buf - p, "\n"); 141 p += scnprintf(p, sizeof(buf) + buf - p, "\n");
141 } 142 }
142 spin_unlock_bh(&sta->lock); 143 rcu_read_unlock();
143 144
144 return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); 145 return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf);
145} 146}
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 5bc0745368fe..66b0b52b828d 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -260,6 +260,7 @@ enum ieee80211_work_type {
260 IEEE80211_WORK_ASSOC_BEACON_WAIT, 260 IEEE80211_WORK_ASSOC_BEACON_WAIT,
261 IEEE80211_WORK_ASSOC, 261 IEEE80211_WORK_ASSOC,
262 IEEE80211_WORK_REMAIN_ON_CHANNEL, 262 IEEE80211_WORK_REMAIN_ON_CHANNEL,
263 IEEE80211_WORK_OFFCHANNEL_TX,
263}; 264};
264 265
265/** 266/**
@@ -320,6 +321,10 @@ struct ieee80211_work {
320 struct { 321 struct {
321 u32 duration; 322 u32 duration;
322 } remain; 323 } remain;
324 struct {
325 struct sk_buff *frame;
326 u32 wait;
327 } offchan_tx;
323 }; 328 };
324 329
325 int ie_len; 330 int ie_len;
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 55337709de41..6289525c0998 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -538,6 +538,8 @@ static void ieee80211_release_reorder_frame(struct ieee80211_hw *hw,
538{ 538{
539 struct sk_buff *skb = tid_agg_rx->reorder_buf[index]; 539 struct sk_buff *skb = tid_agg_rx->reorder_buf[index];
540 540
541 lockdep_assert_held(&tid_agg_rx->reorder_lock);
542
541 if (!skb) 543 if (!skb)
542 goto no_frame; 544 goto no_frame;
543 545
@@ -557,6 +559,8 @@ static void ieee80211_release_reorder_frames(struct ieee80211_hw *hw,
557{ 559{
558 int index; 560 int index;
559 561
562 lockdep_assert_held(&tid_agg_rx->reorder_lock);
563
560 while (seq_less(tid_agg_rx->head_seq_num, head_seq_num)) { 564 while (seq_less(tid_agg_rx->head_seq_num, head_seq_num)) {
561 index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) % 565 index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) %
562 tid_agg_rx->buf_size; 566 tid_agg_rx->buf_size;
@@ -581,6 +585,8 @@ static void ieee80211_sta_reorder_release(struct ieee80211_hw *hw,
581{ 585{
582 int index, j; 586 int index, j;
583 587
588 lockdep_assert_held(&tid_agg_rx->reorder_lock);
589
584 /* release the buffer until next missing frame */ 590 /* release the buffer until next missing frame */
585 index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) % 591 index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) %
586 tid_agg_rx->buf_size; 592 tid_agg_rx->buf_size;
@@ -683,10 +689,11 @@ static bool ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
683 int index; 689 int index;
684 bool ret = true; 690 bool ret = true;
685 691
692 spin_lock(&tid_agg_rx->reorder_lock);
693
686 buf_size = tid_agg_rx->buf_size; 694 buf_size = tid_agg_rx->buf_size;
687 head_seq_num = tid_agg_rx->head_seq_num; 695 head_seq_num = tid_agg_rx->head_seq_num;
688 696
689 spin_lock(&tid_agg_rx->reorder_lock);
690 /* frame with out of date sequence number */ 697 /* frame with out of date sequence number */
691 if (seq_less(mpdu_seq_num, head_seq_num)) { 698 if (seq_less(mpdu_seq_num, head_seq_num)) {
692 dev_kfree_skb(skb); 699 dev_kfree_skb(skb);
@@ -1870,9 +1877,8 @@ ieee80211_rx_h_data(struct ieee80211_rx_data *rx)
1870 dev->stats.rx_packets++; 1877 dev->stats.rx_packets++;
1871 dev->stats.rx_bytes += rx->skb->len; 1878 dev->stats.rx_bytes += rx->skb->len;
1872 1879
1873 if (ieee80211_is_data(hdr->frame_control) && 1880 if (local->ps_sdata && local->hw.conf.dynamic_ps_timeout > 0 &&
1874 !is_multicast_ether_addr(hdr->addr1) && 1881 !is_multicast_ether_addr(((struct ethhdr *)rx->skb->data)->h_dest)) {
1875 local->hw.conf.dynamic_ps_timeout > 0 && local->ps_sdata) {
1876 mod_timer(&local->dynamic_ps_timer, jiffies + 1882 mod_timer(&local->dynamic_ps_timer, jiffies +
1877 msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout)); 1883 msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout));
1878 } 1884 }
@@ -1921,9 +1927,12 @@ ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx, struct sk_buff_head *frames)
1921 mod_timer(&tid_agg_rx->session_timer, 1927 mod_timer(&tid_agg_rx->session_timer,
1922 TU_TO_EXP_TIME(tid_agg_rx->timeout)); 1928 TU_TO_EXP_TIME(tid_agg_rx->timeout));
1923 1929
1930 spin_lock(&tid_agg_rx->reorder_lock);
1924 /* release stored frames up to start of BAR */ 1931 /* release stored frames up to start of BAR */
1925 ieee80211_release_reorder_frames(hw, tid_agg_rx, start_seq_num, 1932 ieee80211_release_reorder_frames(hw, tid_agg_rx, start_seq_num,
1926 frames); 1933 frames);
1934 spin_unlock(&tid_agg_rx->reorder_lock);
1935
1927 kfree_skb(skb); 1936 kfree_skb(skb);
1928 return RX_QUEUED; 1937 return RX_QUEUED;
1929 } 1938 }
@@ -2519,9 +2528,8 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_data *rx)
2519} 2528}
2520 2529
2521/* 2530/*
2522 * This function makes calls into the RX path. Therefore the 2531 * This function makes calls into the RX path, therefore
2523 * caller must hold the sta_info->lock and everything has to 2532 * it has to be invoked under RCU read lock.
2524 * be under rcu_read_lock protection as well.
2525 */ 2533 */
2526void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid) 2534void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid)
2527{ 2535{
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index b562d9b6a702..05f11302443b 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -81,13 +81,14 @@ enum ieee80211_sta_info_flags {
81 * @stop_initiator: initiator of a session stop 81 * @stop_initiator: initiator of a session stop
82 * @tx_stop: TX DelBA frame when stopping 82 * @tx_stop: TX DelBA frame when stopping
83 * 83 *
84 * This structure is protected by RCU and the per-station 84 * This structure's lifetime is managed by RCU, assignments to
85 * spinlock. Assignments to the array holding it must hold 85 * the array holding it must hold the aggregation mutex.
86 * the spinlock, only the TX path can access it under RCU 86 *
87 * lock-free if, and only if, the state has the flag 87 * The TX path can access it under RCU lock-free if, and
88 * %HT_AGG_STATE_OPERATIONAL set. Otherwise, the TX path 88 * only if, the state has the flag %HT_AGG_STATE_OPERATIONAL
89 * must also acquire the spinlock and re-check the state, 89 * set. Otherwise, the TX path must also acquire the spinlock
90 * see comments in the tx code touching it. 90 * and re-check the state, see comments in the tx code
91 * touching it.
91 */ 92 */
92struct tid_ampdu_tx { 93struct tid_ampdu_tx {
93 struct rcu_head rcu_head; 94 struct rcu_head rcu_head;
@@ -115,15 +116,13 @@ struct tid_ampdu_tx {
115 * @rcu_head: RCU head used for freeing this struct 116 * @rcu_head: RCU head used for freeing this struct
116 * @reorder_lock: serializes access to reorder buffer, see below. 117 * @reorder_lock: serializes access to reorder buffer, see below.
117 * 118 *
118 * This structure is protected by RCU and the per-station 119 * This structure's lifetime is managed by RCU, assignments to
119 * spinlock. Assignments to the array holding it must hold 120 * the array holding it must hold the aggregation mutex.
120 * the spinlock.
121 * 121 *
122 * The @reorder_lock is used to protect the variables and 122 * The @reorder_lock is used to protect the members of this
123 * arrays such as @reorder_buf, @reorder_time, @head_seq_num, 123 * struct, except for @timeout, @buf_size and @dialog_token,
124 * @stored_mpdu_num and @reorder_time from being corrupted by 124 * which are constant across the lifetime of the struct (the
125 * concurrent access of the RX path and the expired frame 125 * dialog token being used only for debugging).
126 * release timer.
127 */ 126 */
128struct tid_ampdu_rx { 127struct tid_ampdu_rx {
129 struct rcu_head rcu_head; 128 struct rcu_head rcu_head;
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index bed7e32ed908..4958710a7d92 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -321,10 +321,23 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
321 msecs_to_jiffies(10)); 321 msecs_to_jiffies(10));
322 } 322 }
323 323
324 if (info->flags & IEEE80211_TX_INTFL_NL80211_FRAME_TX) 324 if (info->flags & IEEE80211_TX_INTFL_NL80211_FRAME_TX) {
325 struct ieee80211_work *wk;
326
327 rcu_read_lock();
328 list_for_each_entry_rcu(wk, &local->work_list, list) {
329 if (wk->type != IEEE80211_WORK_OFFCHANNEL_TX)
330 continue;
331 if (wk->offchan_tx.frame != skb)
332 continue;
333 wk->offchan_tx.frame = NULL;
334 break;
335 }
336 rcu_read_unlock();
325 cfg80211_mgmt_tx_status( 337 cfg80211_mgmt_tx_status(
326 skb->dev, (unsigned long) skb, skb->data, skb->len, 338 skb->dev, (unsigned long) skb, skb->data, skb->len,
327 !!(info->flags & IEEE80211_TX_STAT_ACK), GFP_ATOMIC); 339 !!(info->flags & IEEE80211_TX_STAT_ACK), GFP_ATOMIC);
340 }
328 341
329 /* this was a transmitted frame, but now we want to reuse it */ 342 /* this was a transmitted frame, but now we want to reuse it */
330 skb_orphan(skb); 343 skb_orphan(skb);
diff --git a/net/mac80211/work.c b/net/mac80211/work.c
index ae344d1ba056..2b5c3f267198 100644
--- a/net/mac80211/work.c
+++ b/net/mac80211/work.c
@@ -561,6 +561,25 @@ ieee80211_remain_on_channel_timeout(struct ieee80211_work *wk)
561} 561}
562 562
563static enum work_action __must_check 563static enum work_action __must_check
564ieee80211_offchannel_tx(struct ieee80211_work *wk)
565{
566 if (!wk->started) {
567 wk->timeout = jiffies + msecs_to_jiffies(wk->offchan_tx.wait);
568
569 /*
570 * After this, offchan_tx.frame remains but now is no
571 * longer a valid pointer -- we still need it as the
572 * cookie for canceling this work.
573 */
574 ieee80211_tx_skb(wk->sdata, wk->offchan_tx.frame);
575
576 return WORK_ACT_NONE;
577 }
578
579 return WORK_ACT_TIMEOUT;
580}
581
582static enum work_action __must_check
564ieee80211_assoc_beacon_wait(struct ieee80211_work *wk) 583ieee80211_assoc_beacon_wait(struct ieee80211_work *wk)
565{ 584{
566 if (wk->started) 585 if (wk->started)
@@ -955,6 +974,9 @@ static void ieee80211_work_work(struct work_struct *work)
955 case IEEE80211_WORK_REMAIN_ON_CHANNEL: 974 case IEEE80211_WORK_REMAIN_ON_CHANNEL:
956 rma = ieee80211_remain_on_channel_timeout(wk); 975 rma = ieee80211_remain_on_channel_timeout(wk);
957 break; 976 break;
977 case IEEE80211_WORK_OFFCHANNEL_TX:
978 rma = ieee80211_offchannel_tx(wk);
979 break;
958 case IEEE80211_WORK_ASSOC_BEACON_WAIT: 980 case IEEE80211_WORK_ASSOC_BEACON_WAIT:
959 rma = ieee80211_assoc_beacon_wait(wk); 981 rma = ieee80211_assoc_beacon_wait(wk);
960 break; 982 break;
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 6583cca0e2ee..ee80ad8dc655 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -341,9 +341,9 @@ void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlpid);
341void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev); 341void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev);
342int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, 342int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
343 struct net_device *dev, 343 struct net_device *dev,
344 struct ieee80211_channel *chan, 344 struct ieee80211_channel *chan, bool offchan,
345 enum nl80211_channel_type channel_type, 345 enum nl80211_channel_type channel_type,
346 bool channel_type_valid, 346 bool channel_type_valid, unsigned int wait,
347 const u8 *buf, size_t len, u64 *cookie); 347 const u8 *buf, size_t len, u64 *cookie);
348 348
349/* SME */ 349/* SME */
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 6980a0c315b2..d7680f2a4c5b 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -864,9 +864,9 @@ void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev)
864 864
865int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, 865int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
866 struct net_device *dev, 866 struct net_device *dev,
867 struct ieee80211_channel *chan, 867 struct ieee80211_channel *chan, bool offchan,
868 enum nl80211_channel_type channel_type, 868 enum nl80211_channel_type channel_type,
869 bool channel_type_valid, 869 bool channel_type_valid, unsigned int wait,
870 const u8 *buf, size_t len, u64 *cookie) 870 const u8 *buf, size_t len, u64 *cookie)
871{ 871{
872 struct wireless_dev *wdev = dev->ieee80211_ptr; 872 struct wireless_dev *wdev = dev->ieee80211_ptr;
@@ -946,8 +946,9 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
946 return -EINVAL; 946 return -EINVAL;
947 947
948 /* Transmit the Action frame as requested by user space */ 948 /* Transmit the Action frame as requested by user space */
949 return rdev->ops->mgmt_tx(&rdev->wiphy, dev, chan, channel_type, 949 return rdev->ops->mgmt_tx(&rdev->wiphy, dev, chan, offchan,
950 channel_type_valid, buf, len, cookie); 950 channel_type, channel_type_valid,
951 wait, buf, len, cookie);
951} 952}
952 953
953bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf, 954bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 67ff7e92cb99..960be4e650f0 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -163,16 +163,13 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
163 [NL80211_ATTR_CQM] = { .type = NLA_NESTED, }, 163 [NL80211_ATTR_CQM] = { .type = NLA_NESTED, },
164 [NL80211_ATTR_LOCAL_STATE_CHANGE] = { .type = NLA_FLAG }, 164 [NL80211_ATTR_LOCAL_STATE_CHANGE] = { .type = NLA_FLAG },
165 [NL80211_ATTR_AP_ISOLATE] = { .type = NLA_U8 }, 165 [NL80211_ATTR_AP_ISOLATE] = { .type = NLA_U8 },
166
167 [NL80211_ATTR_WIPHY_TX_POWER_SETTING] = { .type = NLA_U32 }, 166 [NL80211_ATTR_WIPHY_TX_POWER_SETTING] = { .type = NLA_U32 },
168 [NL80211_ATTR_WIPHY_TX_POWER_LEVEL] = { .type = NLA_U32 }, 167 [NL80211_ATTR_WIPHY_TX_POWER_LEVEL] = { .type = NLA_U32 },
169
170 [NL80211_ATTR_FRAME_TYPE] = { .type = NLA_U16 }, 168 [NL80211_ATTR_FRAME_TYPE] = { .type = NLA_U16 },
171
172 [NL80211_ATTR_WIPHY_ANTENNA_TX] = { .type = NLA_U32 }, 169 [NL80211_ATTR_WIPHY_ANTENNA_TX] = { .type = NLA_U32 },
173 [NL80211_ATTR_WIPHY_ANTENNA_RX] = { .type = NLA_U32 }, 170 [NL80211_ATTR_WIPHY_ANTENNA_RX] = { .type = NLA_U32 },
174
175 [NL80211_ATTR_MCAST_RATE] = { .type = NLA_U32 }, 171 [NL80211_ATTR_MCAST_RATE] = { .type = NLA_U32 },
172 [NL80211_ATTR_OFFCHANNEL_TX_OK] = { .type = NLA_FLAG },
176}; 173};
177 174
178/* policy for the key attributes */ 175/* policy for the key attributes */
@@ -677,6 +674,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
677 CMD(remain_on_channel, REMAIN_ON_CHANNEL); 674 CMD(remain_on_channel, REMAIN_ON_CHANNEL);
678 CMD(set_bitrate_mask, SET_TX_BITRATE_MASK); 675 CMD(set_bitrate_mask, SET_TX_BITRATE_MASK);
679 CMD(mgmt_tx, FRAME); 676 CMD(mgmt_tx, FRAME);
677 CMD(mgmt_tx_cancel_wait, FRAME_WAIT_CANCEL);
680 if (dev->wiphy.flags & WIPHY_FLAG_NETNS_OK) { 678 if (dev->wiphy.flags & WIPHY_FLAG_NETNS_OK) {
681 i++; 679 i++;
682 NLA_PUT_U32(msg, i, NL80211_CMD_SET_WIPHY_NETNS); 680 NLA_PUT_U32(msg, i, NL80211_CMD_SET_WIPHY_NETNS);
@@ -698,6 +696,10 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
698 696
699 nla_nest_end(msg, nl_cmds); 697 nla_nest_end(msg, nl_cmds);
700 698
699 /* for now at least assume all drivers have it */
700 if (dev->ops->mgmt_tx)
701 NLA_PUT_FLAG(msg, NL80211_ATTR_OFFCHANNEL_TX_OK);
702
701 if (mgmt_stypes) { 703 if (mgmt_stypes) {
702 u16 stypes; 704 u16 stypes;
703 struct nlattr *nl_ftypes, *nl_ifs; 705 struct nlattr *nl_ftypes, *nl_ifs;
@@ -4244,6 +4246,8 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
4244 void *hdr; 4246 void *hdr;
4245 u64 cookie; 4247 u64 cookie;
4246 struct sk_buff *msg; 4248 struct sk_buff *msg;
4249 unsigned int wait = 0;
4250 bool offchan;
4247 4251
4248 if (!info->attrs[NL80211_ATTR_FRAME] || 4252 if (!info->attrs[NL80211_ATTR_FRAME] ||
4249 !info->attrs[NL80211_ATTR_WIPHY_FREQ]) 4253 !info->attrs[NL80211_ATTR_WIPHY_FREQ])
@@ -4260,6 +4264,12 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
4260 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) 4264 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
4261 return -EOPNOTSUPP; 4265 return -EOPNOTSUPP;
4262 4266
4267 if (info->attrs[NL80211_ATTR_DURATION]) {
4268 if (!rdev->ops->mgmt_tx_cancel_wait)
4269 return -EINVAL;
4270 wait = nla_get_u32(info->attrs[NL80211_ATTR_DURATION]);
4271 }
4272
4263 if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) { 4273 if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) {
4264 channel_type = nla_get_u32( 4274 channel_type = nla_get_u32(
4265 info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]); 4275 info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]);
@@ -4271,6 +4281,8 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
4271 channel_type_valid = true; 4281 channel_type_valid = true;
4272 } 4282 }
4273 4283
4284 offchan = info->attrs[NL80211_ATTR_OFFCHANNEL_TX_OK];
4285
4274 freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); 4286 freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]);
4275 chan = rdev_freq_to_chan(rdev, freq, channel_type); 4287 chan = rdev_freq_to_chan(rdev, freq, channel_type);
4276 if (chan == NULL) 4288 if (chan == NULL)
@@ -4287,8 +4299,8 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
4287 err = PTR_ERR(hdr); 4299 err = PTR_ERR(hdr);
4288 goto free_msg; 4300 goto free_msg;
4289 } 4301 }
4290 err = cfg80211_mlme_mgmt_tx(rdev, dev, chan, channel_type, 4302 err = cfg80211_mlme_mgmt_tx(rdev, dev, chan, offchan, channel_type,
4291 channel_type_valid, 4303 channel_type_valid, wait,
4292 nla_data(info->attrs[NL80211_ATTR_FRAME]), 4304 nla_data(info->attrs[NL80211_ATTR_FRAME]),
4293 nla_len(info->attrs[NL80211_ATTR_FRAME]), 4305 nla_len(info->attrs[NL80211_ATTR_FRAME]),
4294 &cookie); 4306 &cookie);
@@ -4307,6 +4319,31 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
4307 return err; 4319 return err;
4308} 4320}
4309 4321
4322static int nl80211_tx_mgmt_cancel_wait(struct sk_buff *skb, struct genl_info *info)
4323{
4324 struct cfg80211_registered_device *rdev = info->user_ptr[0];
4325 struct net_device *dev = info->user_ptr[1];
4326 u64 cookie;
4327
4328 if (!info->attrs[NL80211_ATTR_COOKIE])
4329 return -EINVAL;
4330
4331 if (!rdev->ops->mgmt_tx_cancel_wait)
4332 return -EOPNOTSUPP;
4333
4334 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION &&
4335 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC &&
4336 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT &&
4337 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
4338 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN &&
4339 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
4340 return -EOPNOTSUPP;
4341
4342 cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]);
4343
4344 return rdev->ops->mgmt_tx_cancel_wait(&rdev->wiphy, dev, cookie);
4345}
4346
4310static int nl80211_set_power_save(struct sk_buff *skb, struct genl_info *info) 4347static int nl80211_set_power_save(struct sk_buff *skb, struct genl_info *info)
4311{ 4348{
4312 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 4349 struct cfg80211_registered_device *rdev = info->user_ptr[0];
@@ -4880,6 +4917,14 @@ static struct genl_ops nl80211_ops[] = {
4880 NL80211_FLAG_NEED_RTNL, 4917 NL80211_FLAG_NEED_RTNL,
4881 }, 4918 },
4882 { 4919 {
4920 .cmd = NL80211_CMD_FRAME_WAIT_CANCEL,
4921 .doit = nl80211_tx_mgmt_cancel_wait,
4922 .policy = nl80211_policy,
4923 .flags = GENL_ADMIN_PERM,
4924 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
4925 NL80211_FLAG_NEED_RTNL,
4926 },
4927 {
4883 .cmd = NL80211_CMD_SET_POWER_SAVE, 4928 .cmd = NL80211_CMD_SET_POWER_SAVE,
4884 .doit = nl80211_set_power_save, 4929 .doit = nl80211_set_power_save,
4885 .policy = nl80211_policy, 4930 .policy = nl80211_policy,