Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6

+4225 -2319
+6
MAINTAINERS
··· 1080 1080 F: Documentation/aoe/ 1081 1081 F: drivers/block/aoe/ 1082 1082 1083 + ATHEROS ATH GENERIC UTILITIES 1084 + M: "Luis R. Rodriguez" <lrodriguez@atheros.com> 1085 + L: linux-wireless@vger.kernel.org 1086 + S: Supported 1087 + F: drivers/net/wireless/ath/* 1088 + 1083 1089 ATHEROS ATH5K WIRELESS DRIVER 1084 1090 M: Jiri Slaby <jirislaby@gmail.com> 1085 1091 M: Nick Kossifidis <mickflemm@gmail.com>
+109 -6
drivers/net/wireless/ath/ath.h
··· 104 104 ATH_CIPHER_MIC = 127 105 105 }; 106 106 107 - enum ath_drv_info { 108 - AR7010_DEVICE = BIT(0), 109 - AR9287_DEVICE = BIT(1), 110 - }; 111 - 112 107 /** 113 108 * struct ath_ops - Register read/write operations 114 109 * ··· 126 131 void (*read_cachesize)(struct ath_common *common, int *csz); 127 132 bool (*eeprom_read)(struct ath_common *common, u32 off, u16 *data); 128 133 void (*bt_coex_prep)(struct ath_common *common); 134 + void (*extn_synch_en)(struct ath_common *common); 129 135 }; 130 136 131 137 struct ath_common { ··· 148 152 u8 rx_chainmask; 149 153 150 154 u32 rx_bufsize; 151 - u32 driver_info; 152 155 153 156 u32 keymax; 154 157 DECLARE_BITMAP(keymap, ATH_KEYMAX); ··· 180 185 bool ath_hw_keyreset(struct ath_common *common, u16 entry); 181 186 void ath_hw_cycle_counters_update(struct ath_common *common); 182 187 int32_t ath_hw_get_listen_time(struct ath_common *common); 188 + 189 + extern __attribute__ ((format (printf, 3, 4))) int 190 + ath_printk(const char *level, struct ath_common *common, const char *fmt, ...); 191 + 192 + #define ath_emerg(common, fmt, ...) \ 193 + ath_printk(KERN_EMERG, common, fmt, ##__VA_ARGS__) 194 + #define ath_alert(common, fmt, ...) \ 195 + ath_printk(KERN_ALERT, common, fmt, ##__VA_ARGS__) 196 + #define ath_crit(common, fmt, ...) \ 197 + ath_printk(KERN_CRIT, common, fmt, ##__VA_ARGS__) 198 + #define ath_err(common, fmt, ...) \ 199 + ath_printk(KERN_ERR, common, fmt, ##__VA_ARGS__) 200 + #define ath_warn(common, fmt, ...) \ 201 + ath_printk(KERN_WARNING, common, fmt, ##__VA_ARGS__) 202 + #define ath_notice(common, fmt, ...) \ 203 + ath_printk(KERN_NOTICE, common, fmt, ##__VA_ARGS__) 204 + #define ath_info(common, fmt, ...) \ 205 + ath_printk(KERN_INFO, common, fmt, ##__VA_ARGS__) 206 + 207 + /** 208 + * enum ath_debug_level - atheros wireless debug level 209 + * 210 + * @ATH_DBG_RESET: reset processing 211 + * @ATH_DBG_QUEUE: hardware queue management 212 + * @ATH_DBG_EEPROM: eeprom processing 213 + * @ATH_DBG_CALIBRATE: periodic calibration 214 + * @ATH_DBG_INTERRUPT: interrupt processing 215 + * @ATH_DBG_REGULATORY: regulatory processing 216 + * @ATH_DBG_ANI: adaptive noise immunitive processing 217 + * @ATH_DBG_XMIT: basic xmit operation 218 + * @ATH_DBG_BEACON: beacon handling 219 + * @ATH_DBG_CONFIG: configuration of the hardware 220 + * @ATH_DBG_FATAL: fatal errors, this is the default, DBG_DEFAULT 221 + * @ATH_DBG_PS: power save processing 222 + * @ATH_DBG_HWTIMER: hardware timer handling 223 + * @ATH_DBG_BTCOEX: bluetooth coexistance 224 + * @ATH_DBG_BSTUCK: stuck beacons 225 + * @ATH_DBG_ANY: enable all debugging 226 + * 227 + * The debug level is used to control the amount and type of debugging output 228 + * we want to see. Each driver has its own method for enabling debugging and 229 + * modifying debug level states -- but this is typically done through a 230 + * module parameter 'debug' along with a respective 'debug' debugfs file 231 + * entry. 232 + */ 233 + enum ATH_DEBUG { 234 + ATH_DBG_RESET = 0x00000001, 235 + ATH_DBG_QUEUE = 0x00000002, 236 + ATH_DBG_EEPROM = 0x00000004, 237 + ATH_DBG_CALIBRATE = 0x00000008, 238 + ATH_DBG_INTERRUPT = 0x00000010, 239 + ATH_DBG_REGULATORY = 0x00000020, 240 + ATH_DBG_ANI = 0x00000040, 241 + ATH_DBG_XMIT = 0x00000080, 242 + ATH_DBG_BEACON = 0x00000100, 243 + ATH_DBG_CONFIG = 0x00000200, 244 + ATH_DBG_FATAL = 0x00000400, 245 + ATH_DBG_PS = 0x00000800, 246 + ATH_DBG_HWTIMER = 0x00001000, 247 + ATH_DBG_BTCOEX = 0x00002000, 248 + ATH_DBG_WMI = 0x00004000, 249 + ATH_DBG_BSTUCK = 0x00008000, 250 + ATH_DBG_ANY = 0xffffffff 251 + }; 252 + 253 + #define ATH_DBG_DEFAULT (ATH_DBG_FATAL) 254 + 255 + #ifdef CONFIG_ATH_DEBUG 256 + 257 + #define ath_dbg(common, dbg_mask, fmt, ...) \ 258 + ({ \ 259 + int rtn; \ 260 + if ((common)->debug_mask & dbg_mask) \ 261 + rtn = ath_printk(KERN_DEBUG, common, fmt, \ 262 + ##__VA_ARGS__); \ 263 + else \ 264 + rtn = 0; \ 265 + \ 266 + rtn; \ 267 + }) 268 + #define ATH_DBG_WARN(foo, arg...) WARN(foo, arg) 269 + #define ATH_DBG_WARN_ON_ONCE(foo) WARN_ON_ONCE(foo) 270 + 271 + #else 272 + 273 + static inline __attribute__ ((format (printf, 3, 4))) int 274 + ath_dbg(struct ath_common *common, enum ATH_DEBUG dbg_mask, 275 + const char *fmt, ...) 276 + { 277 + return 0; 278 + } 279 + #define ATH_DBG_WARN(foo, arg...) do {} while (0) 280 + #define ATH_DBG_WARN_ON_ONCE(foo) ({ \ 281 + int __ret_warn_once = !!(foo); \ 282 + unlikely(__ret_warn_once); \ 283 + }) 284 + 285 + #endif /* CONFIG_ATH_DEBUG */ 286 + 287 + /** Returns string describing opmode, or NULL if unknown mode. */ 288 + #ifdef CONFIG_ATH_DEBUG 289 + const char *ath_opmode_to_string(enum nl80211_iftype opmode); 290 + #else 291 + static inline const char *ath_opmode_to_string(enum nl80211_iftype opmode) 292 + { 293 + return "UNKNOWN"; 294 + } 295 + #endif 183 296 184 297 #endif /* ATH_H */
+63 -40
drivers/net/wireless/ath/ath5k/base.c
··· 60 60 #include "reg.h" 61 61 #include "debug.h" 62 62 #include "ani.h" 63 - #include "../debug.h" 64 63 65 64 static int modparam_nohwcrypt; 66 65 module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); ··· 75 76 MODULE_DESCRIPTION("Support for 5xxx series of Atheros 802.11 wireless LAN cards."); 76 77 MODULE_SUPPORTED_DEVICE("Atheros 5xxx WLAN cards"); 77 78 MODULE_LICENSE("Dual BSD/GPL"); 78 - MODULE_VERSION("0.6.0 (EXPERIMENTAL)"); 79 79 80 80 static int ath5k_init(struct ieee80211_hw *hw); 81 81 static int ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan, ··· 1879 1881 sc->bmisscount = 0; 1880 1882 } 1881 1883 1882 - if (sc->opmode == NL80211_IFTYPE_AP && sc->num_ap_vifs > 1) { 1884 + if ((sc->opmode == NL80211_IFTYPE_AP && sc->num_ap_vifs > 1) || 1885 + sc->opmode == NL80211_IFTYPE_MESH_POINT) { 1883 1886 u64 tsf = ath5k_hw_get_tsf64(ah); 1884 1887 u32 tsftu = TSF_TO_TU(tsf); 1885 1888 int slot = ((tsftu % sc->bintval) * ATH_BCBUF) / sc->bintval; ··· 1912 1913 /* NB: hw still stops DMA, so proceed */ 1913 1914 } 1914 1915 1915 - /* refresh the beacon for AP mode */ 1916 - if (sc->opmode == NL80211_IFTYPE_AP) 1916 + /* refresh the beacon for AP or MESH mode */ 1917 + if (sc->opmode == NL80211_IFTYPE_AP || 1918 + sc->opmode == NL80211_IFTYPE_MESH_POINT) 1917 1919 ath5k_beacon_update(sc->hw, vif); 1918 1920 1919 1921 ath5k_hw_set_txdp(ah, sc->bhalq, bf->daddr); ··· 2341 2341 /* Initialize driver private data */ 2342 2342 SET_IEEE80211_DEV(hw, sc->dev); 2343 2343 hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | 2344 - IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | 2345 - IEEE80211_HW_SIGNAL_DBM; 2344 + IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | 2345 + IEEE80211_HW_SIGNAL_DBM | 2346 + IEEE80211_HW_REPORTS_TX_ACK_STATUS; 2346 2347 2347 2348 hw->wiphy->interface_modes = 2348 2349 BIT(NL80211_IFTYPE_AP) | ··· 2654 2653 bool skip_pcu) 2655 2654 { 2656 2655 struct ath5k_hw *ah = sc->ah; 2657 - int ret; 2656 + int ret, ani_mode; 2658 2657 2659 2658 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "resetting\n"); 2660 2659 ··· 2662 2661 synchronize_irq(sc->irq); 2663 2662 stop_tasklets(sc); 2664 2663 2665 - if (chan) { 2666 - ath5k_drain_tx_buffs(sc); 2664 + /* Save ani mode and disable ANI durring 2665 + * reset. If we don't we might get false 2666 + * PHY error interrupts. */ 2667 + ani_mode = ah->ah_sc->ani_state.ani_mode; 2668 + ath5k_ani_init(ah, ATH5K_ANI_MODE_OFF); 2667 2669 2670 + /* We are going to empty hw queues 2671 + * so we should also free any remaining 2672 + * tx buffers */ 2673 + ath5k_drain_tx_buffs(sc); 2674 + if (chan) { 2668 2675 sc->curchan = chan; 2669 2676 sc->curband = &sc->sbands[chan->band]; 2670 2677 } ··· 2689 2680 goto err; 2690 2681 } 2691 2682 2692 - ath5k_ani_init(ah, ah->ah_sc->ani_state.ani_mode); 2683 + ath5k_ani_init(ah, ani_mode); 2693 2684 2694 2685 ah->ah_cal_next_full = jiffies; 2695 2686 ah->ah_cal_next_ani = jiffies; 2696 2687 ah->ah_cal_next_nf = jiffies; 2697 - ewma_init(&ah->ah_beacon_rssi_avg, 1000, 8); 2688 + ewma_init(&ah->ah_beacon_rssi_avg, 1024, 8); 2698 2689 2699 2690 /* 2700 2691 * Change channels and update the h/w rate map if we're switching; ··· 2799 2790 goto err_bhal; 2800 2791 } 2801 2792 2802 - /* This order matches mac80211's queue priority, so we can 2803 - * directly use the mac80211 queue number without any mapping */ 2804 - txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_VO); 2805 - if (IS_ERR(txq)) { 2806 - ATH5K_ERR(sc, "can't setup xmit queue\n"); 2807 - ret = PTR_ERR(txq); 2808 - goto err_queues; 2793 + /* 5211 and 5212 usually support 10 queues but we better rely on the 2794 + * capability information */ 2795 + if (ah->ah_capabilities.cap_queues.q_tx_num >= 6) { 2796 + /* This order matches mac80211's queue priority, so we can 2797 + * directly use the mac80211 queue number without any mapping */ 2798 + txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_VO); 2799 + if (IS_ERR(txq)) { 2800 + ATH5K_ERR(sc, "can't setup xmit queue\n"); 2801 + ret = PTR_ERR(txq); 2802 + goto err_queues; 2803 + } 2804 + txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_VI); 2805 + if (IS_ERR(txq)) { 2806 + ATH5K_ERR(sc, "can't setup xmit queue\n"); 2807 + ret = PTR_ERR(txq); 2808 + goto err_queues; 2809 + } 2810 + txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_BE); 2811 + if (IS_ERR(txq)) { 2812 + ATH5K_ERR(sc, "can't setup xmit queue\n"); 2813 + ret = PTR_ERR(txq); 2814 + goto err_queues; 2815 + } 2816 + txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_BK); 2817 + if (IS_ERR(txq)) { 2818 + ATH5K_ERR(sc, "can't setup xmit queue\n"); 2819 + ret = PTR_ERR(txq); 2820 + goto err_queues; 2821 + } 2822 + hw->queues = 4; 2823 + } else { 2824 + /* older hardware (5210) can only support one data queue */ 2825 + txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_BE); 2826 + if (IS_ERR(txq)) { 2827 + ATH5K_ERR(sc, "can't setup xmit queue\n"); 2828 + ret = PTR_ERR(txq); 2829 + goto err_queues; 2830 + } 2831 + hw->queues = 1; 2809 2832 } 2810 - txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_VI); 2811 - if (IS_ERR(txq)) { 2812 - ATH5K_ERR(sc, "can't setup xmit queue\n"); 2813 - ret = PTR_ERR(txq); 2814 - goto err_queues; 2815 - } 2816 - txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_BE); 2817 - if (IS_ERR(txq)) { 2818 - ATH5K_ERR(sc, "can't setup xmit queue\n"); 2819 - ret = PTR_ERR(txq); 2820 - goto err_queues; 2821 - } 2822 - txq = ath5k_txq_setup(sc, AR5K_TX_QUEUE_DATA, AR5K_WME_AC_BK); 2823 - if (IS_ERR(txq)) { 2824 - ATH5K_ERR(sc, "can't setup xmit queue\n"); 2825 - ret = PTR_ERR(txq); 2826 - goto err_queues; 2827 - } 2828 - hw->queues = 4; 2829 2833 2830 2834 tasklet_init(&sc->rxtq, ath5k_tasklet_rx, (unsigned long)sc); 2831 2835 tasklet_init(&sc->txtq, ath5k_tasklet_tx, (unsigned long)sc); ··· 2999 2977 3000 2978 /* Assign the vap/adhoc to a beacon xmit slot. */ 3001 2979 if ((avf->opmode == NL80211_IFTYPE_AP) || 3002 - (avf->opmode == NL80211_IFTYPE_ADHOC)) { 2980 + (avf->opmode == NL80211_IFTYPE_ADHOC) || 2981 + (avf->opmode == NL80211_IFTYPE_MESH_POINT)) { 3003 2982 int slot; 3004 2983 3005 2984 WARN_ON(list_empty(&sc->bcbuf)); ··· 3019 2996 sc->bslot[avf->bslot] = vif; 3020 2997 if (avf->opmode == NL80211_IFTYPE_AP) 3021 2998 sc->num_ap_vifs++; 3022 - else 2999 + else if (avf->opmode == NL80211_IFTYPE_ADHOC) 3023 3000 sc->num_adhoc_vifs++; 3024 3001 } 3025 3002
-1
drivers/net/wireless/ath/ath5k/debug.c
··· 60 60 61 61 #include "base.h" 62 62 #include "debug.h" 63 - #include "../debug.h" 64 63 65 64 static unsigned int ath5k_debug; 66 65 module_param_named(debug, ath5k_debug, uint, 0);
+1 -1
drivers/net/wireless/ath/ath5k/dma.c
··· 72 72 i--) 73 73 udelay(100); 74 74 75 - if (i) 75 + if (!i) 76 76 ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_DMA, 77 77 "failed to stop RX DMA !\n"); 78 78
+1
drivers/net/wireless/ath/ath5k/pci.c
··· 45 45 { PCI_VDEVICE(ATHEROS, 0x001d) }, /* 2417 Nala */ 46 46 { 0 } 47 47 }; 48 + MODULE_DEVICE_TABLE(pci, ath5k_pci_id_table); 48 49 49 50 /* return bus cachesize in 4B word units */ 50 51 static void ath5k_pci_read_cachesize(struct ath_common *common, int *csz)
+21 -12
drivers/net/wireless/ath/ath5k/phy.c
··· 2742 2742 2743 2743 /* Write PDADC values on hw */ 2744 2744 static void 2745 - ath5k_setup_pwr_to_pdadc_table(struct ath5k_hw *ah, 2746 - u8 pdcurves, u8 *pdg_to_idx) 2745 + ath5k_setup_pwr_to_pdadc_table(struct ath5k_hw *ah, u8 ee_mode) 2747 2746 { 2747 + struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; 2748 2748 u8 *pdadc_out = ah->ah_txpower.txp_pd_table; 2749 + u8 *pdg_to_idx = ee->ee_pdc_to_idx[ee_mode]; 2750 + u8 pdcurves = ee->ee_pd_gains[ee_mode]; 2749 2751 u32 reg; 2750 2752 u8 i; 2751 2753 ··· 2994 2992 ee->ee_pd_gains[ee_mode]); 2995 2993 2996 2994 /* Write settings on hw */ 2997 - ath5k_setup_pwr_to_pdadc_table(ah, pdg, pdg_curve_to_idx); 2995 + ath5k_setup_pwr_to_pdadc_table(ah, ee_mode); 2998 2996 2999 2997 /* Set txp.offset, note that table_min 3000 2998 * can be negative */ ··· 3116 3114 return -EINVAL; 3117 3115 } 3118 3116 3119 - /* Reset TX power values */ 3120 - memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower)); 3121 - ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER; 3122 - ah->ah_txpower.txp_min_pwr = 0; 3123 - ah->ah_txpower.txp_max_pwr = AR5K_TUNE_MAX_TXPOWER; 3124 - 3125 3117 /* Initialize TX power table */ 3126 3118 switch (ah->ah_radio) { 3127 3119 case AR5K_RF5110: ··· 3142 3146 * so there is no need to recalculate the powertable, we 'll 3143 3147 * just use the cached one */ 3144 3148 if (!fast) { 3149 + /* Reset TX power values */ 3150 + memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower)); 3151 + ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER; 3152 + ah->ah_txpower.txp_min_pwr = 0; 3153 + ah->ah_txpower.txp_max_pwr = AR5K_TUNE_MAX_TXPOWER; 3154 + 3155 + /* Calculate the powertable */ 3145 3156 ret = ath5k_setup_channel_powertable(ah, channel, 3146 3157 ee_mode, type); 3147 - if (ret) 3148 - return ret; 3149 - } 3158 + if (ret) 3159 + return ret; 3160 + /* Write cached table on hw */ 3161 + } else if (type == AR5K_PWRTABLE_PWR_TO_PDADC) 3162 + ath5k_setup_pwr_to_pdadc_table(ah, ee_mode); 3163 + else 3164 + ath5k_setup_pcdac_table(ah); 3165 + 3166 + 3150 3167 3151 3168 /* Limit max power if we have a CTL available */ 3152 3169 ath5k_get_max_ctl_power(ah, channel);
+2 -2
drivers/net/wireless/ath/ath5k/qcu.c
··· 152 152 /* 153 153 * Get queue by type 154 154 */ 155 - /*5210 only has 2 queues*/ 156 - if (ah->ah_version == AR5K_AR5210) { 155 + /* 5210 only has 2 queues */ 156 + if (ah->ah_capabilities.cap_queues.q_tx_num == 2) { 157 157 switch (queue_type) { 158 158 case AR5K_TX_QUEUE_DATA: 159 159 queue = AR5K_TX_QUEUE_ID_NOQCU_DATA;
+3 -4
drivers/net/wireless/ath/ath9k/ahb.c
··· 35 35 36 36 pdata = (struct ath9k_platform_data *) pdev->dev.platform_data; 37 37 if (off >= (ARRAY_SIZE(pdata->eeprom_data))) { 38 - ath_print(common, ATH_DBG_FATAL, 39 - "%s: flash read failed, offset %08x " 40 - "is out of range\n", 41 - __func__, off); 38 + ath_err(common, 39 + "%s: flash read failed, offset %08x is out of range\n", 40 + __func__, off); 42 41 return false; 43 42 } 44 43
+46 -53
drivers/net/wireless/ath/ath9k/ani.c
··· 135 135 cck_base = AR_PHY_COUNTMAX - ah->config.cck_trig_high; 136 136 } 137 137 138 - ath_print(common, ATH_DBG_ANI, 139 - "Writing ofdmbase=%u cckbase=%u\n", ofdm_base, cck_base); 138 + ath_dbg(common, ATH_DBG_ANI, 139 + "Writing ofdmbase=%u cckbase=%u\n", ofdm_base, cck_base); 140 140 141 141 ENABLE_REGWRITE_BUFFER(ah); 142 142 ··· 267 267 268 268 aniState->noiseFloor = BEACON_RSSI(ah); 269 269 270 - ath_print(common, ATH_DBG_ANI, 271 - "**** ofdmlevel %d=>%d, rssi=%d[lo=%d hi=%d]\n", 272 - aniState->ofdmNoiseImmunityLevel, 273 - immunityLevel, aniState->noiseFloor, 274 - aniState->rssiThrLow, aniState->rssiThrHigh); 270 + ath_dbg(common, ATH_DBG_ANI, 271 + "**** ofdmlevel %d=>%d, rssi=%d[lo=%d hi=%d]\n", 272 + aniState->ofdmNoiseImmunityLevel, 273 + immunityLevel, aniState->noiseFloor, 274 + aniState->rssiThrLow, aniState->rssiThrHigh); 275 275 276 276 aniState->ofdmNoiseImmunityLevel = immunityLevel; 277 277 ··· 334 334 const struct ani_cck_level_entry *entry_cck; 335 335 336 336 aniState->noiseFloor = BEACON_RSSI(ah); 337 - ath_print(common, ATH_DBG_ANI, 338 - "**** ccklevel %d=>%d, rssi=%d[lo=%d hi=%d]\n", 339 - aniState->cckNoiseImmunityLevel, immunityLevel, 340 - aniState->noiseFloor, aniState->rssiThrLow, 341 - aniState->rssiThrHigh); 337 + ath_dbg(common, ATH_DBG_ANI, 338 + "**** ccklevel %d=>%d, rssi=%d[lo=%d hi=%d]\n", 339 + aniState->cckNoiseImmunityLevel, immunityLevel, 340 + aniState->noiseFloor, aniState->rssiThrLow, 341 + aniState->rssiThrHigh); 342 342 343 343 if ((ah->opmode == NL80211_IFTYPE_STATION || 344 344 ah->opmode == NL80211_IFTYPE_ADHOC) && ··· 358 358 entry_cck->fir_step_level); 359 359 360 360 /* Skip MRC CCK for pre AR9003 families */ 361 - if (!AR_SREV_9300_20_OR_LATER(ah)) 361 + if (!AR_SREV_9300_20_OR_LATER(ah) || AR_SREV_9485(ah)) 362 362 return; 363 363 364 364 if (aniState->mrcCCKOff == entry_cck->mrc_cck_on) ··· 478 478 479 479 if (ah->opmode != NL80211_IFTYPE_STATION 480 480 && ah->opmode != NL80211_IFTYPE_ADHOC) { 481 - ath_print(common, ATH_DBG_ANI, 482 - "Reset ANI state opmode %u\n", ah->opmode); 481 + ath_dbg(common, ATH_DBG_ANI, 482 + "Reset ANI state opmode %u\n", ah->opmode); 483 483 ah->stats.ast_ani_reset++; 484 484 485 485 if (ah->opmode == NL80211_IFTYPE_AP) { ··· 584 584 ATH9K_ANI_OFDM_DEF_LEVEL || 585 585 aniState->cckNoiseImmunityLevel != 586 586 ATH9K_ANI_CCK_DEF_LEVEL) { 587 - ath_print(common, ATH_DBG_ANI, 588 - "Restore defaults: opmode %u " 589 - "chan %d Mhz/0x%x is_scanning=%d " 590 - "ofdm:%d cck:%d\n", 591 - ah->opmode, 592 - chan->channel, 593 - chan->channelFlags, 594 - is_scanning, 595 - aniState->ofdmNoiseImmunityLevel, 596 - aniState->cckNoiseImmunityLevel); 587 + ath_dbg(common, ATH_DBG_ANI, 588 + "Restore defaults: opmode %u chan %d Mhz/0x%x is_scanning=%d ofdm:%d cck:%d\n", 589 + ah->opmode, 590 + chan->channel, 591 + chan->channelFlags, 592 + is_scanning, 593 + aniState->ofdmNoiseImmunityLevel, 594 + aniState->cckNoiseImmunityLevel); 597 595 598 596 ath9k_hw_set_ofdm_nil(ah, ATH9K_ANI_OFDM_DEF_LEVEL); 599 597 ath9k_hw_set_cck_nil(ah, ATH9K_ANI_CCK_DEF_LEVEL); ··· 600 602 /* 601 603 * restore historical levels for this channel 602 604 */ 603 - ath_print(common, ATH_DBG_ANI, 604 - "Restore history: opmode %u " 605 - "chan %d Mhz/0x%x is_scanning=%d " 606 - "ofdm:%d cck:%d\n", 607 - ah->opmode, 608 - chan->channel, 609 - chan->channelFlags, 610 - is_scanning, 611 - aniState->ofdmNoiseImmunityLevel, 612 - aniState->cckNoiseImmunityLevel); 605 + ath_dbg(common, ATH_DBG_ANI, 606 + "Restore history: opmode %u chan %d Mhz/0x%x is_scanning=%d ofdm:%d cck:%d\n", 607 + ah->opmode, 608 + chan->channel, 609 + chan->channelFlags, 610 + is_scanning, 611 + aniState->ofdmNoiseImmunityLevel, 612 + aniState->cckNoiseImmunityLevel); 613 613 614 614 ath9k_hw_set_ofdm_nil(ah, 615 615 aniState->ofdmNoiseImmunityLevel); ··· 662 666 663 667 if (!use_new_ani(ah) && (phyCnt1 < ofdm_base || phyCnt2 < cck_base)) { 664 668 if (phyCnt1 < ofdm_base) { 665 - ath_print(common, ATH_DBG_ANI, 666 - "phyCnt1 0x%x, resetting " 667 - "counter value to 0x%x\n", 668 - phyCnt1, ofdm_base); 669 + ath_dbg(common, ATH_DBG_ANI, 670 + "phyCnt1 0x%x, resetting counter value to 0x%x\n", 671 + phyCnt1, ofdm_base); 669 672 REG_WRITE(ah, AR_PHY_ERR_1, ofdm_base); 670 673 REG_WRITE(ah, AR_PHY_ERR_MASK_1, 671 674 AR_PHY_ERR_OFDM_TIMING); 672 675 } 673 676 if (phyCnt2 < cck_base) { 674 - ath_print(common, ATH_DBG_ANI, 675 - "phyCnt2 0x%x, resetting " 676 - "counter value to 0x%x\n", 677 - phyCnt2, cck_base); 677 + ath_dbg(common, ATH_DBG_ANI, 678 + "phyCnt2 0x%x, resetting counter value to 0x%x\n", 679 + phyCnt2, cck_base); 678 680 REG_WRITE(ah, AR_PHY_ERR_2, cck_base); 679 681 REG_WRITE(ah, AR_PHY_ERR_MASK_2, 680 682 AR_PHY_ERR_CCK_TIMING); ··· 713 719 cckPhyErrRate = aniState->cckPhyErrCount * 1000 / 714 720 aniState->listenTime; 715 721 716 - ath_print(common, ATH_DBG_ANI, 717 - "listenTime=%d OFDM:%d errs=%d/s CCK:%d " 718 - "errs=%d/s ofdm_turn=%d\n", 719 - aniState->listenTime, 720 - aniState->ofdmNoiseImmunityLevel, 721 - ofdmPhyErrRate, aniState->cckNoiseImmunityLevel, 722 - cckPhyErrRate, aniState->ofdmsTurn); 722 + ath_dbg(common, ATH_DBG_ANI, 723 + "listenTime=%d OFDM:%d errs=%d/s CCK:%d errs=%d/s ofdm_turn=%d\n", 724 + aniState->listenTime, 725 + aniState->ofdmNoiseImmunityLevel, 726 + ofdmPhyErrRate, aniState->cckNoiseImmunityLevel, 727 + cckPhyErrRate, aniState->ofdmsTurn); 723 728 724 729 if (aniState->listenTime > 5 * ah->aniperiod) { 725 730 if (ofdmPhyErrRate <= ah->config.ofdm_trig_low && ··· 748 755 { 749 756 struct ath_common *common = ath9k_hw_common(ah); 750 757 751 - ath_print(common, ATH_DBG_ANI, "Enable MIB counters\n"); 758 + ath_dbg(common, ATH_DBG_ANI, "Enable MIB counters\n"); 752 759 753 760 ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); 754 761 ··· 770 777 { 771 778 struct ath_common *common = ath9k_hw_common(ah); 772 779 773 - ath_print(common, ATH_DBG_ANI, "Disable MIB counters\n"); 780 + ath_dbg(common, ATH_DBG_ANI, "Disable MIB counters\n"); 774 781 775 782 REG_WRITE(ah, AR_MIBC, AR_MIBC_FMC); 776 783 ath9k_hw_update_mibstats(ah, &ah->ah_mibStats); ··· 845 852 struct ath_common *common = ath9k_hw_common(ah); 846 853 int i; 847 854 848 - ath_print(common, ATH_DBG_ANI, "Initialize ANI\n"); 855 + ath_dbg(common, ATH_DBG_ANI, "Initialize ANI\n"); 849 856 850 857 if (use_new_ani(ah)) { 851 858 ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_NEW;
+88 -111
drivers/net/wireless/ath/ath9k/ar5008_phy.c
··· 130 130 /* pre-reverse this field */ 131 131 tmp_reg = ath9k_hw_reverse_bits(new_bias, 3); 132 132 133 - ath_print(common, ATH_DBG_CONFIG, 134 - "Force rf_pwd_icsyndiv to %1d on %4d\n", 135 - new_bias, synth_freq); 133 + ath_dbg(common, ATH_DBG_CONFIG, "Force rf_pwd_icsyndiv to %1d on %4d\n", 134 + new_bias, synth_freq); 136 135 137 136 /* swizzle rf_pwd_icsyndiv */ 138 137 ar5008_hw_phy_modify_rx_buffer(ah->analogBank6Data, tmp_reg, 3, 181, 3); ··· 172 173 channelSel = ((freq - 704) * 2 - 3040) / 10; 173 174 bModeSynth = 1; 174 175 } else { 175 - ath_print(common, ATH_DBG_FATAL, 176 - "Invalid channel %u MHz\n", freq); 176 + ath_err(common, "Invalid channel %u MHz\n", freq); 177 177 return -EINVAL; 178 178 } 179 179 ··· 204 206 channelSel = ath9k_hw_reverse_bits((freq - 4800) / 5, 8); 205 207 aModeRefSel = ath9k_hw_reverse_bits(1, 2); 206 208 } else { 207 - ath_print(common, ATH_DBG_FATAL, 208 - "Invalid channel %u MHz\n", freq); 209 + ath_err(common, "Invalid channel %u MHz\n", freq); 209 210 return -EINVAL; 210 211 } 211 212 ··· 445 448 #define ATH_ALLOC_BANK(bank, size) do { \ 446 449 bank = kzalloc((sizeof(u32) * size), GFP_KERNEL); \ 447 450 if (!bank) { \ 448 - ath_print(common, ATH_DBG_FATAL, \ 449 - "Cannot allocate RF banks\n"); \ 451 + ath_err(common, "Cannot allocate RF banks\n"); \ 450 452 return -ENOMEM; \ 451 453 } \ 452 454 } while (0); ··· 875 879 876 880 /* Write analog registers */ 877 881 if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) { 878 - ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, 879 - "ar5416SetRfRegs failed\n"); 882 + ath_err(ath9k_hw_common(ah), "ar5416SetRfRegs failed\n"); 880 883 return -EIO; 881 884 } 882 885 ··· 1053 1058 u32 level = param; 1054 1059 1055 1060 if (level >= ARRAY_SIZE(ah->totalSizeDesired)) { 1056 - ath_print(common, ATH_DBG_ANI, 1057 - "level out of range (%u > %u)\n", 1058 - level, 1059 - (unsigned)ARRAY_SIZE(ah->totalSizeDesired)); 1061 + ath_dbg(common, ATH_DBG_ANI, 1062 + "level out of range (%u > %zu)\n", 1063 + level, ARRAY_SIZE(ah->totalSizeDesired)); 1060 1064 return false; 1061 1065 } 1062 1066 ··· 1157 1163 u32 level = param; 1158 1164 1159 1165 if (level >= ARRAY_SIZE(firstep)) { 1160 - ath_print(common, ATH_DBG_ANI, 1161 - "level out of range (%u > %u)\n", 1162 - level, 1163 - (unsigned) ARRAY_SIZE(firstep)); 1166 + ath_dbg(common, ATH_DBG_ANI, 1167 + "level out of range (%u > %zu)\n", 1168 + level, ARRAY_SIZE(firstep)); 1164 1169 return false; 1165 1170 } 1166 1171 REG_RMW_FIELD(ah, AR_PHY_FIND_SIG, ··· 1177 1184 u32 level = param; 1178 1185 1179 1186 if (level >= ARRAY_SIZE(cycpwrThr1)) { 1180 - ath_print(common, ATH_DBG_ANI, 1181 - "level out of range (%u > %u)\n", 1182 - level, 1183 - (unsigned) ARRAY_SIZE(cycpwrThr1)); 1187 + ath_dbg(common, ATH_DBG_ANI, 1188 + "level out of range (%u > %zu)\n", 1189 + level, ARRAY_SIZE(cycpwrThr1)); 1184 1190 return false; 1185 1191 } 1186 1192 REG_RMW_FIELD(ah, AR_PHY_TIMING5, ··· 1195 1203 case ATH9K_ANI_PRESENT: 1196 1204 break; 1197 1205 default: 1198 - ath_print(common, ATH_DBG_ANI, 1199 - "invalid cmd %u\n", cmd); 1206 + ath_dbg(common, ATH_DBG_ANI, "invalid cmd %u\n", cmd); 1200 1207 return false; 1201 1208 } 1202 1209 1203 - ath_print(common, ATH_DBG_ANI, "ANI parameters:\n"); 1204 - ath_print(common, ATH_DBG_ANI, 1205 - "noiseImmunityLevel=%d, spurImmunityLevel=%d, " 1206 - "ofdmWeakSigDetectOff=%d\n", 1207 - aniState->noiseImmunityLevel, 1208 - aniState->spurImmunityLevel, 1209 - !aniState->ofdmWeakSigDetectOff); 1210 - ath_print(common, ATH_DBG_ANI, 1211 - "cckWeakSigThreshold=%d, " 1212 - "firstepLevel=%d, listenTime=%d\n", 1213 - aniState->cckWeakSigThreshold, 1214 - aniState->firstepLevel, 1215 - aniState->listenTime); 1216 - ath_print(common, ATH_DBG_ANI, 1210 + ath_dbg(common, ATH_DBG_ANI, "ANI parameters:\n"); 1211 + ath_dbg(common, ATH_DBG_ANI, 1212 + "noiseImmunityLevel=%d, spurImmunityLevel=%d, ofdmWeakSigDetectOff=%d\n", 1213 + aniState->noiseImmunityLevel, 1214 + aniState->spurImmunityLevel, 1215 + !aniState->ofdmWeakSigDetectOff); 1216 + ath_dbg(common, ATH_DBG_ANI, 1217 + "cckWeakSigThreshold=%d, firstepLevel=%d, listenTime=%d\n", 1218 + aniState->cckWeakSigThreshold, 1219 + aniState->firstepLevel, 1220 + aniState->listenTime); 1221 + ath_dbg(common, ATH_DBG_ANI, 1217 1222 "ofdmPhyErrCount=%d, cckPhyErrCount=%d\n\n", 1218 1223 aniState->ofdmPhyErrCount, 1219 1224 aniState->cckPhyErrCount); ··· 1295 1306 AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW); 1296 1307 1297 1308 if (!on != aniState->ofdmWeakSigDetectOff) { 1298 - ath_print(common, ATH_DBG_ANI, 1299 - "** ch %d: ofdm weak signal: %s=>%s\n", 1300 - chan->channel, 1301 - !aniState->ofdmWeakSigDetectOff ? 1302 - "on" : "off", 1303 - on ? "on" : "off"); 1309 + ath_dbg(common, ATH_DBG_ANI, 1310 + "** ch %d: ofdm weak signal: %s=>%s\n", 1311 + chan->channel, 1312 + !aniState->ofdmWeakSigDetectOff ? 1313 + "on" : "off", 1314 + on ? "on" : "off"); 1304 1315 if (on) 1305 1316 ah->stats.ast_ani_ofdmon++; 1306 1317 else ··· 1313 1324 u32 level = param; 1314 1325 1315 1326 if (level >= ARRAY_SIZE(firstep_table)) { 1316 - ath_print(common, ATH_DBG_ANI, 1317 - "ATH9K_ANI_FIRSTEP_LEVEL: level " 1318 - "out of range (%u > %u)\n", 1319 - level, 1320 - (unsigned) ARRAY_SIZE(firstep_table)); 1327 + ath_dbg(common, ATH_DBG_ANI, 1328 + "ATH9K_ANI_FIRSTEP_LEVEL: level out of range (%u > %zu)\n", 1329 + level, ARRAY_SIZE(firstep_table)); 1321 1330 return false; 1322 1331 } 1323 1332 ··· 1350 1363 AR_PHY_FIND_SIG_FIRSTEP_LOW, value2); 1351 1364 1352 1365 if (level != aniState->firstepLevel) { 1353 - ath_print(common, ATH_DBG_ANI, 1354 - "** ch %d: level %d=>%d[def:%d] " 1355 - "firstep[level]=%d ini=%d\n", 1356 - chan->channel, 1357 - aniState->firstepLevel, 1358 - level, 1359 - ATH9K_ANI_FIRSTEP_LVL_NEW, 1360 - value, 1361 - aniState->iniDef.firstep); 1362 - ath_print(common, ATH_DBG_ANI, 1363 - "** ch %d: level %d=>%d[def:%d] " 1364 - "firstep_low[level]=%d ini=%d\n", 1365 - chan->channel, 1366 - aniState->firstepLevel, 1367 - level, 1368 - ATH9K_ANI_FIRSTEP_LVL_NEW, 1369 - value2, 1370 - aniState->iniDef.firstepLow); 1366 + ath_dbg(common, ATH_DBG_ANI, 1367 + "** ch %d: level %d=>%d[def:%d] firstep[level]=%d ini=%d\n", 1368 + chan->channel, 1369 + aniState->firstepLevel, 1370 + level, 1371 + ATH9K_ANI_FIRSTEP_LVL_NEW, 1372 + value, 1373 + aniState->iniDef.firstep); 1374 + ath_dbg(common, ATH_DBG_ANI, 1375 + "** ch %d: level %d=>%d[def:%d] firstep_low[level]=%d ini=%d\n", 1376 + chan->channel, 1377 + aniState->firstepLevel, 1378 + level, 1379 + ATH9K_ANI_FIRSTEP_LVL_NEW, 1380 + value2, 1381 + aniState->iniDef.firstepLow); 1371 1382 if (level > aniState->firstepLevel) 1372 1383 ah->stats.ast_ani_stepup++; 1373 1384 else if (level < aniState->firstepLevel) ··· 1378 1393 u32 level = param; 1379 1394 1380 1395 if (level >= ARRAY_SIZE(cycpwrThr1_table)) { 1381 - ath_print(common, ATH_DBG_ANI, 1382 - "ATH9K_ANI_SPUR_IMMUNITY_LEVEL: level " 1383 - "out of range (%u > %u)\n", 1384 - level, 1385 - (unsigned) ARRAY_SIZE(cycpwrThr1_table)); 1396 + ath_dbg(common, ATH_DBG_ANI, 1397 + "ATH9K_ANI_SPUR_IMMUNITY_LEVEL: level out of range (%u > %zu)\n", 1398 + level, ARRAY_SIZE(cycpwrThr1_table)); 1386 1399 return false; 1387 1400 } 1388 1401 /* ··· 1414 1431 AR_PHY_EXT_TIMING5_CYCPWR_THR1, value2); 1415 1432 1416 1433 if (level != aniState->spurImmunityLevel) { 1417 - ath_print(common, ATH_DBG_ANI, 1418 - "** ch %d: level %d=>%d[def:%d] " 1419 - "cycpwrThr1[level]=%d ini=%d\n", 1420 - chan->channel, 1421 - aniState->spurImmunityLevel, 1422 - level, 1423 - ATH9K_ANI_SPUR_IMMUNE_LVL_NEW, 1424 - value, 1425 - aniState->iniDef.cycpwrThr1); 1426 - ath_print(common, ATH_DBG_ANI, 1427 - "** ch %d: level %d=>%d[def:%d] " 1428 - "cycpwrThr1Ext[level]=%d ini=%d\n", 1429 - chan->channel, 1430 - aniState->spurImmunityLevel, 1431 - level, 1432 - ATH9K_ANI_SPUR_IMMUNE_LVL_NEW, 1433 - value2, 1434 - aniState->iniDef.cycpwrThr1Ext); 1434 + ath_dbg(common, ATH_DBG_ANI, 1435 + "** ch %d: level %d=>%d[def:%d] cycpwrThr1[level]=%d ini=%d\n", 1436 + chan->channel, 1437 + aniState->spurImmunityLevel, 1438 + level, 1439 + ATH9K_ANI_SPUR_IMMUNE_LVL_NEW, 1440 + value, 1441 + aniState->iniDef.cycpwrThr1); 1442 + ath_dbg(common, ATH_DBG_ANI, 1443 + "** ch %d: level %d=>%d[def:%d] cycpwrThr1Ext[level]=%d ini=%d\n", 1444 + chan->channel, 1445 + aniState->spurImmunityLevel, 1446 + level, 1447 + ATH9K_ANI_SPUR_IMMUNE_LVL_NEW, 1448 + value2, 1449 + aniState->iniDef.cycpwrThr1Ext); 1435 1450 if (level > aniState->spurImmunityLevel) 1436 1451 ah->stats.ast_ani_spurup++; 1437 1452 else if (level < aniState->spurImmunityLevel) ··· 1448 1467 case ATH9K_ANI_PRESENT: 1449 1468 break; 1450 1469 default: 1451 - ath_print(common, ATH_DBG_ANI, 1452 - "invalid cmd %u\n", cmd); 1470 + ath_dbg(common, ATH_DBG_ANI, "invalid cmd %u\n", cmd); 1453 1471 return false; 1454 1472 } 1455 1473 1456 - ath_print(common, ATH_DBG_ANI, 1457 - "ANI parameters: SI=%d, ofdmWS=%s FS=%d " 1458 - "MRCcck=%s listenTime=%d " 1459 - "ofdmErrs=%d cckErrs=%d\n", 1460 - aniState->spurImmunityLevel, 1461 - !aniState->ofdmWeakSigDetectOff ? "on" : "off", 1462 - aniState->firstepLevel, 1463 - !aniState->mrcCCKOff ? "on" : "off", 1464 - aniState->listenTime, 1465 - aniState->ofdmPhyErrCount, 1466 - aniState->cckPhyErrCount); 1474 + ath_dbg(common, ATH_DBG_ANI, 1475 + "ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n", 1476 + aniState->spurImmunityLevel, 1477 + !aniState->ofdmWeakSigDetectOff ? "on" : "off", 1478 + aniState->firstepLevel, 1479 + !aniState->mrcCCKOff ? "on" : "off", 1480 + aniState->listenTime, 1481 + aniState->ofdmPhyErrCount, 1482 + aniState->cckPhyErrCount); 1467 1483 return true; 1468 1484 } 1469 1485 ··· 1506 1528 1507 1529 iniDef = &aniState->iniDef; 1508 1530 1509 - ath_print(common, ATH_DBG_ANI, 1510 - "ver %d.%d opmode %u chan %d Mhz/0x%x\n", 1511 - ah->hw_version.macVersion, 1512 - ah->hw_version.macRev, 1513 - ah->opmode, 1514 - chan->channel, 1515 - chan->channelFlags); 1531 + ath_dbg(common, ATH_DBG_ANI, "ver %d.%d opmode %u chan %d Mhz/0x%x\n", 1532 + ah->hw_version.macVersion, 1533 + ah->hw_version.macRev, 1534 + ah->opmode, 1535 + chan->channel, 1536 + chan->channelFlags); 1516 1537 1517 1538 val = REG_READ(ah, AR_PHY_SFCORR); 1518 1539 iniDef->m1Thresh = MS(val, AR_PHY_SFCORR_M1_THRESH);
+106 -110
drivers/net/wireless/ath/ath9k/ar9002_calib.c
··· 39 39 switch (currCal->calData->calType) { 40 40 case IQ_MISMATCH_CAL: 41 41 REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_IQ); 42 - ath_print(common, ATH_DBG_CALIBRATE, 43 - "starting IQ Mismatch Calibration\n"); 42 + ath_dbg(common, ATH_DBG_CALIBRATE, 43 + "starting IQ Mismatch Calibration\n"); 44 44 break; 45 45 case ADC_GAIN_CAL: 46 46 REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_ADC_GAIN); 47 - ath_print(common, ATH_DBG_CALIBRATE, 48 - "starting ADC Gain Calibration\n"); 47 + ath_dbg(common, ATH_DBG_CALIBRATE, 48 + "starting ADC Gain Calibration\n"); 49 49 break; 50 50 case ADC_DC_CAL: 51 51 REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_ADC_DC_PER); 52 - ath_print(common, ATH_DBG_CALIBRATE, 53 - "starting ADC DC Calibration\n"); 52 + ath_dbg(common, ATH_DBG_CALIBRATE, 53 + "starting ADC DC Calibration\n"); 54 54 break; 55 55 } 56 56 ··· 107 107 REG_READ(ah, AR_PHY_CAL_MEAS_1(i)); 108 108 ah->totalIqCorrMeas[i] += 109 109 (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_2(i)); 110 - ath_print(ath9k_hw_common(ah), ATH_DBG_CALIBRATE, 111 - "%d: Chn %d pmi=0x%08x;pmq=0x%08x;iqcm=0x%08x;\n", 112 - ah->cal_samples, i, ah->totalPowerMeasI[i], 113 - ah->totalPowerMeasQ[i], 114 - ah->totalIqCorrMeas[i]); 110 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_CALIBRATE, 111 + "%d: Chn %d pmi=0x%08x;pmq=0x%08x;iqcm=0x%08x;\n", 112 + ah->cal_samples, i, ah->totalPowerMeasI[i], 113 + ah->totalPowerMeasQ[i], 114 + ah->totalIqCorrMeas[i]); 115 115 } 116 116 } 117 117 ··· 129 129 ah->totalAdcQEvenPhase[i] += 130 130 REG_READ(ah, AR_PHY_CAL_MEAS_3(i)); 131 131 132 - ath_print(ath9k_hw_common(ah), ATH_DBG_CALIBRATE, 133 - "%d: Chn %d oddi=0x%08x; eveni=0x%08x; " 134 - "oddq=0x%08x; evenq=0x%08x;\n", 135 - ah->cal_samples, i, 136 - ah->totalAdcIOddPhase[i], 137 - ah->totalAdcIEvenPhase[i], 138 - ah->totalAdcQOddPhase[i], 139 - ah->totalAdcQEvenPhase[i]); 132 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_CALIBRATE, 133 + "%d: Chn %d oddi=0x%08x; eveni=0x%08x; oddq=0x%08x; evenq=0x%08x;\n", 134 + ah->cal_samples, i, 135 + ah->totalAdcIOddPhase[i], 136 + ah->totalAdcIEvenPhase[i], 137 + ah->totalAdcQOddPhase[i], 138 + ah->totalAdcQEvenPhase[i]); 140 139 } 141 140 } 142 141 ··· 153 154 ah->totalAdcDcOffsetQEvenPhase[i] += 154 155 (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_3(i)); 155 156 156 - ath_print(ath9k_hw_common(ah), ATH_DBG_CALIBRATE, 157 - "%d: Chn %d oddi=0x%08x; eveni=0x%08x; " 158 - "oddq=0x%08x; evenq=0x%08x;\n", 159 - ah->cal_samples, i, 160 - ah->totalAdcDcOffsetIOddPhase[i], 161 - ah->totalAdcDcOffsetIEvenPhase[i], 162 - ah->totalAdcDcOffsetQOddPhase[i], 163 - ah->totalAdcDcOffsetQEvenPhase[i]); 157 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_CALIBRATE, 158 + "%d: Chn %d oddi=0x%08x; eveni=0x%08x; oddq=0x%08x; evenq=0x%08x;\n", 159 + ah->cal_samples, i, 160 + ah->totalAdcDcOffsetIOddPhase[i], 161 + ah->totalAdcDcOffsetIEvenPhase[i], 162 + ah->totalAdcDcOffsetQOddPhase[i], 163 + ah->totalAdcDcOffsetQEvenPhase[i]); 164 164 } 165 165 } 166 166 ··· 176 178 powerMeasQ = ah->totalPowerMeasQ[i]; 177 179 iqCorrMeas = ah->totalIqCorrMeas[i]; 178 180 179 - ath_print(common, ATH_DBG_CALIBRATE, 180 - "Starting IQ Cal and Correction for Chain %d\n", 181 - i); 181 + ath_dbg(common, ATH_DBG_CALIBRATE, 182 + "Starting IQ Cal and Correction for Chain %d\n", 183 + i); 182 184 183 - ath_print(common, ATH_DBG_CALIBRATE, 184 - "Orignal: Chn %diq_corr_meas = 0x%08x\n", 185 - i, ah->totalIqCorrMeas[i]); 185 + ath_dbg(common, ATH_DBG_CALIBRATE, 186 + "Orignal: Chn %diq_corr_meas = 0x%08x\n", 187 + i, ah->totalIqCorrMeas[i]); 186 188 187 189 iqCorrNeg = 0; 188 190 ··· 191 193 iqCorrNeg = 1; 192 194 } 193 195 194 - ath_print(common, ATH_DBG_CALIBRATE, 195 - "Chn %d pwr_meas_i = 0x%08x\n", i, powerMeasI); 196 - ath_print(common, ATH_DBG_CALIBRATE, 197 - "Chn %d pwr_meas_q = 0x%08x\n", i, powerMeasQ); 198 - ath_print(common, ATH_DBG_CALIBRATE, "iqCorrNeg is 0x%08x\n", 199 - iqCorrNeg); 196 + ath_dbg(common, ATH_DBG_CALIBRATE, 197 + "Chn %d pwr_meas_i = 0x%08x\n", i, powerMeasI); 198 + ath_dbg(common, ATH_DBG_CALIBRATE, 199 + "Chn %d pwr_meas_q = 0x%08x\n", i, powerMeasQ); 200 + ath_dbg(common, ATH_DBG_CALIBRATE, "iqCorrNeg is 0x%08x\n", 201 + iqCorrNeg); 200 202 201 203 iCoffDenom = (powerMeasI / 2 + powerMeasQ / 2) / 128; 202 204 qCoffDenom = powerMeasQ / 64; ··· 205 207 (qCoffDenom != 0)) { 206 208 iCoff = iqCorrMeas / iCoffDenom; 207 209 qCoff = powerMeasI / qCoffDenom - 64; 208 - ath_print(common, ATH_DBG_CALIBRATE, 209 - "Chn %d iCoff = 0x%08x\n", i, iCoff); 210 - ath_print(common, ATH_DBG_CALIBRATE, 211 - "Chn %d qCoff = 0x%08x\n", i, qCoff); 210 + ath_dbg(common, ATH_DBG_CALIBRATE, 211 + "Chn %d iCoff = 0x%08x\n", i, iCoff); 212 + ath_dbg(common, ATH_DBG_CALIBRATE, 213 + "Chn %d qCoff = 0x%08x\n", i, qCoff); 212 214 213 215 iCoff = iCoff & 0x3f; 214 - ath_print(common, ATH_DBG_CALIBRATE, 215 - "New: Chn %d iCoff = 0x%08x\n", i, iCoff); 216 + ath_dbg(common, ATH_DBG_CALIBRATE, 217 + "New: Chn %d iCoff = 0x%08x\n", i, iCoff); 216 218 if (iqCorrNeg == 0x0) 217 219 iCoff = 0x40 - iCoff; 218 220 ··· 221 223 else if (qCoff <= -16) 222 224 qCoff = -16; 223 225 224 - ath_print(common, ATH_DBG_CALIBRATE, 225 - "Chn %d : iCoff = 0x%x qCoff = 0x%x\n", 226 - i, iCoff, qCoff); 226 + ath_dbg(common, ATH_DBG_CALIBRATE, 227 + "Chn %d : iCoff = 0x%x qCoff = 0x%x\n", 228 + i, iCoff, qCoff); 227 229 228 230 REG_RMW_FIELD(ah, AR_PHY_TIMING_CTRL4(i), 229 231 AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF, ··· 231 233 REG_RMW_FIELD(ah, AR_PHY_TIMING_CTRL4(i), 232 234 AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF, 233 235 qCoff); 234 - ath_print(common, ATH_DBG_CALIBRATE, 235 - "IQ Cal and Correction done for Chain %d\n", 236 - i); 236 + ath_dbg(common, ATH_DBG_CALIBRATE, 237 + "IQ Cal and Correction done for Chain %d\n", 238 + i); 237 239 } 238 240 } 239 241 ··· 253 255 qOddMeasOffset = ah->totalAdcQOddPhase[i]; 254 256 qEvenMeasOffset = ah->totalAdcQEvenPhase[i]; 255 257 256 - ath_print(common, ATH_DBG_CALIBRATE, 257 - "Starting ADC Gain Cal for Chain %d\n", i); 258 + ath_dbg(common, ATH_DBG_CALIBRATE, 259 + "Starting ADC Gain Cal for Chain %d\n", i); 258 260 259 - ath_print(common, ATH_DBG_CALIBRATE, 260 - "Chn %d pwr_meas_odd_i = 0x%08x\n", i, 261 - iOddMeasOffset); 262 - ath_print(common, ATH_DBG_CALIBRATE, 263 - "Chn %d pwr_meas_even_i = 0x%08x\n", i, 264 - iEvenMeasOffset); 265 - ath_print(common, ATH_DBG_CALIBRATE, 266 - "Chn %d pwr_meas_odd_q = 0x%08x\n", i, 267 - qOddMeasOffset); 268 - ath_print(common, ATH_DBG_CALIBRATE, 269 - "Chn %d pwr_meas_even_q = 0x%08x\n", i, 270 - qEvenMeasOffset); 261 + ath_dbg(common, ATH_DBG_CALIBRATE, 262 + "Chn %d pwr_meas_odd_i = 0x%08x\n", i, 263 + iOddMeasOffset); 264 + ath_dbg(common, ATH_DBG_CALIBRATE, 265 + "Chn %d pwr_meas_even_i = 0x%08x\n", i, 266 + iEvenMeasOffset); 267 + ath_dbg(common, ATH_DBG_CALIBRATE, 268 + "Chn %d pwr_meas_odd_q = 0x%08x\n", i, 269 + qOddMeasOffset); 270 + ath_dbg(common, ATH_DBG_CALIBRATE, 271 + "Chn %d pwr_meas_even_q = 0x%08x\n", i, 272 + qEvenMeasOffset); 271 273 272 274 if (iOddMeasOffset != 0 && qEvenMeasOffset != 0) { 273 275 iGainMismatch = ··· 277 279 ((qOddMeasOffset * 32) / 278 280 qEvenMeasOffset) & 0x3f; 279 281 280 - ath_print(common, ATH_DBG_CALIBRATE, 281 - "Chn %d gain_mismatch_i = 0x%08x\n", i, 282 - iGainMismatch); 283 - ath_print(common, ATH_DBG_CALIBRATE, 284 - "Chn %d gain_mismatch_q = 0x%08x\n", i, 285 - qGainMismatch); 282 + ath_dbg(common, ATH_DBG_CALIBRATE, 283 + "Chn %d gain_mismatch_i = 0x%08x\n", i, 284 + iGainMismatch); 285 + ath_dbg(common, ATH_DBG_CALIBRATE, 286 + "Chn %d gain_mismatch_q = 0x%08x\n", i, 287 + qGainMismatch); 286 288 287 289 val = REG_READ(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i)); 288 290 val &= 0xfffff000; 289 291 val |= (qGainMismatch) | (iGainMismatch << 6); 290 292 REG_WRITE(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i), val); 291 293 292 - ath_print(common, ATH_DBG_CALIBRATE, 293 - "ADC Gain Cal done for Chain %d\n", i); 294 + ath_dbg(common, ATH_DBG_CALIBRATE, 295 + "ADC Gain Cal done for Chain %d\n", i); 294 296 } 295 297 } 296 298 ··· 315 317 qOddMeasOffset = ah->totalAdcDcOffsetQOddPhase[i]; 316 318 qEvenMeasOffset = ah->totalAdcDcOffsetQEvenPhase[i]; 317 319 318 - ath_print(common, ATH_DBG_CALIBRATE, 319 - "Starting ADC DC Offset Cal for Chain %d\n", i); 320 + ath_dbg(common, ATH_DBG_CALIBRATE, 321 + "Starting ADC DC Offset Cal for Chain %d\n", i); 320 322 321 - ath_print(common, ATH_DBG_CALIBRATE, 322 - "Chn %d pwr_meas_odd_i = %d\n", i, 323 - iOddMeasOffset); 324 - ath_print(common, ATH_DBG_CALIBRATE, 325 - "Chn %d pwr_meas_even_i = %d\n", i, 326 - iEvenMeasOffset); 327 - ath_print(common, ATH_DBG_CALIBRATE, 328 - "Chn %d pwr_meas_odd_q = %d\n", i, 329 - qOddMeasOffset); 330 - ath_print(common, ATH_DBG_CALIBRATE, 331 - "Chn %d pwr_meas_even_q = %d\n", i, 332 - qEvenMeasOffset); 323 + ath_dbg(common, ATH_DBG_CALIBRATE, 324 + "Chn %d pwr_meas_odd_i = %d\n", i, 325 + iOddMeasOffset); 326 + ath_dbg(common, ATH_DBG_CALIBRATE, 327 + "Chn %d pwr_meas_even_i = %d\n", i, 328 + iEvenMeasOffset); 329 + ath_dbg(common, ATH_DBG_CALIBRATE, 330 + "Chn %d pwr_meas_odd_q = %d\n", i, 331 + qOddMeasOffset); 332 + ath_dbg(common, ATH_DBG_CALIBRATE, 333 + "Chn %d pwr_meas_even_q = %d\n", i, 334 + qEvenMeasOffset); 333 335 334 336 iDcMismatch = (((iEvenMeasOffset - iOddMeasOffset) * 2) / 335 337 numSamples) & 0x1ff; 336 338 qDcMismatch = (((qOddMeasOffset - qEvenMeasOffset) * 2) / 337 339 numSamples) & 0x1ff; 338 340 339 - ath_print(common, ATH_DBG_CALIBRATE, 340 - "Chn %d dc_offset_mismatch_i = 0x%08x\n", i, 341 - iDcMismatch); 342 - ath_print(common, ATH_DBG_CALIBRATE, 343 - "Chn %d dc_offset_mismatch_q = 0x%08x\n", i, 344 - qDcMismatch); 341 + ath_dbg(common, ATH_DBG_CALIBRATE, 342 + "Chn %d dc_offset_mismatch_i = 0x%08x\n", i, 343 + iDcMismatch); 344 + ath_dbg(common, ATH_DBG_CALIBRATE, 345 + "Chn %d dc_offset_mismatch_q = 0x%08x\n", i, 346 + qDcMismatch); 345 347 346 348 val = REG_READ(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i)); 347 349 val &= 0xc0000fff; 348 350 val |= (qDcMismatch << 12) | (iDcMismatch << 21); 349 351 REG_WRITE(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(i), val); 350 352 351 - ath_print(common, ATH_DBG_CALIBRATE, 352 - "ADC DC Offset Cal done for Chain %d\n", i); 353 + ath_dbg(common, ATH_DBG_CALIBRATE, 354 + "ADC DC Offset Cal done for Chain %d\n", i); 353 355 } 354 356 355 357 REG_WRITE(ah, AR_PHY_NEW_ADC_DC_GAIN_CORR(0), ··· 538 540 { 0x7838, 0 }, 539 541 }; 540 542 541 - ath_print(common, ATH_DBG_CALIBRATE, "Running PA Calibration\n"); 543 + ath_dbg(common, ATH_DBG_CALIBRATE, "Running PA Calibration\n"); 542 544 543 545 /* PA CAL is not needed for high power solution */ 544 546 if (ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE) == ··· 719 721 REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL); 720 722 if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, 721 723 AR_PHY_AGC_CONTROL_CAL, 0, AH_WAIT_TIMEOUT)) { 722 - ath_print(common, ATH_DBG_CALIBRATE, "offset " 723 - "calibration failed to complete in " 724 - "1ms; noisy ??\n"); 724 + ath_dbg(common, ATH_DBG_CALIBRATE, 725 + "offset calibration failed to complete in 1ms; noisy environment?\n"); 725 726 return false; 726 727 } 727 728 REG_CLR_BIT(ah, AR_PHY_TURBO, AR_PHY_FC_DYN2040_EN); ··· 733 736 REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL); 734 737 if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL, 735 738 0, AH_WAIT_TIMEOUT)) { 736 - ath_print(common, ATH_DBG_CALIBRATE, "offset calibration " 737 - "failed to complete in 1ms; noisy ??\n"); 739 + ath_dbg(common, ATH_DBG_CALIBRATE, 740 + "offset calibration failed to complete in 1ms; noisy environment?\n"); 738 741 return false; 739 742 } 740 743 ··· 826 829 if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, 827 830 AR_PHY_AGC_CONTROL_CAL, 828 831 0, AH_WAIT_TIMEOUT)) { 829 - ath_print(common, ATH_DBG_CALIBRATE, 830 - "offset calibration failed to " 831 - "complete in 1ms; noisy environment?\n"); 832 + ath_dbg(common, ATH_DBG_CALIBRATE, 833 + "offset calibration failed to complete in 1ms; noisy environment?\n"); 832 834 return false; 833 835 } 834 836 ··· 862 866 863 867 INIT_CAL(&ah->adcgain_caldata); 864 868 INSERT_CAL(ah, &ah->adcgain_caldata); 865 - ath_print(common, ATH_DBG_CALIBRATE, 866 - "enabling ADC Gain Calibration.\n"); 869 + ath_dbg(common, ATH_DBG_CALIBRATE, 870 + "enabling ADC Gain Calibration.\n"); 867 871 868 872 INIT_CAL(&ah->adcdc_caldata); 869 873 INSERT_CAL(ah, &ah->adcdc_caldata); 870 - ath_print(common, ATH_DBG_CALIBRATE, 871 - "enabling ADC DC Calibration.\n"); 874 + ath_dbg(common, ATH_DBG_CALIBRATE, 875 + "enabling ADC DC Calibration.\n"); 872 876 } 873 877 874 878 INIT_CAL(&ah->iq_caldata); 875 879 INSERT_CAL(ah, &ah->iq_caldata); 876 - ath_print(common, ATH_DBG_CALIBRATE, 877 - "enabling IQ Calibration.\n"); 880 + ath_dbg(common, ATH_DBG_CALIBRATE, 881 + "enabling IQ Calibration.\n"); 878 882 879 883 ah->cal_list_curr = ah->cal_list; 880 884
+3 -3
drivers/net/wireless/ath/ath9k/ar9002_hw.c
··· 494 494 case AR_RAD2122_SREV_MAJOR: 495 495 break; 496 496 default: 497 - ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, 498 - "Radio Chip Rev 0x%02X not supported\n", 499 - val & AR_RADIO_SREV_MAJOR); 497 + ath_err(ath9k_hw_common(ah), 498 + "Radio Chip Rev 0x%02X not supported\n", 499 + val & AR_RADIO_SREV_MAJOR); 500 500 return -EOPNOTSUPP; 501 501 } 502 502
+10 -10
drivers/net/wireless/ath/ath9k/ar9002_mac.c
··· 111 111 } 112 112 113 113 if (isr & AR_ISR_RXORN) { 114 - ath_print(common, ATH_DBG_INTERRUPT, 115 - "receive FIFO overrun interrupt\n"); 114 + ath_dbg(common, ATH_DBG_INTERRUPT, 115 + "receive FIFO overrun interrupt\n"); 116 116 } 117 117 118 118 *masked |= mask2; ··· 147 147 148 148 if (fatal_int) { 149 149 if (sync_cause & AR_INTR_SYNC_HOST1_FATAL) { 150 - ath_print(common, ATH_DBG_ANY, 151 - "received PCI FATAL interrupt\n"); 150 + ath_dbg(common, ATH_DBG_ANY, 151 + "received PCI FATAL interrupt\n"); 152 152 } 153 153 if (sync_cause & AR_INTR_SYNC_HOST1_PERR) { 154 - ath_print(common, ATH_DBG_ANY, 155 - "received PCI PERR interrupt\n"); 154 + ath_dbg(common, ATH_DBG_ANY, 155 + "received PCI PERR interrupt\n"); 156 156 } 157 157 *masked |= ATH9K_INT_FATAL; 158 158 } 159 159 if (sync_cause & AR_INTR_SYNC_RADM_CPL_TIMEOUT) { 160 - ath_print(common, ATH_DBG_INTERRUPT, 161 - "AR_INTR_SYNC_RADM_CPL_TIMEOUT\n"); 160 + ath_dbg(common, ATH_DBG_INTERRUPT, 161 + "AR_INTR_SYNC_RADM_CPL_TIMEOUT\n"); 162 162 REG_WRITE(ah, AR_RC, AR_RC_HOSTIF); 163 163 REG_WRITE(ah, AR_RC, 0); 164 164 *masked |= ATH9K_INT_FATAL; 165 165 } 166 166 if (sync_cause & AR_INTR_SYNC_LOCAL_TIMEOUT) { 167 - ath_print(common, ATH_DBG_INTERRUPT, 168 - "AR_INTR_SYNC_LOCAL_TIMEOUT\n"); 167 + ath_dbg(common, ATH_DBG_INTERRUPT, 168 + "AR_INTR_SYNC_LOCAL_TIMEOUT\n"); 169 169 } 170 170 171 171 REG_WRITE(ah, AR_INTR_SYNC_CAUSE_CLR, sync_cause);
+355 -116
drivers/net/wireless/ath/ath9k/ar9003_calib.c
··· 18 18 #include "hw-ops.h" 19 19 #include "ar9003_phy.h" 20 20 21 + #define MPASS 3 22 + #define MAX_MEASUREMENT 8 23 + #define MAX_DIFFERENCE 10 24 + 25 + struct coeff { 26 + int mag_coeff[AR9300_MAX_CHAINS][MAX_MEASUREMENT][MPASS]; 27 + int phs_coeff[AR9300_MAX_CHAINS][MAX_MEASUREMENT][MPASS]; 28 + int iqc_coeff[2]; 29 + }; 30 + 21 31 enum ar9003_cal_types { 22 32 IQ_MISMATCH_CAL = BIT(0), 23 33 TEMP_COMP_CAL = BIT(1), ··· 50 40 currCal->calData->calCountMax); 51 41 REG_WRITE(ah, AR_PHY_CALMODE, AR_PHY_CALMODE_IQ); 52 42 53 - ath_print(common, ATH_DBG_CALIBRATE, 54 - "starting IQ Mismatch Calibration\n"); 43 + ath_dbg(common, ATH_DBG_CALIBRATE, 44 + "starting IQ Mismatch Calibration\n"); 55 45 56 46 /* Kick-off cal */ 57 47 REG_SET_BIT(ah, AR_PHY_TIMING4, AR_PHY_TIMING4_DO_CAL); ··· 62 52 REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_THERM, 63 53 AR_PHY_65NM_CH0_THERM_START, 1); 64 54 65 - ath_print(common, ATH_DBG_CALIBRATE, 66 - "starting Temperature Compensation Calibration\n"); 55 + ath_dbg(common, ATH_DBG_CALIBRATE, 56 + "starting Temperature Compensation Calibration\n"); 67 57 break; 68 58 } 69 59 } ··· 191 181 REG_READ(ah, AR_PHY_CAL_MEAS_1(i)); 192 182 ah->totalIqCorrMeas[i] += 193 183 (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_2(i)); 194 - ath_print(ath9k_hw_common(ah), ATH_DBG_CALIBRATE, 195 - "%d: Chn %d pmi=0x%08x;pmq=0x%08x;iqcm=0x%08x;\n", 196 - ah->cal_samples, i, ah->totalPowerMeasI[i], 197 - ah->totalPowerMeasQ[i], 198 - ah->totalIqCorrMeas[i]); 184 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_CALIBRATE, 185 + "%d: Chn %d pmi=0x%08x;pmq=0x%08x;iqcm=0x%08x;\n", 186 + ah->cal_samples, i, ah->totalPowerMeasI[i], 187 + ah->totalPowerMeasQ[i], 188 + ah->totalIqCorrMeas[i]); 199 189 } 200 190 } 201 191 ··· 217 207 powerMeasQ = ah->totalPowerMeasQ[i]; 218 208 iqCorrMeas = ah->totalIqCorrMeas[i]; 219 209 220 - ath_print(common, ATH_DBG_CALIBRATE, 221 - "Starting IQ Cal and Correction for Chain %d\n", 222 - i); 210 + ath_dbg(common, ATH_DBG_CALIBRATE, 211 + "Starting IQ Cal and Correction for Chain %d\n", 212 + i); 223 213 224 - ath_print(common, ATH_DBG_CALIBRATE, 225 - "Orignal: Chn %diq_corr_meas = 0x%08x\n", 226 - i, ah->totalIqCorrMeas[i]); 214 + ath_dbg(common, ATH_DBG_CALIBRATE, 215 + "Orignal: Chn %diq_corr_meas = 0x%08x\n", 216 + i, ah->totalIqCorrMeas[i]); 227 217 228 218 iqCorrNeg = 0; 229 219 ··· 232 222 iqCorrNeg = 1; 233 223 } 234 224 235 - ath_print(common, ATH_DBG_CALIBRATE, 236 - "Chn %d pwr_meas_i = 0x%08x\n", i, powerMeasI); 237 - ath_print(common, ATH_DBG_CALIBRATE, 238 - "Chn %d pwr_meas_q = 0x%08x\n", i, powerMeasQ); 239 - ath_print(common, ATH_DBG_CALIBRATE, "iqCorrNeg is 0x%08x\n", 240 - iqCorrNeg); 225 + ath_dbg(common, ATH_DBG_CALIBRATE, 226 + "Chn %d pwr_meas_i = 0x%08x\n", i, powerMeasI); 227 + ath_dbg(common, ATH_DBG_CALIBRATE, 228 + "Chn %d pwr_meas_q = 0x%08x\n", i, powerMeasQ); 229 + ath_dbg(common, ATH_DBG_CALIBRATE, "iqCorrNeg is 0x%08x\n", 230 + iqCorrNeg); 241 231 242 232 iCoffDenom = (powerMeasI / 2 + powerMeasQ / 2) / 256; 243 233 qCoffDenom = powerMeasQ / 64; ··· 245 235 if ((iCoffDenom != 0) && (qCoffDenom != 0)) { 246 236 iCoff = iqCorrMeas / iCoffDenom; 247 237 qCoff = powerMeasI / qCoffDenom - 64; 248 - ath_print(common, ATH_DBG_CALIBRATE, 249 - "Chn %d iCoff = 0x%08x\n", i, iCoff); 250 - ath_print(common, ATH_DBG_CALIBRATE, 251 - "Chn %d qCoff = 0x%08x\n", i, qCoff); 238 + ath_dbg(common, ATH_DBG_CALIBRATE, 239 + "Chn %d iCoff = 0x%08x\n", i, iCoff); 240 + ath_dbg(common, ATH_DBG_CALIBRATE, 241 + "Chn %d qCoff = 0x%08x\n", i, qCoff); 252 242 253 243 /* Force bounds on iCoff */ 254 244 if (iCoff >= 63) ··· 269 259 iCoff = iCoff & 0x7f; 270 260 qCoff = qCoff & 0x7f; 271 261 272 - ath_print(common, ATH_DBG_CALIBRATE, 273 - "Chn %d : iCoff = 0x%x qCoff = 0x%x\n", 274 - i, iCoff, qCoff); 275 - ath_print(common, ATH_DBG_CALIBRATE, 276 - "Register offset (0x%04x) " 277 - "before update = 0x%x\n", 278 - offset_array[i], 279 - REG_READ(ah, offset_array[i])); 262 + ath_dbg(common, ATH_DBG_CALIBRATE, 263 + "Chn %d : iCoff = 0x%x qCoff = 0x%x\n", 264 + i, iCoff, qCoff); 265 + ath_dbg(common, ATH_DBG_CALIBRATE, 266 + "Register offset (0x%04x) before update = 0x%x\n", 267 + offset_array[i], 268 + REG_READ(ah, offset_array[i])); 280 269 281 270 REG_RMW_FIELD(ah, offset_array[i], 282 271 AR_PHY_RX_IQCAL_CORR_IQCORR_Q_I_COFF, ··· 283 274 REG_RMW_FIELD(ah, offset_array[i], 284 275 AR_PHY_RX_IQCAL_CORR_IQCORR_Q_Q_COFF, 285 276 qCoff); 286 - ath_print(common, ATH_DBG_CALIBRATE, 287 - "Register offset (0x%04x) QI COFF " 288 - "(bitfields 0x%08x) after update = 0x%x\n", 289 - offset_array[i], 290 - AR_PHY_RX_IQCAL_CORR_IQCORR_Q_I_COFF, 291 - REG_READ(ah, offset_array[i])); 292 - ath_print(common, ATH_DBG_CALIBRATE, 293 - "Register offset (0x%04x) QQ COFF " 294 - "(bitfields 0x%08x) after update = 0x%x\n", 295 - offset_array[i], 296 - AR_PHY_RX_IQCAL_CORR_IQCORR_Q_Q_COFF, 297 - REG_READ(ah, offset_array[i])); 277 + ath_dbg(common, ATH_DBG_CALIBRATE, 278 + "Register offset (0x%04x) QI COFF (bitfields 0x%08x) after update = 0x%x\n", 279 + offset_array[i], 280 + AR_PHY_RX_IQCAL_CORR_IQCORR_Q_I_COFF, 281 + REG_READ(ah, offset_array[i])); 282 + ath_dbg(common, ATH_DBG_CALIBRATE, 283 + "Register offset (0x%04x) QQ COFF (bitfields 0x%08x) after update = 0x%x\n", 284 + offset_array[i], 285 + AR_PHY_RX_IQCAL_CORR_IQCORR_Q_Q_COFF, 286 + REG_READ(ah, offset_array[i])); 298 287 299 - ath_print(common, ATH_DBG_CALIBRATE, 300 - "IQ Cal and Correction done for Chain %d\n", 301 - i); 288 + ath_dbg(common, ATH_DBG_CALIBRATE, 289 + "IQ Cal and Correction done for Chain %d\n", i); 302 290 } 303 291 } 304 292 305 293 REG_SET_BIT(ah, AR_PHY_RX_IQCAL_CORR_B0, 306 294 AR_PHY_RX_IQCAL_CORR_IQCORR_ENABLE); 307 - ath_print(common, ATH_DBG_CALIBRATE, 308 - "IQ Cal and Correction (offset 0x%04x) enabled " 309 - "(bit position 0x%08x). New Value 0x%08x\n", 310 - (unsigned) (AR_PHY_RX_IQCAL_CORR_B0), 311 - AR_PHY_RX_IQCAL_CORR_IQCORR_ENABLE, 312 - REG_READ(ah, AR_PHY_RX_IQCAL_CORR_B0)); 295 + ath_dbg(common, ATH_DBG_CALIBRATE, 296 + "IQ Cal and Correction (offset 0x%04x) enabled (bit position 0x%08x). New Value 0x%08x\n", 297 + (unsigned) (AR_PHY_RX_IQCAL_CORR_B0), 298 + AR_PHY_RX_IQCAL_CORR_IQCORR_ENABLE, 299 + REG_READ(ah, AR_PHY_RX_IQCAL_CORR_B0)); 313 300 } 314 301 315 302 static const struct ath9k_percal_data iq_cal_single_sample = { ··· 345 340 f2 = (f1 * f1 + f3 * f3) / result_shift; 346 341 347 342 if (!f2) { 348 - ath_print(common, ATH_DBG_CALIBRATE, "Divide by 0\n"); 343 + ath_dbg(common, ATH_DBG_CALIBRATE, "Divide by 0\n"); 349 344 return false; 350 345 } 351 346 ··· 466 461 467 462 if ((i2_p_q2_a0_d0 == 0) || (i2_p_q2_a0_d1 == 0) || 468 463 (i2_p_q2_a1_d0 == 0) || (i2_p_q2_a1_d1 == 0)) { 469 - ath_print(common, ATH_DBG_CALIBRATE, 470 - "Divide by 0:\na0_d0=%d\n" 471 - "a0_d1=%d\na2_d0=%d\na1_d1=%d\n", 472 - i2_p_q2_a0_d0, i2_p_q2_a0_d1, 473 - i2_p_q2_a1_d0, i2_p_q2_a1_d1); 464 + ath_dbg(common, ATH_DBG_CALIBRATE, 465 + "Divide by 0:\n" 466 + "a0_d0=%d\n" 467 + "a0_d1=%d\n" 468 + "a2_d0=%d\n" 469 + "a1_d1=%d\n", 470 + i2_p_q2_a0_d0, i2_p_q2_a0_d1, 471 + i2_p_q2_a1_d0, i2_p_q2_a1_d1); 474 472 return false; 475 473 } 476 474 ··· 506 498 mag2 = ar9003_hw_find_mag_approx(ah, cos_2phi_2, sin_2phi_2); 507 499 508 500 if ((mag1 == 0) || (mag2 == 0)) { 509 - ath_print(common, ATH_DBG_CALIBRATE, 510 - "Divide by 0: mag1=%d, mag2=%d\n", 511 - mag1, mag2); 501 + ath_dbg(common, ATH_DBG_CALIBRATE, 502 + "Divide by 0: mag1=%d, mag2=%d\n", 503 + mag1, mag2); 512 504 return false; 513 505 } 514 506 ··· 525 517 mag_a0_d0, phs_a0_d0, 526 518 mag_a1_d0, 527 519 phs_a1_d0, solved_eq)) { 528 - ath_print(common, ATH_DBG_CALIBRATE, 529 - "Call to ar9003_hw_solve_iq_cal() failed.\n"); 520 + ath_dbg(common, ATH_DBG_CALIBRATE, 521 + "Call to ar9003_hw_solve_iq_cal() failed.\n"); 530 522 return false; 531 523 } 532 524 ··· 535 527 mag_rx = solved_eq[2]; 536 528 phs_rx = solved_eq[3]; 537 529 538 - ath_print(common, ATH_DBG_CALIBRATE, 539 - "chain %d: mag mismatch=%d phase mismatch=%d\n", 540 - chain_idx, mag_tx/res_scale, phs_tx/res_scale); 530 + ath_dbg(common, ATH_DBG_CALIBRATE, 531 + "chain %d: mag mismatch=%d phase mismatch=%d\n", 532 + chain_idx, mag_tx/res_scale, phs_tx/res_scale); 541 533 542 534 if (res_scale == mag_tx) { 543 - ath_print(common, ATH_DBG_CALIBRATE, 544 - "Divide by 0: mag_tx=%d, res_scale=%d\n", 545 - mag_tx, res_scale); 535 + ath_dbg(common, ATH_DBG_CALIBRATE, 536 + "Divide by 0: mag_tx=%d, res_scale=%d\n", 537 + mag_tx, res_scale); 546 538 return false; 547 539 } 548 540 ··· 553 545 q_q_coff = (mag_corr_tx * 128 / res_scale); 554 546 q_i_coff = (phs_corr_tx * 256 / res_scale); 555 547 556 - ath_print(common, ATH_DBG_CALIBRATE, 557 - "tx chain %d: mag corr=%d phase corr=%d\n", 558 - chain_idx, q_q_coff, q_i_coff); 548 + ath_dbg(common, ATH_DBG_CALIBRATE, 549 + "tx chain %d: mag corr=%d phase corr=%d\n", 550 + chain_idx, q_q_coff, q_i_coff); 559 551 560 552 if (q_i_coff < -63) 561 553 q_i_coff = -63; ··· 568 560 569 561 iqc_coeff[0] = (q_q_coff * 128) + q_i_coff; 570 562 571 - ath_print(common, ATH_DBG_CALIBRATE, 572 - "tx chain %d: iq corr coeff=%x\n", 573 - chain_idx, iqc_coeff[0]); 563 + ath_dbg(common, ATH_DBG_CALIBRATE, 564 + "tx chain %d: iq corr coeff=%x\n", 565 + chain_idx, iqc_coeff[0]); 574 566 575 567 if (-mag_rx == res_scale) { 576 - ath_print(common, ATH_DBG_CALIBRATE, 577 - "Divide by 0: mag_rx=%d, res_scale=%d\n", 578 - mag_rx, res_scale); 568 + ath_dbg(common, ATH_DBG_CALIBRATE, 569 + "Divide by 0: mag_rx=%d, res_scale=%d\n", 570 + mag_rx, res_scale); 579 571 return false; 580 572 } 581 573 ··· 586 578 q_q_coff = (mag_corr_rx * 128 / res_scale); 587 579 q_i_coff = (phs_corr_rx * 256 / res_scale); 588 580 589 - ath_print(common, ATH_DBG_CALIBRATE, 590 - "rx chain %d: mag corr=%d phase corr=%d\n", 591 - chain_idx, q_q_coff, q_i_coff); 581 + ath_dbg(common, ATH_DBG_CALIBRATE, 582 + "rx chain %d: mag corr=%d phase corr=%d\n", 583 + chain_idx, q_q_coff, q_i_coff); 592 584 593 585 if (q_i_coff < -63) 594 586 q_i_coff = -63; ··· 601 593 602 594 iqc_coeff[1] = (q_q_coff * 128) + q_i_coff; 603 595 604 - ath_print(common, ATH_DBG_CALIBRATE, 605 - "rx chain %d: iq corr coeff=%x\n", 606 - chain_idx, iqc_coeff[1]); 596 + ath_dbg(common, ATH_DBG_CALIBRATE, 597 + "rx chain %d: iq corr coeff=%x\n", 598 + chain_idx, iqc_coeff[1]); 607 599 608 600 return true; 609 601 } ··· 616 608 AR_PHY_TX_IQCAL_STATUS_B1, 617 609 AR_PHY_TX_IQCAL_STATUS_B2, 618 610 }; 619 - static const u32 tx_corr_coeff[AR9300_MAX_CHAINS] = { 620 - AR_PHY_TX_IQCAL_CORR_COEFF_01_B0, 621 - AR_PHY_TX_IQCAL_CORR_COEFF_01_B1, 622 - AR_PHY_TX_IQCAL_CORR_COEFF_01_B2, 623 - }; 624 611 static const u32 rx_corr[AR9300_MAX_CHAINS] = { 625 612 AR_PHY_RX_IQCAL_CORR_B0, 626 613 AR_PHY_RX_IQCAL_CORR_B1, ··· 626 623 AR_PHY_CHAN_INFO_TAB_1, 627 624 AR_PHY_CHAN_INFO_TAB_2, 628 625 }; 626 + u32 tx_corr_coeff[AR9300_MAX_CHAINS]; 629 627 s32 iq_res[6]; 630 628 s32 iqc_coeff[2]; 631 629 s32 i, j; 632 630 u32 num_chains = 0; 631 + 632 + tx_corr_coeff[0] = AR_PHY_TX_IQCAL_CORR_COEFF_B0(0); 633 + tx_corr_coeff[1] = AR_PHY_TX_IQCAL_CORR_COEFF_B1(0); 634 + tx_corr_coeff[2] = AR_PHY_TX_IQCAL_CORR_COEFF_B2(0); 633 635 634 636 for (i = 0; i < AR9300_MAX_CHAINS; i++) { 635 637 if (ah->txchainmask & (1 << i)) ··· 651 643 if (!ath9k_hw_wait(ah, AR_PHY_TX_IQCAL_START, 652 644 AR_PHY_TX_IQCAL_START_DO_CAL, 653 645 0, AH_WAIT_TIMEOUT)) { 654 - ath_print(common, ATH_DBG_CALIBRATE, 655 - "Tx IQ Cal not complete.\n"); 646 + ath_dbg(common, ATH_DBG_CALIBRATE, 647 + "Tx IQ Cal not complete.\n"); 656 648 goto TX_IQ_CAL_FAILED; 657 649 } 658 650 659 651 for (i = 0; i < num_chains; i++) { 660 - ath_print(common, ATH_DBG_CALIBRATE, 661 - "Doing Tx IQ Cal for chain %d.\n", i); 652 + ath_dbg(common, ATH_DBG_CALIBRATE, 653 + "Doing Tx IQ Cal for chain %d.\n", i); 662 654 663 655 if (REG_READ(ah, txiqcal_status[i]) & 664 656 AR_PHY_TX_IQCAL_STATUS_FAILED) { 665 - ath_print(common, ATH_DBG_CALIBRATE, 666 - "Tx IQ Cal failed for chain %d.\n", i); 657 + ath_dbg(common, ATH_DBG_CALIBRATE, 658 + "Tx IQ Cal failed for chain %d.\n", i); 667 659 goto TX_IQ_CAL_FAILED; 668 660 } 669 661 ··· 685 677 chan_info_tab[i] + 686 678 offset); 687 679 688 - ath_print(common, ATH_DBG_CALIBRATE, 689 - "IQ RES[%d]=0x%x IQ_RES[%d]=0x%x\n", 690 - idx, iq_res[idx], idx+1, iq_res[idx+1]); 680 + ath_dbg(common, ATH_DBG_CALIBRATE, 681 + "IQ RES[%d]=0x%x IQ_RES[%d]=0x%x\n", 682 + idx, iq_res[idx], idx+1, iq_res[idx+1]); 691 683 } 692 684 693 685 if (!ar9003_hw_calc_iq_corr(ah, i, iq_res, iqc_coeff)) { 694 - ath_print(common, ATH_DBG_CALIBRATE, 695 - "Failed in calculation of IQ correction.\n"); 686 + ath_dbg(common, ATH_DBG_CALIBRATE, 687 + "Failed in calculation of IQ correction.\n"); 696 688 goto TX_IQ_CAL_FAILED; 697 689 } 698 690 699 - ath_print(common, ATH_DBG_CALIBRATE, 700 - "IQ_COEFF[0] = 0x%x IQ_COEFF[1] = 0x%x\n", 701 - iqc_coeff[0], iqc_coeff[1]); 691 + ath_dbg(common, ATH_DBG_CALIBRATE, 692 + "IQ_COEFF[0] = 0x%x IQ_COEFF[1] = 0x%x\n", 693 + iqc_coeff[0], iqc_coeff[1]); 702 694 703 695 REG_RMW_FIELD(ah, tx_corr_coeff[i], 704 696 AR_PHY_TX_IQCAL_CORR_COEFF_01_COEFF_TABLE, ··· 719 711 return; 720 712 721 713 TX_IQ_CAL_FAILED: 722 - ath_print(common, ATH_DBG_CALIBRATE, "Tx IQ Cal failed\n"); 714 + ath_dbg(common, ATH_DBG_CALIBRATE, "Tx IQ Cal failed\n"); 723 715 } 724 716 717 + static bool ar9003_hw_compute_closest_pass_and_avg(int *mp_coeff, int *mp_avg) 718 + { 719 + int diff[MPASS]; 720 + 721 + diff[0] = abs(mp_coeff[0] - mp_coeff[1]); 722 + diff[1] = abs(mp_coeff[1] - mp_coeff[2]); 723 + diff[2] = abs(mp_coeff[2] - mp_coeff[0]); 724 + 725 + if (diff[0] > MAX_MEASUREMENT && 726 + diff[1] > MAX_MEASUREMENT && 727 + diff[2] > MAX_MEASUREMENT) 728 + return false; 729 + 730 + if (diff[0] <= diff[1] && diff[0] <= diff[2]) 731 + *mp_avg = (mp_coeff[0] + mp_coeff[1]) / 2; 732 + else if (diff[1] <= diff[2]) 733 + *mp_avg = (mp_coeff[1] + mp_coeff[2]) / 2; 734 + else 735 + *mp_avg = (mp_coeff[2] + mp_coeff[0]) / 2; 736 + 737 + return true; 738 + } 739 + 740 + static void ar9003_hw_tx_iqcal_load_avg_2_passes(struct ath_hw *ah, 741 + u8 num_chains, 742 + struct coeff *coeff) 743 + { 744 + struct ath_common *common = ath9k_hw_common(ah); 745 + int i, im, nmeasurement; 746 + int magnitude, phase; 747 + u32 tx_corr_coeff[MAX_MEASUREMENT][AR9300_MAX_CHAINS]; 748 + 749 + memset(tx_corr_coeff, 0, sizeof(tx_corr_coeff)); 750 + for (i = 0; i < MAX_MEASUREMENT / 2; i++) { 751 + tx_corr_coeff[i * 2][0] = tx_corr_coeff[(i * 2) + 1][0] = 752 + AR_PHY_TX_IQCAL_CORR_COEFF_B0(i); 753 + if (!AR_SREV_9485(ah)) { 754 + tx_corr_coeff[i * 2][1] = 755 + tx_corr_coeff[(i * 2) + 1][1] = 756 + AR_PHY_TX_IQCAL_CORR_COEFF_B1(i); 757 + 758 + tx_corr_coeff[i * 2][2] = 759 + tx_corr_coeff[(i * 2) + 1][2] = 760 + AR_PHY_TX_IQCAL_CORR_COEFF_B2(i); 761 + } 762 + } 763 + 764 + /* Load the average of 2 passes */ 765 + for (i = 0; i < num_chains; i++) { 766 + if (AR_SREV_9485(ah)) 767 + nmeasurement = REG_READ_FIELD(ah, 768 + AR_PHY_TX_IQCAL_STATUS_B0_9485, 769 + AR_PHY_CALIBRATED_GAINS_0); 770 + else 771 + nmeasurement = REG_READ_FIELD(ah, 772 + AR_PHY_TX_IQCAL_STATUS_B0, 773 + AR_PHY_CALIBRATED_GAINS_0); 774 + 775 + if (nmeasurement > MAX_MEASUREMENT) 776 + nmeasurement = MAX_MEASUREMENT; 777 + 778 + for (im = 0; im < nmeasurement; im++) { 779 + /* 780 + * Determine which 2 passes are closest and compute avg 781 + * magnitude 782 + */ 783 + if (!ar9003_hw_compute_closest_pass_and_avg(coeff->mag_coeff[i][im], 784 + &magnitude)) 785 + goto disable_txiqcal; 786 + 787 + /* 788 + * Determine which 2 passes are closest and compute avg 789 + * phase 790 + */ 791 + if (!ar9003_hw_compute_closest_pass_and_avg(coeff->phs_coeff[i][im], 792 + &phase)) 793 + goto disable_txiqcal; 794 + 795 + coeff->iqc_coeff[0] = (magnitude & 0x7f) | 796 + ((phase & 0x7f) << 7); 797 + 798 + if ((im % 2) == 0) 799 + REG_RMW_FIELD(ah, tx_corr_coeff[im][i], 800 + AR_PHY_TX_IQCAL_CORR_COEFF_00_COEFF_TABLE, 801 + coeff->iqc_coeff[0]); 802 + else 803 + REG_RMW_FIELD(ah, tx_corr_coeff[im][i], 804 + AR_PHY_TX_IQCAL_CORR_COEFF_01_COEFF_TABLE, 805 + coeff->iqc_coeff[0]); 806 + } 807 + } 808 + 809 + REG_RMW_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_3, 810 + AR_PHY_TX_IQCAL_CONTROL_3_IQCORR_EN, 0x1); 811 + REG_RMW_FIELD(ah, AR_PHY_RX_IQCAL_CORR_B0, 812 + AR_PHY_RX_IQCAL_CORR_B0_LOOPBACK_IQCORR_EN, 0x1); 813 + 814 + return; 815 + 816 + disable_txiqcal: 817 + REG_RMW_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_3, 818 + AR_PHY_TX_IQCAL_CONTROL_3_IQCORR_EN, 0x0); 819 + REG_RMW_FIELD(ah, AR_PHY_RX_IQCAL_CORR_B0, 820 + AR_PHY_RX_IQCAL_CORR_B0_LOOPBACK_IQCORR_EN, 0x0); 821 + 822 + ath_dbg(common, ATH_DBG_CALIBRATE, "TX IQ Cal disabled\n"); 823 + } 824 + 825 + static void ar9003_hw_tx_iq_cal_run(struct ath_hw *ah) 826 + { 827 + u8 tx_gain_forced; 828 + 829 + REG_RMW_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_1_9485, 830 + AR_PHY_TX_IQCAQL_CONTROL_1_IQCORR_I_Q_COFF_DELPT, DELPT); 831 + tx_gain_forced = REG_READ_FIELD(ah, AR_PHY_TX_FORCED_GAIN, 832 + AR_PHY_TXGAIN_FORCE); 833 + if (tx_gain_forced) 834 + REG_RMW_FIELD(ah, AR_PHY_TX_FORCED_GAIN, 835 + AR_PHY_TXGAIN_FORCE, 0); 836 + 837 + REG_RMW_FIELD(ah, AR_PHY_TX_IQCAL_START_9485, 838 + AR_PHY_TX_IQCAL_START_DO_CAL_9485, 1); 839 + } 840 + 841 + static void ar9003_hw_tx_iq_cal_post_proc(struct ath_hw *ah) 842 + { 843 + struct ath_common *common = ath9k_hw_common(ah); 844 + const u32 txiqcal_status[AR9300_MAX_CHAINS] = { 845 + AR_PHY_TX_IQCAL_STATUS_B0_9485, 846 + AR_PHY_TX_IQCAL_STATUS_B1, 847 + AR_PHY_TX_IQCAL_STATUS_B2, 848 + }; 849 + const u_int32_t chan_info_tab[] = { 850 + AR_PHY_CHAN_INFO_TAB_0, 851 + AR_PHY_CHAN_INFO_TAB_1, 852 + AR_PHY_CHAN_INFO_TAB_2, 853 + }; 854 + struct coeff coeff; 855 + s32 iq_res[6]; 856 + u8 num_chains = 0; 857 + int i, ip, im, j; 858 + int nmeasurement; 859 + 860 + for (i = 0; i < AR9300_MAX_CHAINS; i++) { 861 + if (ah->txchainmask & (1 << i)) 862 + num_chains++; 863 + } 864 + 865 + for (ip = 0; ip < MPASS; ip++) { 866 + for (i = 0; i < num_chains; i++) { 867 + nmeasurement = REG_READ_FIELD(ah, 868 + AR_PHY_TX_IQCAL_STATUS_B0_9485, 869 + AR_PHY_CALIBRATED_GAINS_0); 870 + if (nmeasurement > MAX_MEASUREMENT) 871 + nmeasurement = MAX_MEASUREMENT; 872 + 873 + for (im = 0; im < nmeasurement; im++) { 874 + ath_dbg(common, ATH_DBG_CALIBRATE, 875 + "Doing Tx IQ Cal for chain %d.\n", i); 876 + 877 + if (REG_READ(ah, txiqcal_status[i]) & 878 + AR_PHY_TX_IQCAL_STATUS_FAILED) { 879 + ath_dbg(common, ATH_DBG_CALIBRATE, 880 + "Tx IQ Cal failed for chain %d.\n", i); 881 + goto tx_iqcal_fail; 882 + } 883 + 884 + for (j = 0; j < 3; j++) { 885 + u32 idx = 2 * j, offset = 4 * (3 * im + j); 886 + 887 + REG_RMW_FIELD(ah, 888 + AR_PHY_CHAN_INFO_MEMORY, 889 + AR_PHY_CHAN_INFO_TAB_S2_READ, 890 + 0); 891 + 892 + /* 32 bits */ 893 + iq_res[idx] = REG_READ(ah, 894 + chan_info_tab[i] + 895 + offset); 896 + 897 + REG_RMW_FIELD(ah, 898 + AR_PHY_CHAN_INFO_MEMORY, 899 + AR_PHY_CHAN_INFO_TAB_S2_READ, 900 + 1); 901 + 902 + /* 16 bits */ 903 + iq_res[idx + 1] = 0xffff & REG_READ(ah, 904 + chan_info_tab[i] + offset); 905 + 906 + ath_dbg(common, ATH_DBG_CALIBRATE, 907 + "IQ RES[%d]=0x%x" 908 + "IQ_RES[%d]=0x%x\n", 909 + idx, iq_res[idx], idx + 1, 910 + iq_res[idx + 1]); 911 + } 912 + 913 + if (!ar9003_hw_calc_iq_corr(ah, i, iq_res, 914 + coeff.iqc_coeff)) { 915 + ath_dbg(common, ATH_DBG_CALIBRATE, 916 + "Failed in calculation of IQ correction.\n"); 917 + goto tx_iqcal_fail; 918 + } 919 + 920 + coeff.mag_coeff[i][im][ip] = 921 + coeff.iqc_coeff[0] & 0x7f; 922 + coeff.phs_coeff[i][im][ip] = 923 + (coeff.iqc_coeff[0] >> 7) & 0x7f; 924 + 925 + if (coeff.mag_coeff[i][im][ip] > 63) 926 + coeff.mag_coeff[i][im][ip] -= 128; 927 + if (coeff.phs_coeff[i][im][ip] > 63) 928 + coeff.phs_coeff[i][im][ip] -= 128; 929 + } 930 + } 931 + } 932 + ar9003_hw_tx_iqcal_load_avg_2_passes(ah, num_chains, &coeff); 933 + 934 + return; 935 + 936 + tx_iqcal_fail: 937 + ath_dbg(common, ATH_DBG_CALIBRATE, "Tx IQ Cal failed\n"); 938 + return; 939 + } 725 940 static bool ar9003_hw_init_cal(struct ath_hw *ah, 726 941 struct ath9k_channel *chan) 727 942 { ··· 952 721 int val; 953 722 954 723 val = REG_READ(ah, AR_ENT_OTP); 955 - ath_print(common, ATH_DBG_CALIBRATE, "ath9k: AR_ENT_OTP 0x%x\n", val); 724 + ath_dbg(common, ATH_DBG_CALIBRATE, "ath9k: AR_ENT_OTP 0x%x\n", val); 956 725 957 - if (val & AR_ENT_OTP_CHAIN2_DISABLE) 726 + if (AR_SREV_9485(ah)) 727 + ar9003_hw_set_chain_masks(ah, 0x1, 0x1); 728 + else if (val & AR_ENT_OTP_CHAIN2_DISABLE) 958 729 ar9003_hw_set_chain_masks(ah, 0x3, 0x3); 959 730 else 960 731 /* ··· 966 733 ar9003_hw_set_chain_masks(ah, 0x7, 0x7); 967 734 968 735 /* Do Tx IQ Calibration */ 969 - ar9003_hw_tx_iq_cal(ah); 736 + if (AR_SREV_9485(ah)) 737 + ar9003_hw_tx_iq_cal_run(ah); 738 + else 739 + ar9003_hw_tx_iq_cal(ah); 740 + 970 741 REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_DIS); 971 742 udelay(5); 972 743 REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); ··· 983 746 /* Poll for offset calibration complete */ 984 747 if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL, 985 748 0, AH_WAIT_TIMEOUT)) { 986 - ath_print(common, ATH_DBG_CALIBRATE, 987 - "offset calibration failed to " 988 - "complete in 1ms; noisy environment?\n"); 749 + ath_dbg(common, ATH_DBG_CALIBRATE, 750 + "offset calibration failed to complete in 1ms; noisy environment?\n"); 989 751 return false; 990 752 } 753 + 754 + if (AR_SREV_9485(ah)) 755 + ar9003_hw_tx_iq_cal_post_proc(ah); 991 756 992 757 /* Revert chainmasks to their original values before NF cal */ 993 758 ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); ··· 1003 764 if (ah->supp_cals & IQ_MISMATCH_CAL) { 1004 765 INIT_CAL(&ah->iq_caldata); 1005 766 INSERT_CAL(ah, &ah->iq_caldata); 1006 - ath_print(common, ATH_DBG_CALIBRATE, 1007 - "enabling IQ Calibration.\n"); 767 + ath_dbg(common, ATH_DBG_CALIBRATE, 768 + "enabling IQ Calibration.\n"); 1008 769 } 1009 770 1010 771 if (ah->supp_cals & TEMP_COMP_CAL) { 1011 772 INIT_CAL(&ah->tempCompCalData); 1012 773 INSERT_CAL(ah, &ah->tempCompCalData); 1013 - ath_print(common, ATH_DBG_CALIBRATE, 1014 - "enabling Temperature Compensation Calibration.\n"); 774 + ath_dbg(common, ATH_DBG_CALIBRATE, 775 + "enabling Temperature Compensation Calibration.\n"); 1015 776 } 1016 777 1017 778 /* Initialize current pointer to first element in list */
+223 -138
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
··· 3035 3035 return !!(pBase->featureEnable & BIT(5)); 3036 3036 case EEP_CHAIN_MASK_REDUCE: 3037 3037 return (pBase->miscConfiguration >> 0x3) & 0x1; 3038 + case EEP_ANT_DIV_CTL1: 3039 + return le32_to_cpu(eep->base_ext1.ant_div_control); 3038 3040 default: 3039 3041 return 0; 3040 3042 } ··· 3075 3073 int i; 3076 3074 3077 3075 if ((address < 0) || ((address + count) / 2 > AR9300_EEPROM_SIZE - 1)) { 3078 - ath_print(common, ATH_DBG_EEPROM, 3079 - "eeprom address not in range\n"); 3076 + ath_dbg(common, ATH_DBG_EEPROM, 3077 + "eeprom address not in range\n"); 3080 3078 return false; 3081 3079 } 3082 3080 ··· 3107 3105 return true; 3108 3106 3109 3107 error: 3110 - ath_print(common, ATH_DBG_EEPROM, 3111 - "unable to read eeprom region at offset %d\n", address); 3108 + ath_dbg(common, ATH_DBG_EEPROM, 3109 + "unable to read eeprom region at offset %d\n", address); 3112 3110 return false; 3113 3111 } 3114 3112 ··· 3192 3190 length &= 0xff; 3193 3191 3194 3192 if (length > 0 && spot >= 0 && spot+length <= mdataSize) { 3195 - ath_print(common, ATH_DBG_EEPROM, 3196 - "Restore at %d: spot=%d " 3197 - "offset=%d length=%d\n", 3198 - it, spot, offset, length); 3193 + ath_dbg(common, ATH_DBG_EEPROM, 3194 + "Restore at %d: spot=%d offset=%d length=%d\n", 3195 + it, spot, offset, length); 3199 3196 memcpy(&mptr[spot], &block[it+2], length); 3200 3197 spot += length; 3201 3198 } else if (length > 0) { 3202 - ath_print(common, ATH_DBG_EEPROM, 3203 - "Bad restore at %d: spot=%d " 3204 - "offset=%d length=%d\n", 3205 - it, spot, offset, length); 3199 + ath_dbg(common, ATH_DBG_EEPROM, 3200 + "Bad restore at %d: spot=%d offset=%d length=%d\n", 3201 + it, spot, offset, length); 3206 3202 return false; 3207 3203 } 3208 3204 } ··· 3221 3221 switch (code) { 3222 3222 case _CompressNone: 3223 3223 if (length != mdata_size) { 3224 - ath_print(common, ATH_DBG_EEPROM, 3225 - "EEPROM structure size mismatch" 3226 - "memory=%d eeprom=%d\n", mdata_size, length); 3224 + ath_dbg(common, ATH_DBG_EEPROM, 3225 + "EEPROM structure size mismatch memory=%d eeprom=%d\n", 3226 + mdata_size, length); 3227 3227 return -1; 3228 3228 } 3229 3229 memcpy(mptr, (u8 *) (word + COMP_HDR_LEN), length); 3230 - ath_print(common, ATH_DBG_EEPROM, "restored eeprom %d:" 3231 - " uncompressed, length %d\n", it, length); 3230 + ath_dbg(common, ATH_DBG_EEPROM, 3231 + "restored eeprom %d: uncompressed, length %d\n", 3232 + it, length); 3232 3233 break; 3233 3234 case _CompressBlock: 3234 3235 if (reference == 0) { ··· 3237 3236 } else { 3238 3237 eep = ar9003_eeprom_struct_find_by_id(reference); 3239 3238 if (eep == NULL) { 3240 - ath_print(common, ATH_DBG_EEPROM, 3241 - "cant find reference eeprom" 3242 - "struct %d\n", reference); 3239 + ath_dbg(common, ATH_DBG_EEPROM, 3240 + "cant find reference eeprom struct %d\n", 3241 + reference); 3243 3242 return -1; 3244 3243 } 3245 3244 memcpy(mptr, eep, mdata_size); 3246 3245 } 3247 - ath_print(common, ATH_DBG_EEPROM, 3248 - "restore eeprom %d: block, reference %d," 3249 - " length %d\n", it, reference, length); 3246 + ath_dbg(common, ATH_DBG_EEPROM, 3247 + "restore eeprom %d: block, reference %d, length %d\n", 3248 + it, reference, length); 3250 3249 ar9300_uncompress_block(ah, mptr, mdata_size, 3251 3250 (u8 *) (word + COMP_HDR_LEN), length); 3252 3251 break; 3253 3252 default: 3254 - ath_print(common, ATH_DBG_EEPROM, "unknown compression" 3255 - " code %d\n", code); 3253 + ath_dbg(common, ATH_DBG_EEPROM, 3254 + "unknown compression code %d\n", code); 3256 3255 return -1; 3257 3256 } 3258 3257 return 0; ··· 3322 3321 memcpy(mptr, &ar9300_default, mdata_size); 3323 3322 3324 3323 read = ar9300_read_eeprom; 3325 - cptr = AR9300_BASE_ADDR; 3326 - ath_print(common, ATH_DBG_EEPROM, 3324 + if (AR_SREV_9485(ah)) 3325 + cptr = AR9300_BASE_ADDR_4K; 3326 + else 3327 + cptr = AR9300_BASE_ADDR; 3328 + ath_dbg(common, ATH_DBG_EEPROM, 3327 3329 "Trying EEPROM accesss at Address 0x%04x\n", cptr); 3328 3330 if (ar9300_check_eeprom_header(ah, read, cptr)) 3329 3331 goto found; 3330 3332 3331 3333 cptr = AR9300_BASE_ADDR_512; 3332 - ath_print(common, ATH_DBG_EEPROM, 3334 + ath_dbg(common, ATH_DBG_EEPROM, 3333 3335 "Trying EEPROM accesss at Address 0x%04x\n", cptr); 3334 3336 if (ar9300_check_eeprom_header(ah, read, cptr)) 3335 3337 goto found; 3336 3338 3337 3339 read = ar9300_read_otp; 3338 3340 cptr = AR9300_BASE_ADDR; 3339 - ath_print(common, ATH_DBG_EEPROM, 3341 + ath_dbg(common, ATH_DBG_EEPROM, 3340 3342 "Trying OTP accesss at Address 0x%04x\n", cptr); 3341 3343 if (ar9300_check_eeprom_header(ah, read, cptr)) 3342 3344 goto found; 3343 3345 3344 3346 cptr = AR9300_BASE_ADDR_512; 3345 - ath_print(common, ATH_DBG_EEPROM, 3347 + ath_dbg(common, ATH_DBG_EEPROM, 3346 3348 "Trying OTP accesss at Address 0x%04x\n", cptr); 3347 3349 if (ar9300_check_eeprom_header(ah, read, cptr)) 3348 3350 goto found; ··· 3353 3349 goto fail; 3354 3350 3355 3351 found: 3356 - ath_print(common, ATH_DBG_EEPROM, "Found valid EEPROM data"); 3352 + ath_dbg(common, ATH_DBG_EEPROM, "Found valid EEPROM data\n"); 3357 3353 3358 3354 for (it = 0; it < MSTATE; it++) { 3359 3355 if (!read(ah, cptr, word, COMP_HDR_LEN)) ··· 3364 3360 3365 3361 ar9300_comp_hdr_unpack(word, &code, &reference, 3366 3362 &length, &major, &minor); 3367 - ath_print(common, ATH_DBG_EEPROM, 3368 - "Found block at %x: code=%d ref=%d" 3369 - "length=%d major=%d minor=%d\n", cptr, code, 3370 - reference, length, major, minor); 3371 - if (length >= 1024) { 3372 - ath_print(common, ATH_DBG_EEPROM, 3373 - "Skipping bad header\n"); 3363 + ath_dbg(common, ATH_DBG_EEPROM, 3364 + "Found block at %x: code=%d ref=%d length=%d major=%d minor=%d\n", 3365 + cptr, code, reference, length, major, minor); 3366 + if ((!AR_SREV_9485(ah) && length >= 1024) || 3367 + (AR_SREV_9485(ah) && length >= (4 * 1024))) { 3368 + ath_dbg(common, ATH_DBG_EEPROM, 3369 + "Skipping bad header\n"); 3374 3370 cptr -= COMP_HDR_LEN; 3375 3371 continue; 3376 3372 } ··· 3380 3376 checksum = ar9300_comp_cksum(&word[COMP_HDR_LEN], length); 3381 3377 mchecksum = word[COMP_HDR_LEN + osize] | 3382 3378 (word[COMP_HDR_LEN + osize + 1] << 8); 3383 - ath_print(common, ATH_DBG_EEPROM, 3384 - "checksum %x %x\n", checksum, mchecksum); 3379 + ath_dbg(common, ATH_DBG_EEPROM, 3380 + "checksum %x %x\n", checksum, mchecksum); 3385 3381 if (checksum == mchecksum) { 3386 3382 ar9300_compress_decision(ah, it, code, reference, mptr, 3387 3383 word, length, mdata_size); 3388 3384 } else { 3389 - ath_print(common, ATH_DBG_EEPROM, 3390 - "skipping block with bad checksum\n"); 3385 + ath_dbg(common, ATH_DBG_EEPROM, 3386 + "skipping block with bad checksum\n"); 3391 3387 } 3392 3388 cptr -= (COMP_HDR_LEN + osize + COMP_CKSUM_LEN); 3393 3389 } ··· 3453 3449 static void ar9003_hw_xpa_bias_level_apply(struct ath_hw *ah, bool is2ghz) 3454 3450 { 3455 3451 int bias = ar9003_hw_xpa_bias_level_get(ah, is2ghz); 3456 - REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, bias); 3457 - REG_RMW_FIELD(ah, AR_CH0_THERM, AR_CH0_THERM_XPABIASLVL_MSB, bias >> 2); 3458 - REG_RMW_FIELD(ah, AR_CH0_THERM, AR_CH0_THERM_XPASHORT2GND, 1); 3452 + 3453 + if (AR_SREV_9485(ah)) 3454 + REG_RMW_FIELD(ah, AR_CH0_TOP2, AR_CH0_TOP2_XPABIASLVL, bias); 3455 + else { 3456 + REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, bias); 3457 + REG_RMW_FIELD(ah, AR_CH0_THERM, AR_CH0_THERM_XPABIASLVL_MSB, 3458 + bias >> 2); 3459 + REG_RMW_FIELD(ah, AR_CH0_THERM, AR_CH0_THERM_XPASHORT2GND, 1); 3460 + } 3459 3461 } 3460 3462 3461 3463 static u32 ar9003_hw_ant_ctrl_common_get(struct ath_hw *ah, bool is2ghz) ··· 3516 3506 value = ar9003_hw_ant_ctrl_chain_get(ah, 0, is2ghz); 3517 3507 REG_RMW_FIELD(ah, AR_PHY_SWITCH_CHAIN_0, AR_SWITCH_TABLE_ALL, value); 3518 3508 3519 - value = ar9003_hw_ant_ctrl_chain_get(ah, 1, is2ghz); 3520 - REG_RMW_FIELD(ah, AR_PHY_SWITCH_CHAIN_1, AR_SWITCH_TABLE_ALL, value); 3509 + if (!AR_SREV_9485(ah)) { 3510 + value = ar9003_hw_ant_ctrl_chain_get(ah, 1, is2ghz); 3511 + REG_RMW_FIELD(ah, AR_PHY_SWITCH_CHAIN_1, AR_SWITCH_TABLE_ALL, 3512 + value); 3521 3513 3522 - value = ar9003_hw_ant_ctrl_chain_get(ah, 2, is2ghz); 3523 - REG_RMW_FIELD(ah, AR_PHY_SWITCH_CHAIN_2, AR_SWITCH_TABLE_ALL, value); 3514 + value = ar9003_hw_ant_ctrl_chain_get(ah, 2, is2ghz); 3515 + REG_RMW_FIELD(ah, AR_PHY_SWITCH_CHAIN_2, AR_SWITCH_TABLE_ALL, 3516 + value); 3517 + } 3518 + 3519 + if (AR_SREV_9485(ah)) { 3520 + value = ath9k_hw_ar9300_get_eeprom(ah, EEP_ANT_DIV_CTL1); 3521 + REG_RMW_FIELD(ah, AR_PHY_MC_GAIN_CTRL, AR_ANT_DIV_CTRL_ALL, 3522 + value); 3523 + REG_RMW_FIELD(ah, AR_PHY_MC_GAIN_CTRL, AR_ANT_DIV_ENABLE, 3524 + value >> 6); 3525 + REG_RMW_FIELD(ah, AR_PHY_CCK_DETECT, AR_FAST_DIV_ENABLE, 3526 + value >> 7); 3527 + } 3524 3528 } 3525 3529 3526 3530 static void ar9003_hw_drive_strength_apply(struct ath_hw *ah) ··· 3654 3630 } 3655 3631 } 3656 3632 3633 + static bool is_pmu_set(struct ath_hw *ah, u32 pmu_reg, int pmu_set) 3634 + { 3635 + int timeout = 100; 3636 + 3637 + while (pmu_set != REG_READ(ah, pmu_reg)) { 3638 + if (timeout-- == 0) 3639 + return false; 3640 + REG_WRITE(ah, pmu_reg, pmu_set); 3641 + udelay(10); 3642 + } 3643 + 3644 + return true; 3645 + } 3646 + 3657 3647 static void ar9003_hw_internal_regulator_apply(struct ath_hw *ah) 3658 3648 { 3659 3649 int internal_regulator = 3660 3650 ath9k_hw_ar9300_get_eeprom(ah, EEP_INTERNAL_REGULATOR); 3661 3651 3662 3652 if (internal_regulator) { 3663 - /* Internal regulator is ON. Write swreg register. */ 3664 - int swreg = ath9k_hw_ar9300_get_eeprom(ah, EEP_SWREG); 3665 - REG_WRITE(ah, AR_RTC_REG_CONTROL1, 3666 - REG_READ(ah, AR_RTC_REG_CONTROL1) & 3667 - (~AR_RTC_REG_CONTROL1_SWREG_PROGRAM)); 3668 - REG_WRITE(ah, AR_RTC_REG_CONTROL0, swreg); 3669 - /* Set REG_CONTROL1.SWREG_PROGRAM */ 3670 - REG_WRITE(ah, AR_RTC_REG_CONTROL1, 3671 - REG_READ(ah, 3672 - AR_RTC_REG_CONTROL1) | 3673 - AR_RTC_REG_CONTROL1_SWREG_PROGRAM); 3653 + if (AR_SREV_9485(ah)) { 3654 + int reg_pmu_set; 3655 + 3656 + reg_pmu_set = REG_READ(ah, AR_PHY_PMU2) & ~AR_PHY_PMU2_PGM; 3657 + REG_WRITE(ah, AR_PHY_PMU2, reg_pmu_set); 3658 + if (!is_pmu_set(ah, AR_PHY_PMU2, reg_pmu_set)) 3659 + return; 3660 + 3661 + reg_pmu_set = (5 << 1) | (7 << 4) | (1 << 8) | 3662 + (7 << 14) | (6 << 17) | (1 << 20) | 3663 + (3 << 24) | (1 << 28); 3664 + 3665 + REG_WRITE(ah, AR_PHY_PMU1, reg_pmu_set); 3666 + if (!is_pmu_set(ah, AR_PHY_PMU1, reg_pmu_set)) 3667 + return; 3668 + 3669 + reg_pmu_set = (REG_READ(ah, AR_PHY_PMU2) & ~0xFFC00000) 3670 + | (4 << 26); 3671 + REG_WRITE(ah, AR_PHY_PMU2, reg_pmu_set); 3672 + if (!is_pmu_set(ah, AR_PHY_PMU2, reg_pmu_set)) 3673 + return; 3674 + 3675 + reg_pmu_set = (REG_READ(ah, AR_PHY_PMU2) & ~0x00200000) 3676 + | (1 << 21); 3677 + REG_WRITE(ah, AR_PHY_PMU2, reg_pmu_set); 3678 + if (!is_pmu_set(ah, AR_PHY_PMU2, reg_pmu_set)) 3679 + return; 3680 + } else { 3681 + /* Internal regulator is ON. Write swreg register. */ 3682 + int swreg = ath9k_hw_ar9300_get_eeprom(ah, EEP_SWREG); 3683 + REG_WRITE(ah, AR_RTC_REG_CONTROL1, 3684 + REG_READ(ah, AR_RTC_REG_CONTROL1) & 3685 + (~AR_RTC_REG_CONTROL1_SWREG_PROGRAM)); 3686 + REG_WRITE(ah, AR_RTC_REG_CONTROL0, swreg); 3687 + /* Set REG_CONTROL1.SWREG_PROGRAM */ 3688 + REG_WRITE(ah, AR_RTC_REG_CONTROL1, 3689 + REG_READ(ah, 3690 + AR_RTC_REG_CONTROL1) | 3691 + AR_RTC_REG_CONTROL1_SWREG_PROGRAM); 3692 + } 3674 3693 } else { 3675 - REG_WRITE(ah, AR_RTC_SLEEP_CLK, 3676 - (REG_READ(ah, 3677 - AR_RTC_SLEEP_CLK) | 3678 - AR_RTC_FORCE_SWREG_PRD)); 3694 + if (AR_SREV_9485(ah)) { 3695 + REG_RMW_FIELD(ah, AR_PHY_PMU2, AR_PHY_PMU2_PGM, 0); 3696 + while (REG_READ_FIELD(ah, AR_PHY_PMU2, 3697 + AR_PHY_PMU2_PGM)) 3698 + udelay(10); 3699 + 3700 + REG_RMW_FIELD(ah, AR_PHY_PMU1, AR_PHY_PMU1_PWD, 0x1); 3701 + while (!REG_READ_FIELD(ah, AR_PHY_PMU1, 3702 + AR_PHY_PMU1_PWD)) 3703 + udelay(10); 3704 + REG_RMW_FIELD(ah, AR_PHY_PMU2, AR_PHY_PMU2_PGM, 0x1); 3705 + while (!REG_READ_FIELD(ah, AR_PHY_PMU2, 3706 + AR_PHY_PMU2_PGM)) 3707 + udelay(10); 3708 + } else 3709 + REG_WRITE(ah, AR_RTC_SLEEP_CLK, 3710 + (REG_READ(ah, 3711 + AR_RTC_SLEEP_CLK) | 3712 + AR_RTC_FORCE_SWREG_PRD)); 3713 + } 3714 + 3715 + } 3716 + 3717 + static void ar9003_hw_apply_tuning_caps(struct ath_hw *ah) 3718 + { 3719 + struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; 3720 + u8 tuning_caps_param = eep->baseEepHeader.params_for_tuning_caps[0]; 3721 + 3722 + if (eep->baseEepHeader.featureEnable & 0x40) { 3723 + tuning_caps_param &= 0x7f; 3724 + REG_RMW_FIELD(ah, AR_CH0_XTAL, AR_CH0_XTAL_CAPINDAC, 3725 + tuning_caps_param); 3726 + REG_RMW_FIELD(ah, AR_CH0_XTAL, AR_CH0_XTAL_CAPOUTDAC, 3727 + tuning_caps_param); 3679 3728 } 3680 3729 } 3681 3730 ··· 3760 3663 ar9003_hw_drive_strength_apply(ah); 3761 3664 ar9003_hw_atten_apply(ah, chan); 3762 3665 ar9003_hw_internal_regulator_apply(ah); 3666 + if (AR_SREV_9485(ah)) 3667 + ar9003_hw_apply_tuning_caps(ah); 3763 3668 } 3764 3669 3765 3670 static void ath9k_hw_ar9300_set_addac(struct ath_hw *ah, ··· 4191 4092 ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_23, freq, 4192 4093 is2GHz) + ht40PowerIncForPdadc; 4193 4094 4194 - while (i < ar9300RateSize) { 4195 - ath_print(common, ATH_DBG_EEPROM, 4196 - "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]); 4197 - i++; 4198 - 4199 - ath_print(common, ATH_DBG_EEPROM, 4200 - "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]); 4201 - i++; 4202 - 4203 - ath_print(common, ATH_DBG_EEPROM, 4204 - "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]); 4205 - i++; 4206 - 4207 - ath_print(common, ATH_DBG_EEPROM, 4208 - "TPC[%02d] 0x%08x\n", i, targetPowerValT2[i]); 4209 - i++; 4095 + for (i = 0; i < ar9300RateSize; i++) { 4096 + ath_dbg(common, ATH_DBG_EEPROM, 4097 + "TPC[%02d] 0x%08x\n", i, targetPowerValT2[i]); 4210 4098 } 4211 4099 } 4212 4100 ··· 4212 4126 struct ath_common *common = ath9k_hw_common(ah); 4213 4127 4214 4128 if (ichain >= AR9300_MAX_CHAINS) { 4215 - ath_print(common, ATH_DBG_EEPROM, 4216 - "Invalid chain index, must be less than %d\n", 4217 - AR9300_MAX_CHAINS); 4129 + ath_dbg(common, ATH_DBG_EEPROM, 4130 + "Invalid chain index, must be less than %d\n", 4131 + AR9300_MAX_CHAINS); 4218 4132 return -1; 4219 4133 } 4220 4134 4221 4135 if (mode) { /* 5GHz */ 4222 4136 if (ipier >= AR9300_NUM_5G_CAL_PIERS) { 4223 - ath_print(common, ATH_DBG_EEPROM, 4224 - "Invalid 5GHz cal pier index, must " 4225 - "be less than %d\n", 4226 - AR9300_NUM_5G_CAL_PIERS); 4137 + ath_dbg(common, ATH_DBG_EEPROM, 4138 + "Invalid 5GHz cal pier index, must be less than %d\n", 4139 + AR9300_NUM_5G_CAL_PIERS); 4227 4140 return -1; 4228 4141 } 4229 4142 pCalPier = &(eep->calFreqPier5G[ipier]); ··· 4230 4145 is2GHz = 0; 4231 4146 } else { 4232 4147 if (ipier >= AR9300_NUM_2G_CAL_PIERS) { 4233 - ath_print(common, ATH_DBG_EEPROM, 4234 - "Invalid 2GHz cal pier index, must " 4235 - "be less than %d\n", AR9300_NUM_2G_CAL_PIERS); 4148 + ath_dbg(common, ATH_DBG_EEPROM, 4149 + "Invalid 2GHz cal pier index, must be less than %d\n", 4150 + AR9300_NUM_2G_CAL_PIERS); 4236 4151 return -1; 4237 4152 } 4238 4153 ··· 4261 4176 REG_RMW(ah, AR_PHY_TPC_11_B0, 4262 4177 (correction[0] << AR_PHY_TPC_OLPC_GAIN_DELTA_S), 4263 4178 AR_PHY_TPC_OLPC_GAIN_DELTA); 4264 - REG_RMW(ah, AR_PHY_TPC_11_B1, 4265 - (correction[1] << AR_PHY_TPC_OLPC_GAIN_DELTA_S), 4266 - AR_PHY_TPC_OLPC_GAIN_DELTA); 4267 - REG_RMW(ah, AR_PHY_TPC_11_B2, 4268 - (correction[2] << AR_PHY_TPC_OLPC_GAIN_DELTA_S), 4269 - AR_PHY_TPC_OLPC_GAIN_DELTA); 4179 + if (ah->caps.tx_chainmask & BIT(1)) 4180 + REG_RMW(ah, AR_PHY_TPC_11_B1, 4181 + (correction[1] << AR_PHY_TPC_OLPC_GAIN_DELTA_S), 4182 + AR_PHY_TPC_OLPC_GAIN_DELTA); 4183 + if (ah->caps.tx_chainmask & BIT(2)) 4184 + REG_RMW(ah, AR_PHY_TPC_11_B2, 4185 + (correction[2] << AR_PHY_TPC_OLPC_GAIN_DELTA_S), 4186 + AR_PHY_TPC_OLPC_GAIN_DELTA); 4270 4187 4271 4188 /* enable open loop power control on chip */ 4272 4189 REG_RMW(ah, AR_PHY_TPC_6_B0, 4273 4190 (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S), 4274 4191 AR_PHY_TPC_6_ERROR_EST_MODE); 4275 - REG_RMW(ah, AR_PHY_TPC_6_B1, 4276 - (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S), 4277 - AR_PHY_TPC_6_ERROR_EST_MODE); 4278 - REG_RMW(ah, AR_PHY_TPC_6_B2, 4279 - (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S), 4280 - AR_PHY_TPC_6_ERROR_EST_MODE); 4192 + if (ah->caps.tx_chainmask & BIT(1)) 4193 + REG_RMW(ah, AR_PHY_TPC_6_B1, 4194 + (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S), 4195 + AR_PHY_TPC_6_ERROR_EST_MODE); 4196 + if (ah->caps.tx_chainmask & BIT(2)) 4197 + REG_RMW(ah, AR_PHY_TPC_6_B2, 4198 + (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S), 4199 + AR_PHY_TPC_6_ERROR_EST_MODE); 4281 4200 4282 4201 /* 4283 4202 * enable temperature compensation ··· 4386 4297 4387 4298 /* interpolate */ 4388 4299 for (ichain = 0; ichain < AR9300_MAX_CHAINS; ichain++) { 4389 - ath_print(common, ATH_DBG_EEPROM, 4390 - "ch=%d f=%d low=%d %d h=%d %d\n", 4391 - ichain, frequency, lfrequency[ichain], 4392 - lcorrection[ichain], hfrequency[ichain], 4393 - hcorrection[ichain]); 4300 + ath_dbg(common, ATH_DBG_EEPROM, 4301 + "ch=%d f=%d low=%d %d h=%d %d\n", 4302 + ichain, frequency, lfrequency[ichain], 4303 + lcorrection[ichain], hfrequency[ichain], 4304 + hcorrection[ichain]); 4394 4305 /* they're the same, so just pick one */ 4395 4306 if (hfrequency[ichain] == lfrequency[ichain]) { 4396 4307 correction[ichain] = lcorrection[ichain]; ··· 4442 4353 ar9003_hw_power_control_override(ah, frequency, correction, voltage, 4443 4354 temperature); 4444 4355 4445 - ath_print(common, ATH_DBG_EEPROM, 4446 - "for frequency=%d, calibration correction = %d %d %d\n", 4447 - frequency, correction[0], correction[1], correction[2]); 4356 + ath_dbg(common, ATH_DBG_EEPROM, 4357 + "for frequency=%d, calibration correction = %d %d %d\n", 4358 + frequency, correction[0], correction[1], correction[2]); 4448 4359 4449 4360 return 0; 4450 4361 } ··· 4649 4560 else 4650 4561 freq = centers.ctl_center; 4651 4562 4652 - ath_print(common, ATH_DBG_REGULATORY, 4653 - "LOOP-Mode ctlMode %d < %d, isHt40CtlMode %d, " 4654 - "EXT_ADDITIVE %d\n", 4655 - ctlMode, numCtlModes, isHt40CtlMode, 4656 - (pCtlMode[ctlMode] & EXT_ADDITIVE)); 4563 + ath_dbg(common, ATH_DBG_REGULATORY, 4564 + "LOOP-Mode ctlMode %d < %d, isHt40CtlMode %d, EXT_ADDITIVE %d\n", 4565 + ctlMode, numCtlModes, isHt40CtlMode, 4566 + (pCtlMode[ctlMode] & EXT_ADDITIVE)); 4657 4567 4658 4568 /* walk through each CTL index stored in EEPROM */ 4659 4569 if (is2ghz) { ··· 4664 4576 } 4665 4577 4666 4578 for (i = 0; (i < ctlNum) && ctlIndex[i]; i++) { 4667 - ath_print(common, ATH_DBG_REGULATORY, 4668 - "LOOP-Ctlidx %d: cfgCtl 0x%2.2x " 4669 - "pCtlMode 0x%2.2x ctlIndex 0x%2.2x " 4670 - "chan %dn", 4671 - i, cfgCtl, pCtlMode[ctlMode], ctlIndex[i], 4672 - chan->channel); 4579 + ath_dbg(common, ATH_DBG_REGULATORY, 4580 + "LOOP-Ctlidx %d: cfgCtl 0x%2.2x pCtlMode 0x%2.2x ctlIndex 0x%2.2x chan %d\n", 4581 + i, cfgCtl, pCtlMode[ctlMode], ctlIndex[i], 4582 + chan->channel); 4673 4583 4674 4584 /* 4675 4585 * compare test group from regulatory ··· 4706 4620 4707 4621 minCtlPower = (u8)min(twiceMaxEdgePower, scaledPower); 4708 4622 4709 - ath_print(common, ATH_DBG_REGULATORY, 4710 - "SEL-Min ctlMode %d pCtlMode %d 2xMaxEdge %d " 4711 - "sP %d minCtlPwr %d\n", 4712 - ctlMode, pCtlMode[ctlMode], twiceMaxEdgePower, 4713 - scaledPower, minCtlPower); 4623 + ath_dbg(common, ATH_DBG_REGULATORY, 4624 + "SEL-Min ctlMode %d pCtlMode %d 2xMaxEdge %d sP %d minCtlPwr %d\n", 4625 + ctlMode, pCtlMode[ctlMode], twiceMaxEdgePower, 4626 + scaledPower, minCtlPower); 4714 4627 4715 4628 /* Apply ctl mode to correct target power set */ 4716 4629 switch (pCtlMode[ctlMode]) { ··· 4784 4699 return; 4785 4700 4786 4701 for (i = 0; i < ar9300RateSize; i++) { 4787 - ath_print(common, ATH_DBG_EEPROM, 4788 - "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]); 4789 - i++; 4790 - ath_print(common, ATH_DBG_EEPROM, 4791 - "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]); 4792 - i++; 4793 - ath_print(common, ATH_DBG_EEPROM, 4794 - "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]); 4795 - i++; 4796 - ath_print(common, ATH_DBG_EEPROM, 4797 - "TPC[%02d] 0x%08x\n\n", i, targetPowerValT2[i]); 4798 - i++; 4702 + ath_dbg(common, ATH_DBG_EEPROM, 4703 + "TPC[%02d] 0x%08x\n", i, targetPowerValT2[i]); 4799 4704 } 4800 4705 4801 4706 /* ··· 4831 4756 struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; 4832 4757 4833 4758 return (eep->baseEepHeader.txrxgain) & 0xf; /* bits 3:0 */ 4759 + } 4760 + 4761 + u8 *ar9003_get_spur_chan_ptr(struct ath_hw *ah, bool is_2ghz) 4762 + { 4763 + struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; 4764 + 4765 + if (is_2ghz) 4766 + return eep->modalHeader2G.spurChans; 4767 + else 4768 + return eep->modalHeader5G.spurChans; 4834 4769 } 4835 4770 4836 4771 const struct eeprom_ops eep_ar9300_ops = {
+2
drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
··· 78 78 #define AR9300_EEPROM_SIZE (16*1024) 79 79 #define FIXED_CCA_THRESHOLD 15 80 80 81 + #define AR9300_BASE_ADDR_4K 0xfff 81 82 #define AR9300_BASE_ADDR 0x3ff 82 83 #define AR9300_BASE_ADDR_512 0x1ff 83 84 ··· 343 342 s32 ar9003_hw_get_tx_gain_idx(struct ath_hw *ah); 344 343 s32 ar9003_hw_get_rx_gain_idx(struct ath_hw *ah); 345 344 345 + u8 *ar9003_get_spur_chan_ptr(struct ath_hw *ah, bool is_2ghz); 346 346 #endif
+182 -76
drivers/net/wireless/ath/ath9k/ar9003_hw.c
··· 17 17 #include "hw.h" 18 18 #include "ar9003_mac.h" 19 19 #include "ar9003_2p2_initvals.h" 20 + #include "ar9485_initvals.h" 20 21 21 22 /* General hardware code for the AR9003 hadware family */ 22 23 ··· 25 24 { 26 25 switch (macversion) { 27 26 case AR_SREV_VERSION_9300: 27 + case AR_SREV_VERSION_9485: 28 28 return true; 29 29 default: 30 30 break; ··· 40 38 */ 41 39 static void ar9003_hw_init_mode_regs(struct ath_hw *ah) 42 40 { 43 - /* mac */ 44 - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0); 45 - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], 46 - ar9300_2p2_mac_core, 47 - ARRAY_SIZE(ar9300_2p2_mac_core), 2); 48 - INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], 49 - ar9300_2p2_mac_postamble, 50 - ARRAY_SIZE(ar9300_2p2_mac_postamble), 5); 41 + if (AR_SREV_9485(ah)) { 42 + /* mac */ 43 + INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0); 44 + INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], 45 + ar9485_1_0_mac_core, 46 + ARRAY_SIZE(ar9485_1_0_mac_core), 2); 47 + INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], 48 + ar9485_1_0_mac_postamble, 49 + ARRAY_SIZE(ar9485_1_0_mac_postamble), 5); 51 50 52 - /* bb */ 53 - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0); 54 - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], 55 - ar9300_2p2_baseband_core, 56 - ARRAY_SIZE(ar9300_2p2_baseband_core), 2); 57 - INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], 58 - ar9300_2p2_baseband_postamble, 59 - ARRAY_SIZE(ar9300_2p2_baseband_postamble), 5); 51 + /* bb */ 52 + INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], ar9485_1_0, 53 + ARRAY_SIZE(ar9485_1_0), 2); 54 + INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], 55 + ar9485_1_0_baseband_core, 56 + ARRAY_SIZE(ar9485_1_0_baseband_core), 2); 57 + INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], 58 + ar9485_1_0_baseband_postamble, 59 + ARRAY_SIZE(ar9485_1_0_baseband_postamble), 5); 60 60 61 - /* radio */ 62 - INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0); 63 - INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], 64 - ar9300_2p2_radio_core, 65 - ARRAY_SIZE(ar9300_2p2_radio_core), 2); 66 - INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], 67 - ar9300_2p2_radio_postamble, 68 - ARRAY_SIZE(ar9300_2p2_radio_postamble), 5); 61 + /* radio */ 62 + INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0); 63 + INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], 64 + ar9485_1_0_radio_core, 65 + ARRAY_SIZE(ar9485_1_0_radio_core), 2); 66 + INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], 67 + ar9485_1_0_radio_postamble, 68 + ARRAY_SIZE(ar9485_1_0_radio_postamble), 2); 69 69 70 - /* soc */ 71 - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], 72 - ar9300_2p2_soc_preamble, 73 - ARRAY_SIZE(ar9300_2p2_soc_preamble), 2); 74 - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0); 75 - INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], 76 - ar9300_2p2_soc_postamble, 77 - ARRAY_SIZE(ar9300_2p2_soc_postamble), 5); 70 + /* soc */ 71 + INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], 72 + ar9485_1_0_soc_preamble, 73 + ARRAY_SIZE(ar9485_1_0_soc_preamble), 2); 74 + INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0); 75 + INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], NULL, 0, 0); 78 76 79 - /* rx/tx gain */ 80 - INIT_INI_ARRAY(&ah->iniModesRxGain, 81 - ar9300Common_rx_gain_table_2p2, 82 - ARRAY_SIZE(ar9300Common_rx_gain_table_2p2), 2); 83 - INIT_INI_ARRAY(&ah->iniModesTxGain, 84 - ar9300Modes_lowest_ob_db_tx_gain_table_2p2, 85 - ARRAY_SIZE(ar9300Modes_lowest_ob_db_tx_gain_table_2p2), 86 - 5); 77 + /* rx/tx gain */ 78 + INIT_INI_ARRAY(&ah->iniModesRxGain, 79 + ar9485Common_rx_gain_1_0, 80 + ARRAY_SIZE(ar9485Common_rx_gain_1_0), 2); 81 + INIT_INI_ARRAY(&ah->iniModesTxGain, 82 + ar9485Modes_lowest_ob_db_tx_gain_1_0, 83 + ARRAY_SIZE(ar9485Modes_lowest_ob_db_tx_gain_1_0), 84 + 5); 87 85 88 - /* Load PCIE SERDES settings from INI */ 86 + /* Load PCIE SERDES settings from INI */ 89 87 90 - /* Awake Setting */ 88 + /* Awake Setting */ 91 89 92 - INIT_INI_ARRAY(&ah->iniPcieSerdes, 93 - ar9300PciePhy_pll_on_clkreq_disable_L1_2p2, 94 - ARRAY_SIZE(ar9300PciePhy_pll_on_clkreq_disable_L1_2p2), 95 - 2); 90 + INIT_INI_ARRAY(&ah->iniPcieSerdes, 91 + ar9485_1_0_pcie_phy_pll_on_clkreq_disable_L1, 92 + ARRAY_SIZE(ar9485_1_0_pcie_phy_pll_on_clkreq_disable_L1), 93 + 2); 96 94 97 - /* Sleep Setting */ 95 + /* Sleep Setting */ 98 96 99 - INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower, 100 - ar9300PciePhy_clkreq_enable_L1_2p2, 101 - ARRAY_SIZE(ar9300PciePhy_clkreq_enable_L1_2p2), 102 - 2); 97 + INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower, 98 + ar9485_1_0_pcie_phy_pll_on_clkreq_enable_L1, 99 + ARRAY_SIZE(ar9485_1_0_pcie_phy_pll_on_clkreq_enable_L1), 100 + 2); 101 + } else { 102 + /* mac */ 103 + INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0); 104 + INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], 105 + ar9300_2p2_mac_core, 106 + ARRAY_SIZE(ar9300_2p2_mac_core), 2); 107 + INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], 108 + ar9300_2p2_mac_postamble, 109 + ARRAY_SIZE(ar9300_2p2_mac_postamble), 5); 103 110 104 - /* Fast clock modal settings */ 105 - INIT_INI_ARRAY(&ah->iniModesAdditional, 106 - ar9300Modes_fast_clock_2p2, 107 - ARRAY_SIZE(ar9300Modes_fast_clock_2p2), 108 - 3); 111 + /* bb */ 112 + INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0); 113 + INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], 114 + ar9300_2p2_baseband_core, 115 + ARRAY_SIZE(ar9300_2p2_baseband_core), 2); 116 + INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], 117 + ar9300_2p2_baseband_postamble, 118 + ARRAY_SIZE(ar9300_2p2_baseband_postamble), 5); 119 + 120 + /* radio */ 121 + INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0); 122 + INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], 123 + ar9300_2p2_radio_core, 124 + ARRAY_SIZE(ar9300_2p2_radio_core), 2); 125 + INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], 126 + ar9300_2p2_radio_postamble, 127 + ARRAY_SIZE(ar9300_2p2_radio_postamble), 5); 128 + 129 + /* soc */ 130 + INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], 131 + ar9300_2p2_soc_preamble, 132 + ARRAY_SIZE(ar9300_2p2_soc_preamble), 2); 133 + INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0); 134 + INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], 135 + ar9300_2p2_soc_postamble, 136 + ARRAY_SIZE(ar9300_2p2_soc_postamble), 5); 137 + 138 + /* rx/tx gain */ 139 + INIT_INI_ARRAY(&ah->iniModesRxGain, 140 + ar9300Common_rx_gain_table_2p2, 141 + ARRAY_SIZE(ar9300Common_rx_gain_table_2p2), 2); 142 + INIT_INI_ARRAY(&ah->iniModesTxGain, 143 + ar9300Modes_lowest_ob_db_tx_gain_table_2p2, 144 + ARRAY_SIZE(ar9300Modes_lowest_ob_db_tx_gain_table_2p2), 145 + 5); 146 + 147 + /* Load PCIE SERDES settings from INI */ 148 + 149 + /* Awake Setting */ 150 + 151 + INIT_INI_ARRAY(&ah->iniPcieSerdes, 152 + ar9300PciePhy_pll_on_clkreq_disable_L1_2p2, 153 + ARRAY_SIZE(ar9300PciePhy_pll_on_clkreq_disable_L1_2p2), 154 + 2); 155 + 156 + /* Sleep Setting */ 157 + 158 + INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower, 159 + ar9300PciePhy_clkreq_enable_L1_2p2, 160 + ARRAY_SIZE(ar9300PciePhy_clkreq_enable_L1_2p2), 161 + 2); 162 + 163 + /* Fast clock modal settings */ 164 + INIT_INI_ARRAY(&ah->iniModesAdditional, 165 + ar9300Modes_fast_clock_2p2, 166 + ARRAY_SIZE(ar9300Modes_fast_clock_2p2), 167 + 3); 168 + } 109 169 } 110 170 111 171 static void ar9003_tx_gain_table_apply(struct ath_hw *ah) ··· 175 111 switch (ar9003_hw_get_tx_gain_idx(ah)) { 176 112 case 0: 177 113 default: 178 - INIT_INI_ARRAY(&ah->iniModesTxGain, 179 - ar9300Modes_lowest_ob_db_tx_gain_table_2p2, 180 - ARRAY_SIZE(ar9300Modes_lowest_ob_db_tx_gain_table_2p2), 181 - 5); 114 + if (AR_SREV_9485(ah)) 115 + INIT_INI_ARRAY(&ah->iniModesTxGain, 116 + ar9485Modes_lowest_ob_db_tx_gain_1_0, 117 + ARRAY_SIZE(ar9485Modes_lowest_ob_db_tx_gain_1_0), 118 + 5); 119 + else 120 + INIT_INI_ARRAY(&ah->iniModesTxGain, 121 + ar9300Modes_lowest_ob_db_tx_gain_table_2p2, 122 + ARRAY_SIZE(ar9300Modes_lowest_ob_db_tx_gain_table_2p2), 123 + 5); 182 124 break; 183 125 case 1: 184 - INIT_INI_ARRAY(&ah->iniModesTxGain, 185 - ar9300Modes_high_ob_db_tx_gain_table_2p2, 186 - ARRAY_SIZE(ar9300Modes_high_ob_db_tx_gain_table_2p2), 187 - 5); 126 + if (AR_SREV_9485(ah)) 127 + INIT_INI_ARRAY(&ah->iniModesTxGain, 128 + ar9485Modes_high_ob_db_tx_gain_1_0, 129 + ARRAY_SIZE(ar9485Modes_lowest_ob_db_tx_gain_1_0), 130 + 5); 131 + else 132 + INIT_INI_ARRAY(&ah->iniModesTxGain, 133 + ar9300Modes_high_ob_db_tx_gain_table_2p2, 134 + ARRAY_SIZE(ar9300Modes_high_ob_db_tx_gain_table_2p2), 135 + 5); 188 136 break; 189 137 case 2: 190 - INIT_INI_ARRAY(&ah->iniModesTxGain, 191 - ar9300Modes_low_ob_db_tx_gain_table_2p2, 192 - ARRAY_SIZE(ar9300Modes_low_ob_db_tx_gain_table_2p2), 193 - 5); 138 + if (AR_SREV_9485(ah)) 139 + INIT_INI_ARRAY(&ah->iniModesTxGain, 140 + ar9485Modes_low_ob_db_tx_gain_1_0, 141 + ARRAY_SIZE(ar9485Modes_lowest_ob_db_tx_gain_1_0), 142 + 5); 143 + else 144 + INIT_INI_ARRAY(&ah->iniModesTxGain, 145 + ar9300Modes_low_ob_db_tx_gain_table_2p2, 146 + ARRAY_SIZE(ar9300Modes_low_ob_db_tx_gain_table_2p2), 147 + 5); 148 + break; 149 + case 3: 150 + if (AR_SREV_9485(ah)) 151 + INIT_INI_ARRAY(&ah->iniModesTxGain, 152 + ar9485Modes_high_power_tx_gain_1_0, 153 + ARRAY_SIZE(ar9485Modes_high_power_tx_gain_1_0), 154 + 5); 155 + else 156 + INIT_INI_ARRAY(&ah->iniModesTxGain, 157 + ar9300Modes_high_power_tx_gain_table_2p2, 158 + ARRAY_SIZE(ar9300Modes_high_power_tx_gain_table_2p2), 159 + 5); 194 160 break; 195 161 } 196 162 } ··· 230 136 switch (ar9003_hw_get_rx_gain_idx(ah)) { 231 137 case 0: 232 138 default: 233 - INIT_INI_ARRAY(&ah->iniModesRxGain, 234 - ar9300Common_rx_gain_table_2p2, 235 - ARRAY_SIZE(ar9300Common_rx_gain_table_2p2), 236 - 2); 139 + if (AR_SREV_9485(ah)) 140 + INIT_INI_ARRAY(&ah->iniModesRxGain, 141 + ar9485Common_rx_gain_1_0, 142 + ARRAY_SIZE(ar9485Common_rx_gain_1_0), 143 + 2); 144 + else 145 + INIT_INI_ARRAY(&ah->iniModesRxGain, 146 + ar9300Common_rx_gain_table_2p2, 147 + ARRAY_SIZE(ar9300Common_rx_gain_table_2p2), 148 + 2); 237 149 break; 238 150 case 1: 239 - INIT_INI_ARRAY(&ah->iniModesRxGain, 240 - ar9300Common_wo_xlna_rx_gain_table_2p2, 241 - ARRAY_SIZE(ar9300Common_wo_xlna_rx_gain_table_2p2), 242 - 2); 151 + if (AR_SREV_9485(ah)) 152 + INIT_INI_ARRAY(&ah->iniModesRxGain, 153 + ar9485Common_wo_xlna_rx_gain_1_0, 154 + ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_0), 155 + 2); 156 + else 157 + INIT_INI_ARRAY(&ah->iniModesRxGain, 158 + ar9300Common_wo_xlna_rx_gain_table_2p2, 159 + ARRAY_SIZE(ar9300Common_wo_xlna_rx_gain_table_2p2), 160 + 2); 243 161 break; 244 162 } 245 163 }
+8 -8
drivers/net/wireless/ath/ath9k/ar9003_mac.c
··· 182 182 } 183 183 184 184 if (sync_cause & AR_INTR_SYNC_LOCAL_TIMEOUT) 185 - ath_print(common, ATH_DBG_INTERRUPT, 186 - "AR_INTR_SYNC_LOCAL_TIMEOUT\n"); 185 + ath_dbg(common, ATH_DBG_INTERRUPT, 186 + "AR_INTR_SYNC_LOCAL_TIMEOUT\n"); 187 187 188 188 REG_WRITE(ah, AR_INTR_SYNC_CAUSE_CLR, sync_cause); 189 189 (void) REG_READ(ah, AR_INTR_SYNC_CAUSE_CLR); ··· 249 249 250 250 if ((MS(ads->ds_info, AR_DescId) != ATHEROS_VENDOR_ID) || 251 251 (MS(ads->ds_info, AR_TxRxDesc) != 1)) { 252 - ath_print(ath9k_hw_common(ah), ATH_DBG_XMIT, 253 - "Tx Descriptor error %x\n", ads->ds_info); 252 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_XMIT, 253 + "Tx Descriptor error %x\n", ads->ds_info); 254 254 memset(ads, 0, sizeof(*ads)); 255 255 return -EIO; 256 256 } ··· 658 658 memset((void *) ah->ts_ring, 0, 659 659 ah->ts_size * sizeof(struct ar9003_txs)); 660 660 661 - ath_print(ath9k_hw_common(ah), ATH_DBG_XMIT, 662 - "TS Start 0x%x End 0x%x Virt %p, Size %d\n", 663 - ah->ts_paddr_start, ah->ts_paddr_end, 664 - ah->ts_ring, ah->ts_size); 661 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_XMIT, 662 + "TS Start 0x%x End 0x%x Virt %p, Size %d\n", 663 + ah->ts_paddr_start, ah->ts_paddr_end, 664 + ah->ts_ring, ah->ts_size); 665 665 666 666 REG_WRITE(ah, AR_Q_STATUS_RING_START, ah->ts_paddr_start); 667 667 REG_WRITE(ah, AR_Q_STATUS_RING_END, ah->ts_paddr_end);
+24 -13
drivers/net/wireless/ath/ath9k/ar9003_paprd.c
··· 21 21 { 22 22 REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B0, 23 23 AR_PHY_PAPRD_CTRL0_PAPRD_ENABLE, !!val); 24 - REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B1, 25 - AR_PHY_PAPRD_CTRL0_PAPRD_ENABLE, !!val); 26 - REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B2, 27 - AR_PHY_PAPRD_CTRL0_PAPRD_ENABLE, !!val); 24 + if (ah->caps.tx_chainmask & BIT(1)) 25 + REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B1, 26 + AR_PHY_PAPRD_CTRL0_PAPRD_ENABLE, !!val); 27 + if (ah->caps.tx_chainmask & BIT(2)) 28 + REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B2, 29 + AR_PHY_PAPRD_CTRL0_PAPRD_ENABLE, !!val); 28 30 } 29 31 EXPORT_SYMBOL(ar9003_paprd_enable); 30 32 ··· 59 57 REG_RMW_FIELD(ah, AR_PHY_PAPRD_AM2PM, AR_PHY_PAPRD_AM2PM_MASK, am_mask); 60 58 REG_RMW_FIELD(ah, AR_PHY_PAPRD_HT40, AR_PHY_PAPRD_HT40_MASK, ht40_mask); 61 59 62 - for (i = 0; i < 3; i++) { 60 + 61 + for (i = 0; i < ah->caps.max_txchains; i++) { 63 62 REG_RMW_FIELD(ah, ctrl0[i], 64 63 AR_PHY_PAPRD_CTRL0_USE_SINGLE_TABLE_MASK, 1); 65 64 REG_RMW_FIELD(ah, ctrl1[i], ··· 105 102 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES, 7); 106 103 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, 107 104 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL, 1); 108 - REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, 109 - AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP, -6); 105 + if (AR_SREV_9485(ah)) 106 + REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, 107 + AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP, 108 + -3); 109 + else 110 + REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, 111 + AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP, 112 + -6); 110 113 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, 111 114 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE, 112 115 -15); ··· 629 620 AR_PHY_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL, 630 621 training_power); 631 622 632 - REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL1_B1, 633 - AR_PHY_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL, 634 - training_power); 623 + if (ah->caps.tx_chainmask & BIT(1)) 624 + REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL1_B1, 625 + AR_PHY_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL, 626 + training_power); 635 627 636 - REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL1_B2, 637 - AR_PHY_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL, 638 - training_power); 628 + if (ah->caps.tx_chainmask & BIT(2)) 629 + REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL1_B2, 630 + AR_PHY_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL, 631 + training_power); 639 632 } 640 633 EXPORT_SYMBOL(ar9003_paprd_populate_single_table); 641 634
+131 -112
drivers/net/wireless/ath/ath9k/ar9003_phy.c
··· 75 75 freq = centers.synth_center; 76 76 77 77 if (freq < 4800) { /* 2 GHz, fractional mode */ 78 - channelSel = CHANSEL_2G(freq); 78 + if (AR_SREV_9485(ah)) 79 + channelSel = CHANSEL_2G_9485(freq); 80 + else 81 + channelSel = CHANSEL_2G(freq); 79 82 /* Set to 2G mode */ 80 83 bMode = 1; 81 84 } else { ··· 134 131 static const u32 spur_freq[4] = { 2420, 2440, 2464, 2480 }; 135 132 int cur_bb_spur, negative = 0, cck_spur_freq; 136 133 int i; 134 + int range, max_spur_cnts, synth_freq; 135 + u8 *spur_fbin_ptr = NULL; 137 136 138 137 /* 139 138 * Need to verify range +/- 10 MHz in control channel, otherwise spur 140 139 * is out-of-band and can be ignored. 141 140 */ 142 141 143 - for (i = 0; i < 4; i++) { 142 + if (AR_SREV_9485(ah)) { 143 + spur_fbin_ptr = ar9003_get_spur_chan_ptr(ah, 144 + IS_CHAN_2GHZ(chan)); 145 + if (spur_fbin_ptr[0] == 0) /* No spur */ 146 + return; 147 + max_spur_cnts = 5; 148 + if (IS_CHAN_HT40(chan)) { 149 + range = 19; 150 + if (REG_READ_FIELD(ah, AR_PHY_GEN_CTRL, 151 + AR_PHY_GC_DYN2040_PRI_CH) == 0) 152 + synth_freq = chan->channel + 10; 153 + else 154 + synth_freq = chan->channel - 10; 155 + } else { 156 + range = 10; 157 + synth_freq = chan->channel; 158 + } 159 + } else { 160 + range = 10; 161 + max_spur_cnts = 4; 162 + synth_freq = chan->channel; 163 + } 164 + 165 + for (i = 0; i < max_spur_cnts; i++) { 144 166 negative = 0; 145 - cur_bb_spur = spur_freq[i] - chan->channel; 167 + if (AR_SREV_9485(ah)) 168 + cur_bb_spur = FBIN2FREQ(spur_fbin_ptr[i], 169 + IS_CHAN_2GHZ(chan)) - synth_freq; 170 + else 171 + cur_bb_spur = spur_freq[i] - synth_freq; 146 172 147 173 if (cur_bb_spur < 0) { 148 174 negative = 1; 149 175 cur_bb_spur = -cur_bb_spur; 150 176 } 151 - if (cur_bb_spur < 10) { 177 + if (cur_bb_spur < range) { 152 178 cck_spur_freq = (int)((cur_bb_spur << 19) / 11); 153 179 154 180 if (negative == 1) ··· 856 824 AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW); 857 825 858 826 if (!on != aniState->ofdmWeakSigDetectOff) { 859 - ath_print(common, ATH_DBG_ANI, 860 - "** ch %d: ofdm weak signal: %s=>%s\n", 861 - chan->channel, 862 - !aniState->ofdmWeakSigDetectOff ? 863 - "on" : "off", 864 - on ? "on" : "off"); 827 + ath_dbg(common, ATH_DBG_ANI, 828 + "** ch %d: ofdm weak signal: %s=>%s\n", 829 + chan->channel, 830 + !aniState->ofdmWeakSigDetectOff ? 831 + "on" : "off", 832 + on ? "on" : "off"); 865 833 if (on) 866 834 ah->stats.ast_ani_ofdmon++; 867 835 else ··· 874 842 u32 level = param; 875 843 876 844 if (level >= ARRAY_SIZE(firstep_table)) { 877 - ath_print(common, ATH_DBG_ANI, 878 - "ATH9K_ANI_FIRSTEP_LEVEL: level " 879 - "out of range (%u > %u)\n", 880 - level, 881 - (unsigned) ARRAY_SIZE(firstep_table)); 845 + ath_dbg(common, ATH_DBG_ANI, 846 + "ATH9K_ANI_FIRSTEP_LEVEL: level out of range (%u > %zu)\n", 847 + level, ARRAY_SIZE(firstep_table)); 882 848 return false; 883 849 } 884 850 ··· 911 881 AR_PHY_FIND_SIG_LOW_FIRSTEP_LOW, value2); 912 882 913 883 if (level != aniState->firstepLevel) { 914 - ath_print(common, ATH_DBG_ANI, 915 - "** ch %d: level %d=>%d[def:%d] " 916 - "firstep[level]=%d ini=%d\n", 917 - chan->channel, 918 - aniState->firstepLevel, 919 - level, 920 - ATH9K_ANI_FIRSTEP_LVL_NEW, 921 - value, 922 - aniState->iniDef.firstep); 923 - ath_print(common, ATH_DBG_ANI, 924 - "** ch %d: level %d=>%d[def:%d] " 925 - "firstep_low[level]=%d ini=%d\n", 926 - chan->channel, 927 - aniState->firstepLevel, 928 - level, 929 - ATH9K_ANI_FIRSTEP_LVL_NEW, 930 - value2, 931 - aniState->iniDef.firstepLow); 884 + ath_dbg(common, ATH_DBG_ANI, 885 + "** ch %d: level %d=>%d[def:%d] firstep[level]=%d ini=%d\n", 886 + chan->channel, 887 + aniState->firstepLevel, 888 + level, 889 + ATH9K_ANI_FIRSTEP_LVL_NEW, 890 + value, 891 + aniState->iniDef.firstep); 892 + ath_dbg(common, ATH_DBG_ANI, 893 + "** ch %d: level %d=>%d[def:%d] firstep_low[level]=%d ini=%d\n", 894 + chan->channel, 895 + aniState->firstepLevel, 896 + level, 897 + ATH9K_ANI_FIRSTEP_LVL_NEW, 898 + value2, 899 + aniState->iniDef.firstepLow); 932 900 if (level > aniState->firstepLevel) 933 901 ah->stats.ast_ani_stepup++; 934 902 else if (level < aniState->firstepLevel) ··· 939 911 u32 level = param; 940 912 941 913 if (level >= ARRAY_SIZE(cycpwrThr1_table)) { 942 - ath_print(common, ATH_DBG_ANI, 943 - "ATH9K_ANI_SPUR_IMMUNITY_LEVEL: level " 944 - "out of range (%u > %u)\n", 945 - level, 946 - (unsigned) ARRAY_SIZE(cycpwrThr1_table)); 914 + ath_dbg(common, ATH_DBG_ANI, 915 + "ATH9K_ANI_SPUR_IMMUNITY_LEVEL: level out of range (%u > %zu)\n", 916 + level, ARRAY_SIZE(cycpwrThr1_table)); 947 917 return false; 948 918 } 949 919 /* ··· 975 949 AR_PHY_EXT_CYCPWR_THR1, value2); 976 950 977 951 if (level != aniState->spurImmunityLevel) { 978 - ath_print(common, ATH_DBG_ANI, 979 - "** ch %d: level %d=>%d[def:%d] " 980 - "cycpwrThr1[level]=%d ini=%d\n", 981 - chan->channel, 982 - aniState->spurImmunityLevel, 983 - level, 984 - ATH9K_ANI_SPUR_IMMUNE_LVL_NEW, 985 - value, 986 - aniState->iniDef.cycpwrThr1); 987 - ath_print(common, ATH_DBG_ANI, 988 - "** ch %d: level %d=>%d[def:%d] " 989 - "cycpwrThr1Ext[level]=%d ini=%d\n", 990 - chan->channel, 991 - aniState->spurImmunityLevel, 992 - level, 993 - ATH9K_ANI_SPUR_IMMUNE_LVL_NEW, 994 - value2, 995 - aniState->iniDef.cycpwrThr1Ext); 952 + ath_dbg(common, ATH_DBG_ANI, 953 + "** ch %d: level %d=>%d[def:%d] cycpwrThr1[level]=%d ini=%d\n", 954 + chan->channel, 955 + aniState->spurImmunityLevel, 956 + level, 957 + ATH9K_ANI_SPUR_IMMUNE_LVL_NEW, 958 + value, 959 + aniState->iniDef.cycpwrThr1); 960 + ath_dbg(common, ATH_DBG_ANI, 961 + "** ch %d: level %d=>%d[def:%d] cycpwrThr1Ext[level]=%d ini=%d\n", 962 + chan->channel, 963 + aniState->spurImmunityLevel, 964 + level, 965 + ATH9K_ANI_SPUR_IMMUNE_LVL_NEW, 966 + value2, 967 + aniState->iniDef.cycpwrThr1Ext); 996 968 if (level > aniState->spurImmunityLevel) 997 969 ah->stats.ast_ani_spurup++; 998 970 else if (level < aniState->spurImmunityLevel) ··· 1010 986 REG_RMW_FIELD(ah, AR_PHY_MRC_CCK_CTRL, 1011 987 AR_PHY_MRC_CCK_MUX_REG, is_on); 1012 988 if (!is_on != aniState->mrcCCKOff) { 1013 - ath_print(common, ATH_DBG_ANI, 1014 - "** ch %d: MRC CCK: %s=>%s\n", 1015 - chan->channel, 1016 - !aniState->mrcCCKOff ? "on" : "off", 1017 - is_on ? "on" : "off"); 989 + ath_dbg(common, ATH_DBG_ANI, 990 + "** ch %d: MRC CCK: %s=>%s\n", 991 + chan->channel, 992 + !aniState->mrcCCKOff ? "on" : "off", 993 + is_on ? "on" : "off"); 1018 994 if (is_on) 1019 995 ah->stats.ast_ani_ccklow++; 1020 996 else ··· 1026 1002 case ATH9K_ANI_PRESENT: 1027 1003 break; 1028 1004 default: 1029 - ath_print(common, ATH_DBG_ANI, 1030 - "invalid cmd %u\n", cmd); 1005 + ath_dbg(common, ATH_DBG_ANI, "invalid cmd %u\n", cmd); 1031 1006 return false; 1032 1007 } 1033 1008 1034 - ath_print(common, ATH_DBG_ANI, 1035 - "ANI parameters: SI=%d, ofdmWS=%s FS=%d " 1036 - "MRCcck=%s listenTime=%d " 1037 - "ofdmErrs=%d cckErrs=%d\n", 1038 - aniState->spurImmunityLevel, 1039 - !aniState->ofdmWeakSigDetectOff ? "on" : "off", 1040 - aniState->firstepLevel, 1041 - !aniState->mrcCCKOff ? "on" : "off", 1042 - aniState->listenTime, 1043 - aniState->ofdmPhyErrCount, 1044 - aniState->cckPhyErrCount); 1009 + ath_dbg(common, ATH_DBG_ANI, 1010 + "ANI parameters: SI=%d, ofdmWS=%s FS=%d MRCcck=%s listenTime=%d ofdmErrs=%d cckErrs=%d\n", 1011 + aniState->spurImmunityLevel, 1012 + !aniState->ofdmWeakSigDetectOff ? "on" : "off", 1013 + aniState->firstepLevel, 1014 + !aniState->mrcCCKOff ? "on" : "off", 1015 + aniState->listenTime, 1016 + aniState->ofdmPhyErrCount, 1017 + aniState->cckPhyErrCount); 1045 1018 return true; 1046 1019 } 1047 1020 ··· 1095 1074 aniState = &ah->curchan->ani; 1096 1075 iniDef = &aniState->iniDef; 1097 1076 1098 - ath_print(common, ATH_DBG_ANI, 1099 - "ver %d.%d opmode %u chan %d Mhz/0x%x\n", 1100 - ah->hw_version.macVersion, 1101 - ah->hw_version.macRev, 1102 - ah->opmode, 1103 - chan->channel, 1104 - chan->channelFlags); 1077 + ath_dbg(common, ATH_DBG_ANI, 1078 + "ver %d.%d opmode %u chan %d Mhz/0x%x\n", 1079 + ah->hw_version.macVersion, 1080 + ah->hw_version.macRev, 1081 + ah->opmode, 1082 + chan->channel, 1083 + chan->channelFlags); 1105 1084 1106 1085 val = REG_READ(ah, AR_PHY_SFCORR); 1107 1086 iniDef->m1Thresh = MS(val, AR_PHY_SFCORR_M1_THRESH); ··· 1237 1216 ~(AR_PHY_WATCHDOG_NON_IDLE_ENABLE | 1238 1217 AR_PHY_WATCHDOG_IDLE_ENABLE)); 1239 1218 1240 - ath_print(common, ATH_DBG_RESET, "Disabled BB Watchdog\n"); 1219 + ath_dbg(common, ATH_DBG_RESET, "Disabled BB Watchdog\n"); 1241 1220 return; 1242 1221 } 1243 1222 ··· 1273 1252 AR_PHY_WATCHDOG_IDLE_MASK | 1274 1253 (AR_PHY_WATCHDOG_NON_IDLE_MASK & (idle_count << 2))); 1275 1254 1276 - ath_print(common, ATH_DBG_RESET, 1277 - "Enabled BB Watchdog timeout (%u ms)\n", 1278 - idle_tmo_ms); 1255 + ath_dbg(common, ATH_DBG_RESET, 1256 + "Enabled BB Watchdog timeout (%u ms)\n", 1257 + idle_tmo_ms); 1279 1258 } 1280 1259 1281 1260 void ar9003_hw_bb_watchdog_read(struct ath_hw *ah) ··· 1303 1282 return; 1304 1283 1305 1284 status = ah->bb_watchdog_last_status; 1306 - ath_print(common, ATH_DBG_RESET, 1307 - "\n==== BB update: BB status=0x%08x ====\n", status); 1308 - ath_print(common, ATH_DBG_RESET, 1309 - "** BB state: wd=%u det=%u rdar=%u rOFDM=%d " 1310 - "rCCK=%u tOFDM=%u tCCK=%u agc=%u src=%u **\n", 1311 - MS(status, AR_PHY_WATCHDOG_INFO), 1312 - MS(status, AR_PHY_WATCHDOG_DET_HANG), 1313 - MS(status, AR_PHY_WATCHDOG_RADAR_SM), 1314 - MS(status, AR_PHY_WATCHDOG_RX_OFDM_SM), 1315 - MS(status, AR_PHY_WATCHDOG_RX_CCK_SM), 1316 - MS(status, AR_PHY_WATCHDOG_TX_OFDM_SM), 1317 - MS(status, AR_PHY_WATCHDOG_TX_CCK_SM), 1318 - MS(status, AR_PHY_WATCHDOG_AGC_SM), 1319 - MS(status,AR_PHY_WATCHDOG_SRCH_SM)); 1285 + ath_dbg(common, ATH_DBG_RESET, 1286 + "\n==== BB update: BB status=0x%08x ====\n", status); 1287 + ath_dbg(common, ATH_DBG_RESET, 1288 + "** BB state: wd=%u det=%u rdar=%u rOFDM=%d rCCK=%u tOFDM=%u tCCK=%u agc=%u src=%u **\n", 1289 + MS(status, AR_PHY_WATCHDOG_INFO), 1290 + MS(status, AR_PHY_WATCHDOG_DET_HANG), 1291 + MS(status, AR_PHY_WATCHDOG_RADAR_SM), 1292 + MS(status, AR_PHY_WATCHDOG_RX_OFDM_SM), 1293 + MS(status, AR_PHY_WATCHDOG_RX_CCK_SM), 1294 + MS(status, AR_PHY_WATCHDOG_TX_OFDM_SM), 1295 + MS(status, AR_PHY_WATCHDOG_TX_CCK_SM), 1296 + MS(status, AR_PHY_WATCHDOG_AGC_SM), 1297 + MS(status, AR_PHY_WATCHDOG_SRCH_SM)); 1320 1298 1321 - ath_print(common, ATH_DBG_RESET, 1322 - "** BB WD cntl: cntl1=0x%08x cntl2=0x%08x **\n", 1323 - REG_READ(ah, AR_PHY_WATCHDOG_CTL_1), 1324 - REG_READ(ah, AR_PHY_WATCHDOG_CTL_2)); 1325 - ath_print(common, ATH_DBG_RESET, 1326 - "** BB mode: BB_gen_controls=0x%08x **\n", 1327 - REG_READ(ah, AR_PHY_GEN_CTRL)); 1299 + ath_dbg(common, ATH_DBG_RESET, 1300 + "** BB WD cntl: cntl1=0x%08x cntl2=0x%08x **\n", 1301 + REG_READ(ah, AR_PHY_WATCHDOG_CTL_1), 1302 + REG_READ(ah, AR_PHY_WATCHDOG_CTL_2)); 1303 + ath_dbg(common, ATH_DBG_RESET, 1304 + "** BB mode: BB_gen_controls=0x%08x **\n", 1305 + REG_READ(ah, AR_PHY_GEN_CTRL)); 1328 1306 1329 1307 #define PCT(_field) (common->cc_survey._field * 100 / common->cc_survey.cycles) 1330 1308 if (common->cc_survey.cycles) 1331 - ath_print(common, ATH_DBG_RESET, 1332 - "** BB busy times: rx_clear=%d%%, " 1333 - "rx_frame=%d%%, tx_frame=%d%% **\n", 1334 - PCT(rx_busy), PCT(rx_frame), PCT(tx_frame)); 1309 + ath_dbg(common, ATH_DBG_RESET, 1310 + "** BB busy times: rx_clear=%d%%, rx_frame=%d%%, tx_frame=%d%% **\n", 1311 + PCT(rx_busy), PCT(rx_frame), PCT(tx_frame)); 1335 1312 1336 - ath_print(common, ATH_DBG_RESET, 1337 - "==== BB update: done ====\n\n"); 1313 + ath_dbg(common, ATH_DBG_RESET, 1314 + "==== BB update: done ====\n\n"); 1338 1315 } 1339 1316 EXPORT_SYMBOL(ar9003_hw_bb_watchdog_dbg_info);
+60 -10
drivers/net/wireless/ath/ath9k/ar9003_phy.h
··· 260 260 #define AR_PHY_CCA_0 (AR_AGC_BASE + 0x1c) 261 261 #define AR_PHY_EXT_CCA0 (AR_AGC_BASE + 0x20) 262 262 #define AR_PHY_RESTART (AR_AGC_BASE + 0x24) 263 + 263 264 #define AR_PHY_MC_GAIN_CTRL (AR_AGC_BASE + 0x28) 265 + #define AR_ANT_DIV_CTRL_ALL 0x7e000000 266 + #define AR_ANT_DIV_CTRL_ALL_S 25 267 + #define AR_ANT_DIV_ENABLE 0x1000000 268 + #define AR_ANT_DIV_ENABLE_S 24 269 + 264 270 #define AR_PHY_EXTCHN_PWRTHR1 (AR_AGC_BASE + 0x2c) 265 271 #define AR_PHY_EXT_CHN_WIN (AR_AGC_BASE + 0x30) 266 272 #define AR_PHY_20_40_DET_THR (AR_AGC_BASE + 0x34) ··· 277 271 #define AR_PHY_RX_GAIN_BOUNDS_2 (AR_AGC_BASE + 0x48) 278 272 #define AR_PHY_RSSI_0 (AR_AGC_BASE + 0x180) 279 273 #define AR_PHY_SPUR_CCK_REP0 (AR_AGC_BASE + 0x184) 274 + 280 275 #define AR_PHY_CCK_DETECT (AR_AGC_BASE + 0x1c0) 276 + #define AR_FAST_DIV_ENABLE 0x2000 277 + #define AR_FAST_DIV_ENABLE_S 13 278 + 281 279 #define AR_PHY_DAG_CTRLCCK (AR_AGC_BASE + 0x1c4) 282 280 #define AR_PHY_IQCORR_CTRL_CCK (AR_AGC_BASE + 0x1c8) 283 281 ··· 546 536 547 537 #define AR_PHY_TXGAIN_TABLE (AR_SM_BASE + 0x300) 548 538 539 + #define AR_PHY_TX_IQCAL_START_9485 (AR_SM_BASE + 0x3c4) 540 + #define AR_PHY_TX_IQCAL_START_DO_CAL_9485 0x80000000 541 + #define AR_PHY_TX_IQCAL_START_DO_CAL_9485_S 31 542 + #define AR_PHY_TX_IQCAL_CONTROL_1_9485 (AR_SM_BASE + 0x3c8) 543 + #define AR_PHY_TX_IQCAL_STATUS_B0_9485 (AR_SM_BASE + 0x3f0) 544 + 549 545 #define AR_PHY_TX_IQCAL_CONTROL_1 (AR_SM_BASE + 0x448) 550 546 #define AR_PHY_TX_IQCAL_START (AR_SM_BASE + 0x440) 551 547 #define AR_PHY_TX_IQCAL_STATUS_B0 (AR_SM_BASE + 0x48c) 552 - #define AR_PHY_TX_IQCAL_CORR_COEFF_01_B0 (AR_SM_BASE + 0x450) 548 + #define AR_PHY_TX_IQCAL_CORR_COEFF_B0(_i) (AR_SM_BASE + \ 549 + (AR_SREV_9485(ah) ? \ 550 + 0x3d0 : 0x450) + ((_i) << 2)) 553 551 554 552 #define AR_PHY_WATCHDOG_STATUS (AR_SM_BASE + 0x5c0) 555 553 #define AR_PHY_WATCHDOG_CTL_1 (AR_SM_BASE + 0x5c4) ··· 586 568 #define AR_PHY_65NM_CH0_BIAS2 0x160c4 587 569 #define AR_PHY_65NM_CH0_BIAS4 0x160cc 588 570 #define AR_PHY_65NM_CH0_RXTX4 0x1610c 589 - #define AR_PHY_65NM_CH0_THERM 0x16290 571 + #define AR_PHY_65NM_CH0_THERM (AR_SREV_9485(ah) ? 0x1628c : 0x16290) 590 572 591 573 #define AR_PHY_65NM_CH0_THERM_LOCAL 0x80000000 592 574 #define AR_PHY_65NM_CH0_THERM_LOCAL_S 31 ··· 601 583 #define AR_PHY_65NM_CH1_RXTX2 0x16504 602 584 #define AR_PHY_65NM_CH2_RXTX1 0x16900 603 585 #define AR_PHY_65NM_CH2_RXTX2 0x16904 586 + 587 + #define AR_CH0_TOP2 (AR_SREV_9485(ah) ? 0x00016284 : 0x0001628c) 588 + #define AR_CH0_TOP2_XPABIASLVL 0xf000 589 + #define AR_CH0_TOP2_XPABIASLVL_S 12 590 + 591 + #define AR_CH0_XTAL (AR_SREV_9485(ah) ? 0x16290 : 0x16294) 592 + #define AR_CH0_XTAL_CAPINDAC 0x7f000000 593 + #define AR_CH0_XTAL_CAPINDAC_S 24 594 + #define AR_CH0_XTAL_CAPOUTDAC 0x00fe0000 595 + #define AR_CH0_XTAL_CAPOUTDAC_S 17 596 + 597 + #define AR_PHY_PMU1 0x16c40 598 + #define AR_PHY_PMU1_PWD 0x1 599 + #define AR_PHY_PMU1_PWD_S 0 600 + 601 + #define AR_PHY_PMU2 0x16c44 602 + #define AR_PHY_PMU2_PGM 0x00200000 603 + #define AR_PHY_PMU2_PGM_S 21 604 604 605 605 #define AR_PHY_RX1DB_BIQUAD_LONG_SHIFT 0x00380000 606 606 #define AR_PHY_RX1DB_BIQUAD_LONG_SHIFT_S 19 ··· 719 683 #define AR_PHY_TPCGR1_FORCED_DAC_GAIN_S 1 720 684 #define AR_PHY_TPCGR1_FORCE_DAC_GAIN 0x00000001 721 685 #define AR_PHY_TXGAIN_FORCE 0x00000001 686 + #define AR_PHY_TXGAIN_FORCE_S 0 722 687 #define AR_PHY_TXGAIN_FORCED_PADVGNRA 0x00003c00 723 688 #define AR_PHY_TXGAIN_FORCED_PADVGNRA_S 10 724 689 #define AR_PHY_TXGAIN_FORCED_PADVGNRB 0x0003c000 ··· 762 725 #define AR_PHY_TX_IQCAL_START_DO_CAL_S 0 763 726 764 727 #define AR_PHY_TX_IQCAL_STATUS_FAILED 0x00000001 765 - #define AR_PHY_TX_IQCAL_CORR_COEFF_01_COEFF_TABLE 0x00003fff 766 - #define AR_PHY_TX_IQCAL_CORR_COEFF_01_COEFF_TABLE_S 0 728 + #define AR_PHY_CALIBRATED_GAINS_0 0x3e 729 + #define AR_PHY_CALIBRATED_GAINS_0_S 1 730 + 731 + #define AR_PHY_TX_IQCAL_CORR_COEFF_00_COEFF_TABLE 0x00003fff 732 + #define AR_PHY_TX_IQCAL_CORR_COEFF_00_COEFF_TABLE_S 0 733 + #define AR_PHY_TX_IQCAL_CORR_COEFF_01_COEFF_TABLE 0x0fffc000 734 + #define AR_PHY_TX_IQCAL_CORR_COEFF_01_COEFF_TABLE_S 14 767 735 768 736 #define AR_PHY_65NM_CH0_RXTX4_THERM_ON 0x10000000 769 737 #define AR_PHY_65NM_CH0_RXTX4_THERM_ON_S 28 ··· 827 785 #define AR_PHY_TPC_11_B1 (AR_SM1_BASE + 0x220) 828 786 #define AR_PHY_PDADC_TAB_1 (AR_SM1_BASE + 0x240) 829 787 #define AR_PHY_TX_IQCAL_STATUS_B1 (AR_SM1_BASE + 0x48c) 830 - #define AR_PHY_TX_IQCAL_CORR_COEFF_01_B1 (AR_SM1_BASE + 0x450) 788 + #define AR_PHY_TX_IQCAL_CORR_COEFF_B1(_i) (AR_SM_BASE + 0x450 + ((_i) << 2)) 831 789 832 790 /* 833 791 * Channel 2 Register Map ··· 880 838 #define AR_PHY_TPC_11_B2 (AR_SM2_BASE + 0x220) 881 839 #define AR_PHY_PDADC_TAB_2 (AR_SM2_BASE + 0x240) 882 840 #define AR_PHY_TX_IQCAL_STATUS_B2 (AR_SM2_BASE + 0x48c) 883 - #define AR_PHY_TX_IQCAL_CORR_COEFF_01_B2 (AR_SM2_BASE + 0x450) 841 + #define AR_PHY_TX_IQCAL_CORR_COEFF_B2(_i) (AR_SM2_BASE + 0x450 + ((_i) << 2)) 884 842 885 843 #define AR_PHY_TX_IQCAL_STATUS_B2_FAILED 0x00000001 886 844 ··· 987 945 #define AR_PHY_PAPRD_CTRL1_PAPRD_MAG_SCALE_FACT 0x0ffe0000 988 946 #define AR_PHY_PAPRD_CTRL1_PAPRD_MAG_SCALE_FACT_S 17 989 947 990 - #define AR_PHY_PAPRD_TRAINER_CNTL1 (AR_SM_BASE + 0x490) 948 + #define AR_PHY_PAPRD_TRAINER_CNTL1 (AR_SM_BASE + \ 949 + (AR_SREV_9485(ah) ? \ 950 + 0x580 : 0x490)) 991 951 #define AR_PHY_PAPRD_TRAINER_CNTL1_CF_CF_PAPRD_TRAIN_ENABLE 0x00000001 992 952 #define AR_PHY_PAPRD_TRAINER_CNTL1_CF_CF_PAPRD_TRAIN_ENABLE_S 0 993 953 #define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING 0x0000007e ··· 1005 961 #define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP 0x0003f000 1006 962 #define AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_LB_SKIP_S 12 1007 963 1008 - #define AR_PHY_PAPRD_TRAINER_CNTL2 (AR_SM_BASE + 0x494) 964 + #define AR_PHY_PAPRD_TRAINER_CNTL2 (AR_SM_BASE + \ 965 + (AR_SREV_9485(ah) ? \ 966 + 0x584 : 0x494)) 1009 967 #define AR_PHY_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN 0xFFFFFFFF 1010 968 #define AR_PHY_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN_S 0 1011 969 1012 - #define AR_PHY_PAPRD_TRAINER_CNTL3 (AR_SM_BASE + 0x498) 970 + #define AR_PHY_PAPRD_TRAINER_CNTL3 (AR_SM_BASE + \ 971 + (AR_SREV_9485(ah) ? \ 972 + 0x588 : 0x498)) 1013 973 #define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE 0x0000003f 1014 974 #define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE_S 0 1015 975 #define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP 0x00000fc0 ··· 1029 981 #define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE 0x20000000 1030 982 #define AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE_S 29 1031 983 1032 - #define AR_PHY_PAPRD_TRAINER_CNTL4 (AR_SM_BASE + 0x49c) 984 + #define AR_PHY_PAPRD_TRAINER_CNTL4 (AR_SM_BASE + \ 985 + (AR_SREV_9485(ah) ? \ 986 + 0x58c : 0x49c)) 1033 987 #define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES 0x03ff0000 1034 988 #define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_NUM_TRAIN_SAMPLES_S 16 1035 989 #define AR_PHY_PAPRD_TRAINER_CNTL4_CF_PAPRD_SAFETY_DELTA 0x0000f000
+943
drivers/net/wireless/ath/ath9k/ar9485_initvals.h
··· 1 + /* 2 + * Copyright (c) 2010 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 + #ifndef INITVALS_9485_H 18 + #define INITVALS_9485_H 19 + 20 + static const u32 ar9485Common_1_0[][2] = { 21 + /* Addr allmodes */ 22 + {0x00007010, 0x00000022}, 23 + {0x00007020, 0x00000000}, 24 + {0x00007034, 0x00000002}, 25 + {0x00007038, 0x000004c2}, 26 + }; 27 + 28 + static const u32 ar9485_1_0_mac_postamble[][5] = { 29 + /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 30 + {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160}, 31 + {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c}, 32 + {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38}, 33 + {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00}, 34 + {0x0000801c, 0x128d8027, 0x128d804f, 0x12e00057, 0x12e0002b}, 35 + {0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810}, 36 + {0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a}, 37 + {0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440}, 38 + }; 39 + 40 + static const u32 ar9485_1_0_pcie_phy_pll_on_clkreq_disable_L1[][2] = { 41 + /* Addr allmodes */ 42 + {0x00018c00, 0x10212e5e}, 43 + {0x00018c04, 0x000801d8}, 44 + {0x00018c08, 0x0000580c}, 45 + }; 46 + 47 + static const u32 ar9485Common_wo_xlna_rx_gain_1_0[][2] = { 48 + /* Addr allmodes */ 49 + {0x0000a000, 0x00010000}, 50 + {0x0000a004, 0x00030002}, 51 + {0x0000a008, 0x00050004}, 52 + {0x0000a00c, 0x00810080}, 53 + {0x0000a010, 0x01800082}, 54 + {0x0000a014, 0x01820181}, 55 + {0x0000a018, 0x01840183}, 56 + {0x0000a01c, 0x01880185}, 57 + {0x0000a020, 0x018a0189}, 58 + {0x0000a024, 0x02850284}, 59 + {0x0000a028, 0x02890288}, 60 + {0x0000a02c, 0x03850384}, 61 + {0x0000a030, 0x03890388}, 62 + {0x0000a034, 0x038b038a}, 63 + {0x0000a038, 0x038d038c}, 64 + {0x0000a03c, 0x03910390}, 65 + {0x0000a040, 0x03930392}, 66 + {0x0000a044, 0x03950394}, 67 + {0x0000a048, 0x00000396}, 68 + {0x0000a04c, 0x00000000}, 69 + {0x0000a050, 0x00000000}, 70 + {0x0000a054, 0x00000000}, 71 + {0x0000a058, 0x00000000}, 72 + {0x0000a05c, 0x00000000}, 73 + {0x0000a060, 0x00000000}, 74 + {0x0000a064, 0x00000000}, 75 + {0x0000a068, 0x00000000}, 76 + {0x0000a06c, 0x00000000}, 77 + {0x0000a070, 0x00000000}, 78 + {0x0000a074, 0x00000000}, 79 + {0x0000a078, 0x00000000}, 80 + {0x0000a07c, 0x00000000}, 81 + {0x0000a080, 0x28282828}, 82 + {0x0000a084, 0x28282828}, 83 + {0x0000a088, 0x28282828}, 84 + {0x0000a08c, 0x28282828}, 85 + {0x0000a090, 0x28282828}, 86 + {0x0000a094, 0x21212128}, 87 + {0x0000a098, 0x171c1c1c}, 88 + {0x0000a09c, 0x02020212}, 89 + {0x0000a0a0, 0x00000202}, 90 + {0x0000a0a4, 0x00000000}, 91 + {0x0000a0a8, 0x00000000}, 92 + {0x0000a0ac, 0x00000000}, 93 + {0x0000a0b0, 0x00000000}, 94 + {0x0000a0b4, 0x00000000}, 95 + {0x0000a0b8, 0x00000000}, 96 + {0x0000a0bc, 0x00000000}, 97 + {0x0000a0c0, 0x001f0000}, 98 + {0x0000a0c4, 0x111f1100}, 99 + {0x0000a0c8, 0x111d111e}, 100 + {0x0000a0cc, 0x111b111c}, 101 + {0x0000a0d0, 0x22032204}, 102 + {0x0000a0d4, 0x22012202}, 103 + {0x0000a0d8, 0x221f2200}, 104 + {0x0000a0dc, 0x221d221e}, 105 + {0x0000a0e0, 0x33013302}, 106 + {0x0000a0e4, 0x331f3300}, 107 + {0x0000a0e8, 0x4402331e}, 108 + {0x0000a0ec, 0x44004401}, 109 + {0x0000a0f0, 0x441e441f}, 110 + {0x0000a0f4, 0x55015502}, 111 + {0x0000a0f8, 0x551f5500}, 112 + {0x0000a0fc, 0x6602551e}, 113 + {0x0000a100, 0x66006601}, 114 + {0x0000a104, 0x661e661f}, 115 + {0x0000a108, 0x7703661d}, 116 + {0x0000a10c, 0x77017702}, 117 + {0x0000a110, 0x00007700}, 118 + {0x0000a114, 0x00000000}, 119 + {0x0000a118, 0x00000000}, 120 + {0x0000a11c, 0x00000000}, 121 + {0x0000a120, 0x00000000}, 122 + {0x0000a124, 0x00000000}, 123 + {0x0000a128, 0x00000000}, 124 + {0x0000a12c, 0x00000000}, 125 + {0x0000a130, 0x00000000}, 126 + {0x0000a134, 0x00000000}, 127 + {0x0000a138, 0x00000000}, 128 + {0x0000a13c, 0x00000000}, 129 + {0x0000a140, 0x001f0000}, 130 + {0x0000a144, 0x111f1100}, 131 + {0x0000a148, 0x111d111e}, 132 + {0x0000a14c, 0x111b111c}, 133 + {0x0000a150, 0x22032204}, 134 + {0x0000a154, 0x22012202}, 135 + {0x0000a158, 0x221f2200}, 136 + {0x0000a15c, 0x221d221e}, 137 + {0x0000a160, 0x33013302}, 138 + {0x0000a164, 0x331f3300}, 139 + {0x0000a168, 0x4402331e}, 140 + {0x0000a16c, 0x44004401}, 141 + {0x0000a170, 0x441e441f}, 142 + {0x0000a174, 0x55015502}, 143 + {0x0000a178, 0x551f5500}, 144 + {0x0000a17c, 0x6602551e}, 145 + {0x0000a180, 0x66006601}, 146 + {0x0000a184, 0x661e661f}, 147 + {0x0000a188, 0x7703661d}, 148 + {0x0000a18c, 0x77017702}, 149 + {0x0000a190, 0x00007700}, 150 + {0x0000a194, 0x00000000}, 151 + {0x0000a198, 0x00000000}, 152 + {0x0000a19c, 0x00000000}, 153 + {0x0000a1a0, 0x00000000}, 154 + {0x0000a1a4, 0x00000000}, 155 + {0x0000a1a8, 0x00000000}, 156 + {0x0000a1ac, 0x00000000}, 157 + {0x0000a1b0, 0x00000000}, 158 + {0x0000a1b4, 0x00000000}, 159 + {0x0000a1b8, 0x00000000}, 160 + {0x0000a1bc, 0x00000000}, 161 + {0x0000a1c0, 0x00000000}, 162 + {0x0000a1c4, 0x00000000}, 163 + {0x0000a1c8, 0x00000000}, 164 + {0x0000a1cc, 0x00000000}, 165 + {0x0000a1d0, 0x00000000}, 166 + {0x0000a1d4, 0x00000000}, 167 + {0x0000a1d8, 0x00000000}, 168 + {0x0000a1dc, 0x00000000}, 169 + {0x0000a1e0, 0x00000000}, 170 + {0x0000a1e4, 0x00000000}, 171 + {0x0000a1e8, 0x00000000}, 172 + {0x0000a1ec, 0x00000000}, 173 + {0x0000a1f0, 0x00000396}, 174 + {0x0000a1f4, 0x00000396}, 175 + {0x0000a1f8, 0x00000396}, 176 + {0x0000a1fc, 0x00000296}, 177 + }; 178 + 179 + static const u32 ar9485Modes_high_power_tx_gain_1_0[][5] = { 180 + /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 181 + {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d8, 0x000050d8}, 182 + {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, 183 + {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, 184 + {0x0000a508, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, 185 + {0x0000a50c, 0x11062202, 0x11062202, 0x0d000200, 0x0d000200}, 186 + {0x0000a510, 0x17022e00, 0x17022e00, 0x11000202, 0x11000202}, 187 + {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x15000400, 0x15000400}, 188 + {0x0000a518, 0x25020ec0, 0x25020ec0, 0x19000402, 0x19000402}, 189 + {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x1d000404, 0x1d000404}, 190 + {0x0000a520, 0x2f001f04, 0x2f001f04, 0x21000603, 0x21000603}, 191 + {0x0000a524, 0x35001fc4, 0x35001fc4, 0x25000605, 0x25000605}, 192 + {0x0000a528, 0x3c022f04, 0x3c022f04, 0x2a000a03, 0x2a000a03}, 193 + {0x0000a52c, 0x41023e85, 0x41023e85, 0x2c000a04, 0x2c000a04}, 194 + {0x0000a530, 0x48023ec6, 0x48023ec6, 0x2e000a20, 0x2e000a20}, 195 + {0x0000a534, 0x4d023f01, 0x4d023f01, 0x34000e20, 0x34000e20}, 196 + {0x0000a538, 0x53023f4b, 0x53023f4b, 0x38000e22, 0x38000e22}, 197 + {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x3c000e24, 0x3c000e24}, 198 + {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x40000e26, 0x40000e26}, 199 + {0x0000a544, 0x6502feca, 0x6502feca, 0x43001640, 0x43001640}, 200 + {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x46001660, 0x46001660}, 201 + {0x0000a54c, 0x7203feca, 0x7203feca, 0x49001861, 0x49001861}, 202 + {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x4c001a81, 0x4c001a81}, 203 + {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x4f001a83, 0x4f001a83}, 204 + {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x54001c85, 0x54001c85}, 205 + {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x58001ce5, 0x58001ce5}, 206 + {0x0000a560, 0x900fff0b, 0x900fff0b, 0x5b001ce9, 0x5b001ce9}, 207 + {0x0000a564, 0x960fffcb, 0x960fffcb, 0x60001eeb, 0x60001eeb}, 208 + {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 209 + {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 210 + {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 211 + {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 212 + {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 213 + {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 214 + {0x00016044, 0x05b6b2db, 0x05b6b2db, 0x05b6b2db, 0x05b6b2db}, 215 + }; 216 + 217 + static const u32 ar9485_1_0[][2] = { 218 + /* Addr allmodes */ 219 + {0x0000a580, 0x00000000}, 220 + {0x0000a584, 0x00000000}, 221 + {0x0000a588, 0x00000000}, 222 + {0x0000a58c, 0x00000000}, 223 + {0x0000a590, 0x00000000}, 224 + {0x0000a594, 0x00000000}, 225 + {0x0000a598, 0x00000000}, 226 + {0x0000a59c, 0x00000000}, 227 + {0x0000a5a0, 0x00000000}, 228 + {0x0000a5a4, 0x00000000}, 229 + {0x0000a5a8, 0x00000000}, 230 + {0x0000a5ac, 0x00000000}, 231 + {0x0000a5b0, 0x00000000}, 232 + {0x0000a5b4, 0x00000000}, 233 + {0x0000a5b8, 0x00000000}, 234 + {0x0000a5bc, 0x00000000}, 235 + }; 236 + 237 + static const u32 ar9485_1_0_radio_core[][2] = { 238 + /* Addr allmodes */ 239 + {0x00016000, 0x36db6db6}, 240 + {0x00016004, 0x6db6db40}, 241 + {0x00016008, 0x73800000}, 242 + {0x0001600c, 0x00000000}, 243 + {0x00016040, 0x7f80fff8}, 244 + {0x00016048, 0x6c92426e}, 245 + {0x0001604c, 0x000f0278}, 246 + {0x00016050, 0x6db6db6c}, 247 + {0x00016054, 0x6db60000}, 248 + {0x00016080, 0x00080000}, 249 + {0x00016084, 0x0e48048c}, 250 + {0x00016088, 0x14214514}, 251 + {0x0001608c, 0x119f081e}, 252 + {0x00016090, 0x24926490}, 253 + {0x00016098, 0xd28b3330}, 254 + {0x000160a0, 0xc2108ffe}, 255 + {0x000160a4, 0x812fc370}, 256 + {0x000160a8, 0x423c8000}, 257 + {0x000160b4, 0x92480040}, 258 + {0x000160c0, 0x006db6db}, 259 + {0x000160c4, 0x0186db60}, 260 + {0x000160c8, 0x6db6db6c}, 261 + {0x000160cc, 0x6de6fbe0}, 262 + {0x000160d0, 0xf7dfcf3c}, 263 + {0x00016100, 0x04cb0001}, 264 + {0x00016104, 0xfff80015}, 265 + {0x00016108, 0x00080010}, 266 + {0x00016144, 0x01884080}, 267 + {0x00016148, 0x00008040}, 268 + {0x00016180, 0x08453333}, 269 + {0x00016184, 0x18e82f01}, 270 + {0x00016188, 0x00000000}, 271 + {0x0001618c, 0x00000000}, 272 + {0x00016240, 0x08400000}, 273 + {0x00016244, 0x1bf90f00}, 274 + {0x00016248, 0x00000000}, 275 + {0x0001624c, 0x00000000}, 276 + {0x00016280, 0x01000015}, 277 + {0x00016284, 0x00d30000}, 278 + {0x00016288, 0x00318000}, 279 + {0x0001628c, 0x50000000}, 280 + {0x00016290, 0x4b96210f}, 281 + {0x00016380, 0x00000000}, 282 + {0x00016384, 0x00000000}, 283 + {0x00016388, 0x00800700}, 284 + {0x0001638c, 0x00800700}, 285 + {0x00016390, 0x00800700}, 286 + {0x00016394, 0x00000000}, 287 + {0x00016398, 0x00000000}, 288 + {0x0001639c, 0x00000000}, 289 + {0x000163a0, 0x00000001}, 290 + {0x000163a4, 0x00000001}, 291 + {0x000163a8, 0x00000000}, 292 + {0x000163ac, 0x00000000}, 293 + {0x000163b0, 0x00000000}, 294 + {0x000163b4, 0x00000000}, 295 + {0x000163b8, 0x00000000}, 296 + {0x000163bc, 0x00000000}, 297 + {0x000163c0, 0x000000a0}, 298 + {0x000163c4, 0x000c0000}, 299 + {0x000163c8, 0x14021402}, 300 + {0x000163cc, 0x00001402}, 301 + {0x000163d0, 0x00000000}, 302 + {0x000163d4, 0x00000000}, 303 + {0x00016c40, 0x1319c178}, 304 + {0x00016c44, 0x10000000}, 305 + }; 306 + 307 + static const u32 ar9485Modes_lowest_ob_db_tx_gain_1_0[][5] = { 308 + /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 309 + {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d8, 0x000050d8}, 310 + {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, 311 + {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, 312 + {0x0000a508, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, 313 + {0x0000a50c, 0x11062202, 0x11062202, 0x0d000200, 0x0d000200}, 314 + {0x0000a510, 0x17022e00, 0x17022e00, 0x11000202, 0x11000202}, 315 + {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x15000400, 0x15000400}, 316 + {0x0000a518, 0x25020ec0, 0x25020ec0, 0x19000402, 0x19000402}, 317 + {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x1d000404, 0x1d000404}, 318 + {0x0000a520, 0x2f001f04, 0x2f001f04, 0x21000603, 0x21000603}, 319 + {0x0000a524, 0x35001fc4, 0x35001fc4, 0x25000605, 0x25000605}, 320 + {0x0000a528, 0x3c022f04, 0x3c022f04, 0x2a000a03, 0x2a000a03}, 321 + {0x0000a52c, 0x41023e85, 0x41023e85, 0x2c000a04, 0x2c000a04}, 322 + {0x0000a530, 0x48023ec6, 0x48023ec6, 0x2e000a20, 0x2e000a20}, 323 + {0x0000a534, 0x4d023f01, 0x4d023f01, 0x34000e20, 0x34000e20}, 324 + {0x0000a538, 0x53023f4b, 0x53023f4b, 0x38000e22, 0x38000e22}, 325 + {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x3c000e24, 0x3c000e24}, 326 + {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x40000e26, 0x40000e26}, 327 + {0x0000a544, 0x6502feca, 0x6502feca, 0x43001640, 0x43001640}, 328 + {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x46001660, 0x46001660}, 329 + {0x0000a54c, 0x7203feca, 0x7203feca, 0x49001861, 0x49001861}, 330 + {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x4c001a81, 0x4c001a81}, 331 + {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x4f001a83, 0x4f001a83}, 332 + {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x54001c85, 0x54001c85}, 333 + {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x58001ce5, 0x58001ce5}, 334 + {0x0000a560, 0x900fff0b, 0x900fff0b, 0x5b001ce9, 0x5b001ce9}, 335 + {0x0000a564, 0x960fffcb, 0x960fffcb, 0x60001eeb, 0x60001eeb}, 336 + {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 337 + {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 338 + {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 339 + {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 340 + {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 341 + {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 342 + {0x00016044, 0x05b6b2db, 0x05b6b2db, 0x05b6b2db, 0x05b6b2db}, 343 + }; 344 + 345 + static const u32 ar9485_1_0_baseband_core[][2] = { 346 + /* Addr allmodes */ 347 + {0x00009800, 0xafe68e30}, 348 + {0x00009804, 0xfd14e000}, 349 + {0x00009808, 0x9c0a8f6b}, 350 + {0x0000980c, 0x04800000}, 351 + {0x00009814, 0x9280c00a}, 352 + {0x00009818, 0x00000000}, 353 + {0x0000981c, 0x00020028}, 354 + {0x00009834, 0x5f3ca3de}, 355 + {0x00009838, 0x0108ecff}, 356 + {0x0000983c, 0x14750600}, 357 + {0x00009880, 0x201fff00}, 358 + {0x00009884, 0x00001042}, 359 + {0x000098a4, 0x00200400}, 360 + {0x000098b0, 0x52440bbe}, 361 + {0x000098bc, 0x00000002}, 362 + {0x000098d0, 0x004b6a8e}, 363 + {0x000098d4, 0x00000820}, 364 + {0x000098dc, 0x00000000}, 365 + {0x000098f0, 0x00000000}, 366 + {0x000098f4, 0x00000000}, 367 + {0x00009c04, 0x00000000}, 368 + {0x00009c08, 0x03200000}, 369 + {0x00009c0c, 0x00000000}, 370 + {0x00009c10, 0x00000000}, 371 + {0x00009c14, 0x00046384}, 372 + {0x00009c18, 0x05b6b440}, 373 + {0x00009c1c, 0x00b6b440}, 374 + {0x00009d00, 0xc080a333}, 375 + {0x00009d04, 0x40206c10}, 376 + {0x00009d08, 0x009c4060}, 377 + {0x00009d0c, 0x1883800a}, 378 + {0x00009d10, 0x01834061}, 379 + {0x00009d14, 0x00c00400}, 380 + {0x00009d18, 0x00000000}, 381 + {0x00009d1c, 0x00000000}, 382 + {0x00009e08, 0x0038233c}, 383 + {0x00009e24, 0x990bb515}, 384 + {0x00009e28, 0x0a6f0000}, 385 + {0x00009e30, 0x06336f77}, 386 + {0x00009e34, 0x6af6532f}, 387 + {0x00009e38, 0x0cc80c00}, 388 + {0x00009e40, 0x0d261820}, 389 + {0x00009e4c, 0x00001004}, 390 + {0x00009e50, 0x00ff03f1}, 391 + {0x00009fc0, 0x80be4788}, 392 + {0x00009fc4, 0x0001efb5}, 393 + {0x00009fcc, 0x40000014}, 394 + {0x0000a20c, 0x00000000}, 395 + {0x0000a210, 0x00000000}, 396 + {0x0000a220, 0x00000000}, 397 + {0x0000a224, 0x00000000}, 398 + {0x0000a228, 0x10002310}, 399 + {0x0000a23c, 0x00000000}, 400 + {0x0000a244, 0x0c000000}, 401 + {0x0000a2a0, 0x00000001}, 402 + {0x0000a2c0, 0x00000001}, 403 + {0x0000a2c8, 0x00000000}, 404 + {0x0000a2cc, 0x18c43433}, 405 + {0x0000a2d4, 0x00000000}, 406 + {0x0000a2dc, 0x00000000}, 407 + {0x0000a2e0, 0x00000000}, 408 + {0x0000a2e4, 0x00000000}, 409 + {0x0000a2e8, 0x00000000}, 410 + {0x0000a2ec, 0x00000000}, 411 + {0x0000a2f0, 0x00000000}, 412 + {0x0000a2f4, 0x00000000}, 413 + {0x0000a2f8, 0x00000000}, 414 + {0x0000a344, 0x00000000}, 415 + {0x0000a34c, 0x00000000}, 416 + {0x0000a350, 0x0000a000}, 417 + {0x0000a364, 0x00000000}, 418 + {0x0000a370, 0x00000000}, 419 + {0x0000a390, 0x00000001}, 420 + {0x0000a394, 0x00000444}, 421 + {0x0000a398, 0x001f0e0f}, 422 + {0x0000a39c, 0x0075393f}, 423 + {0x0000a3a0, 0xb79f6427}, 424 + {0x0000a3a4, 0x00000000}, 425 + {0x0000a3a8, 0xaaaaaaaa}, 426 + {0x0000a3ac, 0x3c466478}, 427 + {0x0000a3c0, 0x20202020}, 428 + {0x0000a3c4, 0x22222220}, 429 + {0x0000a3c8, 0x20200020}, 430 + {0x0000a3cc, 0x20202020}, 431 + {0x0000a3d0, 0x20202020}, 432 + {0x0000a3d4, 0x20202020}, 433 + {0x0000a3d8, 0x20202020}, 434 + {0x0000a3dc, 0x20202020}, 435 + {0x0000a3e0, 0x20202020}, 436 + {0x0000a3e4, 0x20202020}, 437 + {0x0000a3e8, 0x20202020}, 438 + {0x0000a3ec, 0x20202020}, 439 + {0x0000a3f0, 0x00000000}, 440 + {0x0000a3f4, 0x00000006}, 441 + {0x0000a3f8, 0x0cdbd380}, 442 + {0x0000a3fc, 0x000f0f01}, 443 + {0x0000a400, 0x8fa91f01}, 444 + {0x0000a404, 0x00000000}, 445 + {0x0000a408, 0x0e79e5c6}, 446 + {0x0000a40c, 0x00820820}, 447 + {0x0000a414, 0x1ce739ce}, 448 + {0x0000a418, 0x2d0011ce}, 449 + {0x0000a41c, 0x1ce739ce}, 450 + {0x0000a420, 0x000001ce}, 451 + {0x0000a424, 0x1ce739ce}, 452 + {0x0000a428, 0x000001ce}, 453 + {0x0000a42c, 0x1ce739ce}, 454 + {0x0000a430, 0x1ce739ce}, 455 + {0x0000a434, 0x00000000}, 456 + {0x0000a438, 0x00001801}, 457 + {0x0000a43c, 0x00000000}, 458 + {0x0000a440, 0x00000000}, 459 + {0x0000a444, 0x00000000}, 460 + {0x0000a448, 0x04000000}, 461 + {0x0000a44c, 0x00000001}, 462 + {0x0000a450, 0x00010000}, 463 + {0x0000a458, 0x00000000}, 464 + {0x0000a5c4, 0x3fad9d74}, 465 + {0x0000a5c8, 0x0048060a}, 466 + {0x0000a5cc, 0x00000637}, 467 + {0x0000a760, 0x03020100}, 468 + {0x0000a764, 0x09080504}, 469 + {0x0000a768, 0x0d0c0b0a}, 470 + {0x0000a76c, 0x13121110}, 471 + {0x0000a770, 0x31301514}, 472 + {0x0000a774, 0x35343332}, 473 + {0x0000a778, 0x00000036}, 474 + {0x0000a780, 0x00000838}, 475 + {0x0000a7c0, 0x00000000}, 476 + {0x0000a7c4, 0xfffffffc}, 477 + {0x0000a7c8, 0x00000000}, 478 + {0x0000a7cc, 0x00000000}, 479 + {0x0000a7d0, 0x00000000}, 480 + {0x0000a7d4, 0x00000004}, 481 + {0x0000a7dc, 0x00000001}, 482 + }; 483 + 484 + static const u32 ar9485Modes_high_ob_db_tx_gain_1_0[][5] = { 485 + /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 486 + {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d8, 0x000050d8}, 487 + {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, 488 + {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, 489 + {0x0000a508, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, 490 + {0x0000a50c, 0x11062202, 0x11062202, 0x0d000200, 0x0d000200}, 491 + {0x0000a510, 0x17022e00, 0x17022e00, 0x11000202, 0x11000202}, 492 + {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x15000400, 0x15000400}, 493 + {0x0000a518, 0x25020ec0, 0x25020ec0, 0x19000402, 0x19000402}, 494 + {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x1d000404, 0x1d000404}, 495 + {0x0000a520, 0x2f001f04, 0x2f001f04, 0x21000603, 0x21000603}, 496 + {0x0000a524, 0x35001fc4, 0x35001fc4, 0x25000605, 0x25000605}, 497 + {0x0000a528, 0x3c022f04, 0x3c022f04, 0x2a000a03, 0x2a000a03}, 498 + {0x0000a52c, 0x41023e85, 0x41023e85, 0x2c000a04, 0x2c000a04}, 499 + {0x0000a530, 0x48023ec6, 0x48023ec6, 0x2e000a20, 0x2e000a20}, 500 + {0x0000a534, 0x4d023f01, 0x4d023f01, 0x34000e20, 0x34000e20}, 501 + {0x0000a538, 0x53023f4b, 0x53023f4b, 0x38000e22, 0x38000e22}, 502 + {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x3c000e24, 0x3c000e24}, 503 + {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x40000e26, 0x40000e26}, 504 + {0x0000a544, 0x6502feca, 0x6502feca, 0x43001640, 0x43001640}, 505 + {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x46001660, 0x46001660}, 506 + {0x0000a54c, 0x7203feca, 0x7203feca, 0x49001861, 0x49001861}, 507 + {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x4c001a81, 0x4c001a81}, 508 + {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x4f001a83, 0x4f001a83}, 509 + {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x54001c85, 0x54001c85}, 510 + {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x58001ce5, 0x58001ce5}, 511 + {0x0000a560, 0x900fff0b, 0x900fff0b, 0x5b001ce9, 0x5b001ce9}, 512 + {0x0000a564, 0x960fffcb, 0x960fffcb, 0x60001eeb, 0x60001eeb}, 513 + {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 514 + {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 515 + {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 516 + {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 517 + {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 518 + {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 519 + {0x00016044, 0x05b6b2db, 0x05b6b2db, 0x05b6b2db, 0x05b6b2db}, 520 + }; 521 + 522 + static const u32 ar9485Common_rx_gain_1_0[][2] = { 523 + /* Addr allmodes */ 524 + {0x0000a000, 0x00010000}, 525 + {0x0000a004, 0x00030002}, 526 + {0x0000a008, 0x00050004}, 527 + {0x0000a00c, 0x00810080}, 528 + {0x0000a010, 0x01800082}, 529 + {0x0000a014, 0x01820181}, 530 + {0x0000a018, 0x01840183}, 531 + {0x0000a01c, 0x01880185}, 532 + {0x0000a020, 0x018a0189}, 533 + {0x0000a024, 0x02850284}, 534 + {0x0000a028, 0x02890288}, 535 + {0x0000a02c, 0x03850384}, 536 + {0x0000a030, 0x03890388}, 537 + {0x0000a034, 0x038b038a}, 538 + {0x0000a038, 0x038d038c}, 539 + {0x0000a03c, 0x03910390}, 540 + {0x0000a040, 0x03930392}, 541 + {0x0000a044, 0x03950394}, 542 + {0x0000a048, 0x00000396}, 543 + {0x0000a04c, 0x00000000}, 544 + {0x0000a050, 0x00000000}, 545 + {0x0000a054, 0x00000000}, 546 + {0x0000a058, 0x00000000}, 547 + {0x0000a05c, 0x00000000}, 548 + {0x0000a060, 0x00000000}, 549 + {0x0000a064, 0x00000000}, 550 + {0x0000a068, 0x00000000}, 551 + {0x0000a06c, 0x00000000}, 552 + {0x0000a070, 0x00000000}, 553 + {0x0000a074, 0x00000000}, 554 + {0x0000a078, 0x00000000}, 555 + {0x0000a07c, 0x00000000}, 556 + {0x0000a080, 0x28282828}, 557 + {0x0000a084, 0x28282828}, 558 + {0x0000a088, 0x28282828}, 559 + {0x0000a08c, 0x28282828}, 560 + {0x0000a090, 0x28282828}, 561 + {0x0000a094, 0x21212128}, 562 + {0x0000a098, 0x171c1c1c}, 563 + {0x0000a09c, 0x02020212}, 564 + {0x0000a0a0, 0x00000202}, 565 + {0x0000a0a4, 0x00000000}, 566 + {0x0000a0a8, 0x00000000}, 567 + {0x0000a0ac, 0x00000000}, 568 + {0x0000a0b0, 0x00000000}, 569 + {0x0000a0b4, 0x00000000}, 570 + {0x0000a0b8, 0x00000000}, 571 + {0x0000a0bc, 0x00000000}, 572 + {0x0000a0c0, 0x001f0000}, 573 + {0x0000a0c4, 0x111f1100}, 574 + {0x0000a0c8, 0x111d111e}, 575 + {0x0000a0cc, 0x111b111c}, 576 + {0x0000a0d0, 0x22032204}, 577 + {0x0000a0d4, 0x22012202}, 578 + {0x0000a0d8, 0x221f2200}, 579 + {0x0000a0dc, 0x221d221e}, 580 + {0x0000a0e0, 0x33013302}, 581 + {0x0000a0e4, 0x331f3300}, 582 + {0x0000a0e8, 0x4402331e}, 583 + {0x0000a0ec, 0x44004401}, 584 + {0x0000a0f0, 0x441e441f}, 585 + {0x0000a0f4, 0x55015502}, 586 + {0x0000a0f8, 0x551f5500}, 587 + {0x0000a0fc, 0x6602551e}, 588 + {0x0000a100, 0x66006601}, 589 + {0x0000a104, 0x661e661f}, 590 + {0x0000a108, 0x7703661d}, 591 + {0x0000a10c, 0x77017702}, 592 + {0x0000a110, 0x00007700}, 593 + {0x0000a114, 0x00000000}, 594 + {0x0000a118, 0x00000000}, 595 + {0x0000a11c, 0x00000000}, 596 + {0x0000a120, 0x00000000}, 597 + {0x0000a124, 0x00000000}, 598 + {0x0000a128, 0x00000000}, 599 + {0x0000a12c, 0x00000000}, 600 + {0x0000a130, 0x00000000}, 601 + {0x0000a134, 0x00000000}, 602 + {0x0000a138, 0x00000000}, 603 + {0x0000a13c, 0x00000000}, 604 + {0x0000a140, 0x001f0000}, 605 + {0x0000a144, 0x111f1100}, 606 + {0x0000a148, 0x111d111e}, 607 + {0x0000a14c, 0x111b111c}, 608 + {0x0000a150, 0x22032204}, 609 + {0x0000a154, 0x22012202}, 610 + {0x0000a158, 0x221f2200}, 611 + {0x0000a15c, 0x221d221e}, 612 + {0x0000a160, 0x33013302}, 613 + {0x0000a164, 0x331f3300}, 614 + {0x0000a168, 0x4402331e}, 615 + {0x0000a16c, 0x44004401}, 616 + {0x0000a170, 0x441e441f}, 617 + {0x0000a174, 0x55015502}, 618 + {0x0000a178, 0x551f5500}, 619 + {0x0000a17c, 0x6602551e}, 620 + {0x0000a180, 0x66006601}, 621 + {0x0000a184, 0x661e661f}, 622 + {0x0000a188, 0x7703661d}, 623 + {0x0000a18c, 0x77017702}, 624 + {0x0000a190, 0x00007700}, 625 + {0x0000a194, 0x00000000}, 626 + {0x0000a198, 0x00000000}, 627 + {0x0000a19c, 0x00000000}, 628 + {0x0000a1a0, 0x00000000}, 629 + {0x0000a1a4, 0x00000000}, 630 + {0x0000a1a8, 0x00000000}, 631 + {0x0000a1ac, 0x00000000}, 632 + {0x0000a1b0, 0x00000000}, 633 + {0x0000a1b4, 0x00000000}, 634 + {0x0000a1b8, 0x00000000}, 635 + {0x0000a1bc, 0x00000000}, 636 + {0x0000a1c0, 0x00000000}, 637 + {0x0000a1c4, 0x00000000}, 638 + {0x0000a1c8, 0x00000000}, 639 + {0x0000a1cc, 0x00000000}, 640 + {0x0000a1d0, 0x00000000}, 641 + {0x0000a1d4, 0x00000000}, 642 + {0x0000a1d8, 0x00000000}, 643 + {0x0000a1dc, 0x00000000}, 644 + {0x0000a1e0, 0x00000000}, 645 + {0x0000a1e4, 0x00000000}, 646 + {0x0000a1e8, 0x00000000}, 647 + {0x0000a1ec, 0x00000000}, 648 + {0x0000a1f0, 0x00000396}, 649 + {0x0000a1f4, 0x00000396}, 650 + {0x0000a1f8, 0x00000396}, 651 + {0x0000a1fc, 0x00000296}, 652 + }; 653 + 654 + static const u32 ar9485_1_0_pcie_phy_pll_on_clkreq_enable_L1[][2] = { 655 + /* Addr allmodes */ 656 + {0x00018c00, 0x10252e5e}, 657 + {0x00018c04, 0x000801d8}, 658 + {0x00018c08, 0x0000580c}, 659 + }; 660 + 661 + static const u32 ar9485_1_0_pcie_phy_clkreq_enable_L1[][2] = { 662 + /* Addr allmodes */ 663 + {0x00018c00, 0x10253e5e}, 664 + {0x00018c04, 0x000801d8}, 665 + {0x00018c08, 0x0000580c}, 666 + }; 667 + 668 + static const u32 ar9485_1_0_soc_preamble[][2] = { 669 + /* Addr allmodes */ 670 + {0x000040a4, 0x00a0c9c9}, 671 + {0x00007048, 0x00000004}, 672 + }; 673 + 674 + static const u32 ar9485_fast_clock_1_0_baseband_postamble[][3] = { 675 + /* Addr 5G_HT20 5G_HT40 */ 676 + {0x00009e00, 0x03721821, 0x03721821}, 677 + {0x0000a230, 0x0000400b, 0x00004016}, 678 + {0x0000a254, 0x00000898, 0x00001130}, 679 + }; 680 + 681 + static const u32 ar9485_1_0_baseband_postamble[][5] = { 682 + /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 683 + {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8005, 0xd00a8005}, 684 + {0x00009820, 0x206a002e, 0x206a002e, 0x206a002e, 0x206a002e}, 685 + {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0}, 686 + {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881}, 687 + {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, 688 + {0x00009830, 0x0000059c, 0x0000059c, 0x0000059c, 0x0000059c}, 689 + {0x00009c00, 0x00000044, 0x00000044, 0x00000044, 0x00000044}, 690 + {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0}, 691 + {0x00009e04, 0x00182020, 0x00182020, 0x00182020, 0x00182020}, 692 + {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, 693 + {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec80d2e, 0x7ec80d2e}, 694 + {0x00009e14, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e}, 695 + {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 696 + {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, 697 + {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, 698 + {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, 699 + {0x00009e3c, 0xcf946220, 0xcf946220, 0xcf946222, 0xcf946222}, 700 + {0x00009e44, 0x02321e27, 0x02321e27, 0x02282324, 0x02282324}, 701 + {0x00009e48, 0x5030201a, 0x5030201a, 0x50302010, 0x50302010}, 702 + {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, 703 + {0x0000a204, 0x01303fc0, 0x01303fc4, 0x01303fc4, 0x01303fc0}, 704 + {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004}, 705 + {0x0000a230, 0x0000400a, 0x00004014, 0x00004016, 0x0000400b}, 706 + {0x0000a234, 0x10000fff, 0x10000fff, 0x10000fff, 0x10000fff}, 707 + {0x0000a238, 0xffb81018, 0xffb81018, 0xffb81018, 0xffb81018}, 708 + {0x0000a250, 0x00000000, 0x00000000, 0x00000210, 0x00000108}, 709 + {0x0000a254, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898}, 710 + {0x0000a258, 0x02020002, 0x02020002, 0x02020002, 0x02020002}, 711 + {0x0000a25c, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e}, 712 + {0x0000a260, 0x3a021501, 0x3a021501, 0x3a021501, 0x3a021501}, 713 + {0x0000a264, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e}, 714 + {0x0000a280, 0x00000007, 0x00000007, 0x0000000b, 0x0000000b}, 715 + {0x0000a284, 0x00000000, 0x00000000, 0x000002a0, 0x000002a0}, 716 + {0x0000a288, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 717 + {0x0000a28c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 718 + {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, 719 + {0x0000a2d0, 0x00071981, 0x00071981, 0x00071981, 0x00071982}, 720 + {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a}, 721 + {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 722 + {0x0000be04, 0x00802020, 0x00802020, 0x00802020, 0x00802020}, 723 + {0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 724 + }; 725 + 726 + static const u32 ar9485Modes_low_ob_db_tx_gain_1_0[][5] = { 727 + /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 728 + {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d8, 0x000050d8}, 729 + {0x0000a500, 0x00022200, 0x00022200, 0x00000000, 0x00000000}, 730 + {0x0000a504, 0x05062002, 0x05062002, 0x04000002, 0x04000002}, 731 + {0x0000a508, 0x0c002e00, 0x0c002e00, 0x08000004, 0x08000004}, 732 + {0x0000a50c, 0x11062202, 0x11062202, 0x0d000200, 0x0d000200}, 733 + {0x0000a510, 0x17022e00, 0x17022e00, 0x11000202, 0x11000202}, 734 + {0x0000a514, 0x1d000ec2, 0x1d000ec2, 0x15000400, 0x15000400}, 735 + {0x0000a518, 0x25020ec0, 0x25020ec0, 0x19000402, 0x19000402}, 736 + {0x0000a51c, 0x2b020ec3, 0x2b020ec3, 0x1d000404, 0x1d000404}, 737 + {0x0000a520, 0x2f001f04, 0x2f001f04, 0x21000603, 0x21000603}, 738 + {0x0000a524, 0x35001fc4, 0x35001fc4, 0x25000605, 0x25000605}, 739 + {0x0000a528, 0x3c022f04, 0x3c022f04, 0x2a000a03, 0x2a000a03}, 740 + {0x0000a52c, 0x41023e85, 0x41023e85, 0x2c000a04, 0x2c000a04}, 741 + {0x0000a530, 0x48023ec6, 0x48023ec6, 0x2e000a20, 0x2e000a20}, 742 + {0x0000a534, 0x4d023f01, 0x4d023f01, 0x34000e20, 0x34000e20}, 743 + {0x0000a538, 0x53023f4b, 0x53023f4b, 0x38000e22, 0x38000e22}, 744 + {0x0000a53c, 0x5a027f09, 0x5a027f09, 0x3c000e24, 0x3c000e24}, 745 + {0x0000a540, 0x5f027fc9, 0x5f027fc9, 0x40000e26, 0x40000e26}, 746 + {0x0000a544, 0x6502feca, 0x6502feca, 0x43001640, 0x43001640}, 747 + {0x0000a548, 0x6b02ff4a, 0x6b02ff4a, 0x46001660, 0x46001660}, 748 + {0x0000a54c, 0x7203feca, 0x7203feca, 0x49001861, 0x49001861}, 749 + {0x0000a550, 0x7703ff0b, 0x7703ff0b, 0x4c001a81, 0x4c001a81}, 750 + {0x0000a554, 0x7d06ffcb, 0x7d06ffcb, 0x4f001a83, 0x4f001a83}, 751 + {0x0000a558, 0x8407ff0b, 0x8407ff0b, 0x54001c85, 0x54001c85}, 752 + {0x0000a55c, 0x8907ffcb, 0x8907ffcb, 0x58001ce5, 0x58001ce5}, 753 + {0x0000a560, 0x900fff0b, 0x900fff0b, 0x5b001ce9, 0x5b001ce9}, 754 + {0x0000a564, 0x960fffcb, 0x960fffcb, 0x60001eeb, 0x60001eeb}, 755 + {0x0000a568, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 756 + {0x0000a56c, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 757 + {0x0000a570, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 758 + {0x0000a574, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 759 + {0x0000a578, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 760 + {0x0000a57c, 0x9c1fff0b, 0x9c1fff0b, 0x60001eeb, 0x60001eeb}, 761 + {0x00016044, 0x05b6b2db, 0x05b6b2db, 0x05b6b2db, 0x05b6b2db}, 762 + }; 763 + 764 + static const u32 ar9485_1_0_pcie_phy_clkreq_disable_L1[][2] = { 765 + /* Addr allmodes */ 766 + {0x00018c00, 0x10213e5e}, 767 + {0x00018c04, 0x000801d8}, 768 + {0x00018c08, 0x0000580c}, 769 + }; 770 + 771 + static const u32 ar9485_1_0_radio_postamble[][2] = { 772 + /* Addr allmodes */ 773 + {0x0001609c, 0x0b283f31}, 774 + {0x000160ac, 0x24611800}, 775 + {0x000160b0, 0x03284f3e}, 776 + {0x0001610c, 0x00170000}, 777 + {0x00016140, 0x10804008}, 778 + }; 779 + 780 + static const u32 ar9485_1_0_mac_core[][2] = { 781 + /* Addr allmodes */ 782 + {0x00000008, 0x00000000}, 783 + {0x00000030, 0x00020085}, 784 + {0x00000034, 0x00000005}, 785 + {0x00000040, 0x00000000}, 786 + {0x00000044, 0x00000000}, 787 + {0x00000048, 0x00000008}, 788 + {0x0000004c, 0x00000010}, 789 + {0x00000050, 0x00000000}, 790 + {0x00001040, 0x002ffc0f}, 791 + {0x00001044, 0x002ffc0f}, 792 + {0x00001048, 0x002ffc0f}, 793 + {0x0000104c, 0x002ffc0f}, 794 + {0x00001050, 0x002ffc0f}, 795 + {0x00001054, 0x002ffc0f}, 796 + {0x00001058, 0x002ffc0f}, 797 + {0x0000105c, 0x002ffc0f}, 798 + {0x00001060, 0x002ffc0f}, 799 + {0x00001064, 0x002ffc0f}, 800 + {0x000010f0, 0x00000100}, 801 + {0x00001270, 0x00000000}, 802 + {0x000012b0, 0x00000000}, 803 + {0x000012f0, 0x00000000}, 804 + {0x0000143c, 0x00000000}, 805 + {0x0000147c, 0x00000000}, 806 + {0x00008000, 0x00000000}, 807 + {0x00008004, 0x00000000}, 808 + {0x00008008, 0x00000000}, 809 + {0x0000800c, 0x00000000}, 810 + {0x00008018, 0x00000000}, 811 + {0x00008020, 0x00000000}, 812 + {0x00008038, 0x00000000}, 813 + {0x0000803c, 0x00000000}, 814 + {0x00008040, 0x00000000}, 815 + {0x00008044, 0x00000000}, 816 + {0x00008048, 0x00000000}, 817 + {0x0000804c, 0xffffffff}, 818 + {0x00008054, 0x00000000}, 819 + {0x00008058, 0x00000000}, 820 + {0x0000805c, 0x000fc78f}, 821 + {0x00008060, 0x0000000f}, 822 + {0x00008064, 0x00000000}, 823 + {0x00008070, 0x00000310}, 824 + {0x00008074, 0x00000020}, 825 + {0x00008078, 0x00000000}, 826 + {0x0000809c, 0x0000000f}, 827 + {0x000080a0, 0x00000000}, 828 + {0x000080a4, 0x02ff0000}, 829 + {0x000080a8, 0x0e070605}, 830 + {0x000080ac, 0x0000000d}, 831 + {0x000080b0, 0x00000000}, 832 + {0x000080b4, 0x00000000}, 833 + {0x000080b8, 0x00000000}, 834 + {0x000080bc, 0x00000000}, 835 + {0x000080c0, 0x2a800000}, 836 + {0x000080c4, 0x06900168}, 837 + {0x000080c8, 0x13881c20}, 838 + {0x000080cc, 0x01f40000}, 839 + {0x000080d0, 0x00252500}, 840 + {0x000080d4, 0x00a00000}, 841 + {0x000080d8, 0x00400000}, 842 + {0x000080dc, 0x00000000}, 843 + {0x000080e0, 0xffffffff}, 844 + {0x000080e4, 0x0000ffff}, 845 + {0x000080e8, 0x3f3f3f3f}, 846 + {0x000080ec, 0x00000000}, 847 + {0x000080f0, 0x00000000}, 848 + {0x000080f4, 0x00000000}, 849 + {0x000080fc, 0x00020000}, 850 + {0x00008100, 0x00000000}, 851 + {0x00008108, 0x00000052}, 852 + {0x0000810c, 0x00000000}, 853 + {0x00008110, 0x00000000}, 854 + {0x00008114, 0x000007ff}, 855 + {0x00008118, 0x000000aa}, 856 + {0x0000811c, 0x00003210}, 857 + {0x00008124, 0x00000000}, 858 + {0x00008128, 0x00000000}, 859 + {0x0000812c, 0x00000000}, 860 + {0x00008130, 0x00000000}, 861 + {0x00008134, 0x00000000}, 862 + {0x00008138, 0x00000000}, 863 + {0x0000813c, 0x0000ffff}, 864 + {0x00008144, 0xffffffff}, 865 + {0x00008168, 0x00000000}, 866 + {0x0000816c, 0x00000000}, 867 + {0x00008170, 0x18486200}, 868 + {0x00008174, 0x33332210}, 869 + {0x00008178, 0x00000000}, 870 + {0x0000817c, 0x00020000}, 871 + {0x000081c0, 0x00000000}, 872 + {0x000081c4, 0x33332210}, 873 + {0x000081c8, 0x00000000}, 874 + {0x000081cc, 0x00000000}, 875 + {0x000081d4, 0x00000000}, 876 + {0x000081ec, 0x00000000}, 877 + {0x000081f0, 0x00000000}, 878 + {0x000081f4, 0x00000000}, 879 + {0x000081f8, 0x00000000}, 880 + {0x000081fc, 0x00000000}, 881 + {0x00008240, 0x00100000}, 882 + {0x00008244, 0x0010f400}, 883 + {0x00008248, 0x00000800}, 884 + {0x0000824c, 0x0001e800}, 885 + {0x00008250, 0x00000000}, 886 + {0x00008254, 0x00000000}, 887 + {0x00008258, 0x00000000}, 888 + {0x0000825c, 0x40000000}, 889 + {0x00008260, 0x00080922}, 890 + {0x00008264, 0x9ca00010}, 891 + {0x00008268, 0xffffffff}, 892 + {0x0000826c, 0x0000ffff}, 893 + {0x00008270, 0x00000000}, 894 + {0x00008274, 0x40000000}, 895 + {0x00008278, 0x003e4180}, 896 + {0x0000827c, 0x00000004}, 897 + {0x00008284, 0x0000002c}, 898 + {0x00008288, 0x0000002c}, 899 + {0x0000828c, 0x000000ff}, 900 + {0x00008294, 0x00000000}, 901 + {0x00008298, 0x00000000}, 902 + {0x0000829c, 0x00000000}, 903 + {0x00008300, 0x00000140}, 904 + {0x00008314, 0x00000000}, 905 + {0x0000831c, 0x0000010d}, 906 + {0x00008328, 0x00000000}, 907 + {0x0000832c, 0x00000007}, 908 + {0x00008330, 0x00000302}, 909 + {0x00008334, 0x00000700}, 910 + {0x00008338, 0x00ff0000}, 911 + {0x0000833c, 0x02400000}, 912 + {0x00008340, 0x000107ff}, 913 + {0x00008344, 0xa248105b}, 914 + {0x00008348, 0x008f0000}, 915 + {0x0000835c, 0x00000000}, 916 + {0x00008360, 0xffffffff}, 917 + {0x00008364, 0xffffffff}, 918 + {0x00008368, 0x00000000}, 919 + {0x00008370, 0x00000000}, 920 + {0x00008374, 0x000000ff}, 921 + {0x00008378, 0x00000000}, 922 + {0x0000837c, 0x00000000}, 923 + {0x00008380, 0xffffffff}, 924 + {0x00008384, 0xffffffff}, 925 + {0x00008390, 0xffffffff}, 926 + {0x00008394, 0xffffffff}, 927 + {0x00008398, 0x00000000}, 928 + {0x0000839c, 0x00000000}, 929 + {0x000083a0, 0x00000000}, 930 + {0x000083a4, 0x0000fa14}, 931 + {0x000083a8, 0x000f0c00}, 932 + {0x000083ac, 0x33332210}, 933 + {0x000083b0, 0x33332210}, 934 + {0x000083b4, 0x33332210}, 935 + {0x000083b8, 0x33332210}, 936 + {0x000083bc, 0x00000000}, 937 + {0x000083c0, 0x00000000}, 938 + {0x000083c4, 0x00000000}, 939 + {0x000083c8, 0x00000000}, 940 + {0x000083cc, 0x00000200}, 941 + {0x000083d0, 0x000301ff}, 942 + }; 943 + #endif
+1 -1
drivers/net/wireless/ath/ath9k/ath9k.h
··· 311 311 int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp); 312 312 struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype); 313 313 void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq); 314 - void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx); 314 + bool ath_drain_all_txq(struct ath_softc *sc, bool retry_tx); 315 315 void ath_draintxq(struct ath_softc *sc, 316 316 struct ath_txq *txq, bool retry_tx); 317 317 void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an);
+38 -41
drivers/net/wireless/ath/ath9k/beacon.c
··· 46 46 } 47 47 48 48 if (!ath9k_hw_set_txq_props(ah, sc->beacon.beaconq, &qi)) { 49 - ath_print(common, ATH_DBG_FATAL, 50 - "Unable to update h/w beacon queue parameters\n"); 49 + ath_err(common, 50 + "Unable to update h/w beacon queue parameters\n"); 51 51 return 0; 52 52 } else { 53 53 ath9k_hw_resettxqueue(ah, sc->beacon.beaconq); ··· 120 120 memset(&txctl, 0, sizeof(struct ath_tx_control)); 121 121 txctl.txq = sc->beacon.cabq; 122 122 123 - ath_print(common, ATH_DBG_XMIT, 124 - "transmitting CABQ packet, skb: %p\n", skb); 123 + ath_dbg(common, ATH_DBG_XMIT, 124 + "transmitting CABQ packet, skb: %p\n", skb); 125 125 126 126 if (ath_tx_start(hw, skb, &txctl) != 0) { 127 - ath_print(common, ATH_DBG_XMIT, "CABQ TX failed\n"); 127 + ath_dbg(common, ATH_DBG_XMIT, "CABQ TX failed\n"); 128 128 dev_kfree_skb_any(skb); 129 129 } 130 130 } ··· 189 189 dev_kfree_skb_any(skb); 190 190 bf->bf_mpdu = NULL; 191 191 bf->bf_buf_addr = 0; 192 - ath_print(common, ATH_DBG_FATAL, 193 - "dma_mapping_error on beaconing\n"); 192 + ath_err(common, "dma_mapping_error on beaconing\n"); 194 193 return NULL; 195 194 } 196 195 ··· 209 210 210 211 if (skb && cabq_depth) { 211 212 if (sc->nvifs > 1) { 212 - ath_print(common, ATH_DBG_BEACON, 213 - "Flushing previous cabq traffic\n"); 213 + ath_dbg(common, ATH_DBG_BEACON, 214 + "Flushing previous cabq traffic\n"); 214 215 ath_draintxq(sc, cabq, false); 215 216 } 216 217 } ··· 282 283 /* NB: the beacon data buffer must be 32-bit aligned. */ 283 284 skb = ieee80211_beacon_get(sc->hw, vif); 284 285 if (skb == NULL) { 285 - ath_print(common, ATH_DBG_BEACON, "cannot get skb\n"); 286 + ath_dbg(common, ATH_DBG_BEACON, "cannot get skb\n"); 286 287 return -ENOMEM; 287 288 } 288 289 ··· 306 307 tsfadjust = intval * avp->av_bslot / ATH_BCBUF; 307 308 avp->tsf_adjust = cpu_to_le64(TU_TO_USEC(tsfadjust)); 308 309 309 - ath_print(common, ATH_DBG_BEACON, 310 - "stagger beacons, bslot %d intval " 311 - "%u tsfadjust %llu\n", 312 - avp->av_bslot, intval, (unsigned long long)tsfadjust); 310 + ath_dbg(common, ATH_DBG_BEACON, 311 + "stagger beacons, bslot %d intval %u tsfadjust %llu\n", 312 + avp->av_bslot, intval, (unsigned long long)tsfadjust); 313 313 314 314 ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp = 315 315 avp->tsf_adjust; ··· 322 324 dev_kfree_skb_any(skb); 323 325 bf->bf_mpdu = NULL; 324 326 bf->bf_buf_addr = 0; 325 - ath_print(common, ATH_DBG_FATAL, 326 - "dma_mapping_error on beacon alloc\n"); 327 + ath_err(common, "dma_mapping_error on beacon alloc\n"); 327 328 return -ENOMEM; 328 329 } 329 330 ··· 379 382 sc->beacon.bmisscnt++; 380 383 381 384 if (sc->beacon.bmisscnt < BSTUCK_THRESH) { 382 - ath_print(common, ATH_DBG_BSTUCK, 383 - "missed %u consecutive beacons\n", 384 - sc->beacon.bmisscnt); 385 + ath_dbg(common, ATH_DBG_BSTUCK, 386 + "missed %u consecutive beacons\n", 387 + sc->beacon.bmisscnt); 385 388 ath9k_hw_bstuck_nfcal(ah); 386 389 } else if (sc->beacon.bmisscnt >= BSTUCK_THRESH) { 387 - ath_print(common, ATH_DBG_BSTUCK, 388 - "beacon is officially stuck\n"); 390 + ath_dbg(common, ATH_DBG_BSTUCK, 391 + "beacon is officially stuck\n"); 389 392 sc->sc_flags |= SC_OP_TSF_RESET; 390 393 ath_reset(sc, true); 391 394 } ··· 394 397 } 395 398 396 399 if (sc->beacon.bmisscnt != 0) { 397 - ath_print(common, ATH_DBG_BSTUCK, 398 - "resume beacon xmit after %u misses\n", 399 - sc->beacon.bmisscnt); 400 + ath_dbg(common, ATH_DBG_BSTUCK, 401 + "resume beacon xmit after %u misses\n", 402 + sc->beacon.bmisscnt); 400 403 sc->beacon.bmisscnt = 0; 401 404 } 402 405 ··· 422 425 vif = sc->beacon.bslot[slot]; 423 426 aphy = sc->beacon.bslot_aphy[slot]; 424 427 425 - ath_print(common, ATH_DBG_BEACON, 426 - "slot %d [tsf %llu tsftu %u intval %u] vif %p\n", 427 - slot, tsf, tsftu, intval, vif); 428 + ath_dbg(common, ATH_DBG_BEACON, 429 + "slot %d [tsf %llu tsftu %u intval %u] vif %p\n", 430 + slot, tsf, tsftu, intval, vif); 428 431 429 432 bfaddr = 0; 430 433 if (vif) { ··· 466 469 * are still pending on the queue. 467 470 */ 468 471 if (!ath9k_hw_stoptxdma(ah, sc->beacon.beaconq)) { 469 - ath_print(common, ATH_DBG_FATAL, 470 - "beacon queue %u did not stop?\n", sc->beacon.beaconq); 472 + ath_err(common, "beacon queue %u did not stop?\n", 473 + sc->beacon.beaconq); 471 474 } 472 475 473 476 /* NB: cabq traffic should already be queued and primed */ ··· 553 556 554 557 /* No need to configure beacon if we are not associated */ 555 558 if (!common->curaid) { 556 - ath_print(common, ATH_DBG_BEACON, 557 - "STA is not yet associated..skipping beacon config\n"); 559 + ath_dbg(common, ATH_DBG_BEACON, 560 + "STA is not yet associated..skipping beacon config\n"); 558 561 return; 559 562 } 560 563 ··· 647 650 /* TSF out of range threshold fixed at 1 second */ 648 651 bs.bs_tsfoor_threshold = ATH9K_TSFOOR_THRESHOLD; 649 652 650 - ath_print(common, ATH_DBG_BEACON, "tsf: %llu tsftu: %u\n", tsf, tsftu); 651 - ath_print(common, ATH_DBG_BEACON, 652 - "bmiss: %u sleep: %u cfp-period: %u maxdur: %u next: %u\n", 653 - bs.bs_bmissthreshold, bs.bs_sleepduration, 654 - bs.bs_cfpperiod, bs.bs_cfpmaxduration, bs.bs_cfpnext); 653 + ath_dbg(common, ATH_DBG_BEACON, "tsf: %llu tsftu: %u\n", tsf, tsftu); 654 + ath_dbg(common, ATH_DBG_BEACON, 655 + "bmiss: %u sleep: %u cfp-period: %u maxdur: %u next: %u\n", 656 + bs.bs_bmissthreshold, bs.bs_sleepduration, 657 + bs.bs_cfpperiod, bs.bs_cfpmaxduration, bs.bs_cfpnext); 655 658 656 659 /* Set the computed STA beacon timers */ 657 660 ··· 687 690 nexttbtt += intval; 688 691 } while (nexttbtt < tsftu); 689 692 690 - ath_print(common, ATH_DBG_BEACON, 691 - "IBSS nexttbtt %u intval %u (%u)\n", 692 - nexttbtt, intval, conf->beacon_interval); 693 + ath_dbg(common, ATH_DBG_BEACON, 694 + "IBSS nexttbtt %u intval %u (%u)\n", 695 + nexttbtt, intval, conf->beacon_interval); 693 696 694 697 /* 695 698 * In IBSS mode enable the beacon timers but only enable SWBA interrupts ··· 752 755 ath_beacon_config_sta(sc, cur_conf); 753 756 break; 754 757 default: 755 - ath_print(common, ATH_DBG_CONFIG, 756 - "Unsupported beaconing mode\n"); 758 + ath_dbg(common, ATH_DBG_CONFIG, 759 + "Unsupported beaconing mode\n"); 757 760 return; 758 761 } 759 762
+29 -30
drivers/net/wireless/ath/ath9k/calib.c
··· 97 97 if (h[i].privNF > limit->max) { 98 98 high_nf_mid = true; 99 99 100 - ath_print(common, ATH_DBG_CALIBRATE, 101 - "NFmid[%d] (%d) > MAX (%d), %s\n", 102 - i, h[i].privNF, limit->max, 103 - (cal->nfcal_interference ? 104 - "not corrected (due to interference)" : 105 - "correcting to MAX")); 100 + ath_dbg(common, ATH_DBG_CALIBRATE, 101 + "NFmid[%d] (%d) > MAX (%d), %s\n", 102 + i, h[i].privNF, limit->max, 103 + (cal->nfcal_interference ? 104 + "not corrected (due to interference)" : 105 + "correcting to MAX")); 106 106 107 107 /* 108 108 * Normally we limit the average noise floor by the ··· 180 180 return true; 181 181 182 182 if (currCal->calState != CAL_DONE) { 183 - ath_print(common, ATH_DBG_CALIBRATE, 184 - "Calibration state incorrect, %d\n", 185 - currCal->calState); 183 + ath_dbg(common, ATH_DBG_CALIBRATE, 184 + "Calibration state incorrect, %d\n", 185 + currCal->calState); 186 186 return true; 187 187 } 188 188 189 189 if (!(ah->supp_cals & currCal->calData->calType)) 190 190 return true; 191 191 192 - ath_print(common, ATH_DBG_CALIBRATE, 193 - "Resetting Cal %d state for channel %u\n", 194 - currCal->calData->calType, conf->channel->center_freq); 192 + ath_dbg(common, ATH_DBG_CALIBRATE, 193 + "Resetting Cal %d state for channel %u\n", 194 + currCal->calData->calType, conf->channel->center_freq); 195 195 196 196 ah->caldata->CalValid &= ~currCal->calData->calType; 197 197 currCal->calState = CAL_WAITING; ··· 279 279 * noisefloor until the next calibration timer. 280 280 */ 281 281 if (j == 1000) { 282 - ath_print(common, ATH_DBG_ANY, "Timeout while waiting for nf " 283 - "to load: AR_PHY_AGC_CONTROL=0x%x\n", 284 - REG_READ(ah, AR_PHY_AGC_CONTROL)); 282 + ath_dbg(common, ATH_DBG_ANY, 283 + "Timeout while waiting for nf to load: AR_PHY_AGC_CONTROL=0x%x\n", 284 + REG_READ(ah, AR_PHY_AGC_CONTROL)); 285 285 return; 286 286 } 287 287 ··· 318 318 if (!nf[i]) 319 319 continue; 320 320 321 - ath_print(common, ATH_DBG_CALIBRATE, 322 - "NF calibrated [%s] [chain %d] is %d\n", 323 - (i >= 3 ? "ext" : "ctl"), i % 3, nf[i]); 321 + ath_dbg(common, ATH_DBG_CALIBRATE, 322 + "NF calibrated [%s] [chain %d] is %d\n", 323 + (i >= 3 ? "ext" : "ctl"), i % 3, nf[i]); 324 324 325 325 if (nf[i] > ATH9K_NF_TOO_HIGH) { 326 - ath_print(common, ATH_DBG_CALIBRATE, 327 - "NF[%d] (%d) > MAX (%d), correcting to MAX", 328 - i, nf[i], ATH9K_NF_TOO_HIGH); 326 + ath_dbg(common, ATH_DBG_CALIBRATE, 327 + "NF[%d] (%d) > MAX (%d), correcting to MAX\n", 328 + i, nf[i], ATH9K_NF_TOO_HIGH); 329 329 nf[i] = limit->max; 330 330 } else if (nf[i] < limit->min) { 331 - ath_print(common, ATH_DBG_CALIBRATE, 332 - "NF[%d] (%d) < MIN (%d), correcting to NOM", 333 - i, nf[i], limit->min); 331 + ath_dbg(common, ATH_DBG_CALIBRATE, 332 + "NF[%d] (%d) < MIN (%d), correcting to NOM\n", 333 + i, nf[i], limit->min); 334 334 nf[i] = limit->nominal; 335 335 } 336 336 } ··· 347 347 348 348 chan->channelFlags &= (~CHANNEL_CW_INT); 349 349 if (REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) { 350 - ath_print(common, ATH_DBG_CALIBRATE, 351 - "NF did not complete in calibration window\n"); 350 + ath_dbg(common, ATH_DBG_CALIBRATE, 351 + "NF did not complete in calibration window\n"); 352 352 return false; 353 353 } 354 354 ··· 357 357 nf = nfarray[0]; 358 358 if (ath9k_hw_get_nf_thresh(ah, c->band, &nfThresh) 359 359 && nf > nfThresh) { 360 - ath_print(common, ATH_DBG_CALIBRATE, 361 - "noise floor failed detected; " 362 - "detected %d, threshold %d\n", 363 - nf, nfThresh); 360 + ath_dbg(common, ATH_DBG_CALIBRATE, 361 + "noise floor failed detected; detected %d, threshold %d\n", 362 + nf, nfThresh); 364 363 chan->channelFlags |= CHANNEL_CW_INT; 365 364 } 366 365
+2 -2
drivers/net/wireless/ath/ath9k/common.c
··· 180 180 AR_STOMP_NONE_WLAN_WGHT); 181 181 break; 182 182 default: 183 - ath_print(common, ATH_DBG_BTCOEX, 184 - "Invalid Stomptype\n"); 183 + ath_dbg(common, ATH_DBG_BTCOEX, 184 + "Invalid Stomptype\n"); 185 185 break; 186 186 } 187 187
-1
drivers/net/wireless/ath/ath9k/common.h
··· 17 17 #include <net/mac80211.h> 18 18 19 19 #include "../ath.h" 20 - #include "../debug.h" 21 20 22 21 #include "hw.h" 23 22 #include "hw-ops.h"
+2 -2
drivers/net/wireless/ath/ath9k/eeprom.c
··· 273 273 regulatory->max_power_level += INCREASE_MAXPOW_BY_THREE_CHAIN; 274 274 break; 275 275 default: 276 - ath_print(common, ATH_DBG_EEPROM, 277 - "Invalid chainmask configuration\n"); 276 + ath_dbg(common, ATH_DBG_EEPROM, 277 + "Invalid chainmask configuration\n"); 278 278 break; 279 279 } 280 280 }
+34 -38
drivers/net/wireless/ath/ath9k/eeprom_4k.c
··· 37 37 eep_start_loc = 64; 38 38 39 39 if (!ath9k_hw_use_flash(ah)) { 40 - ath_print(common, ATH_DBG_EEPROM, 41 - "Reading from EEPROM, not flash\n"); 40 + ath_dbg(common, ATH_DBG_EEPROM, 41 + "Reading from EEPROM, not flash\n"); 42 42 } 43 43 44 44 for (addr = 0; addr < SIZE_EEPROM_4K; addr++) { 45 45 if (!ath9k_hw_nvram_read(common, addr + eep_start_loc, eep_data)) { 46 - ath_print(common, ATH_DBG_EEPROM, 47 - "Unable to read eeprom region\n"); 46 + ath_dbg(common, ATH_DBG_EEPROM, 47 + "Unable to read eeprom region\n"); 48 48 return false; 49 49 } 50 50 eep_data++; ··· 69 69 if (!ath9k_hw_use_flash(ah)) { 70 70 if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET, 71 71 &magic)) { 72 - ath_print(common, ATH_DBG_FATAL, 73 - "Reading Magic # failed\n"); 72 + ath_err(common, "Reading Magic # failed\n"); 74 73 return false; 75 74 } 76 75 77 - ath_print(common, ATH_DBG_EEPROM, 78 - "Read Magic = 0x%04X\n", magic); 76 + ath_dbg(common, ATH_DBG_EEPROM, 77 + "Read Magic = 0x%04X\n", magic); 79 78 80 79 if (magic != AR5416_EEPROM_MAGIC) { 81 80 magic2 = swab16(magic); ··· 89 90 eepdata++; 90 91 } 91 92 } else { 92 - ath_print(common, ATH_DBG_FATAL, 93 - "Invalid EEPROM Magic. " 94 - "endianness mismatch.\n"); 93 + ath_err(common, 94 + "Invalid EEPROM Magic. Endianness mismatch.\n"); 95 95 return -EINVAL; 96 96 } 97 97 } 98 98 } 99 99 100 - ath_print(common, ATH_DBG_EEPROM, "need_swap = %s.\n", 101 - need_swap ? "True" : "False"); 100 + ath_dbg(common, ATH_DBG_EEPROM, "need_swap = %s.\n", 101 + need_swap ? "True" : "False"); 102 102 103 103 if (need_swap) 104 104 el = swab16(ah->eeprom.map4k.baseEepHeader.length); ··· 118 120 u32 integer; 119 121 u16 word; 120 122 121 - ath_print(common, ATH_DBG_EEPROM, 122 - "EEPROM Endianness is not native.. Changing\n"); 123 + ath_dbg(common, ATH_DBG_EEPROM, 124 + "EEPROM Endianness is not native.. Changing\n"); 123 125 124 126 word = swab16(eep->baseEepHeader.length); 125 127 eep->baseEepHeader.length = word; ··· 161 163 162 164 if (sum != 0xffff || ah->eep_ops->get_eeprom_ver(ah) != AR5416_EEP_VER || 163 165 ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_NO_BACK_VER) { 164 - ath_print(common, ATH_DBG_FATAL, 165 - "Bad EEPROM checksum 0x%x or revision 0x%04x\n", 166 - sum, ah->eep_ops->get_eeprom_ver(ah)); 166 + ath_err(common, "Bad EEPROM checksum 0x%x or revision 0x%04x\n", 167 + sum, ah->eep_ops->get_eeprom_ver(ah)); 167 168 return -EINVAL; 168 169 } 169 170 ··· 485 488 ((pdadcValues[4 * j + 3] & 0xFF) << 24); 486 489 REG_WRITE(ah, regOffset, reg32); 487 490 488 - ath_print(common, ATH_DBG_EEPROM, 489 - "PDADC (%d,%4x): %4.4x %8.8x\n", 490 - i, regChainOffset, regOffset, 491 - reg32); 492 - ath_print(common, ATH_DBG_EEPROM, 493 - "PDADC: Chain %d | " 494 - "PDADC %3d Value %3d | " 495 - "PDADC %3d Value %3d | " 496 - "PDADC %3d Value %3d | " 497 - "PDADC %3d Value %3d |\n", 498 - i, 4 * j, pdadcValues[4 * j], 499 - 4 * j + 1, pdadcValues[4 * j + 1], 500 - 4 * j + 2, pdadcValues[4 * j + 2], 501 - 4 * j + 3, 502 - pdadcValues[4 * j + 3]); 491 + ath_dbg(common, ATH_DBG_EEPROM, 492 + "PDADC (%d,%4x): %4.4x %8.8x\n", 493 + i, regChainOffset, regOffset, 494 + reg32); 495 + ath_dbg(common, ATH_DBG_EEPROM, 496 + "PDADC: Chain %d | " 497 + "PDADC %3d Value %3d | " 498 + "PDADC %3d Value %3d | " 499 + "PDADC %3d Value %3d | " 500 + "PDADC %3d Value %3d |\n", 501 + i, 4 * j, pdadcValues[4 * j], 502 + 4 * j + 1, pdadcValues[4 * j + 1], 503 + 4 * j + 2, pdadcValues[4 * j + 2], 504 + 4 * j + 3, pdadcValues[4 * j + 3]); 503 505 504 506 regOffset += 4; 505 507 } ··· 1177 1181 1178 1182 u16 spur_val = AR_NO_SPUR; 1179 1183 1180 - ath_print(common, ATH_DBG_ANI, 1181 - "Getting spur idx %d is2Ghz. %d val %x\n", 1182 - i, is2GHz, ah->config.spurchans[i][is2GHz]); 1184 + ath_dbg(common, ATH_DBG_ANI, 1185 + "Getting spur idx:%d is2Ghz:%d val:%x\n", 1186 + i, is2GHz, ah->config.spurchans[i][is2GHz]); 1183 1187 1184 1188 switch (ah->config.spurmode) { 1185 1189 case SPUR_DISABLE: 1186 1190 break; 1187 1191 case SPUR_ENABLE_IOCTL: 1188 1192 spur_val = ah->config.spurchans[i][is2GHz]; 1189 - ath_print(common, ATH_DBG_ANI, 1190 - "Getting spur val from new loc. %d\n", spur_val); 1193 + ath_dbg(common, ATH_DBG_ANI, 1194 + "Getting spur val from new loc. %d\n", spur_val); 1191 1195 break; 1192 1196 case SPUR_ENABLE_EEPROM: 1193 1197 spur_val = EEP_MAP4K_SPURCHAN;
+21 -24
drivers/net/wireless/ath/ath9k/eeprom_9287.c
··· 37 37 int addr, eep_start_loc; 38 38 eep_data = (u16 *)eep; 39 39 40 - if (!common->driver_info) 41 - eep_start_loc = AR9287_EEP_START_LOC; 42 - else 40 + if (common->bus_ops->ath_bus_type == ATH_USB) 43 41 eep_start_loc = AR9287_HTC_EEP_START_LOC; 42 + else 43 + eep_start_loc = AR9287_EEP_START_LOC; 44 44 45 45 if (!ath9k_hw_use_flash(ah)) { 46 - ath_print(common, ATH_DBG_EEPROM, 47 - "Reading from EEPROM, not flash\n"); 46 + ath_dbg(common, ATH_DBG_EEPROM, 47 + "Reading from EEPROM, not flash\n"); 48 48 } 49 49 50 50 for (addr = 0; addr < NUM_EEP_WORDS; addr++) { 51 51 if (!ath9k_hw_nvram_read(common, addr + eep_start_loc, 52 52 eep_data)) { 53 - ath_print(common, ATH_DBG_EEPROM, 54 - "Unable to read eeprom region\n"); 53 + ath_dbg(common, ATH_DBG_EEPROM, 54 + "Unable to read eeprom region\n"); 55 55 return false; 56 56 } 57 57 eep_data++; ··· 72 72 if (!ath9k_hw_use_flash(ah)) { 73 73 if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET, 74 74 &magic)) { 75 - ath_print(common, ATH_DBG_FATAL, 76 - "Reading Magic # failed\n"); 75 + ath_err(common, "Reading Magic # failed\n"); 77 76 return false; 78 77 } 79 78 80 - ath_print(common, ATH_DBG_EEPROM, 81 - "Read Magic = 0x%04X\n", magic); 79 + ath_dbg(common, ATH_DBG_EEPROM, 80 + "Read Magic = 0x%04X\n", magic); 82 81 83 82 if (magic != AR5416_EEPROM_MAGIC) { 84 83 magic2 = swab16(magic); ··· 92 93 eepdata++; 93 94 } 94 95 } else { 95 - ath_print(common, ATH_DBG_FATAL, 96 - "Invalid EEPROM Magic. " 97 - "Endianness mismatch.\n"); 96 + ath_err(common, 97 + "Invalid EEPROM Magic. Endianness mismatch.\n"); 98 98 return -EINVAL; 99 99 } 100 100 } 101 101 } 102 102 103 - ath_print(common, ATH_DBG_EEPROM, "need_swap = %s.\n", 104 - need_swap ? "True" : "False"); 103 + ath_dbg(common, ATH_DBG_EEPROM, "need_swap = %s.\n", 104 + need_swap ? "True" : "False"); 105 105 106 106 if (need_swap) 107 107 el = swab16(ah->eeprom.map9287.baseEepHeader.length); ··· 158 160 159 161 if (sum != 0xffff || ah->eep_ops->get_eeprom_ver(ah) != AR9287_EEP_VER 160 162 || ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_NO_BACK_VER) { 161 - ath_print(common, ATH_DBG_FATAL, 162 - "Bad EEPROM checksum 0x%x or revision 0x%04x\n", 163 - sum, ah->eep_ops->get_eeprom_ver(ah)); 163 + ath_err(common, "Bad EEPROM checksum 0x%x or revision 0x%04x\n", 164 + sum, ah->eep_ops->get_eeprom_ver(ah)); 164 165 return -EINVAL; 165 166 } 166 167 ··· 1149 1152 struct ath_common *common = ath9k_hw_common(ah); 1150 1153 u16 spur_val = AR_NO_SPUR; 1151 1154 1152 - ath_print(common, ATH_DBG_ANI, 1153 - "Getting spur idx %d is2Ghz. %d val %x\n", 1154 - i, is2GHz, ah->config.spurchans[i][is2GHz]); 1155 + ath_dbg(common, ATH_DBG_ANI, 1156 + "Getting spur idx:%d is2Ghz:%d val:%x\n", 1157 + i, is2GHz, ah->config.spurchans[i][is2GHz]); 1155 1158 1156 1159 switch (ah->config.spurmode) { 1157 1160 case SPUR_DISABLE: 1158 1161 break; 1159 1162 case SPUR_ENABLE_IOCTL: 1160 1163 spur_val = ah->config.spurchans[i][is2GHz]; 1161 - ath_print(common, ATH_DBG_ANI, 1162 - "Getting spur val from new loc. %d\n", spur_val); 1164 + ath_dbg(common, ATH_DBG_ANI, 1165 + "Getting spur val from new loc. %d\n", spur_val); 1163 1166 break; 1164 1167 case SPUR_ENABLE_EEPROM: 1165 1168 spur_val = EEP_MAP9287_SPURCHAN;
+40 -39
drivers/net/wireless/ath/ath9k/eeprom_def.c
··· 96 96 for (addr = 0; addr < SIZE_EEPROM_DEF; addr++) { 97 97 if (!ath9k_hw_nvram_read(common, addr + ar5416_eep_start_loc, 98 98 eep_data)) { 99 - ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, 100 - "Unable to read eeprom region\n"); 99 + ath_err(ath9k_hw_common(ah), 100 + "Unable to read eeprom region\n"); 101 101 return false; 102 102 } 103 103 eep_data++; ··· 117 117 int i, addr, size; 118 118 119 119 if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET, &magic)) { 120 - ath_print(common, ATH_DBG_FATAL, "Reading Magic # failed\n"); 120 + ath_err(common, "Reading Magic # failed\n"); 121 121 return false; 122 122 } 123 123 124 124 if (!ath9k_hw_use_flash(ah)) { 125 - ath_print(common, ATH_DBG_EEPROM, 126 - "Read Magic = 0x%04X\n", magic); 125 + ath_dbg(common, ATH_DBG_EEPROM, 126 + "Read Magic = 0x%04X\n", magic); 127 127 128 128 if (magic != AR5416_EEPROM_MAGIC) { 129 129 magic2 = swab16(magic); ··· 139 139 eepdata++; 140 140 } 141 141 } else { 142 - ath_print(common, ATH_DBG_FATAL, 143 - "Invalid EEPROM Magic. " 144 - "Endianness mismatch.\n"); 142 + ath_err(common, 143 + "Invalid EEPROM Magic. Endianness mismatch.\n"); 145 144 return -EINVAL; 146 145 } 147 146 } 148 147 } 149 148 150 - ath_print(common, ATH_DBG_EEPROM, "need_swap = %s.\n", 151 - need_swap ? "True" : "False"); 149 + ath_dbg(common, ATH_DBG_EEPROM, "need_swap = %s.\n", 150 + need_swap ? "True" : "False"); 152 151 153 152 if (need_swap) 154 153 el = swab16(ah->eeprom.def.baseEepHeader.length); ··· 168 169 u32 integer, j; 169 170 u16 word; 170 171 171 - ath_print(common, ATH_DBG_EEPROM, 172 - "EEPROM Endianness is not native.. Changing.\n"); 172 + ath_dbg(common, ATH_DBG_EEPROM, 173 + "EEPROM Endianness is not native.. Changing.\n"); 173 174 174 175 word = swab16(eep->baseEepHeader.length); 175 176 eep->baseEepHeader.length = word; ··· 215 216 216 217 if (sum != 0xffff || ah->eep_ops->get_eeprom_ver(ah) != AR5416_EEP_VER || 217 218 ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_NO_BACK_VER) { 218 - ath_print(common, ATH_DBG_FATAL, 219 - "Bad EEPROM checksum 0x%x or revision 0x%04x\n", 219 + ath_err(common, "Bad EEPROM checksum 0x%x or revision 0x%04x\n", 220 220 sum, ah->eep_ops->get_eeprom_ver(ah)); 221 221 return -EINVAL; 222 222 } ··· 964 966 ((pdadcValues[4 * j + 3] & 0xFF) << 24); 965 967 REG_WRITE(ah, regOffset, reg32); 966 968 967 - ath_print(common, ATH_DBG_EEPROM, 968 - "PDADC (%d,%4x): %4.4x %8.8x\n", 969 - i, regChainOffset, regOffset, 970 - reg32); 971 - ath_print(common, ATH_DBG_EEPROM, 972 - "PDADC: Chain %d | PDADC %3d " 973 - "Value %3d | PDADC %3d Value %3d | " 974 - "PDADC %3d Value %3d | PDADC %3d " 975 - "Value %3d |\n", 976 - i, 4 * j, pdadcValues[4 * j], 977 - 4 * j + 1, pdadcValues[4 * j + 1], 978 - 4 * j + 2, pdadcValues[4 * j + 2], 979 - 4 * j + 3, 980 - pdadcValues[4 * j + 3]); 969 + ath_dbg(common, ATH_DBG_EEPROM, 970 + "PDADC (%d,%4x): %4.4x %8.8x\n", 971 + i, regChainOffset, regOffset, 972 + reg32); 973 + ath_dbg(common, ATH_DBG_EEPROM, 974 + "PDADC: Chain %d | PDADC %3d " 975 + "Value %3d | PDADC %3d Value %3d | " 976 + "PDADC %3d Value %3d | PDADC %3d " 977 + "Value %3d |\n", 978 + i, 4 * j, pdadcValues[4 * j], 979 + 4 * j + 1, pdadcValues[4 * j + 1], 980 + 4 * j + 2, pdadcValues[4 * j + 2], 981 + 4 * j + 3, pdadcValues[4 * j + 3]); 981 982 982 983 regOffset += 4; 983 984 } ··· 1063 1066 case 1: 1064 1067 break; 1065 1068 case 2: 1066 - scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN; 1069 + if (scaledPower > REDUCE_SCALED_POWER_BY_TWO_CHAIN) 1070 + scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN; 1071 + else 1072 + scaledPower = 0; 1067 1073 break; 1068 1074 case 3: 1069 - scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN; 1075 + if (scaledPower > REDUCE_SCALED_POWER_BY_THREE_CHAIN) 1076 + scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN; 1077 + else 1078 + scaledPower = 0; 1070 1079 break; 1071 1080 } 1072 - 1073 - scaledPower = max((u16)0, scaledPower); 1074 1081 1075 1082 if (IS_CHAN_2GHZ(chan)) { 1076 1083 numCtlModes = ARRAY_SIZE(ctlModesFor11g) - ··· 1320 1319 regulatory->max_power_level += INCREASE_MAXPOW_BY_THREE_CHAIN; 1321 1320 break; 1322 1321 default: 1323 - ath_print(ath9k_hw_common(ah), ATH_DBG_EEPROM, 1324 - "Invalid chainmask configuration\n"); 1322 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_EEPROM, 1323 + "Invalid chainmask configuration\n"); 1325 1324 break; 1326 1325 } 1327 1326 ··· 1462 1461 1463 1462 u16 spur_val = AR_NO_SPUR; 1464 1463 1465 - ath_print(common, ATH_DBG_ANI, 1466 - "Getting spur idx %d is2Ghz. %d val %x\n", 1467 - i, is2GHz, ah->config.spurchans[i][is2GHz]); 1464 + ath_dbg(common, ATH_DBG_ANI, 1465 + "Getting spur idx:%d is2Ghz:%d val:%x\n", 1466 + i, is2GHz, ah->config.spurchans[i][is2GHz]); 1468 1467 1469 1468 switch (ah->config.spurmode) { 1470 1469 case SPUR_DISABLE: 1471 1470 break; 1472 1471 case SPUR_ENABLE_IOCTL: 1473 1472 spur_val = ah->config.spurchans[i][is2GHz]; 1474 - ath_print(common, ATH_DBG_ANI, 1475 - "Getting spur val from new loc. %d\n", spur_val); 1473 + ath_dbg(common, ATH_DBG_ANI, 1474 + "Getting spur val from new loc. %d\n", spur_val); 1476 1475 break; 1477 1476 case SPUR_ENABLE_EEPROM: 1478 1477 spur_val = EEP_DEF_SPURCHAN;
+10 -10
drivers/net/wireless/ath/ath9k/gpio.c
··· 103 103 104 104 ret = led_classdev_register(wiphy_dev(sc->hw->wiphy), &led->led_cdev); 105 105 if (ret) 106 - ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, 107 - "Failed to register led:%s", led->name); 106 + ath_err(ath9k_hw_common(sc->sc_ah), 107 + "Failed to register led:%s", led->name); 108 108 else 109 109 led->registered = 1; 110 110 return ret; ··· 236 236 sc->sc_flags &= ~(SC_OP_BT_PRIORITY_DETECTED | SC_OP_BT_SCAN); 237 237 /* Detect if colocated bt started scanning */ 238 238 if (btcoex->bt_priority_cnt >= ATH_BT_CNT_SCAN_THRESHOLD) { 239 - ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_BTCOEX, 240 - "BT scan detected"); 239 + ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_BTCOEX, 240 + "BT scan detected\n"); 241 241 sc->sc_flags |= (SC_OP_BT_SCAN | 242 242 SC_OP_BT_PRIORITY_DETECTED); 243 243 } else if (btcoex->bt_priority_cnt >= ATH_BT_CNT_THRESHOLD) { 244 - ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_BTCOEX, 245 - "BT priority traffic detected"); 244 + ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_BTCOEX, 245 + "BT priority traffic detected\n"); 246 246 sc->sc_flags |= SC_OP_BT_PRIORITY_DETECTED; 247 247 } 248 248 ··· 331 331 struct ath_common *common = ath9k_hw_common(ah); 332 332 bool is_btscan = sc->sc_flags & SC_OP_BT_SCAN; 333 333 334 - ath_print(common, ATH_DBG_BTCOEX, 335 - "no stomp timer running\n"); 334 + ath_dbg(common, ATH_DBG_BTCOEX, 335 + "no stomp timer running\n"); 336 336 337 337 spin_lock_bh(&btcoex->btcoex_lock); 338 338 ··· 378 378 struct ath_btcoex *btcoex = &sc->btcoex; 379 379 struct ath_hw *ah = sc->sc_ah; 380 380 381 - ath_print(ath9k_hw_common(ah), ATH_DBG_BTCOEX, 382 - "Starting btcoex timers"); 381 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_BTCOEX, 382 + "Starting btcoex timers\n"); 383 383 384 384 /* make sure duty cycle timer is also stopped when resuming */ 385 385 if (btcoex->hw_timer_enabled)
+24 -19
drivers/net/wireless/ath/ath9k/hif_usb.c
··· 28 28 static struct usb_device_id ath9k_hif_usb_ids[] = { 29 29 { USB_DEVICE(0x0cf3, 0x9271) }, /* Atheros */ 30 30 { USB_DEVICE(0x0cf3, 0x1006) }, /* Atheros */ 31 - { USB_DEVICE(0x0cf3, 0x7010), 32 - .driver_info = AR7010_DEVICE }, 33 - /* Atheros */ 34 - { USB_DEVICE(0x0cf3, 0x7015), 35 - .driver_info = AR7010_DEVICE | AR9287_DEVICE }, 36 - /* Atheros */ 37 31 { USB_DEVICE(0x0846, 0x9030) }, /* Netgear N150 */ 38 - { USB_DEVICE(0x0846, 0x9018), 39 - .driver_info = AR7010_DEVICE }, 40 - /* Netgear WNDA3200 */ 41 32 { USB_DEVICE(0x07D1, 0x3A10) }, /* Dlink Wireless 150 */ 42 33 { USB_DEVICE(0x13D3, 0x3327) }, /* Azurewave */ 43 34 { USB_DEVICE(0x13D3, 0x3328) }, /* Azurewave */ ··· 37 46 { USB_DEVICE(0x13D3, 0x3349) }, /* Azurewave */ 38 47 { USB_DEVICE(0x13D3, 0x3350) }, /* Azurewave */ 39 48 { USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */ 40 - { USB_DEVICE(0x083A, 0xA704), 41 - .driver_info = AR7010_DEVICE }, 42 - /* SMC Networks */ 43 49 { USB_DEVICE(0x040D, 0x3801) }, /* VIA */ 50 + 51 + { USB_DEVICE(0x0cf3, 0x7015), 52 + .driver_info = AR9287_USB }, /* Atheros */ 44 53 { USB_DEVICE(0x1668, 0x1200), 45 - .driver_info = AR7010_DEVICE | AR9287_DEVICE }, 46 - /* Verizon */ 54 + .driver_info = AR9287_USB }, /* Verizon */ 55 + 56 + { USB_DEVICE(0x0cf3, 0x7010), 57 + .driver_info = AR9280_USB }, /* Atheros */ 58 + { USB_DEVICE(0x0846, 0x9018), 59 + .driver_info = AR9280_USB }, /* Netgear WNDA3200 */ 60 + { USB_DEVICE(0x083A, 0xA704), 61 + .driver_info = AR9280_USB }, /* SMC Networks */ 62 + 47 63 { }, 48 64 }; 49 65 ··· 816 818 } 817 819 kfree(buf); 818 820 819 - if (drv_info & AR7010_DEVICE) 821 + if (IS_AR7010_DEVICE(drv_info)) 820 822 firm_offset = AR7010_FIRMWARE_TEXT; 821 823 else 822 824 firm_offset = AR9271_FIRMWARE_TEXT; ··· 885 887 886 888 return 0; 887 889 888 - err_fw_download: 889 - ath9k_hif_usb_dealloc_urbs(hif_dev); 890 890 err_urb: 891 + ath9k_hif_usb_dealloc_urbs(hif_dev); 892 + err_fw_download: 891 893 release_firmware(hif_dev->firmware); 892 894 err_fw_req: 893 895 hif_dev->firmware = NULL; ··· 932 934 933 935 /* Find out which firmware to load */ 934 936 935 - if (id->driver_info & AR7010_DEVICE) 937 + if (IS_AR7010_DEVICE(id->driver_info)) 936 938 if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x0202) 937 939 hif_dev->fw_name = FIRMWARE_AR7010_1_1; 938 940 else ··· 1015 1017 { 1016 1018 struct hif_device_usb *hif_dev = usb_get_intfdata(interface); 1017 1019 1020 + /* 1021 + * The device has to be set to FULLSLEEP mode in case no 1022 + * interface is up. 1023 + */ 1024 + if (!(hif_dev->flags & HIF_USB_START)) 1025 + ath9k_htc_suspend(hif_dev->htc_handle); 1026 + 1018 1027 ath9k_hif_usb_dealloc_urbs(hif_dev); 1019 1028 1020 1029 return 0; ··· 1039 1034 1040 1035 if (hif_dev->firmware) { 1041 1036 ret = ath9k_hif_usb_download_fw(hif_dev, 1042 - htc_handle->drv_priv->ah->common.driver_info); 1037 + htc_handle->drv_priv->ah->hw_version.usbdev); 1043 1038 if (ret) 1044 1039 goto fail_resume; 1045 1040 } else {
+2
drivers/net/wireless/ath/ath9k/hif_usb.h
··· 17 17 #ifndef HTC_USB_H 18 18 #define HTC_USB_H 19 19 20 + #define IS_AR7010_DEVICE(_v) (((_v) == AR9280_USB) || ((_v) == AR9287_USB)) 21 + 20 22 #define AR9271_FIRMWARE 0x501000 21 23 #define AR9271_FIRMWARE_TEXT 0x903000 22 24 #define AR7010_FIRMWARE_TEXT 0x906000
+3
drivers/net/wireless/ath/ath9k/htc.h
··· 455 455 void ath9k_htc_ps_wakeup(struct ath9k_htc_priv *priv); 456 456 void ath9k_htc_ps_restore(struct ath9k_htc_priv *priv); 457 457 void ath9k_ps_work(struct work_struct *work); 458 + bool ath9k_htc_setpower(struct ath9k_htc_priv *priv, 459 + enum ath9k_power_mode mode); 458 460 459 461 void ath9k_start_rfkill_poll(struct ath9k_htc_priv *priv); 460 462 void ath9k_init_leds(struct ath9k_htc_priv *priv); ··· 466 464 u16 devid, char *product, u32 drv_info); 467 465 void ath9k_htc_disconnect_device(struct htc_target *htc_handle, bool hotunplug); 468 466 #ifdef CONFIG_PM 467 + void ath9k_htc_suspend(struct htc_target *htc_handle); 469 468 int ath9k_htc_resume(struct htc_target *htc_handle); 470 469 #endif 471 470 #ifdef CONFIG_ATH9K_HTC_DEBUGFS
+12 -12
drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
··· 123 123 /* TSF out of range threshold fixed at 1 second */ 124 124 bs.bs_tsfoor_threshold = ATH9K_TSFOOR_THRESHOLD; 125 125 126 - ath_print(common, ATH_DBG_BEACON, "tsf: %llu tsftu: %u\n", tsf, tsftu); 127 - ath_print(common, ATH_DBG_BEACON, 128 - "bmiss: %u sleep: %u cfp-period: %u maxdur: %u next: %u\n", 129 - bs.bs_bmissthreshold, bs.bs_sleepduration, 130 - bs.bs_cfpperiod, bs.bs_cfpmaxduration, bs.bs_cfpnext); 126 + ath_dbg(common, ATH_DBG_BEACON, "tsf: %llu tsftu: %u\n", tsf, tsftu); 127 + ath_dbg(common, ATH_DBG_BEACON, 128 + "bmiss: %u sleep: %u cfp-period: %u maxdur: %u next: %u\n", 129 + bs.bs_bmissthreshold, bs.bs_sleepduration, 130 + bs.bs_cfpperiod, bs.bs_cfpmaxduration, bs.bs_cfpnext); 131 131 132 132 /* Set the computed STA beacon timers */ 133 133 ··· 154 154 if (priv->op_flags & OP_ENABLE_BEACON) 155 155 imask |= ATH9K_INT_SWBA; 156 156 157 - ath_print(common, ATH_DBG_BEACON, 158 - "IBSS Beacon config, intval: %d, imask: 0x%x\n", 159 - bss_conf->beacon_interval, imask); 157 + ath_dbg(common, ATH_DBG_BEACON, 158 + "IBSS Beacon config, intval: %d, imask: 0x%x\n", 159 + bss_conf->beacon_interval, imask); 160 160 161 161 WMI_CMD(WMI_DISABLE_INTR_CMDID); 162 162 ath9k_hw_beaconinit(priv->ah, nexttbtt, intval); ··· 246 246 qi.tqi_cwmax = qi_be.tqi_cwmax; 247 247 248 248 if (!ath9k_hw_set_txq_props(ah, priv->beaconq, &qi)) { 249 - ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, 250 - "Unable to update beacon queue %u!\n", qnum); 249 + ath_err(ath9k_hw_common(ah), 250 + "Unable to update beacon queue %u!\n", qnum); 251 251 } else { 252 252 ath9k_hw_resettxqueue(ah, priv->beaconq); 253 253 } ··· 278 278 ath9k_htc_beacon_config_adhoc(priv, cur_conf); 279 279 break; 280 280 default: 281 - ath_print(common, ATH_DBG_CONFIG, 282 - "Unsupported beaconing mode\n"); 281 + ath_dbg(common, ATH_DBG_CONFIG, 282 + "Unsupported beaconing mode\n"); 283 283 return; 284 284 } 285 285 }
+7 -8
drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
··· 20 20 priv->op_flags &= ~(OP_BT_PRIORITY_DETECTED | OP_BT_SCAN); 21 21 /* Detect if colocated bt started scanning */ 22 22 if (btcoex->bt_priority_cnt >= ATH_BT_CNT_SCAN_THRESHOLD) { 23 - ath_print(ath9k_hw_common(ah), ATH_DBG_BTCOEX, 24 - "BT scan detected"); 23 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_BTCOEX, 24 + "BT scan detected\n"); 25 25 priv->op_flags |= (OP_BT_SCAN | 26 26 OP_BT_PRIORITY_DETECTED); 27 27 } else if (btcoex->bt_priority_cnt >= ATH_BT_CNT_THRESHOLD) { 28 - ath_print(ath9k_hw_common(ah), ATH_DBG_BTCOEX, 29 - "BT priority traffic detected"); 28 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_BTCOEX, 29 + "BT priority traffic detected\n"); 30 30 priv->op_flags |= OP_BT_PRIORITY_DETECTED; 31 31 } 32 32 ··· 83 83 struct ath_common *common = ath9k_hw_common(ah); 84 84 bool is_btscan = priv->op_flags & OP_BT_SCAN; 85 85 86 - ath_print(common, ATH_DBG_BTCOEX, 87 - "time slice work for bt and wlan\n"); 86 + ath_dbg(common, ATH_DBG_BTCOEX, 87 + "time slice work for bt and wlan\n"); 88 88 89 89 if (btcoex->bt_stomp_type == ATH_BTCOEX_STOMP_LOW || is_btscan) 90 90 ath9k_cmn_btcoex_bt_stomp(common, ATH_BTCOEX_STOMP_NONE); ··· 114 114 struct ath_btcoex *btcoex = &priv->btcoex; 115 115 struct ath_hw *ah = priv->ah; 116 116 117 - ath_print(ath9k_hw_common(ah), ATH_DBG_BTCOEX, 118 - "Starting btcoex work"); 117 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_BTCOEX, "Starting btcoex work\n"); 119 118 120 119 btcoex->bt_priority_cnt = 0; 121 120 btcoex->bt_priority_time = jiffies;
+39 -39
drivers/net/wireless/ath/ath9k/htc_drv_init.c
··· 246 246 * the HIF layer, shouldn't matter much. 247 247 */ 248 248 249 - if (drv_info & AR7010_DEVICE) 249 + if (IS_AR7010_DEVICE(drv_info)) 250 250 priv->htc->credits = 45; 251 251 else 252 252 priv->htc->credits = 33; ··· 288 288 (u8 *) &val, sizeof(val), 289 289 100); 290 290 if (unlikely(r)) { 291 - ath_print(common, ATH_DBG_WMI, 292 - "REGISTER READ FAILED: (0x%04x, %d)\n", 293 - reg_offset, r); 291 + ath_dbg(common, ATH_DBG_WMI, 292 + "REGISTER READ FAILED: (0x%04x, %d)\n", 293 + reg_offset, r); 294 294 return -EIO; 295 295 } 296 296 ··· 313 313 (u8 *) &val, sizeof(val), 314 314 100); 315 315 if (unlikely(r)) { 316 - ath_print(common, ATH_DBG_WMI, 317 - "REGISTER WRITE FAILED:(0x%04x, %d)\n", 318 - reg_offset, r); 316 + ath_dbg(common, ATH_DBG_WMI, 317 + "REGISTER WRITE FAILED:(0x%04x, %d)\n", 318 + reg_offset, r); 319 319 } 320 320 } 321 321 ··· 345 345 (u8 *) &rsp_status, sizeof(rsp_status), 346 346 100); 347 347 if (unlikely(r)) { 348 - ath_print(common, ATH_DBG_WMI, 349 - "REGISTER WRITE FAILED, multi len: %d\n", 350 - priv->wmi->multi_write_idx); 348 + ath_dbg(common, ATH_DBG_WMI, 349 + "REGISTER WRITE FAILED, multi len: %d\n", 350 + priv->wmi->multi_write_idx); 351 351 } 352 352 priv->wmi->multi_write_idx = 0; 353 353 } ··· 395 395 (u8 *) &rsp_status, sizeof(rsp_status), 396 396 100); 397 397 if (unlikely(r)) { 398 - ath_print(common, ATH_DBG_WMI, 399 - "REGISTER WRITE FAILED, multi len: %d\n", 400 - priv->wmi->multi_write_idx); 398 + ath_dbg(common, ATH_DBG_WMI, 399 + "REGISTER WRITE FAILED, multi len: %d\n", 400 + priv->wmi->multi_write_idx); 401 401 } 402 402 priv->wmi->multi_write_idx = 0; 403 403 } ··· 469 469 tx_streams = ath9k_cmn_count_streams(common->tx_chainmask, 2); 470 470 rx_streams = ath9k_cmn_count_streams(common->rx_chainmask, 2); 471 471 472 - ath_print(common, ATH_DBG_CONFIG, 473 - "TX streams %d, RX streams: %d\n", 474 - tx_streams, rx_streams); 472 + ath_dbg(common, ATH_DBG_CONFIG, 473 + "TX streams %d, RX streams: %d\n", 474 + tx_streams, rx_streams); 475 475 476 476 if (tx_streams != rx_streams) { 477 477 ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_RX_DIFF; ··· 495 495 496 496 priv->beaconq = ath9k_hw_beaconq_setup(priv->ah); 497 497 if (priv->beaconq == -1) { 498 - ath_print(common, ATH_DBG_FATAL, 499 - "Unable to setup BEACON xmit queue\n"); 498 + ath_err(common, "Unable to setup BEACON xmit queue\n"); 500 499 goto err; 501 500 } 502 501 503 502 priv->cabq = ath9k_htc_cabq_setup(priv); 504 503 if (priv->cabq == -1) { 505 - ath_print(common, ATH_DBG_FATAL, 506 - "Unable to setup CAB xmit queue\n"); 504 + ath_err(common, "Unable to setup CAB xmit queue\n"); 507 505 goto err; 508 506 } 509 507 510 508 if (!ath9k_htc_txq_setup(priv, WME_AC_BE)) { 511 - ath_print(common, ATH_DBG_FATAL, 512 - "Unable to setup xmit queue for BE traffic\n"); 509 + ath_err(common, "Unable to setup xmit queue for BE traffic\n"); 513 510 goto err; 514 511 } 515 512 516 513 if (!ath9k_htc_txq_setup(priv, WME_AC_BK)) { 517 - ath_print(common, ATH_DBG_FATAL, 518 - "Unable to setup xmit queue for BK traffic\n"); 514 + ath_err(common, "Unable to setup xmit queue for BK traffic\n"); 519 515 goto err; 520 516 } 521 517 if (!ath9k_htc_txq_setup(priv, WME_AC_VI)) { 522 - ath_print(common, ATH_DBG_FATAL, 523 - "Unable to setup xmit queue for VI traffic\n"); 518 + ath_err(common, "Unable to setup xmit queue for VI traffic\n"); 524 519 goto err; 525 520 } 526 521 if (!ath9k_htc_txq_setup(priv, WME_AC_VO)) { 527 - ath_print(common, ATH_DBG_FATAL, 528 - "Unable to setup xmit queue for VO traffic\n"); 522 + ath_err(common, "Unable to setup xmit queue for VO traffic\n"); 529 523 goto err; 530 524 } 531 525 ··· 537 543 /* Get the hardware key cache size. */ 538 544 common->keymax = priv->ah->caps.keycache_size; 539 545 if (common->keymax > ATH_KEYMAX) { 540 - ath_print(common, ATH_DBG_ANY, 541 - "Warning, using only %u entries in %u key cache\n", 542 - ATH_KEYMAX, common->keymax); 546 + ath_dbg(common, ATH_DBG_ANY, 547 + "Warning, using only %u entries in %u key cache\n", 548 + ATH_KEYMAX, common->keymax); 543 549 common->keymax = ATH_KEYMAX; 544 550 } 545 551 ··· 630 636 631 637 ah->hw_version.devid = devid; 632 638 ah->hw_version.subsysid = 0; /* FIXME */ 639 + ah->hw_version.usbdev = drv_info; 633 640 ah->ah_flags |= AH_USE_EEPROM; 634 641 priv->ah = ah; 635 642 ··· 641 646 common->hw = priv->hw; 642 647 common->priv = priv; 643 648 common->debug_mask = ath9k_debug; 644 - common->driver_info = drv_info; 645 649 646 650 spin_lock_init(&priv->wmi->wmi_lock); 647 651 spin_lock_init(&priv->beacon_lock); ··· 664 670 665 671 ret = ath9k_hw_init(ah); 666 672 if (ret) { 667 - ath_print(common, ATH_DBG_FATAL, 668 - "Unable to initialize hardware; " 669 - "initialization status: %d\n", ret); 673 + ath_err(common, 674 + "Unable to initialize hardware; initialization status: %d\n", 675 + ret); 670 676 goto err_hw; 671 677 } 672 678 673 679 ret = ath9k_htc_init_debug(ah); 674 680 if (ret) { 675 - ath_print(common, ATH_DBG_FATAL, 676 - "Unable to create debugfs files\n"); 681 + ath_err(common, "Unable to create debugfs files\n"); 677 682 goto err_debug; 678 683 } 679 684 ··· 714 721 IEEE80211_HW_HAS_RATE_CONTROL | 715 722 IEEE80211_HW_RX_INCLUDES_FCS | 716 723 IEEE80211_HW_SUPPORTS_PS | 717 - IEEE80211_HW_PS_NULLFUNC_STACK; 724 + IEEE80211_HW_PS_NULLFUNC_STACK | 725 + IEEE80211_HW_NEED_DTIM_PERIOD; 718 726 719 727 hw->wiphy->interface_modes = 720 728 BIT(NL80211_IFTYPE_STATION) | ··· 882 888 } 883 889 884 890 #ifdef CONFIG_PM 891 + 892 + void ath9k_htc_suspend(struct htc_target *htc_handle) 893 + { 894 + ath9k_htc_setpower(htc_handle->drv_priv, ATH9K_PM_FULL_SLEEP); 895 + } 896 + 885 897 int ath9k_htc_resume(struct htc_target *htc_handle) 886 898 { 887 899 struct ath9k_htc_priv *priv = htc_handle->drv_priv; ··· 898 898 return ret; 899 899 900 900 ret = ath9k_init_htc_services(priv, priv->ah->hw_version.devid, 901 - priv->ah->common.driver_info); 901 + priv->ah->hw_version.usbdev); 902 902 return ret; 903 903 } 904 904 #endif
+102 -100
drivers/net/wireless/ath/ath9k/htc_drv_main.c
··· 63 63 return mode; 64 64 } 65 65 66 - static bool ath9k_htc_setpower(struct ath9k_htc_priv *priv, 67 - enum ath9k_power_mode mode) 66 + bool ath9k_htc_setpower(struct ath9k_htc_priv *priv, 67 + enum ath9k_power_mode mode) 68 68 { 69 69 bool ret; 70 70 ··· 143 143 WMI_CMD(WMI_DRAIN_TXQ_ALL_CMDID); 144 144 WMI_CMD(WMI_STOP_RECV_CMDID); 145 145 146 - ath_print(common, ATH_DBG_CONFIG, 147 - "(%u MHz) -> (%u MHz), HT: %d, HT40: %d fastcc: %d\n", 148 - priv->ah->curchan->channel, 149 - channel->center_freq, conf_is_ht(conf), conf_is_ht40(conf), 150 - fastcc); 146 + ath_dbg(common, ATH_DBG_CONFIG, 147 + "(%u MHz) -> (%u MHz), HT: %d, HT40: %d fastcc: %d\n", 148 + priv->ah->curchan->channel, 149 + channel->center_freq, conf_is_ht(conf), conf_is_ht40(conf), 150 + fastcc); 151 151 152 152 caldata = &priv->caldata[channel->hw_value]; 153 153 ret = ath9k_hw_reset(ah, hchan, caldata, fastcc); 154 154 if (ret) { 155 - ath_print(common, ATH_DBG_FATAL, 156 - "Unable to reset channel (%u Mhz) " 157 - "reset status %d\n", channel->center_freq, ret); 155 + ath_err(common, 156 + "Unable to reset channel (%u Mhz) reset status %d\n", 157 + channel->center_freq, ret); 158 158 goto err; 159 159 } 160 160 ··· 263 263 WMI_CMD_BUF(WMI_NODE_CREATE_CMDID, &tsta); 264 264 if (ret) { 265 265 if (sta) 266 - ath_print(common, ATH_DBG_FATAL, 267 - "Unable to add station entry for: %pM\n", sta->addr); 266 + ath_err(common, 267 + "Unable to add station entry for: %pM\n", 268 + sta->addr); 268 269 return ret; 269 270 } 270 271 271 272 if (sta) 272 - ath_print(common, ATH_DBG_CONFIG, 273 - "Added a station entry for: %pM (idx: %d)\n", 274 - sta->addr, tsta.sta_index); 273 + ath_dbg(common, ATH_DBG_CONFIG, 274 + "Added a station entry for: %pM (idx: %d)\n", 275 + sta->addr, tsta.sta_index); 275 276 276 277 priv->nstations++; 277 278 return 0; ··· 297 296 WMI_CMD_BUF(WMI_NODE_REMOVE_CMDID, &sta_idx); 298 297 if (ret) { 299 298 if (sta) 300 - ath_print(common, ATH_DBG_FATAL, 301 - "Unable to remove station entry for: %pM\n", 302 - sta->addr); 299 + ath_err(common, 300 + "Unable to remove station entry for: %pM\n", 301 + sta->addr); 303 302 return ret; 304 303 } 305 304 306 305 if (sta) 307 - ath_print(common, ATH_DBG_CONFIG, 308 - "Removed a station entry for: %pM (idx: %d)\n", 309 - sta->addr, sta_idx); 306 + ath_dbg(common, ATH_DBG_CONFIG, 307 + "Removed a station entry for: %pM (idx: %d)\n", 308 + sta->addr, sta_idx); 310 309 311 310 priv->nstations--; 312 311 return 0; ··· 391 390 392 391 WMI_CMD_BUF(WMI_RC_RATE_UPDATE_CMDID, trate); 393 392 if (ret) { 394 - ath_print(common, ATH_DBG_FATAL, 395 - "Unable to initialize Rate information on target\n"); 393 + ath_err(common, 394 + "Unable to initialize Rate information on target\n"); 396 395 } 397 396 398 397 return ret; ··· 409 408 ath9k_htc_setup_rate(priv, sta, &trate); 410 409 ret = ath9k_htc_send_rate_cmd(priv, &trate); 411 410 if (!ret) 412 - ath_print(common, ATH_DBG_CONFIG, 413 - "Updated target sta: %pM, rate caps: 0x%X\n", 414 - sta->addr, be32_to_cpu(trate.capflags)); 411 + ath_dbg(common, ATH_DBG_CONFIG, 412 + "Updated target sta: %pM, rate caps: 0x%X\n", 413 + sta->addr, be32_to_cpu(trate.capflags)); 415 414 } 416 415 417 416 static void ath9k_htc_update_rate(struct ath9k_htc_priv *priv, ··· 436 435 437 436 ret = ath9k_htc_send_rate_cmd(priv, &trate); 438 437 if (!ret) 439 - ath_print(common, ATH_DBG_CONFIG, 440 - "Updated target sta: %pM, rate caps: 0x%X\n", 441 - bss_conf->bssid, be32_to_cpu(trate.capflags)); 438 + ath_dbg(common, ATH_DBG_CONFIG, 439 + "Updated target sta: %pM, rate caps: 0x%X\n", 440 + bss_conf->bssid, be32_to_cpu(trate.capflags)); 442 441 } 443 442 444 443 static int ath9k_htc_tx_aggr_oper(struct ath9k_htc_priv *priv, ··· 465 464 466 465 WMI_CMD_BUF(WMI_TX_AGGR_ENABLE_CMDID, &aggr); 467 466 if (ret) 468 - ath_print(common, ATH_DBG_CONFIG, 469 - "Unable to %s TX aggregation for (%pM, %d)\n", 470 - (aggr.aggr_enable) ? "start" : "stop", sta->addr, tid); 467 + ath_dbg(common, ATH_DBG_CONFIG, 468 + "Unable to %s TX aggregation for (%pM, %d)\n", 469 + (aggr.aggr_enable) ? "start" : "stop", sta->addr, tid); 471 470 else 472 - ath_print(common, ATH_DBG_CONFIG, 473 - "%s TX aggregation for (%pM, %d)\n", 474 - (aggr.aggr_enable) ? "Starting" : "Stopping", 475 - sta->addr, tid); 471 + ath_dbg(common, ATH_DBG_CONFIG, 472 + "%s TX aggregation for (%pM, %d)\n", 473 + (aggr.aggr_enable) ? "Starting" : "Stopping", 474 + sta->addr, tid); 476 475 477 476 spin_lock_bh(&priv->tx_lock); 478 477 ista->tid_state[tid] = (aggr.aggr_enable && !ret) ? AGGR_START : AGGR_STOP; ··· 725 724 /* Long calibration runs independently of short calibration. */ 726 725 if ((timestamp - common->ani.longcal_timer) >= ATH_LONG_CALINTERVAL) { 727 726 longcal = true; 728 - ath_print(common, ATH_DBG_ANI, "longcal @%lu\n", jiffies); 727 + ath_dbg(common, ATH_DBG_ANI, "longcal @%lu\n", jiffies); 729 728 common->ani.longcal_timer = timestamp; 730 729 } 731 730 ··· 734 733 if ((timestamp - common->ani.shortcal_timer) >= 735 734 short_cal_interval) { 736 735 shortcal = true; 737 - ath_print(common, ATH_DBG_ANI, 738 - "shortcal @%lu\n", jiffies); 736 + ath_dbg(common, ATH_DBG_ANI, 737 + "shortcal @%lu\n", jiffies); 739 738 common->ani.shortcal_timer = timestamp; 740 739 common->ani.resetcal_timer = timestamp; 741 740 } ··· 896 895 897 896 ret = led_classdev_register(wiphy_dev(priv->hw->wiphy), &led->led_cdev); 898 897 if (ret) 899 - ath_print(ath9k_hw_common(priv->ah), ATH_DBG_FATAL, 900 - "Failed to register led:%s", led->name); 898 + ath_err(ath9k_hw_common(priv->ah), 899 + "Failed to register led:%s", led->name); 901 900 else 902 901 led->registered = 1; 903 902 ··· 1025 1024 /* Reset the HW */ 1026 1025 ret = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); 1027 1026 if (ret) { 1028 - ath_print(common, ATH_DBG_FATAL, 1029 - "Unable to reset hardware; reset status %d " 1030 - "(freq %u MHz)\n", ret, ah->curchan->channel); 1027 + ath_err(common, 1028 + "Unable to reset hardware; reset status %d (freq %u MHz)\n", 1029 + ret, ah->curchan->channel); 1031 1030 } 1032 1031 1033 1032 ath_update_txpow(priv); ··· 1088 1087 /* Reset the HW */ 1089 1088 ret = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); 1090 1089 if (ret) { 1091 - ath_print(common, ATH_DBG_FATAL, 1092 - "Unable to reset hardware; reset status %d " 1093 - "(freq %u MHz)\n", ret, ah->curchan->channel); 1090 + ath_err(common, 1091 + "Unable to reset hardware; reset status %d (freq %u MHz)\n", 1092 + ret, ah->curchan->channel); 1094 1093 } 1095 1094 1096 1095 /* Disable the PHY */ ··· 1125 1124 ret = ath9k_htc_tx_start(priv, skb); 1126 1125 if (ret != 0) { 1127 1126 if (ret == -ENOMEM) { 1128 - ath_print(ath9k_hw_common(priv->ah), ATH_DBG_XMIT, 1129 - "Stopping TX queues\n"); 1127 + ath_dbg(ath9k_hw_common(priv->ah), ATH_DBG_XMIT, 1128 + "Stopping TX queues\n"); 1130 1129 ieee80211_stop_queues(hw); 1131 1130 spin_lock_bh(&priv->tx_lock); 1132 1131 priv->tx_queues_stop = true; 1133 1132 spin_unlock_bh(&priv->tx_lock); 1134 1133 } else { 1135 - ath_print(ath9k_hw_common(priv->ah), ATH_DBG_XMIT, 1136 - "Tx failed"); 1134 + ath_dbg(ath9k_hw_common(priv->ah), ATH_DBG_XMIT, 1135 + "Tx failed\n"); 1137 1136 } 1138 1137 goto fail_tx; 1139 1138 } ··· 1159 1158 1160 1159 mutex_lock(&priv->mutex); 1161 1160 1162 - ath_print(common, ATH_DBG_CONFIG, 1163 - "Starting driver with initial channel: %d MHz\n", 1164 - curchan->center_freq); 1161 + ath_dbg(common, ATH_DBG_CONFIG, 1162 + "Starting driver with initial channel: %d MHz\n", 1163 + curchan->center_freq); 1165 1164 1166 1165 /* Ensure that HW is awake before flushing RX */ 1167 1166 ath9k_htc_setpower(priv, ATH9K_PM_AWAKE); ··· 1176 1175 ath9k_hw_htc_resetinit(ah); 1177 1176 ret = ath9k_hw_reset(ah, init_channel, ah->caldata, false); 1178 1177 if (ret) { 1179 - ath_print(common, ATH_DBG_FATAL, 1180 - "Unable to reset hardware; reset status %d " 1181 - "(freq %u MHz)\n", ret, curchan->center_freq); 1178 + ath_err(common, 1179 + "Unable to reset hardware; reset status %d (freq %u MHz)\n", 1180 + ret, curchan->center_freq); 1182 1181 mutex_unlock(&priv->mutex); 1183 1182 return ret; 1184 1183 } ··· 1224 1223 mutex_lock(&priv->mutex); 1225 1224 1226 1225 if (priv->op_flags & OP_INVALID) { 1227 - ath_print(common, ATH_DBG_ANY, "Device not present\n"); 1226 + ath_dbg(common, ATH_DBG_ANY, "Device not present\n"); 1228 1227 mutex_unlock(&priv->mutex); 1229 1228 return; 1230 1229 } ··· 1244 1243 /* Remove monitor interface here */ 1245 1244 if (ah->opmode == NL80211_IFTYPE_MONITOR) { 1246 1245 if (ath9k_htc_remove_monitor_interface(priv)) 1247 - ath_print(common, ATH_DBG_FATAL, 1248 - "Unable to remove monitor interface\n"); 1246 + ath_err(common, "Unable to remove monitor interface\n"); 1249 1247 else 1250 - ath_print(common, ATH_DBG_CONFIG, 1251 - "Monitor interface removed\n"); 1248 + ath_dbg(common, ATH_DBG_CONFIG, 1249 + "Monitor interface removed\n"); 1252 1250 } 1253 1251 1254 1252 if (ah->btcoex_hw.enabled) { ··· 1264 1264 1265 1265 priv->op_flags |= OP_INVALID; 1266 1266 1267 - ath_print(common, ATH_DBG_CONFIG, "Driver halt\n"); 1267 + ath_dbg(common, ATH_DBG_CONFIG, "Driver halt\n"); 1268 1268 mutex_unlock(&priv->mutex); 1269 1269 } 1270 1270 ··· 1298 1298 hvif.opmode = cpu_to_be32(HTC_M_IBSS); 1299 1299 break; 1300 1300 default: 1301 - ath_print(common, ATH_DBG_FATAL, 1301 + ath_err(common, 1302 1302 "Interface type %d not yet supported\n", vif->type); 1303 1303 ret = -EOPNOTSUPP; 1304 1304 goto out; 1305 1305 } 1306 1306 1307 - ath_print(common, ATH_DBG_CONFIG, 1308 - "Attach a VIF of type: %d\n", vif->type); 1307 + ath_dbg(common, ATH_DBG_CONFIG, 1308 + "Attach a VIF of type: %d\n", vif->type); 1309 1309 1310 1310 priv->ah->opmode = vif->type; 1311 1311 ··· 1328 1328 1329 1329 ret = ath9k_htc_update_cap_target(priv); 1330 1330 if (ret) 1331 - ath_print(common, ATH_DBG_CONFIG, "Failed to update" 1332 - " capability in target \n"); 1331 + ath_dbg(common, ATH_DBG_CONFIG, 1332 + "Failed to update capability in target\n"); 1333 1333 1334 1334 priv->vif = vif; 1335 1335 out: ··· 1349 1349 int ret = 0; 1350 1350 u8 cmd_rsp; 1351 1351 1352 - ath_print(common, ATH_DBG_CONFIG, "Detach Interface\n"); 1352 + ath_dbg(common, ATH_DBG_CONFIG, "Detach Interface\n"); 1353 1353 1354 1354 mutex_lock(&priv->mutex); 1355 1355 ath9k_htc_ps_wakeup(priv); ··· 1386 1386 mutex_unlock(&priv->htc_pm_lock); 1387 1387 1388 1388 if (enable_radio) { 1389 - ath_print(common, ATH_DBG_CONFIG, 1390 - "not-idle: enabling radio\n"); 1389 + ath_dbg(common, ATH_DBG_CONFIG, 1390 + "not-idle: enabling radio\n"); 1391 1391 ath9k_htc_setpower(priv, ATH9K_PM_AWAKE); 1392 1392 ath9k_htc_radio_enable(hw); 1393 1393 } ··· 1397 1397 struct ieee80211_channel *curchan = hw->conf.channel; 1398 1398 int pos = curchan->hw_value; 1399 1399 1400 - ath_print(common, ATH_DBG_CONFIG, "Set channel: %d MHz\n", 1401 - curchan->center_freq); 1400 + ath_dbg(common, ATH_DBG_CONFIG, "Set channel: %d MHz\n", 1401 + curchan->center_freq); 1402 1402 1403 1403 ath9k_cmn_update_ichannel(&priv->ah->channels[pos], 1404 1404 hw->conf.channel, 1405 1405 hw->conf.channel_type); 1406 1406 1407 1407 if (ath9k_htc_set_channel(priv, hw, &priv->ah->channels[pos]) < 0) { 1408 - ath_print(common, ATH_DBG_FATAL, 1409 - "Unable to set channel\n"); 1408 + ath_err(common, "Unable to set channel\n"); 1410 1409 mutex_unlock(&priv->mutex); 1411 1410 return -EINVAL; 1412 1411 } 1413 1412 1414 1413 } 1414 + 1415 1415 if (changed & IEEE80211_CONF_CHANGE_PS) { 1416 1416 if (conf->flags & IEEE80211_CONF_PS) { 1417 1417 ath9k_htc_setpower(priv, ATH9K_PM_NETWORK_SLEEP); ··· 1423 1423 } 1424 1424 } 1425 1425 1426 + if (changed & IEEE80211_CONF_CHANGE_POWER) { 1427 + priv->txpowlimit = 2 * conf->power_level; 1428 + ath_update_txpow(priv); 1429 + } 1430 + 1426 1431 if (changed & IEEE80211_CONF_CHANGE_MONITOR) { 1427 1432 if (conf->flags & IEEE80211_CONF_MONITOR) { 1428 1433 if (ath9k_htc_add_monitor_interface(priv)) 1429 - ath_print(common, ATH_DBG_FATAL, 1430 - "Failed to set monitor mode\n"); 1434 + ath_err(common, "Failed to set monitor mode\n"); 1431 1435 else 1432 - ath_print(common, ATH_DBG_CONFIG, 1433 - "HW opmode set to Monitor mode\n"); 1436 + ath_dbg(common, ATH_DBG_CONFIG, 1437 + "HW opmode set to Monitor mode\n"); 1434 1438 } 1435 1439 } 1436 1440 ··· 1446 1442 } 1447 1443 mutex_unlock(&priv->htc_pm_lock); 1448 1444 1449 - ath_print(common, ATH_DBG_CONFIG, 1450 - "idle: disabling radio\n"); 1445 + ath_dbg(common, ATH_DBG_CONFIG, 1446 + "idle: disabling radio\n"); 1451 1447 ath9k_htc_radio_disable(hw); 1452 1448 } 1453 1449 ··· 1484 1480 rfilt = ath9k_htc_calcrxfilter(priv); 1485 1481 ath9k_hw_setrxfilter(priv->ah, rfilt); 1486 1482 1487 - ath_print(ath9k_hw_common(priv->ah), ATH_DBG_CONFIG, 1488 - "Set HW RX filter: 0x%x\n", rfilt); 1483 + ath_dbg(ath9k_hw_common(priv->ah), ATH_DBG_CONFIG, 1484 + "Set HW RX filter: 0x%x\n", rfilt); 1489 1485 1490 1486 ath9k_htc_ps_restore(priv); 1491 1487 mutex_unlock(&priv->mutex); ··· 1548 1544 1549 1545 qnum = get_hw_qnum(queue, priv->hwq_map); 1550 1546 1551 - ath_print(common, ATH_DBG_CONFIG, 1552 - "Configure tx [queue/hwq] [%d/%d], " 1553 - "aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n", 1554 - queue, qnum, params->aifs, params->cw_min, 1555 - params->cw_max, params->txop); 1547 + ath_dbg(common, ATH_DBG_CONFIG, 1548 + "Configure tx [queue/hwq] [%d/%d], aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n", 1549 + queue, qnum, params->aifs, params->cw_min, 1550 + params->cw_max, params->txop); 1556 1551 1557 1552 ret = ath_htc_txq_update(priv, qnum, &qi); 1558 1553 if (ret) { 1559 - ath_print(common, ATH_DBG_FATAL, "TXQ Update failed\n"); 1554 + ath_err(common, "TXQ Update failed\n"); 1560 1555 goto out; 1561 1556 } 1562 1557 ··· 1583 1580 return -ENOSPC; 1584 1581 1585 1582 mutex_lock(&priv->mutex); 1586 - ath_print(common, ATH_DBG_CONFIG, "Set HW Key\n"); 1583 + ath_dbg(common, ATH_DBG_CONFIG, "Set HW Key\n"); 1587 1584 ath9k_htc_ps_wakeup(priv); 1588 1585 1589 1586 switch (cmd) { ··· 1629 1626 if (changed & BSS_CHANGED_ASSOC) { 1630 1627 common->curaid = bss_conf->assoc ? 1631 1628 bss_conf->aid : 0; 1632 - ath_print(common, ATH_DBG_CONFIG, "BSS Changed ASSOC %d\n", 1629 + ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed ASSOC %d\n", 1633 1630 bss_conf->assoc); 1634 1631 1635 1632 if (bss_conf->assoc) { ··· 1646 1643 memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); 1647 1644 ath9k_hw_write_associd(ah); 1648 1645 1649 - ath_print(common, ATH_DBG_CONFIG, 1650 - "BSSID: %pM aid: 0x%x\n", 1651 - common->curbssid, common->curaid); 1646 + ath_dbg(common, ATH_DBG_CONFIG, 1647 + "BSSID: %pM aid: 0x%x\n", 1648 + common->curbssid, common->curaid); 1652 1649 } 1653 1650 1654 1651 if ((changed & BSS_CHANGED_BEACON_INT) || ··· 1666 1663 } 1667 1664 1668 1665 if (changed & BSS_CHANGED_ERP_PREAMBLE) { 1669 - ath_print(common, ATH_DBG_CONFIG, "BSS Changed PREAMBLE %d\n", 1670 - bss_conf->use_short_preamble); 1666 + ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed PREAMBLE %d\n", 1667 + bss_conf->use_short_preamble); 1671 1668 if (bss_conf->use_short_preamble) 1672 1669 priv->op_flags |= OP_PREAMBLE_SHORT; 1673 1670 else ··· 1675 1672 } 1676 1673 1677 1674 if (changed & BSS_CHANGED_ERP_CTS_PROT) { 1678 - ath_print(common, ATH_DBG_CONFIG, "BSS Changed CTS PROT %d\n", 1679 - bss_conf->use_cts_prot); 1675 + ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed CTS PROT %d\n", 1676 + bss_conf->use_cts_prot); 1680 1677 if (bss_conf->use_cts_prot && 1681 1678 hw->conf.channel->band != IEEE80211_BAND_5GHZ) 1682 1679 priv->op_flags |= OP_PROTECT_ENABLE; ··· 1767 1764 spin_unlock_bh(&priv->tx_lock); 1768 1765 break; 1769 1766 default: 1770 - ath_print(ath9k_hw_common(priv->ah), ATH_DBG_FATAL, 1771 - "Unknown AMPDU action\n"); 1767 + ath_err(ath9k_hw_common(priv->ah), "Unknown AMPDU action\n"); 1772 1768 } 1773 1769 1774 1770 return ret;
+14 -19
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
··· 69 69 qi.tqi_readyTime = qinfo->tqi_readyTime; 70 70 71 71 if (!ath9k_hw_set_txq_props(ah, qnum, &qi)) { 72 - ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, 73 - "Unable to update hardware queue %u!\n", qnum); 72 + ath_err(ath9k_hw_common(ah), 73 + "Unable to update hardware queue %u!\n", qnum); 74 74 error = -EIO; 75 75 } else { 76 76 ath9k_hw_resettxqueue(ah, qnum); ··· 270 270 if (priv->tx_queues_stop) { 271 271 priv->tx_queues_stop = false; 272 272 spin_unlock_bh(&priv->tx_lock); 273 - ath_print(ath9k_hw_common(priv->ah), ATH_DBG_XMIT, 274 - "Waking up TX queues\n"); 273 + ath_dbg(ath9k_hw_common(priv->ah), ATH_DBG_XMIT, 274 + "Waking up TX queues\n"); 275 275 ieee80211_wake_queues(priv->hw); 276 276 return; 277 277 } ··· 296 296 (ep_id == priv->data_vo_ep)) { 297 297 skb_pull(skb, sizeof(struct tx_frame_hdr)); 298 298 } else { 299 - ath_print(common, ATH_DBG_FATAL, 300 - "Unsupported TX EPID: %d\n", ep_id); 299 + ath_err(common, "Unsupported TX EPID: %d\n", ep_id); 301 300 dev_kfree_skb_any(skb); 302 301 return; 303 302 } ··· 336 337 return false; 337 338 338 339 if (qnum >= ARRAY_SIZE(priv->hwq_map)) { 339 - ath_print(common, ATH_DBG_FATAL, 340 - "qnum %u out of range, max %u!\n", 341 - qnum, (unsigned int)ARRAY_SIZE(priv->hwq_map)); 340 + ath_err(common, "qnum %u out of range, max %zu!\n", 341 + qnum, ARRAY_SIZE(priv->hwq_map)); 342 342 ath9k_hw_releasetxqueue(ah, qnum); 343 343 return false; 344 344 } ··· 488 490 __le16 fc; 489 491 490 492 if (skb->len <= HTC_RX_FRAME_HEADER_SIZE) { 491 - ath_print(common, ATH_DBG_FATAL, 492 - "Corrupted RX frame, dropping\n"); 493 + ath_err(common, "Corrupted RX frame, dropping\n"); 493 494 goto rx_next; 494 495 } 495 496 ··· 496 499 497 500 if (be16_to_cpu(rxstatus->rs_datalen) - 498 501 (skb->len - HTC_RX_FRAME_HEADER_SIZE) != 0) { 499 - ath_print(common, ATH_DBG_FATAL, 500 - "Corrupted RX data len, dropping " 501 - "(dlen: %d, skblen: %d)\n", 502 - rxstatus->rs_datalen, skb->len); 502 + ath_err(common, 503 + "Corrupted RX data len, dropping (dlen: %d, skblen: %d)\n", 504 + rxstatus->rs_datalen, skb->len); 503 505 goto rx_next; 504 506 } 505 507 ··· 681 685 spin_unlock(&priv->rx.rxbuflock); 682 686 683 687 if (rxbuf == NULL) { 684 - ath_print(common, ATH_DBG_ANY, 685 - "No free RX buffer\n"); 688 + ath_dbg(common, ATH_DBG_ANY, 689 + "No free RX buffer\n"); 686 690 goto err; 687 691 } 688 692 ··· 724 728 for (i = 0; i < ATH9K_HTC_RXBUF; i++) { 725 729 rxbuf = kzalloc(sizeof(struct ath9k_htc_rxbuf), GFP_KERNEL); 726 730 if (rxbuf == NULL) { 727 - ath_print(common, ATH_DBG_FATAL, 728 - "Unable to allocate RX buffers\n"); 731 + ath_err(common, "Unable to allocate RX buffers\n"); 729 732 goto err; 730 733 } 731 734 list_add_tail(&rxbuf->list, &priv->rx.rxbuf);
+110 -91
drivers/net/wireless/ath/ath9k/hw.c
··· 129 129 udelay(AH_TIME_QUANTUM); 130 130 } 131 131 132 - ath_print(ath9k_hw_common(ah), ATH_DBG_ANY, 133 - "timeout (%d us) on reg 0x%x: 0x%08x & 0x%08x != 0x%08x\n", 134 - timeout, reg, REG_READ(ah, reg), mask, val); 132 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_ANY, 133 + "timeout (%d us) on reg 0x%x: 0x%08x & 0x%08x != 0x%08x\n", 134 + timeout, reg, REG_READ(ah, reg), mask, val); 135 135 136 136 return false; 137 137 } ··· 211 211 } 212 212 break; 213 213 default: 214 - ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, 215 - "Unknown phy %u (rate ix %u)\n", phy, rateix); 214 + ath_err(ath9k_hw_common(ah), 215 + "Unknown phy %u (rate ix %u)\n", phy, rateix); 216 216 txTime = 0; 217 217 break; 218 218 } ··· 331 331 REG_WRITE(ah, addr, wrData); 332 332 rdData = REG_READ(ah, addr); 333 333 if (rdData != wrData) { 334 - ath_print(common, ATH_DBG_FATAL, 335 - "address test failed " 336 - "addr: 0x%08x - wr:0x%08x != " 337 - "rd:0x%08x\n", 338 - addr, wrData, rdData); 334 + ath_err(common, 335 + "address test failed addr: 0x%08x - wr:0x%08x != rd:0x%08x\n", 336 + addr, wrData, rdData); 339 337 return false; 340 338 } 341 339 } ··· 342 344 REG_WRITE(ah, addr, wrData); 343 345 rdData = REG_READ(ah, addr); 344 346 if (wrData != rdData) { 345 - ath_print(common, ATH_DBG_FATAL, 346 - "address test failed " 347 - "addr: 0x%08x - wr:0x%08x != " 348 - "rd:0x%08x\n", 349 - addr, wrData, rdData); 347 + ath_err(common, 348 + "address test failed addr: 0x%08x - wr:0x%08x != rd:0x%08x\n", 349 + addr, wrData, rdData); 350 350 return false; 351 351 } 352 352 } ··· 465 469 if (ecode != 0) 466 470 return ecode; 467 471 468 - ath_print(ath9k_hw_common(ah), ATH_DBG_CONFIG, 469 - "Eeprom VER: %d, REV: %d\n", 470 - ah->eep_ops->get_eeprom_ver(ah), 471 - ah->eep_ops->get_eeprom_rev(ah)); 472 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_CONFIG, 473 + "Eeprom VER: %d, REV: %d\n", 474 + ah->eep_ops->get_eeprom_ver(ah), 475 + ah->eep_ops->get_eeprom_rev(ah)); 472 476 473 477 ecode = ath9k_hw_rf_alloc_ext_banks(ah); 474 478 if (ecode) { 475 - ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, 476 - "Failed allocating banks for " 477 - "external radio\n"); 479 + ath_err(ath9k_hw_common(ah), 480 + "Failed allocating banks for external radio\n"); 478 481 ath9k_hw_rf_free_ext_banks(ah); 479 482 return ecode; 480 483 } ··· 504 509 ah->hw_version.macVersion = AR_SREV_VERSION_9100; 505 510 506 511 if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) { 507 - ath_print(common, ATH_DBG_FATAL, 508 - "Couldn't reset chip\n"); 512 + ath_err(common, "Couldn't reset chip\n"); 509 513 return -EIO; 510 514 } 511 515 ··· 514 520 ath9k_hw_attach_ops(ah); 515 521 516 522 if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) { 517 - ath_print(common, ATH_DBG_FATAL, "Couldn't wakeup chip\n"); 523 + ath_err(common, "Couldn't wakeup chip\n"); 518 524 return -EIO; 519 525 } 520 526 ··· 530 536 } 531 537 } 532 538 533 - ath_print(common, ATH_DBG_RESET, "serialize_regmode is %d\n", 539 + ath_dbg(common, ATH_DBG_RESET, "serialize_regmode is %d\n", 534 540 ah->config.serialize_regmode); 535 541 536 542 if (AR_SREV_9285(ah) || AR_SREV_9271(ah)) ··· 539 545 ah->config.max_txtrig_level = MAX_TX_FIFO_THRESHOLD; 540 546 541 547 if (!ath9k_hw_macversion_supported(ah)) { 542 - ath_print(common, ATH_DBG_FATAL, 543 - "Mac Chip Rev 0x%02x.%x is not supported by " 544 - "this driver\n", ah->hw_version.macVersion, 545 - ah->hw_version.macRev); 548 + ath_err(common, 549 + "Mac Chip Rev 0x%02x.%x is not supported by this driver\n", 550 + ah->hw_version.macVersion, ah->hw_version.macRev); 546 551 return -EOPNOTSUPP; 547 552 } 548 553 ··· 587 594 588 595 r = ath9k_hw_init_macaddr(ah); 589 596 if (r) { 590 - ath_print(common, ATH_DBG_FATAL, 591 - "Failed to initialize MAC address\n"); 597 + ath_err(common, "Failed to initialize MAC address\n"); 592 598 return r; 593 599 } 594 600 ··· 621 629 case AR9287_DEVID_PCIE: 622 630 case AR2427_DEVID_PCIE: 623 631 case AR9300_DEVID_PCIE: 632 + case AR9300_DEVID_AR9485_PCIE: 624 633 break; 625 634 default: 626 635 if (common->bus_ops->ath_bus_type == ATH_USB) 627 636 break; 628 - ath_print(common, ATH_DBG_FATAL, 629 - "Hardware device ID 0x%04x not supported\n", 630 - ah->hw_version.devid); 637 + ath_err(common, "Hardware device ID 0x%04x not supported\n", 638 + ah->hw_version.devid); 631 639 return -EOPNOTSUPP; 632 640 } 633 641 634 642 ret = __ath9k_hw_init(ah); 635 643 if (ret) { 636 - ath_print(common, ATH_DBG_FATAL, 637 - "Unable to initialize hardware; " 638 - "initialization status: %d\n", ret); 644 + ath_err(common, 645 + "Unable to initialize hardware; initialization status: %d\n", 646 + ret); 639 647 return ret; 640 648 } 641 649 ··· 667 675 static void ath9k_hw_init_pll(struct ath_hw *ah, 668 676 struct ath9k_channel *chan) 669 677 { 670 - u32 pll = ath9k_hw_compute_pll_control(ah, chan); 678 + u32 pll; 679 + 680 + if (AR_SREV_9485(ah)) 681 + REG_WRITE(ah, AR_RTC_PLL_CONTROL2, 0x886666); 682 + 683 + pll = ath9k_hw_compute_pll_control(ah, chan); 671 684 672 685 REG_WRITE(ah, AR_RTC_PLL_CONTROL, pll); 673 686 ··· 764 767 static bool ath9k_hw_set_global_txtimeout(struct ath_hw *ah, u32 tu) 765 768 { 766 769 if (tu > 0xFFFF) { 767 - ath_print(ath9k_hw_common(ah), ATH_DBG_XMIT, 768 - "bad global tx timeout %u\n", tu); 770 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_XMIT, 771 + "bad global tx timeout %u\n", tu); 769 772 ah->globaltxtimeout = (u32) -1; 770 773 return false; 771 774 } else { ··· 782 785 int slottime; 783 786 int sifstime; 784 787 785 - ath_print(ath9k_hw_common(ah), ATH_DBG_RESET, "ah->misc_mode 0x%x\n", 786 - ah->misc_mode); 788 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_RESET, "ah->misc_mode 0x%x\n", 789 + ah->misc_mode); 787 790 788 791 if (ah->misc_mode != 0) 789 792 REG_WRITE(ah, AR_PCU_MISC, ··· 1026 1029 1027 1030 REG_WRITE(ah, AR_RTC_RC, 0); 1028 1031 if (!ath9k_hw_wait(ah, AR_RTC_RC, AR_RTC_RC_M, 0, AH_WAIT_TIMEOUT)) { 1029 - ath_print(ath9k_hw_common(ah), ATH_DBG_RESET, 1030 - "RTC stuck in MAC reset\n"); 1032 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_RESET, 1033 + "RTC stuck in MAC reset\n"); 1031 1034 return false; 1032 1035 } 1033 1036 ··· 1073 1076 AR_RTC_STATUS_M, 1074 1077 AR_RTC_STATUS_ON, 1075 1078 AH_WAIT_TIMEOUT)) { 1076 - ath_print(ath9k_hw_common(ah), ATH_DBG_RESET, 1077 - "RTC not waking up\n"); 1079 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_RESET, 1080 + "RTC not waking up\n"); 1078 1081 return false; 1079 1082 } 1080 1083 ··· 1134 1137 1135 1138 for (qnum = 0; qnum < AR_NUM_QCU; qnum++) { 1136 1139 if (ath9k_hw_numtxpending(ah, qnum)) { 1137 - ath_print(common, ATH_DBG_QUEUE, 1138 - "Transmit frames pending on " 1139 - "queue %d\n", qnum); 1140 + ath_dbg(common, ATH_DBG_QUEUE, 1141 + "Transmit frames pending on queue %d\n", qnum); 1140 1142 return false; 1141 1143 } 1142 1144 } 1143 1145 1144 1146 if (!ath9k_hw_rfbus_req(ah)) { 1145 - ath_print(common, ATH_DBG_FATAL, 1146 - "Could not kill baseband RX\n"); 1147 + ath_err(common, "Could not kill baseband RX\n"); 1147 1148 return false; 1148 1149 } 1149 1150 ··· 1149 1154 1150 1155 r = ath9k_hw_rf_set_freq(ah, chan); 1151 1156 if (r) { 1152 - ath_print(common, ATH_DBG_FATAL, 1153 - "Failed to set channel\n"); 1157 + ath_err(common, "Failed to set channel\n"); 1154 1158 return false; 1155 1159 } 1156 1160 ath9k_hw_set_clockrate(ah); ··· 1216 1222 if (!ah->chip_fullsleep) { 1217 1223 ath9k_hw_abortpcurecv(ah); 1218 1224 if (!ath9k_hw_stopdmarecv(ah)) { 1219 - ath_print(common, ATH_DBG_XMIT, 1225 + ath_dbg(common, ATH_DBG_XMIT, 1220 1226 "Failed to stop receive dma\n"); 1221 1227 bChannelChange = false; 1222 1228 } ··· 1281 1287 } 1282 1288 1283 1289 if (!ath9k_hw_chip_reset(ah, chan)) { 1284 - ath_print(common, ATH_DBG_FATAL, "Chip reset failed\n"); 1290 + ath_err(common, "Chip reset failed\n"); 1285 1291 return -EINVAL; 1286 1292 } 1287 1293 ··· 1428 1434 u32 mask; 1429 1435 mask = REG_READ(ah, AR_CFG); 1430 1436 if (mask & (AR_CFG_SWRB | AR_CFG_SWTB | AR_CFG_SWRG)) { 1431 - ath_print(common, ATH_DBG_RESET, 1437 + ath_dbg(common, ATH_DBG_RESET, 1432 1438 "CFG Byte Swap Set 0x%x\n", mask); 1433 1439 } else { 1434 1440 mask = 1435 1441 INIT_CONFIG_STATUS | AR_CFG_SWRB | AR_CFG_SWTB; 1436 1442 REG_WRITE(ah, AR_CFG, mask); 1437 - ath_print(common, ATH_DBG_RESET, 1443 + ath_dbg(common, ATH_DBG_RESET, 1438 1444 "Setting CFG 0x%x\n", REG_READ(ah, AR_CFG)); 1439 1445 } 1440 1446 } else { ··· 1562 1568 AR_RTC_FORCE_WAKE_EN); 1563 1569 } 1564 1570 if (i == 0) { 1565 - ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, 1566 - "Failed to wakeup in %uus\n", 1567 - POWER_UP_TIME / 20); 1571 + ath_err(ath9k_hw_common(ah), 1572 + "Failed to wakeup in %uus\n", 1573 + POWER_UP_TIME / 20); 1568 1574 return false; 1569 1575 } 1570 1576 } ··· 1588 1594 if (ah->power_mode == mode) 1589 1595 return status; 1590 1596 1591 - ath_print(common, ATH_DBG_RESET, "%s -> %s\n", 1592 - modes[ah->power_mode], modes[mode]); 1597 + ath_dbg(common, ATH_DBG_RESET, "%s -> %s\n", 1598 + modes[ah->power_mode], modes[mode]); 1593 1599 1594 1600 switch (mode) { 1595 1601 case ATH9K_PM_AWAKE: ··· 1603 1609 ath9k_set_power_network_sleep(ah, setChip); 1604 1610 break; 1605 1611 default: 1606 - ath_print(common, ATH_DBG_FATAL, 1607 - "Unknown power mode %u\n", mode); 1612 + ath_err(common, "Unknown power mode %u\n", mode); 1608 1613 return false; 1609 1614 } 1610 1615 ah->power_mode = mode; 1616 + 1617 + /* 1618 + * XXX: If this warning never comes up after a while then 1619 + * simply keep the ATH_DBG_WARN_ON_ONCE() but make 1620 + * ath9k_hw_setpower() return type void. 1621 + */ 1622 + ATH_DBG_WARN_ON_ONCE(!status); 1611 1623 1612 1624 return status; 1613 1625 } ··· 1669 1669 flags |= AR_TBTT_TIMER_EN; 1670 1670 break; 1671 1671 } 1672 - ath_print(ath9k_hw_common(ah), ATH_DBG_BEACON, 1673 - "%s: unsupported opmode: %d\n", 1674 - __func__, ah->opmode); 1672 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_BEACON, 1673 + "%s: unsupported opmode: %d\n", 1674 + __func__, ah->opmode); 1675 1675 return; 1676 1676 break; 1677 1677 } ··· 1727 1727 else 1728 1728 nextTbtt = bs->bs_nexttbtt; 1729 1729 1730 - ath_print(common, ATH_DBG_BEACON, "next DTIM %d\n", bs->bs_nextdtim); 1731 - ath_print(common, ATH_DBG_BEACON, "next beacon %d\n", nextTbtt); 1732 - ath_print(common, ATH_DBG_BEACON, "beacon period %d\n", beaconintval); 1733 - ath_print(common, ATH_DBG_BEACON, "DTIM period %d\n", dtimperiod); 1730 + ath_dbg(common, ATH_DBG_BEACON, "next DTIM %d\n", bs->bs_nextdtim); 1731 + ath_dbg(common, ATH_DBG_BEACON, "next beacon %d\n", nextTbtt); 1732 + ath_dbg(common, ATH_DBG_BEACON, "beacon period %d\n", beaconintval); 1733 + ath_dbg(common, ATH_DBG_BEACON, "DTIM period %d\n", dtimperiod); 1734 1734 1735 1735 ENABLE_REGWRITE_BUFFER(ah); 1736 1736 ··· 1776 1776 struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; 1777 1777 1778 1778 u16 capField = 0, eeval; 1779 - u8 ant_div_ctl1; 1779 + u8 ant_div_ctl1, tx_chainmask, rx_chainmask; 1780 1780 1781 1781 eeval = ah->eep_ops->get_eeprom(ah, EEP_REG_0); 1782 1782 regulatory->current_rd = eeval; ··· 1795 1795 regulatory->current_rd += 5; 1796 1796 else if (regulatory->current_rd == 0x41) 1797 1797 regulatory->current_rd = 0x43; 1798 - ath_print(common, ATH_DBG_REGULATORY, 1799 - "regdomain mapped to 0x%x\n", regulatory->current_rd); 1798 + ath_dbg(common, ATH_DBG_REGULATORY, 1799 + "regdomain mapped to 0x%x\n", regulatory->current_rd); 1800 1800 } 1801 1801 1802 1802 eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE); 1803 1803 if ((eeval & (AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A)) == 0) { 1804 - ath_print(common, ATH_DBG_FATAL, 1805 - "no band has been marked as supported in EEPROM.\n"); 1804 + ath_err(common, 1805 + "no band has been marked as supported in EEPROM\n"); 1806 1806 return -EINVAL; 1807 1807 } 1808 1808 ··· 1940 1940 } 1941 1941 1942 1942 if (AR_SREV_9300_20_OR_LATER(ah)) { 1943 - pCap->hw_caps |= ATH9K_HW_CAP_EDMA | ATH9K_HW_CAP_LDPC | 1944 - ATH9K_HW_CAP_FASTCLOCK; 1943 + pCap->hw_caps |= ATH9K_HW_CAP_EDMA | ATH9K_HW_CAP_FASTCLOCK; 1944 + if (!AR_SREV_9485(ah)) 1945 + pCap->hw_caps |= ATH9K_HW_CAP_LDPC; 1946 + 1945 1947 pCap->rx_hp_qdepth = ATH9K_HW_RX_HP_QDEPTH; 1946 1948 pCap->rx_lp_qdepth = ATH9K_HW_RX_LP_QDEPTH; 1947 1949 pCap->rx_status_len = sizeof(struct ar9003_rxs); ··· 1982 1980 } 1983 1981 1984 1982 1983 + 1984 + if (AR_SREV_9485_10(ah)) { 1985 + pCap->pcie_lcr_extsync_en = true; 1986 + pCap->pcie_lcr_offset = 0x80; 1987 + } 1988 + 1989 + tx_chainmask = pCap->tx_chainmask; 1990 + rx_chainmask = pCap->rx_chainmask; 1991 + while (tx_chainmask || rx_chainmask) { 1992 + if (tx_chainmask & BIT(0)) 1993 + pCap->max_txchains++; 1994 + if (rx_chainmask & BIT(0)) 1995 + pCap->max_rxchains++; 1996 + 1997 + tx_chainmask >>= 1; 1998 + rx_chainmask >>= 1; 1999 + } 1985 2000 1986 2001 return 0; 1987 2002 } ··· 2276 2257 { 2277 2258 if (!ath9k_hw_wait(ah, AR_SLP32_MODE, AR_SLP32_TSF_WRITE_STATUS, 0, 2278 2259 AH_TSF_WRITE_TIMEOUT)) 2279 - ath_print(ath9k_hw_common(ah), ATH_DBG_RESET, 2280 - "AR_SLP32_TSF_WRITE_STATUS limit exceeded\n"); 2260 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_RESET, 2261 + "AR_SLP32_TSF_WRITE_STATUS limit exceeded\n"); 2281 2262 2282 2263 REG_WRITE(ah, AR_RESET_TSF, AR_RESET_TSF_ONCE); 2283 2264 } ··· 2367 2348 timer = kzalloc(sizeof(struct ath_gen_timer), GFP_KERNEL); 2368 2349 2369 2350 if (timer == NULL) { 2370 - ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, 2371 - "Failed to allocate memory" 2372 - "for hw timer[%d]\n", timer_index); 2351 + ath_err(ath9k_hw_common(ah), 2352 + "Failed to allocate memory for hw timer[%d]\n", 2353 + timer_index); 2373 2354 return NULL; 2374 2355 } 2375 2356 ··· 2398 2379 2399 2380 tsf = ath9k_hw_gettsf32(ah); 2400 2381 2401 - ath_print(ath9k_hw_common(ah), ATH_DBG_HWTIMER, 2402 - "curent tsf %x period %x" 2403 - "timer_next %x\n", tsf, timer_period, timer_next); 2382 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_HWTIMER, 2383 + "current tsf %x period %x timer_next %x\n", 2384 + tsf, timer_period, timer_next); 2404 2385 2405 2386 /* 2406 2387 * Pull timer_next forward if the current TSF already passed it ··· 2480 2461 index = rightmost_index(timer_table, &thresh_mask); 2481 2462 timer = timer_table->timers[index]; 2482 2463 BUG_ON(!timer); 2483 - ath_print(common, ATH_DBG_HWTIMER, 2484 - "TSF overflow for Gen timer %d\n", index); 2464 + ath_dbg(common, ATH_DBG_HWTIMER, 2465 + "TSF overflow for Gen timer %d\n", index); 2485 2466 timer->overflow(timer->arg); 2486 2467 } 2487 2468 ··· 2489 2470 index = rightmost_index(timer_table, &trigger_mask); 2490 2471 timer = timer_table->timers[index]; 2491 2472 BUG_ON(!timer); 2492 - ath_print(common, ATH_DBG_HWTIMER, 2493 - "Gen timer[%d] trigger\n", index); 2473 + ath_dbg(common, ATH_DBG_HWTIMER, 2474 + "Gen timer[%d] trigger\n", index); 2494 2475 timer->trigger(timer->arg); 2495 2476 } 2496 2477 }
+6 -1
drivers/net/wireless/ath/ath9k/hw.h
··· 30 30 #include "btcoex.h" 31 31 32 32 #include "../regd.h" 33 - #include "../debug.h" 34 33 35 34 #define ATHEROS_VENDOR_ID 0x168c 36 35 ··· 43 44 #define AR9287_DEVID_PCI 0x002d 44 45 #define AR9287_DEVID_PCIE 0x002e 45 46 #define AR9300_DEVID_PCIE 0x0030 47 + #define AR9300_DEVID_AR9485_PCIE 0x0032 46 48 47 49 #define AR5416_AR9100_DEVID 0x000b 48 50 ··· 199 199 u16 rts_aggr_limit; 200 200 u8 tx_chainmask; 201 201 u8 rx_chainmask; 202 + u8 max_txchains; 203 + u8 max_rxchains; 202 204 u16 tx_triglevel_max; 203 205 u16 reg_cap; 204 206 u8 num_gpio_pins; ··· 211 209 u8 rx_status_len; 212 210 u8 tx_desc_len; 213 211 u8 txs_len; 212 + u16 pcie_lcr_offset; 213 + bool pcie_lcr_extsync_en; 214 214 }; 215 215 216 216 struct ath9k_ops_config { ··· 446 442 u16 analog5GhzRev; 447 443 u16 analog2GhzRev; 448 444 u16 subsysid; 445 + enum ath_usb_dev usbdev; 449 446 }; 450 447 451 448 /* Generic TSF timer definitions */
+18 -17
drivers/net/wireless/ath/ath9k/init.c
··· 210 210 ht_info->ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; 211 211 ht_info->ampdu_density = IEEE80211_HT_MPDU_DENSITY_8; 212 212 213 - if (AR_SREV_9300_20_OR_LATER(ah)) 213 + if (AR_SREV_9485(ah)) 214 + max_streams = 1; 215 + else if (AR_SREV_9300_20_OR_LATER(ah)) 214 216 max_streams = 3; 215 217 else 216 218 max_streams = 2; ··· 228 226 tx_streams = ath9k_cmn_count_streams(common->tx_chainmask, max_streams); 229 227 rx_streams = ath9k_cmn_count_streams(common->rx_chainmask, max_streams); 230 228 231 - ath_print(common, ATH_DBG_CONFIG, 232 - "TX streams %d, RX streams: %d\n", 233 - tx_streams, rx_streams); 229 + ath_dbg(common, ATH_DBG_CONFIG, 230 + "TX streams %d, RX streams: %d\n", 231 + tx_streams, rx_streams); 234 232 235 233 if (tx_streams != rx_streams) { 236 234 ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_RX_DIFF; ··· 273 271 struct ath_buf *bf; 274 272 int i, bsize, error, desc_len; 275 273 276 - ath_print(common, ATH_DBG_CONFIG, "%s DMA: %u buffers %u desc/buf\n", 277 - name, nbuf, ndesc); 274 + ath_dbg(common, ATH_DBG_CONFIG, "%s DMA: %u buffers %u desc/buf\n", 275 + name, nbuf, ndesc); 278 276 279 277 INIT_LIST_HEAD(head); 280 278 ··· 285 283 286 284 /* ath_desc must be a multiple of DWORDs */ 287 285 if ((desc_len % 4) != 0) { 288 - ath_print(common, ATH_DBG_FATAL, 289 - "ath_desc not DWORD aligned\n"); 286 + ath_err(common, "ath_desc not DWORD aligned\n"); 290 287 BUG_ON((desc_len % 4) != 0); 291 288 error = -ENOMEM; 292 289 goto fail; ··· 319 318 goto fail; 320 319 } 321 320 ds = (u8 *) dd->dd_desc; 322 - ath_print(common, ATH_DBG_CONFIG, "%s DMA map: %p (%u) -> %llx (%u)\n", 323 - name, ds, (u32) dd->dd_desc_len, 324 - ito64(dd->dd_desc_paddr), /*XXX*/(u32) dd->dd_desc_len); 321 + ath_dbg(common, ATH_DBG_CONFIG, "%s DMA map: %p (%u) -> %llx (%u)\n", 322 + name, ds, (u32) dd->dd_desc_len, 323 + ito64(dd->dd_desc_paddr), /*XXX*/(u32) dd->dd_desc_len); 325 324 326 325 /* allocate buffers */ 327 326 bsize = sizeof(struct ath_buf) * nbuf; ··· 375 374 /* Get the hardware key cache size. */ 376 375 common->keymax = sc->sc_ah->caps.keycache_size; 377 376 if (common->keymax > ATH_KEYMAX) { 378 - ath_print(common, ATH_DBG_ANY, 379 - "Warning, using only %u entries in %u key cache\n", 380 - ATH_KEYMAX, common->keymax); 377 + ath_dbg(common, ATH_DBG_ANY, 378 + "Warning, using only %u entries in %u key cache\n", 379 + ATH_KEYMAX, common->keymax); 381 380 common->keymax = ATH_KEYMAX; 382 381 } 383 382 ··· 642 641 IEEE80211_HW_SUPPORTS_PS | 643 642 IEEE80211_HW_PS_NULLFUNC_STACK | 644 643 IEEE80211_HW_SPECTRUM_MGMT | 645 - IEEE80211_HW_REPORTS_TX_ACK_STATUS; 644 + IEEE80211_HW_REPORTS_TX_ACK_STATUS | 645 + IEEE80211_HW_NEED_DTIM_PERIOD; 646 646 647 647 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) 648 648 hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION; ··· 738 736 739 737 error = ath9k_init_debug(ah); 740 738 if (error) { 741 - ath_print(common, ATH_DBG_FATAL, 742 - "Unable to create debugfs files\n"); 739 + ath_err(common, "Unable to create debugfs files\n"); 743 740 goto error_world; 744 741 } 745 742
+57 -63
drivers/net/wireless/ath/ath9k/mac.c
··· 20 20 static void ath9k_hw_set_txq_interrupts(struct ath_hw *ah, 21 21 struct ath9k_tx_queue_info *qi) 22 22 { 23 - ath_print(ath9k_hw_common(ah), ATH_DBG_INTERRUPT, 24 - "tx ok 0x%x err 0x%x desc 0x%x eol 0x%x urn 0x%x\n", 25 - ah->txok_interrupt_mask, ah->txerr_interrupt_mask, 26 - ah->txdesc_interrupt_mask, ah->txeol_interrupt_mask, 27 - ah->txurn_interrupt_mask); 23 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_INTERRUPT, 24 + "tx ok 0x%x err 0x%x desc 0x%x eol 0x%x urn 0x%x\n", 25 + ah->txok_interrupt_mask, ah->txerr_interrupt_mask, 26 + ah->txdesc_interrupt_mask, ah->txeol_interrupt_mask, 27 + ah->txurn_interrupt_mask); 28 28 29 29 ENABLE_REGWRITE_BUFFER(ah); 30 30 ··· 56 56 57 57 void ath9k_hw_txstart(struct ath_hw *ah, u32 q) 58 58 { 59 - ath_print(ath9k_hw_common(ah), ATH_DBG_QUEUE, 60 - "Enable TXE on queue: %u\n", q); 59 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_QUEUE, 60 + "Enable TXE on queue: %u\n", q); 61 61 REG_WRITE(ah, AR_Q_TXE, 1 << q); 62 62 } 63 63 EXPORT_SYMBOL(ath9k_hw_txstart); ··· 154 154 u32 wait_time = ATH9K_TX_STOP_DMA_TIMEOUT / ATH9K_TIME_QUANTUM; 155 155 156 156 if (q >= pCap->total_queues) { 157 - ath_print(common, ATH_DBG_QUEUE, "Stopping TX DMA, " 158 - "invalid queue: %u\n", q); 157 + ath_dbg(common, ATH_DBG_QUEUE, 158 + "Stopping TX DMA, invalid queue: %u\n", q); 159 159 return false; 160 160 } 161 161 162 162 qi = &ah->txq[q]; 163 163 if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) { 164 - ath_print(common, ATH_DBG_QUEUE, "Stopping TX DMA, " 165 - "inactive queue: %u\n", q); 164 + ath_dbg(common, ATH_DBG_QUEUE, 165 + "Stopping TX DMA, inactive queue: %u\n", q); 166 166 return false; 167 167 } 168 168 ··· 175 175 } 176 176 177 177 if (ath9k_hw_numtxpending(ah, q)) { 178 - ath_print(common, ATH_DBG_QUEUE, 179 - "%s: Num of pending TX Frames %d on Q %d\n", 180 - __func__, ath9k_hw_numtxpending(ah, q), q); 178 + ath_dbg(common, ATH_DBG_QUEUE, 179 + "%s: Num of pending TX Frames %d on Q %d\n", 180 + __func__, ath9k_hw_numtxpending(ah, q), q); 181 181 182 182 for (j = 0; j < 2; j++) { 183 183 tsfLow = REG_READ(ah, AR_TSF_L32); ··· 191 191 if ((REG_READ(ah, AR_TSF_L32) >> 10) == (tsfLow >> 10)) 192 192 break; 193 193 194 - ath_print(common, ATH_DBG_QUEUE, 195 - "TSF has moved while trying to set " 196 - "quiet time TSF: 0x%08x\n", tsfLow); 194 + ath_dbg(common, ATH_DBG_QUEUE, 195 + "TSF has moved while trying to set quiet time TSF: 0x%08x\n", 196 + tsfLow); 197 197 } 198 198 199 199 REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_FORCE_CH_IDLE_HIGH); ··· 204 204 wait = wait_time; 205 205 while (ath9k_hw_numtxpending(ah, q)) { 206 206 if ((--wait) == 0) { 207 - ath_print(common, ATH_DBG_FATAL, 208 - "Failed to stop TX DMA in 100 " 209 - "msec after killing last frame\n"); 207 + ath_err(common, 208 + "Failed to stop TX DMA in 100 msec after killing last frame\n"); 210 209 break; 211 210 } 212 211 udelay(ATH9K_TIME_QUANTUM); ··· 238 239 struct ath9k_tx_queue_info *qi; 239 240 240 241 if (q >= pCap->total_queues) { 241 - ath_print(common, ATH_DBG_QUEUE, "Set TXQ properties, " 242 - "invalid queue: %u\n", q); 242 + ath_dbg(common, ATH_DBG_QUEUE, 243 + "Set TXQ properties, invalid queue: %u\n", q); 243 244 return false; 244 245 } 245 246 246 247 qi = &ah->txq[q]; 247 248 if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) { 248 - ath_print(common, ATH_DBG_QUEUE, "Set TXQ properties, " 249 - "inactive queue: %u\n", q); 249 + ath_dbg(common, ATH_DBG_QUEUE, 250 + "Set TXQ properties, inactive queue: %u\n", q); 250 251 return false; 251 252 } 252 253 253 - ath_print(common, ATH_DBG_QUEUE, "Set queue properties for: %u\n", q); 254 + ath_dbg(common, ATH_DBG_QUEUE, "Set queue properties for: %u\n", q); 254 255 255 256 qi->tqi_ver = qinfo->tqi_ver; 256 257 qi->tqi_subtype = qinfo->tqi_subtype; ··· 309 310 struct ath9k_tx_queue_info *qi; 310 311 311 312 if (q >= pCap->total_queues) { 312 - ath_print(common, ATH_DBG_QUEUE, "Get TXQ properties, " 313 - "invalid queue: %u\n", q); 313 + ath_dbg(common, ATH_DBG_QUEUE, 314 + "Get TXQ properties, invalid queue: %u\n", q); 314 315 return false; 315 316 } 316 317 317 318 qi = &ah->txq[q]; 318 319 if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) { 319 - ath_print(common, ATH_DBG_QUEUE, "Get TXQ properties, " 320 - "inactive queue: %u\n", q); 320 + ath_dbg(common, ATH_DBG_QUEUE, 321 + "Get TXQ properties, inactive queue: %u\n", q); 321 322 return false; 322 323 } 323 324 ··· 367 368 ATH9K_TX_QUEUE_INACTIVE) 368 369 break; 369 370 if (q == pCap->total_queues) { 370 - ath_print(common, ATH_DBG_FATAL, 371 - "No available TX queue\n"); 371 + ath_err(common, "No available TX queue\n"); 372 372 return -1; 373 373 } 374 374 break; 375 375 default: 376 - ath_print(common, ATH_DBG_FATAL, 377 - "Invalid TX queue type: %u\n", type); 376 + ath_err(common, "Invalid TX queue type: %u\n", type); 378 377 return -1; 379 378 } 380 379 381 - ath_print(common, ATH_DBG_QUEUE, "Setup TX queue: %u\n", q); 380 + ath_dbg(common, ATH_DBG_QUEUE, "Setup TX queue: %u\n", q); 382 381 383 382 qi = &ah->txq[q]; 384 383 if (qi->tqi_type != ATH9K_TX_QUEUE_INACTIVE) { 385 - ath_print(common, ATH_DBG_FATAL, 386 - "TX queue: %u already active\n", q); 384 + ath_err(common, "TX queue: %u already active\n", q); 387 385 return -1; 388 386 } 389 387 memset(qi, 0, sizeof(struct ath9k_tx_queue_info)); ··· 412 416 struct ath9k_tx_queue_info *qi; 413 417 414 418 if (q >= pCap->total_queues) { 415 - ath_print(common, ATH_DBG_QUEUE, "Release TXQ, " 416 - "invalid queue: %u\n", q); 419 + ath_dbg(common, ATH_DBG_QUEUE, 420 + "Release TXQ, invalid queue: %u\n", q); 417 421 return false; 418 422 } 419 423 qi = &ah->txq[q]; 420 424 if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) { 421 - ath_print(common, ATH_DBG_QUEUE, "Release TXQ, " 422 - "inactive queue: %u\n", q); 425 + ath_dbg(common, ATH_DBG_QUEUE, 426 + "Release TXQ, inactive queue: %u\n", q); 423 427 return false; 424 428 } 425 429 426 - ath_print(common, ATH_DBG_QUEUE, "Release TX queue: %u\n", q); 430 + ath_dbg(common, ATH_DBG_QUEUE, "Release TX queue: %u\n", q); 427 431 428 432 qi->tqi_type = ATH9K_TX_QUEUE_INACTIVE; 429 433 ah->txok_interrupt_mask &= ~(1 << q); ··· 446 450 u32 cwMin, chanCwMin, value; 447 451 448 452 if (q >= pCap->total_queues) { 449 - ath_print(common, ATH_DBG_QUEUE, "Reset TXQ, " 450 - "invalid queue: %u\n", q); 453 + ath_dbg(common, ATH_DBG_QUEUE, 454 + "Reset TXQ, invalid queue: %u\n", q); 451 455 return false; 452 456 } 453 457 454 458 qi = &ah->txq[q]; 455 459 if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) { 456 - ath_print(common, ATH_DBG_QUEUE, "Reset TXQ, " 457 - "inactive queue: %u\n", q); 460 + ath_dbg(common, ATH_DBG_QUEUE, 461 + "Reset TXQ, inactive queue: %u\n", q); 458 462 return true; 459 463 } 460 464 461 - ath_print(common, ATH_DBG_QUEUE, "Reset TX queue: %u\n", q); 465 + ath_dbg(common, ATH_DBG_QUEUE, "Reset TX queue: %u\n", q); 462 466 463 467 if (qi->tqi_cwmin == ATH9K_TXQ_USEDEFAULT) { 464 468 if (chan && IS_CHAN_B(chan)) ··· 698 702 rs->rs_phyerr = phyerr; 699 703 } else if (ads.ds_rxstatus8 & AR_DecryptCRCErr) 700 704 rs->rs_status |= ATH9K_RXERR_DECRYPT; 701 - else if ((ads.ds_rxstatus8 & AR_MichaelErr) && 702 - rs->rs_keyix != ATH9K_RXKEYIX_INVALID) 705 + else if (ads.ds_rxstatus8 & AR_MichaelErr) 703 706 rs->rs_status |= ATH9K_RXERR_MIC; 704 707 else if (ads.ds_rxstatus8 & AR_KeyMiss) 705 708 rs->rs_status |= ATH9K_RXERR_DECRYPT; ··· 730 735 AR_DIAG_RX_ABORT)); 731 736 732 737 reg = REG_READ(ah, AR_OBS_BUS_1); 733 - ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, 734 - "RX failed to go idle in 10 ms RXSM=0x%x\n", 735 - reg); 738 + ath_err(ath9k_hw_common(ah), 739 + "RX failed to go idle in 10 ms RXSM=0x%x\n", 740 + reg); 736 741 737 742 return false; 738 743 } ··· 786 791 } 787 792 788 793 if (i == 0) { 789 - ath_print(common, ATH_DBG_FATAL, 790 - "DMA failed to stop in %d ms " 791 - "AR_CR=0x%08x AR_DIAG_SW=0x%08x\n", 792 - AH_RX_STOP_DMA_TIMEOUT / 1000, 793 - REG_READ(ah, AR_CR), 794 - REG_READ(ah, AR_DIAG_SW)); 794 + ath_err(common, 795 + "DMA failed to stop in %d ms AR_CR=0x%08x AR_DIAG_SW=0x%08x\n", 796 + AH_RX_STOP_DMA_TIMEOUT / 1000, 797 + REG_READ(ah, AR_CR), 798 + REG_READ(ah, AR_DIAG_SW)); 795 799 return false; 796 800 } else { 797 801 return true; ··· 838 844 { 839 845 struct ath_common *common = ath9k_hw_common(ah); 840 846 841 - ath_print(common, ATH_DBG_INTERRUPT, "disable IER\n"); 847 + ath_dbg(common, ATH_DBG_INTERRUPT, "disable IER\n"); 842 848 REG_WRITE(ah, AR_IER, AR_IER_DISABLE); 843 849 (void) REG_READ(ah, AR_IER); 844 850 if (!AR_SREV_9100(ah)) { ··· 858 864 if (!(ah->imask & ATH9K_INT_GLOBAL)) 859 865 return; 860 866 861 - ath_print(common, ATH_DBG_INTERRUPT, "enable IER\n"); 867 + ath_dbg(common, ATH_DBG_INTERRUPT, "enable IER\n"); 862 868 REG_WRITE(ah, AR_IER, AR_IER_ENABLE); 863 869 if (!AR_SREV_9100(ah)) { 864 870 REG_WRITE(ah, AR_INTR_ASYNC_ENABLE, ··· 871 877 REG_WRITE(ah, AR_INTR_SYNC_MASK, 872 878 AR_INTR_SYNC_DEFAULT); 873 879 } 874 - ath_print(common, ATH_DBG_INTERRUPT, "AR_IMR 0x%x IER 0x%x\n", 875 - REG_READ(ah, AR_IMR), REG_READ(ah, AR_IER)); 880 + ath_dbg(common, ATH_DBG_INTERRUPT, "AR_IMR 0x%x IER 0x%x\n", 881 + REG_READ(ah, AR_IMR), REG_READ(ah, AR_IER)); 876 882 } 877 883 EXPORT_SYMBOL(ath9k_hw_enable_interrupts); 878 884 ··· 886 892 if (!(ints & ATH9K_INT_GLOBAL)) 887 893 ath9k_hw_enable_interrupts(ah); 888 894 889 - ath_print(common, ATH_DBG_INTERRUPT, "0x%x => 0x%x\n", omask, ints); 895 + ath_dbg(common, ATH_DBG_INTERRUPT, "0x%x => 0x%x\n", omask, ints); 890 896 891 897 /* TODO: global int Ref count */ 892 898 mask = ints & ATH9K_INT_COMMON; ··· 947 953 mask2 |= AR_IMR_S2_CST; 948 954 } 949 955 950 - ath_print(common, ATH_DBG_INTERRUPT, "new IMR 0x%x\n", mask); 956 + ath_dbg(common, ATH_DBG_INTERRUPT, "new IMR 0x%x\n", mask); 951 957 REG_WRITE(ah, AR_IMR, mask); 952 958 ah->imrs2_reg &= ~(AR_IMR_S2_TIM | AR_IMR_S2_DTIM | AR_IMR_S2_DTIMSYNC | 953 959 AR_IMR_S2_CABEND | AR_IMR_S2_CABTO |
+101 -115
drivers/net/wireless/ath/ath9k/main.c
··· 246 246 * the relevant bits of the h/w. 247 247 */ 248 248 ath9k_hw_disable_interrupts(ah); 249 - ath_drain_all_txq(sc, false); 249 + stopped = ath_drain_all_txq(sc, false); 250 250 251 - stopped = ath_stoprecv(sc); 251 + if (!ath_stoprecv(sc)) 252 + stopped = false; 252 253 253 254 /* XXX: do not flush receive queue here. We don't want 254 255 * to flush data frames already in queue because of ··· 261 260 if (!(sc->sc_flags & SC_OP_OFFCHANNEL)) 262 261 caldata = &aphy->caldata; 263 262 264 - ath_print(common, ATH_DBG_CONFIG, 265 - "(%u MHz) -> (%u MHz), conf_is_ht40: %d fastcc: %d\n", 266 - sc->sc_ah->curchan->channel, 267 - channel->center_freq, conf_is_ht40(conf), 268 - fastcc); 263 + ath_dbg(common, ATH_DBG_CONFIG, 264 + "(%u MHz) -> (%u MHz), conf_is_ht40: %d fastcc: %d\n", 265 + sc->sc_ah->curchan->channel, 266 + channel->center_freq, conf_is_ht40(conf), 267 + fastcc); 269 268 270 269 r = ath9k_hw_reset(ah, hchan, caldata, fastcc); 271 270 if (r) { 272 - ath_print(common, ATH_DBG_FATAL, 273 - "Unable to reset channel (%u MHz), " 274 - "reset status %d\n", 275 - channel->center_freq, r); 271 + ath_err(common, 272 + "Unable to reset channel (%u MHz), reset status %d\n", 273 + channel->center_freq, r); 276 274 goto ps_restore; 277 275 } 278 276 279 277 if (ath_startrecv(sc) != 0) { 280 - ath_print(common, ATH_DBG_FATAL, 281 - "Unable to restart recv logic\n"); 278 + ath_err(common, "Unable to restart recv logic\n"); 282 279 r = -EIO; 283 280 goto ps_restore; 284 281 } ··· 388 389 msecs_to_jiffies(ATH_PAPRD_TIMEOUT)); 389 390 sc->paprd_pending = false; 390 391 if (!time_left) { 391 - ath_print(ath9k_hw_common(ah), ATH_DBG_CALIBRATE, 392 - "Timeout waiting for paprd training on " 393 - "TX chain %d\n", 394 - chain); 392 + ath_dbg(ath9k_hw_common(ah), ATH_DBG_CALIBRATE, 393 + "Timeout waiting for paprd training on TX chain %d\n", 394 + chain); 395 395 goto fail_paprd; 396 396 } 397 397 ··· 449 451 /* Long calibration runs independently of short calibration. */ 450 452 if ((timestamp - common->ani.longcal_timer) >= long_cal_interval) { 451 453 longcal = true; 452 - ath_print(common, ATH_DBG_ANI, "longcal @%lu\n", jiffies); 454 + ath_dbg(common, ATH_DBG_ANI, "longcal @%lu\n", jiffies); 453 455 common->ani.longcal_timer = timestamp; 454 456 } 455 457 ··· 457 459 if (!common->ani.caldone) { 458 460 if ((timestamp - common->ani.shortcal_timer) >= short_cal_interval) { 459 461 shortcal = true; 460 - ath_print(common, ATH_DBG_ANI, 461 - "shortcal @%lu\n", jiffies); 462 + ath_dbg(common, ATH_DBG_ANI, 463 + "shortcal @%lu\n", jiffies); 462 464 common->ani.shortcal_timer = timestamp; 463 465 common->ani.resetcal_timer = timestamp; 464 466 } ··· 542 544 common->rx_chainmask = 1; 543 545 } 544 546 545 - ath_print(common, ATH_DBG_CONFIG, 546 - "tx chmask: %d, rx chmask: %d\n", 547 - common->tx_chainmask, 548 - common->rx_chainmask); 547 + ath_dbg(common, ATH_DBG_CONFIG, 548 + "tx chmask: %d, rx chmask: %d\n", 549 + common->tx_chainmask, 550 + common->rx_chainmask); 549 551 } 550 552 551 553 static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta) ··· 641 643 * TSF sync does not look correct; remain awake to sync with 642 644 * the next Beacon. 643 645 */ 644 - ath_print(common, ATH_DBG_PS, 645 - "TSFOOR - Sync with next Beacon\n"); 646 + ath_dbg(common, ATH_DBG_PS, 647 + "TSFOOR - Sync with next Beacon\n"); 646 648 sc->ps_flags |= PS_WAIT_FOR_BEACON | PS_BEACON_SYNC; 647 649 } 648 650 ··· 766 768 767 769 if (!(ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) 768 770 if (status & ATH9K_INT_TIM_TIMER) { 771 + if (ATH_DBG_WARN_ON_ONCE(sc->ps_idle)) 772 + goto chip_reset; 769 773 /* Clear RxAbort bit so that we can 770 774 * receive frames */ 771 775 ath9k_setpower(sc, ATH9K_PM_AWAKE); ··· 842 842 struct ath_common *common = ath9k_hw_common(ah); 843 843 844 844 if (bss_conf->assoc) { 845 - ath_print(common, ATH_DBG_CONFIG, 846 - "Bss Info ASSOC %d, bssid: %pM\n", 847 - bss_conf->aid, common->curbssid); 845 + ath_dbg(common, ATH_DBG_CONFIG, 846 + "Bss Info ASSOC %d, bssid: %pM\n", 847 + bss_conf->aid, common->curbssid); 848 848 849 849 /* New association, store aid */ 850 850 common->curaid = bss_conf->aid; ··· 867 867 sc->sc_flags |= SC_OP_ANI_RUN; 868 868 ath_start_ani(common); 869 869 } else { 870 - ath_print(common, ATH_DBG_CONFIG, "Bss Info DISASSOC\n"); 870 + ath_dbg(common, ATH_DBG_CONFIG, "Bss Info DISASSOC\n"); 871 871 common->curaid = 0; 872 872 /* Stop ANI */ 873 873 sc->sc_flags &= ~SC_OP_ANI_RUN; ··· 892 892 893 893 r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); 894 894 if (r) { 895 - ath_print(common, ATH_DBG_FATAL, 896 - "Unable to reset channel (%u MHz), " 897 - "reset status %d\n", 898 - channel->center_freq, r); 895 + ath_err(common, 896 + "Unable to reset channel (%u MHz), reset status %d\n", 897 + channel->center_freq, r); 899 898 } 900 899 901 900 ath_update_txpow(sc); 902 901 if (ath_startrecv(sc) != 0) { 903 - ath_print(common, ATH_DBG_FATAL, 904 - "Unable to restart recv logic\n"); 902 + ath_err(common, "Unable to restart recv logic\n"); 905 903 spin_unlock_bh(&sc->sc_pcu_lock); 906 904 return; 907 905 } ··· 953 955 954 956 r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); 955 957 if (r) { 956 - ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, 957 - "Unable to reset channel (%u MHz), " 958 - "reset status %d\n", 959 - channel->center_freq, r); 958 + ath_err(ath9k_hw_common(sc->sc_ah), 959 + "Unable to reset channel (%u MHz), reset status %d\n", 960 + channel->center_freq, r); 960 961 } 961 962 962 963 ath9k_hw_phy_disable(ah); ··· 990 993 991 994 r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false); 992 995 if (r) 993 - ath_print(common, ATH_DBG_FATAL, 994 - "Unable to reset hardware; reset status %d\n", r); 996 + ath_err(common, 997 + "Unable to reset hardware; reset status %d\n", r); 995 998 996 999 if (ath_startrecv(sc) != 0) 997 - ath_print(common, ATH_DBG_FATAL, 998 - "Unable to start recv logic\n"); 1000 + ath_err(common, "Unable to start recv logic\n"); 999 1001 1000 1002 /* 1001 1003 * We may be doing a reset in response to a request ··· 1066 1070 struct ath9k_channel *init_channel; 1067 1071 int r; 1068 1072 1069 - ath_print(common, ATH_DBG_CONFIG, 1070 - "Starting driver with initial channel: %d MHz\n", 1071 - curchan->center_freq); 1073 + ath_dbg(common, ATH_DBG_CONFIG, 1074 + "Starting driver with initial channel: %d MHz\n", 1075 + curchan->center_freq); 1072 1076 1073 1077 mutex_lock(&sc->mutex); 1074 1078 ··· 1112 1116 spin_lock_bh(&sc->sc_pcu_lock); 1113 1117 r = ath9k_hw_reset(ah, init_channel, ah->caldata, false); 1114 1118 if (r) { 1115 - ath_print(common, ATH_DBG_FATAL, 1116 - "Unable to reset hardware; reset status %d " 1117 - "(freq %u MHz)\n", r, 1118 - curchan->center_freq); 1119 + ath_err(common, 1120 + "Unable to reset hardware; reset status %d (freq %u MHz)\n", 1121 + r, curchan->center_freq); 1119 1122 spin_unlock_bh(&sc->sc_pcu_lock); 1120 1123 goto mutex_unlock; 1121 1124 } ··· 1133 1138 * here except setup the interrupt mask. 1134 1139 */ 1135 1140 if (ath_startrecv(sc) != 0) { 1136 - ath_print(common, ATH_DBG_FATAL, 1137 - "Unable to start recv logic\n"); 1141 + ath_err(common, "Unable to start recv logic\n"); 1138 1142 r = -EIO; 1139 1143 spin_unlock_bh(&sc->sc_pcu_lock); 1140 1144 goto mutex_unlock; ··· 1182 1188 1183 1189 pm_qos_update_request(&sc->pm_qos_req, 55); 1184 1190 1191 + if (ah->caps.pcie_lcr_extsync_en && common->bus_ops->extn_synch_en) 1192 + common->bus_ops->extn_synch_en(common); 1193 + 1185 1194 mutex_unlock: 1186 1195 mutex_unlock(&sc->mutex); 1187 1196 ··· 1201 1204 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 1202 1205 1203 1206 if (aphy->state != ATH_WIPHY_ACTIVE && aphy->state != ATH_WIPHY_SCAN) { 1204 - ath_print(common, ATH_DBG_XMIT, 1205 - "ath9k: %s: TX in unexpected wiphy state " 1206 - "%d\n", wiphy_name(hw->wiphy), aphy->state); 1207 + ath_dbg(common, ATH_DBG_XMIT, 1208 + "ath9k: %s: TX in unexpected wiphy state %d\n", 1209 + wiphy_name(hw->wiphy), aphy->state); 1207 1210 goto exit; 1208 1211 } 1209 1212 ··· 1215 1218 if (ieee80211_is_data(hdr->frame_control) && 1216 1219 !ieee80211_is_nullfunc(hdr->frame_control) && 1217 1220 !ieee80211_has_pm(hdr->frame_control)) { 1218 - ath_print(common, ATH_DBG_PS, "Add PM=1 for a TX frame " 1219 - "while in PS mode\n"); 1221 + ath_dbg(common, ATH_DBG_PS, 1222 + "Add PM=1 for a TX frame while in PS mode\n"); 1220 1223 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); 1221 1224 } 1222 1225 } ··· 1231 1234 if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) 1232 1235 ath9k_hw_setrxabort(sc->sc_ah, 0); 1233 1236 if (ieee80211_is_pspoll(hdr->frame_control)) { 1234 - ath_print(common, ATH_DBG_PS, 1235 - "Sending PS-Poll to pick a buffered frame\n"); 1237 + ath_dbg(common, ATH_DBG_PS, 1238 + "Sending PS-Poll to pick a buffered frame\n"); 1236 1239 sc->ps_flags |= PS_WAIT_FOR_PSPOLL_DATA; 1237 1240 } else { 1238 - ath_print(common, ATH_DBG_PS, 1239 - "Wake up to complete TX\n"); 1241 + ath_dbg(common, ATH_DBG_PS, 1242 + "Wake up to complete TX\n"); 1240 1243 sc->ps_flags |= PS_WAIT_FOR_TX_ACK; 1241 1244 } 1242 1245 /* ··· 1250 1253 memset(&txctl, 0, sizeof(struct ath_tx_control)); 1251 1254 txctl.txq = sc->tx.txq_map[skb_get_queue_mapping(skb)]; 1252 1255 1253 - ath_print(common, ATH_DBG_XMIT, "transmitting packet, skb: %p\n", skb); 1256 + ath_dbg(common, ATH_DBG_XMIT, "transmitting packet, skb: %p\n", skb); 1254 1257 1255 1258 if (ath_tx_start(hw, skb, &txctl) != 0) { 1256 - ath_print(common, ATH_DBG_XMIT, "TX failed\n"); 1259 + ath_dbg(common, ATH_DBG_XMIT, "TX failed\n"); 1257 1260 goto exit; 1258 1261 } 1259 1262 ··· 1293 1296 } 1294 1297 1295 1298 if (sc->sc_flags & SC_OP_INVALID) { 1296 - ath_print(common, ATH_DBG_ANY, "Device not present\n"); 1299 + ath_dbg(common, ATH_DBG_ANY, "Device not present\n"); 1297 1300 mutex_unlock(&sc->mutex); 1298 1301 return; 1299 1302 } ··· 1342 1345 1343 1346 mutex_unlock(&sc->mutex); 1344 1347 1345 - ath_print(common, ATH_DBG_CONFIG, "Driver halt\n"); 1348 + ath_dbg(common, ATH_DBG_CONFIG, "Driver halt\n"); 1346 1349 } 1347 1350 1348 1351 static int ath9k_add_interface(struct ieee80211_hw *hw, ··· 1375 1378 ic_opmode = vif->type; 1376 1379 break; 1377 1380 default: 1378 - ath_print(common, ATH_DBG_FATAL, 1379 - "Interface type %d not yet supported\n", vif->type); 1381 + ath_err(common, "Interface type %d not yet supported\n", 1382 + vif->type); 1380 1383 ret = -EOPNOTSUPP; 1381 1384 goto out; 1382 1385 } 1383 1386 1384 - ath_print(common, ATH_DBG_CONFIG, 1385 - "Attach a VIF of type: %d\n", ic_opmode); 1387 + ath_dbg(common, ATH_DBG_CONFIG, 1388 + "Attach a VIF of type: %d\n", ic_opmode); 1386 1389 1387 1390 /* Set the VIF opmode */ 1388 1391 avp->av_opmode = ic_opmode; ··· 1435 1438 struct ath_softc *sc = aphy->sc; 1436 1439 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1437 1440 struct ath_vif *avp = (void *)vif->drv_priv; 1438 - bool bs_valid = false; 1439 - int i; 1440 1441 1441 - ath_print(common, ATH_DBG_CONFIG, "Detach Interface\n"); 1442 + ath_dbg(common, ATH_DBG_CONFIG, "Detach Interface\n"); 1442 1443 1443 1444 mutex_lock(&sc->mutex); 1444 1445 ··· 1448 1453 if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) || 1449 1454 (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) || 1450 1455 (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) { 1456 + /* Disable SWBA interrupt */ 1457 + sc->sc_ah->imask &= ~ATH9K_INT_SWBA; 1451 1458 ath9k_ps_wakeup(sc); 1459 + ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask); 1452 1460 ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); 1453 1461 ath9k_ps_restore(sc); 1462 + tasklet_kill(&sc->bcon_tasklet); 1454 1463 } 1455 1464 1456 1465 ath_beacon_return(sc, avp); 1457 1466 sc->sc_flags &= ~SC_OP_BEACONS; 1458 1467 1459 - for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) { 1460 - if (sc->beacon.bslot[i] == vif) { 1461 - printk(KERN_DEBUG "%s: vif had allocated beacon " 1462 - "slot\n", __func__); 1463 - sc->beacon.bslot[i] = NULL; 1464 - sc->beacon.bslot_aphy[i] = NULL; 1465 - } else if (sc->beacon.bslot[i]) 1466 - bs_valid = true; 1467 - } 1468 - if (!bs_valid && (sc->sc_ah->imask & ATH9K_INT_SWBA)) { 1469 - /* Disable SWBA interrupt */ 1470 - sc->sc_ah->imask &= ~ATH9K_INT_SWBA; 1468 + if (sc->nbcnvifs) { 1469 + /* Re-enable SWBA interrupt */ 1470 + sc->sc_ah->imask |= ATH9K_INT_SWBA; 1471 1471 ath9k_ps_wakeup(sc); 1472 1472 ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask); 1473 1473 ath9k_ps_restore(sc); ··· 1546 1556 if (enable_radio) { 1547 1557 sc->ps_idle = false; 1548 1558 ath_radio_enable(sc, hw); 1549 - ath_print(common, ATH_DBG_CONFIG, 1550 - "not-idle: enabling radio\n"); 1559 + ath_dbg(common, ATH_DBG_CONFIG, 1560 + "not-idle: enabling radio\n"); 1551 1561 } 1552 1562 } 1553 1563 ··· 1569 1579 1570 1580 if (changed & IEEE80211_CONF_CHANGE_MONITOR) { 1571 1581 if (conf->flags & IEEE80211_CONF_MONITOR) { 1572 - ath_print(common, ATH_DBG_CONFIG, 1573 - "Monitor mode is enabled\n"); 1582 + ath_dbg(common, ATH_DBG_CONFIG, 1583 + "Monitor mode is enabled\n"); 1574 1584 sc->sc_ah->is_monitoring = true; 1575 1585 } else { 1576 - ath_print(common, ATH_DBG_CONFIG, 1577 - "Monitor mode is disabled\n"); 1586 + ath_dbg(common, ATH_DBG_CONFIG, 1587 + "Monitor mode is disabled\n"); 1578 1588 sc->sc_ah->is_monitoring = false; 1579 1589 } 1580 1590 } ··· 1606 1616 goto skip_chan_change; 1607 1617 } 1608 1618 1609 - ath_print(common, ATH_DBG_CONFIG, "Set channel: %d MHz\n", 1610 - curchan->center_freq); 1619 + ath_dbg(common, ATH_DBG_CONFIG, "Set channel: %d MHz\n", 1620 + curchan->center_freq); 1611 1621 1612 1622 /* XXX: remove me eventualy */ 1613 1623 ath9k_update_ichannel(sc, hw, &sc->sc_ah->channels[pos]); ··· 1640 1650 } 1641 1651 1642 1652 if (ath_set_channel(sc, hw, &sc->sc_ah->channels[pos]) < 0) { 1643 - ath_print(common, ATH_DBG_FATAL, 1644 - "Unable to set channel\n"); 1653 + ath_err(common, "Unable to set channel\n"); 1645 1654 mutex_unlock(&sc->mutex); 1646 1655 return -EINVAL; 1647 1656 } ··· 1665 1676 spin_unlock_bh(&sc->wiphy_lock); 1666 1677 1667 1678 if (disable_radio) { 1668 - ath_print(common, ATH_DBG_CONFIG, "idle: disabling radio\n"); 1679 + ath_dbg(common, ATH_DBG_CONFIG, "idle: disabling radio\n"); 1669 1680 sc->ps_idle = true; 1670 1681 ath_radio_disable(sc, hw); 1671 1682 } ··· 1704 1715 ath9k_hw_setrxfilter(sc->sc_ah, rfilt); 1705 1716 ath9k_ps_restore(sc); 1706 1717 1707 - ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_CONFIG, 1708 - "Set HW RX filter: 0x%x\n", rfilt); 1718 + ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_CONFIG, 1719 + "Set HW RX filter: 0x%x\n", rfilt); 1709 1720 } 1710 1721 1711 1722 static int ath9k_sta_add(struct ieee80211_hw *hw, ··· 1756 1767 qi.tqi_cwmax = params->cw_max; 1757 1768 qi.tqi_burstTime = params->txop; 1758 1769 1759 - ath_print(common, ATH_DBG_CONFIG, 1760 - "Configure tx [queue/halq] [%d/%d], " 1761 - "aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n", 1762 - queue, txq->axq_qnum, params->aifs, params->cw_min, 1763 - params->cw_max, params->txop); 1770 + ath_dbg(common, ATH_DBG_CONFIG, 1771 + "Configure tx [queue/halq] [%d/%d], aifs: %d, cw_min: %d, cw_max: %d, txop: %d\n", 1772 + queue, txq->axq_qnum, params->aifs, params->cw_min, 1773 + params->cw_max, params->txop); 1764 1774 1765 1775 ret = ath_txq_update(sc, txq->axq_qnum, &qi); 1766 1776 if (ret) 1767 - ath_print(common, ATH_DBG_FATAL, "TXQ Update failed\n"); 1777 + ath_err(common, "TXQ Update failed\n"); 1768 1778 1769 1779 if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) 1770 1780 if (queue == WME_AC_BE && !ret) ··· 1790 1802 1791 1803 mutex_lock(&sc->mutex); 1792 1804 ath9k_ps_wakeup(sc); 1793 - ath_print(common, ATH_DBG_CONFIG, "Set HW Key\n"); 1805 + ath_dbg(common, ATH_DBG_CONFIG, "Set HW Key\n"); 1794 1806 1795 1807 switch (cmd) { 1796 1808 case SET_KEY: ··· 1849 1861 if (vif->type == NL80211_IFTYPE_ADHOC) 1850 1862 ath_update_chainmask(sc, 0); 1851 1863 1852 - ath_print(common, ATH_DBG_CONFIG, 1853 - "BSSID: %pM aid: 0x%x\n", 1854 - common->curbssid, common->curaid); 1864 + ath_dbg(common, ATH_DBG_CONFIG, "BSSID: %pM aid: 0x%x\n", 1865 + common->curbssid, common->curaid); 1855 1866 1856 1867 /* need to reconfigure the beacon */ 1857 1868 sc->sc_flags &= ~SC_OP_BEACONS ; ··· 1906 1919 } 1907 1920 1908 1921 if (changed & BSS_CHANGED_ERP_PREAMBLE) { 1909 - ath_print(common, ATH_DBG_CONFIG, "BSS Changed PREAMBLE %d\n", 1910 - bss_conf->use_short_preamble); 1922 + ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed PREAMBLE %d\n", 1923 + bss_conf->use_short_preamble); 1911 1924 if (bss_conf->use_short_preamble) 1912 1925 sc->sc_flags |= SC_OP_PREAMBLE_SHORT; 1913 1926 else ··· 1915 1928 } 1916 1929 1917 1930 if (changed & BSS_CHANGED_ERP_CTS_PROT) { 1918 - ath_print(common, ATH_DBG_CONFIG, "BSS Changed CTS PROT %d\n", 1919 - bss_conf->use_cts_prot); 1931 + ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed CTS PROT %d\n", 1932 + bss_conf->use_cts_prot); 1920 1933 if (bss_conf->use_cts_prot && 1921 1934 hw->conf.channel->band != IEEE80211_BAND_5GHZ) 1922 1935 sc->sc_flags |= SC_OP_PROTECT_ENABLE; ··· 1925 1938 } 1926 1939 1927 1940 if (changed & BSS_CHANGED_ASSOC) { 1928 - ath_print(common, ATH_DBG_CONFIG, "BSS Changed ASSOC %d\n", 1941 + ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed ASSOC %d\n", 1929 1942 bss_conf->assoc); 1930 1943 ath9k_bss_assoc_info(sc, hw, vif, bss_conf); 1931 1944 } ··· 2011 2024 ath9k_ps_restore(sc); 2012 2025 break; 2013 2026 default: 2014 - ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, 2015 - "Unknown AMPDU action\n"); 2027 + ath_err(ath9k_hw_common(sc->sc_ah), "Unknown AMPDU action\n"); 2016 2028 } 2017 2029 2018 2030 local_bh_enable();
+16 -4
drivers/net/wireless/ath/ath9k/pci.c
··· 30 30 { PCI_VDEVICE(ATHEROS, 0x002D) }, /* PCI */ 31 31 { PCI_VDEVICE(ATHEROS, 0x002E) }, /* PCI-E */ 32 32 { PCI_VDEVICE(ATHEROS, 0x0030) }, /* PCI-E AR9300 */ 33 + { PCI_VDEVICE(ATHEROS, 0x0032) }, /* PCI-E AR9485 */ 33 34 { 0 } 34 35 }; 35 36 ··· 60 59 61 60 if (pdata) { 62 61 if (off >= (ARRAY_SIZE(pdata->eeprom_data))) { 63 - ath_print(common, ATH_DBG_FATAL, 64 - "%s: eeprom read failed, offset %08x " 65 - "is out of range\n", 66 - __func__, off); 62 + ath_err(common, 63 + "%s: eeprom read failed, offset %08x is out of range\n", 64 + __func__, off); 67 65 } 68 66 69 67 *data = pdata->eeprom_data[off]; ··· 104 104 pci_write_config_byte(pdev, ATH_PCIE_CAP_LINK_CTRL, aspm); 105 105 } 106 106 107 + static void ath_pci_extn_synch_enable(struct ath_common *common) 108 + { 109 + struct ath_softc *sc = (struct ath_softc *) common->priv; 110 + struct pci_dev *pdev = to_pci_dev(sc->dev); 111 + u8 lnkctl; 112 + 113 + pci_read_config_byte(pdev, sc->sc_ah->caps.pcie_lcr_offset, &lnkctl); 114 + lnkctl |= PCI_EXP_LNKCTL_ES; 115 + pci_write_config_byte(pdev, sc->sc_ah->caps.pcie_lcr_offset, lnkctl); 116 + } 117 + 107 118 static const struct ath_bus_ops ath_pci_bus_ops = { 108 119 .ath_bus_type = ATH_PCI, 109 120 .read_cachesize = ath_pci_read_cachesize, 110 121 .eeprom_read = ath_pci_eeprom_read, 111 122 .bt_coex_prep = ath_pci_bt_coex_prep, 123 + .extn_synch_en = ath_pci_extn_synch_enable, 112 124 }; 113 125 114 126 static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+1
drivers/net/wireless/ath/ath9k/phy.h
··· 19 19 20 20 #define CHANSEL_DIV 15 21 21 #define CHANSEL_2G(_freq) (((_freq) * 0x10000) / CHANSEL_DIV) 22 + #define CHANSEL_2G_9485(_freq) ((((_freq) * 0x10000) - 215) / CHANSEL_DIV) 22 23 #define CHANSEL_5G(_freq) (((_freq) * 0x8000) / CHANSEL_DIV) 23 24 24 25 #define AR_PHY_BASE 0x9800
+9 -9
drivers/net/wireless/ath/ath9k/rc.c
··· 1184 1184 return &ar5416_11na_ratetable; 1185 1185 return &ar5416_11a_ratetable; 1186 1186 default: 1187 - ath_print(common, ATH_DBG_CONFIG, "Invalid band\n"); 1187 + ath_dbg(common, ATH_DBG_CONFIG, "Invalid band\n"); 1188 1188 return NULL; 1189 1189 } 1190 1190 } ··· 1259 1259 ath_rc_priv->rate_max_phy = ath_rc_priv->valid_rate_index[k-4]; 1260 1260 ath_rc_priv->rate_table = rate_table; 1261 1261 1262 - ath_print(common, ATH_DBG_CONFIG, 1263 - "RC Initialized with capabilities: 0x%x\n", 1264 - ath_rc_priv->ht_cap); 1262 + ath_dbg(common, ATH_DBG_CONFIG, 1263 + "RC Initialized with capabilities: 0x%x\n", 1264 + ath_rc_priv->ht_cap); 1265 1265 } 1266 1266 1267 1267 static u8 ath_rc_build_ht_caps(struct ath_softc *sc, struct ieee80211_sta *sta, ··· 1463 1463 oper_cw40, oper_sgi); 1464 1464 ath_rc_init(sc, priv_sta, sband, sta, rate_table); 1465 1465 1466 - ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_CONFIG, 1467 - "Operating HT Bandwidth changed to: %d\n", 1468 - sc->hw->conf.channel_type); 1466 + ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_CONFIG, 1467 + "Operating HT Bandwidth changed to: %d\n", 1468 + sc->hw->conf.channel_type); 1469 1469 } 1470 1470 } 1471 1471 } ··· 1576 1576 1577 1577 rate_priv = kzalloc(sizeof(struct ath_rate_priv), gfp); 1578 1578 if (!rate_priv) { 1579 - ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, 1580 - "Unable to allocate private rc structure\n"); 1579 + ath_err(ath9k_hw_common(sc->sc_ah), 1580 + "Unable to allocate private rc structure\n"); 1581 1581 return NULL; 1582 1582 } 1583 1583
+45 -36
drivers/net/wireless/ath/ath9k/recv.c
··· 165 165 u32 nbuf = 0; 166 166 167 167 if (list_empty(&sc->rx.rxbuf)) { 168 - ath_print(common, ATH_DBG_QUEUE, "No free rx buf available\n"); 168 + ath_dbg(common, ATH_DBG_QUEUE, "No free rx buf available\n"); 169 169 return; 170 170 } 171 171 ··· 269 269 dev_kfree_skb_any(skb); 270 270 bf->bf_mpdu = NULL; 271 271 bf->bf_buf_addr = 0; 272 - ath_print(common, ATH_DBG_FATAL, 272 + ath_err(common, 273 273 "dma_mapping_error() on RX init\n"); 274 274 error = -ENOMEM; 275 275 goto rx_init_fail; ··· 327 327 common->rx_bufsize = roundup(IEEE80211_MAX_MPDU_LEN, 328 328 min(common->cachelsz, (u16)64)); 329 329 330 - ath_print(common, ATH_DBG_CONFIG, "cachelsz %u rxbufsize %u\n", 331 - common->cachelsz, common->rx_bufsize); 330 + ath_dbg(common, ATH_DBG_CONFIG, "cachelsz %u rxbufsize %u\n", 331 + common->cachelsz, common->rx_bufsize); 332 332 333 333 /* Initialize rx descriptors */ 334 334 335 335 error = ath_descdma_setup(sc, &sc->rx.rxdma, &sc->rx.rxbuf, 336 336 "rx", nbufs, 1, 0); 337 337 if (error != 0) { 338 - ath_print(common, ATH_DBG_FATAL, 339 - "failed to allocate rx descriptors: %d\n", 340 - error); 338 + ath_err(common, 339 + "failed to allocate rx descriptors: %d\n", 340 + error); 341 341 goto err; 342 342 } 343 343 ··· 358 358 dev_kfree_skb_any(skb); 359 359 bf->bf_mpdu = NULL; 360 360 bf->bf_buf_addr = 0; 361 - ath_print(common, ATH_DBG_FATAL, 362 - "dma_mapping_error() on RX init\n"); 361 + ath_err(common, 362 + "dma_mapping_error() on RX init\n"); 363 363 error = -ENOMEM; 364 364 goto err; 365 365 } ··· 528 528 sc->rx.rxlink = NULL; 529 529 spin_unlock_bh(&sc->rx.rxbuflock); 530 530 531 - ATH_DBG_WARN(!stopped, "Could not stop RX, we could be " 532 - "confusing the DMA engine when we start RX up\n"); 531 + if (unlikely(!stopped)) { 532 + ath_err(ath9k_hw_common(sc->sc_ah), 533 + "Could not stop RX, we could be " 534 + "confusing the DMA engine when we start RX up\n"); 535 + ATH_DBG_WARN_ON_ONCE(!stopped); 536 + } 533 537 return stopped; 534 538 } 535 539 ··· 594 590 595 591 if (sc->ps_flags & PS_BEACON_SYNC) { 596 592 sc->ps_flags &= ~PS_BEACON_SYNC; 597 - ath_print(common, ATH_DBG_PS, 598 - "Reconfigure Beacon timers based on " 599 - "timestamp from the AP\n"); 593 + ath_dbg(common, ATH_DBG_PS, 594 + "Reconfigure Beacon timers based on timestamp from the AP\n"); 600 595 ath_beacon_config(sc, NULL); 601 596 } 602 597 ··· 607 604 * a backup trigger for returning into NETWORK SLEEP state, 608 605 * so we are waiting for it as well. 609 606 */ 610 - ath_print(common, ATH_DBG_PS, "Received DTIM beacon indicating " 611 - "buffered broadcast/multicast frame(s)\n"); 607 + ath_dbg(common, ATH_DBG_PS, 608 + "Received DTIM beacon indicating buffered broadcast/multicast frame(s)\n"); 612 609 sc->ps_flags |= PS_WAIT_FOR_CAB | PS_WAIT_FOR_BEACON; 613 610 return; 614 611 } ··· 620 617 * been delivered. 621 618 */ 622 619 sc->ps_flags &= ~PS_WAIT_FOR_CAB; 623 - ath_print(common, ATH_DBG_PS, 624 - "PS wait for CAB frames timed out\n"); 620 + ath_dbg(common, ATH_DBG_PS, 621 + "PS wait for CAB frames timed out\n"); 625 622 } 626 623 } 627 624 ··· 646 643 * point. 647 644 */ 648 645 sc->ps_flags &= ~(PS_WAIT_FOR_CAB | PS_WAIT_FOR_BEACON); 649 - ath_print(common, ATH_DBG_PS, 650 - "All PS CAB frames received, back to sleep\n"); 646 + ath_dbg(common, ATH_DBG_PS, 647 + "All PS CAB frames received, back to sleep\n"); 651 648 } else if ((sc->ps_flags & PS_WAIT_FOR_PSPOLL_DATA) && 652 649 !is_multicast_ether_addr(hdr->addr1) && 653 650 !ieee80211_has_morefrags(hdr->frame_control)) { 654 651 sc->ps_flags &= ~PS_WAIT_FOR_PSPOLL_DATA; 655 - ath_print(common, ATH_DBG_PS, 656 - "Going back to sleep after having received " 657 - "PS-Poll data (0x%lx)\n", 652 + ath_dbg(common, ATH_DBG_PS, 653 + "Going back to sleep after having received PS-Poll data (0x%lx)\n", 658 654 sc->ps_flags & (PS_WAIT_FOR_BEACON | 659 655 PS_WAIT_FOR_CAB | 660 656 PS_WAIT_FOR_PSPOLL_DATA | ··· 662 660 } 663 661 664 662 static void ath_rx_send_to_mac80211(struct ieee80211_hw *hw, 665 - struct ath_softc *sc, struct sk_buff *skb, 666 - struct ieee80211_rx_status *rxs) 663 + struct ath_softc *sc, struct sk_buff *skb) 667 664 { 668 665 struct ieee80211_hdr *hdr; 669 666 ··· 841 840 struct ath_rx_status *rx_stats, 842 841 bool *decrypt_error) 843 842 { 843 + #define is_mc_or_valid_tkip_keyix ((is_mc || \ 844 + (rx_stats->rs_keyix != ATH9K_RXKEYIX_INVALID && \ 845 + test_bit(rx_stats->rs_keyix, common->tkip_keymap)))) 846 + 844 847 struct ath_hw *ah = common->ah; 845 848 __le16 fc; 846 849 u8 rx_status_len = ah->caps.rx_status_len; ··· 886 881 if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) { 887 882 *decrypt_error = true; 888 883 } else if (rx_stats->rs_status & ATH9K_RXERR_MIC) { 884 + bool is_mc; 889 885 /* 890 886 * The MIC error bit is only valid if the frame 891 887 * is not a control frame or fragment, and it was 892 888 * decrypted using a valid TKIP key. 893 889 */ 890 + is_mc = !!is_multicast_ether_addr(hdr->addr1); 891 + 894 892 if (!ieee80211_is_ctl(fc) && 895 893 !ieee80211_has_morefrags(fc) && 896 894 !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) && 897 - test_bit(rx_stats->rs_keyix, common->tkip_keymap)) 895 + is_mc_or_valid_tkip_keyix) 898 896 rxs->flag |= RX_FLAG_MMIC_ERROR; 899 897 else 900 898 rx_stats->rs_status &= ~ATH9K_RXERR_MIC; ··· 961 953 * No valid hardware bitrate found -- we should not get here 962 954 * because hardware has already validated this frame as OK. 963 955 */ 964 - ath_print(common, ATH_DBG_XMIT, "unsupported hw bitrate detected " 965 - "0x%02x using 1 Mbit\n", rx_stats->rs_rate); 956 + ath_dbg(common, ATH_DBG_XMIT, 957 + "unsupported hw bitrate detected 0x%02x using 1 Mbit\n", 958 + rx_stats->rs_rate); 966 959 967 960 return -EINVAL; 968 961 } ··· 1627 1618 struct ath_hw *ah = sc->sc_ah; 1628 1619 struct ath_common *common = ath9k_hw_common(ah); 1629 1620 /* 1630 - * The hw can techncically differ from common->hw when using ath9k 1621 + * The hw can technically differ from common->hw when using ath9k 1631 1622 * virtual wiphy so to account for that we iterate over the active 1632 1623 * wiphys and find the appropriate wiphy and therefore hw. 1633 1624 */ ··· 1734 1725 dev_kfree_skb_any(requeue_skb); 1735 1726 bf->bf_mpdu = NULL; 1736 1727 bf->bf_buf_addr = 0; 1737 - ath_print(common, ATH_DBG_FATAL, 1738 - "dma_mapping_error() on RX\n"); 1739 - ath_rx_send_to_mac80211(hw, sc, skb, rxs); 1728 + ath_err(common, "dma_mapping_error() on RX\n"); 1729 + ath_rx_send_to_mac80211(hw, sc, skb); 1740 1730 break; 1741 1731 } 1742 1732 ··· 1751 1743 } 1752 1744 1753 1745 spin_lock_irqsave(&sc->sc_pm_lock, flags); 1754 - if (unlikely(ath9k_check_auto_sleep(sc) || 1755 - (sc->ps_flags & (PS_WAIT_FOR_BEACON | 1746 + 1747 + if ((sc->ps_flags & (PS_WAIT_FOR_BEACON | 1756 1748 PS_WAIT_FOR_CAB | 1757 - PS_WAIT_FOR_PSPOLL_DATA)))) 1749 + PS_WAIT_FOR_PSPOLL_DATA)) || 1750 + unlikely(ath9k_check_auto_sleep(sc))) 1758 1751 ath_rx_ps(sc, skb); 1759 1752 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); 1760 1753 1761 1754 if (ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB) 1762 1755 ath_ant_comb_scan(sc, &rs); 1763 1756 1764 - ath_rx_send_to_mac80211(hw, sc, skb, rxs); 1757 + ath_rx_send_to_mac80211(hw, sc, skb); 1765 1758 1766 1759 requeue: 1767 1760 if (edma) {
+17 -1
drivers/net/wireless/ath/ath9k/reg.h
··· 787 787 #define AR_SREV_REVISION_9271_11 1 788 788 #define AR_SREV_VERSION_9300 0x1c0 789 789 #define AR_SREV_REVISION_9300_20 2 /* 2.0 and 2.1 */ 790 + #define AR_SREV_VERSION_9485 0x240 791 + #define AR_SREV_REVISION_9485_10 0 790 792 791 793 #define AR_SREV_5416(_ah) \ 792 794 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_5416_PCI) || \ ··· 861 859 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9300) && \ 862 860 ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9300_20))) 863 861 862 + #define AR_SREV_9485(_ah) \ 863 + (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9485)) 864 + #define AR_SREV_9485_10(_ah) \ 865 + (AR_SREV_9485(_ah) && \ 866 + ((_ah)->hw_version.macRev == AR_SREV_REVISION_9485_10)) 867 + 864 868 #define AR_SREV_9285E_20(_ah) \ 865 869 (AR_SREV_9285_12_OR_LATER(_ah) && \ 866 870 ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1)) 867 871 872 + enum ath_usb_dev { 873 + AR9280_USB = 1, /* AR7010 + AR9280, UB94 */ 874 + AR9287_USB = 2, /* AR7010 + AR9287, UB95 */ 875 + }; 876 + 868 877 #define AR_DEVID_7010(_ah) \ 869 - ((_ah)->common.driver_info & AR7010_DEVICE) 878 + (((_ah)->hw_version.usbdev == AR9280_USB) || \ 879 + ((_ah)->hw_version.usbdev == AR9287_USB)) 870 880 871 881 #define AR_RADIO_SREV_MAJOR 0xf0 872 882 #define AR_RAD5133_SREV_MAJOR 0xc0 ··· 1119 1105 1120 1106 #define AR_RTC_PLL_CONTROL \ 1121 1107 ((AR_SREV_9100(ah)) ? (AR_RTC_BASE + 0x0014) : 0x7014) 1108 + 1109 + #define AR_RTC_PLL_CONTROL2 0x703c 1122 1110 1123 1111 #define AR_RTC_PLL_DIV 0x0000001f 1124 1112 #define AR_RTC_PLL_DIV_S 0
+3 -4
drivers/net/wireless/ath/ath9k/virtual.c
··· 656 656 struct ath_softc *sc = aphy->sc; 657 657 658 658 aphy->idle = idle; 659 - ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_CONFIG, 660 - "Marking %s as %s\n", 661 - wiphy_name(aphy->hw->wiphy), 662 - idle ? "idle" : "not-idle"); 659 + ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_CONFIG, 660 + "Marking %s as %sidle\n", 661 + wiphy_name(aphy->hw->wiphy), idle ? "" : "not-"); 663 662 } 664 663 /* Only bother starting a queue on an active virtual wiphy */ 665 664 bool ath_mac80211_start_queue(struct ath_softc *sc, u16 skb_queue)
+6 -6
drivers/net/wireless/ath/ath9k/wmi.c
··· 125 125 struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *)data; 126 126 struct ath_common *common = ath9k_hw_common(priv->ah); 127 127 128 - ath_print(common, ATH_DBG_WMI, "SWBA Event received\n"); 128 + ath_dbg(common, ATH_DBG_WMI, "SWBA Event received\n"); 129 129 130 130 ath9k_htc_swba(priv, priv->wmi->beacon_pending); 131 131 ··· 286 286 287 287 time_left = wait_for_completion_timeout(&wmi->cmd_wait, timeout); 288 288 if (!time_left) { 289 - ath_print(common, ATH_DBG_WMI, 290 - "Timeout waiting for WMI command: %s\n", 291 - wmi_cmd_to_name(cmd_id)); 289 + ath_dbg(common, ATH_DBG_WMI, 290 + "Timeout waiting for WMI command: %s\n", 291 + wmi_cmd_to_name(cmd_id)); 292 292 mutex_unlock(&wmi->op_mutex); 293 293 return -ETIMEDOUT; 294 294 } ··· 298 298 return 0; 299 299 300 300 out: 301 - ath_print(common, ATH_DBG_WMI, 302 - "WMI failure for: %s\n", wmi_cmd_to_name(cmd_id)); 301 + ath_dbg(common, ATH_DBG_WMI, 302 + "WMI failure for: %s\n", wmi_cmd_to_name(cmd_id)); 303 303 mutex_unlock(&wmi->op_mutex); 304 304 kfree_skb(skb); 305 305
+45 -55
drivers/net/wireless/ath/ath9k/xmit.c
··· 985 985 return NULL; 986 986 } 987 987 if (qnum >= ARRAY_SIZE(sc->tx.txq)) { 988 - ath_print(common, ATH_DBG_FATAL, 989 - "qnum %u out of range, max %u!\n", 990 - qnum, (unsigned int)ARRAY_SIZE(sc->tx.txq)); 988 + ath_err(common, "qnum %u out of range, max %zu!\n", 989 + qnum, ARRAY_SIZE(sc->tx.txq)); 991 990 ath9k_hw_releasetxqueue(ah, qnum); 992 991 return NULL; 993 992 } ··· 1037 1038 qi.tqi_readyTime = qinfo->tqi_readyTime; 1038 1039 1039 1040 if (!ath9k_hw_set_txq_props(ah, qnum, &qi)) { 1040 - ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, 1041 - "Unable to update hardware queue %u!\n", qnum); 1041 + ath_err(ath9k_hw_common(sc->sc_ah), 1042 + "Unable to update hardware queue %u!\n", qnum); 1042 1043 error = -EIO; 1043 1044 } else { 1044 1045 ath9k_hw_resettxqueue(ah, qnum); ··· 1171 1172 } 1172 1173 } 1173 1174 1174 - void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) 1175 + bool ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) 1175 1176 { 1176 1177 struct ath_hw *ah = sc->sc_ah; 1177 1178 struct ath_common *common = ath9k_hw_common(sc->sc_ah); ··· 1179 1180 int i, npend = 0; 1180 1181 1181 1182 if (sc->sc_flags & SC_OP_INVALID) 1182 - return; 1183 + return true; 1183 1184 1184 1185 /* Stop beacon queue */ 1185 1186 ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); ··· 1193 1194 } 1194 1195 } 1195 1196 1196 - if (npend) { 1197 - int r; 1198 - 1199 - ath_print(common, ATH_DBG_FATAL, 1200 - "Failed to stop TX DMA. Resetting hardware!\n"); 1201 - 1202 - r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false); 1203 - if (r) 1204 - ath_print(common, ATH_DBG_FATAL, 1205 - "Unable to reset hardware; reset status %d\n", 1206 - r); 1207 - } 1197 + if (npend) 1198 + ath_err(common, "Failed to stop TX DMA!\n"); 1208 1199 1209 1200 for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { 1210 1201 if (ATH_TXQ_SETUP(sc, i)) 1211 1202 ath_draintxq(sc, &sc->tx.txq[i], retry_tx); 1212 1203 } 1204 + 1205 + return !npend; 1213 1206 } 1214 1207 1215 1208 void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq) ··· 1278 1287 1279 1288 bf = list_first_entry(head, struct ath_buf, list); 1280 1289 1281 - ath_print(common, ATH_DBG_QUEUE, 1282 - "qnum: %d, txq depth: %d\n", txq->axq_qnum, txq->axq_depth); 1290 + ath_dbg(common, ATH_DBG_QUEUE, 1291 + "qnum: %d, txq depth: %d\n", txq->axq_qnum, txq->axq_depth); 1283 1292 1284 1293 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { 1285 1294 if (txq->axq_depth >= ATH_TXFIFO_DEPTH) { ··· 1287 1296 return; 1288 1297 } 1289 1298 if (!list_empty(&txq->txq_fifo[txq->txq_headidx])) 1290 - ath_print(common, ATH_DBG_XMIT, 1291 - "Initializing tx fifo %d which " 1292 - "is non-empty\n", 1293 - txq->txq_headidx); 1299 + ath_dbg(common, ATH_DBG_XMIT, 1300 + "Initializing tx fifo %d which is non-empty\n", 1301 + txq->txq_headidx); 1294 1302 INIT_LIST_HEAD(&txq->txq_fifo[txq->txq_headidx]); 1295 1303 list_splice_init(head, &txq->txq_fifo[txq->txq_headidx]); 1296 1304 INCR(txq->txq_headidx, ATH_TXFIFO_DEPTH); 1297 1305 ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr); 1298 - ath_print(common, ATH_DBG_XMIT, 1299 - "TXDP[%u] = %llx (%p)\n", 1300 - txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc); 1306 + ath_dbg(common, ATH_DBG_XMIT, "TXDP[%u] = %llx (%p)\n", 1307 + txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc); 1301 1308 } else { 1302 1309 list_splice_tail_init(head, &txq->axq_q); 1303 1310 1304 1311 if (txq->axq_link == NULL) { 1305 1312 ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr); 1306 - ath_print(common, ATH_DBG_XMIT, 1307 - "TXDP[%u] = %llx (%p)\n", 1308 - txq->axq_qnum, ito64(bf->bf_daddr), 1309 - bf->bf_desc); 1313 + ath_dbg(common, ATH_DBG_XMIT, "TXDP[%u] = %llx (%p)\n", 1314 + txq->axq_qnum, ito64(bf->bf_daddr), 1315 + bf->bf_desc); 1310 1316 } else { 1311 1317 *txq->axq_link = bf->bf_daddr; 1312 - ath_print(common, ATH_DBG_XMIT, 1313 - "link[%u] (%p)=%llx (%p)\n", 1314 - txq->axq_qnum, txq->axq_link, 1315 - ito64(bf->bf_daddr), bf->bf_desc); 1318 + ath_dbg(common, ATH_DBG_XMIT, 1319 + "link[%u] (%p)=%llx (%p)\n", 1320 + txq->axq_qnum, txq->axq_link, 1321 + ito64(bf->bf_daddr), bf->bf_desc); 1316 1322 } 1317 1323 ath9k_hw_get_desc_link(ah, bf->bf_lastbf->bf_desc, 1318 1324 &txq->axq_link); ··· 1636 1648 1637 1649 bf = ath_tx_get_buffer(sc); 1638 1650 if (!bf) { 1639 - ath_print(common, ATH_DBG_XMIT, "TX buffers are full\n"); 1651 + ath_dbg(common, ATH_DBG_XMIT, "TX buffers are full\n"); 1640 1652 return NULL; 1641 1653 } 1642 1654 ··· 1651 1663 if (unlikely(dma_mapping_error(sc->dev, bf->bf_buf_addr))) { 1652 1664 bf->bf_mpdu = NULL; 1653 1665 bf->bf_buf_addr = 0; 1654 - ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, 1655 - "dma_mapping_error() on TX\n"); 1666 + ath_err(ath9k_hw_common(sc->sc_ah), 1667 + "dma_mapping_error() on TX\n"); 1656 1668 ath_tx_return_buffer(sc, bf); 1657 1669 return NULL; 1658 1670 } ··· 1733 1745 int frmlen = skb->len + FCS_LEN; 1734 1746 int q; 1735 1747 1736 - txctl->an = (struct ath_node *)sta->drv_priv; 1748 + /* NOTE: sta can be NULL according to net/mac80211.h */ 1749 + if (sta) 1750 + txctl->an = (struct ath_node *)sta->drv_priv; 1751 + 1737 1752 if (info->control.hw_key) 1738 1753 frmlen += info->control.hw_key->icv_len; 1739 1754 ··· 1802 1811 struct ieee80211_hdr * hdr = (struct ieee80211_hdr *)skb->data; 1803 1812 int q, padpos, padsize; 1804 1813 1805 - ath_print(common, ATH_DBG_XMIT, "TX complete: skb: %p\n", skb); 1814 + ath_dbg(common, ATH_DBG_XMIT, "TX complete: skb: %p\n", skb); 1806 1815 1807 1816 if (aphy) 1808 1817 hw = aphy->hw; ··· 1828 1837 1829 1838 if (sc->ps_flags & PS_WAIT_FOR_TX_ACK) { 1830 1839 sc->ps_flags &= ~PS_WAIT_FOR_TX_ACK; 1831 - ath_print(common, ATH_DBG_PS, 1832 - "Going back to sleep after having " 1833 - "received TX status (0x%lx)\n", 1840 + ath_dbg(common, ATH_DBG_PS, 1841 + "Going back to sleep after having received TX status (0x%lx)\n", 1834 1842 sc->ps_flags & (PS_WAIT_FOR_BEACON | 1835 1843 PS_WAIT_FOR_CAB | 1836 1844 PS_WAIT_FOR_PSPOLL_DATA | ··· 1978 1988 int status; 1979 1989 int qnum; 1980 1990 1981 - ath_print(common, ATH_DBG_QUEUE, "tx queue %d (%x), link %p\n", 1982 - txq->axq_qnum, ath9k_hw_gettxbuf(sc->sc_ah, txq->axq_qnum), 1983 - txq->axq_link); 1991 + ath_dbg(common, ATH_DBG_QUEUE, "tx queue %d (%x), link %p\n", 1992 + txq->axq_qnum, ath9k_hw_gettxbuf(sc->sc_ah, txq->axq_qnum), 1993 + txq->axq_link); 1984 1994 1985 1995 for (;;) { 1986 1996 spin_lock_bh(&txq->axq_lock); ··· 2095 2105 } 2096 2106 2097 2107 if (needreset) { 2098 - ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_RESET, 2099 - "tx hung, resetting the chip\n"); 2108 + ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_RESET, 2109 + "tx hung, resetting the chip\n"); 2100 2110 ath9k_ps_wakeup(sc); 2101 2111 ath_reset(sc, true); 2102 2112 ath9k_ps_restore(sc); ··· 2138 2148 if (status == -EINPROGRESS) 2139 2149 break; 2140 2150 if (status == -EIO) { 2141 - ath_print(common, ATH_DBG_XMIT, 2142 - "Error processing tx status\n"); 2151 + ath_dbg(common, ATH_DBG_XMIT, 2152 + "Error processing tx status\n"); 2143 2153 break; 2144 2154 } 2145 2155 ··· 2250 2260 error = ath_descdma_setup(sc, &sc->tx.txdma, &sc->tx.txbuf, 2251 2261 "tx", nbufs, 1, 1); 2252 2262 if (error != 0) { 2253 - ath_print(common, ATH_DBG_FATAL, 2254 - "Failed to allocate tx descriptors: %d\n", error); 2263 + ath_err(common, 2264 + "Failed to allocate tx descriptors: %d\n", error); 2255 2265 goto err; 2256 2266 } 2257 2267 2258 2268 error = ath_descdma_setup(sc, &sc->beacon.bdma, &sc->beacon.bbuf, 2259 2269 "beacon", ATH_BCBUF, 1, 1); 2260 2270 if (error != 0) { 2261 - ath_print(common, ATH_DBG_FATAL, 2262 - "Failed to allocate beacon descriptors: %d\n", error); 2271 + ath_err(common, 2272 + "Failed to allocate beacon descriptors: %d\n", error); 2263 2273 goto err; 2264 2274 } 2265 2275
-20
drivers/net/wireless/ath/debug.c
··· 15 15 */ 16 16 17 17 #include "ath.h" 18 - #include "debug.h" 19 - 20 - void ath_print(struct ath_common *common, int dbg_mask, const char *fmt, ...) 21 - { 22 - struct va_format vaf; 23 - va_list args; 24 - 25 - if (likely(!(common->debug_mask & dbg_mask))) 26 - return; 27 - 28 - va_start(args, fmt); 29 - 30 - vaf.fmt = fmt; 31 - vaf.va = &args; 32 - 33 - printk(KERN_DEBUG "ath: %pV", &vaf); 34 - 35 - va_end(args); 36 - } 37 - EXPORT_SYMBOL(ath_print); 38 18 39 19 const char *ath_opmode_to_string(enum nl80211_iftype opmode) 40 20 {
-92
drivers/net/wireless/ath/debug.h
··· 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 - #ifndef ATH_DEBUG_H 18 - #define ATH_DEBUG_H 19 - 20 - #include "ath.h" 21 - 22 - /** 23 - * enum ath_debug_level - atheros wireless debug level 24 - * 25 - * @ATH_DBG_RESET: reset processing 26 - * @ATH_DBG_QUEUE: hardware queue management 27 - * @ATH_DBG_EEPROM: eeprom processing 28 - * @ATH_DBG_CALIBRATE: periodic calibration 29 - * @ATH_DBG_INTERRUPT: interrupt processing 30 - * @ATH_DBG_REGULATORY: regulatory processing 31 - * @ATH_DBG_ANI: adaptive noise immunitive processing 32 - * @ATH_DBG_XMIT: basic xmit operation 33 - * @ATH_DBG_BEACON: beacon handling 34 - * @ATH_DBG_CONFIG: configuration of the hardware 35 - * @ATH_DBG_FATAL: fatal errors, this is the default, DBG_DEFAULT 36 - * @ATH_DBG_PS: power save processing 37 - * @ATH_DBG_HWTIMER: hardware timer handling 38 - * @ATH_DBG_BTCOEX: bluetooth coexistance 39 - * @ATH_DBG_BSTUCK: stuck beacons 40 - * @ATH_DBG_ANY: enable all debugging 41 - * 42 - * The debug level is used to control the amount and type of debugging output 43 - * we want to see. Each driver has its own method for enabling debugging and 44 - * modifying debug level states -- but this is typically done through a 45 - * module parameter 'debug' along with a respective 'debug' debugfs file 46 - * entry. 47 - */ 48 - enum ATH_DEBUG { 49 - ATH_DBG_RESET = 0x00000001, 50 - ATH_DBG_QUEUE = 0x00000002, 51 - ATH_DBG_EEPROM = 0x00000004, 52 - ATH_DBG_CALIBRATE = 0x00000008, 53 - ATH_DBG_INTERRUPT = 0x00000010, 54 - ATH_DBG_REGULATORY = 0x00000020, 55 - ATH_DBG_ANI = 0x00000040, 56 - ATH_DBG_XMIT = 0x00000080, 57 - ATH_DBG_BEACON = 0x00000100, 58 - ATH_DBG_CONFIG = 0x00000200, 59 - ATH_DBG_FATAL = 0x00000400, 60 - ATH_DBG_PS = 0x00000800, 61 - ATH_DBG_HWTIMER = 0x00001000, 62 - ATH_DBG_BTCOEX = 0x00002000, 63 - ATH_DBG_WMI = 0x00004000, 64 - ATH_DBG_BSTUCK = 0x00008000, 65 - ATH_DBG_ANY = 0xffffffff 66 - }; 67 - 68 - #define ATH_DBG_DEFAULT (ATH_DBG_FATAL) 69 - 70 - #ifdef CONFIG_ATH_DEBUG 71 - void ath_print(struct ath_common *common, int dbg_mask, const char *fmt, ...) 72 - __attribute__ ((format (printf, 3, 4))); 73 - #define ATH_DBG_WARN(foo, arg...) WARN(foo, arg) 74 - #else 75 - static inline void __attribute__ ((format (printf, 3, 4))) 76 - ath_print(struct ath_common *common, int dbg_mask, const char *fmt, ...) 77 - { 78 - } 79 - #define ATH_DBG_WARN(foo, arg) 80 - #endif /* CONFIG_ATH_DEBUG */ 81 - 82 - /** Returns string describing opmode, or NULL if unknown mode. */ 83 - #ifdef CONFIG_ATH_DEBUG 84 - const char *ath_opmode_to_string(enum nl80211_iftype opmode); 85 - #else 86 - static inline const char *ath_opmode_to_string(enum nl80211_iftype opmode) 87 - { 88 - return "UNKNOWN"; 89 - } 90 - #endif 91 - 92 - #endif /* ATH_DEBUG_H */
+11 -17
drivers/net/wireless/ath/key.c
··· 20 20 21 21 #include "ath.h" 22 22 #include "reg.h" 23 - #include "debug.h" 24 23 25 24 #define REG_READ (common->ops->read) 26 25 #define REG_WRITE(_ah, _reg, _val) (common->ops->write)(_ah, _val, _reg) ··· 36 37 void *ah = common->ah; 37 38 38 39 if (entry >= common->keymax) { 39 - ath_print(common, ATH_DBG_FATAL, 40 - "keychache entry %u out of range\n", entry); 40 + ath_err(common, "keycache entry %u out of range\n", entry); 41 41 return false; 42 42 } 43 43 ··· 73 75 void *ah = common->ah; 74 76 75 77 if (entry >= common->keymax) { 76 - ath_print(common, ATH_DBG_FATAL, 77 - "keychache entry %u out of range\n", entry); 78 + ath_err(common, "keycache entry %u out of range\n", entry); 78 79 return false; 79 80 } 80 81 ··· 114 117 u32 keyType; 115 118 116 119 if (entry >= common->keymax) { 117 - ath_print(common, ATH_DBG_FATAL, 118 - "keycache entry %u out of range\n", entry); 120 + ath_err(common, "keycache entry %u out of range\n", entry); 119 121 return false; 120 122 } 121 123 ··· 124 128 break; 125 129 case ATH_CIPHER_AES_CCM: 126 130 if (!(common->crypt_caps & ATH_CRYPT_CAP_CIPHER_AESCCM)) { 127 - ath_print(common, ATH_DBG_ANY, 128 - "AES-CCM not supported by this mac rev\n"); 131 + ath_dbg(common, ATH_DBG_ANY, 132 + "AES-CCM not supported by this mac rev\n"); 129 133 return false; 130 134 } 131 135 keyType = AR_KEYTABLE_TYPE_CCM; ··· 133 137 case ATH_CIPHER_TKIP: 134 138 keyType = AR_KEYTABLE_TYPE_TKIP; 135 139 if (entry + 64 >= common->keymax) { 136 - ath_print(common, ATH_DBG_ANY, 137 - "entry %u inappropriate for TKIP\n", entry); 140 + ath_dbg(common, ATH_DBG_ANY, 141 + "entry %u inappropriate for TKIP\n", entry); 138 142 return false; 139 143 } 140 144 break; 141 145 case ATH_CIPHER_WEP: 142 146 if (k->kv_len < WLAN_KEY_LEN_WEP40) { 143 - ath_print(common, ATH_DBG_ANY, 144 - "WEP key length %u too small\n", k->kv_len); 147 + ath_dbg(common, ATH_DBG_ANY, 148 + "WEP key length %u too small\n", k->kv_len); 145 149 return false; 146 150 } 147 151 if (k->kv_len <= WLAN_KEY_LEN_WEP40) ··· 155 159 keyType = AR_KEYTABLE_TYPE_CLR; 156 160 break; 157 161 default: 158 - ath_print(common, ATH_DBG_FATAL, 159 - "cipher %u not supported\n", k->kv_type); 162 + ath_err(common, "cipher %u not supported\n", k->kv_type); 160 163 return false; 161 164 } 162 165 ··· 336 341 memcpy(hk->kv_mic, key_txmic, sizeof(hk->kv_mic)); 337 342 if (!ath_hw_set_keycache_entry(common, keyix, hk, NULL)) { 338 343 /* TX MIC entry failed. No need to proceed further */ 339 - ath_print(common, ATH_DBG_FATAL, 340 - "Setting TX MIC Key Failed\n"); 344 + ath_err(common, "Setting TX MIC Key Failed\n"); 341 345 return 0; 342 346 } 343 347
+20
drivers/net/wireless/ath/main.c
··· 56 56 return skb; 57 57 } 58 58 EXPORT_SYMBOL(ath_rxbuf_alloc); 59 + 60 + int ath_printk(const char *level, struct ath_common *common, 61 + const char *fmt, ...) 62 + { 63 + struct va_format vaf; 64 + va_list args; 65 + int rtn; 66 + 67 + va_start(args, fmt); 68 + 69 + vaf.fmt = fmt; 70 + vaf.va = &args; 71 + 72 + rtn = printk("%sath: %pV", level, &vaf); 73 + 74 + va_end(args); 75 + 76 + return rtn; 77 + } 78 + EXPORT_SYMBOL(ath_printk);
+7 -6
drivers/net/wireless/b43/Kconfig
··· 86 86 select SSB_BLOCKIO 87 87 default y 88 88 89 - config B43_NPHY 90 - bool "Pre IEEE 802.11n support (BROKEN)" 91 - depends on B43 && EXPERIMENTAL && BROKEN 89 + config B43_PHY_N 90 + bool "Support for 802.11n (N-PHY) devices (EXPERIMENTAL)" 91 + depends on B43 && EXPERIMENTAL 92 92 ---help--- 93 - Support for the IEEE 802.11n draft. 93 + Support for the N-PHY. 94 94 95 - THIS IS BROKEN AND DOES NOT WORK YET. 95 + This enables support for devices with N-PHY revision up to 2. 96 96 97 - SAY N. 97 + Say N if you expect high stability and performance. Saying Y will not 98 + affect other devices support and may provide support for basic needs. 98 99 99 100 config B43_PHY_LP 100 101 bool "Support for low-power (LP-PHY) devices (EXPERIMENTAL)"
+4 -4
drivers/net/wireless/b43/Makefile
··· 1 1 b43-y += main.o 2 2 b43-y += tables.o 3 - b43-$(CONFIG_B43_NPHY) += tables_nphy.o 4 - b43-$(CONFIG_B43_NPHY) += radio_2055.o 5 - b43-$(CONFIG_B43_NPHY) += radio_2056.o 3 + b43-$(CONFIG_B43_PHY_N) += tables_nphy.o 4 + b43-$(CONFIG_B43_PHY_N) += radio_2055.o 5 + b43-$(CONFIG_B43_PHY_N) += radio_2056.o 6 6 b43-y += phy_common.o 7 7 b43-y += phy_g.o 8 8 b43-y += phy_a.o 9 - b43-$(CONFIG_B43_NPHY) += phy_n.o 9 + b43-$(CONFIG_B43_PHY_N) += phy_n.o 10 10 b43-$(CONFIG_B43_PHY_LP) += phy_lp.o 11 11 b43-$(CONFIG_B43_PHY_LP) += tables_lpphy.o 12 12 b43-y += sysfs.o
+9 -3
drivers/net/wireless/b43/main.c
··· 1150 1150 1151 1151 flags |= B43_TMSLOW_PHYCLKEN; 1152 1152 flags |= B43_TMSLOW_PHYRESET; 1153 + if (dev->phy.type == B43_PHYTYPE_N) { 1154 + if (b43_channel_type_is_40mhz(dev->phy.channel_type)) 1155 + flags |= B43_TMSLOW_PHYCLKSPEED_160MHZ; 1156 + else 1157 + flags |= B43_TMSLOW_PHYCLKSPEED_80MHZ; 1158 + } 1153 1159 ssb_device_enable(dev->dev, flags); 1154 1160 msleep(2); /* Wait for the PLL to turn on. */ 1155 1161 ··· 4052 4046 if (phy_rev > 9) 4053 4047 unsupported = 1; 4054 4048 break; 4055 - #ifdef CONFIG_B43_NPHY 4049 + #ifdef CONFIG_B43_PHY_N 4056 4050 case B43_PHYTYPE_N: 4057 - if (phy_rev > 4) 4051 + if (phy_rev > 2) 4058 4052 unsupported = 1; 4059 4053 break; 4060 4054 #endif ··· 5097 5091 #ifdef CONFIG_B43_PCMCIA 5098 5092 feat_pcmcia = "M"; 5099 5093 #endif 5100 - #ifdef CONFIG_B43_NPHY 5094 + #ifdef CONFIG_B43_PHY_N 5101 5095 feat_nphy = "N"; 5102 5096 #endif 5103 5097 #ifdef CONFIG_B43_LEDS
+13 -1
drivers/net/wireless/b43/phy_common.c
··· 50 50 phy->ops = &b43_phyops_g; 51 51 break; 52 52 case B43_PHYTYPE_N: 53 - #ifdef CONFIG_B43_NPHY 53 + #ifdef CONFIG_B43_PHY_N 54 54 phy->ops = &b43_phyops_n; 55 55 #endif 56 56 break; ··· 231 231 u16 b43_phy_read(struct b43_wldev *dev, u16 reg) 232 232 { 233 233 assert_mac_suspended(dev); 234 + dev->phy.writes_counter = 0; 234 235 return dev->phy.ops->phy_read(dev, reg); 235 236 } 236 237 ··· 239 238 { 240 239 assert_mac_suspended(dev); 241 240 dev->phy.ops->phy_write(dev, reg, value); 241 + if (++dev->phy.writes_counter == B43_MAX_WRITES_IN_ROW) { 242 + b43_read16(dev, B43_MMIO_PHY_VER); 243 + dev->phy.writes_counter = 0; 244 + } 242 245 } 243 246 244 247 void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg) ··· 427 422 void b43_phyop_switch_analog_generic(struct b43_wldev *dev, bool on) 428 423 { 429 424 b43_write16(dev, B43_MMIO_PHY0, on ? 0 : 0xF4); 425 + } 426 + 427 + 428 + bool b43_channel_type_is_40mhz(enum nl80211_channel_type channel_type) 429 + { 430 + return (channel_type == NL80211_CHAN_HT40MINUS || 431 + channel_type == NL80211_CHAN_HT40PLUS); 430 432 } 431 433 432 434 /* http://bcm-v4.sipsolutions.net/802.11/PHY/Cordic */
+8
drivers/net/wireless/b43/phy_common.h
··· 39 39 #define B43_PHYVER_TYPE_SHIFT 8 40 40 #define B43_PHYVER_VERSION 0x00FF 41 41 42 + /* PHY writes need to be flushed if we reach limit */ 43 + #define B43_MAX_WRITES_IN_ROW 24 44 + 42 45 /** 43 46 * enum b43_interference_mitigation - Interference Mitigation mode 44 47 * ··· 234 231 u8 type; 235 232 /* PHY revision number. */ 236 233 u8 rev; 234 + 235 + /* Count writes since last read */ 236 + u8 writes_counter; 237 237 238 238 /* Radio versioning */ 239 239 u16 radio_manuf; /* Radio manufacturer */ ··· 435 429 * for struct b43_phy_operations. 436 430 */ 437 431 void b43_phyop_switch_analog_generic(struct b43_wldev *dev, bool on); 432 + 433 + bool b43_channel_type_is_40mhz(enum nl80211_channel_type channel_type); 438 434 439 435 struct b43_c32 b43_cordic(int theta); 440 436
+16 -10
drivers/net/wireless/b43/phy_n.c
··· 88 88 static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field, 89 89 u16 value, u8 core); 90 90 91 - static inline bool b43_channel_type_is_40mhz( 92 - enum nl80211_channel_type channel_type) 93 - { 94 - return (channel_type == NL80211_CHAN_HT40MINUS || 95 - channel_type == NL80211_CHAN_HT40PLUS); 96 - } 97 - 98 91 void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna) 99 92 {//TODO 100 93 } ··· 251 258 252 259 for (i = 0; i < 2; i++) { 253 260 if (dev->phy.rev >= 3) { 254 - /* TODO */ 261 + /* FIXME: support 5GHz */ 262 + txgain = b43_ntab_tx_gain_rev3plus_2ghz[txpi[i]]; 255 263 radio_gain = (txgain >> 16) & 0x1FFFF; 256 264 } else { 257 265 txgain = b43_ntab_tx_gain_rev0_1_2[txpi[i]]; ··· 607 613 } 608 614 } 609 615 616 + #if 0 617 + /* Ready but not used anywhere */ 610 618 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCalPhyCleanup */ 611 619 static void b43_nphy_rx_cal_phy_cleanup(struct b43_wldev *dev, u8 core) 612 620 { ··· 690 694 b43_nphy_rf_control_intc_override(dev, 1, rxval, (core + 1)); 691 695 b43_nphy_rf_control_intc_override(dev, 1, txval, (2 - core)); 692 696 } 697 + #endif 693 698 694 699 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CalcRxIqComp */ 695 700 static void b43_nphy_calc_rx_iq_comp(struct b43_wldev *dev, u8 mask) ··· 3085 3088 u8 rfctl[2]; 3086 3089 u8 afectl_core; 3087 3090 u16 tmp[6]; 3088 - u16 cur_hpf1, cur_hpf2, cur_lna; 3091 + u16 uninitialized_var(cur_hpf1), uninitialized_var(cur_hpf2), cur_lna; 3089 3092 u32 real, imag; 3090 3093 enum ieee80211_band band; 3091 3094 ··· 3515 3518 if (phy->rev >= 3) 3516 3519 b43_nphy_spur_workaround(dev); 3517 3520 3518 - b43err(dev->wl, "IEEE 802.11n devices are not supported, yet.\n"); 3519 3521 return 0; 3520 3522 } 3521 3523 ··· 3701 3705 b43_write16(dev, B43_MMIO_PHY_DATA, value); 3702 3706 } 3703 3707 3708 + static void b43_nphy_op_maskset(struct b43_wldev *dev, u16 reg, u16 mask, 3709 + u16 set) 3710 + { 3711 + check_phyreg(dev, reg); 3712 + b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); 3713 + b43_write16(dev, B43_MMIO_PHY_DATA, 3714 + (b43_read16(dev, B43_MMIO_PHY_DATA) & mask) | set); 3715 + } 3716 + 3704 3717 static u16 b43_nphy_op_radio_read(struct b43_wldev *dev, u16 reg) 3705 3718 { 3706 3719 /* Register 1 is a 32-bit register. */ ··· 3804 3799 .init = b43_nphy_op_init, 3805 3800 .phy_read = b43_nphy_op_read, 3806 3801 .phy_write = b43_nphy_op_write, 3802 + .phy_maskset = b43_nphy_op_maskset, 3807 3803 .radio_read = b43_nphy_op_radio_read, 3808 3804 .radio_write = b43_nphy_op_radio_write, 3809 3805 .software_rfkill = b43_nphy_op_software_rfkill,
+111 -113
drivers/net/wireless/b43/tables_nphy.c
··· 28 28 #include "phy_n.h" 29 29 30 30 static const u8 b43_ntab_adjustpower0[] = { 31 - 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 32 - 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 33 - 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 34 - 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 35 - 0x08, 0x08, 0x08, 0x08, 0x09, 0x09, 0x09, 0x09, 36 - 0x0A, 0x0A, 0x0A, 0x0A, 0x0B, 0x0B, 0x0B, 0x0B, 37 - 0x0C, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D, 38 - 0x0E, 0x0E, 0x0E, 0x0E, 0x0F, 0x0F, 0x0F, 0x0F, 39 - 0x10, 0x10, 0x10, 0x10, 0x11, 0x11, 0x11, 0x11, 40 - 0x12, 0x12, 0x12, 0x12, 0x13, 0x13, 0x13, 0x13, 41 - 0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15, 42 - 0x16, 0x16, 0x16, 0x16, 0x17, 0x17, 0x17, 0x17, 43 - 0x18, 0x18, 0x18, 0x18, 0x19, 0x19, 0x19, 0x19, 44 - 0x1A, 0x1A, 0x1A, 0x1A, 0x1B, 0x1B, 0x1B, 0x1B, 45 - 0x1C, 0x1C, 0x1C, 0x1C, 0x1D, 0x1D, 0x1D, 0x1D, 46 - 0x1E, 0x1E, 0x1E, 0x1E, 0x1F, 0x1F, 0x1F, 0x1F, 31 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 32 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 33 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 34 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 35 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 36 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 37 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 38 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 39 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 40 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 41 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 42 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 43 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 44 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 45 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 46 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 47 47 }; 48 48 49 49 static const u8 b43_ntab_adjustpower1[] = { 50 - 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 51 - 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 52 - 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 53 - 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 54 - 0x08, 0x08, 0x08, 0x08, 0x09, 0x09, 0x09, 0x09, 55 - 0x0A, 0x0A, 0x0A, 0x0A, 0x0B, 0x0B, 0x0B, 0x0B, 56 - 0x0C, 0x0C, 0x0C, 0x0C, 0x0D, 0x0D, 0x0D, 0x0D, 57 - 0x0E, 0x0E, 0x0E, 0x0E, 0x0F, 0x0F, 0x0F, 0x0F, 58 - 0x10, 0x10, 0x10, 0x10, 0x11, 0x11, 0x11, 0x11, 59 - 0x12, 0x12, 0x12, 0x12, 0x13, 0x13, 0x13, 0x13, 60 - 0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15, 61 - 0x16, 0x16, 0x16, 0x16, 0x17, 0x17, 0x17, 0x17, 62 - 0x18, 0x18, 0x18, 0x18, 0x19, 0x19, 0x19, 0x19, 63 - 0x1A, 0x1A, 0x1A, 0x1A, 0x1B, 0x1B, 0x1B, 0x1B, 64 - 0x1C, 0x1C, 0x1C, 0x1C, 0x1D, 0x1D, 0x1D, 0x1D, 65 - 0x1E, 0x1E, 0x1E, 0x1E, 0x1F, 0x1F, 0x1F, 0x1F, 50 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 51 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 52 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 53 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 54 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 55 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 56 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 57 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 58 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 59 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 60 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 61 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 62 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 63 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 64 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 65 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 66 66 }; 67 67 68 68 static const u16 b43_ntab_bdi[] = { ··· 130 130 0x09804506, 0x00100030, 0x09804507, 0x00100030, 131 131 0x00000000, 0x00000000, 0x00000000, 0x00000000, 132 132 0x00000000, 0x00000000, 0x00000000, 0x00000000, 133 - 0x08004A0C, 0x00100008, 0x01000A0D, 0x00100028, 134 - 0x0980450E, 0x00100038, 0x0980450F, 0x00100038, 133 + 0x08004A0C, 0x00100004, 0x01000A0D, 0x00100024, 134 + 0x0980450E, 0x00100034, 0x0980450F, 0x00100034, 135 135 0x00000000, 0x00000000, 0x00000000, 0x00000000, 136 136 0x00000000, 0x00000000, 0x00000000, 0x00000000, 137 137 0x00000A04, 0x00100000, 0x11008A05, 0x00100020, ··· 202 202 0x53028A06, 0x01900060, 0x53028A07, 0x01900060, 203 203 0x00000000, 0x00000000, 0x00000000, 0x00000000, 204 204 0x00000000, 0x00000000, 0x00000000, 0x00000000, 205 - 0x4002140C, 0x000F4810, 0x6203140D, 0x00100050, 206 - 0x53028A0E, 0x01900070, 0x53028A0F, 0x01900070, 205 + 0x4002140C, 0x000F4808, 0x6203140D, 0x00100048, 206 + 0x53028A0E, 0x01900068, 0x53028A0F, 0x01900068, 207 207 0x00000000, 0x00000000, 0x00000000, 0x00000000, 208 208 0x00000000, 0x00000000, 0x00000000, 0x00000000, 209 - 0x00000A0C, 0x00100008, 0x11008A0D, 0x00100028, 210 - 0x1980C50E, 0x00100038, 0x2181050E, 0x00100038, 211 - 0x2181050E, 0x00100038, 0x0180050C, 0x00100038, 209 + 0x00000A0C, 0x00100004, 0x11008A0D, 0x00100024, 210 + 0x1980C50E, 0x00100034, 0x2181050E, 0x00100034, 211 + 0x2181050E, 0x00100034, 0x0180050C, 0x00100038, 212 212 0x1180850D, 0x00100038, 0x1181850D, 0x00100038, 213 213 0x2981450F, 0x01100038, 0x00000000, 0x00000000, 214 214 0x00000000, 0x00000000, 0x00000000, 0x00000000, ··· 238 238 0x00000000, 0x00000000, 0x00000000, 0x00000000, 239 239 0x00000000, 0x00000000, 0x00000000, 0x00000000, 240 240 0x00000000, 0x00000000, 0x00000000, 0x00000000, 241 - 0x4002140C, 0x00100010, 0x0200140D, 0x00100050, 242 - 0x0B004A0E, 0x01900070, 0x13008A0E, 0x01900070, 243 - 0x13008A0E, 0x01900070, 0x43020A0C, 0x00100070, 241 + 0x4002140C, 0x00100008, 0x0200140D, 0x00100048, 242 + 0x0B004A0E, 0x01900068, 0x13008A0E, 0x01900068, 243 + 0x13008A0E, 0x01900068, 0x43020A0C, 0x00100070, 244 244 0x1B00CA0D, 0x00100070, 0x1B014A0D, 0x00100070, 245 245 0x23010A0F, 0x01500070, 0x00000000, 0x00000000, 246 246 0x00000000, 0x00000000, 0x00000000, 0x00000000, ··· 337 337 }; 338 338 339 339 static const u32 b43_ntab_gainctl0[] = { 340 - 0x007F003F, 0x007E013F, 0x007D023E, 0x007C033E, 341 - 0x007B043D, 0x007A053D, 0x0079063C, 0x0078073C, 342 - 0x0077083B, 0x0076093B, 0x00750A3A, 0x00740B3A, 343 - 0x00730C39, 0x00720D39, 0x00710E38, 0x00700F38, 344 - 0x006F0037, 0x006E0137, 0x006D0236, 0x006C0336, 345 - 0x006B0435, 0x006A0535, 0x00690634, 0x00680734, 346 - 0x00670833, 0x00660933, 0x00650A32, 0x00640B32, 347 - 0x00630C31, 0x00620D31, 0x00610E30, 0x00600F30, 348 - 0x005F002F, 0x005E012F, 0x005D022E, 0x005C032E, 349 - 0x005B042D, 0x005A052D, 0x0059062C, 0x0058072C, 350 - 0x0057082B, 0x0056092B, 0x00550A2A, 0x00540B2A, 351 - 0x00530C29, 0x00520D29, 0x00510E28, 0x00500F28, 352 - 0x004F0027, 0x004E0127, 0x004D0226, 0x004C0326, 353 - 0x004B0425, 0x004A0525, 0x00490624, 0x00480724, 354 - 0x00470823, 0x00460923, 0x00450A22, 0x00440B22, 355 - 0x00430C21, 0x00420D21, 0x00410E20, 0x00400F20, 356 - 0x003F001F, 0x003E011F, 0x003D021E, 0x003C031E, 357 - 0x003B041D, 0x003A051D, 0x0039061C, 0x0038071C, 358 - 0x0037081B, 0x0036091B, 0x00350A1A, 0x00340B1A, 359 - 0x00330C19, 0x00320D19, 0x00310E18, 0x00300F18, 360 - 0x002F0017, 0x002E0117, 0x002D0216, 0x002C0316, 361 - 0x002B0415, 0x002A0515, 0x00290614, 0x00280714, 362 - 0x00270813, 0x00260913, 0x00250A12, 0x00240B12, 363 - 0x00230C11, 0x00220D11, 0x00210E10, 0x00200F10, 364 - 0x001F000F, 0x001E010F, 0x001D020E, 0x001C030E, 365 - 0x001B040D, 0x001A050D, 0x0019060C, 0x0018070C, 366 - 0x0017080B, 0x0016090B, 0x00150A0A, 0x00140B0A, 367 - 0x00130C09, 0x00120D09, 0x00110E08, 0x00100F08, 368 - 0x000F0007, 0x000E0107, 0x000D0206, 0x000C0306, 369 - 0x000B0405, 0x000A0505, 0x00090604, 0x00080704, 370 - 0x00070803, 0x00060903, 0x00050A02, 0x00040B02, 371 - 0x00030C01, 0x00020D01, 0x00010E00, 0x00000F00, 340 + 0x03CC2B44, 0x03CC2B42, 0x03CC2B40, 0x03CC2B3E, 341 + 0x03CC2B3D, 0x03CC2B3B, 0x03C82B44, 0x03C82B42, 342 + 0x03C82B40, 0x03C82B3E, 0x03C82B3D, 0x03C82B3B, 343 + 0x03C82B39, 0x03C82B38, 0x03C82B36, 0x03C82B34, 344 + 0x03C42B44, 0x03C42B42, 0x03C42B40, 0x03C42B3E, 345 + 0x03C42B3D, 0x03C42B3B, 0x03C42B39, 0x03C42B38, 346 + 0x03C42B36, 0x03C42B34, 0x03C42B33, 0x03C42B32, 347 + 0x03C42B30, 0x03C42B2F, 0x03C42B2D, 0x03C02B44, 348 + 0x03C02B42, 0x03C02B40, 0x03C02B3E, 0x03C02B3D, 349 + 0x03C02B3B, 0x03C02B39, 0x03C02B38, 0x03C02B36, 350 + 0x03C02B34, 0x03B02B44, 0x03B02B42, 0x03B02B40, 351 + 0x03B02B3E, 0x03B02B3D, 0x03B02B3B, 0x03B02B39, 352 + 0x03B02B38, 0x03B02B36, 0x03B02B34, 0x03B02B33, 353 + 0x03B02B32, 0x03B02B30, 0x03B02B2F, 0x03B02B2D, 354 + 0x03A02B44, 0x03A02B42, 0x03A02B40, 0x03A02B3E, 355 + 0x03A02B3D, 0x03A02B3B, 0x03A02B39, 0x03A02B38, 356 + 0x03A02B36, 0x03A02B34, 0x03902B44, 0x03902B42, 357 + 0x03902B40, 0x03902B3E, 0x03902B3D, 0x03902B3B, 358 + 0x03902B39, 0x03902B38, 0x03902B36, 0x03902B34, 359 + 0x03902B33, 0x03902B32, 0x03902B30, 0x03802B44, 360 + 0x03802B42, 0x03802B40, 0x03802B3E, 0x03802B3D, 361 + 0x03802B3B, 0x03802B39, 0x03802B38, 0x03802B36, 362 + 0x03802B34, 0x03802B33, 0x03802B32, 0x03802B30, 363 + 0x03802B2F, 0x03802B2D, 0x03802B2C, 0x03802B2B, 364 + 0x03802B2A, 0x03802B29, 0x03802B27, 0x03802B26, 365 + 0x03802B25, 0x03802B24, 0x03802B23, 0x03802B22, 366 + 0x03802B21, 0x03802B20, 0x03802B1F, 0x03802B1E, 367 + 0x03802B1E, 0x03802B1D, 0x03802B1C, 0x03802B1B, 368 + 0x03802B1A, 0x03802B1A, 0x03802B19, 0x03802B18, 369 + 0x03802B18, 0x03802B18, 0x03802B18, 0x03802B18, 370 + 0x03802B18, 0x03802B18, 0x03802B18, 0x03802B18, 371 + 0x03802B18, 0x03802B18, 0x03802B18, 0x00002B00, 372 372 }; 373 373 374 374 static const u32 b43_ntab_gainctl1[] = { 375 - 0x007F003F, 0x007E013F, 0x007D023E, 0x007C033E, 376 - 0x007B043D, 0x007A053D, 0x0079063C, 0x0078073C, 377 - 0x0077083B, 0x0076093B, 0x00750A3A, 0x00740B3A, 378 - 0x00730C39, 0x00720D39, 0x00710E38, 0x00700F38, 379 - 0x006F0037, 0x006E0137, 0x006D0236, 0x006C0336, 380 - 0x006B0435, 0x006A0535, 0x00690634, 0x00680734, 381 - 0x00670833, 0x00660933, 0x00650A32, 0x00640B32, 382 - 0x00630C31, 0x00620D31, 0x00610E30, 0x00600F30, 383 - 0x005F002F, 0x005E012F, 0x005D022E, 0x005C032E, 384 - 0x005B042D, 0x005A052D, 0x0059062C, 0x0058072C, 385 - 0x0057082B, 0x0056092B, 0x00550A2A, 0x00540B2A, 386 - 0x00530C29, 0x00520D29, 0x00510E28, 0x00500F28, 387 - 0x004F0027, 0x004E0127, 0x004D0226, 0x004C0326, 388 - 0x004B0425, 0x004A0525, 0x00490624, 0x00480724, 389 - 0x00470823, 0x00460923, 0x00450A22, 0x00440B22, 390 - 0x00430C21, 0x00420D21, 0x00410E20, 0x00400F20, 391 - 0x003F001F, 0x003E011F, 0x003D021E, 0x003C031E, 392 - 0x003B041D, 0x003A051D, 0x0039061C, 0x0038071C, 393 - 0x0037081B, 0x0036091B, 0x00350A1A, 0x00340B1A, 394 - 0x00330C19, 0x00320D19, 0x00310E18, 0x00300F18, 395 - 0x002F0017, 0x002E0117, 0x002D0216, 0x002C0316, 396 - 0x002B0415, 0x002A0515, 0x00290614, 0x00280714, 397 - 0x00270813, 0x00260913, 0x00250A12, 0x00240B12, 398 - 0x00230C11, 0x00220D11, 0x00210E10, 0x00200F10, 399 - 0x001F000F, 0x001E010F, 0x001D020E, 0x001C030E, 400 - 0x001B040D, 0x001A050D, 0x0019060C, 0x0018070C, 401 - 0x0017080B, 0x0016090B, 0x00150A0A, 0x00140B0A, 402 - 0x00130C09, 0x00120D09, 0x00110E08, 0x00100F08, 403 - 0x000F0007, 0x000E0107, 0x000D0206, 0x000C0306, 404 - 0x000B0405, 0x000A0505, 0x00090604, 0x00080704, 405 - 0x00070803, 0x00060903, 0x00050A02, 0x00040B02, 406 - 0x00030C01, 0x00020D01, 0x00010E00, 0x00000F00, 375 + 0x03CC2B44, 0x03CC2B42, 0x03CC2B40, 0x03CC2B3E, 376 + 0x03CC2B3D, 0x03CC2B3B, 0x03C82B44, 0x03C82B42, 377 + 0x03C82B40, 0x03C82B3E, 0x03C82B3D, 0x03C82B3B, 378 + 0x03C82B39, 0x03C82B38, 0x03C82B36, 0x03C82B34, 379 + 0x03C42B44, 0x03C42B42, 0x03C42B40, 0x03C42B3E, 380 + 0x03C42B3D, 0x03C42B3B, 0x03C42B39, 0x03C42B38, 381 + 0x03C42B36, 0x03C42B34, 0x03C42B33, 0x03C42B32, 382 + 0x03C42B30, 0x03C42B2F, 0x03C42B2D, 0x03C02B44, 383 + 0x03C02B42, 0x03C02B40, 0x03C02B3E, 0x03C02B3D, 384 + 0x03C02B3B, 0x03C02B39, 0x03C02B38, 0x03C02B36, 385 + 0x03C02B34, 0x03B02B44, 0x03B02B42, 0x03B02B40, 386 + 0x03B02B3E, 0x03B02B3D, 0x03B02B3B, 0x03B02B39, 387 + 0x03B02B38, 0x03B02B36, 0x03B02B34, 0x03B02B33, 388 + 0x03B02B32, 0x03B02B30, 0x03B02B2F, 0x03B02B2D, 389 + 0x03A02B44, 0x03A02B42, 0x03A02B40, 0x03A02B3E, 390 + 0x03A02B3D, 0x03A02B3B, 0x03A02B39, 0x03A02B38, 391 + 0x03A02B36, 0x03A02B34, 0x03902B44, 0x03902B42, 392 + 0x03902B40, 0x03902B3E, 0x03902B3D, 0x03902B3B, 393 + 0x03902B39, 0x03902B38, 0x03902B36, 0x03902B34, 394 + 0x03902B33, 0x03902B32, 0x03902B30, 0x03802B44, 395 + 0x03802B42, 0x03802B40, 0x03802B3E, 0x03802B3D, 396 + 0x03802B3B, 0x03802B39, 0x03802B38, 0x03802B36, 397 + 0x03802B34, 0x03802B33, 0x03802B32, 0x03802B30, 398 + 0x03802B2F, 0x03802B2D, 0x03802B2C, 0x03802B2B, 399 + 0x03802B2A, 0x03802B29, 0x03802B27, 0x03802B26, 400 + 0x03802B25, 0x03802B24, 0x03802B23, 0x03802B22, 401 + 0x03802B21, 0x03802B20, 0x03802B1F, 0x03802B1E, 402 + 0x03802B1E, 0x03802B1D, 0x03802B1C, 0x03802B1B, 403 + 0x03802B1A, 0x03802B1A, 0x03802B19, 0x03802B18, 404 + 0x03802B18, 0x03802B18, 0x03802B18, 0x03802B18, 405 + 0x03802B18, 0x03802B18, 0x03802B18, 0x03802B18, 406 + 0x03802B18, 0x03802B18, 0x03802B18, 0x00002B00, 407 407 }; 408 408 409 409 static const u32 b43_ntab_intlevel[] = { ··· 1811 1811 } 1812 1812 1813 1813 #define ntab_upload(dev, offset, data) do { \ 1814 - unsigned int i; \ 1815 - for (i = 0; i < (offset##_SIZE); i++) \ 1816 - b43_ntab_write(dev, (offset) + i, (data)[i]); \ 1814 + b43_ntab_write_bulk(dev, offset, offset##_SIZE, data); \ 1817 1815 } while (0) 1818 1816 1819 1817 void b43_nphy_rev0_1_2_tables_init(struct b43_wldev *dev) ··· 1823 1825 ntab_upload(dev, B43_NTAB_TDTRN, b43_ntab_tdtrn); 1824 1826 ntab_upload(dev, B43_NTAB_INTLEVEL, b43_ntab_intlevel); 1825 1827 ntab_upload(dev, B43_NTAB_PILOT, b43_ntab_pilot); 1826 - ntab_upload(dev, B43_NTAB_PILOTLT, b43_ntab_pilotlt); 1827 1828 ntab_upload(dev, B43_NTAB_TDI20A0, b43_ntab_tdi20a0); 1828 1829 ntab_upload(dev, B43_NTAB_TDI20A1, b43_ntab_tdi20a1); 1829 1830 ntab_upload(dev, B43_NTAB_TDI40A0, b43_ntab_tdi40a0); 1830 1831 ntab_upload(dev, B43_NTAB_TDI40A1, b43_ntab_tdi40a1); 1831 - ntab_upload(dev, B43_NTAB_BDI, b43_ntab_bdi); 1832 1832 ntab_upload(dev, B43_NTAB_CHANEST, b43_ntab_channelest); 1833 1833 ntab_upload(dev, B43_NTAB_MCS, b43_ntab_mcs); 1834 - 1835 - /* Volatile tables */ 1836 1834 ntab_upload(dev, B43_NTAB_NOISEVAR10, b43_ntab_noisevar10); 1837 1835 ntab_upload(dev, B43_NTAB_NOISEVAR11, b43_ntab_noisevar11); 1836 + 1837 + /* Volatile tables */ 1838 + ntab_upload(dev, B43_NTAB_BDI, b43_ntab_bdi); 1839 + ntab_upload(dev, B43_NTAB_PILOTLT, b43_ntab_pilotlt); 1838 1840 ntab_upload(dev, B43_NTAB_C0_ESTPLT, b43_ntab_estimatepowerlt0); 1839 1841 ntab_upload(dev, B43_NTAB_C1_ESTPLT, b43_ntab_estimatepowerlt1); 1840 1842 ntab_upload(dev, B43_NTAB_C0_ADJPLT, b43_ntab_adjustpower0);
+1 -2
drivers/net/wireless/iwlwifi/iwl-1000.c
··· 228 228 .bt_stats_read = iwl_ucode_bt_stats_read, 229 229 .reply_tx_error = iwl_reply_tx_error_read, 230 230 }, 231 - .recover_from_tx_stall = iwl_bg_monitor_recover, 232 231 .check_plcp_health = iwl_good_plcp_health, 233 232 .check_ack_health = iwl_good_ack_health, 234 233 .txfifo_flush = iwlagn_txfifo_flush, ··· 261 262 .support_ct_kill_exit = true, 262 263 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF, 263 264 .chain_noise_scale = 1000, 264 - .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 265 + .wd_timeout = IWL_DEF_WD_TIMEOUT, 265 266 .max_event_log_size = 128, 266 267 .ucode_tracing = true, 267 268 .sensitivity_calib_by_driver = true,
+5 -2
drivers/net/wireless/iwlwifi/iwl-3945.c
··· 325 325 return; 326 326 } 327 327 328 + txq->time_stamp = jiffies; 328 329 info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb); 329 330 ieee80211_tx_info_clear_status(info); 330 331 ··· 1785 1784 int rc = 0; 1786 1785 bool new_assoc = !!(staging_rxon->filter_flags & RXON_FILTER_ASSOC_MSK); 1787 1786 1787 + if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 1788 + return -EINVAL; 1789 + 1788 1790 if (!iwl_is_alive(priv)) 1789 1791 return -1; 1790 1792 ··· 2734 2730 .isr_ops = { 2735 2731 .isr = iwl_isr_legacy, 2736 2732 }, 2737 - .recover_from_tx_stall = iwl_bg_monitor_recover, 2738 2733 .check_plcp_health = iwl3945_good_plcp_health, 2739 2734 2740 2735 .debugfs_ops = { ··· 2776 2773 .led_compensation = 64, 2777 2774 .broken_powersave = true, 2778 2775 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 2779 - .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 2776 + .wd_timeout = IWL_DEF_WD_TIMEOUT, 2780 2777 .max_event_log_size = 512, 2781 2778 .tx_power_by_driver = true, 2782 2779 };
+2 -2
drivers/net/wireless/iwlwifi/iwl-4965.c
··· 2198 2198 return; 2199 2199 } 2200 2200 2201 + txq->time_stamp = jiffies; 2201 2202 info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb); 2202 2203 memset(&info->status, 0, sizeof(info->status)); 2203 2204 ··· 2555 2554 .bt_stats_read = iwl_ucode_bt_stats_read, 2556 2555 .reply_tx_error = iwl_reply_tx_error_read, 2557 2556 }, 2558 - .recover_from_tx_stall = iwl_bg_monitor_recover, 2559 2557 .check_plcp_health = iwl_good_plcp_health, 2560 2558 }; 2561 2559 ··· 2609 2609 .led_compensation = 61, 2610 2610 .chain_noise_num_beacons = IWL4965_CAL_NUM_BEACONS, 2611 2611 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 2612 - .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 2612 + .wd_timeout = IWL_DEF_WD_TIMEOUT, 2613 2613 .temperature_kelvin = true, 2614 2614 .max_event_log_size = 512, 2615 2615 .tx_power_by_driver = true,
+1 -3
drivers/net/wireless/iwlwifi/iwl-5000.c
··· 402 402 .bt_stats_read = iwl_ucode_bt_stats_read, 403 403 .reply_tx_error = iwl_reply_tx_error_read, 404 404 }, 405 - .recover_from_tx_stall = iwl_bg_monitor_recover, 406 405 .check_plcp_health = iwl_good_plcp_health, 407 406 .check_ack_health = iwl_good_ack_health, 408 407 .txfifo_flush = iwlagn_txfifo_flush, ··· 471 472 .bt_stats_read = iwl_ucode_bt_stats_read, 472 473 .reply_tx_error = iwl_reply_tx_error_read, 473 474 }, 474 - .recover_from_tx_stall = iwl_bg_monitor_recover, 475 475 .check_plcp_health = iwl_good_plcp_health, 476 476 .check_ack_health = iwl_good_ack_health, 477 477 .txfifo_flush = iwlagn_txfifo_flush, ··· 509 511 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 510 512 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 511 513 .chain_noise_scale = 1000, 512 - .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, 514 + .wd_timeout = IWL_LONG_WD_TIMEOUT, 513 515 .max_event_log_size = 512, 514 516 .ucode_tracing = true, 515 517 .sensitivity_calib_by_driver = true,
+13 -15
drivers/net/wireless/iwlwifi/iwl-6000.c
··· 339 339 .bt_stats_read = iwl_ucode_bt_stats_read, 340 340 .reply_tx_error = iwl_reply_tx_error_read, 341 341 }, 342 - .recover_from_tx_stall = iwl_bg_monitor_recover, 343 342 .check_plcp_health = iwl_good_plcp_health, 344 343 .check_ack_health = iwl_good_ack_health, 345 344 .txfifo_flush = iwlagn_txfifo_flush, ··· 411 412 .bt_stats_read = iwl_ucode_bt_stats_read, 412 413 .reply_tx_error = iwl_reply_tx_error_read, 413 414 }, 414 - .recover_from_tx_stall = iwl_bg_monitor_recover, 415 415 .check_plcp_health = iwl_good_plcp_health, 416 416 .check_ack_health = iwl_good_ack_health, 417 417 .txfifo_flush = iwlagn_txfifo_flush, ··· 480 482 .support_ct_kill_exit = true, 481 483 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 482 484 .chain_noise_scale = 1000, 483 - .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 485 + .wd_timeout = IWL_DEF_WD_TIMEOUT, 484 486 .max_event_log_size = 512, 485 487 .ucode_tracing = true, 486 488 .sensitivity_calib_by_driver = true, ··· 504 506 .support_ct_kill_exit = true, 505 507 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 506 508 .chain_noise_scale = 1500, 507 - .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, 509 + .wd_timeout = IWL_DEF_WD_TIMEOUT, 508 510 .max_event_log_size = 1024, 509 511 .ucode_tracing = true, 510 512 .sensitivity_calib_by_driver = true, ··· 527 529 .support_ct_kill_exit = true, 528 530 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 529 531 .chain_noise_scale = 1000, 530 - .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, 532 + .wd_timeout = IWL_LONG_WD_TIMEOUT, 531 533 .max_event_log_size = 512, 532 534 .ucode_tracing = true, 533 535 .sensitivity_calib_by_driver = true, ··· 550 552 .bt_sco_disable = true, 551 553 }; 552 554 553 - struct iwl_cfg iwl6000g2a_2agn_cfg = { 555 + struct iwl_cfg iwl6005_2agn_cfg = { 554 556 .name = "Intel(R) Centrino(R) Advanced-N 6205 AGN", 555 557 .fw_name_pre = IWL6000G2A_FW_PRE, 556 558 .ucode_api_max = IWL6000G2_UCODE_API_MAX, ··· 566 568 .led_mode = IWL_LED_RF_STATE, 567 569 }; 568 570 569 - struct iwl_cfg iwl6000g2a_2abg_cfg = { 571 + struct iwl_cfg iwl6005_2abg_cfg = { 570 572 .name = "Intel(R) Centrino(R) Advanced-N 6205 ABG", 571 573 .fw_name_pre = IWL6000G2A_FW_PRE, 572 574 .ucode_api_max = IWL6000G2_UCODE_API_MAX, ··· 581 583 .led_mode = IWL_LED_RF_STATE, 582 584 }; 583 585 584 - struct iwl_cfg iwl6000g2a_2bg_cfg = { 586 + struct iwl_cfg iwl6005_2bg_cfg = { 585 587 .name = "Intel(R) Centrino(R) Advanced-N 6205 BG", 586 588 .fw_name_pre = IWL6000G2A_FW_PRE, 587 589 .ucode_api_max = IWL6000G2_UCODE_API_MAX, ··· 596 598 .led_mode = IWL_LED_RF_STATE, 597 599 }; 598 600 599 - struct iwl_cfg iwl6000g2b_2agn_cfg = { 601 + struct iwl_cfg iwl6030_2agn_cfg = { 600 602 .name = "Intel(R) Centrino(R) Advanced-N 6230 AGN", 601 603 .fw_name_pre = IWL6000G2B_FW_PRE, 602 604 .ucode_api_max = IWL6000G2_UCODE_API_MAX, ··· 616 618 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 617 619 }; 618 620 619 - struct iwl_cfg iwl6000g2b_2abg_cfg = { 621 + struct iwl_cfg iwl6030_2abg_cfg = { 620 622 .name = "Intel(R) Centrino(R) Advanced-N 6230 ABG", 621 623 .fw_name_pre = IWL6000G2B_FW_PRE, 622 624 .ucode_api_max = IWL6000G2_UCODE_API_MAX, ··· 635 637 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 636 638 }; 637 639 638 - struct iwl_cfg iwl6000g2b_2bgn_cfg = { 640 + struct iwl_cfg iwl6030_2bgn_cfg = { 639 641 .name = "Intel(R) Centrino(R) Advanced-N 6230 BGN", 640 642 .fw_name_pre = IWL6000G2B_FW_PRE, 641 643 .ucode_api_max = IWL6000G2_UCODE_API_MAX, ··· 655 657 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 656 658 }; 657 659 658 - struct iwl_cfg iwl6000g2b_2bg_cfg = { 660 + struct iwl_cfg iwl6030_2bg_cfg = { 659 661 .name = "Intel(R) Centrino(R) Advanced-N 6230 BG", 660 662 .fw_name_pre = IWL6000G2B_FW_PRE, 661 663 .ucode_api_max = IWL6000G2_UCODE_API_MAX, ··· 674 676 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 675 677 }; 676 678 677 - struct iwl_cfg iwl6000g2b_bgn_cfg = { 679 + struct iwl_cfg iwl1030_bgn_cfg = { 678 680 .name = "Intel(R) Centrino(R) Wireless-N 1030 BGN", 679 681 .fw_name_pre = IWL6000G2B_FW_PRE, 680 682 .ucode_api_max = IWL6000G2_UCODE_API_MAX, ··· 694 696 .scan_tx_antennas[IEEE80211_BAND_2GHZ] = ANT_A, 695 697 }; 696 698 697 - struct iwl_cfg iwl6000g2b_bg_cfg = { 699 + struct iwl_cfg iwl1030_bg_cfg = { 698 700 .name = "Intel(R) Centrino(R) Wireless-N 1030 BG", 699 701 .fw_name_pre = IWL6000G2B_FW_PRE, 700 702 .ucode_api_max = IWL6000G2_UCODE_API_MAX, ··· 780 782 .led_mode = IWL_LED_BLINK, 781 783 }; 782 784 783 - struct iwl_cfg iwl6050g2_bgn_cfg = { 785 + struct iwl_cfg iwl6150_bgn_cfg = { 784 786 .name = "Intel(R) Centrino(R) Wireless-N + WiMAX 6150 BGN", 785 787 .fw_name_pre = IWL6050_FW_PRE, 786 788 .ucode_api_max = IWL6050_UCODE_API_MAX,
+1
drivers/net/wireless/iwlwifi/iwl-agn-lib.c
··· 405 405 return; 406 406 } 407 407 408 + txq->time_stamp = jiffies; 408 409 info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb); 409 410 memset(&info->status, 0, sizeof(info->status)); 410 411
+3
drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
··· 130 130 131 131 lockdep_assert_held(&priv->mutex); 132 132 133 + if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 134 + return -EINVAL; 135 + 133 136 if (!iwl_is_alive(priv)) 134 137 return -EBUSY; 135 138
+4
drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
··· 531 531 532 532 spin_unlock_irqrestore(&priv->lock, flags); 533 533 534 + /* Enable L1-Active */ 535 + iwl_clear_bits_prph(priv, APMG_PCIDEV_STT_REG, 536 + APMG_PCIDEV_STT_VAL_L1_ACT_DIS); 537 + 534 538 iwlagn_send_wimax_coex(priv); 535 539 536 540 iwlagn_set_Xtal_calib(priv);
+42 -49
drivers/net/wireless/iwlwifi/iwl-agn.c
··· 2502 2502 return pos; 2503 2503 } 2504 2504 2505 - /* enable/disable bt channel announcement */ 2505 + /* enable/disable bt channel inhibition */ 2506 2506 priv->bt_ch_announce = iwlagn_bt_ch_announce; 2507 2507 2508 2508 #ifdef CONFIG_IWLWIFI_DEBUG ··· 2654 2654 /* After the ALIVE response, we can send host commands to the uCode */ 2655 2655 set_bit(STATUS_ALIVE, &priv->status); 2656 2656 2657 - if (priv->cfg->ops->lib->recover_from_tx_stall) { 2658 - /* Enable timer to monitor the driver queues */ 2659 - mod_timer(&priv->monitor_recover, 2660 - jiffies + 2661 - msecs_to_jiffies( 2662 - priv->cfg->base_params->monitor_recover_period)); 2663 - } 2657 + /* Enable watchdog to monitor the driver tx queues */ 2658 + iwl_setup_watchdog(priv); 2664 2659 2665 2660 if (iwl_is_rfkill(priv)) 2666 2661 return; ··· 2750 2755 2751 2756 /* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set 2752 2757 * to prevent rearm timer */ 2753 - if (priv->cfg->ops->lib->recover_from_tx_stall) 2754 - del_timer_sync(&priv->monitor_recover); 2758 + del_timer_sync(&priv->watchdog); 2755 2759 2756 2760 iwl_clear_ucode_stations(priv, NULL); 2757 2761 iwl_dealloc_bcast_stations(priv); ··· 3736 3742 priv->ucode_trace.data = (unsigned long)priv; 3737 3743 priv->ucode_trace.function = iwl_bg_ucode_trace; 3738 3744 3739 - if (priv->cfg->ops->lib->recover_from_tx_stall) { 3740 - init_timer(&priv->monitor_recover); 3741 - priv->monitor_recover.data = (unsigned long)priv; 3742 - priv->monitor_recover.function = 3743 - priv->cfg->ops->lib->recover_from_tx_stall; 3744 - } 3745 + init_timer(&priv->watchdog); 3746 + priv->watchdog.data = (unsigned long)priv; 3747 + priv->watchdog.function = iwl_bg_watchdog; 3745 3748 3746 3749 if (!priv->cfg->base_params->use_isr_legacy) 3747 3750 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) ··· 4035 4044 (iwlagn_ant_coupling > IWL_BT_ANTENNA_COUPLING_THRESHOLD) ? 4036 4045 true : false; 4037 4046 4038 - /* enable/disable bt channel announcement */ 4047 + /* enable/disable bt channel inhibition */ 4039 4048 priv->bt_ch_announce = iwlagn_bt_ch_announce; 4049 + IWL_DEBUG_INFO(priv, "BT channel inhibition is %s\n", 4050 + (priv->bt_ch_announce) ? "On" : "Off"); 4040 4051 4041 4052 if (iwl_alloc_traffic_mem(priv)) 4042 4053 IWL_ERR(priv, "Not enough memory to generate traffic log\n"); ··· 4412 4419 {IWL_PCI_DEVICE(0x4239, 0x1316, iwl6000i_2abg_cfg)}, 4413 4420 4414 4421 /* 6x00 Series Gen2a */ 4415 - {IWL_PCI_DEVICE(0x0082, 0x1301, iwl6000g2a_2agn_cfg)}, 4416 - {IWL_PCI_DEVICE(0x0082, 0x1306, iwl6000g2a_2abg_cfg)}, 4417 - {IWL_PCI_DEVICE(0x0082, 0x1307, iwl6000g2a_2bg_cfg)}, 4418 - {IWL_PCI_DEVICE(0x0082, 0x1321, iwl6000g2a_2agn_cfg)}, 4419 - {IWL_PCI_DEVICE(0x0082, 0x1326, iwl6000g2a_2abg_cfg)}, 4420 - {IWL_PCI_DEVICE(0x0085, 0x1311, iwl6000g2a_2agn_cfg)}, 4421 - {IWL_PCI_DEVICE(0x0085, 0x1316, iwl6000g2a_2abg_cfg)}, 4422 + {IWL_PCI_DEVICE(0x0082, 0x1301, iwl6005_2agn_cfg)}, 4423 + {IWL_PCI_DEVICE(0x0082, 0x1306, iwl6005_2abg_cfg)}, 4424 + {IWL_PCI_DEVICE(0x0082, 0x1307, iwl6005_2bg_cfg)}, 4425 + {IWL_PCI_DEVICE(0x0082, 0x1321, iwl6005_2agn_cfg)}, 4426 + {IWL_PCI_DEVICE(0x0082, 0x1326, iwl6005_2abg_cfg)}, 4427 + {IWL_PCI_DEVICE(0x0085, 0x1311, iwl6005_2agn_cfg)}, 4428 + {IWL_PCI_DEVICE(0x0085, 0x1316, iwl6005_2abg_cfg)}, 4422 4429 4423 4430 /* 6x00 Series Gen2b */ 4424 - {IWL_PCI_DEVICE(0x008A, 0x5305, iwl6000g2b_bgn_cfg)}, 4425 - {IWL_PCI_DEVICE(0x008A, 0x5307, iwl6000g2b_bg_cfg)}, 4426 - {IWL_PCI_DEVICE(0x008A, 0x5325, iwl6000g2b_bgn_cfg)}, 4427 - {IWL_PCI_DEVICE(0x008A, 0x5327, iwl6000g2b_bg_cfg)}, 4428 - {IWL_PCI_DEVICE(0x008B, 0x5315, iwl6000g2b_bgn_cfg)}, 4429 - {IWL_PCI_DEVICE(0x008B, 0x5317, iwl6000g2b_bg_cfg)}, 4430 - {IWL_PCI_DEVICE(0x0090, 0x5211, iwl6000g2b_2agn_cfg)}, 4431 - {IWL_PCI_DEVICE(0x0090, 0x5215, iwl6000g2b_2bgn_cfg)}, 4432 - {IWL_PCI_DEVICE(0x0090, 0x5216, iwl6000g2b_2abg_cfg)}, 4433 - {IWL_PCI_DEVICE(0x0091, 0x5201, iwl6000g2b_2agn_cfg)}, 4434 - {IWL_PCI_DEVICE(0x0091, 0x5205, iwl6000g2b_2bgn_cfg)}, 4435 - {IWL_PCI_DEVICE(0x0091, 0x5206, iwl6000g2b_2abg_cfg)}, 4436 - {IWL_PCI_DEVICE(0x0091, 0x5207, iwl6000g2b_2bg_cfg)}, 4437 - {IWL_PCI_DEVICE(0x0091, 0x5221, iwl6000g2b_2agn_cfg)}, 4438 - {IWL_PCI_DEVICE(0x0091, 0x5225, iwl6000g2b_2bgn_cfg)}, 4439 - {IWL_PCI_DEVICE(0x0091, 0x5226, iwl6000g2b_2abg_cfg)}, 4431 + {IWL_PCI_DEVICE(0x008A, 0x5305, iwl1030_bgn_cfg)}, 4432 + {IWL_PCI_DEVICE(0x008A, 0x5307, iwl1030_bg_cfg)}, 4433 + {IWL_PCI_DEVICE(0x008A, 0x5325, iwl1030_bgn_cfg)}, 4434 + {IWL_PCI_DEVICE(0x008A, 0x5327, iwl1030_bg_cfg)}, 4435 + {IWL_PCI_DEVICE(0x008B, 0x5315, iwl1030_bgn_cfg)}, 4436 + {IWL_PCI_DEVICE(0x008B, 0x5317, iwl1030_bg_cfg)}, 4437 + {IWL_PCI_DEVICE(0x0090, 0x5211, iwl6030_2agn_cfg)}, 4438 + {IWL_PCI_DEVICE(0x0090, 0x5215, iwl6030_2bgn_cfg)}, 4439 + {IWL_PCI_DEVICE(0x0090, 0x5216, iwl6030_2abg_cfg)}, 4440 + {IWL_PCI_DEVICE(0x0091, 0x5201, iwl6030_2agn_cfg)}, 4441 + {IWL_PCI_DEVICE(0x0091, 0x5205, iwl6030_2bgn_cfg)}, 4442 + {IWL_PCI_DEVICE(0x0091, 0x5206, iwl6030_2abg_cfg)}, 4443 + {IWL_PCI_DEVICE(0x0091, 0x5207, iwl6030_2bg_cfg)}, 4444 + {IWL_PCI_DEVICE(0x0091, 0x5221, iwl6030_2agn_cfg)}, 4445 + {IWL_PCI_DEVICE(0x0091, 0x5225, iwl6030_2bgn_cfg)}, 4446 + {IWL_PCI_DEVICE(0x0091, 0x5226, iwl6030_2abg_cfg)}, 4440 4447 4441 4448 /* 6x50 WiFi/WiMax Series */ 4442 4449 {IWL_PCI_DEVICE(0x0087, 0x1301, iwl6050_2agn_cfg)}, ··· 4447 4454 {IWL_PCI_DEVICE(0x0089, 0x1316, iwl6050_2abg_cfg)}, 4448 4455 4449 4456 /* 6x50 WiFi/WiMax Series Gen2 */ 4450 - {IWL_PCI_DEVICE(0x0885, 0x1305, iwl6050g2_bgn_cfg)}, 4451 - {IWL_PCI_DEVICE(0x0885, 0x1306, iwl6050g2_bgn_cfg)}, 4452 - {IWL_PCI_DEVICE(0x0885, 0x1325, iwl6050g2_bgn_cfg)}, 4453 - {IWL_PCI_DEVICE(0x0885, 0x1326, iwl6050g2_bgn_cfg)}, 4454 - {IWL_PCI_DEVICE(0x0886, 0x1315, iwl6050g2_bgn_cfg)}, 4455 - {IWL_PCI_DEVICE(0x0886, 0x1316, iwl6050g2_bgn_cfg)}, 4457 + {IWL_PCI_DEVICE(0x0885, 0x1305, iwl6150_bgn_cfg)}, 4458 + {IWL_PCI_DEVICE(0x0885, 0x1306, iwl6150_bgn_cfg)}, 4459 + {IWL_PCI_DEVICE(0x0885, 0x1325, iwl6150_bgn_cfg)}, 4460 + {IWL_PCI_DEVICE(0x0885, 0x1326, iwl6150_bgn_cfg)}, 4461 + {IWL_PCI_DEVICE(0x0886, 0x1315, iwl6150_bgn_cfg)}, 4462 + {IWL_PCI_DEVICE(0x0886, 0x1316, iwl6150_bgn_cfg)}, 4456 4463 4457 4464 /* 1000 Series WiFi */ 4458 4465 {IWL_PCI_DEVICE(0x0083, 0x1205, iwl1000_bgn_cfg)}, ··· 4581 4588 MODULE_PARM_DESC(antenna_coupling, 4582 4589 "specify antenna coupling in dB (defualt: 0 dB)"); 4583 4590 4584 - module_param_named(bt_ch_announce, iwlagn_bt_ch_announce, bool, S_IRUGO); 4585 - MODULE_PARM_DESC(bt_ch_announce, 4586 - "Enable BT channel announcement mode (default: enable)"); 4591 + module_param_named(bt_ch_inhibition, iwlagn_bt_ch_announce, bool, S_IRUGO); 4592 + MODULE_PARM_DESC(bt_ch_inhibition, 4593 + "Disable BT channel inhibition (default: enable)");
+10 -10
drivers/net/wireless/iwlwifi/iwl-agn.h
··· 74 74 extern struct iwl_cfg iwl5100_abg_cfg; 75 75 extern struct iwl_cfg iwl5150_agn_cfg; 76 76 extern struct iwl_cfg iwl5150_abg_cfg; 77 - extern struct iwl_cfg iwl6000g2a_2agn_cfg; 78 - extern struct iwl_cfg iwl6000g2a_2abg_cfg; 79 - extern struct iwl_cfg iwl6000g2a_2bg_cfg; 80 - extern struct iwl_cfg iwl6000g2b_bgn_cfg; 81 - extern struct iwl_cfg iwl6000g2b_bg_cfg; 82 - extern struct iwl_cfg iwl6000g2b_2agn_cfg; 83 - extern struct iwl_cfg iwl6000g2b_2abg_cfg; 84 - extern struct iwl_cfg iwl6000g2b_2bgn_cfg; 85 - extern struct iwl_cfg iwl6000g2b_2bg_cfg; 77 + extern struct iwl_cfg iwl6005_2agn_cfg; 78 + extern struct iwl_cfg iwl6005_2abg_cfg; 79 + extern struct iwl_cfg iwl6005_2bg_cfg; 80 + extern struct iwl_cfg iwl1030_bgn_cfg; 81 + extern struct iwl_cfg iwl1030_bg_cfg; 82 + extern struct iwl_cfg iwl6030_2agn_cfg; 83 + extern struct iwl_cfg iwl6030_2abg_cfg; 84 + extern struct iwl_cfg iwl6030_2bgn_cfg; 85 + extern struct iwl_cfg iwl6030_2bg_cfg; 86 86 extern struct iwl_cfg iwl6000i_2agn_cfg; 87 87 extern struct iwl_cfg iwl6000i_2abg_cfg; 88 88 extern struct iwl_cfg iwl6000i_2bg_cfg; 89 89 extern struct iwl_cfg iwl6000_3agn_cfg; 90 90 extern struct iwl_cfg iwl6050_2agn_cfg; 91 91 extern struct iwl_cfg iwl6050_2abg_cfg; 92 - extern struct iwl_cfg iwl6050g2_bgn_cfg; 92 + extern struct iwl_cfg iwl6150_bgn_cfg; 93 93 extern struct iwl_cfg iwl1000_bgn_cfg; 94 94 extern struct iwl_cfg iwl1000_bg_cfg; 95 95 extern struct iwl_cfg iwl100_bgn_cfg;
+51 -64
drivers/net/wireless/iwlwifi/iwl-core.c
··· 1894 1894 } 1895 1895 EXPORT_SYMBOL(iwl_mac_change_interface); 1896 1896 1897 - /** 1898 - * iwl_bg_monitor_recover - Timer callback to check for stuck queue and recover 1899 - * 1900 - * During normal condition (no queue is stuck), the timer is continually set to 1901 - * execute every monitor_recover_period milliseconds after the last timer 1902 - * expired. When the queue read_ptr is at the same place, the timer is 1903 - * shorten to 100mSecs. This is 1904 - * 1) to reduce the chance that the read_ptr may wrap around (not stuck) 1905 - * 2) to detect the stuck queues quicker before the station and AP can 1906 - * disassociate each other. 1907 - * 1908 - * This function monitors all the tx queues and recover from it if any 1909 - * of the queues are stuck. 1910 - * 1. It first check the cmd queue for stuck conditions. If it is stuck, 1911 - * it will recover by resetting the firmware and return. 1912 - * 2. Then, it checks for station association. If it associates it will check 1913 - * other queues. If any queue is stuck, it will recover by resetting 1914 - * the firmware. 1915 - * Note: It the number of times the queue read_ptr to be at the same place to 1916 - * be MAX_REPEAT+1 in order to consider to be stuck. 1917 - */ 1918 1897 /* 1919 - * The maximum number of times the read pointer of the tx queue at the 1920 - * same place without considering to be stuck. 1898 + * On every watchdog tick we check (latest) time stamp. If it does not 1899 + * change during timeout period and queue is not empty we reset firmware. 1921 1900 */ 1922 - #define MAX_REPEAT (2) 1923 1901 static int iwl_check_stuck_queue(struct iwl_priv *priv, int cnt) 1924 1902 { 1925 - struct iwl_tx_queue *txq; 1926 - struct iwl_queue *q; 1903 + struct iwl_tx_queue *txq = &priv->txq[cnt]; 1904 + struct iwl_queue *q = &txq->q; 1905 + unsigned long timeout; 1906 + int ret; 1927 1907 1928 - txq = &priv->txq[cnt]; 1929 - q = &txq->q; 1930 - /* queue is empty, skip */ 1931 - if (q->read_ptr == q->write_ptr) 1908 + if (q->read_ptr == q->write_ptr) { 1909 + txq->time_stamp = jiffies; 1932 1910 return 0; 1933 - 1934 - if (q->read_ptr == q->last_read_ptr) { 1935 - /* a queue has not been read from last time */ 1936 - if (q->repeat_same_read_ptr > MAX_REPEAT) { 1937 - IWL_ERR(priv, 1938 - "queue %d stuck %d time. Fw reload.\n", 1939 - q->id, q->repeat_same_read_ptr); 1940 - q->repeat_same_read_ptr = 0; 1941 - iwl_force_reset(priv, IWL_FW_RESET, false); 1942 - } else { 1943 - q->repeat_same_read_ptr++; 1944 - IWL_DEBUG_RADIO(priv, 1945 - "queue %d, not read %d time\n", 1946 - q->id, 1947 - q->repeat_same_read_ptr); 1948 - mod_timer(&priv->monitor_recover, 1949 - jiffies + msecs_to_jiffies( 1950 - IWL_ONE_HUNDRED_MSECS)); 1951 - return 1; 1952 - } 1953 - } else { 1954 - q->last_read_ptr = q->read_ptr; 1955 - q->repeat_same_read_ptr = 0; 1956 1911 } 1912 + 1913 + timeout = txq->time_stamp + 1914 + msecs_to_jiffies(priv->cfg->base_params->wd_timeout); 1915 + 1916 + if (time_after(jiffies, timeout)) { 1917 + IWL_ERR(priv, "Queue %d stuck for %u ms.\n", 1918 + q->id, priv->cfg->base_params->wd_timeout); 1919 + ret = iwl_force_reset(priv, IWL_FW_RESET, false); 1920 + return (ret == -EAGAIN) ? 0 : 1; 1921 + } 1922 + 1957 1923 return 0; 1958 1924 } 1959 1925 1960 - void iwl_bg_monitor_recover(unsigned long data) 1926 + /* 1927 + * Making watchdog tick be a quarter of timeout assure we will 1928 + * discover the queue hung between timeout and 1.25*timeout 1929 + */ 1930 + #define IWL_WD_TICK(timeout) ((timeout) / 4) 1931 + 1932 + /* 1933 + * Watchdog timer callback, we check each tx queue for stuck, if if hung 1934 + * we reset the firmware. If everything is fine just rearm the timer. 1935 + */ 1936 + void iwl_bg_watchdog(unsigned long data) 1961 1937 { 1962 1938 struct iwl_priv *priv = (struct iwl_priv *)data; 1963 1939 int cnt; 1940 + unsigned long timeout; 1964 1941 1965 1942 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 1943 + return; 1944 + 1945 + timeout = priv->cfg->base_params->wd_timeout; 1946 + if (timeout == 0) 1966 1947 return; 1967 1948 1968 1949 /* monitor and check for stuck cmd queue */ ··· 1960 1979 return; 1961 1980 } 1962 1981 } 1963 - if (priv->cfg->base_params->monitor_recover_period) { 1964 - /* 1965 - * Reschedule the timer to occur in 1966 - * priv->cfg->base_params->monitor_recover_period 1967 - */ 1968 - mod_timer(&priv->monitor_recover, jiffies + msecs_to_jiffies( 1969 - priv->cfg->base_params->monitor_recover_period)); 1970 - } 1971 - } 1972 - EXPORT_SYMBOL(iwl_bg_monitor_recover); 1973 1982 1983 + mod_timer(&priv->watchdog, jiffies + 1984 + msecs_to_jiffies(IWL_WD_TICK(timeout))); 1985 + } 1986 + EXPORT_SYMBOL(iwl_bg_watchdog); 1987 + 1988 + void iwl_setup_watchdog(struct iwl_priv *priv) 1989 + { 1990 + unsigned int timeout = priv->cfg->base_params->wd_timeout; 1991 + 1992 + if (timeout) 1993 + mod_timer(&priv->watchdog, 1994 + jiffies + msecs_to_jiffies(IWL_WD_TICK(timeout))); 1995 + else 1996 + del_timer(&priv->watchdog); 1997 + } 1998 + EXPORT_SYMBOL(iwl_setup_watchdog); 1974 1999 1975 2000 /* 1976 2001 * extended beacon time format
+4 -6
drivers/net/wireless/iwlwifi/iwl-core.h
··· 210 210 211 211 /* temperature */ 212 212 struct iwl_temp_ops temp_ops; 213 - /* recover from tx queue stall */ 214 - void (*recover_from_tx_stall)(unsigned long data); 215 213 /* check for plcp health */ 216 214 bool (*check_plcp_health)(struct iwl_priv *priv, 217 215 struct iwl_rx_packet *pkt); ··· 278 280 * @plcp_delta_threshold: plcp error rate threshold used to trigger 279 281 * radio tuning when there is a high receiving plcp error rate 280 282 * @chain_noise_scale: default chain noise scale used for gain computation 281 - * @monitor_recover_period: default timer used to check stuck queues 283 + * @wd_timeout: TX queues watchdog timeout 282 284 * @temperature_kelvin: temperature report by uCode in kelvin 283 285 * @max_event_log_size: size of event log buffer size for ucode event logging 284 286 * @tx_power_by_driver: tx power calibration performed by driver ··· 313 315 const bool support_wimax_coexist; 314 316 u8 plcp_delta_threshold; 315 317 s32 chain_noise_scale; 316 - /* timer period for monitor the driver queues */ 317 - u32 monitor_recover_period; 318 + unsigned int wd_timeout; 318 319 bool temperature_kelvin; 319 320 u32 max_event_log_size; 320 321 const bool tx_power_by_driver; ··· 543 546 void iwl_tx_queue_reset(struct iwl_priv *priv, struct iwl_tx_queue *txq, 544 547 int slots_num, u32 txq_id); 545 548 void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id); 549 + void iwl_setup_watchdog(struct iwl_priv *priv); 546 550 /***************************************************** 547 551 * TX power 548 552 ****************************************************/ ··· 623 625 return pci_lnk_ctl; 624 626 } 625 627 626 - void iwl_bg_monitor_recover(unsigned long data); 628 + void iwl_bg_watchdog(unsigned long data); 627 629 u32 iwl_usecs_to_beacons(struct iwl_priv *priv, u32 usec, u32 beacon_interval); 628 630 __le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base, 629 631 u32 addon, u32 beacon_interval);
+9 -15
drivers/net/wireless/iwlwifi/iwl-debugfs.c
··· 1534 1534 user_buf, count, ppos); 1535 1535 } 1536 1536 1537 - static ssize_t iwl_dbgfs_monitor_period_write(struct file *file, 1537 + static ssize_t iwl_dbgfs_wd_timeout_write(struct file *file, 1538 1538 const char __user *user_buf, 1539 1539 size_t count, loff_t *ppos) { 1540 1540 1541 1541 struct iwl_priv *priv = file->private_data; 1542 1542 char buf[8]; 1543 1543 int buf_size; 1544 - int period; 1544 + int timeout; 1545 1545 1546 1546 memset(buf, 0, sizeof(buf)); 1547 1547 buf_size = min(count, sizeof(buf) - 1); 1548 1548 if (copy_from_user(buf, user_buf, buf_size)) 1549 1549 return -EFAULT; 1550 - if (sscanf(buf, "%d", &period) != 1) 1550 + if (sscanf(buf, "%d", &timeout) != 1) 1551 1551 return -EINVAL; 1552 - if (period < 0 || period > IWL_MAX_MONITORING_PERIOD) 1553 - priv->cfg->base_params->monitor_recover_period = 1554 - IWL_DEF_MONITORING_PERIOD; 1555 - else 1556 - priv->cfg->base_params->monitor_recover_period = period; 1552 + if (timeout < 0 || timeout > IWL_MAX_WD_TIMEOUT) 1553 + timeout = IWL_DEF_WD_TIMEOUT; 1557 1554 1558 - if (priv->cfg->base_params->monitor_recover_period) 1559 - mod_timer(&priv->monitor_recover, jiffies + msecs_to_jiffies( 1560 - priv->cfg->base_params->monitor_recover_period)); 1561 - else 1562 - del_timer_sync(&priv->monitor_recover); 1555 + priv->cfg->base_params->wd_timeout = timeout; 1556 + iwl_setup_watchdog(priv); 1563 1557 return count; 1564 1558 } 1565 1559 ··· 1680 1686 DEBUGFS_READ_FILE_OPS(rxon_filter_flags); 1681 1687 DEBUGFS_WRITE_FILE_OPS(txfifo_flush); 1682 1688 DEBUGFS_READ_FILE_OPS(ucode_bt_stats); 1683 - DEBUGFS_WRITE_FILE_OPS(monitor_period); 1689 + DEBUGFS_WRITE_FILE_OPS(wd_timeout); 1684 1690 DEBUGFS_READ_FILE_OPS(bt_traffic); 1685 1691 DEBUGFS_READ_WRITE_FILE_OPS(protection_mode); 1686 1692 DEBUGFS_READ_FILE_OPS(reply_tx_error); ··· 1757 1763 DEBUGFS_ADD_FILE(reply_tx_error, dir_debug, S_IRUSR); 1758 1764 DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); 1759 1765 DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); 1760 - DEBUGFS_ADD_FILE(monitor_period, dir_debug, S_IWUSR); 1766 + DEBUGFS_ADD_FILE(wd_timeout, dir_debug, S_IWUSR); 1761 1767 if (priv->cfg->bt_params && priv->cfg->bt_params->advanced_bt_coexist) 1762 1768 DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR); 1763 1769 if (priv->cfg->base_params->sensitivity_calib_by_driver)
+7 -9
drivers/net/wireless/iwlwifi/iwl-dev.h
··· 129 129 int write_ptr; /* 1-st empty entry (index) host_w*/ 130 130 int read_ptr; /* last used entry (index) host_r*/ 131 131 /* use for monitoring and recovering the stuck queue */ 132 - int last_read_ptr; /* storing the last read_ptr */ 133 - /* number of time read_ptr and last_read_ptr are the same */ 134 - u8 repeat_same_read_ptr; 135 132 dma_addr_t dma_addr; /* physical addr for BD's */ 136 133 int n_window; /* safe queue window */ 137 134 u32 id; ··· 152 155 * @meta: array of meta data for each command/tx buffer 153 156 * @dma_addr_cmd: physical address of cmd/tx buffer array 154 157 * @txb: array of per-TFD driver data 158 + * @time_stamp: time (in jiffies) of last read_ptr change 155 159 * @need_update: indicates need to update read/write index 156 160 * @sched_retry: indicates queue is high-throughput aggregation (HT AGG) enabled 157 161 * ··· 168 170 struct iwl_device_cmd **cmd; 169 171 struct iwl_cmd_meta *meta; 170 172 struct iwl_tx_info *txb; 173 + unsigned long time_stamp; 171 174 u8 need_update; 172 175 u8 sched_retry; 173 176 u8 active; ··· 1103 1104 #define IWL_DELAY_NEXT_FORCE_RF_RESET (HZ*3) 1104 1105 #define IWL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5) 1105 1106 1106 - /* timer constants use to monitor and recover stuck tx queues in mSecs */ 1107 - #define IWL_DEF_MONITORING_PERIOD (1000) 1108 - #define IWL_LONG_MONITORING_PERIOD (5000) 1109 - #define IWL_ONE_HUNDRED_MSECS (100) 1110 - #define IWL_MAX_MONITORING_PERIOD (60000) 1107 + /* TX queue watchdog timeouts in mSecs */ 1108 + #define IWL_DEF_WD_TIMEOUT (2000) 1109 + #define IWL_LONG_WD_TIMEOUT (10000) 1110 + #define IWL_MAX_WD_TIMEOUT (120000) 1111 1111 1112 1112 /* BT Antenna Coupling Threshold (dB) */ 1113 1113 #define IWL_BT_ANTENNA_COUPLING_THRESHOLD (35) ··· 1542 1544 struct work_struct run_time_calib_work; 1543 1545 struct timer_list statistics_periodic; 1544 1546 struct timer_list ucode_trace; 1545 - struct timer_list monitor_recover; 1547 + struct timer_list watchdog; 1546 1548 bool hw_ready; 1547 1549 1548 1550 struct iwl_event_log event_log;
+13
drivers/net/wireless/iwlwifi/iwl-sta.c
··· 647 647 memcpy(&lq, priv->stations[sta_id].lq, sizeof(lq)); 648 648 649 649 active = priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE; 650 + priv->stations[sta_id].used &= ~IWL_STA_DRIVER_ACTIVE; 650 651 spin_unlock_irqrestore(&priv->sta_lock, flags); 651 652 652 653 if (active) { ··· 658 657 IWL_ERR(priv, "failed to remove STA %pM (%d)\n", 659 658 priv->stations[sta_id].sta.sta.addr, ret); 660 659 } 660 + spin_lock_irqsave(&priv->sta_lock, flags); 661 + priv->stations[sta_id].used |= IWL_STA_DRIVER_ACTIVE; 662 + spin_unlock_irqrestore(&priv->sta_lock, flags); 663 + 661 664 ret = iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC); 662 665 if (ret) 663 666 IWL_ERR(priv, "failed to re-add STA %pM (%d)\n", ··· 781 776 782 777 if (WARN_ON(lq->sta_id == IWL_INVALID_STATION)) 783 778 return -EINVAL; 779 + 780 + 781 + spin_lock_irqsave(&priv->sta_lock, flags_spin); 782 + if (!(priv->stations[lq->sta_id].used & IWL_STA_DRIVER_ACTIVE)) { 783 + spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 784 + return -EINVAL; 785 + } 786 + spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 784 787 785 788 iwl_dump_lq_cmd(priv, lq); 786 789 BUG_ON(init && (cmd.flags & CMD_ASYNC));
-2
drivers/net/wireless/iwlwifi/iwl-tx.c
··· 263 263 q->high_mark = 2; 264 264 265 265 q->write_ptr = q->read_ptr = 0; 266 - q->last_read_ptr = 0; 267 - q->repeat_same_read_ptr = 0; 268 266 269 267 return 0; 270 268 }
+13 -15
drivers/net/wireless/iwlwifi/iwl3945-base.c
··· 2509 2509 /* After the ALIVE response, we can send commands to 3945 uCode */ 2510 2510 set_bit(STATUS_ALIVE, &priv->status); 2511 2511 2512 - if (priv->cfg->ops->lib->recover_from_tx_stall) { 2513 - /* Enable timer to monitor the driver queues */ 2514 - mod_timer(&priv->monitor_recover, 2515 - jiffies + 2516 - msecs_to_jiffies( 2517 - priv->cfg->base_params->monitor_recover_period)); 2518 - } 2512 + /* Enable watchdog to monitor the driver tx queues */ 2513 + iwl_setup_watchdog(priv); 2519 2514 2520 2515 if (iwl_is_rfkill(priv)) 2521 2516 return; ··· 2567 2572 2568 2573 /* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set 2569 2574 * to prevent rearm timer */ 2570 - if (priv->cfg->ops->lib->recover_from_tx_stall) 2571 - del_timer_sync(&priv->monitor_recover); 2575 + del_timer_sync(&priv->watchdog); 2572 2576 2573 2577 /* Station information will now be cleared in device */ 2574 2578 iwl_clear_ucode_stations(priv, NULL); ··· 3769 3775 3770 3776 iwl3945_hw_setup_deferred_work(priv); 3771 3777 3772 - if (priv->cfg->ops->lib->recover_from_tx_stall) { 3773 - init_timer(&priv->monitor_recover); 3774 - priv->monitor_recover.data = (unsigned long)priv; 3775 - priv->monitor_recover.function = 3776 - priv->cfg->ops->lib->recover_from_tx_stall; 3777 - } 3778 + init_timer(&priv->watchdog); 3779 + priv->watchdog.data = (unsigned long)priv; 3780 + priv->watchdog.function = iwl_bg_watchdog; 3778 3781 3779 3782 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) 3780 3783 iwl3945_irq_tasklet, (unsigned long)priv); ··· 3851 3860 3852 3861 priv->iw_mode = NL80211_IFTYPE_STATION; 3853 3862 priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF; 3863 + 3864 + /* initialize force reset */ 3865 + priv->force_reset[IWL_RF_RESET].reset_duration = 3866 + IWL_DELAY_NEXT_FORCE_RF_RESET; 3867 + priv->force_reset[IWL_FW_RESET].reset_duration = 3868 + IWL_DELAY_NEXT_FORCE_FW_RELOAD; 3869 + 3854 3870 3855 3871 priv->tx_power_user_lmt = IWL_DEFAULT_TX_POWER; 3856 3872 priv->tx_power_next = IWL_DEFAULT_TX_POWER;
+6
drivers/net/wireless/orinoco/main.c
··· 1811 1811 struct net_device *dev = priv->ndev; 1812 1812 int err = 0; 1813 1813 1814 + /* If we've called commit, we are reconfiguring or bringing the 1815 + * interface up. Maintaining countermeasures across this would 1816 + * be confusing, so note that we've disabled them. The port will 1817 + * be enabled later in orinoco_commit or __orinoco_up. */ 1818 + priv->tkip_cm_active = 0; 1819 + 1814 1820 err = orinoco_hw_program_rids(priv); 1815 1821 1816 1822 /* FIXME: what about netif_tx_lock */
+7 -7
drivers/net/wireless/orinoco/orinoco_cs.c
··· 151 151 goto failed; 152 152 } 153 153 154 - ret = pcmcia_request_irq(link, orinoco_interrupt); 155 - if (ret) 156 - goto failed; 157 - 158 - /* We initialize the hermes structure before completing PCMCIA 159 - * configuration just in case the interrupt handler gets 160 - * called. */ 161 154 mem = ioport_map(link->resource[0]->start, 162 155 resource_size(link->resource[0])); 163 156 if (!mem) 164 157 goto failed; 165 158 159 + /* We initialize the hermes structure before completing PCMCIA 160 + * configuration just in case the interrupt handler gets 161 + * called. */ 166 162 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); 163 + 164 + ret = pcmcia_request_irq(link, orinoco_interrupt); 165 + if (ret) 166 + goto failed; 167 167 168 168 ret = pcmcia_enable_device(link); 169 169 if (ret)
+7 -7
drivers/net/wireless/orinoco/spectrum_cs.c
··· 214 214 goto failed; 215 215 } 216 216 217 - ret = pcmcia_request_irq(link, orinoco_interrupt); 218 - if (ret) 219 - goto failed; 220 - 221 - /* We initialize the hermes structure before completing PCMCIA 222 - * configuration just in case the interrupt handler gets 223 - * called. */ 224 217 mem = ioport_map(link->resource[0]->start, 225 218 resource_size(link->resource[0])); 226 219 if (!mem) 227 220 goto failed; 228 221 222 + /* We initialize the hermes structure before completing PCMCIA 223 + * configuration just in case the interrupt handler gets 224 + * called. */ 229 225 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); 230 226 hw->eeprom_pda = true; 227 + 228 + ret = pcmcia_request_irq(link, orinoco_interrupt); 229 + if (ret) 230 + goto failed; 231 231 232 232 ret = pcmcia_enable_device(link); 233 233 if (ret)
+10 -2
drivers/net/wireless/orinoco/wext.c
··· 893 893 */ 894 894 break; 895 895 896 + case IW_AUTH_MFP: 897 + /* Management Frame Protection not supported. 898 + * Only fail if set to required. 899 + */ 900 + if (param->value == IW_AUTH_MFP_REQUIRED) 901 + ret = -EINVAL; 902 + break; 903 + 896 904 case IW_AUTH_KEY_MGMT: 897 905 /* wl_lkm implies value 2 == PSK for Hermes I 898 906 * which ties in with WEXT ··· 919 911 */ 920 912 if (param->value) { 921 913 priv->tkip_cm_active = 1; 922 - ret = hermes_enable_port(hw, 0); 914 + ret = hermes_disable_port(hw, 0); 923 915 } else { 924 916 priv->tkip_cm_active = 0; 925 - ret = hermes_disable_port(hw, 0); 917 + ret = hermes_enable_port(hw, 0); 926 918 } 927 919 break; 928 920
+1 -3
include/linux/average.h
··· 1 1 #ifndef _LINUX_AVERAGE_H 2 2 #define _LINUX_AVERAGE_H 3 3 4 - #include <linux/kernel.h> 5 - 6 4 /* Exponentially weighted moving average (EWMA) */ 7 5 8 6 /* For more documentation see lib/average.c */ ··· 24 26 */ 25 27 static inline unsigned long ewma_read(const struct ewma *avg) 26 28 { 27 - return DIV_ROUND_CLOSEST(avg->internal, avg->factor); 29 + return avg->internal >> avg->factor; 28 30 } 29 31 30 32 #endif /* _LINUX_AVERAGE_H */
+3
include/linux/ieee80211.h
··· 1223 1223 WLAN_EID_BSS_AC_ACCESS_DELAY = 68, 1224 1224 WLAN_EID_RRM_ENABLED_CAPABILITIES = 70, 1225 1225 WLAN_EID_MULTIPLE_BSSID = 71, 1226 + WLAN_EID_BSS_COEX_2040 = 72, 1227 + WLAN_EID_OVERLAP_BSS_SCAN_PARAM = 74, 1228 + WLAN_EID_EXT_CAPABILITY = 127, 1226 1229 1227 1230 WLAN_EID_MOBILITY_DOMAIN = 54, 1228 1231 WLAN_EID_FAST_BSS_TRANSITION = 55,
+18
include/linux/nl80211.h
··· 394 394 * 395 395 * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface. 396 396 * 397 + * @NL80211_CMD_JOIN_MESH: Join a mesh. The mesh ID must be given, and initial 398 + * mesh config parameters may be given. 399 + * @NL80211_CMD_LEAVE_MESH: Leave the mesh network -- no special arguments, the 400 + * network is determined by the network interface. 401 + * 397 402 * @NL80211_CMD_MAX: highest used command number 398 403 * @__NL80211_CMD_AFTER_LAST: internal use 399 404 */ ··· 504 499 NL80211_CMD_SET_WDS_PEER, 505 500 506 501 NL80211_CMD_FRAME_WAIT_CANCEL, 502 + 503 + NL80211_CMD_JOIN_MESH, 504 + NL80211_CMD_LEAVE_MESH, 507 505 508 506 /* add new commands above here */ 509 507 ··· 849 841 * flag isn't set, the frame will be rejected. This is also used as an 850 842 * nl80211 capability flag. 851 843 * 844 + * @NL80211_ATTR_BSS_HTOPMODE: HT operation mode (u16) 845 + * 852 846 * @NL80211_ATTR_MAX: highest attribute number currently defined 853 847 * @__NL80211_ATTR_AFTER_LAST: internal use 854 848 */ ··· 1027 1017 1028 1018 NL80211_ATTR_OFFCHANNEL_TX_OK, 1029 1019 1020 + NL80211_ATTR_BSS_HT_OPMODE, 1021 + 1030 1022 /* add attributes here, update the policy in nl80211.c */ 1031 1023 1032 1024 __NL80211_ATTR_AFTER_LAST, ··· 1195 1183 * station) 1196 1184 * @NL80211_STA_INFO_TX_RETRIES: total retries (u32, to this station) 1197 1185 * @NL80211_STA_INFO_TX_FAILED: total failed packets (u32, to this station) 1186 + * @NL80211_STA_INFO_SIGNAL_AVG: signal strength average (u8, dBm) 1198 1187 */ 1199 1188 enum nl80211_sta_info { 1200 1189 __NL80211_STA_INFO_INVALID, ··· 1211 1198 NL80211_STA_INFO_TX_PACKETS, 1212 1199 NL80211_STA_INFO_TX_RETRIES, 1213 1200 NL80211_STA_INFO_TX_FAILED, 1201 + NL80211_STA_INFO_SIGNAL_AVG, 1214 1202 1215 1203 /* keep last */ 1216 1204 __NL80211_STA_INFO_AFTER_LAST, ··· 1561 1547 * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh 1562 1548 * point. 1563 1549 * 1550 + * @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a 1551 + * source mesh point for path selection elements. 1552 + * 1564 1553 * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically 1565 1554 * open peer links when we detect compatible mesh peers. 1566 1555 * ··· 1610 1593 NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, 1611 1594 NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, 1612 1595 NL80211_MESHCONF_HWMP_ROOTMODE, 1596 + NL80211_MESHCONF_ELEMENT_TTL, 1613 1597 1614 1598 /* keep last */ 1615 1599 __NL80211_MESHCONF_ATTR_AFTER_LAST,
+45 -13
include/net/cfg80211.h
··· 258 258 259 259 /** 260 260 * struct vif_params - describes virtual interface parameters 261 - * @mesh_id: mesh ID to use 262 - * @mesh_id_len: length of the mesh ID 263 261 * @use_4addr: use 4-address frames 264 262 */ 265 263 struct vif_params { 266 - u8 *mesh_id; 267 - int mesh_id_len; 268 264 int use_4addr; 269 265 }; 270 266 ··· 420 424 * @STATION_INFO_TX_RETRIES: @tx_retries filled 421 425 * @STATION_INFO_TX_FAILED: @tx_failed filled 422 426 * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled 427 + * @STATION_INFO_SIGNAL_AVG: @signal_avg filled 423 428 */ 424 429 enum station_info_flags { 425 430 STATION_INFO_INACTIVE_TIME = 1<<0, ··· 436 439 STATION_INFO_TX_RETRIES = 1<<10, 437 440 STATION_INFO_TX_FAILED = 1<<11, 438 441 STATION_INFO_RX_DROP_MISC = 1<<12, 442 + STATION_INFO_SIGNAL_AVG = 1<<13, 439 443 }; 440 444 441 445 /** ··· 483 485 * @plid: mesh peer link id 484 486 * @plink_state: mesh peer link state 485 487 * @signal: signal strength of last received packet in dBm 488 + * @signal_avg: signal strength average in dBm 486 489 * @txrate: current unicast bitrate to this station 487 490 * @rx_packets: packets received from this station 488 491 * @tx_packets: packets transmitted to this station ··· 504 505 u16 plid; 505 506 u8 plink_state; 506 507 s8 signal; 508 + s8 signal_avg; 507 509 struct rate_info txrate; 508 510 u32 rx_packets; 509 511 u32 tx_packets; ··· 605 605 * (or NULL for no change) 606 606 * @basic_rates_len: number of basic rates 607 607 * @ap_isolate: do not forward packets between connected stations 608 + * @ht_opmode: HT Operation mode 609 + * (u16 = opmode, -1 = do not change) 608 610 */ 609 611 struct bss_parameters { 610 612 int use_cts_prot; ··· 615 613 u8 *basic_rates; 616 614 u8 basic_rates_len; 617 615 int ap_isolate; 616 + int ht_opmode; 618 617 }; 619 618 619 + /* 620 + * struct mesh_config - 802.11s mesh configuration 621 + * 622 + * These parameters can be changed while the mesh is active. 623 + */ 620 624 struct mesh_config { 621 625 /* Timeouts in ms */ 622 626 /* Mesh plink management parameters */ ··· 632 624 u16 dot11MeshMaxPeerLinks; 633 625 u8 dot11MeshMaxRetries; 634 626 u8 dot11MeshTTL; 627 + /* ttl used in path selection information elements */ 628 + u8 element_ttl; 635 629 bool auto_open_plinks; 636 630 /* HWMP parameters */ 637 631 u8 dot11MeshHWMPmaxPREQretries; ··· 643 633 u16 dot11MeshHWMPpreqMinInterval; 644 634 u16 dot11MeshHWMPnetDiameterTraversalTime; 645 635 u8 dot11MeshHWMPRootMode; 636 + }; 637 + 638 + /** 639 + * struct mesh_setup - 802.11s mesh setup configuration 640 + * @mesh_id: the mesh ID 641 + * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 642 + * 643 + * These parameters are fixed when the mesh is created. 644 + */ 645 + struct mesh_setup { 646 + const u8 *mesh_id; 647 + u8 mesh_id_len; 646 648 }; 647 649 648 650 /** ··· 1053 1031 * 1054 1032 * @add_virtual_intf: create a new virtual interface with the given name, 1055 1033 * must set the struct wireless_dev's iftype. Beware: You must create 1056 - * the new netdev in the wiphy's network namespace! 1034 + * the new netdev in the wiphy's network namespace! Returns the netdev, 1035 + * or an ERR_PTR. 1057 1036 * 1058 1037 * @del_virtual_intf: remove the virtual interface determined by ifindex. 1059 1038 * ··· 1098 1075 * 1099 1076 * @get_mesh_params: Put the current mesh parameters into *params 1100 1077 * 1101 - * @set_mesh_params: Set mesh parameters. 1078 + * @update_mesh_params: Update mesh parameters on a running mesh. 1102 1079 * The mask is a bitfield which tells us which parameters to 1103 1080 * set, and which to leave alone. 1104 1081 * ··· 1189 1166 int (*suspend)(struct wiphy *wiphy); 1190 1167 int (*resume)(struct wiphy *wiphy); 1191 1168 1192 - int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 1193 - enum nl80211_iftype type, u32 *flags, 1194 - struct vif_params *params); 1169 + struct net_device * (*add_virtual_intf)(struct wiphy *wiphy, 1170 + char *name, 1171 + enum nl80211_iftype type, 1172 + u32 *flags, 1173 + struct vif_params *params); 1195 1174 int (*del_virtual_intf)(struct wiphy *wiphy, struct net_device *dev); 1196 1175 int (*change_virtual_intf)(struct wiphy *wiphy, 1197 1176 struct net_device *dev, ··· 1249 1224 int (*get_mesh_params)(struct wiphy *wiphy, 1250 1225 struct net_device *dev, 1251 1226 struct mesh_config *conf); 1252 - int (*set_mesh_params)(struct wiphy *wiphy, 1253 - struct net_device *dev, 1254 - const struct mesh_config *nconf, u32 mask); 1227 + int (*update_mesh_params)(struct wiphy *wiphy, 1228 + struct net_device *dev, u32 mask, 1229 + const struct mesh_config *nconf); 1230 + int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, 1231 + const struct mesh_config *conf, 1232 + const struct mesh_setup *setup); 1233 + int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); 1234 + 1255 1235 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 1256 1236 struct bss_parameters *params); 1257 1237 ··· 1672 1642 * @bssid: (private) Used by the internal configuration code 1673 1643 * @ssid: (private) Used by the internal configuration code 1674 1644 * @ssid_len: (private) Used by the internal configuration code 1645 + * @mesh_id_len: (private) Used by the internal configuration code 1646 + * @mesh_id_up_len: (private) Used by the internal configuration code 1675 1647 * @wext: (private) Used by the internal wireless extensions compat code 1676 1648 * @use_4addr: indicates 4addr mode is used on this interface, must be 1677 1649 * set by driver (if supported) on add_interface BEFORE registering the ··· 1703 1671 1704 1672 /* currently used for IBSS and SME - might be rearranged later */ 1705 1673 u8 ssid[IEEE80211_MAX_SSID_LEN]; 1706 - u8 ssid_len; 1674 + u8 ssid_len, mesh_id_len, mesh_id_up_len; 1707 1675 enum { 1708 1676 CFG80211_SME_IDLE, 1709 1677 CFG80211_SME_CONNECTING,
+12 -8
lib/average.c
··· 8 8 #include <linux/module.h> 9 9 #include <linux/average.h> 10 10 #include <linux/bug.h> 11 + #include <linux/log2.h> 11 12 12 13 /** 13 14 * DOC: Exponentially Weighted Moving Average (EWMA) ··· 25 24 * ewma_init() - Initialize EWMA parameters 26 25 * @avg: Average structure 27 26 * @factor: Factor to use for the scaled up internal value. The maximum value 28 - * of averages can be ULONG_MAX/(factor*weight). 27 + * of averages can be ULONG_MAX/(factor*weight). For performance reasons 28 + * factor has to be a power of 2. 29 29 * @weight: Exponential weight, or decay rate. This defines how fast the 30 - * influence of older values decreases. Has to be bigger than 1. 30 + * influence of older values decreases. For performance reasons weight has 31 + * to be a power of 2. 31 32 * 32 33 * Initialize the EWMA parameters for a given struct ewma @avg. 33 34 */ 34 35 void ewma_init(struct ewma *avg, unsigned long factor, unsigned long weight) 35 36 { 36 - WARN_ON(weight <= 1 || factor == 0); 37 + WARN_ON(!is_power_of_2(weight) || !is_power_of_2(factor)); 38 + 39 + avg->weight = ilog2(weight); 40 + avg->factor = ilog2(factor); 37 41 avg->internal = 0; 38 - avg->weight = weight; 39 - avg->factor = factor; 40 42 } 41 43 EXPORT_SYMBOL(ewma_init); 42 44 ··· 53 49 struct ewma *ewma_add(struct ewma *avg, unsigned long val) 54 50 { 55 51 avg->internal = avg->internal ? 56 - (((avg->internal * (avg->weight - 1)) + 57 - (val * avg->factor)) / avg->weight) : 58 - (val * avg->factor); 52 + (((avg->internal << avg->weight) - avg->internal) + 53 + (val << avg->factor)) >> avg->weight : 54 + (val << avg->factor); 59 55 return avg; 60 56 } 61 57 EXPORT_SYMBOL(ewma_add);
+1
net/mac80211/Kconfig
··· 6 6 select CRYPTO_ARC4 7 7 select CRYPTO_AES 8 8 select CRC32 9 + select AVERAGE 9 10 ---help--- 10 11 This option enables the hardware independent IEEE 802.11 11 12 networking stack.
+52 -18
net/mac80211/cfg.c
··· 19 19 #include "rate.h" 20 20 #include "mesh.h" 21 21 22 - static int ieee80211_add_iface(struct wiphy *wiphy, char *name, 23 - enum nl80211_iftype type, u32 *flags, 24 - struct vif_params *params) 22 + static struct net_device *ieee80211_add_iface(struct wiphy *wiphy, char *name, 23 + enum nl80211_iftype type, 24 + u32 *flags, 25 + struct vif_params *params) 25 26 { 26 27 struct ieee80211_local *local = wiphy_priv(wiphy); 27 28 struct net_device *dev; ··· 30 29 int err; 31 30 32 31 err = ieee80211_if_add(local, name, &dev, type, params); 33 - if (err || type != NL80211_IFTYPE_MONITOR || !flags) 34 - return err; 32 + if (err) 33 + return ERR_PTR(err); 35 34 36 - sdata = IEEE80211_DEV_TO_SUB_IF(dev); 37 - sdata->u.mntr_flags = *flags; 38 - return 0; 35 + if (type == NL80211_IFTYPE_MONITOR && flags) { 36 + sdata = IEEE80211_DEV_TO_SUB_IF(dev); 37 + sdata->u.mntr_flags = *flags; 38 + } 39 + 40 + return dev; 39 41 } 40 42 41 43 static int ieee80211_del_iface(struct wiphy *wiphy, struct net_device *dev) ··· 59 55 ret = ieee80211_if_change_type(sdata, type); 60 56 if (ret) 61 57 return ret; 62 - 63 - if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len) 64 - ieee80211_sdata_set_mesh_id(sdata, 65 - params->mesh_id_len, 66 - params->mesh_id); 67 58 68 59 if (type == NL80211_IFTYPE_AP_VLAN && 69 60 params && params->use_4addr == 0) ··· 342 343 343 344 if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) || 344 345 (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) { 345 - sinfo->filled |= STATION_INFO_SIGNAL; 346 + sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG; 346 347 sinfo->signal = (s8)sta->last_signal; 348 + sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal); 347 349 } 348 350 349 351 sinfo->txrate.flags = 0; ··· 999 999 return (mask >> (parm-1)) & 0x1; 1000 1000 } 1001 1001 1002 - static int ieee80211_set_mesh_params(struct wiphy *wiphy, 1003 - struct net_device *dev, 1004 - const struct mesh_config *nconf, u32 mask) 1002 + static int ieee80211_update_mesh_params(struct wiphy *wiphy, 1003 + struct net_device *dev, u32 mask, 1004 + const struct mesh_config *nconf) 1005 1005 { 1006 1006 struct mesh_config *conf; 1007 1007 struct ieee80211_sub_if_data *sdata; ··· 1024 1024 conf->dot11MeshMaxRetries = nconf->dot11MeshMaxRetries; 1025 1025 if (_chg_mesh_attr(NL80211_MESHCONF_TTL, mask)) 1026 1026 conf->dot11MeshTTL = nconf->dot11MeshTTL; 1027 + if (_chg_mesh_attr(NL80211_MESHCONF_ELEMENT_TTL, mask)) 1028 + conf->dot11MeshTTL = nconf->element_ttl; 1027 1029 if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS, mask)) 1028 1030 conf->auto_open_plinks = nconf->auto_open_plinks; 1029 1031 if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, mask)) ··· 1052 1050 return 0; 1053 1051 } 1054 1052 1053 + static int ieee80211_join_mesh(struct wiphy *wiphy, struct net_device *dev, 1054 + const struct mesh_config *conf, 1055 + const struct mesh_setup *setup) 1056 + { 1057 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1058 + struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 1059 + 1060 + memcpy(&sdata->u.mesh.mshcfg, conf, sizeof(struct mesh_config)); 1061 + ifmsh->mesh_id_len = setup->mesh_id_len; 1062 + memcpy(ifmsh->mesh_id, setup->mesh_id, ifmsh->mesh_id_len); 1063 + 1064 + ieee80211_start_mesh(sdata); 1065 + 1066 + return 0; 1067 + } 1068 + 1069 + static int ieee80211_leave_mesh(struct wiphy *wiphy, struct net_device *dev) 1070 + { 1071 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1072 + 1073 + ieee80211_stop_mesh(sdata); 1074 + 1075 + return 0; 1076 + } 1055 1077 #endif 1056 1078 1057 1079 static int ieee80211_change_bss(struct wiphy *wiphy, ··· 1132 1106 sdata->flags |= IEEE80211_SDATA_DONT_BRIDGE_PACKETS; 1133 1107 else 1134 1108 sdata->flags &= ~IEEE80211_SDATA_DONT_BRIDGE_PACKETS; 1109 + } 1110 + 1111 + if (params->ht_opmode >= 0) { 1112 + sdata->vif.bss_conf.ht_operation_mode = 1113 + (u16) params->ht_opmode; 1114 + changed |= BSS_CHANGED_HT; 1135 1115 } 1136 1116 1137 1117 ieee80211_bss_info_change_notify(sdata, changed); ··· 1786 1754 .change_mpath = ieee80211_change_mpath, 1787 1755 .get_mpath = ieee80211_get_mpath, 1788 1756 .dump_mpath = ieee80211_dump_mpath, 1789 - .set_mesh_params = ieee80211_set_mesh_params, 1757 + .update_mesh_params = ieee80211_update_mesh_params, 1790 1758 .get_mesh_params = ieee80211_get_mesh_params, 1759 + .join_mesh = ieee80211_join_mesh, 1760 + .leave_mesh = ieee80211_leave_mesh, 1791 1761 #endif 1792 1762 .change_bss = ieee80211_change_bss, 1793 1763 .set_txq_params = ieee80211_set_txq_params,
+2
net/mac80211/debugfs_netdev.c
··· 251 251 IEEE80211_IF_FILE(dot11MeshHoldingTimeout, 252 252 u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC); 253 253 IEEE80211_IF_FILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC); 254 + IEEE80211_IF_FILE(element_ttl, u.mesh.mshcfg.element_ttl, DEC); 254 255 IEEE80211_IF_FILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC); 255 256 IEEE80211_IF_FILE(dot11MeshMaxPeerLinks, 256 257 u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC); ··· 356 355 MESHPARAMS_ADD(dot11MeshConfirmTimeout); 357 356 MESHPARAMS_ADD(dot11MeshHoldingTimeout); 358 357 MESHPARAMS_ADD(dot11MeshTTL); 358 + MESHPARAMS_ADD(element_ttl); 359 359 MESHPARAMS_ADD(auto_open_plinks); 360 360 MESHPARAMS_ADD(dot11MeshMaxPeerLinks); 361 361 MESHPARAMS_ADD(dot11MeshHWMPactivePathTimeout);
+2 -14
net/mac80211/ieee80211_i.h
··· 357 357 unsigned long beacon_timeout; 358 358 unsigned long probe_timeout; 359 359 int probe_send_count; 360 + bool nullfunc_failed; 360 361 361 362 struct mutex mtx; 362 363 struct cfg80211_bss *associated; ··· 607 606 struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p) 608 607 { 609 608 return container_of(p, struct ieee80211_sub_if_data, vif); 610 - } 611 - 612 - static inline void 613 - ieee80211_sdata_set_mesh_id(struct ieee80211_sub_if_data *sdata, 614 - u8 mesh_id_len, u8 *mesh_id) 615 - { 616 - #ifdef CONFIG_MAC80211_MESH 617 - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 618 - ifmsh->mesh_id_len = mesh_id_len; 619 - memcpy(ifmsh->mesh_id, mesh_id, mesh_id_len); 620 - #else 621 - WARN_ON(1); 622 - #endif 623 609 } 624 610 625 611 enum sdata_queue_type { ··· 1259 1271 void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, 1260 1272 struct ieee80211_hdr *hdr); 1261 1273 void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata, 1262 - struct ieee80211_hdr *hdr); 1274 + struct ieee80211_hdr *hdr, bool ack); 1263 1275 void ieee80211_beacon_connection_loss_work(struct work_struct *work); 1264 1276 1265 1277 void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw,
+1 -29
net/mac80211/iface.c
··· 197 197 sdata->bss = &sdata->u.ap; 198 198 break; 199 199 case NL80211_IFTYPE_MESH_POINT: 200 - if (!ieee80211_vif_is_mesh(&sdata->vif)) 201 - break; 202 - /* mesh ifaces must set allmulti to forward mcast traffic */ 203 - atomic_inc(&local->iff_allmultis); 204 - break; 205 200 case NL80211_IFTYPE_STATION: 206 201 case NL80211_IFTYPE_MONITOR: 207 202 case NL80211_IFTYPE_ADHOC: ··· 268 273 goto err_stop; 269 274 } 270 275 271 - if (ieee80211_vif_is_mesh(&sdata->vif)) { 272 - local->fif_other_bss++; 273 - ieee80211_configure_filter(local); 274 - 275 - ieee80211_start_mesh(sdata); 276 - } else if (sdata->vif.type == NL80211_IFTYPE_AP) { 276 + if (sdata->vif.type == NL80211_IFTYPE_AP) { 277 277 local->fif_pspoll++; 278 278 local->fif_probe_req++; 279 279 ··· 493 503 ieee80211_adjust_monitor_flags(sdata, -1); 494 504 ieee80211_configure_filter(local); 495 505 break; 496 - case NL80211_IFTYPE_MESH_POINT: 497 - if (ieee80211_vif_is_mesh(&sdata->vif)) { 498 - /* other_bss and allmulti are always set on mesh 499 - * ifaces */ 500 - local->fif_other_bss--; 501 - atomic_dec(&local->iff_allmultis); 502 - 503 - ieee80211_configure_filter(local); 504 - 505 - ieee80211_stop_mesh(sdata); 506 - } 507 - /* fall through */ 508 506 default: 509 507 flush_work(&sdata->work); 510 508 /* ··· 1181 1203 ret = register_netdevice(ndev); 1182 1204 if (ret) 1183 1205 goto fail; 1184 - 1185 - if (ieee80211_vif_is_mesh(&sdata->vif) && 1186 - params && params->mesh_id_len) 1187 - ieee80211_sdata_set_mesh_id(sdata, 1188 - params->mesh_id_len, 1189 - params->mesh_id); 1190 1206 1191 1207 mutex_lock(&local->iflist_mtx); 1192 1208 list_add_tail_rcu(&sdata->list, &local->interfaces);
+4 -1
net/mac80211/main.c
··· 245 245 sdata->vif.bss_conf.enable_beacon = 246 246 !!sdata->u.ibss.presp; 247 247 break; 248 + #ifdef CONFIG_MAC80211_MESH 248 249 case NL80211_IFTYPE_MESH_POINT: 249 - sdata->vif.bss_conf.enable_beacon = true; 250 + sdata->vif.bss_conf.enable_beacon = 251 + !!sdata->u.mesh.mesh_id_len; 250 252 break; 253 + #endif 251 254 default: 252 255 /* not reached */ 253 256 WARN_ON(1);
+16 -20
net/mac80211/mesh.c
··· 513 513 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 514 514 struct ieee80211_local *local = sdata->local; 515 515 516 + local->fif_other_bss++; 517 + /* mesh ifaces must set allmulti to forward mcast traffic */ 518 + atomic_inc(&local->iff_allmultis); 519 + ieee80211_configure_filter(local); 520 + 516 521 set_bit(MESH_WORK_HOUSEKEEPING, &ifmsh->wrkq_flags); 517 522 ieee80211_mesh_root_setup(ifmsh); 518 523 ieee80211_queue_work(&local->hw, &sdata->work); ··· 529 524 530 525 void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) 531 526 { 527 + struct ieee80211_local *local = sdata->local; 528 + struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 529 + 530 + ifmsh->mesh_id_len = 0; 531 + ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED); 532 + sta_info_flush(local, NULL); 533 + 532 534 del_timer_sync(&sdata->u.mesh.housekeeping_timer); 533 535 del_timer_sync(&sdata->u.mesh.mesh_path_root_timer); 534 536 /* ··· 546 534 * it no longer is. 547 535 */ 548 536 cancel_work_sync(&sdata->work); 537 + 538 + local->fif_other_bss--; 539 + atomic_dec(&local->iff_allmultis); 540 + ieee80211_configure_filter(local); 549 541 } 550 542 551 543 static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, ··· 679 663 ieee80211_mesh_housekeeping_timer, 680 664 (unsigned long) sdata); 681 665 682 - ifmsh->mshcfg.dot11MeshRetryTimeout = MESH_RET_T; 683 - ifmsh->mshcfg.dot11MeshConfirmTimeout = MESH_CONF_T; 684 - ifmsh->mshcfg.dot11MeshHoldingTimeout = MESH_HOLD_T; 685 - ifmsh->mshcfg.dot11MeshMaxRetries = MESH_MAX_RETR; 686 - ifmsh->mshcfg.dot11MeshTTL = MESH_TTL; 687 - ifmsh->mshcfg.auto_open_plinks = true; 688 - ifmsh->mshcfg.dot11MeshMaxPeerLinks = 689 - MESH_MAX_ESTAB_PLINKS; 690 - ifmsh->mshcfg.dot11MeshHWMPactivePathTimeout = 691 - MESH_PATH_TIMEOUT; 692 - ifmsh->mshcfg.dot11MeshHWMPpreqMinInterval = 693 - MESH_PREQ_MIN_INT; 694 - ifmsh->mshcfg.dot11MeshHWMPnetDiameterTraversalTime = 695 - MESH_DIAM_TRAVERSAL_TIME; 696 - ifmsh->mshcfg.dot11MeshHWMPmaxPREQretries = 697 - MESH_MAX_PREQ_RETRIES; 698 - ifmsh->mshcfg.path_refresh_time = 699 - MESH_PATH_REFRESH_TIME; 700 - ifmsh->mshcfg.min_discovery_timeout = 701 - MESH_MIN_DISCOVERY_TIMEOUT; 702 666 ifmsh->accepting_plinks = true; 703 667 ifmsh->preq_id = 0; 704 668 ifmsh->sn = 0;
-23
net/mac80211/mesh.h
··· 175 175 */ 176 176 #define MESH_CFG_CMP_LEN (IEEE80211_MESH_CONFIG_LEN - 2) 177 177 178 - /* Default values, timeouts in ms */ 179 - #define MESH_TTL 31 180 - #define MESH_MAX_RETR 3 181 - #define MESH_RET_T 100 182 - #define MESH_CONF_T 100 183 - #define MESH_HOLD_T 100 184 - 185 - #define MESH_PATH_TIMEOUT 5000 186 - /* Minimum interval between two consecutive PREQs originated by the same 187 - * interface 188 - */ 189 - #define MESH_PREQ_MIN_INT 10 190 - #define MESH_DIAM_TRAVERSAL_TIME 50 191 - /* A path will be refreshed if it is used PATH_REFRESH_TIME milliseconds before 192 - * timing out. This way it will remain ACTIVE and no data frames will be 193 - * unnecesarily held in the pending queue. 194 - */ 195 - #define MESH_PATH_REFRESH_TIME 1000 196 - #define MESH_MIN_DISCOVERY_TIMEOUT (2 * MESH_DIAM_TRAVERSAL_TIME) 197 178 #define MESH_DEFAULT_BEACON_INTERVAL 1000 /* in 1024 us units */ 198 179 199 - #define MESH_MAX_PREQ_RETRIES 4 200 180 #define MESH_PATH_EXPIRE (600 * HZ) 201 - 202 - /* Default maximum number of established plinks per interface */ 203 - #define MESH_MAX_ESTAB_PLINKS 32 204 181 205 182 /* Default maximum number of plinks per interface */ 206 183 #define MESH_MAX_PLINKS 256
+5 -4
net/mac80211/mesh_hwmp.c
··· 232 232 *pos++ = WLAN_EID_PERR; 233 233 *pos++ = ie_len; 234 234 /* ttl */ 235 - *pos++ = MESH_TTL; 235 + *pos++ = ttl; 236 236 /* number of destinations */ 237 237 *pos++ = 1; 238 238 /* ··· 522 522 523 523 if (reply) { 524 524 lifetime = PREQ_IE_LIFETIME(preq_elem); 525 - ttl = ifmsh->mshcfg.dot11MeshTTL; 525 + ttl = ifmsh->mshcfg.element_ttl; 526 526 if (ttl != 0) { 527 527 mhwmp_dbg("replying to the PREQ\n"); 528 528 mesh_path_sel_frame_tx(MPATH_PREP, 0, target_addr, ··· 877 877 sdata->u.mesh.last_sn_update = jiffies; 878 878 } 879 879 lifetime = default_lifetime(sdata); 880 - ttl = sdata->u.mesh.mshcfg.dot11MeshTTL; 880 + ttl = sdata->u.mesh.mshcfg.element_ttl; 881 881 if (ttl == 0) { 882 882 sdata->u.mesh.mshstats.dropped_frames_ttl++; 883 883 spin_unlock_bh(&mpath->state_lock); ··· 1013 1013 mesh_path_sel_frame_tx(MPATH_RANN, 0, sdata->vif.addr, 1014 1014 cpu_to_le32(++ifmsh->sn), 1015 1015 0, NULL, 0, broadcast_addr, 1016 - 0, MESH_TTL, 0, 0, 0, sdata); 1016 + 0, sdata->u.mesh.mshcfg.element_ttl, 1017 + 0, 0, 0, sdata); 1017 1018 }
+4 -3
net/mac80211/mesh_pathtbl.c
··· 467 467 mpath->flags &= ~MESH_PATH_ACTIVE; 468 468 ++mpath->sn; 469 469 spin_unlock_bh(&mpath->state_lock); 470 - mesh_path_error_tx(MESH_TTL, mpath->dst, 471 - cpu_to_le32(mpath->sn), 470 + mesh_path_error_tx(sdata->u.mesh.mshcfg.element_ttl, 471 + mpath->dst, cpu_to_le32(mpath->sn), 472 472 cpu_to_le16(PERR_RCODE_DEST_UNREACH), 473 473 bcast, sdata); 474 474 } else ··· 614 614 mpath = mesh_path_lookup(da, sdata); 615 615 if (mpath) 616 616 sn = ++mpath->sn; 617 - mesh_path_error_tx(MESH_TTL, skb->data, cpu_to_le32(sn), 617 + mesh_path_error_tx(sdata->u.mesh.mshcfg.element_ttl, skb->data, 618 + cpu_to_le32(sn), 618 619 cpu_to_le16(PERR_RCODE_NO_ROUTE), ra, sdata); 619 620 } 620 621
+73 -31
net/mac80211/mlme.c
··· 625 625 /* 626 626 * Go to full PSM if the user configures a very low 627 627 * latency requirement. 628 - * The 2 second value is there for compatibility until 629 - * the PM_QOS_NETWORK_LATENCY is configured with real 630 - * values. 628 + * The 2000 second value is there for compatibility 629 + * until the PM_QOS_NETWORK_LATENCY is configured 630 + * with real values. 631 631 */ 632 - if (latency > 1900000000 && latency != 2000000000) 632 + if (latency > (1900 * USEC_PER_MSEC) && 633 + latency != (2000 * USEC_PER_SEC)) 633 634 timeout = 0; 634 635 else 635 636 timeout = 100; ··· 1066 1065 } 1067 1066 1068 1067 void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata, 1069 - struct ieee80211_hdr *hdr) 1068 + struct ieee80211_hdr *hdr, bool ack) 1070 1069 { 1071 - if (!ieee80211_is_data(hdr->frame_control) && 1072 - !ieee80211_is_nullfunc(hdr->frame_control)) 1070 + if (!ieee80211_is_data(hdr->frame_control)) 1073 1071 return; 1074 1072 1075 - ieee80211_sta_reset_conn_monitor(sdata); 1073 + if (ack) 1074 + ieee80211_sta_reset_conn_monitor(sdata); 1076 1075 1077 1076 if (ieee80211_is_nullfunc(hdr->frame_control) && 1078 1077 sdata->u.mgd.probe_send_count > 0) { 1079 - sdata->u.mgd.probe_send_count = 0; 1078 + if (ack) 1079 + sdata->u.mgd.probe_send_count = 0; 1080 + else 1081 + sdata->u.mgd.nullfunc_failed = true; 1080 1082 ieee80211_queue_work(&sdata->local->hw, &sdata->work); 1081 1083 } 1082 1084 } ··· 1106 1102 * anymore. The timeout will be reset if the frame is ACKed by 1107 1103 * the AP. 1108 1104 */ 1109 - if (sdata->local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) 1105 + if (sdata->local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) { 1106 + ifmgd->nullfunc_failed = false; 1110 1107 ieee80211_send_nullfunc(sdata->local, sdata, 0); 1111 - else { 1108 + } else { 1112 1109 ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID); 1113 1110 ieee80211_send_probe_req(sdata, dst, ssid + 2, ssid[1], NULL, 0); 1114 1111 } ··· 1918 1913 ieee80211_queue_work(&local->hw, &sdata->work); 1919 1914 } 1920 1915 1916 + static void ieee80211_sta_connection_lost(struct ieee80211_sub_if_data *sdata, 1917 + u8 *bssid) 1918 + { 1919 + struct ieee80211_local *local = sdata->local; 1920 + struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 1921 + 1922 + ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL | 1923 + IEEE80211_STA_BEACON_POLL); 1924 + 1925 + ieee80211_set_disassoc(sdata, true, true); 1926 + mutex_unlock(&ifmgd->mtx); 1927 + mutex_lock(&local->mtx); 1928 + ieee80211_recalc_idle(local); 1929 + mutex_unlock(&local->mtx); 1930 + /* 1931 + * must be outside lock due to cfg80211, 1932 + * but that's not a problem. 1933 + */ 1934 + ieee80211_send_deauth_disassoc(sdata, bssid, 1935 + IEEE80211_STYPE_DEAUTH, 1936 + WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, 1937 + NULL, true); 1938 + mutex_lock(&ifmgd->mtx); 1939 + } 1940 + 1921 1941 void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata) 1922 1942 { 1923 1943 struct ieee80211_local *local = sdata->local; ··· 1967 1937 /* ACK received for nullfunc probing frame */ 1968 1938 if (!ifmgd->probe_send_count) 1969 1939 ieee80211_reset_ap_probe(sdata); 1970 - 1971 - else if (time_is_after_jiffies(ifmgd->probe_timeout)) 1940 + else if (ifmgd->nullfunc_failed) { 1941 + if (ifmgd->probe_send_count < max_tries) { 1942 + #ifdef CONFIG_MAC80211_VERBOSE_DEBUG 1943 + wiphy_debug(local->hw.wiphy, 1944 + "%s: No ack for nullfunc frame to" 1945 + " AP %pM, try %d\n", 1946 + sdata->name, bssid, 1947 + ifmgd->probe_send_count); 1948 + #endif 1949 + ieee80211_mgd_probe_ap_send(sdata); 1950 + } else { 1951 + #ifdef CONFIG_MAC80211_VERBOSE_DEBUG 1952 + wiphy_debug(local->hw.wiphy, 1953 + "%s: No ack for nullfunc frame to" 1954 + " AP %pM, disconnecting.\n", 1955 + sdata->name, bssid); 1956 + #endif 1957 + ieee80211_sta_connection_lost(sdata, bssid); 1958 + } 1959 + } else if (time_is_after_jiffies(ifmgd->probe_timeout)) 1972 1960 run_again(ifmgd, ifmgd->probe_timeout); 1973 - 1974 - else if (ifmgd->probe_send_count < max_tries) { 1961 + else if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) { 1962 + #ifdef CONFIG_MAC80211_VERBOSE_DEBUG 1963 + wiphy_debug(local->hw.wiphy, 1964 + "%s: Failed to send nullfunc to AP %pM" 1965 + " after %dms, disconnecting.\n", 1966 + sdata->name, 1967 + bssid, (1000 * IEEE80211_PROBE_WAIT)/HZ); 1968 + #endif 1969 + ieee80211_sta_connection_lost(sdata, bssid); 1970 + } else if (ifmgd->probe_send_count < max_tries) { 1975 1971 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG 1976 1972 wiphy_debug(local->hw.wiphy, 1977 1973 "%s: No probe response from AP %pM" ··· 2012 1956 * We actually lost the connection ... or did we? 2013 1957 * Let's make sure! 2014 1958 */ 2015 - ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL | 2016 - IEEE80211_STA_BEACON_POLL); 2017 1959 wiphy_debug(local->hw.wiphy, 2018 1960 "%s: No probe response from AP %pM" 2019 1961 " after %dms, disconnecting.\n", 2020 1962 sdata->name, 2021 1963 bssid, (1000 * IEEE80211_PROBE_WAIT)/HZ); 2022 - ieee80211_set_disassoc(sdata, true, true); 2023 - mutex_unlock(&ifmgd->mtx); 2024 - mutex_lock(&local->mtx); 2025 - ieee80211_recalc_idle(local); 2026 - mutex_unlock(&local->mtx); 2027 - /* 2028 - * must be outside lock due to cfg80211, 2029 - * but that's not a problem. 2030 - */ 2031 - ieee80211_send_deauth_disassoc(sdata, bssid, 2032 - IEEE80211_STYPE_DEAUTH, 2033 - WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, 2034 - NULL, true); 2035 - mutex_lock(&ifmgd->mtx); 1964 + 1965 + ieee80211_sta_connection_lost(sdata, bssid); 2036 1966 } 2037 1967 } 2038 1968
+1
net/mac80211/rx.c
··· 1163 1163 sta->rx_fragments++; 1164 1164 sta->rx_bytes += rx->skb->len; 1165 1165 sta->last_signal = status->signal; 1166 + ewma_add(&sta->avg_signal, -status->signal); 1166 1167 1167 1168 /* 1168 1169 * Change STA power saving mode only at the end of a frame
+2
net/mac80211/sta_info.c
··· 244 244 sta->local = local; 245 245 sta->sdata = sdata; 246 246 247 + ewma_init(&sta->avg_signal, 1024, 8); 248 + 247 249 if (sta_prepare_rate_control(local, sta, gfp)) { 248 250 kfree(sta); 249 251 return NULL;
+3
net/mac80211/sta_info.h
··· 13 13 #include <linux/types.h> 14 14 #include <linux/if_ether.h> 15 15 #include <linux/workqueue.h> 16 + #include <linux/average.h> 16 17 #include "key.h" 17 18 18 19 /** ··· 224 223 * @rx_fragments: number of received MPDUs 225 224 * @rx_dropped: number of dropped MPDUs from this STA 226 225 * @last_signal: signal of last received frame from this STA 226 + * @avg_signal: moving average of signal of received frames from this STA 227 227 * @last_seq_ctrl: last received seq/frag number from this STA (per RX queue) 228 228 * @tx_filtered_count: number of frames the hardware filtered for this STA 229 229 * @tx_retry_failed: number of frames that failed retry ··· 293 291 unsigned long rx_fragments; 294 292 unsigned long rx_dropped; 295 293 int last_signal; 294 + struct ewma avg_signal; 296 295 __le16 last_seq_ctrl[NUM_RX_DATA_QUEUES]; 297 296 298 297 /* Updated from TX status path only, no locking requirements */
+9 -9
net/mac80211/status.c
··· 155 155 156 156 ieee80211_queue_work(&local->hw, &local->recalc_smps); 157 157 } 158 - 159 - if ((sdata->vif.type == NL80211_IFTYPE_STATION) && 160 - (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)) 161 - ieee80211_sta_tx_notify(sdata, (void *) skb->data); 162 158 } 163 159 164 160 /* ··· 182 186 int retry_count = -1, i; 183 187 int rates_idx = -1; 184 188 bool send_to_cooked; 189 + bool acked; 185 190 186 191 for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { 187 192 /* the HW cannot have attempted that rate */ ··· 208 211 if (memcmp(hdr->addr2, sta->sdata->vif.addr, ETH_ALEN)) 209 212 continue; 210 213 211 - if (!(info->flags & IEEE80211_TX_STAT_ACK) && 212 - test_sta_flags(sta, WLAN_STA_PS_STA)) { 214 + acked = !!(info->flags & IEEE80211_TX_STAT_ACK); 215 + if (!acked && test_sta_flags(sta, WLAN_STA_PS_STA)) { 213 216 /* 214 217 * The STA is in power save mode, so assume 215 218 * that this TX packet failed because of that. ··· 241 244 rcu_read_unlock(); 242 245 return; 243 246 } else { 244 - if (!(info->flags & IEEE80211_TX_STAT_ACK)) 247 + if (!acked) 245 248 sta->tx_retry_failed++; 246 249 sta->tx_retry_count += retry_count; 247 250 } ··· 250 253 if (ieee80211_vif_is_mesh(&sta->sdata->vif)) 251 254 ieee80211s_update_metric(local, sta, skb); 252 255 253 - if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && 254 - (info->flags & IEEE80211_TX_STAT_ACK)) 256 + if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && acked) 255 257 ieee80211_frame_acked(sta, skb); 258 + 259 + if ((sta->sdata->vif.type == NL80211_IFTYPE_STATION) && 260 + (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)) 261 + ieee80211_sta_tx_notify(sta->sdata, (void *) skb->data, acked); 256 262 257 263 if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) { 258 264 if (info->flags & IEEE80211_TX_STAT_ACK) {
+22 -6
net/mac80211/tx.c
··· 666 666 if (unlikely(info->control.rates[0].idx < 0)) 667 667 return TX_DROP; 668 668 669 - if (txrc.reported_rate.idx < 0) 669 + if (txrc.reported_rate.idx < 0) { 670 670 txrc.reported_rate = info->control.rates[0]; 671 - 672 - if (tx->sta) 671 + if (tx->sta && ieee80211_is_data(hdr->frame_control)) 672 + tx->sta->last_tx_rate = txrc.reported_rate; 673 + } else if (tx->sta) 673 674 tx->sta->last_tx_rate = txrc.reported_rate; 674 675 675 676 if (unlikely(!info->control.rates[0].count)) ··· 1746 1745 int nh_pos, h_pos; 1747 1746 struct sta_info *sta = NULL; 1748 1747 u32 sta_flags = 0; 1748 + struct sk_buff *tmp_skb; 1749 1749 1750 1750 if (unlikely(skb->len < ETH_HLEN)) { 1751 1751 ret = NETDEV_TX_OK; 1752 1752 goto fail; 1753 1753 } 1754 - 1755 - nh_pos = skb_network_header(skb) - skb->data; 1756 - h_pos = skb_transport_header(skb) - skb->data; 1757 1754 1758 1755 /* convert Ethernet header to proper 802.11 header (based on 1759 1756 * operation mode) */ ··· 1925 1926 goto fail; 1926 1927 } 1927 1928 1929 + /* 1930 + * If the skb is shared we need to obtain our own copy. 1931 + */ 1932 + if (skb_shared(skb)) { 1933 + tmp_skb = skb; 1934 + skb = skb_copy(skb, GFP_ATOMIC); 1935 + kfree_skb(tmp_skb); 1936 + 1937 + if (!skb) { 1938 + ret = NETDEV_TX_OK; 1939 + goto fail; 1940 + } 1941 + } 1942 + 1928 1943 hdr.frame_control = fc; 1929 1944 hdr.duration_id = 0; 1930 1945 hdr.seq_ctrl = 0; ··· 1956 1943 encaps_data = NULL; 1957 1944 encaps_len = 0; 1958 1945 } 1946 + 1947 + nh_pos = skb_network_header(skb) - skb->data; 1948 + h_pos = skb_transport_header(skb) - skb->data; 1959 1949 1960 1950 skb_pull(skb, skip_header_bytes); 1961 1951 nh_pos -= skip_header_bytes;
+3 -2
net/mac80211/work.c
··· 458 458 return WORK_ACT_TIMEOUT; 459 459 } 460 460 461 - printk(KERN_DEBUG "%s: direct probe to %pM (try %d)\n", 462 - sdata->name, wk->filter_ta, wk->probe_auth.tries); 461 + printk(KERN_DEBUG "%s: direct probe to %pM (try %d/%i)\n", 462 + sdata->name, wk->filter_ta, wk->probe_auth.tries, 463 + IEEE80211_AUTH_MAX_TRIES); 463 464 464 465 /* 465 466 * Direct probe is sent to broadcast address as some APs
+1 -1
net/wireless/Makefile
··· 10 10 obj-$(CONFIG_WEXT_PRIV) += wext-priv.o 11 11 12 12 cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o 13 - cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o 13 + cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o 14 14 cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o 15 15 cfg80211-$(CONFIG_CFG80211_WEXT) += wext-compat.o wext-sme.o 16 16 cfg80211-$(CONFIG_CFG80211_INTERNAL_REGDB) += regdb.o
+13 -2
net/wireless/core.c
··· 332 332 WARN_ON(ops->add_virtual_intf && !ops->del_virtual_intf); 333 333 WARN_ON(ops->add_station && !ops->del_station); 334 334 WARN_ON(ops->add_mpath && !ops->del_mpath); 335 + WARN_ON(ops->join_mesh && !ops->leave_mesh); 335 336 336 337 alloc_size = sizeof(*rdev) + sizeof_priv; 337 338 ··· 753 752 cfg80211_mlme_down(rdev, dev); 754 753 wdev_unlock(wdev); 755 754 break; 755 + case NL80211_IFTYPE_MESH_POINT: 756 + cfg80211_leave_mesh(rdev, dev); 757 + break; 756 758 default: 757 759 break; 758 760 } ··· 779 775 } 780 776 cfg80211_lock_rdev(rdev); 781 777 mutex_lock(&rdev->devlist_mtx); 782 - #ifdef CONFIG_CFG80211_WEXT 783 778 wdev_lock(wdev); 784 779 switch (wdev->iftype) { 780 + #ifdef CONFIG_CFG80211_WEXT 785 781 case NL80211_IFTYPE_ADHOC: 786 782 cfg80211_ibss_wext_join(rdev, wdev); 787 783 break; 788 784 case NL80211_IFTYPE_STATION: 789 785 cfg80211_mgd_wext_connect(rdev, wdev); 790 786 break; 787 + #endif 788 + case NL80211_IFTYPE_MESH_POINT: 789 + /* backward compat code ... */ 790 + if (wdev->mesh_id_up_len) 791 + __cfg80211_join_mesh(rdev, dev, wdev->ssid, 792 + wdev->mesh_id_up_len, 793 + &default_mesh_config); 794 + break; 791 795 default: 792 796 break; 793 797 } 794 798 wdev_unlock(wdev); 795 - #endif 796 799 rdev->opencount++; 797 800 mutex_unlock(&rdev->devlist_mtx); 798 801 cfg80211_unlock_rdev(rdev);
+13
net/wireless/core.h
··· 285 285 int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev, 286 286 struct wireless_dev *wdev); 287 287 288 + /* mesh */ 289 + extern const struct mesh_config default_mesh_config; 290 + int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev, 291 + struct net_device *dev, 292 + const u8 *mesh_id, u8 mesh_id_len, 293 + const struct mesh_config *conf); 294 + int cfg80211_join_mesh(struct cfg80211_registered_device *rdev, 295 + struct net_device *dev, 296 + const u8 *mesh_id, u8 mesh_id_len, 297 + const struct mesh_config *conf); 298 + int cfg80211_leave_mesh(struct cfg80211_registered_device *rdev, 299 + struct net_device *dev); 300 + 288 301 /* MLME */ 289 302 int __cfg80211_mlme_auth(struct cfg80211_registered_device *rdev, 290 303 struct net_device *dev,
+140
net/wireless/mesh.c
··· 1 + #include <linux/ieee80211.h> 2 + #include <net/cfg80211.h> 3 + #include "core.h" 4 + 5 + /* Default values, timeouts in ms */ 6 + #define MESH_TTL 31 7 + #define MESH_DEFAULT_ELEMENT_TTL 31 8 + #define MESH_MAX_RETR 3 9 + #define MESH_RET_T 100 10 + #define MESH_CONF_T 100 11 + #define MESH_HOLD_T 100 12 + 13 + #define MESH_PATH_TIMEOUT 5000 14 + 15 + /* 16 + * Minimum interval between two consecutive PREQs originated by the same 17 + * interface 18 + */ 19 + #define MESH_PREQ_MIN_INT 10 20 + #define MESH_DIAM_TRAVERSAL_TIME 50 21 + 22 + /* 23 + * A path will be refreshed if it is used PATH_REFRESH_TIME milliseconds 24 + * before timing out. This way it will remain ACTIVE and no data frames 25 + * will be unnecessarily held in the pending queue. 26 + */ 27 + #define MESH_PATH_REFRESH_TIME 1000 28 + #define MESH_MIN_DISCOVERY_TIMEOUT (2 * MESH_DIAM_TRAVERSAL_TIME) 29 + 30 + /* Default maximum number of established plinks per interface */ 31 + #define MESH_MAX_ESTAB_PLINKS 32 32 + 33 + #define MESH_MAX_PREQ_RETRIES 4 34 + 35 + 36 + const struct mesh_config default_mesh_config = { 37 + .dot11MeshRetryTimeout = MESH_RET_T, 38 + .dot11MeshConfirmTimeout = MESH_CONF_T, 39 + .dot11MeshHoldingTimeout = MESH_HOLD_T, 40 + .dot11MeshMaxRetries = MESH_MAX_RETR, 41 + .dot11MeshTTL = MESH_TTL, 42 + .element_ttl = MESH_DEFAULT_ELEMENT_TTL, 43 + .auto_open_plinks = true, 44 + .dot11MeshMaxPeerLinks = MESH_MAX_ESTAB_PLINKS, 45 + .dot11MeshHWMPactivePathTimeout = MESH_PATH_TIMEOUT, 46 + .dot11MeshHWMPpreqMinInterval = MESH_PREQ_MIN_INT, 47 + .dot11MeshHWMPnetDiameterTraversalTime = MESH_DIAM_TRAVERSAL_TIME, 48 + .dot11MeshHWMPmaxPREQretries = MESH_MAX_PREQ_RETRIES, 49 + .path_refresh_time = MESH_PATH_REFRESH_TIME, 50 + .min_discovery_timeout = MESH_MIN_DISCOVERY_TIMEOUT, 51 + }; 52 + 53 + 54 + int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev, 55 + struct net_device *dev, 56 + const u8 *mesh_id, u8 mesh_id_len, 57 + const struct mesh_config *conf) 58 + { 59 + struct wireless_dev *wdev = dev->ieee80211_ptr; 60 + struct mesh_setup setup = { 61 + .mesh_id = mesh_id, 62 + .mesh_id_len = mesh_id_len, 63 + }; 64 + int err; 65 + 66 + BUILD_BUG_ON(IEEE80211_MAX_SSID_LEN != IEEE80211_MAX_MESH_ID_LEN); 67 + 68 + ASSERT_WDEV_LOCK(wdev); 69 + 70 + if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) 71 + return -EOPNOTSUPP; 72 + 73 + if (wdev->mesh_id_len) 74 + return -EALREADY; 75 + 76 + if (!mesh_id_len) 77 + return -EINVAL; 78 + 79 + if (!rdev->ops->join_mesh) 80 + return -EOPNOTSUPP; 81 + 82 + err = rdev->ops->join_mesh(&rdev->wiphy, dev, conf, &setup); 83 + if (!err) { 84 + memcpy(wdev->ssid, mesh_id, mesh_id_len); 85 + wdev->mesh_id_len = mesh_id_len; 86 + } 87 + 88 + return err; 89 + } 90 + 91 + int cfg80211_join_mesh(struct cfg80211_registered_device *rdev, 92 + struct net_device *dev, 93 + const u8 *mesh_id, u8 mesh_id_len, 94 + const struct mesh_config *conf) 95 + { 96 + struct wireless_dev *wdev = dev->ieee80211_ptr; 97 + int err; 98 + 99 + wdev_lock(wdev); 100 + err = __cfg80211_join_mesh(rdev, dev, mesh_id, mesh_id_len, conf); 101 + wdev_unlock(wdev); 102 + 103 + return err; 104 + } 105 + 106 + static int __cfg80211_leave_mesh(struct cfg80211_registered_device *rdev, 107 + struct net_device *dev) 108 + { 109 + struct wireless_dev *wdev = dev->ieee80211_ptr; 110 + int err; 111 + 112 + ASSERT_WDEV_LOCK(wdev); 113 + 114 + if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) 115 + return -EOPNOTSUPP; 116 + 117 + if (!rdev->ops->leave_mesh) 118 + return -EOPNOTSUPP; 119 + 120 + if (!wdev->mesh_id_len) 121 + return -ENOTCONN; 122 + 123 + err = rdev->ops->leave_mesh(&rdev->wiphy, dev); 124 + if (!err) 125 + wdev->mesh_id_len = 0; 126 + return err; 127 + } 128 + 129 + int cfg80211_leave_mesh(struct cfg80211_registered_device *rdev, 130 + struct net_device *dev) 131 + { 132 + struct wireless_dev *wdev = dev->ieee80211_ptr; 133 + int err; 134 + 135 + wdev_lock(wdev); 136 + err = __cfg80211_leave_mesh(rdev, dev); 137 + wdev_unlock(wdev); 138 + 139 + return err; 140 + }
+169 -43
net/wireless/nl80211.c
··· 121 121 [NL80211_ATTR_BSS_SHORT_SLOT_TIME] = { .type = NLA_U8 }, 122 122 [NL80211_ATTR_BSS_BASIC_RATES] = { .type = NLA_BINARY, 123 123 .len = NL80211_MAX_SUPP_RATES }, 124 + [NL80211_ATTR_BSS_HT_OPMODE] = { .type = NLA_U16 }, 124 125 125 126 [NL80211_ATTR_MESH_PARAMS] = { .type = NLA_NESTED }, 126 127 ··· 662 661 CMD(add_beacon, NEW_BEACON); 663 662 CMD(add_station, NEW_STATION); 664 663 CMD(add_mpath, NEW_MPATH); 665 - CMD(set_mesh_params, SET_MESH_PARAMS); 664 + CMD(update_mesh_params, SET_MESH_PARAMS); 666 665 CMD(change_bss, SET_BSS); 667 666 CMD(auth, AUTHENTICATE); 668 667 CMD(assoc, ASSOCIATE); 669 668 CMD(deauth, DEAUTHENTICATE); 670 669 CMD(disassoc, DISASSOCIATE); 671 670 CMD(join_ibss, JOIN_IBSS); 671 + CMD(join_mesh, JOIN_MESH); 672 672 CMD(set_pmksa, SET_PMKSA); 673 673 CMD(del_pmksa, DEL_PMKSA); 674 674 CMD(flush_pmksa, FLUSH_PMKSA); ··· 1326 1324 } 1327 1325 1328 1326 if (info->attrs[NL80211_ATTR_MESH_ID]) { 1327 + struct wireless_dev *wdev = dev->ieee80211_ptr; 1328 + 1329 1329 if (ntype != NL80211_IFTYPE_MESH_POINT) 1330 1330 return -EINVAL; 1331 - params.mesh_id = nla_data(info->attrs[NL80211_ATTR_MESH_ID]); 1332 - params.mesh_id_len = nla_len(info->attrs[NL80211_ATTR_MESH_ID]); 1333 - change = true; 1331 + if (netif_running(dev)) 1332 + return -EBUSY; 1333 + 1334 + wdev_lock(wdev); 1335 + BUILD_BUG_ON(IEEE80211_MAX_SSID_LEN != 1336 + IEEE80211_MAX_MESH_ID_LEN); 1337 + wdev->mesh_id_up_len = 1338 + nla_len(info->attrs[NL80211_ATTR_MESH_ID]); 1339 + memcpy(wdev->ssid, nla_data(info->attrs[NL80211_ATTR_MESH_ID]), 1340 + wdev->mesh_id_up_len); 1341 + wdev_unlock(wdev); 1334 1342 } 1335 1343 1336 1344 if (info->attrs[NL80211_ATTR_4ADDR]) { ··· 1380 1368 { 1381 1369 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 1382 1370 struct vif_params params; 1371 + struct net_device *dev; 1383 1372 int err; 1384 1373 enum nl80211_iftype type = NL80211_IFTYPE_UNSPECIFIED; 1385 1374 u32 flags; ··· 1400 1387 !(rdev->wiphy.interface_modes & (1 << type))) 1401 1388 return -EOPNOTSUPP; 1402 1389 1403 - if (type == NL80211_IFTYPE_MESH_POINT && 1404 - info->attrs[NL80211_ATTR_MESH_ID]) { 1405 - params.mesh_id = nla_data(info->attrs[NL80211_ATTR_MESH_ID]); 1406 - params.mesh_id_len = nla_len(info->attrs[NL80211_ATTR_MESH_ID]); 1407 - } 1408 - 1409 1390 if (info->attrs[NL80211_ATTR_4ADDR]) { 1410 1391 params.use_4addr = !!nla_get_u8(info->attrs[NL80211_ATTR_4ADDR]); 1411 1392 err = nl80211_valid_4addr(rdev, NULL, params.use_4addr, type); ··· 1410 1403 err = parse_monitor_flags(type == NL80211_IFTYPE_MONITOR ? 1411 1404 info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL, 1412 1405 &flags); 1413 - err = rdev->ops->add_virtual_intf(&rdev->wiphy, 1406 + dev = rdev->ops->add_virtual_intf(&rdev->wiphy, 1414 1407 nla_data(info->attrs[NL80211_ATTR_IFNAME]), 1415 1408 type, err ? NULL : &flags, &params); 1409 + if (IS_ERR(dev)) 1410 + return PTR_ERR(dev); 1416 1411 1417 - return err; 1412 + if (type == NL80211_IFTYPE_MESH_POINT && 1413 + info->attrs[NL80211_ATTR_MESH_ID]) { 1414 + struct wireless_dev *wdev = dev->ieee80211_ptr; 1415 + 1416 + wdev_lock(wdev); 1417 + BUILD_BUG_ON(IEEE80211_MAX_SSID_LEN != 1418 + IEEE80211_MAX_MESH_ID_LEN); 1419 + wdev->mesh_id_up_len = 1420 + nla_len(info->attrs[NL80211_ATTR_MESH_ID]); 1421 + memcpy(wdev->ssid, nla_data(info->attrs[NL80211_ATTR_MESH_ID]), 1422 + wdev->mesh_id_up_len); 1423 + wdev_unlock(wdev); 1424 + } 1425 + 1426 + return 0; 1418 1427 } 1419 1428 1420 1429 static int nl80211_del_interface(struct sk_buff *skb, struct genl_info *info) ··· 1897 1874 if (sinfo->filled & STATION_INFO_SIGNAL) 1898 1875 NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL, 1899 1876 sinfo->signal); 1877 + if (sinfo->filled & STATION_INFO_SIGNAL_AVG) 1878 + NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL_AVG, 1879 + sinfo->signal_avg); 1900 1880 if (sinfo->filled & STATION_INFO_TX_BITRATE) { 1901 1881 txrate = nla_nest_start(msg, NL80211_STA_INFO_TX_BITRATE); 1902 1882 if (!txrate) ··· 2463 2437 params.use_short_preamble = -1; 2464 2438 params.use_short_slot_time = -1; 2465 2439 params.ap_isolate = -1; 2440 + params.ht_opmode = -1; 2466 2441 2467 2442 if (info->attrs[NL80211_ATTR_BSS_CTS_PROT]) 2468 2443 params.use_cts_prot = ··· 2482 2455 } 2483 2456 if (info->attrs[NL80211_ATTR_AP_ISOLATE]) 2484 2457 params.ap_isolate = !!nla_get_u8(info->attrs[NL80211_ATTR_AP_ISOLATE]); 2458 + if (info->attrs[NL80211_ATTR_BSS_HT_OPMODE]) 2459 + params.ht_opmode = 2460 + nla_get_u16(info->attrs[NL80211_ATTR_BSS_HT_OPMODE]); 2485 2461 2486 2462 if (!rdev->ops->change_bss) 2487 2463 return -EOPNOTSUPP; ··· 2570 2540 } 2571 2541 2572 2542 static int nl80211_get_mesh_params(struct sk_buff *skb, 2573 - struct genl_info *info) 2543 + struct genl_info *info) 2574 2544 { 2575 2545 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 2576 - struct mesh_config cur_params; 2577 - int err; 2578 2546 struct net_device *dev = info->user_ptr[1]; 2547 + struct wireless_dev *wdev = dev->ieee80211_ptr; 2548 + struct mesh_config cur_params; 2549 + int err = 0; 2579 2550 void *hdr; 2580 2551 struct nlattr *pinfoattr; 2581 2552 struct sk_buff *msg; 2582 2553 2554 + if (wdev->iftype != NL80211_IFTYPE_MESH_POINT) 2555 + return -EOPNOTSUPP; 2556 + 2583 2557 if (!rdev->ops->get_mesh_params) 2584 2558 return -EOPNOTSUPP; 2585 2559 2586 - /* Get the mesh params */ 2587 - err = rdev->ops->get_mesh_params(&rdev->wiphy, dev, &cur_params); 2560 + wdev_lock(wdev); 2561 + /* If not connected, get default parameters */ 2562 + if (!wdev->mesh_id_len) 2563 + memcpy(&cur_params, &default_mesh_config, sizeof(cur_params)); 2564 + else 2565 + err = rdev->ops->get_mesh_params(&rdev->wiphy, dev, 2566 + &cur_params); 2567 + wdev_unlock(wdev); 2568 + 2588 2569 if (err) 2589 2570 return err; 2590 2571 ··· 2623 2582 cur_params.dot11MeshMaxRetries); 2624 2583 NLA_PUT_U8(msg, NL80211_MESHCONF_TTL, 2625 2584 cur_params.dot11MeshTTL); 2585 + NLA_PUT_U8(msg, NL80211_MESHCONF_ELEMENT_TTL, 2586 + cur_params.element_ttl); 2626 2587 NLA_PUT_U8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS, 2627 2588 cur_params.auto_open_plinks); 2628 2589 NLA_PUT_U8(msg, NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, ··· 2651 2608 return -ENOBUFS; 2652 2609 } 2653 2610 2654 - #define FILL_IN_MESH_PARAM_IF_SET(table, cfg, param, mask, attr_num, nla_fn) \ 2655 - do {\ 2656 - if (table[attr_num]) {\ 2657 - cfg.param = nla_fn(table[attr_num]); \ 2658 - mask |= (1 << (attr_num - 1)); \ 2659 - } \ 2660 - } while (0);\ 2661 - 2662 2611 static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_ATTR_MAX+1] = { 2663 2612 [NL80211_MESHCONF_RETRY_TIMEOUT] = { .type = NLA_U16 }, 2664 2613 [NL80211_MESHCONF_CONFIRM_TIMEOUT] = { .type = NLA_U16 }, ··· 2658 2623 [NL80211_MESHCONF_MAX_PEER_LINKS] = { .type = NLA_U16 }, 2659 2624 [NL80211_MESHCONF_MAX_RETRIES] = { .type = NLA_U8 }, 2660 2625 [NL80211_MESHCONF_TTL] = { .type = NLA_U8 }, 2626 + [NL80211_MESHCONF_ELEMENT_TTL] = { .type = NLA_U8 }, 2661 2627 [NL80211_MESHCONF_AUTO_OPEN_PLINKS] = { .type = NLA_U8 }, 2662 2628 2663 2629 [NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES] = { .type = NLA_U8 }, ··· 2669 2633 [NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME] = { .type = NLA_U16 }, 2670 2634 }; 2671 2635 2672 - static int nl80211_set_mesh_params(struct sk_buff *skb, struct genl_info *info) 2636 + static int nl80211_parse_mesh_params(struct genl_info *info, 2637 + struct mesh_config *cfg, 2638 + u32 *mask_out) 2673 2639 { 2674 - u32 mask; 2675 - struct cfg80211_registered_device *rdev = info->user_ptr[0]; 2676 - struct net_device *dev = info->user_ptr[1]; 2677 - struct mesh_config cfg; 2678 2640 struct nlattr *tb[NL80211_MESHCONF_ATTR_MAX + 1]; 2679 - struct nlattr *parent_attr; 2641 + u32 mask = 0; 2680 2642 2681 - parent_attr = info->attrs[NL80211_ATTR_MESH_PARAMS]; 2682 - if (!parent_attr) 2643 + #define FILL_IN_MESH_PARAM_IF_SET(table, cfg, param, mask, attr_num, nla_fn) \ 2644 + do {\ 2645 + if (table[attr_num]) {\ 2646 + cfg->param = nla_fn(table[attr_num]); \ 2647 + mask |= (1 << (attr_num - 1)); \ 2648 + } \ 2649 + } while (0);\ 2650 + 2651 + 2652 + if (!info->attrs[NL80211_ATTR_MESH_PARAMS]) 2683 2653 return -EINVAL; 2684 2654 if (nla_parse_nested(tb, NL80211_MESHCONF_ATTR_MAX, 2685 - parent_attr, nl80211_meshconf_params_policy)) 2655 + info->attrs[NL80211_ATTR_MESH_PARAMS], 2656 + nl80211_meshconf_params_policy)) 2686 2657 return -EINVAL; 2687 - 2688 - if (!rdev->ops->set_mesh_params) 2689 - return -EOPNOTSUPP; 2690 2658 2691 2659 /* This makes sure that there aren't more than 32 mesh config 2692 2660 * parameters (otherwise our bitfield scheme would not work.) */ 2693 2661 BUILD_BUG_ON(NL80211_MESHCONF_ATTR_MAX > 32); 2694 2662 2695 2663 /* Fill in the params struct */ 2696 - mask = 0; 2697 2664 FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshRetryTimeout, 2698 2665 mask, NL80211_MESHCONF_RETRY_TIMEOUT, nla_get_u16); 2699 2666 FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshConfirmTimeout, ··· 2709 2670 mask, NL80211_MESHCONF_MAX_RETRIES, nla_get_u8); 2710 2671 FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshTTL, 2711 2672 mask, NL80211_MESHCONF_TTL, nla_get_u8); 2673 + FILL_IN_MESH_PARAM_IF_SET(tb, cfg, element_ttl, 2674 + mask, NL80211_MESHCONF_ELEMENT_TTL, nla_get_u8); 2712 2675 FILL_IN_MESH_PARAM_IF_SET(tb, cfg, auto_open_plinks, 2713 2676 mask, NL80211_MESHCONF_AUTO_OPEN_PLINKS, nla_get_u8); 2714 2677 FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPmaxPREQretries, ··· 2736 2695 NL80211_MESHCONF_HWMP_ROOTMODE, 2737 2696 nla_get_u8); 2738 2697 2739 - /* Apply changes */ 2740 - return rdev->ops->set_mesh_params(&rdev->wiphy, dev, &cfg, mask); 2741 - } 2698 + if (mask_out) 2699 + *mask_out = mask; 2700 + return 0; 2742 2701 2743 2702 #undef FILL_IN_MESH_PARAM_IF_SET 2703 + } 2704 + 2705 + static int nl80211_update_mesh_params(struct sk_buff *skb, 2706 + struct genl_info *info) 2707 + { 2708 + struct cfg80211_registered_device *rdev = info->user_ptr[0]; 2709 + struct net_device *dev = info->user_ptr[1]; 2710 + struct wireless_dev *wdev = dev->ieee80211_ptr; 2711 + struct mesh_config cfg; 2712 + u32 mask; 2713 + int err; 2714 + 2715 + if (wdev->iftype != NL80211_IFTYPE_MESH_POINT) 2716 + return -EOPNOTSUPP; 2717 + 2718 + if (!rdev->ops->update_mesh_params) 2719 + return -EOPNOTSUPP; 2720 + 2721 + err = nl80211_parse_mesh_params(info, &cfg, &mask); 2722 + if (err) 2723 + return err; 2724 + 2725 + wdev_lock(wdev); 2726 + if (!wdev->mesh_id_len) 2727 + err = -ENOLINK; 2728 + 2729 + if (!err) 2730 + err = rdev->ops->update_mesh_params(&rdev->wiphy, dev, 2731 + mask, &cfg); 2732 + 2733 + wdev_unlock(wdev); 2734 + 2735 + return err; 2736 + } 2744 2737 2745 2738 static int nl80211_get_reg(struct sk_buff *skb, struct genl_info *info) 2746 2739 { ··· 4557 4482 return err; 4558 4483 } 4559 4484 4485 + static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info) 4486 + { 4487 + struct cfg80211_registered_device *rdev = info->user_ptr[0]; 4488 + struct net_device *dev = info->user_ptr[1]; 4489 + struct mesh_config cfg; 4490 + int err; 4491 + 4492 + /* start with default */ 4493 + memcpy(&cfg, &default_mesh_config, sizeof(cfg)); 4494 + 4495 + if (info->attrs[NL80211_ATTR_MESH_PARAMS]) { 4496 + /* and parse parameters if given */ 4497 + err = nl80211_parse_mesh_params(info, &cfg, NULL); 4498 + if (err) 4499 + return err; 4500 + } 4501 + 4502 + if (!info->attrs[NL80211_ATTR_MESH_ID] || 4503 + !nla_len(info->attrs[NL80211_ATTR_MESH_ID])) 4504 + return -EINVAL; 4505 + 4506 + return cfg80211_join_mesh(rdev, dev, 4507 + nla_data(info->attrs[NL80211_ATTR_MESH_ID]), 4508 + nla_len(info->attrs[NL80211_ATTR_MESH_ID]), 4509 + &cfg); 4510 + } 4511 + 4512 + static int nl80211_leave_mesh(struct sk_buff *skb, struct genl_info *info) 4513 + { 4514 + struct cfg80211_registered_device *rdev = info->user_ptr[0]; 4515 + struct net_device *dev = info->user_ptr[1]; 4516 + 4517 + return cfg80211_leave_mesh(rdev, dev); 4518 + } 4519 + 4560 4520 #define NL80211_FLAG_NEED_WIPHY 0x01 4561 4521 #define NL80211_FLAG_NEED_NETDEV 0x02 4562 4522 #define NL80211_FLAG_NEED_RTNL 0x04 ··· 4856 4746 }, 4857 4747 { 4858 4748 .cmd = NL80211_CMD_SET_MESH_PARAMS, 4859 - .doit = nl80211_set_mesh_params, 4749 + .doit = nl80211_update_mesh_params, 4860 4750 .policy = nl80211_policy, 4861 4751 .flags = GENL_ADMIN_PERM, 4862 - .internal_flags = NL80211_FLAG_NEED_NETDEV | 4752 + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | 4863 4753 NL80211_FLAG_NEED_RTNL, 4864 4754 }, 4865 4755 { ··· 5072 4962 .policy = nl80211_policy, 5073 4963 .flags = GENL_ADMIN_PERM, 5074 4964 .internal_flags = NL80211_FLAG_NEED_NETDEV | 4965 + NL80211_FLAG_NEED_RTNL, 4966 + }, 4967 + { 4968 + .cmd = NL80211_CMD_JOIN_MESH, 4969 + .doit = nl80211_join_mesh, 4970 + .policy = nl80211_policy, 4971 + .flags = GENL_ADMIN_PERM, 4972 + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | 4973 + NL80211_FLAG_NEED_RTNL, 4974 + }, 4975 + { 4976 + .cmd = NL80211_CMD_LEAVE_MESH, 4977 + .doit = nl80211_leave_mesh, 4978 + .policy = nl80211_policy, 4979 + .flags = GENL_ADMIN_PERM, 4980 + .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | 5075 4981 NL80211_FLAG_NEED_RTNL, 5076 4982 }, 5077 4983 };
+1
net/wireless/util.c
··· 792 792 793 793 if (ntype != otype) { 794 794 dev->ieee80211_ptr->use_4addr = false; 795 + dev->ieee80211_ptr->mesh_id_up_len = 0; 795 796 796 797 switch (otype) { 797 798 case NL80211_IFTYPE_ADHOC: