From 253d2b511bd7b32a63aeec471717430902906d51 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 13 Aug 2013 10:35:14 +0000 Subject: ath9k: reorganize patches Signed-off-by: Felix Fietkau SVN-Revision: 37766 --- .../kernel/mac80211/patches/300-pending_work.patch | 105 +++++++++++++++- .../mac80211/patches/511-ath9k_reduce_rxbuf.patch | 2 +- .../patches/512-ath9k_channelbw_debugfs.patch | 4 +- .../522-ath9k_per_chain_signal_strength.patch | 6 +- .../mac80211/patches/530-ath9k_extra_leds.patch | 6 +- .../patches/540-ath9k_reduce_ani_interval.patch | 11 ++ .../541-ath9k_optimize_interrupt_mitigation.patch | 30 ----- .../patches/541-ath9k_rx_dma_stop_check.patch | 28 +++++ .../mac80211/patches/542-ath9k_debugfs_diag.patch | 139 +++++++++++++++++++++ ...-allow-to-disable-bands-via-platform-data.patch | 70 +++++++++++ .../patches/550-ath9k_reduce_ani_interval.patch | 11 -- .../patches/552-ath9k_rx_dma_stop_check.patch | 28 ----- .../mac80211/patches/553-ath9k_debugfs_diag.patch | 139 --------------------- .../mac80211/patches/554-ath9k_ani_mrc_fix.patch | 13 -- ...-allow-to-disable-bands-via-platform-data.patch | 70 ----------- .../mac80211/patches/556-ath9k_fix_rx_race.patch | 82 ------------ 16 files changed, 356 insertions(+), 388 deletions(-) create mode 100644 package/kernel/mac80211/patches/540-ath9k_reduce_ani_interval.patch delete mode 100644 package/kernel/mac80211/patches/541-ath9k_optimize_interrupt_mitigation.patch create mode 100644 package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch create mode 100644 package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch create mode 100644 package/kernel/mac80211/patches/543-ath9k-allow-to-disable-bands-via-platform-data.patch delete mode 100644 package/kernel/mac80211/patches/550-ath9k_reduce_ani_interval.patch delete mode 100644 package/kernel/mac80211/patches/552-ath9k_rx_dma_stop_check.patch delete mode 100644 package/kernel/mac80211/patches/553-ath9k_debugfs_diag.patch delete mode 100644 package/kernel/mac80211/patches/554-ath9k_ani_mrc_fix.patch delete mode 100644 package/kernel/mac80211/patches/555-ath9k-allow-to-disable-bands-via-platform-data.patch delete mode 100644 package/kernel/mac80211/patches/556-ath9k_fix_rx_race.patch (limited to 'package') diff --git a/package/kernel/mac80211/patches/300-pending_work.patch b/package/kernel/mac80211/patches/300-pending_work.patch index 4ec4423c6b..f6ef30e633 100644 --- a/package/kernel/mac80211/patches/300-pending_work.patch +++ b/package/kernel/mac80211/patches/300-pending_work.patch @@ -2235,7 +2235,18 @@ #define REALTEK_USB_VENQT_WRITE 0x40 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -137,7 +137,8 @@ int ath_descdma_setup(struct ath_softc * +@@ -79,10 +79,6 @@ struct ath_config { + sizeof(struct ath_buf_state)); \ + } while (0) + +-#define ATH_RXBUF_RESET(_bf) do { \ +- (_bf)->bf_stale = false; \ +- } while (0) +- + /** + * enum buffer_type - Buffer type flags + * +@@ -137,7 +133,8 @@ int ath_descdma_setup(struct ath_softc * #define ATH_AGGR_ENCRYPTDELIM 10 /* minimum h/w qdepth to be sustained to maximize aggregation */ #define ATH_AGGR_MIN_QDEPTH 2 @@ -2245,7 +2256,7 @@ #define IEEE80211_SEQ_SEQ_SHIFT 4 #define IEEE80211_SEQ_MAX 4096 -@@ -174,12 +175,6 @@ int ath_descdma_setup(struct ath_softc * +@@ -174,12 +171,6 @@ int ath_descdma_setup(struct ath_softc * #define ATH_TX_COMPLETE_POLL_INT 1000 @@ -2258,7 +2269,7 @@ #define ATH_TXFIFO_DEPTH 8 struct ath_txq { int mac80211_qnum; /* mac80211 queue number, -1 means not mac80211 Q */ -@@ -212,8 +207,9 @@ struct ath_frame_info { +@@ -212,8 +203,9 @@ struct ath_frame_info { int framelen; enum ath9k_key_type keytype; u8 keyix; @@ -2269,7 +2280,7 @@ }; struct ath_buf_state { -@@ -241,6 +237,7 @@ struct ath_buf { +@@ -241,6 +233,7 @@ struct ath_buf { struct ath_atx_tid { struct list_head list; struct sk_buff_head buf_q; @@ -2277,7 +2288,7 @@ struct ath_node *an; struct ath_atx_ac *ac; unsigned long tx_buf[BITS_TO_LONGS(ATH_TID_MAX_BUFS)]; -@@ -268,6 +265,7 @@ struct ath_node { +@@ -268,6 +261,7 @@ struct ath_node { u8 mpdudensity; bool sleeping; @@ -2285,7 +2296,15 @@ #if defined(CPTCFG_MAC80211_DEBUGFS) && defined(CPTCFG_ATH9K_DEBUGFS) struct dentry *node_stat; -@@ -367,6 +365,7 @@ void ath9k_release_buffered_frames(struc +@@ -317,6 +311,7 @@ struct ath_rx { + struct ath_descdma rxdma; + struct ath_rx_edma rx_edma[ATH9K_RX_QUEUE_MAX]; + ++ struct ath_buf *buf_hold; + struct sk_buff *frag; + + u32 ampdu_ref; +@@ -367,6 +362,7 @@ void ath9k_release_buffered_frames(struc /********/ struct ath_vif { @@ -2374,3 +2393,77 @@ ibss_dbg(sdata, "sta_find_ibss: did not try to join ibss\n"); /* Selected IBSS not found in current scan results - try to scan */ +--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c ++++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c +@@ -1173,6 +1173,10 @@ skip_ws_det: + * is_on == 0 means MRC CCK is OFF (more noise imm) + */ + bool is_on = param ? 1 : 0; ++ ++ if (ah->caps.rx_chainmask == 1) ++ break; ++ + REG_RMW_FIELD(ah, AR_PHY_MRC_CCK_CTRL, + AR_PHY_MRC_CCK_ENABLE, is_on); + REG_RMW_FIELD(ah, AR_PHY_MRC_CCK_CTRL, +--- a/drivers/net/wireless/ath/ath9k/recv.c ++++ b/drivers/net/wireless/ath/ath9k/recv.c +@@ -42,8 +42,6 @@ static void ath_rx_buf_link(struct ath_s + struct ath_desc *ds; + struct sk_buff *skb; + +- ATH_RXBUF_RESET(bf); +- + ds = bf->bf_desc; + ds->ds_link = 0; /* link to null */ + ds->ds_data = bf->bf_buf_addr; +@@ -70,6 +68,14 @@ static void ath_rx_buf_link(struct ath_s + sc->rx.rxlink = &ds->ds_link; + } + ++static void ath_rx_buf_relink(struct ath_softc *sc, struct ath_buf *bf) ++{ ++ if (sc->rx.buf_hold) ++ ath_rx_buf_link(sc, sc->rx.buf_hold); ++ ++ sc->rx.buf_hold = bf; ++} ++ + static void ath_setdefantenna(struct ath_softc *sc, u32 antenna) + { + /* XXX block beacon interrupts */ +@@ -117,7 +123,6 @@ static bool ath_rx_edma_buf_link(struct + + skb = bf->bf_mpdu; + +- ATH_RXBUF_RESET(bf); + memset(skb->data, 0, ah->caps.rx_status_len); + dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, + ah->caps.rx_status_len, DMA_TO_DEVICE); +@@ -432,6 +437,7 @@ int ath_startrecv(struct ath_softc *sc) + if (list_empty(&sc->rx.rxbuf)) + goto start_recv; + ++ sc->rx.buf_hold = NULL; + sc->rx.rxlink = NULL; + list_for_each_entry_safe(bf, tbf, &sc->rx.rxbuf, list) { + ath_rx_buf_link(sc, bf); +@@ -677,6 +683,9 @@ static struct ath_buf *ath_get_next_rx_b + } + + bf = list_first_entry(&sc->rx.rxbuf, struct ath_buf, list); ++ if (bf == sc->rx.buf_hold) ++ return NULL; ++ + ds = bf->bf_desc; + + /* +@@ -1375,7 +1384,7 @@ requeue: + if (edma) { + ath_rx_edma_buf_link(sc, qtype); + } else { +- ath_rx_buf_link(sc, bf); ++ ath_rx_buf_relink(sc, bf); + ath9k_hw_rxena(ah); + } + } while (1); diff --git a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch index 8d8c5fd7fe..273b68381f 100644 --- a/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch +++ b/package/kernel/mac80211/patches/511-ath9k_reduce_rxbuf.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -119,7 +119,7 @@ int ath_descdma_setup(struct ath_softc * +@@ -115,7 +115,7 @@ int ath_descdma_setup(struct ath_softc * /* RX / TX */ /***********/ diff --git a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch index d09306f3ef..87aaf3061c 100644 --- a/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch +++ b/package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -700,6 +700,7 @@ struct ath_softc { +@@ -697,6 +697,7 @@ struct ath_softc { struct ieee80211_hw *hw; struct device *dev; @@ -8,7 +8,7 @@ struct survey_info *cur_survey; struct survey_info survey[ATH9K_NUM_CHANNELS]; -@@ -904,6 +905,7 @@ struct fft_sample_ht20 { +@@ -901,6 +902,7 @@ struct fft_sample_ht20 { u8 data[SPECTRAL_HT20_NUM_BINS]; } __packed; diff --git a/package/kernel/mac80211/patches/522-ath9k_per_chain_signal_strength.patch b/package/kernel/mac80211/patches/522-ath9k_per_chain_signal_strength.patch index 50dbcd9902..b6075a8144 100644 --- a/package/kernel/mac80211/patches/522-ath9k_per_chain_signal_strength.patch +++ b/package/kernel/mac80211/patches/522-ath9k_per_chain_signal_strength.patch @@ -17,7 +17,7 @@ u8 rs_num_delims; --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c -@@ -939,6 +939,7 @@ static int ath9k_rx_skb_preprocess(struc +@@ -948,6 +948,7 @@ static int ath9k_rx_skb_preprocess(struc struct ath_hw *ah = sc->sc_ah; struct ath_common *common = ath9k_hw_common(ah); bool discard_current = sc->rx.discard_next; @@ -25,7 +25,7 @@ sc->rx.discard_next = rx_stats->rs_more; if (discard_current) -@@ -968,6 +969,21 @@ static int ath9k_rx_skb_preprocess(struc +@@ -977,6 +978,21 @@ static int ath9k_rx_skb_preprocess(struc if (rx_stats->rs_moreaggr) rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL; @@ -47,7 +47,7 @@ sc->rx.discard_next = false; return 0; } -@@ -1077,7 +1093,7 @@ static int ath_process_fft(struct ath_so +@@ -1086,7 +1102,7 @@ static int ath_process_fft(struct ath_so fft_sample.tlv.length = __cpu_to_be16(length); fft_sample.freq = __cpu_to_be16(ah->curchan->chan->center_freq); diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch index 79eb9c84c9..f595059027 100644 --- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch +++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -556,6 +556,9 @@ struct ath9k_wow_pattern { +@@ -553,6 +553,9 @@ struct ath9k_wow_pattern { void ath_init_leds(struct ath_softc *sc); void ath_deinit_leds(struct ath_softc *sc); void ath_fill_led_pin(struct ath_softc *sc); @@ -10,7 +10,7 @@ #else static inline void ath_init_leds(struct ath_softc *sc) { -@@ -696,6 +699,13 @@ enum spectral_mode { +@@ -693,6 +696,13 @@ enum spectral_mode { SPECTRAL_CHANSCAN, }; @@ -24,7 +24,7 @@ struct ath_softc { struct ieee80211_hw *hw; struct device *dev; -@@ -738,9 +748,8 @@ struct ath_softc { +@@ -735,9 +745,8 @@ struct ath_softc { struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS]; #ifdef CPTCFG_MAC80211_LEDS diff --git a/package/kernel/mac80211/patches/540-ath9k_reduce_ani_interval.patch b/package/kernel/mac80211/patches/540-ath9k_reduce_ani_interval.patch new file mode 100644 index 0000000000..7c24f46f67 --- /dev/null +++ b/package/kernel/mac80211/patches/540-ath9k_reduce_ani_interval.patch @@ -0,0 +1,11 @@ +--- a/drivers/net/wireless/ath/ath9k/ani.h ++++ b/drivers/net/wireless/ath/ath9k/ani.h +@@ -38,7 +38,7 @@ + #define ATH9K_ANI_PERIOD 300 + + /* in ms */ +-#define ATH9K_ANI_POLLINTERVAL 1000 ++#define ATH9K_ANI_POLLINTERVAL 300 + + #define ATH9K_SIG_FIRSTEP_SETTING_MIN 0 + #define ATH9K_SIG_FIRSTEP_SETTING_MAX 20 diff --git a/package/kernel/mac80211/patches/541-ath9k_optimize_interrupt_mitigation.patch b/package/kernel/mac80211/patches/541-ath9k_optimize_interrupt_mitigation.patch deleted file mode 100644 index 95ceb3575d..0000000000 --- a/package/kernel/mac80211/patches/541-ath9k_optimize_interrupt_mitigation.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c -+++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c -@@ -241,21 +241,19 @@ static bool ar9003_hw_get_isr(struct ath - - *masked = isr & ATH9K_INT_COMMON; - -- if (ah->config.rx_intr_mitigation) -+ if (ah->config.rx_intr_mitigation) { - if (isr & (AR_ISR_RXMINTR | AR_ISR_RXINTM)) - *masked |= ATH9K_INT_RXLP; -- -- if (ah->config.tx_intr_mitigation) -- if (isr & (AR_ISR_TXMINTR | AR_ISR_TXINTM)) -- *masked |= ATH9K_INT_TX; -- -- if (isr & (AR_ISR_LP_RXOK | AR_ISR_RXERR)) -+ } else if (isr & (AR_ISR_LP_RXOK | AR_ISR_RXERR)) - *masked |= ATH9K_INT_RXLP; - - if (isr & AR_ISR_HP_RXOK) - *masked |= ATH9K_INT_RXHP; - -- if (isr & (AR_ISR_TXOK | AR_ISR_TXERR | AR_ISR_TXEOL)) { -+ if (ah->config.tx_intr_mitigation) { -+ if (isr & (AR_ISR_TXMINTR | AR_ISR_TXINTM)) -+ *masked |= ATH9K_INT_TX; -+ } else if (isr & (AR_ISR_TXOK | AR_ISR_TXERR | AR_ISR_TXEOL)) { - *masked |= ATH9K_INT_TX; - - if (!(pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED)) { diff --git a/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch b/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch new file mode 100644 index 0000000000..5d063c7d65 --- /dev/null +++ b/package/kernel/mac80211/patches/541-ath9k_rx_dma_stop_check.patch @@ -0,0 +1,28 @@ +--- a/drivers/net/wireless/ath/ath9k/mac.c ++++ b/drivers/net/wireless/ath/ath9k/mac.c +@@ -705,7 +705,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw + { + #define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */ + struct ath_common *common = ath9k_hw_common(ah); +- u32 mac_status, last_mac_status = 0; ++ u32 mac_status = 0, last_mac_status = 0; + int i; + + /* Enable access to the DMA observation bus */ +@@ -735,6 +735,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw + } + + if (i == 0) { ++ if (!AR_SREV_9300_20_OR_LATER(ah) && ++ (mac_status & 0x700) == 0) { ++ /* ++ * DMA is idle but the MAC is still stuck ++ * processing events ++ */ ++ *reset = true; ++ return true; ++ } ++ + ath_err(common, + "DMA failed to stop in %d ms AR_CR=0x%08x AR_DIAG_SW=0x%08x DMADBG_7=0x%08x\n", + AH_RX_STOP_DMA_TIMEOUT / 1000, diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch new file mode 100644 index 0000000000..b069cb2cdb --- /dev/null +++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch @@ -0,0 +1,139 @@ +--- a/drivers/net/wireless/ath/ath9k/debug.c ++++ b/drivers/net/wireless/ath/ath9k/debug.c +@@ -1892,6 +1892,50 @@ static const struct file_operations fops + #endif + + ++static ssize_t read_file_diag(struct file *file, char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath_softc *sc = file->private_data; ++ struct ath_hw *ah = sc->sc_ah; ++ char buf[32]; ++ unsigned int len; ++ ++ len = sprintf(buf, "0x%08lx\n", ah->diag); ++ return simple_read_from_buffer(user_buf, count, ppos, buf, len); ++} ++ ++static ssize_t write_file_diag(struct file *file, const char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath_softc *sc = file->private_data; ++ struct ath_hw *ah = sc->sc_ah; ++ unsigned long diag; ++ char buf[32]; ++ ssize_t len; ++ ++ len = min(count, sizeof(buf) - 1); ++ if (copy_from_user(buf, user_buf, len)) ++ return -EFAULT; ++ ++ buf[len] = '\0'; ++ if (kstrtoul(buf, 0, &diag)) ++ return -EINVAL; ++ ++ ah->diag = diag; ++ ath9k_hw_update_diag(ah); ++ ++ return count; ++} ++ ++static const struct file_operations fops_diag = { ++ .read = read_file_diag, ++ .write = write_file_diag, ++ .open = simple_open, ++ .owner = THIS_MODULE, ++ .llseek = default_llseek, ++}; ++ ++ + int ath9k_init_debug(struct ath_hw *ah) + { + struct ath_common *common = ath9k_hw_common(ah); +@@ -1917,6 +1961,8 @@ int ath9k_init_debug(struct ath_hw *ah) + debugfs_create_file("gpio_led", S_IWUSR, + sc->debug.debugfs_phy, sc, &fops_gpio_led); + #endif ++ debugfs_create_file("diag", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, ++ sc, &fops_diag); + debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, sc, + &fops_dma); + debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc, +--- a/drivers/net/wireless/ath/ath9k/hw.h ++++ b/drivers/net/wireless/ath/ath9k/hw.h +@@ -500,6 +500,12 @@ enum { + ATH9K_RESET_COLD, + }; + ++enum { ++ ATH_DIAG_DISABLE_RX, ++ ATH_DIAG_DISABLE_TX, ++ ATH_DIAG_TRIGGER_ERROR, ++}; ++ + struct ath9k_hw_version { + u32 magic; + u16 devid; +@@ -778,6 +784,8 @@ struct ath_hw { + u32 rfkill_polarity; + u32 ah_flags; + ++ unsigned long diag; ++ + bool reset_power_on; + bool htc_reset_init; + +@@ -1028,6 +1036,7 @@ void ath9k_hw_set_sta_beacon_timers(stru + bool ath9k_hw_check_alive(struct ath_hw *ah); + + bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); ++void ath9k_hw_update_diag(struct ath_hw *ah); + + #ifdef CPTCFG_ATH9K_DEBUGFS + void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause); +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -1854,6 +1854,20 @@ fail: + return -EINVAL; + } + ++void ath9k_hw_update_diag(struct ath_hw *ah) ++{ ++ if (test_bit(ATH_DIAG_DISABLE_RX, &ah->diag)) ++ REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_DIS); ++ else ++ REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_DIS); ++ ++ if (test_bit(ATH_DIAG_DISABLE_TX, &ah->diag)) ++ REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_LOOP_BACK); ++ else ++ REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_LOOP_BACK); ++} ++EXPORT_SYMBOL(ath9k_hw_update_diag); ++ + int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, + struct ath9k_hw_cal_data *caldata, bool fastcc) + { +@@ -2056,6 +2070,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st + } + + ath9k_hw_apply_gpio_override(ah); ++ ath9k_hw_update_diag(ah); + + if (AR_SREV_9565(ah) && ah->shared_chain_lnadiv) + REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, AR_BTCOEX_WL_LNADIV_FORCE_ON); +--- a/drivers/net/wireless/ath/ath9k/main.c ++++ b/drivers/net/wireless/ath/ath9k/main.c +@@ -462,6 +462,11 @@ irqreturn_t ath_isr(int irq, void *dev) + ath9k_hw_getisr(ah, &status); /* NB: clears ISR too */ + status &= ah->imask; /* discard unasked-for bits */ + ++ if (test_bit(ATH_DIAG_TRIGGER_ERROR, &ah->diag)) { ++ status |= ATH9K_INT_FATAL; ++ clear_bit(ATH_DIAG_TRIGGER_ERROR, &ah->diag); ++ } ++ + /* + * If there are no status bits set, then this interrupt was not + * for me (should have been caught above). diff --git a/package/kernel/mac80211/patches/543-ath9k-allow-to-disable-bands-via-platform-data.patch b/package/kernel/mac80211/patches/543-ath9k-allow-to-disable-bands-via-platform-data.patch new file mode 100644 index 0000000000..c5b90af68c --- /dev/null +++ b/package/kernel/mac80211/patches/543-ath9k-allow-to-disable-bands-via-platform-data.patch @@ -0,0 +1,70 @@ +--- a/include/linux/ath9k_platform.h ++++ b/include/linux/ath9k_platform.h +@@ -33,6 +33,9 @@ struct ath9k_platform_data { + + bool endian_check; + bool is_clk_25mhz; ++ bool disable_2ghz; ++ bool disable_5ghz; ++ + int (*get_mac_revision)(void); + int (*external_reset)(void); + +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -2449,17 +2449,25 @@ int ath9k_hw_fill_cap_info(struct ath_hw + } + + eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE); +- if ((eeval & (AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A)) == 0) { +- ath_err(common, +- "no band has been marked as supported in EEPROM\n"); +- return -EINVAL; ++ ++ if (eeval & AR5416_OPFLAGS_11A) { ++ if (ah->disable_5ghz) ++ ath_warn(common, "disabling 5GHz band\n"); ++ else ++ pCap->hw_caps |= ATH9K_HW_CAP_5GHZ; + } + +- if (eeval & AR5416_OPFLAGS_11A) +- pCap->hw_caps |= ATH9K_HW_CAP_5GHZ; ++ if (eeval & AR5416_OPFLAGS_11G) { ++ if (ah->disable_2ghz) ++ ath_warn(common, "disabling 2GHz band\n"); ++ else ++ pCap->hw_caps |= ATH9K_HW_CAP_2GHZ; ++ } + +- if (eeval & AR5416_OPFLAGS_11G) +- pCap->hw_caps |= ATH9K_HW_CAP_2GHZ; ++ if ((pCap->hw_caps & (ATH9K_HW_CAP_2GHZ | ATH9K_HW_CAP_5GHZ)) == 0) { ++ ath_err(common, "both bands are disabled\n"); ++ return -EINVAL; ++ } + + if (AR_SREV_9485(ah) || + AR_SREV_9285(ah) || +--- a/drivers/net/wireless/ath/ath9k/hw.h ++++ b/drivers/net/wireless/ath/ath9k/hw.h +@@ -948,6 +948,8 @@ struct ath_hw { + bool is_clk_25mhz; + int (*get_mac_revision)(void); + int (*external_reset)(void); ++ bool disable_2ghz; ++ bool disable_5ghz; + + const struct firmware *eeprom_blob; + }; +--- a/drivers/net/wireless/ath/ath9k/init.c ++++ b/drivers/net/wireless/ath/ath9k/init.c +@@ -613,6 +613,8 @@ static int ath9k_init_softc(u16 devid, s + ah->is_clk_25mhz = pdata->is_clk_25mhz; + ah->get_mac_revision = pdata->get_mac_revision; + ah->external_reset = pdata->external_reset; ++ ah->disable_2ghz = pdata->disable_2ghz; ++ ah->disable_5ghz = pdata->disable_5ghz; + if (!pdata->endian_check) + ah->ah_flags |= AH_NO_EEP_SWAP; + } diff --git a/package/kernel/mac80211/patches/550-ath9k_reduce_ani_interval.patch b/package/kernel/mac80211/patches/550-ath9k_reduce_ani_interval.patch deleted file mode 100644 index 7c24f46f67..0000000000 --- a/package/kernel/mac80211/patches/550-ath9k_reduce_ani_interval.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/ani.h -+++ b/drivers/net/wireless/ath/ath9k/ani.h -@@ -38,7 +38,7 @@ - #define ATH9K_ANI_PERIOD 300 - - /* in ms */ --#define ATH9K_ANI_POLLINTERVAL 1000 -+#define ATH9K_ANI_POLLINTERVAL 300 - - #define ATH9K_SIG_FIRSTEP_SETTING_MIN 0 - #define ATH9K_SIG_FIRSTEP_SETTING_MAX 20 diff --git a/package/kernel/mac80211/patches/552-ath9k_rx_dma_stop_check.patch b/package/kernel/mac80211/patches/552-ath9k_rx_dma_stop_check.patch deleted file mode 100644 index 5d063c7d65..0000000000 --- a/package/kernel/mac80211/patches/552-ath9k_rx_dma_stop_check.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/mac.c -+++ b/drivers/net/wireless/ath/ath9k/mac.c -@@ -705,7 +705,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw - { - #define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */ - struct ath_common *common = ath9k_hw_common(ah); -- u32 mac_status, last_mac_status = 0; -+ u32 mac_status = 0, last_mac_status = 0; - int i; - - /* Enable access to the DMA observation bus */ -@@ -735,6 +735,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw - } - - if (i == 0) { -+ if (!AR_SREV_9300_20_OR_LATER(ah) && -+ (mac_status & 0x700) == 0) { -+ /* -+ * DMA is idle but the MAC is still stuck -+ * processing events -+ */ -+ *reset = true; -+ return true; -+ } -+ - ath_err(common, - "DMA failed to stop in %d ms AR_CR=0x%08x AR_DIAG_SW=0x%08x DMADBG_7=0x%08x\n", - AH_RX_STOP_DMA_TIMEOUT / 1000, diff --git a/package/kernel/mac80211/patches/553-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/553-ath9k_debugfs_diag.patch deleted file mode 100644 index b069cb2cdb..0000000000 --- a/package/kernel/mac80211/patches/553-ath9k_debugfs_diag.patch +++ /dev/null @@ -1,139 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/debug.c -+++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1892,6 +1892,50 @@ static const struct file_operations fops - #endif - - -+static ssize_t read_file_diag(struct file *file, char __user *user_buf, -+ size_t count, loff_t *ppos) -+{ -+ struct ath_softc *sc = file->private_data; -+ struct ath_hw *ah = sc->sc_ah; -+ char buf[32]; -+ unsigned int len; -+ -+ len = sprintf(buf, "0x%08lx\n", ah->diag); -+ return simple_read_from_buffer(user_buf, count, ppos, buf, len); -+} -+ -+static ssize_t write_file_diag(struct file *file, const char __user *user_buf, -+ size_t count, loff_t *ppos) -+{ -+ struct ath_softc *sc = file->private_data; -+ struct ath_hw *ah = sc->sc_ah; -+ unsigned long diag; -+ char buf[32]; -+ ssize_t len; -+ -+ len = min(count, sizeof(buf) - 1); -+ if (copy_from_user(buf, user_buf, len)) -+ return -EFAULT; -+ -+ buf[len] = '\0'; -+ if (kstrtoul(buf, 0, &diag)) -+ return -EINVAL; -+ -+ ah->diag = diag; -+ ath9k_hw_update_diag(ah); -+ -+ return count; -+} -+ -+static const struct file_operations fops_diag = { -+ .read = read_file_diag, -+ .write = write_file_diag, -+ .open = simple_open, -+ .owner = THIS_MODULE, -+ .llseek = default_llseek, -+}; -+ -+ - int ath9k_init_debug(struct ath_hw *ah) - { - struct ath_common *common = ath9k_hw_common(ah); -@@ -1917,6 +1961,8 @@ int ath9k_init_debug(struct ath_hw *ah) - debugfs_create_file("gpio_led", S_IWUSR, - sc->debug.debugfs_phy, sc, &fops_gpio_led); - #endif -+ debugfs_create_file("diag", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, -+ sc, &fops_diag); - debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, sc, - &fops_dma); - debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc, ---- a/drivers/net/wireless/ath/ath9k/hw.h -+++ b/drivers/net/wireless/ath/ath9k/hw.h -@@ -500,6 +500,12 @@ enum { - ATH9K_RESET_COLD, - }; - -+enum { -+ ATH_DIAG_DISABLE_RX, -+ ATH_DIAG_DISABLE_TX, -+ ATH_DIAG_TRIGGER_ERROR, -+}; -+ - struct ath9k_hw_version { - u32 magic; - u16 devid; -@@ -778,6 +784,8 @@ struct ath_hw { - u32 rfkill_polarity; - u32 ah_flags; - -+ unsigned long diag; -+ - bool reset_power_on; - bool htc_reset_init; - -@@ -1028,6 +1036,7 @@ void ath9k_hw_set_sta_beacon_timers(stru - bool ath9k_hw_check_alive(struct ath_hw *ah); - - bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); -+void ath9k_hw_update_diag(struct ath_hw *ah); - - #ifdef CPTCFG_ATH9K_DEBUGFS - void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause); ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1854,6 +1854,20 @@ fail: - return -EINVAL; - } - -+void ath9k_hw_update_diag(struct ath_hw *ah) -+{ -+ if (test_bit(ATH_DIAG_DISABLE_RX, &ah->diag)) -+ REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_DIS); -+ else -+ REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_DIS); -+ -+ if (test_bit(ATH_DIAG_DISABLE_TX, &ah->diag)) -+ REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_LOOP_BACK); -+ else -+ REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_LOOP_BACK); -+} -+EXPORT_SYMBOL(ath9k_hw_update_diag); -+ - int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, - struct ath9k_hw_cal_data *caldata, bool fastcc) - { -@@ -2056,6 +2070,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st - } - - ath9k_hw_apply_gpio_override(ah); -+ ath9k_hw_update_diag(ah); - - if (AR_SREV_9565(ah) && ah->shared_chain_lnadiv) - REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, AR_BTCOEX_WL_LNADIV_FORCE_ON); ---- a/drivers/net/wireless/ath/ath9k/main.c -+++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -462,6 +462,11 @@ irqreturn_t ath_isr(int irq, void *dev) - ath9k_hw_getisr(ah, &status); /* NB: clears ISR too */ - status &= ah->imask; /* discard unasked-for bits */ - -+ if (test_bit(ATH_DIAG_TRIGGER_ERROR, &ah->diag)) { -+ status |= ATH9K_INT_FATAL; -+ clear_bit(ATH_DIAG_TRIGGER_ERROR, &ah->diag); -+ } -+ - /* - * If there are no status bits set, then this interrupt was not - * for me (should have been caught above). diff --git a/package/kernel/mac80211/patches/554-ath9k_ani_mrc_fix.patch b/package/kernel/mac80211/patches/554-ath9k_ani_mrc_fix.patch deleted file mode 100644 index 47df721322..0000000000 --- a/package/kernel/mac80211/patches/554-ath9k_ani_mrc_fix.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c -+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c -@@ -1173,6 +1173,10 @@ skip_ws_det: - * is_on == 0 means MRC CCK is OFF (more noise imm) - */ - bool is_on = param ? 1 : 0; -+ -+ if (ah->caps.rx_chainmask == 1) -+ break; -+ - REG_RMW_FIELD(ah, AR_PHY_MRC_CCK_CTRL, - AR_PHY_MRC_CCK_ENABLE, is_on); - REG_RMW_FIELD(ah, AR_PHY_MRC_CCK_CTRL, diff --git a/package/kernel/mac80211/patches/555-ath9k-allow-to-disable-bands-via-platform-data.patch b/package/kernel/mac80211/patches/555-ath9k-allow-to-disable-bands-via-platform-data.patch deleted file mode 100644 index c5b90af68c..0000000000 --- a/package/kernel/mac80211/patches/555-ath9k-allow-to-disable-bands-via-platform-data.patch +++ /dev/null @@ -1,70 +0,0 @@ ---- a/include/linux/ath9k_platform.h -+++ b/include/linux/ath9k_platform.h -@@ -33,6 +33,9 @@ struct ath9k_platform_data { - - bool endian_check; - bool is_clk_25mhz; -+ bool disable_2ghz; -+ bool disable_5ghz; -+ - int (*get_mac_revision)(void); - int (*external_reset)(void); - ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2449,17 +2449,25 @@ int ath9k_hw_fill_cap_info(struct ath_hw - } - - eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE); -- if ((eeval & (AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A)) == 0) { -- ath_err(common, -- "no band has been marked as supported in EEPROM\n"); -- return -EINVAL; -+ -+ if (eeval & AR5416_OPFLAGS_11A) { -+ if (ah->disable_5ghz) -+ ath_warn(common, "disabling 5GHz band\n"); -+ else -+ pCap->hw_caps |= ATH9K_HW_CAP_5GHZ; - } - -- if (eeval & AR5416_OPFLAGS_11A) -- pCap->hw_caps |= ATH9K_HW_CAP_5GHZ; -+ if (eeval & AR5416_OPFLAGS_11G) { -+ if (ah->disable_2ghz) -+ ath_warn(common, "disabling 2GHz band\n"); -+ else -+ pCap->hw_caps |= ATH9K_HW_CAP_2GHZ; -+ } - -- if (eeval & AR5416_OPFLAGS_11G) -- pCap->hw_caps |= ATH9K_HW_CAP_2GHZ; -+ if ((pCap->hw_caps & (ATH9K_HW_CAP_2GHZ | ATH9K_HW_CAP_5GHZ)) == 0) { -+ ath_err(common, "both bands are disabled\n"); -+ return -EINVAL; -+ } - - if (AR_SREV_9485(ah) || - AR_SREV_9285(ah) || ---- a/drivers/net/wireless/ath/ath9k/hw.h -+++ b/drivers/net/wireless/ath/ath9k/hw.h -@@ -948,6 +948,8 @@ struct ath_hw { - bool is_clk_25mhz; - int (*get_mac_revision)(void); - int (*external_reset)(void); -+ bool disable_2ghz; -+ bool disable_5ghz; - - const struct firmware *eeprom_blob; - }; ---- a/drivers/net/wireless/ath/ath9k/init.c -+++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -613,6 +613,8 @@ static int ath9k_init_softc(u16 devid, s - ah->is_clk_25mhz = pdata->is_clk_25mhz; - ah->get_mac_revision = pdata->get_mac_revision; - ah->external_reset = pdata->external_reset; -+ ah->disable_2ghz = pdata->disable_2ghz; -+ ah->disable_5ghz = pdata->disable_5ghz; - if (!pdata->endian_check) - ah->ah_flags |= AH_NO_EEP_SWAP; - } diff --git a/package/kernel/mac80211/patches/556-ath9k_fix_rx_race.patch b/package/kernel/mac80211/patches/556-ath9k_fix_rx_race.patch deleted file mode 100644 index 3e5347dfb3..0000000000 --- a/package/kernel/mac80211/patches/556-ath9k_fix_rx_race.patch +++ /dev/null @@ -1,82 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/ath9k.h -+++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -79,10 +79,6 @@ struct ath_config { - sizeof(struct ath_buf_state)); \ - } while (0) - --#define ATH_RXBUF_RESET(_bf) do { \ -- (_bf)->bf_stale = false; \ -- } while (0) -- - /** - * enum buffer_type - Buffer type flags - * -@@ -315,6 +311,7 @@ struct ath_rx { - struct ath_descdma rxdma; - struct ath_rx_edma rx_edma[ATH9K_RX_QUEUE_MAX]; - -+ struct ath_buf *buf_hold; - struct sk_buff *frag; - - u32 ampdu_ref; ---- a/drivers/net/wireless/ath/ath9k/recv.c -+++ b/drivers/net/wireless/ath/ath9k/recv.c -@@ -42,8 +42,6 @@ static void ath_rx_buf_link(struct ath_s - struct ath_desc *ds; - struct sk_buff *skb; - -- ATH_RXBUF_RESET(bf); -- - ds = bf->bf_desc; - ds->ds_link = 0; /* link to null */ - ds->ds_data = bf->bf_buf_addr; -@@ -70,6 +68,14 @@ static void ath_rx_buf_link(struct ath_s - sc->rx.rxlink = &ds->ds_link; - } - -+static void ath_rx_buf_relink(struct ath_softc *sc, struct ath_buf *bf) -+{ -+ if (sc->rx.buf_hold) -+ ath_rx_buf_link(sc, sc->rx.buf_hold); -+ -+ sc->rx.buf_hold = bf; -+} -+ - static void ath_setdefantenna(struct ath_softc *sc, u32 antenna) - { - /* XXX block beacon interrupts */ -@@ -117,7 +123,6 @@ static bool ath_rx_edma_buf_link(struct - - skb = bf->bf_mpdu; - -- ATH_RXBUF_RESET(bf); - memset(skb->data, 0, ah->caps.rx_status_len); - dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, - ah->caps.rx_status_len, DMA_TO_DEVICE); -@@ -432,6 +437,7 @@ int ath_startrecv(struct ath_softc *sc) - if (list_empty(&sc->rx.rxbuf)) - goto start_recv; - -+ sc->rx.buf_hold = NULL; - sc->rx.rxlink = NULL; - list_for_each_entry_safe(bf, tbf, &sc->rx.rxbuf, list) { - ath_rx_buf_link(sc, bf); -@@ -677,6 +683,9 @@ static struct ath_buf *ath_get_next_rx_b - } - - bf = list_first_entry(&sc->rx.rxbuf, struct ath_buf, list); -+ if (bf == sc->rx.buf_hold) -+ return NULL; -+ - ds = bf->bf_desc; - - /* -@@ -1391,7 +1400,7 @@ requeue: - if (edma) { - ath_rx_edma_buf_link(sc, qtype); - } else { -- ath_rx_buf_link(sc, bf); -+ ath_rx_buf_relink(sc, bf); - ath9k_hw_rxena(ah); - } - } while (1); -- cgit v1.2.3