aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-12-19 12:01:48 -0500
committerJohn W. Linville <linville@tuxdriver.com>2013-12-19 14:41:56 -0500
commit6a4d05dc0c0178b0c30dbda6e9bb79b5dd9662f5 (patch)
treeaea41315bf3b8ad84a2b164246d7b10873f356d2 /drivers
parent08f336b808cea6f776f918f21ad05fe433362987 (diff)
ath9k: move ath9k_debug_sync_cause out of ath9k_hw
ath9k_hw should not depend on any ath9k data structures like ath_softc Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_mac.c6
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_mac.c6
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c41
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.h7
-rw-r--r--drivers/net/wireless/ath/ath9k/hw-ops.h5
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c42
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h10
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c4
8 files changed, 64 insertions, 57 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_mac.c b/drivers/net/wireless/ath/ath9k/ar9002_mac.c
index 8d78253c26ce..857ede3a999c 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_mac.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_mac.c
@@ -29,7 +29,8 @@ static void ar9002_hw_set_desc_link(void *ds, u32 ds_link)
29 ((struct ath_desc*) ds)->ds_link = ds_link; 29 ((struct ath_desc*) ds)->ds_link = ds_link;
30} 30}
31 31
32static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked) 32static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked,
33 u32 *sync_cause_p)
33{ 34{
34 u32 isr = 0; 35 u32 isr = 0;
35 u32 mask2 = 0; 36 u32 mask2 = 0;
@@ -136,7 +137,8 @@ static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
136 } 137 }
137 138
138 if (sync_cause) { 139 if (sync_cause) {
139 ath9k_debug_sync_cause(common, sync_cause); 140 if (sync_cause_p)
141 *sync_cause_p = sync_cause;
140 fatal_int = 142 fatal_int =
141 (sync_cause & 143 (sync_cause &
142 (AR_INTR_SYNC_HOST1_FATAL | AR_INTR_SYNC_HOST1_PERR)) 144 (AR_INTR_SYNC_HOST1_FATAL | AR_INTR_SYNC_HOST1_PERR))
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
index 6eb8657681bf..729ffbf07343 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
@@ -175,7 +175,8 @@ static void ar9003_hw_set_desc_link(void *ds, u32 ds_link)
175 ads->ctl10 |= ar9003_calc_ptr_chksum(ads); 175 ads->ctl10 |= ar9003_calc_ptr_chksum(ads);
176} 176}
177 177
178static bool ar9003_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked) 178static bool ar9003_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked,
179 u32 *sync_cause_p)
179{ 180{
180 u32 isr = 0; 181 u32 isr = 0;
181 u32 mask2 = 0; 182 u32 mask2 = 0;
@@ -310,7 +311,8 @@ static bool ar9003_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
310 ar9003_mci_get_isr(ah, masked); 311 ar9003_mci_get_isr(ah, masked);
311 312
312 if (sync_cause) { 313 if (sync_cause) {
313 ath9k_debug_sync_cause(common, sync_cause); 314 if (sync_cause_p)
315 *sync_cause_p = sync_cause;
314 fatal_int = 316 fatal_int =
315 (sync_cause & 317 (sync_cause &
316 (AR_INTR_SYNC_HOST1_FATAL | AR_INTR_SYNC_HOST1_PERR)) 318 (AR_INTR_SYNC_HOST1_FATAL | AR_INTR_SYNC_HOST1_PERR))
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 4c6f8b107ed6..b041052a10ee 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -26,6 +26,47 @@
26#define REG_READ_D(_ah, _reg) \ 26#define REG_READ_D(_ah, _reg) \
27 ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) 27 ath9k_hw_common(_ah)->ops->read((_ah), (_reg))
28 28
29void ath9k_debug_sync_cause(struct ath_softc *sc, u32 sync_cause)
30{
31 if (sync_cause)
32 sc->debug.stats.istats.sync_cause_all++;
33 if (sync_cause & AR_INTR_SYNC_RTC_IRQ)
34 sc->debug.stats.istats.sync_rtc_irq++;
35 if (sync_cause & AR_INTR_SYNC_MAC_IRQ)
36 sc->debug.stats.istats.sync_mac_irq++;
37 if (sync_cause & AR_INTR_SYNC_EEPROM_ILLEGAL_ACCESS)
38 sc->debug.stats.istats.eeprom_illegal_access++;
39 if (sync_cause & AR_INTR_SYNC_APB_TIMEOUT)
40 sc->debug.stats.istats.apb_timeout++;
41 if (sync_cause & AR_INTR_SYNC_PCI_MODE_CONFLICT)
42 sc->debug.stats.istats.pci_mode_conflict++;
43 if (sync_cause & AR_INTR_SYNC_HOST1_FATAL)
44 sc->debug.stats.istats.host1_fatal++;
45 if (sync_cause & AR_INTR_SYNC_HOST1_PERR)
46 sc->debug.stats.istats.host1_perr++;
47 if (sync_cause & AR_INTR_SYNC_TRCV_FIFO_PERR)
48 sc->debug.stats.istats.trcv_fifo_perr++;
49 if (sync_cause & AR_INTR_SYNC_RADM_CPL_EP)
50 sc->debug.stats.istats.radm_cpl_ep++;
51 if (sync_cause & AR_INTR_SYNC_RADM_CPL_DLLP_ABORT)
52 sc->debug.stats.istats.radm_cpl_dllp_abort++;
53 if (sync_cause & AR_INTR_SYNC_RADM_CPL_TLP_ABORT)
54 sc->debug.stats.istats.radm_cpl_tlp_abort++;
55 if (sync_cause & AR_INTR_SYNC_RADM_CPL_ECRC_ERR)
56 sc->debug.stats.istats.radm_cpl_ecrc_err++;
57 if (sync_cause & AR_INTR_SYNC_RADM_CPL_TIMEOUT)
58 sc->debug.stats.istats.radm_cpl_timeout++;
59 if (sync_cause & AR_INTR_SYNC_LOCAL_TIMEOUT)
60 sc->debug.stats.istats.local_timeout++;
61 if (sync_cause & AR_INTR_SYNC_PM_ACCESS)
62 sc->debug.stats.istats.pm_access++;
63 if (sync_cause & AR_INTR_SYNC_MAC_AWAKE)
64 sc->debug.stats.istats.mac_awake++;
65 if (sync_cause & AR_INTR_SYNC_MAC_ASLEEP)
66 sc->debug.stats.istats.mac_asleep++;
67 if (sync_cause & AR_INTR_SYNC_MAC_SLEEP_ACCESS)
68 sc->debug.stats.istats.mac_sleep_access++;
69}
29 70
30static ssize_t ath9k_debugfs_read_buf(struct file *file, char __user *user_buf, 71static ssize_t ath9k_debugfs_read_buf(struct file *file, char __user *user_buf,
31 size_t count, loff_t *ppos) 72 size_t count, loff_t *ppos)
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h
index 4f596ddeb15d..ec02d38ea8ea 100644
--- a/drivers/net/wireless/ath/ath9k/debug.h
+++ b/drivers/net/wireless/ath/ath9k/debug.h
@@ -295,6 +295,8 @@ void ath9k_sta_add_debugfs(struct ieee80211_hw *hw,
295void ath9k_debug_stat_ant(struct ath_softc *sc, 295void ath9k_debug_stat_ant(struct ath_softc *sc,
296 struct ath_hw_antcomb_conf *div_ant_conf, 296 struct ath_hw_antcomb_conf *div_ant_conf,
297 int main_rssi_avg, int alt_rssi_avg); 297 int main_rssi_avg, int alt_rssi_avg);
298void ath9k_debug_sync_cause(struct ath_softc *sc, u32 sync_cause);
299
298#else 300#else
299 301
300#define RX_STAT_INC(c) /* NOP */ 302#define RX_STAT_INC(c) /* NOP */
@@ -329,6 +331,11 @@ static inline void ath9k_debug_stat_ant(struct ath_softc *sc,
329 331
330} 332}
331 333
334static inline void
335ath9k_debug_sync_cause(struct ath_softc *sc, u32 sync_cause)
336{
337}
338
332#endif /* CONFIG_ATH9K_DEBUGFS */ 339#endif /* CONFIG_ATH9K_DEBUGFS */
333 340
334#endif /* DEBUG_H */ 341#endif /* DEBUG_H */
diff --git a/drivers/net/wireless/ath/ath9k/hw-ops.h b/drivers/net/wireless/ath/ath9k/hw-ops.h
index 4f9378ddf07f..cc58a8ee1223 100644
--- a/drivers/net/wireless/ath/ath9k/hw-ops.h
+++ b/drivers/net/wireless/ath/ath9k/hw-ops.h
@@ -49,9 +49,10 @@ static inline bool ath9k_hw_calibrate(struct ath_hw *ah,
49 return ath9k_hw_ops(ah)->calibrate(ah, chan, rxchainmask, longcal); 49 return ath9k_hw_ops(ah)->calibrate(ah, chan, rxchainmask, longcal);
50} 50}
51 51
52static inline bool ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked) 52static inline bool ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked,
53 u32 *sync_cause_p)
53{ 54{
54 return ath9k_hw_ops(ah)->get_isr(ah, masked); 55 return ath9k_hw_ops(ah)->get_isr(ah, masked, sync_cause_p);
55} 56}
56 57
57static inline void ath9k_hw_set_txdesc(struct ath_hw *ah, void *ds, 58static inline void ath9k_hw_set_txdesc(struct ath_hw *ah, void *ds,
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 0e548a461f55..a4b1ae026216 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -85,48 +85,6 @@ static void ath9k_hw_ani_cache_ini_regs(struct ath_hw *ah)
85 85
86#ifdef CONFIG_ATH9K_DEBUGFS 86#ifdef CONFIG_ATH9K_DEBUGFS
87 87
88void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause)
89{
90 struct ath_softc *sc = common->priv;
91 if (sync_cause)
92 sc->debug.stats.istats.sync_cause_all++;
93 if (sync_cause & AR_INTR_SYNC_RTC_IRQ)
94 sc->debug.stats.istats.sync_rtc_irq++;
95 if (sync_cause & AR_INTR_SYNC_MAC_IRQ)
96 sc->debug.stats.istats.sync_mac_irq++;
97 if (sync_cause & AR_INTR_SYNC_EEPROM_ILLEGAL_ACCESS)
98 sc->debug.stats.istats.eeprom_illegal_access++;
99 if (sync_cause & AR_INTR_SYNC_APB_TIMEOUT)
100 sc->debug.stats.istats.apb_timeout++;
101 if (sync_cause & AR_INTR_SYNC_PCI_MODE_CONFLICT)
102 sc->debug.stats.istats.pci_mode_conflict++;
103 if (sync_cause & AR_INTR_SYNC_HOST1_FATAL)
104 sc->debug.stats.istats.host1_fatal++;
105 if (sync_cause & AR_INTR_SYNC_HOST1_PERR)
106 sc->debug.stats.istats.host1_perr++;
107 if (sync_cause & AR_INTR_SYNC_TRCV_FIFO_PERR)
108 sc->debug.stats.istats.trcv_fifo_perr++;
109 if (sync_cause & AR_INTR_SYNC_RADM_CPL_EP)
110 sc->debug.stats.istats.radm_cpl_ep++;
111 if (sync_cause & AR_INTR_SYNC_RADM_CPL_DLLP_ABORT)
112 sc->debug.stats.istats.radm_cpl_dllp_abort++;
113 if (sync_cause & AR_INTR_SYNC_RADM_CPL_TLP_ABORT)
114 sc->debug.stats.istats.radm_cpl_tlp_abort++;
115 if (sync_cause & AR_INTR_SYNC_RADM_CPL_ECRC_ERR)
116 sc->debug.stats.istats.radm_cpl_ecrc_err++;
117 if (sync_cause & AR_INTR_SYNC_RADM_CPL_TIMEOUT)
118 sc->debug.stats.istats.radm_cpl_timeout++;
119 if (sync_cause & AR_INTR_SYNC_LOCAL_TIMEOUT)
120 sc->debug.stats.istats.local_timeout++;
121 if (sync_cause & AR_INTR_SYNC_PM_ACCESS)
122 sc->debug.stats.istats.pm_access++;
123 if (sync_cause & AR_INTR_SYNC_MAC_AWAKE)
124 sc->debug.stats.istats.mac_awake++;
125 if (sync_cause & AR_INTR_SYNC_MAC_ASLEEP)
126 sc->debug.stats.istats.mac_asleep++;
127 if (sync_cause & AR_INTR_SYNC_MAC_SLEEP_ACCESS)
128 sc->debug.stats.istats.mac_sleep_access++;
129}
130#endif 88#endif
131 89
132 90
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 54932d8b5edd..6132ffeb3048 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -667,7 +667,8 @@ struct ath_hw_ops {
667 struct ath9k_channel *chan, 667 struct ath9k_channel *chan,
668 u8 rxchainmask, 668 u8 rxchainmask,
669 bool longcal); 669 bool longcal);
670 bool (*get_isr)(struct ath_hw *ah, enum ath9k_int *masked); 670 bool (*get_isr)(struct ath_hw *ah, enum ath9k_int *masked,
671 u32 *sync_cause_p);
671 void (*set_txdesc)(struct ath_hw *ah, void *ds, 672 void (*set_txdesc)(struct ath_hw *ah, void *ds,
672 struct ath_tx_info *i); 673 struct ath_tx_info *i);
673 int (*proc_txdesc)(struct ath_hw *ah, void *ds, 674 int (*proc_txdesc)(struct ath_hw *ah, void *ds,
@@ -994,13 +995,6 @@ bool ath9k_hw_check_alive(struct ath_hw *ah);
994 995
995bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); 996bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
996 997
997#ifdef CONFIG_ATH9K_DEBUGFS
998void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause);
999#else
1000static inline void ath9k_debug_sync_cause(struct ath_common *common,
1001 u32 sync_cause) {}
1002#endif
1003
1004/* Generic hw timer primitives */ 998/* Generic hw timer primitives */
1005struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah, 999struct ath_gen_timer *ath_gen_timer_alloc(struct ath_hw *ah,
1006 void (*trigger)(void *), 1000 void (*trigger)(void *),
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 6a231201c7dc..1d76be501572 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -541,6 +541,7 @@ irqreturn_t ath_isr(int irq, void *dev)
541 struct ath_hw *ah = sc->sc_ah; 541 struct ath_hw *ah = sc->sc_ah;
542 struct ath_common *common = ath9k_hw_common(ah); 542 struct ath_common *common = ath9k_hw_common(ah);
543 enum ath9k_int status; 543 enum ath9k_int status;
544 u32 sync_cause;
544 bool sched = false; 545 bool sched = false;
545 546
546 /* 547 /*
@@ -567,7 +568,8 @@ irqreturn_t ath_isr(int irq, void *dev)
567 * bits we haven't explicitly enabled so we mask the 568 * bits we haven't explicitly enabled so we mask the
568 * value to insure we only process bits we requested. 569 * value to insure we only process bits we requested.
569 */ 570 */
570 ath9k_hw_getisr(ah, &status); /* NB: clears ISR too */ 571 ath9k_hw_getisr(ah, &status, &sync_cause); /* NB: clears ISR too */
572 ath9k_debug_sync_cause(sc, sync_cause);
571 status &= ah->imask; /* discard unasked-for bits */ 573 status &= ah->imask; /* discard unasked-for bits */
572 574
573 /* 575 /*