aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2010-06-12 00:33:42 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-06-14 15:39:29 -0400
commitac0bb76791ce2550e3c0a658408c344e1e231e3d (patch)
tree7f262333e3663d7fbe3a23b4383e58ba1e5e5850 /drivers/net
parent6e97f0fb4dc8e95cd7507f3ae89841a79bac0193 (diff)
ath9k_hw: allow for spliting up ANI operations by family
The AR9003 hardware family will use a slightly modified ANI implementation which has not yet been tested on the other hardware families. To allow for this new ANI implementation a few ANI calls need to be abstracted away. This patch just allows for each hardware family to declare their own ANI ops and annotates the current ANI implementation as old. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath/ath9k/ani.c30
-rw-r--r--drivers/net/wireless/ath/ath9k/ani.h4
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_hw.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_hw.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/hw-ops.h16
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h29
-rw-r--r--drivers/net/wireless/ath/ath9k/mac.c1
7 files changed, 73 insertions, 11 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c
index 66d0b8846a0..28a1dc37517 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -17,6 +17,12 @@
17#include "hw.h" 17#include "hw.h"
18#include "hw-ops.h" 18#include "hw-ops.h"
19 19
20/* Private to ani.c */
21static inline void ath9k_hw_ani_lower_immunity(struct ath_hw *ah)
22{
23 ath9k_hw_private_ops(ah)->ani_lower_immunity(ah);
24}
25
20static int ath9k_hw_get_ani_channel_idx(struct ath_hw *ah, 26static int ath9k_hw_get_ani_channel_idx(struct ath_hw *ah,
21 struct ath9k_channel *chan) 27 struct ath9k_channel *chan)
22{ 28{
@@ -206,7 +212,7 @@ static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
206 } 212 }
207} 213}
208 214
209static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah) 215static void ath9k_hw_ani_lower_immunity_old(struct ath_hw *ah)
210{ 216{
211 struct ar5416AniState *aniState; 217 struct ar5416AniState *aniState;
212 int32_t rssi; 218 int32_t rssi;
@@ -316,7 +322,7 @@ static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah)
316 return listenTime; 322 return listenTime;
317} 323}
318 324
319void ath9k_ani_reset(struct ath_hw *ah) 325static void ath9k_ani_reset_old(struct ath_hw *ah)
320{ 326{
321 struct ar5416AniState *aniState; 327 struct ar5416AniState *aniState;
322 struct ath9k_channel *chan = ah->curchan; 328 struct ath9k_channel *chan = ah->curchan;
@@ -402,8 +408,8 @@ void ath9k_ani_reset(struct ath_hw *ah)
402 DISABLE_REGWRITE_BUFFER(ah); 408 DISABLE_REGWRITE_BUFFER(ah);
403} 409}
404 410
405void ath9k_hw_ani_monitor(struct ath_hw *ah, 411static void ath9k_hw_ani_monitor_old(struct ath_hw *ah,
406 struct ath9k_channel *chan) 412 struct ath9k_channel *chan)
407{ 413{
408 struct ar5416AniState *aniState; 414 struct ar5416AniState *aniState;
409 struct ath_common *common = ath9k_hw_common(ah); 415 struct ath_common *common = ath9k_hw_common(ah);
@@ -487,7 +493,6 @@ void ath9k_hw_ani_monitor(struct ath_hw *ah,
487 } 493 }
488 } 494 }
489} 495}
490EXPORT_SYMBOL(ath9k_hw_ani_monitor);
491 496
492void ath9k_enable_mib_counters(struct ath_hw *ah) 497void ath9k_enable_mib_counters(struct ath_hw *ah)
493{ 498{
@@ -572,7 +577,7 @@ u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hw *ah,
572 * any of the MIB counters overflow/trigger so don't assume we're 577 * any of the MIB counters overflow/trigger so don't assume we're
573 * here because a PHY error counter triggered. 578 * here because a PHY error counter triggered.
574 */ 579 */
575void ath9k_hw_procmibevent(struct ath_hw *ah) 580static void ath9k_hw_proc_mib_event_old(struct ath_hw *ah)
576{ 581{
577 u32 phyCnt1, phyCnt2; 582 u32 phyCnt1, phyCnt2;
578 583
@@ -628,7 +633,6 @@ void ath9k_hw_procmibevent(struct ath_hw *ah)
628 ath9k_ani_restart(ah); 633 ath9k_ani_restart(ah);
629 } 634 }
630} 635}
631EXPORT_SYMBOL(ath9k_hw_procmibevent);
632 636
633void ath9k_hw_ani_setup(struct ath_hw *ah) 637void ath9k_hw_ani_setup(struct ath_hw *ah)
634{ 638{
@@ -694,3 +698,15 @@ void ath9k_hw_ani_init(struct ath_hw *ah)
694 if (ah->config.enable_ani) 698 if (ah->config.enable_ani)
695 ah->proc_phyerr |= HAL_PROCESS_ANI; 699 ah->proc_phyerr |= HAL_PROCESS_ANI;
696} 700}
701
702void ath9k_hw_attach_ani_ops_old(struct ath_hw *ah)
703{
704 struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
705 struct ath_hw_ops *ops = ath9k_hw_ops(ah);
706
707 priv_ops->ani_reset = ath9k_ani_reset_old;
708 priv_ops->ani_lower_immunity = ath9k_hw_ani_lower_immunity_old;
709
710 ops->ani_proc_mib_event = ath9k_hw_proc_mib_event_old;
711 ops->ani_monitor = ath9k_hw_ani_monitor_old;
712}
diff --git a/drivers/net/wireless/ath/ath9k/ani.h b/drivers/net/wireless/ath/ath9k/ani.h
index 3356762ea38..4631ab26969 100644
--- a/drivers/net/wireless/ath/ath9k/ani.h
+++ b/drivers/net/wireless/ath/ath9k/ani.h
@@ -108,14 +108,10 @@ struct ar5416Stats {
108}; 108};
109#define ah_mibStats stats.ast_mibstats 109#define ah_mibStats stats.ast_mibstats
110 110
111void ath9k_ani_reset(struct ath_hw *ah);
112void ath9k_hw_ani_monitor(struct ath_hw *ah,
113 struct ath9k_channel *chan);
114void ath9k_enable_mib_counters(struct ath_hw *ah); 111void ath9k_enable_mib_counters(struct ath_hw *ah);
115void ath9k_hw_disable_mib_counters(struct ath_hw *ah); 112void ath9k_hw_disable_mib_counters(struct ath_hw *ah);
116u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hw *ah, u32 *rxc_pcnt, 113u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hw *ah, u32 *rxc_pcnt,
117 u32 *rxf_pcnt, u32 *txf_pcnt); 114 u32 *rxf_pcnt, u32 *txf_pcnt);
118void ath9k_hw_procmibevent(struct ath_hw *ah);
119void ath9k_hw_ani_setup(struct ath_hw *ah); 115void ath9k_hw_ani_setup(struct ath_hw *ah);
120void ath9k_hw_ani_init(struct ath_hw *ah); 116void ath9k_hw_ani_init(struct ath_hw *ah);
121 117
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
index 7ba9dd68cc0..917eae02acd 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
@@ -636,4 +636,6 @@ void ar9002_hw_attach_ops(struct ath_hw *ah)
636 636
637 ar9002_hw_attach_calib_ops(ah); 637 ar9002_hw_attach_calib_ops(ah);
638 ar9002_hw_attach_mac_ops(ah); 638 ar9002_hw_attach_mac_ops(ah);
639
640 ath9k_hw_attach_ani_ops_old(ah);
639} 641}
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_hw.c b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
index 863f61e3a16..b7574704f67 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
@@ -313,4 +313,6 @@ void ar9003_hw_attach_ops(struct ath_hw *ah)
313 ar9003_hw_attach_phy_ops(ah); 313 ar9003_hw_attach_phy_ops(ah);
314 ar9003_hw_attach_calib_ops(ah); 314 ar9003_hw_attach_calib_ops(ah);
315 ar9003_hw_attach_mac_ops(ah); 315 ar9003_hw_attach_mac_ops(ah);
316
317 ath9k_hw_attach_ani_ops_old(ah);
316} 318}
diff --git a/drivers/net/wireless/ath/ath9k/hw-ops.h b/drivers/net/wireless/ath/ath9k/hw-ops.h
index 624422a8169..65d2c661efb 100644
--- a/drivers/net/wireless/ath/ath9k/hw-ops.h
+++ b/drivers/net/wireless/ath/ath9k/hw-ops.h
@@ -128,6 +128,17 @@ static inline void ath9k_hw_set11n_virtualmorefrag(struct ath_hw *ah, void *ds,
128 ath9k_hw_ops(ah)->set11n_virtualmorefrag(ah, ds, vmf); 128 ath9k_hw_ops(ah)->set11n_virtualmorefrag(ah, ds, vmf);
129} 129}
130 130
131static inline void ath9k_hw_procmibevent(struct ath_hw *ah)
132{
133 ath9k_hw_ops(ah)->ani_proc_mib_event(ah);
134}
135
136static inline void ath9k_hw_ani_monitor(struct ath_hw *ah,
137 struct ath9k_channel *chan)
138{
139 ath9k_hw_ops(ah)->ani_monitor(ah, chan);
140}
141
131/* Private hardware call ops */ 142/* Private hardware call ops */
132 143
133/* PHY ops */ 144/* PHY ops */
@@ -277,4 +288,9 @@ static inline bool ath9k_hw_iscal_supported(struct ath_hw *ah,
277 return ath9k_hw_private_ops(ah)->iscal_supported(ah, calType); 288 return ath9k_hw_private_ops(ah)->iscal_supported(ah, calType);
278} 289}
279 290
291static inline void ath9k_ani_reset(struct ath_hw *ah)
292{
293 ath9k_hw_private_ops(ah)->ani_reset(ah);
294}
295
280#endif /* ATH9K_HW_OPS_H */ 296#endif /* ATH9K_HW_OPS_H */
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 3a28cdc1948..a207a70224c 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -511,6 +511,15 @@ struct ath_gen_timer_table {
511 * @setup_calibration: set up calibration 511 * @setup_calibration: set up calibration
512 * @iscal_supported: used to query if a type of calibration is supported 512 * @iscal_supported: used to query if a type of calibration is supported
513 * @loadnf: load noise floor read from each chain on the CCA registers 513 * @loadnf: load noise floor read from each chain on the CCA registers
514 *
515 * @ani_reset: reset ANI parameters to default values
516 * @ani_lower_immunity: lower the noise immunity level. The level controls
517 * the power-based packet detection on hardware. If a power jump is
518 * detected the adapter takes it as an indication that a packet has
519 * arrived. The level ranges from 0-5. Each level corresponds to a
520 * few dB more of noise immunity. If you have a strong time-varying
521 * interference that is causing false detections (OFDM timing errors or
522 * CCK timing errors) the level can be increased.
514 */ 523 */
515struct ath_hw_private_ops { 524struct ath_hw_private_ops {
516 /* Calibration ops */ 525 /* Calibration ops */
@@ -554,6 +563,10 @@ struct ath_hw_private_ops {
554 int param); 563 int param);
555 void (*do_getnf)(struct ath_hw *ah, int16_t nfarray[NUM_NF_READINGS]); 564 void (*do_getnf)(struct ath_hw *ah, int16_t nfarray[NUM_NF_READINGS]);
556 void (*loadnf)(struct ath_hw *ah, struct ath9k_channel *chan); 565 void (*loadnf)(struct ath_hw *ah, struct ath9k_channel *chan);
566
567 /* ANI */
568 void (*ani_reset)(struct ath_hw *ah);
569 void (*ani_lower_immunity)(struct ath_hw *ah);
557}; 570};
558 571
559/** 572/**
@@ -564,6 +577,11 @@ struct ath_hw_private_ops {
564 * 577 *
565 * @config_pci_powersave: 578 * @config_pci_powersave:
566 * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC 579 * @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
580 *
581 * @ani_proc_mib_event: process MIB events, this would happen upon specific ANI
582 * thresholds being reached or having overflowed.
583 * @ani_monitor: called periodically by the core driver to collect
584 * MIB stats and adjust ANI if specific thresholds have been reached.
567 */ 585 */
568struct ath_hw_ops { 586struct ath_hw_ops {
569 void (*config_pci_powersave)(struct ath_hw *ah, 587 void (*config_pci_powersave)(struct ath_hw *ah,
@@ -604,6 +622,9 @@ struct ath_hw_ops {
604 u32 burstDuration); 622 u32 burstDuration);
605 void (*set11n_virtualmorefrag)(struct ath_hw *ah, void *ds, 623 void (*set11n_virtualmorefrag)(struct ath_hw *ah, void *ds,
606 u32 vmf); 624 u32 vmf);
625
626 void (*ani_proc_mib_event)(struct ath_hw *ah);
627 void (*ani_monitor)(struct ath_hw *ah, struct ath9k_channel *chan);
607}; 628};
608 629
609struct ath_hw { 630struct ath_hw {
@@ -934,6 +955,14 @@ void ar9003_hw_attach_calib_ops(struct ath_hw *ah);
934void ar9002_hw_attach_ops(struct ath_hw *ah); 955void ar9002_hw_attach_ops(struct ath_hw *ah);
935void ar9003_hw_attach_ops(struct ath_hw *ah); 956void ar9003_hw_attach_ops(struct ath_hw *ah);
936 957
958/*
959 * ANI work can be shared between all families but a next
960 * generation implementation of ANI will be used only for AR9003 only
961 * for now as the other families still need to be tested with the same
962 * next generation ANI.
963 */
964void ath9k_hw_attach_ani_ops_old(struct ath_hw *ah);
965
937#define ATH_PCIE_CAP_LINK_CTRL 0x70 966#define ATH_PCIE_CAP_LINK_CTRL 0x70
938#define ATH_PCIE_CAP_LINK_L0S 1 967#define ATH_PCIE_CAP_LINK_L0S 1
939#define ATH_PCIE_CAP_LINK_L1 2 968#define ATH_PCIE_CAP_LINK_L1 2
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
index 0e425cb4bbb..b4d01983e7e 100644
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
@@ -15,6 +15,7 @@
15 */ 15 */
16 16
17#include "hw.h" 17#include "hw.h"
18#include "hw-ops.h"
18 19
19static void ath9k_hw_set_txq_interrupts(struct ath_hw *ah, 20static void ath9k_hw_set_txq_interrupts(struct ath_hw *ah,
20 struct ath9k_tx_queue_info *qi) 21 struct ath9k_tx_queue_info *qi)