source: branches/backfire/package/mac80211/patches/580-ath9k_fixup_chainmask.patch @ 27690

Last change on this file since 27690 was 27690, checked in by nbd, 5 years ago

ath9k: validate eeprom chainmask settings, some Ubiquiti devices (and maybe others) contain bogus data, which breaks wifi (backport of r27688)

File size: 1.7 KB
  • drivers/net/wireless/ath/ath9k/hw.c

    a b EXPORT_SYMBOL(ath9k_hw_set_sta_beacon_ti 
    20072007/* HW Capabilities */ 
    20082008/*******************/ 
    20092009 
     2010static u8 fixup_chainmask(u8 chip_chainmask, u8 eeprom_chainmask) 
     2011{ 
     2012        eeprom_chainmask &= chip_chainmask; 
     2013        if (eeprom_chainmask) 
     2014                return eeprom_chainmask; 
     2015        else 
     2016                return chip_chainmask; 
     2017} 
     2018 
    20102019int ath9k_hw_fill_cap_info(struct ath_hw *ah) 
    20112020{ 
    20122021        struct ath9k_hw_capabilities *pCap = &ah->caps; 
    20132022        struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); 
    20142023        struct ath_common *common = ath9k_hw_common(ah); 
    20152024        struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; 
     2025        unsigned int chip_chainmask; 
    20162026 
    20172027        u16 eeval; 
    20182028        u8 ant_div_ctl1, tx_chainmask, rx_chainmask; 
    int ath9k_hw_fill_cap_info(struct ath_hw 
    20492059        if (eeval & AR5416_OPFLAGS_11G) 
    20502060                pCap->hw_caps |= ATH9K_HW_CAP_2GHZ; 
    20512061 
     2062        if (AR_SREV_9485(ah) || AR_SREV_9285(ah) || AR_SREV_9330(ah)) 
     2063                chip_chainmask = 1; 
     2064        else if (!AR_SREV_9280_20_OR_LATER(ah)) 
     2065                chip_chainmask = 7; 
     2066        else if (!AR_SREV_9300_20_OR_LATER(ah) || AR_SREV_9340(ah)) 
     2067                chip_chainmask = 3; 
     2068        else 
     2069                chip_chainmask = 7; 
     2070 
    20522071        pCap->tx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_TX_MASK); 
    20532072        /* 
    20542073         * For AR9271 we will temporarilly uses the rx chainmax as read from 
    int ath9k_hw_fill_cap_info(struct ath_hw 
    20652084                /* Use rx_chainmask from EEPROM. */ 
    20662085                pCap->rx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_RX_MASK); 
    20672086 
     2087        pCap->tx_chainmask = fixup_chainmask(chip_chainmask, pCap->tx_chainmask); 
     2088        pCap->rx_chainmask = fixup_chainmask(chip_chainmask, pCap->rx_chainmask); 
     2089 
    20682090        ah->misc_mode |= AR_PCU_MIC_NEW_LOC_ENA; 
    20692091 
    20702092        /* enable key search for every frame in an aggregate */ 
Note: See TracBrowser for help on using the repository browser.