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

ath9k: Add QCA956x HW support

Signed-off-by: Miaoqing Pan <miaoqing@qca.qualcomm.com>
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

authored by

Miaoqing Pan and committed by
Kalle Valo
ede6a5e7 df476df1

+76 -32
+2 -1
drivers/net/wireless/ath/ath9k/ani.c
··· 259 259 entry_cck->fir_step_level); 260 260 261 261 /* Skip MRC CCK for pre AR9003 families */ 262 - if (!AR_SREV_9300_20_OR_LATER(ah) || AR_SREV_9485(ah) || AR_SREV_9565(ah)) 262 + if (!AR_SREV_9300_20_OR_LATER(ah) || AR_SREV_9485(ah) || 263 + AR_SREV_9565(ah) || AR_SREV_9561(ah)) 263 264 return; 264 265 265 266 if (aniState->mrcCCK != entry_cck->mrc_cck_on)
+10 -5
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
··· 3536 3536 int bias = ar9003_modal_header(ah, is2ghz)->xpaBiasLvl; 3537 3537 3538 3538 if (AR_SREV_9485(ah) || AR_SREV_9330(ah) || AR_SREV_9340(ah) || 3539 - AR_SREV_9531(ah)) 3539 + AR_SREV_9531(ah) || AR_SREV_9561(ah)) 3540 3540 REG_RMW_FIELD(ah, AR_CH0_TOP2, AR_CH0_TOP2_XPABIASLVL, bias); 3541 3541 else if (AR_SREV_9462(ah) || AR_SREV_9550(ah) || AR_SREV_9565(ah)) 3542 3542 REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, bias); ··· 3599 3599 if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) { 3600 3600 REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM, 3601 3601 AR_SWITCH_TABLE_COM_AR9462_ALL, value); 3602 - } else if (AR_SREV_9550(ah) || AR_SREV_9531(ah)) { 3602 + } else if (AR_SREV_9550(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah)) { 3603 3603 REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM, 3604 3604 AR_SWITCH_TABLE_COM_AR9550_ALL, value); 3605 3605 } else ··· 3929 3929 REG_WRITE(ah, AR_PHY_PMU2, reg_pmu_set); 3930 3930 if (!is_pmu_set(ah, AR_PHY_PMU2, reg_pmu_set)) 3931 3931 return; 3932 - } else if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) { 3932 + } else if (AR_SREV_9462(ah) || AR_SREV_9565(ah) || 3933 + AR_SREV_9561(ah)) { 3933 3934 reg_val = le32_to_cpu(pBase->swreg); 3934 3935 REG_WRITE(ah, AR_PHY_PMU1, reg_val); 3936 + 3937 + if (AR_SREV_9561(ah)) 3938 + REG_WRITE(ah, AR_PHY_PMU2, 0x10200000); 3935 3939 } else { 3936 3940 /* Internal regulator is ON. Write swreg register. */ 3937 3941 reg_val = le32_to_cpu(pBase->swreg); ··· 4038 4034 if (!AR_SREV_9300(ah) && 4039 4035 !AR_SREV_9340(ah) && 4040 4036 !AR_SREV_9580(ah) && 4041 - !AR_SREV_9531(ah)) 4037 + !AR_SREV_9531(ah) && 4038 + !AR_SREV_9561(ah)) 4042 4039 return; 4043 4040 4044 4041 xpa_ctl = ar9003_modal_header(ah, is2ghz)->txFrameToXpaOn; ··· 4817 4812 } 4818 4813 4819 4814 tempslope: 4820 - if (AR_SREV_9550(ah) || AR_SREV_9531(ah)) { 4815 + if (AR_SREV_9550(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah)) { 4821 4816 u8 txmask = (eep->baseEepHeader.txrxMask & 0xf0) >> 4; 4822 4817 4823 4818 /*
+37 -10
drivers/net/wireless/ath/ath9k/ar9003_phy.c
··· 183 183 } else { 184 184 channelSel = CHANSEL_2G(freq) >> 1; 185 185 } 186 - } else if (AR_SREV_9550(ah) || AR_SREV_9531(ah)) { 186 + } else if (AR_SREV_9550(ah) || AR_SREV_9531(ah) || 187 + AR_SREV_9561(ah)) { 187 188 if (ah->is_clk_25mhz) 188 189 div = 75; 189 190 else ··· 199 198 /* Set to 2G mode */ 200 199 bMode = 1; 201 200 } else { 202 - if ((AR_SREV_9340(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah)) && 201 + if ((AR_SREV_9340(ah) || AR_SREV_9550(ah) || 202 + AR_SREV_9531(ah) || AR_SREV_9561(ah)) && 203 203 ah->is_clk_25mhz) { 204 204 channelSel = freq / 75; 205 205 chan_frac = ((freq % 75) * 0x20000) / 75; ··· 267 265 */ 268 266 269 267 if (AR_SREV_9485(ah) || AR_SREV_9340(ah) || AR_SREV_9330(ah) || 270 - AR_SREV_9550(ah)) { 268 + AR_SREV_9550(ah) || AR_SREV_9561(ah)) { 271 269 if (spur_fbin_ptr[0] == 0) /* No spur */ 272 270 return; 273 271 max_spur_cnts = 5; ··· 294 292 295 293 negative = 0; 296 294 if (AR_SREV_9485(ah) || AR_SREV_9340(ah) || AR_SREV_9330(ah) || 297 - AR_SREV_9550(ah)) 295 + AR_SREV_9550(ah) || AR_SREV_9561(ah)) 298 296 cur_bb_spur = ath9k_hw_fbin2freq(spur_fbin_ptr[i], 299 297 IS_CHAN_2GHZ(chan)); 300 298 else ··· 643 641 (REG_READ(ah, AR_PHY_GEN_CTRL) & AR_PHY_GC_ENABLE_DAC_FIFO); 644 642 645 643 /* Enable 11n HT, 20 MHz */ 646 - phymode = AR_PHY_GC_HT_EN | AR_PHY_GC_SINGLE_HT_LTF1 | 647 - AR_PHY_GC_SHORT_GI_40 | enableDacFifo; 644 + phymode = AR_PHY_GC_HT_EN | AR_PHY_GC_SHORT_GI_40 | enableDacFifo; 645 + 646 + if (!AR_SREV_9561(ah)) 647 + phymode |= AR_PHY_GC_SINGLE_HT_LTF1; 648 648 649 649 /* Configure baseband for dynamic 20/40 operation */ 650 650 if (IS_CHAN_HT40(chan)) { ··· 749 745 else 750 746 ah->enabled_cals &= ~TX_CL_CAL; 751 747 752 - if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9550(ah)) { 748 + if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9550(ah) || 749 + AR_SREV_9561(ah)) { 753 750 if (ah->is_clk_25mhz) { 754 751 REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1); 755 752 REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7); ··· 815 810 ret++; 816 811 817 812 return ret; 813 + } 814 + 815 + static int ar9561_hw_get_modes_txgain_index(struct ath_hw *ah, 816 + struct ath9k_channel *chan) 817 + { 818 + if (IS_CHAN_2GHZ(chan)) { 819 + if (IS_CHAN_HT40(chan)) 820 + return 1; 821 + else 822 + return 2; 823 + } 824 + 825 + return 0; 818 826 } 819 827 820 828 static void ar9003_doubler_fix(struct ath_hw *ah) ··· 929 911 REG_WRITE_ARRAY(&ah->ini_modes_rxgain_5g_xlna, 930 912 modesIndex, regWrites); 931 913 } 914 + 915 + if (AR_SREV_9561(ah) && (ar9003_hw_get_rx_gain_idx(ah) == 0)) 916 + REG_WRITE_ARRAY(&ah->ini_modes_rxgain_5g_xlna, 917 + modesIndex, regWrites); 932 918 } 933 919 934 - if (AR_SREV_9550(ah)) 920 + if (AR_SREV_9550(ah) || AR_SREV_9561(ah)) 935 921 REG_WRITE_ARRAY(&ah->ini_modes_rx_gain_bounds, modesIndex, 936 922 regWrites); 937 923 938 924 /* 939 925 * TXGAIN initvals. 940 926 */ 941 - if (AR_SREV_9550(ah) || AR_SREV_9531(ah)) { 927 + if (AR_SREV_9550(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah)) { 942 928 int modes_txgain_index = 1; 943 929 944 930 if (AR_SREV_9550(ah)) 945 931 modes_txgain_index = ar9550_hw_get_modes_txgain_index(ah, chan); 932 + 933 + if (AR_SREV_9561(ah)) 934 + modes_txgain_index = 935 + ar9561_hw_get_modes_txgain_index(ah, chan); 946 936 947 937 if (modes_txgain_index < 0) 948 938 return -EINVAL; ··· 2015 1989 priv_ops->rf_set_freq = ar9003_hw_set_channel; 2016 1990 priv_ops->spur_mitigate_freq = ar9003_hw_spur_mitigate; 2017 1991 2018 - if (AR_SREV_9340(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah)) 1992 + if (AR_SREV_9340(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah) || 1993 + AR_SREV_9561(ah)) 2019 1994 priv_ops->compute_pll_control = ar9003_hw_compute_pll_control_soc; 2020 1995 else 2021 1996 priv_ops->compute_pll_control = ar9003_hw_compute_pll_control;
+23 -14
drivers/net/wireless/ath/ath9k/hw.c
··· 783 783 /* program BB PLL phase_shift */ 784 784 REG_RMW_FIELD(ah, AR_CH0_BB_DPLL3, 785 785 AR_CH0_BB_DPLL3_PHASE_SHIFT, 0x1); 786 - } else if (AR_SREV_9340(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah)) { 786 + } else if (AR_SREV_9340(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah) || 787 + AR_SREV_9561(ah)) { 787 788 u32 regval, pll2_divint, pll2_divfrac, refdiv; 788 789 789 790 REG_WRITE(ah, AR_RTC_PLL_CONTROL, ··· 795 794 udelay(100); 796 795 797 796 if (ah->is_clk_25mhz) { 798 - if (AR_SREV_9531(ah)) { 797 + if (AR_SREV_9531(ah) || AR_SREV_9561(ah)) { 799 798 pll2_divint = 0x1c; 800 799 pll2_divfrac = 0xa3d2; 801 800 refdiv = 1; ··· 811 810 refdiv = 5; 812 811 } else { 813 812 pll2_divint = 0x11; 814 - pll2_divfrac = 815 - AR_SREV_9531(ah) ? 0x26665 : 0x26666; 813 + pll2_divfrac = (AR_SREV_9531(ah) || 814 + AR_SREV_9561(ah)) ? 815 + 0x26665 : 0x26666; 816 816 refdiv = 1; 817 817 } 818 818 } 819 819 820 820 regval = REG_READ(ah, AR_PHY_PLL_MODE); 821 - if (AR_SREV_9531(ah)) 821 + if (AR_SREV_9531(ah) || AR_SREV_9561(ah)) 822 822 regval |= (0x1 << 22); 823 823 else 824 824 regval |= (0x1 << 16); ··· 837 835 (0x1 << 13) | 838 836 (0x4 << 26) | 839 837 (0x18 << 19); 840 - else if (AR_SREV_9531(ah)) 838 + else if (AR_SREV_9531(ah) || AR_SREV_9561(ah)) { 841 839 regval = (regval & 0x01c00fff) | 842 840 (0x1 << 31) | 843 841 (0x2 << 29) | 844 842 (0xa << 25) | 845 - (0x1 << 19) | 846 - (0x6 << 12); 847 - else 843 + (0x1 << 19); 844 + 845 + if (AR_SREV_9531(ah)) 846 + regval |= (0x6 << 12); 847 + } else 848 848 regval = (regval & 0x80071fff) | 849 849 (0x3 << 30) | 850 850 (0x1 << 13) | ··· 854 850 (0x60 << 19); 855 851 REG_WRITE(ah, AR_PHY_PLL_MODE, regval); 856 852 857 - if (AR_SREV_9531(ah)) 853 + if (AR_SREV_9531(ah) || AR_SREV_9561(ah)) 858 854 REG_WRITE(ah, AR_PHY_PLL_MODE, 859 855 REG_READ(ah, AR_PHY_PLL_MODE) & 0xffbfffff); 860 856 else ··· 893 889 AR_IMR_RXORN | 894 890 AR_IMR_BCNMISC; 895 891 896 - if (AR_SREV_9340(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah)) 892 + if (AR_SREV_9340(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah) || 893 + AR_SREV_9561(ah)) 897 894 sync_default &= ~AR_INTR_SYNC_HOST1_FATAL; 898 895 899 896 if (AR_SREV_9300_20_OR_LATER(ah)) { ··· 1683 1678 } 1684 1679 #ifdef __BIG_ENDIAN 1685 1680 else if (AR_SREV_9330(ah) || AR_SREV_9340(ah) || 1686 - AR_SREV_9550(ah) || AR_SREV_9531(ah)) 1681 + AR_SREV_9550(ah) || AR_SREV_9531(ah) || 1682 + AR_SREV_9561(ah)) 1687 1683 REG_RMW(ah, AR_CFG, AR_CFG_SWRB | AR_CFG_SWTB, 0); 1688 1684 else 1689 1685 REG_WRITE(ah, AR_CFG, AR_CFG_SWTD | AR_CFG_SWRD); ··· 2472 2466 2473 2467 if (AR_SREV_9300_20_OR_LATER(ah)) { 2474 2468 pCap->hw_caps |= ATH9K_HW_CAP_EDMA | ATH9K_HW_CAP_FASTCLOCK; 2475 - if (!AR_SREV_9330(ah) && !AR_SREV_9485(ah) && !AR_SREV_9565(ah)) 2469 + if (!AR_SREV_9330(ah) && !AR_SREV_9485(ah) && 2470 + !AR_SREV_9561(ah) && !AR_SREV_9565(ah)) 2476 2471 pCap->hw_caps |= ATH9K_HW_CAP_LDPC; 2477 2472 2478 2473 pCap->rx_hp_qdepth = ATH9K_HW_RX_HP_QDEPTH; ··· 2490 2483 if (AR_SREV_9300_20_OR_LATER(ah)) 2491 2484 pCap->hw_caps |= ATH9K_HW_CAP_RAC_SUPPORTED; 2492 2485 2493 - if (AR_SREV_9300_20_OR_LATER(ah)) 2486 + if (AR_SREV_9561(ah)) 2487 + ah->ent_mode = 0x3BDA000; 2488 + else if (AR_SREV_9300_20_OR_LATER(ah)) 2494 2489 ah->ent_mode = REG_READ(ah, AR_ENT_OTP); 2495 2490 2496 2491 if (AR_SREV_9287_11_OR_LATER(ah) || AR_SREV_9271(ah))
+2 -1
drivers/net/wireless/ath/ath9k/mac.c
··· 820 820 return; 821 821 } 822 822 823 - if (AR_SREV_9340(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah)) 823 + if (AR_SREV_9340(ah) || AR_SREV_9550(ah) || AR_SREV_9531(ah) || 824 + AR_SREV_9561(ah)) 824 825 sync_default &= ~AR_INTR_SYNC_HOST1_FATAL; 825 826 826 827 async_mask = AR_INTR_MAC_IRQ;
+2 -1
drivers/net/wireless/ath/ath9k/recv.c
··· 425 425 rfilt |= ATH9K_RX_FILTER_MCAST_BCAST_ALL; 426 426 } 427 427 428 - if (AR_SREV_9550(sc->sc_ah) || AR_SREV_9531(sc->sc_ah)) 428 + if (AR_SREV_9550(sc->sc_ah) || AR_SREV_9531(sc->sc_ah) || 429 + AR_SREV_9561(sc->sc_ah)) 429 430 rfilt |= ATH9K_RX_FILTER_4ADDRESS; 430 431 431 432 if (ath9k_is_chanctx_enabled() &&