From: Felix Fietkau Date: Mon, 1 Aug 2011 12:15:15 +0000 (+0000) Subject: ath9k: fold patches that were merged upstream into 300-pending_work.patch X-Git-Tag: reboot~16131 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=a1e19186fa70e8bc918d825e31a50259ea8082fd;p=openwrt%2Fstaging%2Fblogic.git ath9k: fold patches that were merged upstream into 300-pending_work.patch SVN-Revision: 27860 --- diff --git a/package/mac80211/patches/300-pending_work.patch b/package/mac80211/patches/300-pending_work.patch index f2e4fdb44525..a36f99ce6edd 100644 --- a/package/mac80211/patches/300-pending_work.patch +++ b/package/mac80211/patches/300-pending_work.patch @@ -44,6 +44,15 @@ return -EINVAL; if (test_sta_flags(sta, WLAN_STA_BLOCK_BA)) { +@@ -809,7 +811,7 @@ void ieee80211_process_addba_resp(struct + * of at least 1. + */ + if (!buf_size) +- goto out; ++ buf_size = 1; + + if (test_and_set_bit(HT_AGG_STATE_RESPONSE_RECEIVED, + &tid_tx->state)) { --- a/net/mac80211/debugfs_sta.c +++ b/net/mac80211/debugfs_sta.c @@ -59,7 +59,7 @@ static ssize_t sta_flags_read(struct fil @@ -1144,3 +1153,493 @@ ieee80211_hw_config(local, 0); /* At the least, we need to disable offchannel_ps, +--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c ++++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c +@@ -627,6 +627,11 @@ static void ar5008_hw_init_bb(struct ath + else + synthDelay /= 10; + ++ if (IS_CHAN_HALF_RATE(chan)) ++ synthDelay *= 2; ++ else if (IS_CHAN_QUARTER_RATE(chan)) ++ synthDelay *= 4; ++ + REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); + + udelay(synthDelay + BASE_ACTIVATE_DELAY); +--- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c ++++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c +@@ -499,45 +499,6 @@ void ar9002_hw_enable_async_fifo(struct + } + } + +-/* +- * If Async FIFO is enabled, the following counters change as MAC now runs +- * at 117 Mhz instead of 88/44MHz when async FIFO is disabled. +- * +- * The values below tested for ht40 2 chain. +- * Overwrite the delay/timeouts initialized in process ini. +- */ +-void ar9002_hw_update_async_fifo(struct ath_hw *ah) +-{ +- if (AR_SREV_9287_13_OR_LATER(ah)) { +- REG_WRITE(ah, AR_D_GBL_IFS_SIFS, +- AR_D_GBL_IFS_SIFS_ASYNC_FIFO_DUR); +- REG_WRITE(ah, AR_D_GBL_IFS_SLOT, +- AR_D_GBL_IFS_SLOT_ASYNC_FIFO_DUR); +- REG_WRITE(ah, AR_D_GBL_IFS_EIFS, +- AR_D_GBL_IFS_EIFS_ASYNC_FIFO_DUR); +- +- REG_WRITE(ah, AR_TIME_OUT, AR_TIME_OUT_ACK_CTS_ASYNC_FIFO_DUR); +- REG_WRITE(ah, AR_USEC, AR_USEC_ASYNC_FIFO_DUR); +- +- REG_SET_BIT(ah, AR_MAC_PCU_LOGIC_ANALYZER, +- AR_MAC_PCU_LOGIC_ANALYZER_DISBUG20768); +- REG_RMW_FIELD(ah, AR_AHB_MODE, AR_AHB_CUSTOM_BURST_EN, +- AR_AHB_CUSTOM_BURST_ASYNC_FIFO_VAL); +- } +-} +- +-/* +- * We don't enable WEP aggregation on mac80211 but we keep this +- * around for HAL unification purposes. +- */ +-void ar9002_hw_enable_wep_aggregation(struct ath_hw *ah) +-{ +- if (AR_SREV_9287_13_OR_LATER(ah)) { +- REG_SET_BIT(ah, AR_PCU_MISC_MODE2, +- AR_PCU_MISC_MODE2_ENABLE_AGGWEP); +- } +-} +- + /* Sets up the AR5008/AR9001/AR9002 hardware familiy callbacks */ + void ar9002_hw_attach_ops(struct ath_hw *ah) + { +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c +@@ -111,7 +111,9 @@ static int ar9002_hw_set_channel(struct + + switch (ah->eep_ops->get_eeprom(ah, EEP_FRAC_N_5G)) { + case 0: +- if ((freq % 20) == 0) ++ if (IS_CHAN_HALF_RATE(chan) || IS_CHAN_QUARTER_RATE(chan)) ++ aModeRefSel = 0; ++ else if ((freq % 20) == 0) + aModeRefSel = 3; + else if ((freq % 10) == 0) + aModeRefSel = 2; +@@ -129,8 +131,9 @@ static int ar9002_hw_set_channel(struct + channelSel = CHANSEL_5G(freq); + + /* RefDivA setting */ +- REG_RMW_FIELD(ah, AR_AN_SYNTH9, +- AR_AN_SYNTH9_REFDIVA, refDivA); ++ ath9k_hw_analog_shift_rmw(ah, AR_AN_SYNTH9, ++ AR_AN_SYNTH9_REFDIVA, ++ AR_AN_SYNTH9_REFDIVA_S, refDivA); + + } + +@@ -447,26 +450,27 @@ static void ar9002_olc_init(struct ath_h + static u32 ar9002_hw_compute_pll_control(struct ath_hw *ah, + struct ath9k_channel *chan) + { ++ int ref_div = 5; ++ int pll_div = 0x2c; + u32 pll; + +- pll = SM(0x5, AR_RTC_9160_PLL_REFDIV); ++ if (chan && IS_CHAN_5GHZ(chan) && !IS_CHAN_A_FAST_CLOCK(ah, chan)) { ++ if (AR_SREV_9280_20(ah)) { ++ ref_div = 10; ++ pll_div = 0x50; ++ } else { ++ pll_div = 0x28; ++ } ++ } ++ ++ pll = SM(ref_div, AR_RTC_9160_PLL_REFDIV); ++ pll |= SM(pll_div, AR_RTC_9160_PLL_DIV); + + if (chan && IS_CHAN_HALF_RATE(chan)) + pll |= SM(0x1, AR_RTC_9160_PLL_CLKSEL); + else if (chan && IS_CHAN_QUARTER_RATE(chan)) + pll |= SM(0x2, AR_RTC_9160_PLL_CLKSEL); + +- if (chan && IS_CHAN_5GHZ(chan)) { +- if (IS_CHAN_A_FAST_CLOCK(ah, chan)) +- pll = 0x142c; +- else if (AR_SREV_9280_20(ah)) +- pll = 0x2850; +- else +- pll |= SM(0x28, AR_RTC_9160_PLL_DIV); +- } else { +- pll |= SM(0x2c, AR_RTC_9160_PLL_DIV); +- } +- + return pll; + } + +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -87,7 +87,10 @@ static void ath9k_hw_set_clockrate(struc + struct ath_common *common = ath9k_hw_common(ah); + unsigned int clockrate; + +- if (!ah->curchan) /* should really check for CCK instead */ ++ /* AR9287 v1.3+ uses async FIFO and runs the MAC at 117 MHz */ ++ if (AR_SREV_9287(ah) && AR_SREV_9287_13_OR_LATER(ah)) ++ clockrate = 117; ++ else if (!ah->curchan) /* should really check for CCK instead */ + clockrate = ATH9K_CLOCK_RATE_CCK; + else if (conf->channel->band == IEEE80211_BAND_2GHZ) + clockrate = ATH9K_CLOCK_RATE_2GHZ_OFDM; +@@ -99,6 +102,13 @@ static void ath9k_hw_set_clockrate(struc + if (conf_is_ht40(conf)) + clockrate *= 2; + ++ if (ah->curchan) { ++ if (IS_CHAN_HALF_RATE(ah->curchan)) ++ clockrate /= 2; ++ if (IS_CHAN_QUARTER_RATE(ah->curchan)) ++ clockrate /= 4; ++ } ++ + common->clockrate = clockrate; + } + +@@ -895,6 +905,13 @@ static void ath9k_hw_init_interrupt_mask + } + } + ++static void ath9k_hw_set_sifs_time(struct ath_hw *ah, u32 us) ++{ ++ u32 val = ath9k_hw_mac_to_clks(ah, us - 2); ++ val = min(val, (u32) 0xFFFF); ++ REG_WRITE(ah, AR_D_GBL_IFS_SIFS, val); ++} ++ + static void ath9k_hw_setslottime(struct ath_hw *ah, u32 us) + { + u32 val = ath9k_hw_mac_to_clks(ah, us); +@@ -932,25 +949,60 @@ static bool ath9k_hw_set_global_txtimeou + + void ath9k_hw_init_global_settings(struct ath_hw *ah) + { +- struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf; ++ struct ath_common *common = ath9k_hw_common(ah); ++ struct ieee80211_conf *conf = &common->hw->conf; ++ const struct ath9k_channel *chan = ah->curchan; + int acktimeout; + int slottime; + int sifstime; ++ int rx_lat = 0, tx_lat = 0, eifs = 0; ++ u32 reg; + + ath_dbg(ath9k_hw_common(ah), ATH_DBG_RESET, "ah->misc_mode 0x%x\n", + ah->misc_mode); + ++ if (!chan) ++ return; ++ + if (ah->misc_mode != 0) + REG_SET_BIT(ah, AR_PCU_MISC, ah->misc_mode); + +- if (conf->channel && conf->channel->band == IEEE80211_BAND_5GHZ) +- sifstime = 16; +- else +- sifstime = 10; ++ rx_lat = 37; ++ tx_lat = 54; ++ ++ if (IS_CHAN_HALF_RATE(chan)) { ++ eifs = 175; ++ rx_lat *= 2; ++ tx_lat *= 2; ++ if (IS_CHAN_A_FAST_CLOCK(ah, chan)) ++ tx_lat += 11; ++ ++ slottime = 13; ++ sifstime = 32; ++ } else if (IS_CHAN_QUARTER_RATE(chan)) { ++ eifs = 340; ++ rx_lat *= 4; ++ tx_lat *= 4; ++ if (IS_CHAN_A_FAST_CLOCK(ah, chan)) ++ tx_lat += 22; ++ ++ slottime = 21; ++ sifstime = 64; ++ } else { ++ eifs = REG_READ(ah, AR_D_GBL_IFS_EIFS); ++ reg = REG_READ(ah, AR_USEC); ++ rx_lat = MS(reg, AR_USEC_RX_LAT); ++ tx_lat = MS(reg, AR_USEC_TX_LAT); ++ ++ slottime = ah->slottime; ++ if (IS_CHAN_5GHZ(chan)) ++ sifstime = 16; ++ else ++ sifstime = 10; ++ } + + /* As defined by IEEE 802.11-2007 17.3.8.6 */ +- slottime = ah->slottime + 3 * ah->coverage_class; +- acktimeout = slottime + sifstime; ++ acktimeout = slottime + sifstime + 3 * ah->coverage_class; + + /* + * Workaround for early ACK timeouts, add an offset to match the +@@ -962,11 +1014,20 @@ void ath9k_hw_init_global_settings(struc + if (conf->channel && conf->channel->band == IEEE80211_BAND_2GHZ) + acktimeout += 64 - sifstime - ah->slottime; + +- ath9k_hw_setslottime(ah, ah->slottime); ++ ath9k_hw_set_sifs_time(ah, sifstime); ++ ath9k_hw_setslottime(ah, slottime); + ath9k_hw_set_ack_timeout(ah, acktimeout); + ath9k_hw_set_cts_timeout(ah, acktimeout); + if (ah->globaltxtimeout != (u32) -1) + ath9k_hw_set_global_txtimeout(ah, ah->globaltxtimeout); ++ ++ REG_WRITE(ah, AR_D_GBL_IFS_EIFS, ath9k_hw_mac_to_clks(ah, eifs)); ++ REG_RMW(ah, AR_USEC, ++ (common->clockrate - 1) | ++ SM(rx_lat, AR_USEC_RX_LAT) | ++ SM(tx_lat, AR_USEC_TX_LAT), ++ AR_USEC_TX_LAT | AR_USEC_RX_LAT | AR_USEC_USEC); ++ + } + EXPORT_SYMBOL(ath9k_hw_init_global_settings); + +@@ -1570,9 +1631,13 @@ int ath9k_hw_reset(struct ath_hw *ah, st + + ath9k_hw_init_global_settings(ah); + +- if (!AR_SREV_9300_20_OR_LATER(ah)) { +- ar9002_hw_update_async_fifo(ah); +- ar9002_hw_enable_wep_aggregation(ah); ++ if (AR_SREV_9287(ah) && AR_SREV_9287_13_OR_LATER(ah)) { ++ REG_SET_BIT(ah, AR_MAC_PCU_LOGIC_ANALYZER, ++ AR_MAC_PCU_LOGIC_ANALYZER_DISBUG20768); ++ REG_RMW_FIELD(ah, AR_AHB_MODE, AR_AHB_CUSTOM_BURST_EN, ++ AR_AHB_CUSTOM_BURST_ASYNC_FIFO_VAL); ++ REG_SET_BIT(ah, AR_PCU_MISC_MODE2, ++ AR_PCU_MISC_MODE2_ENABLE_AGGWEP); + } + + REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PRESERVE_SEQNUM); +@@ -1932,12 +1997,22 @@ EXPORT_SYMBOL(ath9k_hw_set_sta_beacon_ti + /* HW Capabilities */ + /*******************/ + ++static u8 fixup_chainmask(u8 chip_chainmask, u8 eeprom_chainmask) ++{ ++ eeprom_chainmask &= chip_chainmask; ++ if (eeprom_chainmask) ++ return eeprom_chainmask; ++ else ++ return chip_chainmask; ++} ++ + int ath9k_hw_fill_cap_info(struct ath_hw *ah) + { + struct ath9k_hw_capabilities *pCap = &ah->caps; + struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); + struct ath_common *common = ath9k_hw_common(ah); + struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; ++ unsigned int chip_chainmask; + + u16 eeval; + u8 ant_div_ctl1, tx_chainmask, rx_chainmask; +@@ -1974,6 +2049,15 @@ int ath9k_hw_fill_cap_info(struct ath_hw + if (eeval & AR5416_OPFLAGS_11G) + pCap->hw_caps |= ATH9K_HW_CAP_2GHZ; + ++ if (AR_SREV_9485(ah) || AR_SREV_9285(ah) || AR_SREV_9330(ah)) ++ chip_chainmask = 1; ++ else if (!AR_SREV_9280_20_OR_LATER(ah)) ++ chip_chainmask = 7; ++ else if (!AR_SREV_9300_20_OR_LATER(ah) || AR_SREV_9340(ah)) ++ chip_chainmask = 3; ++ else ++ chip_chainmask = 7; ++ + pCap->tx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_TX_MASK); + /* + * For AR9271 we will temporarilly uses the rx chainmax as read from +@@ -1990,6 +2074,9 @@ int ath9k_hw_fill_cap_info(struct ath_hw + /* Use rx_chainmask from EEPROM. */ + pCap->rx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_RX_MASK); + ++ pCap->tx_chainmask = fixup_chainmask(chip_chainmask, pCap->tx_chainmask); ++ pCap->rx_chainmask = fixup_chainmask(chip_chainmask, pCap->rx_chainmask); ++ + ah->misc_mode |= AR_PCU_MIC_NEW_LOC_ENA; + + /* enable key search for every frame in an aggregate */ +@@ -2079,10 +2166,7 @@ int ath9k_hw_fill_cap_info(struct ath_hw + pCap->hw_caps |= ATH9K_HW_CAP_PAPRD; + } else { + pCap->tx_desc_len = sizeof(struct ath_desc); +- if (AR_SREV_9280_20(ah) && +- ((ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV) <= +- AR5416_EEP_MINOR_VER_16) || +- ah->eep_ops->get_eeprom(ah, EEP_FSTCLK_5G))) ++ if (AR_SREV_9280_20(ah)) + pCap->hw_caps |= ATH9K_HW_CAP_FASTCLOCK; + } + +--- a/drivers/net/wireless/ath/ath9k/hw.h ++++ b/drivers/net/wireless/ath/ath9k/hw.h +@@ -983,8 +983,6 @@ void ath9k_hw_get_delta_slope_vals(struc + void ar9002_hw_cck_chan14_spread(struct ath_hw *ah); + int ar9002_hw_rf_claim(struct ath_hw *ah); + void ar9002_hw_enable_async_fifo(struct ath_hw *ah); +-void ar9002_hw_update_async_fifo(struct ath_hw *ah); +-void ar9002_hw_enable_wep_aggregation(struct ath_hw *ah); + + /* + * Code specific to AR9003, we stuff these here to avoid callbacks +--- a/drivers/net/wireless/ath/ath9k/recv.c ++++ b/drivers/net/wireless/ath/ath9k/recv.c +@@ -814,16 +814,19 @@ static bool ath9k_rx_accept(struct ath_c + struct ath_rx_status *rx_stats, + bool *decrypt_error) + { +-#define is_mc_or_valid_tkip_keyix ((is_mc || \ +- (rx_stats->rs_keyix != ATH9K_RXKEYIX_INVALID && \ +- test_bit(rx_stats->rs_keyix, common->tkip_keymap)))) +- ++ bool is_mc, is_valid_tkip, strip_mic, mic_error = false; + struct ath_hw *ah = common->ah; + __le16 fc; + u8 rx_status_len = ah->caps.rx_status_len; + + fc = hdr->frame_control; + ++ is_mc = !!is_multicast_ether_addr(hdr->addr1); ++ is_valid_tkip = rx_stats->rs_keyix != ATH9K_RXKEYIX_INVALID && ++ test_bit(rx_stats->rs_keyix, common->tkip_keymap); ++ strip_mic = is_valid_tkip && !(rx_stats->rs_status & ++ (ATH9K_RXERR_DECRYPT | ATH9K_RXERR_CRC | ATH9K_RXERR_MIC)); ++ + if (!rx_stats->rs_datalen) + return false; + /* +@@ -838,6 +841,11 @@ static bool ath9k_rx_accept(struct ath_c + if (rx_stats->rs_more) + return true; + ++ mic_error = is_valid_tkip && !ieee80211_is_ctl(fc) && ++ !ieee80211_has_morefrags(fc) && ++ !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) && ++ (rx_stats->rs_status & ATH9K_RXERR_MIC); ++ + /* + * The rx_stats->rs_status will not be set until the end of the + * chained descriptors so it can be ignored if rs_more is set. The +@@ -845,30 +853,18 @@ static bool ath9k_rx_accept(struct ath_c + * descriptors. + */ + if (rx_stats->rs_status != 0) { +- if (rx_stats->rs_status & ATH9K_RXERR_CRC) ++ if (rx_stats->rs_status & ATH9K_RXERR_CRC) { + rxs->flag |= RX_FLAG_FAILED_FCS_CRC; ++ mic_error = false; ++ } + if (rx_stats->rs_status & ATH9K_RXERR_PHY) + return false; + + if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) { + *decrypt_error = true; +- } else if (rx_stats->rs_status & ATH9K_RXERR_MIC) { +- bool is_mc; +- /* +- * The MIC error bit is only valid if the frame +- * is not a control frame or fragment, and it was +- * decrypted using a valid TKIP key. +- */ +- is_mc = !!is_multicast_ether_addr(hdr->addr1); +- +- if (!ieee80211_is_ctl(fc) && +- !ieee80211_has_morefrags(fc) && +- !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) && +- is_mc_or_valid_tkip_keyix) +- rxs->flag |= RX_FLAG_MMIC_ERROR; +- else +- rx_stats->rs_status &= ~ATH9K_RXERR_MIC; ++ mic_error = false; + } ++ + /* + * Reject error frames with the exception of + * decryption and MIC failures. For monitor mode, +@@ -886,6 +882,18 @@ static bool ath9k_rx_accept(struct ath_c + } + } + } ++ ++ /* ++ * For unicast frames the MIC error bit can have false positives, ++ * so all MIC error reports need to be validated in software. ++ * False negatives are not common, so skip software verification ++ * if the hardware considers the MIC valid. ++ */ ++ if (strip_mic) ++ rxs->flag |= RX_FLAG_MMIC_STRIPPED; ++ else if (is_mc && mic_error) ++ rxs->flag |= RX_FLAG_MMIC_ERROR; ++ + return true; + } + +@@ -1938,6 +1946,9 @@ int ath_rx_tasklet(struct ath_softc *sc, + sc->rx.rxotherant = 0; + } + ++ if (rxs->flag & RX_FLAG_MMIC_STRIPPED) ++ skb_trim(skb, skb->len - 8); ++ + spin_lock_irqsave(&sc->sc_pm_lock, flags); + + if ((sc->ps_flags & (PS_WAIT_FOR_BEACON | +--- a/drivers/net/wireless/ath/ath9k/reg.h ++++ b/drivers/net/wireless/ath/ath9k/reg.h +@@ -600,7 +600,6 @@ + + #define AR_D_GBL_IFS_SIFS 0x1030 + #define AR_D_GBL_IFS_SIFS_M 0x0000FFFF +-#define AR_D_GBL_IFS_SIFS_ASYNC_FIFO_DUR 0x000003AB + #define AR_D_GBL_IFS_SIFS_RESV0 0xFFFFFFFF + + #define AR_D_TXBLK_BASE 0x1038 +@@ -616,12 +615,10 @@ + #define AR_D_GBL_IFS_SLOT 0x1070 + #define AR_D_GBL_IFS_SLOT_M 0x0000FFFF + #define AR_D_GBL_IFS_SLOT_RESV0 0xFFFF0000 +-#define AR_D_GBL_IFS_SLOT_ASYNC_FIFO_DUR 0x00000420 + + #define AR_D_GBL_IFS_EIFS 0x10b0 + #define AR_D_GBL_IFS_EIFS_M 0x0000FFFF + #define AR_D_GBL_IFS_EIFS_RESV0 0xFFFF0000 +-#define AR_D_GBL_IFS_EIFS_ASYNC_FIFO_DUR 0x0000A5EB + + #define AR_D_GBL_IFS_MISC 0x10f0 + #define AR_D_GBL_IFS_MISC_LFSR_SLICE_SEL 0x00000007 +@@ -1477,7 +1474,6 @@ enum { + #define AR_TIME_OUT_ACK_S 0 + #define AR_TIME_OUT_CTS 0x3FFF0000 + #define AR_TIME_OUT_CTS_S 16 +-#define AR_TIME_OUT_ACK_CTS_ASYNC_FIFO_DUR 0x16001D56 + + #define AR_RSSI_THR 0x8018 + #define AR_RSSI_THR_MASK 0x000000FF +@@ -1493,7 +1489,6 @@ enum { + #define AR_USEC_TX_LAT_S 14 + #define AR_USEC_RX_LAT 0x1F800000 + #define AR_USEC_RX_LAT_S 23 +-#define AR_USEC_ASYNC_FIFO_DUR 0x12e00074 + + #define AR_RESET_TSF 0x8020 + #define AR_RESET_TSF_ONCE 0x01000000 diff --git a/package/mac80211/patches/403-ath9k-fix-invalid-mac-address-handling.patch b/package/mac80211/patches/403-ath9k-fix-invalid-mac-address-handling.patch index 767f905a7fad..88038883b937 100644 --- a/package/mac80211/patches/403-ath9k-fix-invalid-mac-address-handling.patch +++ b/package/mac80211/patches/403-ath9k-fix-invalid-mac-address-handling.patch @@ -8,7 +8,7 @@ #include #include "hw.h" -@@ -443,8 +444,16 @@ static int ath9k_hw_init_macaddr(struct +@@ -453,8 +454,16 @@ static int ath9k_hw_init_macaddr(struct common->macaddr[2 * i] = eeval >> 8; common->macaddr[2 * i + 1] = eeval & 0xff; } diff --git a/package/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch b/package/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch index c3e56d3f1777..d93686c50d12 100644 --- a/package/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch +++ b/package/mac80211/patches/510-ath9k_intr_mitigation_tweak.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1591,8 +1591,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -1656,8 +1656,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st REG_WRITE(ah, AR_OBS, 8); if (ah->config.rx_intr_mitigation) { diff --git a/package/mac80211/patches/511-ath9k_increase_bcbuf.patch b/package/mac80211/patches/511-ath9k_increase_bcbuf.patch index d9e996a72b9e..0b829ec79f6c 100644 --- a/package/mac80211/patches/511-ath9k_increase_bcbuf.patch +++ b/package/mac80211/patches/511-ath9k_increase_bcbuf.patch @@ -11,7 +11,7 @@ #define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024) --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -364,8 +364,8 @@ static void ath9k_hw_init_config(struct +@@ -374,8 +374,8 @@ static void ath9k_hw_init_config(struct { int i; diff --git a/package/mac80211/patches/513-ath9k_channelbw_debugfs.patch b/package/mac80211/patches/513-ath9k_channelbw_debugfs.patch new file mode 100644 index 000000000000..28251eeef196 --- /dev/null +++ b/package/mac80211/patches/513-ath9k_channelbw_debugfs.patch @@ -0,0 +1,57 @@ +--- a/drivers/net/wireless/ath/ath9k/ath9k.h ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h +@@ -586,6 +586,7 @@ struct ath_softc { + struct ieee80211_hw *hw; + struct device *dev; + ++ u32 chan_bw; + int chan_idx; + int chan_is_ht; + struct survey_info *cur_survey; +--- a/drivers/net/wireless/ath/ath9k/debug.c ++++ b/drivers/net/wireless/ath/ath9k/debug.c +@@ -1281,6 +1281,9 @@ int ath9k_init_debug(struct ath_hw *ah) + debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, + &fops_eeprom); + ++ debugfs_create_u32("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, ++ &sc->chan_bw); ++ + sc->debug.regidx = 0; + return 0; + } +--- a/drivers/net/wireless/ath/ath9k/main.c ++++ b/drivers/net/wireless/ath/ath9k/main.c +@@ -226,6 +226,7 @@ static int ath_set_channel(struct ath_so + bool fastcc = true, stopped; + struct ieee80211_channel *channel = hw->conf.channel; + struct ath9k_hw_cal_data *caldata = NULL; ++ u32 oldflags; + int r; + + if (sc->sc_flags & SC_OP_INVALID) +@@ -268,6 +269,24 @@ static int ath_set_channel(struct ath_so + if (!stopped || !(sc->sc_flags & SC_OP_OFFCHANNEL)) + fastcc = false; + ++ oldflags = hchan->channelFlags; ++ switch (sc->chan_bw) { ++ case 5: ++ hchan->channelFlags &= ~CHANNEL_HALF; ++ hchan->channelFlags |= CHANNEL_QUARTER; ++ break; ++ case 10: ++ hchan->channelFlags &= ~CHANNEL_QUARTER; ++ hchan->channelFlags |= CHANNEL_HALF; ++ break; ++ default: ++ hchan->channelFlags &= ~(CHANNEL_HALF | CHANNEL_QUARTER); ++ break; ++ } ++ ++ if (oldflags != hchan->channelFlags) ++ fastcc = false; ++ + if (!(sc->sc_flags & SC_OP_OFFCHANNEL)) + caldata = &sc->caldata; + diff --git a/package/mac80211/patches/530-ath9k_noise_dbm_fixup.patch b/package/mac80211/patches/530-ath9k_noise_dbm_fixup.patch index 7e41b2cb63a3..4e9f38743dc6 100644 --- a/package/mac80211/patches/530-ath9k_noise_dbm_fixup.patch +++ b/package/mac80211/patches/530-ath9k_noise_dbm_fixup.patch @@ -38,7 +38,7 @@ --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1427,6 +1427,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -1488,6 +1488,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st memset(caldata, 0, sizeof(*caldata)); ath9k_init_nfcal_hist_buffer(ah, chan); } @@ -69,7 +69,7 @@ --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c -@@ -986,6 +986,8 @@ static int ath9k_rx_skb_preprocess(struc +@@ -994,6 +994,8 @@ static int ath9k_rx_skb_preprocess(struc struct ieee80211_rx_status *rx_status, bool *decrypt_error) { @@ -78,7 +78,7 @@ memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); /* -@@ -1006,7 +1008,7 @@ static int ath9k_rx_skb_preprocess(struc +@@ -1014,7 +1016,7 @@ static int ath9k_rx_skb_preprocess(struc rx_status->band = hw->conf.channel->band; rx_status->freq = hw->conf.channel->center_freq; diff --git a/package/mac80211/patches/540-ath9k_channelbw_debugfs.patch b/package/mac80211/patches/540-ath9k_channelbw_debugfs.patch deleted file mode 100644 index 28251eeef196..000000000000 --- a/package/mac80211/patches/540-ath9k_channelbw_debugfs.patch +++ /dev/null @@ -1,57 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/ath9k.h -+++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -586,6 +586,7 @@ struct ath_softc { - struct ieee80211_hw *hw; - struct device *dev; - -+ u32 chan_bw; - int chan_idx; - int chan_is_ht; - struct survey_info *cur_survey; ---- a/drivers/net/wireless/ath/ath9k/debug.c -+++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1281,6 +1281,9 @@ int ath9k_init_debug(struct ath_hw *ah) - debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, - &fops_eeprom); - -+ debugfs_create_u32("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, -+ &sc->chan_bw); -+ - sc->debug.regidx = 0; - return 0; - } ---- a/drivers/net/wireless/ath/ath9k/main.c -+++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -226,6 +226,7 @@ static int ath_set_channel(struct ath_so - bool fastcc = true, stopped; - struct ieee80211_channel *channel = hw->conf.channel; - struct ath9k_hw_cal_data *caldata = NULL; -+ u32 oldflags; - int r; - - if (sc->sc_flags & SC_OP_INVALID) -@@ -268,6 +269,24 @@ static int ath_set_channel(struct ath_so - if (!stopped || !(sc->sc_flags & SC_OP_OFFCHANNEL)) - fastcc = false; - -+ oldflags = hchan->channelFlags; -+ switch (sc->chan_bw) { -+ case 5: -+ hchan->channelFlags &= ~CHANNEL_HALF; -+ hchan->channelFlags |= CHANNEL_QUARTER; -+ break; -+ case 10: -+ hchan->channelFlags &= ~CHANNEL_QUARTER; -+ hchan->channelFlags |= CHANNEL_HALF; -+ break; -+ default: -+ hchan->channelFlags &= ~(CHANNEL_HALF | CHANNEL_QUARTER); -+ break; -+ } -+ -+ if (oldflags != hchan->channelFlags) -+ fastcc = false; -+ - if (!(sc->sc_flags & SC_OP_OFFCHANNEL)) - caldata = &sc->caldata; - diff --git a/package/mac80211/patches/540-ath9k_rx_stop.patch b/package/mac80211/patches/540-ath9k_rx_stop.patch new file mode 100644 index 000000000000..17c4c28e42a0 --- /dev/null +++ b/package/mac80211/patches/540-ath9k_rx_stop.patch @@ -0,0 +1,13 @@ +--- a/drivers/net/wireless/ath/ath9k/mac.c ++++ b/drivers/net/wireless/ath/ath9k/mac.c +@@ -737,7 +737,9 @@ bool ath9k_hw_stopdmarecv(struct ath_hw + + if (!AR_SREV_9300_20_OR_LATER(ah)) { + mac_status = REG_READ(ah, AR_DMADBG_7) & 0x7f0; +- if (mac_status == 0x1c0 && mac_status == last_mac_status) { ++ if (mac_status == last_mac_status && ++ (mac_status == 0x1c0 || ++ (AR_SREV_9100(ah) && mac_status == 0x020))) { + *reset = true; + break; + } diff --git a/package/mac80211/patches/541-ath9k_pllclock_fix.patch b/package/mac80211/patches/541-ath9k_pllclock_fix.patch deleted file mode 100644 index 4738159fd98f..000000000000 --- a/package/mac80211/patches/541-ath9k_pllclock_fix.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c -+++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c -@@ -447,26 +447,27 @@ static void ar9002_olc_init(struct ath_h - static u32 ar9002_hw_compute_pll_control(struct ath_hw *ah, - struct ath9k_channel *chan) - { -+ int ref_div = 5; -+ int pll_div = 0x2c; - u32 pll; - -- pll = SM(0x5, AR_RTC_9160_PLL_REFDIV); -+ if (chan && IS_CHAN_5GHZ(chan) && !IS_CHAN_A_FAST_CLOCK(ah, chan)) { -+ if (AR_SREV_9280_20(ah)) { -+ ref_div = 10; -+ pll_div = 0x50; -+ } else { -+ pll_div = 0x28; -+ } -+ } -+ -+ pll = SM(ref_div, AR_RTC_9160_PLL_REFDIV); -+ pll |= SM(pll_div, AR_RTC_9160_PLL_DIV); - - if (chan && IS_CHAN_HALF_RATE(chan)) - pll |= SM(0x1, AR_RTC_9160_PLL_CLKSEL); - else if (chan && IS_CHAN_QUARTER_RATE(chan)) - pll |= SM(0x2, AR_RTC_9160_PLL_CLKSEL); - -- if (chan && IS_CHAN_5GHZ(chan)) { -- if (IS_CHAN_A_FAST_CLOCK(ah, chan)) -- pll = 0x142c; -- else if (AR_SREV_9280_20(ah)) -- pll = 0x2850; -- else -- pll |= SM(0x28, AR_RTC_9160_PLL_DIV); -- } else { -- pll |= SM(0x2c, AR_RTC_9160_PLL_DIV); -- } -- - return pll; - } - diff --git a/package/mac80211/patches/542-ath9k_always_enable_fastclock.patch b/package/mac80211/patches/542-ath9k_always_enable_fastclock.patch deleted file mode 100644 index c3e4a98e9be2..000000000000 --- a/package/mac80211/patches/542-ath9k_always_enable_fastclock.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2089,10 +2089,7 @@ int ath9k_hw_fill_cap_info(struct ath_hw - pCap->hw_caps |= ATH9K_HW_CAP_PAPRD; - } else { - pCap->tx_desc_len = sizeof(struct ath_desc); -- if (AR_SREV_9280_20(ah) && -- ((ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV) <= -- AR5416_EEP_MINOR_VER_16) || -- ah->eep_ops->get_eeprom(ah, EEP_FSTCLK_5G))) -+ if (AR_SREV_9280_20(ah)) - pCap->hw_caps |= ATH9K_HW_CAP_FASTCLOCK; - } - diff --git a/package/mac80211/patches/543-ath9k_fix_mac_clock_div.patch b/package/mac80211/patches/543-ath9k_fix_mac_clock_div.patch deleted file mode 100644 index f76c54229fe8..000000000000 --- a/package/mac80211/patches/543-ath9k_fix_mac_clock_div.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -100,6 +100,13 @@ static void ath9k_hw_set_clockrate(struc - if (conf_is_ht40(conf)) - clockrate *= 2; - -+ if (ah->curchan) { -+ if (IS_CHAN_HALF_RATE(ah->curchan)) -+ clockrate /= 2; -+ if (IS_CHAN_QUARTER_RATE(ah->curchan)) -+ clockrate /= 4; -+ } -+ - common->clockrate = clockrate; - } - diff --git a/package/mac80211/patches/544-ath9k_fix_ar9287_mac_clock.patch b/package/mac80211/patches/544-ath9k_fix_ar9287_mac_clock.patch deleted file mode 100644 index f749f1d6286f..000000000000 --- a/package/mac80211/patches/544-ath9k_fix_ar9287_mac_clock.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -88,7 +88,10 @@ static void ath9k_hw_set_clockrate(struc - struct ath_common *common = ath9k_hw_common(ah); - unsigned int clockrate; - -- if (!ah->curchan) /* should really check for CCK instead */ -+ /* AR9287 v1.3+ uses async FIFO and runs the MAC at 117 MHz */ -+ if (AR_SREV_9287(ah) && AR_SREV_9287_13_OR_LATER(ah)) -+ clockrate = 117; -+ else if (!ah->curchan) /* should really check for CCK instead */ - clockrate = ATH9K_CLOCK_RATE_CCK; - else if (conf->channel->band == IEEE80211_BAND_2GHZ) - clockrate = ATH9K_CLOCK_RATE_2GHZ_OFDM; diff --git a/package/mac80211/patches/545-ath9k_timing_settings.patch b/package/mac80211/patches/545-ath9k_timing_settings.patch deleted file mode 100644 index d83b1508250a..000000000000 --- a/package/mac80211/patches/545-ath9k_timing_settings.patch +++ /dev/null @@ -1,106 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -914,6 +914,13 @@ static void ath9k_hw_init_interrupt_mask - } - } - -+static void ath9k_hw_set_sifs_time(struct ath_hw *ah, u32 us) -+{ -+ u32 val = ath9k_hw_mac_to_clks(ah, us - 2); -+ val = min(val, (u32) 0xFFFF); -+ REG_WRITE(ah, AR_D_GBL_IFS_SIFS, val); -+} -+ - static void ath9k_hw_setslottime(struct ath_hw *ah, u32 us) - { - u32 val = ath9k_hw_mac_to_clks(ah, us); -@@ -951,25 +958,60 @@ static bool ath9k_hw_set_global_txtimeou - - void ath9k_hw_init_global_settings(struct ath_hw *ah) - { -- struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf; -+ struct ath_common *common = ath9k_hw_common(ah); -+ struct ieee80211_conf *conf = &common->hw->conf; -+ const struct ath9k_channel *chan = ah->curchan; - int acktimeout; - int slottime; - int sifstime; -+ int rx_lat = 0, tx_lat = 0, eifs = 0; -+ u32 reg; - - ath_dbg(ath9k_hw_common(ah), ATH_DBG_RESET, "ah->misc_mode 0x%x\n", - ah->misc_mode); - -+ if (!chan) -+ return; -+ - if (ah->misc_mode != 0) - REG_SET_BIT(ah, AR_PCU_MISC, ah->misc_mode); - -- if (conf->channel && conf->channel->band == IEEE80211_BAND_5GHZ) -- sifstime = 16; -- else -- sifstime = 10; -+ rx_lat = 37; -+ tx_lat = 54; -+ -+ if (IS_CHAN_HALF_RATE(chan)) { -+ eifs = 175; -+ rx_lat *= 2; -+ tx_lat *= 2; -+ if (IS_CHAN_A_FAST_CLOCK(ah, chan)) -+ tx_lat += 11; -+ -+ slottime = 13; -+ sifstime = 32; -+ } else if (IS_CHAN_QUARTER_RATE(chan)) { -+ eifs = 340; -+ rx_lat *= 4; -+ tx_lat *= 4; -+ if (IS_CHAN_A_FAST_CLOCK(ah, chan)) -+ tx_lat += 22; -+ -+ slottime = 21; -+ sifstime = 64; -+ } else { -+ eifs = REG_READ(ah, AR_D_GBL_IFS_EIFS); -+ reg = REG_READ(ah, AR_USEC); -+ rx_lat = MS(reg, AR_USEC_RX_LAT); -+ tx_lat = MS(reg, AR_USEC_TX_LAT); -+ -+ slottime = ah->slottime; -+ if (IS_CHAN_5GHZ(chan)) -+ sifstime = 16; -+ else -+ sifstime = 10; -+ } - - /* As defined by IEEE 802.11-2007 17.3.8.6 */ -- slottime = ah->slottime + 3 * ah->coverage_class; -- acktimeout = slottime + sifstime; -+ acktimeout = slottime + sifstime + 3 * ah->coverage_class; - - /* - * Workaround for early ACK timeouts, add an offset to match the -@@ -981,11 +1023,20 @@ void ath9k_hw_init_global_settings(struc - if (conf->channel && conf->channel->band == IEEE80211_BAND_2GHZ) - acktimeout += 64 - sifstime - ah->slottime; - -- ath9k_hw_setslottime(ah, ah->slottime); -+ ath9k_hw_set_sifs_time(ah, sifstime); -+ ath9k_hw_setslottime(ah, slottime); - ath9k_hw_set_ack_timeout(ah, acktimeout); - ath9k_hw_set_cts_timeout(ah, acktimeout); - if (ah->globaltxtimeout != (u32) -1) - ath9k_hw_set_global_txtimeout(ah, ah->globaltxtimeout); -+ -+ REG_WRITE(ah, AR_D_GBL_IFS_EIFS, ath9k_hw_mac_to_clks(ah, eifs)); -+ REG_RMW(ah, AR_USEC, -+ (common->clockrate - 1) | -+ SM(rx_lat, AR_USEC_RX_LAT) | -+ SM(tx_lat, AR_USEC_TX_LAT), -+ AR_USEC_TX_LAT | AR_USEC_RX_LAT | AR_USEC_USEC); -+ - } - EXPORT_SYMBOL(ath9k_hw_init_global_settings); - diff --git a/package/mac80211/patches/546-ath9k_cleanup_ar9287_settings.patch b/package/mac80211/patches/546-ath9k_cleanup_ar9287_settings.patch deleted file mode 100644 index a160feed8b81..000000000000 --- a/package/mac80211/patches/546-ath9k_cleanup_ar9287_settings.patch +++ /dev/null @@ -1,117 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c -+++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c -@@ -499,45 +499,6 @@ void ar9002_hw_enable_async_fifo(struct - } - } - --/* -- * If Async FIFO is enabled, the following counters change as MAC now runs -- * at 117 Mhz instead of 88/44MHz when async FIFO is disabled. -- * -- * The values below tested for ht40 2 chain. -- * Overwrite the delay/timeouts initialized in process ini. -- */ --void ar9002_hw_update_async_fifo(struct ath_hw *ah) --{ -- if (AR_SREV_9287_13_OR_LATER(ah)) { -- REG_WRITE(ah, AR_D_GBL_IFS_SIFS, -- AR_D_GBL_IFS_SIFS_ASYNC_FIFO_DUR); -- REG_WRITE(ah, AR_D_GBL_IFS_SLOT, -- AR_D_GBL_IFS_SLOT_ASYNC_FIFO_DUR); -- REG_WRITE(ah, AR_D_GBL_IFS_EIFS, -- AR_D_GBL_IFS_EIFS_ASYNC_FIFO_DUR); -- -- REG_WRITE(ah, AR_TIME_OUT, AR_TIME_OUT_ACK_CTS_ASYNC_FIFO_DUR); -- REG_WRITE(ah, AR_USEC, AR_USEC_ASYNC_FIFO_DUR); -- -- REG_SET_BIT(ah, AR_MAC_PCU_LOGIC_ANALYZER, -- AR_MAC_PCU_LOGIC_ANALYZER_DISBUG20768); -- REG_RMW_FIELD(ah, AR_AHB_MODE, AR_AHB_CUSTOM_BURST_EN, -- AR_AHB_CUSTOM_BURST_ASYNC_FIFO_VAL); -- } --} -- --/* -- * We don't enable WEP aggregation on mac80211 but we keep this -- * around for HAL unification purposes. -- */ --void ar9002_hw_enable_wep_aggregation(struct ath_hw *ah) --{ -- if (AR_SREV_9287_13_OR_LATER(ah)) { -- REG_SET_BIT(ah, AR_PCU_MISC_MODE2, -- AR_PCU_MISC_MODE2_ENABLE_AGGWEP); -- } --} -- - /* Sets up the AR5008/AR9001/AR9002 hardware familiy callbacks */ - void ar9002_hw_attach_ops(struct ath_hw *ah) - { ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1641,9 +1641,13 @@ int ath9k_hw_reset(struct ath_hw *ah, st - - ath9k_hw_init_global_settings(ah); - -- if (!AR_SREV_9300_20_OR_LATER(ah)) { -- ar9002_hw_update_async_fifo(ah); -- ar9002_hw_enable_wep_aggregation(ah); -+ if (AR_SREV_9287(ah) && AR_SREV_9287_13_OR_LATER(ah)) { -+ REG_SET_BIT(ah, AR_MAC_PCU_LOGIC_ANALYZER, -+ AR_MAC_PCU_LOGIC_ANALYZER_DISBUG20768); -+ REG_RMW_FIELD(ah, AR_AHB_MODE, AR_AHB_CUSTOM_BURST_EN, -+ AR_AHB_CUSTOM_BURST_ASYNC_FIFO_VAL); -+ REG_SET_BIT(ah, AR_PCU_MISC_MODE2, -+ AR_PCU_MISC_MODE2_ENABLE_AGGWEP); - } - - REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PRESERVE_SEQNUM); ---- a/drivers/net/wireless/ath/ath9k/hw.h -+++ b/drivers/net/wireless/ath/ath9k/hw.h -@@ -984,8 +984,6 @@ void ath9k_hw_get_delta_slope_vals(struc - void ar9002_hw_cck_chan14_spread(struct ath_hw *ah); - int ar9002_hw_rf_claim(struct ath_hw *ah); - void ar9002_hw_enable_async_fifo(struct ath_hw *ah); --void ar9002_hw_update_async_fifo(struct ath_hw *ah); --void ar9002_hw_enable_wep_aggregation(struct ath_hw *ah); - - /* - * Code specific to AR9003, we stuff these here to avoid callbacks ---- a/drivers/net/wireless/ath/ath9k/reg.h -+++ b/drivers/net/wireless/ath/ath9k/reg.h -@@ -600,7 +600,6 @@ - - #define AR_D_GBL_IFS_SIFS 0x1030 - #define AR_D_GBL_IFS_SIFS_M 0x0000FFFF --#define AR_D_GBL_IFS_SIFS_ASYNC_FIFO_DUR 0x000003AB - #define AR_D_GBL_IFS_SIFS_RESV0 0xFFFFFFFF - - #define AR_D_TXBLK_BASE 0x1038 -@@ -616,12 +615,10 @@ - #define AR_D_GBL_IFS_SLOT 0x1070 - #define AR_D_GBL_IFS_SLOT_M 0x0000FFFF - #define AR_D_GBL_IFS_SLOT_RESV0 0xFFFF0000 --#define AR_D_GBL_IFS_SLOT_ASYNC_FIFO_DUR 0x00000420 - - #define AR_D_GBL_IFS_EIFS 0x10b0 - #define AR_D_GBL_IFS_EIFS_M 0x0000FFFF - #define AR_D_GBL_IFS_EIFS_RESV0 0xFFFF0000 --#define AR_D_GBL_IFS_EIFS_ASYNC_FIFO_DUR 0x0000A5EB - - #define AR_D_GBL_IFS_MISC 0x10f0 - #define AR_D_GBL_IFS_MISC_LFSR_SLICE_SEL 0x00000007 -@@ -1477,7 +1474,6 @@ enum { - #define AR_TIME_OUT_ACK_S 0 - #define AR_TIME_OUT_CTS 0x3FFF0000 - #define AR_TIME_OUT_CTS_S 16 --#define AR_TIME_OUT_ACK_CTS_ASYNC_FIFO_DUR 0x16001D56 - - #define AR_RSSI_THR 0x8018 - #define AR_RSSI_THR_MASK 0x000000FF -@@ -1493,7 +1489,6 @@ enum { - #define AR_USEC_TX_LAT_S 14 - #define AR_USEC_RX_LAT 0x1F800000 - #define AR_USEC_RX_LAT_S 23 --#define AR_USEC_ASYNC_FIFO_DUR 0x12e00074 - - #define AR_RESET_TSF 0x8020 - #define AR_RESET_TSF_ONCE 0x01000000 diff --git a/package/mac80211/patches/547-ath9k_half_quarter_set_channel_frac.patch b/package/mac80211/patches/547-ath9k_half_quarter_set_channel_frac.patch deleted file mode 100644 index cb215b8c615a..000000000000 --- a/package/mac80211/patches/547-ath9k_half_quarter_set_channel_frac.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c -+++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c -@@ -111,7 +111,9 @@ static int ar9002_hw_set_channel(struct - - switch (ah->eep_ops->get_eeprom(ah, EEP_FRAC_N_5G)) { - case 0: -- if ((freq % 20) == 0) -+ if (IS_CHAN_HALF_RATE(chan) || IS_CHAN_QUARTER_RATE(chan)) -+ aModeRefSel = 0; -+ else if ((freq % 20) == 0) - aModeRefSel = 3; - else if ((freq % 10) == 0) - aModeRefSel = 2; diff --git a/package/mac80211/patches/548-ath9k_half_quarter_synth_delay.patch b/package/mac80211/patches/548-ath9k_half_quarter_synth_delay.patch deleted file mode 100644 index 6429d1907620..000000000000 --- a/package/mac80211/patches/548-ath9k_half_quarter_synth_delay.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c -+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c -@@ -627,6 +627,11 @@ static void ar5008_hw_init_bb(struct ath - else - synthDelay /= 10; - -+ if (IS_CHAN_HALF_RATE(chan)) -+ synthDelay *= 2; -+ else if (IS_CHAN_QUARTER_RATE(chan)) -+ synthDelay *= 4; -+ - REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); - - udelay(synthDelay + BASE_ACTIVATE_DELAY); diff --git a/package/mac80211/patches/549-ath9k_shift_reg_delay.patch b/package/mac80211/patches/549-ath9k_shift_reg_delay.patch deleted file mode 100644 index 3676ae42af7a..000000000000 --- a/package/mac80211/patches/549-ath9k_shift_reg_delay.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c -+++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c -@@ -131,8 +131,9 @@ static int ar9002_hw_set_channel(struct - channelSel = CHANSEL_5G(freq); - - /* RefDivA setting */ -- REG_RMW_FIELD(ah, AR_AN_SYNTH9, -- AR_AN_SYNTH9_REFDIVA, refDivA); -+ ath9k_hw_analog_shift_rmw(ah, AR_AN_SYNTH9, -+ AR_AN_SYNTH9_REFDIVA, -+ AR_AN_SYNTH9_REFDIVA_S, refDivA); - - } - diff --git a/package/mac80211/patches/550-ath9k_mmic_verify.patch b/package/mac80211/patches/550-ath9k_mmic_verify.patch deleted file mode 100644 index a6b2502bf2d2..000000000000 --- a/package/mac80211/patches/550-ath9k_mmic_verify.patch +++ /dev/null @@ -1,103 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/recv.c -+++ b/drivers/net/wireless/ath/ath9k/recv.c -@@ -814,16 +814,19 @@ static bool ath9k_rx_accept(struct ath_c - struct ath_rx_status *rx_stats, - bool *decrypt_error) - { --#define is_mc_or_valid_tkip_keyix ((is_mc || \ -- (rx_stats->rs_keyix != ATH9K_RXKEYIX_INVALID && \ -- test_bit(rx_stats->rs_keyix, common->tkip_keymap)))) -- -+ bool is_mc, is_valid_tkip, strip_mic, mic_error = false; - struct ath_hw *ah = common->ah; - __le16 fc; - u8 rx_status_len = ah->caps.rx_status_len; - - fc = hdr->frame_control; - -+ is_mc = !!is_multicast_ether_addr(hdr->addr1); -+ is_valid_tkip = rx_stats->rs_keyix != ATH9K_RXKEYIX_INVALID && -+ test_bit(rx_stats->rs_keyix, common->tkip_keymap); -+ strip_mic = is_valid_tkip && !(rx_stats->rs_status & -+ (ATH9K_RXERR_DECRYPT | ATH9K_RXERR_CRC | ATH9K_RXERR_MIC)); -+ - if (!rx_stats->rs_datalen) - return false; - /* -@@ -838,6 +841,11 @@ static bool ath9k_rx_accept(struct ath_c - if (rx_stats->rs_more) - return true; - -+ mic_error = is_valid_tkip && !ieee80211_is_ctl(fc) && -+ !ieee80211_has_morefrags(fc) && -+ !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) && -+ (rx_stats->rs_status & ATH9K_RXERR_MIC); -+ - /* - * The rx_stats->rs_status will not be set until the end of the - * chained descriptors so it can be ignored if rs_more is set. The -@@ -845,30 +853,18 @@ static bool ath9k_rx_accept(struct ath_c - * descriptors. - */ - if (rx_stats->rs_status != 0) { -- if (rx_stats->rs_status & ATH9K_RXERR_CRC) -+ if (rx_stats->rs_status & ATH9K_RXERR_CRC) { - rxs->flag |= RX_FLAG_FAILED_FCS_CRC; -+ mic_error = false; -+ } - if (rx_stats->rs_status & ATH9K_RXERR_PHY) - return false; - - if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) { - *decrypt_error = true; -- } else if (rx_stats->rs_status & ATH9K_RXERR_MIC) { -- bool is_mc; -- /* -- * The MIC error bit is only valid if the frame -- * is not a control frame or fragment, and it was -- * decrypted using a valid TKIP key. -- */ -- is_mc = !!is_multicast_ether_addr(hdr->addr1); -- -- if (!ieee80211_is_ctl(fc) && -- !ieee80211_has_morefrags(fc) && -- !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) && -- is_mc_or_valid_tkip_keyix) -- rxs->flag |= RX_FLAG_MMIC_ERROR; -- else -- rx_stats->rs_status &= ~ATH9K_RXERR_MIC; -+ mic_error = false; - } -+ - /* - * Reject error frames with the exception of - * decryption and MIC failures. For monitor mode, -@@ -886,6 +882,18 @@ static bool ath9k_rx_accept(struct ath_c - } - } - } -+ -+ /* -+ * For unicast frames the MIC error bit can have false positives, -+ * so all MIC error reports need to be validated in software. -+ * False negatives are not common, so skip software verification -+ * if the hardware considers the MIC valid. -+ */ -+ if (strip_mic) -+ rxs->flag |= RX_FLAG_MMIC_STRIPPED; -+ else if (is_mc && mic_error) -+ rxs->flag |= RX_FLAG_MMIC_ERROR; -+ - return true; - } - -@@ -1940,6 +1948,9 @@ int ath_rx_tasklet(struct ath_softc *sc, - sc->rx.rxotherant = 0; - } - -+ if (rxs->flag & RX_FLAG_MMIC_STRIPPED) -+ skb_trim(skb, skb->len - 8); -+ - spin_lock_irqsave(&sc->sc_pm_lock, flags); - - if ((sc->ps_flags & (PS_WAIT_FOR_BEACON | diff --git a/package/mac80211/patches/550-mac80211_cur_txpower.patch b/package/mac80211/patches/550-mac80211_cur_txpower.patch new file mode 100644 index 000000000000..8e729c1a443d --- /dev/null +++ b/package/mac80211/patches/550-mac80211_cur_txpower.patch @@ -0,0 +1,32 @@ +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -779,7 +779,7 @@ enum ieee80211_smps_mode { + */ + struct ieee80211_conf { + u32 flags; +- int power_level, dynamic_ps_timeout; ++ int cur_power_level, power_level, dynamic_ps_timeout; + int max_sleep_period; + + u16 listen_interval; +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -1524,7 +1524,7 @@ static int ieee80211_get_tx_power(struct + { + struct ieee80211_local *local = wiphy_priv(wiphy); + +- *dbm = local->hw.conf.power_level; ++ *dbm = local->hw.conf.cur_power_level; + + return 0; + } +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -210,6 +210,7 @@ int ieee80211_hw_config(struct ieee80211 + + if (local->hw.conf.power_level != power) { + changed |= IEEE80211_CONF_CHANGE_POWER; ++ local->hw.conf.cur_power_level = power; + local->hw.conf.power_level = power; + } + diff --git a/package/mac80211/patches/551-ath9k_initialize_chainmask.patch b/package/mac80211/patches/551-ath9k_initialize_chainmask.patch new file mode 100644 index 000000000000..03f7c36a35f0 --- /dev/null +++ b/package/mac80211/patches/551-ath9k_initialize_chainmask.patch @@ -0,0 +1,13 @@ +--- a/drivers/net/wireless/ath/ath9k/init.c ++++ b/drivers/net/wireless/ath/ath9k/init.c +@@ -667,8 +667,10 @@ static void ath9k_init_band_txpower(stru + static void ath9k_init_txpower_limits(struct ath_softc *sc) + { + struct ath_hw *ah = sc->sc_ah; ++ struct ath_common *common = ath9k_hw_common(sc->sc_ah); + struct ath9k_channel *curchan = ah->curchan; + ++ ah->txchainmask = common->tx_chainmask; + if (ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) + ath9k_init_band_txpower(sc, IEEE80211_BAND_2GHZ); + if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) diff --git a/package/mac80211/patches/552-ath9k_remove_tx_indexoffset.patch b/package/mac80211/patches/552-ath9k_remove_tx_indexoffset.patch new file mode 100644 index 000000000000..c8e2640eec03 --- /dev/null +++ b/package/mac80211/patches/552-ath9k_remove_tx_indexoffset.patch @@ -0,0 +1,125 @@ +--- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c ++++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c +@@ -247,8 +247,7 @@ static u32 ath9k_hw_4k_get_eeprom(struct + } + + static void ath9k_hw_set_4k_power_cal_table(struct ath_hw *ah, +- struct ath9k_channel *chan, +- int16_t *pTxPowerIndexOffset) ++ struct ath9k_channel *chan) + { + struct ath_common *common = ath9k_hw_common(ah); + struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k; +@@ -358,8 +357,6 @@ static void ath9k_hw_set_4k_power_cal_ta + REGWRITE_BUFFER_FLUSH(ah); + } + } +- +- *pTxPowerIndexOffset = 0; + } + + static void ath9k_hw_set_4k_power_per_rate_table(struct ath_hw *ah, +@@ -582,7 +579,6 @@ static void ath9k_hw_4k_set_txpower(stru + struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k; + struct modal_eep_4k_header *pModal = &pEepData->modalHeader; + int16_t ratesArray[Ar5416RateSize]; +- int16_t txPowerIndexOffset = 0; + u8 ht40PowerIncForPdadc = 2; + int i; + +@@ -599,11 +595,10 @@ static void ath9k_hw_4k_set_txpower(stru + twiceMaxRegulatoryPower, + powerLimit); + +- ath9k_hw_set_4k_power_cal_table(ah, chan, &txPowerIndexOffset); ++ ath9k_hw_set_4k_power_cal_table(ah, chan); + + regulatory->max_power_level = 0; + for (i = 0; i < ARRAY_SIZE(ratesArray); i++) { +- ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]); + if (ratesArray[i] > MAX_RATE_POWER) + ratesArray[i] = MAX_RATE_POWER; + +--- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c ++++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c +@@ -306,8 +306,7 @@ static void ar9287_eeprom_olpc_set_pdadc + } + + static void ath9k_hw_set_ar9287_power_cal_table(struct ath_hw *ah, +- struct ath9k_channel *chan, +- int16_t *pTxPowerIndexOffset) ++ struct ath9k_channel *chan) + { + struct cal_data_per_freq_ar9287 *pRawDataset; + struct cal_data_op_loop_ar9287 *pRawDatasetOpenLoop; +@@ -446,8 +445,6 @@ static void ath9k_hw_set_ar9287_power_ca + REGWRITE_BUFFER_FLUSH(ah); + } + } +- +- *pTxPowerIndexOffset = 0; + } + + static void ath9k_hw_set_ar9287_power_per_rate_table(struct ath_hw *ah, +@@ -722,7 +719,6 @@ static void ath9k_hw_ar9287_set_txpower( + struct ar9287_eeprom *pEepData = &ah->eeprom.map9287; + struct modal_eep_ar9287_header *pModal = &pEepData->modalHeader; + int16_t ratesArray[Ar5416RateSize]; +- int16_t txPowerIndexOffset = 0; + u8 ht40PowerIncForPdadc = 2; + int i; + +@@ -738,11 +734,10 @@ static void ath9k_hw_ar9287_set_txpower( + twiceMaxRegulatoryPower, + powerLimit); + +- ath9k_hw_set_ar9287_power_cal_table(ah, chan, &txPowerIndexOffset); ++ ath9k_hw_set_ar9287_power_cal_table(ah, chan); + + regulatory->max_power_level = 0; + for (i = 0; i < ARRAY_SIZE(ratesArray); i++) { +- ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]); + if (ratesArray[i] > MAX_RATE_POWER) + ratesArray[i] = MAX_RATE_POWER; + +--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c ++++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c +@@ -692,8 +692,7 @@ static void ath9k_adjust_pdadc_values(st + } + + static void ath9k_hw_set_def_power_cal_table(struct ath_hw *ah, +- struct ath9k_channel *chan, +- int16_t *pTxPowerIndexOffset) ++ struct ath9k_channel *chan) + { + #define SM_PD_GAIN(x) SM(0x38, AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_##x) + #define SM_PDGAIN_B(x, y) \ +@@ -857,7 +856,6 @@ static void ath9k_hw_set_def_power_cal_t + } + } + +- *pTxPowerIndexOffset = 0; + #undef SM_PD_GAIN + #undef SM_PDGAIN_B + } +@@ -1145,7 +1143,6 @@ static void ath9k_hw_def_set_txpower(str + struct modal_eep_header *pModal = + &(pEepData->modalHeader[IS_CHAN_2GHZ(chan)]); + int16_t ratesArray[Ar5416RateSize]; +- int16_t txPowerIndexOffset = 0; + u8 ht40PowerIncForPdadc = 2; + int i, cck_ofdm_delta = 0; + +@@ -1162,11 +1159,10 @@ static void ath9k_hw_def_set_txpower(str + twiceMaxRegulatoryPower, + powerLimit); + +- ath9k_hw_set_def_power_cal_table(ah, chan, &txPowerIndexOffset); ++ ath9k_hw_set_def_power_cal_table(ah, chan); + + regulatory->max_power_level = 0; + for (i = 0; i < ARRAY_SIZE(ratesArray); i++) { +- ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]); + if (ratesArray[i] > MAX_RATE_POWER) + ratesArray[i] = MAX_RATE_POWER; + if (ratesArray[i] > regulatory->max_power_level) diff --git a/package/mac80211/patches/553-ath9k_fix_rate_power.patch b/package/mac80211/patches/553-ath9k_fix_rate_power.patch new file mode 100644 index 000000000000..fc79d5f9e2fa --- /dev/null +++ b/package/mac80211/patches/553-ath9k_fix_rate_power.patch @@ -0,0 +1,83 @@ +--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c ++++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +@@ -4922,25 +4922,7 @@ static void ath9k_hw_ar9300_set_txpower( + "TPC[%02d] 0x%08x\n", i, targetPowerValT2[i]); + } + +- /* +- * This is the TX power we send back to driver core, +- * and it can use to pass to userspace to display our +- * currently configured TX power setting. +- * +- * Since power is rate dependent, use one of the indices +- * from the AR9300_Rates enum to select an entry from +- * targetPowerValT2[] to report. Currently returns the +- * power for HT40 MCS 0, HT20 MCS 0, or OFDM 6 Mbps +- * as CCK power is less interesting (?). +- */ +- i = ALL_TARGET_LEGACY_6_24; /* legacy */ +- if (IS_CHAN_HT40(chan)) +- i = ALL_TARGET_HT40_0_8_16; /* ht40 */ +- else if (IS_CHAN_HT20(chan)) +- i = ALL_TARGET_HT20_0_8_16; /* ht20 */ +- +- ah->txpower_limit = targetPowerValT2[i]; +- regulatory->max_power_level = targetPowerValT2[i]; ++ ah->txpower_limit = regulatory->max_power_level; + + /* Write target power array to registers */ + ar9003_hw_tx_power_regwrite(ah, targetPowerValT2); +--- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c ++++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c +@@ -609,15 +609,6 @@ static void ath9k_hw_4k_set_txpower(stru + if (test) + return; + +- /* Update regulatory */ +- i = rate6mb; +- if (IS_CHAN_HT40(chan)) +- i = rateHt40_0; +- else if (IS_CHAN_HT20(chan)) +- i = rateHt20_0; +- +- regulatory->max_power_level = ratesArray[i]; +- + if (AR_SREV_9280_20_OR_LATER(ah)) { + for (i = 0; i < Ar5416RateSize; i++) + ratesArray[i] -= AR5416_PWR_TABLE_OFFSET_DB * 2; +--- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c ++++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c +@@ -748,13 +748,6 @@ static void ath9k_hw_ar9287_set_txpower( + if (test) + return; + +- if (IS_CHAN_2GHZ(chan)) +- i = rate1l; +- else +- i = rate6mb; +- +- regulatory->max_power_level = ratesArray[i]; +- + if (AR_SREV_9280_20_OR_LATER(ah)) { + for (i = 0; i < Ar5416RateSize; i++) + ratesArray[i] -= AR9287_PWR_TABLE_OFFSET_DB * 2; +--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c ++++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c +@@ -1169,17 +1169,6 @@ static void ath9k_hw_def_set_txpower(str + regulatory->max_power_level = ratesArray[i]; + } + +- if (!test) { +- i = rate6mb; +- +- if (IS_CHAN_HT40(chan)) +- i = rateHt40_0; +- else if (IS_CHAN_HT20(chan)) +- i = rateHt20_0; +- +- regulatory->max_power_level = ratesArray[i]; +- } +- + switch(ar5416_get_ntxchains(ah->txchainmask)) { + case 1: + break; diff --git a/package/mac80211/patches/554-ath9k_test_txpower.patch b/package/mac80211/patches/554-ath9k_test_txpower.patch new file mode 100644 index 000000000000..96131dc9d2db --- /dev/null +++ b/package/mac80211/patches/554-ath9k_test_txpower.patch @@ -0,0 +1,24 @@ +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -2442,15 +2442,18 @@ void ath9k_hw_set_txpowerlimit(struct at + struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); + struct ath9k_channel *chan = ah->curchan; + struct ieee80211_channel *channel = chan->chan; ++ int reg_pwr = min_t(int, MAX_RATE_POWER, regulatory->power_limit); ++ int chan_pwr = channel->max_power * 2; ++ ++ if (test) ++ reg_pwr = chan_pwr = MAX_RATE_POWER; + + regulatory->power_limit = min(limit, (u32) MAX_RATE_POWER); + + ah->eep_ops->set_txpower(ah, chan, + ath9k_regd_get_ctl(regulatory, chan), + channel->max_antenna_gain * 2, +- channel->max_power * 2, +- min((u32) MAX_RATE_POWER, +- (u32) regulatory->power_limit), test); ++ chan_pwr, reg_pwr, test); + } + EXPORT_SYMBOL(ath9k_hw_set_txpowerlimit); + diff --git a/package/mac80211/patches/555-ath9k_cur_txpower.patch b/package/mac80211/patches/555-ath9k_cur_txpower.patch new file mode 100644 index 000000000000..7bc92f13eb25 --- /dev/null +++ b/package/mac80211/patches/555-ath9k_cur_txpower.patch @@ -0,0 +1,35 @@ +--- a/drivers/net/wireless/ath/ath9k/main.c ++++ b/drivers/net/wireless/ath/ath9k/main.c +@@ -1727,6 +1727,8 @@ static int ath9k_config(struct ieee80211 + return -EINVAL; + } + ++ conf->cur_power_level = sc->curtxpow / 2; ++ + /* + * The most recent snapshot of channel->noisefloor for the old + * channel is only available after the hardware reset. Copy it to +@@ -1744,6 +1746,7 @@ static int ath9k_config(struct ieee80211 + ath9k_cmn_update_txpow(ah, sc->curtxpow, + sc->config.txpowlimit, &sc->curtxpow); + ath9k_ps_restore(sc); ++ conf->cur_power_level = sc->curtxpow / 2; + } + + if (disable_radio) { +--- a/drivers/net/wireless/ath/ath9k/common.c ++++ b/drivers/net/wireless/ath/ath9k/common.c +@@ -161,10 +161,12 @@ EXPORT_SYMBOL(ath9k_cmn_count_streams); + void ath9k_cmn_update_txpow(struct ath_hw *ah, u16 cur_txpow, + u16 new_txpow, u16 *txpower) + { ++ struct ath_regulatory *reg = ath9k_hw_regulatory(ah); ++ + if (cur_txpow != new_txpow) { + ath9k_hw_set_txpowerlimit(ah, new_txpow, false); + /* read back in case value is clamped */ +- *txpower = ath9k_hw_regulatory(ah)->power_limit; ++ *txpower = min_t(u16, reg->power_limit, reg->max_power_level); + } + } + EXPORT_SYMBOL(ath9k_cmn_update_txpow); diff --git a/package/mac80211/patches/560-ath9k_rx_stop.patch b/package/mac80211/patches/560-ath9k_rx_stop.patch deleted file mode 100644 index 17c4c28e42a0..000000000000 --- a/package/mac80211/patches/560-ath9k_rx_stop.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/mac.c -+++ b/drivers/net/wireless/ath/ath9k/mac.c -@@ -737,7 +737,9 @@ bool ath9k_hw_stopdmarecv(struct ath_hw - - if (!AR_SREV_9300_20_OR_LATER(ah)) { - mac_status = REG_READ(ah, AR_DMADBG_7) & 0x7f0; -- if (mac_status == 0x1c0 && mac_status == last_mac_status) { -+ if (mac_status == last_mac_status && -+ (mac_status == 0x1c0 || -+ (AR_SREV_9100(ah) && mac_status == 0x020))) { - *reset = true; - break; - } diff --git a/package/mac80211/patches/570-mac80211_agg_buf_size.patch b/package/mac80211/patches/570-mac80211_agg_buf_size.patch deleted file mode 100644 index e7efd7068f82..000000000000 --- a/package/mac80211/patches/570-mac80211_agg_buf_size.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/mac80211/agg-tx.c -+++ b/net/mac80211/agg-tx.c -@@ -814,7 +814,7 @@ void ieee80211_process_addba_resp(struct - * of at least 1. - */ - if (!buf_size) -- goto out; -+ buf_size = 1; - - if (test_and_set_bit(HT_AGG_STATE_RESPONSE_RECEIVED, - &tid_tx->state)) { diff --git a/package/mac80211/patches/580-ath9k_fixup_chainmask.patch b/package/mac80211/patches/580-ath9k_fixup_chainmask.patch deleted file mode 100644 index 07e78d3b30c9..000000000000 --- a/package/mac80211/patches/580-ath9k_fixup_chainmask.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2007,12 +2007,22 @@ EXPORT_SYMBOL(ath9k_hw_set_sta_beacon_ti - /* HW Capabilities */ - /*******************/ - -+static u8 fixup_chainmask(u8 chip_chainmask, u8 eeprom_chainmask) -+{ -+ eeprom_chainmask &= chip_chainmask; -+ if (eeprom_chainmask) -+ return eeprom_chainmask; -+ else -+ return chip_chainmask; -+} -+ - int ath9k_hw_fill_cap_info(struct ath_hw *ah) - { - struct ath9k_hw_capabilities *pCap = &ah->caps; - struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); - struct ath_common *common = ath9k_hw_common(ah); - struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; -+ unsigned int chip_chainmask; - - u16 eeval; - u8 ant_div_ctl1, tx_chainmask, rx_chainmask; -@@ -2049,6 +2059,15 @@ int ath9k_hw_fill_cap_info(struct ath_hw - if (eeval & AR5416_OPFLAGS_11G) - pCap->hw_caps |= ATH9K_HW_CAP_2GHZ; - -+ if (AR_SREV_9485(ah) || AR_SREV_9285(ah) || AR_SREV_9330(ah)) -+ chip_chainmask = 1; -+ else if (!AR_SREV_9280_20_OR_LATER(ah)) -+ chip_chainmask = 7; -+ else if (!AR_SREV_9300_20_OR_LATER(ah) || AR_SREV_9340(ah)) -+ chip_chainmask = 3; -+ else -+ chip_chainmask = 7; -+ - pCap->tx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_TX_MASK); - /* - * For AR9271 we will temporarilly uses the rx chainmax as read from -@@ -2065,6 +2084,9 @@ int ath9k_hw_fill_cap_info(struct ath_hw - /* Use rx_chainmask from EEPROM. */ - pCap->rx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_RX_MASK); - -+ pCap->tx_chainmask = fixup_chainmask(chip_chainmask, pCap->tx_chainmask); -+ pCap->rx_chainmask = fixup_chainmask(chip_chainmask, pCap->rx_chainmask); -+ - ah->misc_mode |= AR_PCU_MIC_NEW_LOC_ENA; - - /* enable key search for every frame in an aggregate */ diff --git a/package/mac80211/patches/590-mac80211_cur_txpower.patch b/package/mac80211/patches/590-mac80211_cur_txpower.patch deleted file mode 100644 index 8e729c1a443d..000000000000 --- a/package/mac80211/patches/590-mac80211_cur_txpower.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/include/net/mac80211.h -+++ b/include/net/mac80211.h -@@ -779,7 +779,7 @@ enum ieee80211_smps_mode { - */ - struct ieee80211_conf { - u32 flags; -- int power_level, dynamic_ps_timeout; -+ int cur_power_level, power_level, dynamic_ps_timeout; - int max_sleep_period; - - u16 listen_interval; ---- a/net/mac80211/cfg.c -+++ b/net/mac80211/cfg.c -@@ -1524,7 +1524,7 @@ static int ieee80211_get_tx_power(struct - { - struct ieee80211_local *local = wiphy_priv(wiphy); - -- *dbm = local->hw.conf.power_level; -+ *dbm = local->hw.conf.cur_power_level; - - return 0; - } ---- a/net/mac80211/main.c -+++ b/net/mac80211/main.c -@@ -210,6 +210,7 @@ int ieee80211_hw_config(struct ieee80211 - - if (local->hw.conf.power_level != power) { - changed |= IEEE80211_CONF_CHANGE_POWER; -+ local->hw.conf.cur_power_level = power; - local->hw.conf.power_level = power; - } - diff --git a/package/mac80211/patches/591-ath9k_initialize_chainmask.patch b/package/mac80211/patches/591-ath9k_initialize_chainmask.patch deleted file mode 100644 index 03f7c36a35f0..000000000000 --- a/package/mac80211/patches/591-ath9k_initialize_chainmask.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/init.c -+++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -667,8 +667,10 @@ static void ath9k_init_band_txpower(stru - static void ath9k_init_txpower_limits(struct ath_softc *sc) - { - struct ath_hw *ah = sc->sc_ah; -+ struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath9k_channel *curchan = ah->curchan; - -+ ah->txchainmask = common->tx_chainmask; - if (ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) - ath9k_init_band_txpower(sc, IEEE80211_BAND_2GHZ); - if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) diff --git a/package/mac80211/patches/592-ath9k_remove_tx_indexoffset.patch b/package/mac80211/patches/592-ath9k_remove_tx_indexoffset.patch deleted file mode 100644 index c8e2640eec03..000000000000 --- a/package/mac80211/patches/592-ath9k_remove_tx_indexoffset.patch +++ /dev/null @@ -1,125 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c -@@ -247,8 +247,7 @@ static u32 ath9k_hw_4k_get_eeprom(struct - } - - static void ath9k_hw_set_4k_power_cal_table(struct ath_hw *ah, -- struct ath9k_channel *chan, -- int16_t *pTxPowerIndexOffset) -+ struct ath9k_channel *chan) - { - struct ath_common *common = ath9k_hw_common(ah); - struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k; -@@ -358,8 +357,6 @@ static void ath9k_hw_set_4k_power_cal_ta - REGWRITE_BUFFER_FLUSH(ah); - } - } -- -- *pTxPowerIndexOffset = 0; - } - - static void ath9k_hw_set_4k_power_per_rate_table(struct ath_hw *ah, -@@ -582,7 +579,6 @@ static void ath9k_hw_4k_set_txpower(stru - struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k; - struct modal_eep_4k_header *pModal = &pEepData->modalHeader; - int16_t ratesArray[Ar5416RateSize]; -- int16_t txPowerIndexOffset = 0; - u8 ht40PowerIncForPdadc = 2; - int i; - -@@ -599,11 +595,10 @@ static void ath9k_hw_4k_set_txpower(stru - twiceMaxRegulatoryPower, - powerLimit); - -- ath9k_hw_set_4k_power_cal_table(ah, chan, &txPowerIndexOffset); -+ ath9k_hw_set_4k_power_cal_table(ah, chan); - - regulatory->max_power_level = 0; - for (i = 0; i < ARRAY_SIZE(ratesArray); i++) { -- ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]); - if (ratesArray[i] > MAX_RATE_POWER) - ratesArray[i] = MAX_RATE_POWER; - ---- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c -+++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c -@@ -306,8 +306,7 @@ static void ar9287_eeprom_olpc_set_pdadc - } - - static void ath9k_hw_set_ar9287_power_cal_table(struct ath_hw *ah, -- struct ath9k_channel *chan, -- int16_t *pTxPowerIndexOffset) -+ struct ath9k_channel *chan) - { - struct cal_data_per_freq_ar9287 *pRawDataset; - struct cal_data_op_loop_ar9287 *pRawDatasetOpenLoop; -@@ -446,8 +445,6 @@ static void ath9k_hw_set_ar9287_power_ca - REGWRITE_BUFFER_FLUSH(ah); - } - } -- -- *pTxPowerIndexOffset = 0; - } - - static void ath9k_hw_set_ar9287_power_per_rate_table(struct ath_hw *ah, -@@ -722,7 +719,6 @@ static void ath9k_hw_ar9287_set_txpower( - struct ar9287_eeprom *pEepData = &ah->eeprom.map9287; - struct modal_eep_ar9287_header *pModal = &pEepData->modalHeader; - int16_t ratesArray[Ar5416RateSize]; -- int16_t txPowerIndexOffset = 0; - u8 ht40PowerIncForPdadc = 2; - int i; - -@@ -738,11 +734,10 @@ static void ath9k_hw_ar9287_set_txpower( - twiceMaxRegulatoryPower, - powerLimit); - -- ath9k_hw_set_ar9287_power_cal_table(ah, chan, &txPowerIndexOffset); -+ ath9k_hw_set_ar9287_power_cal_table(ah, chan); - - regulatory->max_power_level = 0; - for (i = 0; i < ARRAY_SIZE(ratesArray); i++) { -- ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]); - if (ratesArray[i] > MAX_RATE_POWER) - ratesArray[i] = MAX_RATE_POWER; - ---- a/drivers/net/wireless/ath/ath9k/eeprom_def.c -+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c -@@ -692,8 +692,7 @@ static void ath9k_adjust_pdadc_values(st - } - - static void ath9k_hw_set_def_power_cal_table(struct ath_hw *ah, -- struct ath9k_channel *chan, -- int16_t *pTxPowerIndexOffset) -+ struct ath9k_channel *chan) - { - #define SM_PD_GAIN(x) SM(0x38, AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_##x) - #define SM_PDGAIN_B(x, y) \ -@@ -857,7 +856,6 @@ static void ath9k_hw_set_def_power_cal_t - } - } - -- *pTxPowerIndexOffset = 0; - #undef SM_PD_GAIN - #undef SM_PDGAIN_B - } -@@ -1145,7 +1143,6 @@ static void ath9k_hw_def_set_txpower(str - struct modal_eep_header *pModal = - &(pEepData->modalHeader[IS_CHAN_2GHZ(chan)]); - int16_t ratesArray[Ar5416RateSize]; -- int16_t txPowerIndexOffset = 0; - u8 ht40PowerIncForPdadc = 2; - int i, cck_ofdm_delta = 0; - -@@ -1162,11 +1159,10 @@ static void ath9k_hw_def_set_txpower(str - twiceMaxRegulatoryPower, - powerLimit); - -- ath9k_hw_set_def_power_cal_table(ah, chan, &txPowerIndexOffset); -+ ath9k_hw_set_def_power_cal_table(ah, chan); - - regulatory->max_power_level = 0; - for (i = 0; i < ARRAY_SIZE(ratesArray); i++) { -- ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]); - if (ratesArray[i] > MAX_RATE_POWER) - ratesArray[i] = MAX_RATE_POWER; - if (ratesArray[i] > regulatory->max_power_level) diff --git a/package/mac80211/patches/593-ath9k_fix_rate_power.patch b/package/mac80211/patches/593-ath9k_fix_rate_power.patch deleted file mode 100644 index fc79d5f9e2fa..000000000000 --- a/package/mac80211/patches/593-ath9k_fix_rate_power.patch +++ /dev/null @@ -1,83 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c -+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c -@@ -4922,25 +4922,7 @@ static void ath9k_hw_ar9300_set_txpower( - "TPC[%02d] 0x%08x\n", i, targetPowerValT2[i]); - } - -- /* -- * This is the TX power we send back to driver core, -- * and it can use to pass to userspace to display our -- * currently configured TX power setting. -- * -- * Since power is rate dependent, use one of the indices -- * from the AR9300_Rates enum to select an entry from -- * targetPowerValT2[] to report. Currently returns the -- * power for HT40 MCS 0, HT20 MCS 0, or OFDM 6 Mbps -- * as CCK power is less interesting (?). -- */ -- i = ALL_TARGET_LEGACY_6_24; /* legacy */ -- if (IS_CHAN_HT40(chan)) -- i = ALL_TARGET_HT40_0_8_16; /* ht40 */ -- else if (IS_CHAN_HT20(chan)) -- i = ALL_TARGET_HT20_0_8_16; /* ht20 */ -- -- ah->txpower_limit = targetPowerValT2[i]; -- regulatory->max_power_level = targetPowerValT2[i]; -+ ah->txpower_limit = regulatory->max_power_level; - - /* Write target power array to registers */ - ar9003_hw_tx_power_regwrite(ah, targetPowerValT2); ---- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c -+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c -@@ -609,15 +609,6 @@ static void ath9k_hw_4k_set_txpower(stru - if (test) - return; - -- /* Update regulatory */ -- i = rate6mb; -- if (IS_CHAN_HT40(chan)) -- i = rateHt40_0; -- else if (IS_CHAN_HT20(chan)) -- i = rateHt20_0; -- -- regulatory->max_power_level = ratesArray[i]; -- - if (AR_SREV_9280_20_OR_LATER(ah)) { - for (i = 0; i < Ar5416RateSize; i++) - ratesArray[i] -= AR5416_PWR_TABLE_OFFSET_DB * 2; ---- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c -+++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c -@@ -748,13 +748,6 @@ static void ath9k_hw_ar9287_set_txpower( - if (test) - return; - -- if (IS_CHAN_2GHZ(chan)) -- i = rate1l; -- else -- i = rate6mb; -- -- regulatory->max_power_level = ratesArray[i]; -- - if (AR_SREV_9280_20_OR_LATER(ah)) { - for (i = 0; i < Ar5416RateSize; i++) - ratesArray[i] -= AR9287_PWR_TABLE_OFFSET_DB * 2; ---- a/drivers/net/wireless/ath/ath9k/eeprom_def.c -+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c -@@ -1169,17 +1169,6 @@ static void ath9k_hw_def_set_txpower(str - regulatory->max_power_level = ratesArray[i]; - } - -- if (!test) { -- i = rate6mb; -- -- if (IS_CHAN_HT40(chan)) -- i = rateHt40_0; -- else if (IS_CHAN_HT20(chan)) -- i = rateHt20_0; -- -- regulatory->max_power_level = ratesArray[i]; -- } -- - switch(ar5416_get_ntxchains(ah->txchainmask)) { - case 1: - break; diff --git a/package/mac80211/patches/594-ath9k_test_txpower.patch b/package/mac80211/patches/594-ath9k_test_txpower.patch deleted file mode 100644 index 45a51be61e03..000000000000 --- a/package/mac80211/patches/594-ath9k_test_txpower.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2442,15 +2442,18 @@ void ath9k_hw_set_txpowerlimit(struct at - struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); - struct ath9k_channel *chan = ah->curchan; - struct ieee80211_channel *channel = chan->chan; -+ int reg_pwr = min_t(int, MAX_RATE_POWER, regulatory->power_limit); -+ int chan_pwr = channel->max_power * 2; -+ -+ if (test) -+ reg_pwr = chan_pwr = MAX_RATE_POWER; - - regulatory->power_limit = min(limit, (u32) MAX_RATE_POWER); - - ah->eep_ops->set_txpower(ah, chan, - ath9k_regd_get_ctl(regulatory, chan), - channel->max_antenna_gain * 2, -- channel->max_power * 2, -- min((u32) MAX_RATE_POWER, -- (u32) regulatory->power_limit), test); -+ chan_pwr, reg_pwr, test); - } - EXPORT_SYMBOL(ath9k_hw_set_txpowerlimit); - - diff --git a/package/mac80211/patches/595-ath9k_cur_txpower.patch b/package/mac80211/patches/595-ath9k_cur_txpower.patch deleted file mode 100644 index 7bc92f13eb25..000000000000 --- a/package/mac80211/patches/595-ath9k_cur_txpower.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/main.c -+++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -1727,6 +1727,8 @@ static int ath9k_config(struct ieee80211 - return -EINVAL; - } - -+ conf->cur_power_level = sc->curtxpow / 2; -+ - /* - * The most recent snapshot of channel->noisefloor for the old - * channel is only available after the hardware reset. Copy it to -@@ -1744,6 +1746,7 @@ static int ath9k_config(struct ieee80211 - ath9k_cmn_update_txpow(ah, sc->curtxpow, - sc->config.txpowlimit, &sc->curtxpow); - ath9k_ps_restore(sc); -+ conf->cur_power_level = sc->curtxpow / 2; - } - - if (disable_radio) { ---- a/drivers/net/wireless/ath/ath9k/common.c -+++ b/drivers/net/wireless/ath/ath9k/common.c -@@ -161,10 +161,12 @@ EXPORT_SYMBOL(ath9k_cmn_count_streams); - void ath9k_cmn_update_txpow(struct ath_hw *ah, u16 cur_txpow, - u16 new_txpow, u16 *txpower) - { -+ struct ath_regulatory *reg = ath9k_hw_regulatory(ah); -+ - if (cur_txpow != new_txpow) { - ath9k_hw_set_txpowerlimit(ah, new_txpow, false); - /* read back in case value is clamped */ -- *txpower = ath9k_hw_regulatory(ah)->power_limit; -+ *txpower = min_t(u16, reg->power_limit, reg->max_power_level); - } - } - EXPORT_SYMBOL(ath9k_cmn_update_txpow); diff --git a/package/mac80211/patches/820-b43-backport.patch b/package/mac80211/patches/820-b43-backport.patch index ec3b1440cd83..3dbf9367fff8 100644 --- a/package/mac80211/patches/820-b43-backport.patch +++ b/package/mac80211/patches/820-b43-backport.patch @@ -309,7 +309,7 @@ #endif /* B43_BUS_H_ */ --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c -@@ -174,7 +174,7 @@ static void op64_fill_descriptor(struct +@@ -174,7 +174,7 @@ static void op64_fill_descriptor(struct addrhi = (((u64) dmaaddr >> 32) & ~SSB_DMA_TRANSLATION_MASK); addrext = (((u64) dmaaddr >> 32) & SSB_DMA_TRANSLATION_MASK) >> SSB_DMA_TRANSLATION_SHIFT; diff --git a/package/mac80211/patches/850-b43-add-core-rev-17-used-on-bcma-SoC.patch b/package/mac80211/patches/850-b43-add-core-rev-17-used-on-bcma-SoC.patch index 24a38b596d69..91a836459b77 100644 --- a/package/mac80211/patches/850-b43-add-core-rev-17-used-on-bcma-SoC.patch +++ b/package/mac80211/patches/850-b43-add-core-rev-17-used-on-bcma-SoC.patch @@ -11,7 +11,7 @@ Signed-off-by: Hauke Mehrtens --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c -@@ -120,6 +120,7 @@ MODULE_PARM_DESC(pio, "Use PIO accesses +@@ -120,6 +120,7 @@ MODULE_PARM_DESC(pio, "Use PIO accesses #ifdef CONFIG_B43_BCMA static const struct bcma_device_id b43_bcma_tbl[] = {