18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright (c) 2008-2011 Atheros Communications Inc. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any 58c2ecf20Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above 68c2ecf20Sopenharmony_ci * copyright notice and this permission notice appear in all copies. 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 98c2ecf20Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 108c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 118c2ecf20Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 128c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 138c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 148c2ecf20Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 158c2ecf20Sopenharmony_ci */ 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#include "hw.h" 188c2ecf20Sopenharmony_ci#include "ar9003_mac.h" 198c2ecf20Sopenharmony_ci#include "ar9003_2p2_initvals.h" 208c2ecf20Sopenharmony_ci#include "ar9003_buffalo_initvals.h" 218c2ecf20Sopenharmony_ci#include "ar9485_initvals.h" 228c2ecf20Sopenharmony_ci#include "ar9340_initvals.h" 238c2ecf20Sopenharmony_ci#include "ar9330_1p1_initvals.h" 248c2ecf20Sopenharmony_ci#include "ar9330_1p2_initvals.h" 258c2ecf20Sopenharmony_ci#include "ar955x_1p0_initvals.h" 268c2ecf20Sopenharmony_ci#include "ar9580_1p0_initvals.h" 278c2ecf20Sopenharmony_ci#include "ar9462_2p0_initvals.h" 288c2ecf20Sopenharmony_ci#include "ar9462_2p1_initvals.h" 298c2ecf20Sopenharmony_ci#include "ar9565_1p0_initvals.h" 308c2ecf20Sopenharmony_ci#include "ar9565_1p1_initvals.h" 318c2ecf20Sopenharmony_ci#include "ar953x_initvals.h" 328c2ecf20Sopenharmony_ci#include "ar956x_initvals.h" 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci/* General hardware code for the AR9003 hadware family */ 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci/* 378c2ecf20Sopenharmony_ci * The AR9003 family uses a new INI format (pre, core, post 388c2ecf20Sopenharmony_ci * arrays per subsystem). This provides support for the 398c2ecf20Sopenharmony_ci * AR9003 2.2 chipsets. 408c2ecf20Sopenharmony_ci */ 418c2ecf20Sopenharmony_cistatic void ar9003_hw_init_mode_regs(struct ath_hw *ah) 428c2ecf20Sopenharmony_ci{ 438c2ecf20Sopenharmony_ci if (AR_SREV_9330_11(ah)) { 448c2ecf20Sopenharmony_ci /* mac */ 458c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], 468c2ecf20Sopenharmony_ci ar9331_1p1_mac_core); 478c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], 488c2ecf20Sopenharmony_ci ar9331_1p1_mac_postamble); 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci /* bb */ 518c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], 528c2ecf20Sopenharmony_ci ar9331_1p1_baseband_core); 538c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], 548c2ecf20Sopenharmony_ci ar9331_1p1_baseband_postamble); 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci /* radio */ 578c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], 588c2ecf20Sopenharmony_ci ar9331_1p1_radio_core); 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci /* soc */ 618c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], 628c2ecf20Sopenharmony_ci ar9331_1p1_soc_preamble); 638c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], 648c2ecf20Sopenharmony_ci ar9331_1p1_soc_postamble); 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci /* rx/tx gain */ 678c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 688c2ecf20Sopenharmony_ci ar9331_common_rx_gain_1p1); 698c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 708c2ecf20Sopenharmony_ci ar9331_modes_lowest_ob_db_tx_gain_1p1); 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci /* Japan 2484 Mhz CCK */ 738c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniCckfirJapan2484, 748c2ecf20Sopenharmony_ci ar9331_1p1_baseband_core_txfir_coeff_japan_2484); 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci /* additional clock settings */ 778c2ecf20Sopenharmony_ci if (ah->is_clk_25mhz) 788c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniAdditional, 798c2ecf20Sopenharmony_ci ar9331_1p1_xtal_25M); 808c2ecf20Sopenharmony_ci else 818c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniAdditional, 828c2ecf20Sopenharmony_ci ar9331_1p1_xtal_40M); 838c2ecf20Sopenharmony_ci } else if (AR_SREV_9330_12(ah)) { 848c2ecf20Sopenharmony_ci /* mac */ 858c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], 868c2ecf20Sopenharmony_ci ar9331_1p2_mac_core); 878c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], 888c2ecf20Sopenharmony_ci ar9331_1p2_mac_postamble); 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci /* bb */ 918c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], 928c2ecf20Sopenharmony_ci ar9331_1p2_baseband_core); 938c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], 948c2ecf20Sopenharmony_ci ar9331_1p2_baseband_postamble); 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci /* radio */ 978c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], 988c2ecf20Sopenharmony_ci ar9331_1p2_radio_core); 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci /* soc */ 1018c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], 1028c2ecf20Sopenharmony_ci ar9331_1p2_soc_preamble); 1038c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], 1048c2ecf20Sopenharmony_ci ar9331_1p2_soc_postamble); 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci /* rx/tx gain */ 1078c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 1088c2ecf20Sopenharmony_ci ar9331_common_rx_gain_1p2); 1098c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 1108c2ecf20Sopenharmony_ci ar9331_modes_lowest_ob_db_tx_gain_1p2); 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci /* Japan 2484 Mhz CCK */ 1138c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniCckfirJapan2484, 1148c2ecf20Sopenharmony_ci ar9331_1p2_baseband_core_txfir_coeff_japan_2484); 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci /* additional clock settings */ 1178c2ecf20Sopenharmony_ci if (ah->is_clk_25mhz) 1188c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniAdditional, 1198c2ecf20Sopenharmony_ci ar9331_1p2_xtal_25M); 1208c2ecf20Sopenharmony_ci else 1218c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniAdditional, 1228c2ecf20Sopenharmony_ci ar9331_1p2_xtal_40M); 1238c2ecf20Sopenharmony_ci } else if (AR_SREV_9340(ah)) { 1248c2ecf20Sopenharmony_ci /* mac */ 1258c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], 1268c2ecf20Sopenharmony_ci ar9340_1p0_mac_core); 1278c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], 1288c2ecf20Sopenharmony_ci ar9340_1p0_mac_postamble); 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci /* bb */ 1318c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], 1328c2ecf20Sopenharmony_ci ar9340_1p0_baseband_core); 1338c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], 1348c2ecf20Sopenharmony_ci ar9340_1p0_baseband_postamble); 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci /* radio */ 1378c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], 1388c2ecf20Sopenharmony_ci ar9340_1p0_radio_core); 1398c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], 1408c2ecf20Sopenharmony_ci ar9340_1p0_radio_postamble); 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci /* soc */ 1438c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], 1448c2ecf20Sopenharmony_ci ar9340_1p0_soc_preamble); 1458c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], 1468c2ecf20Sopenharmony_ci ar9340_1p0_soc_postamble); 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci /* rx/tx gain */ 1498c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 1508c2ecf20Sopenharmony_ci ar9340Common_wo_xlna_rx_gain_table_1p0); 1518c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 1528c2ecf20Sopenharmony_ci ar9340Modes_high_ob_db_tx_gain_table_1p0); 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesFastClock, 1558c2ecf20Sopenharmony_ci ar9340Modes_fast_clock_1p0); 1568c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniCckfirJapan2484, 1578c2ecf20Sopenharmony_ci ar9340_1p0_baseband_core_txfir_coeff_japan_2484); 1588c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_dfs, 1598c2ecf20Sopenharmony_ci ar9340_1p0_baseband_postamble_dfs_channel); 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci if (!ah->is_clk_25mhz) 1628c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniAdditional, 1638c2ecf20Sopenharmony_ci ar9340_1p0_radio_core_40M); 1648c2ecf20Sopenharmony_ci } else if (AR_SREV_9485_11_OR_LATER(ah)) { 1658c2ecf20Sopenharmony_ci /* mac */ 1668c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], 1678c2ecf20Sopenharmony_ci ar9485_1_1_mac_core); 1688c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], 1698c2ecf20Sopenharmony_ci ar9485_1_1_mac_postamble); 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ci /* bb */ 1728c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], ar9485_1_1); 1738c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], 1748c2ecf20Sopenharmony_ci ar9485_1_1_baseband_core); 1758c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], 1768c2ecf20Sopenharmony_ci ar9485_1_1_baseband_postamble); 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_ci /* radio */ 1798c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], 1808c2ecf20Sopenharmony_ci ar9485_1_1_radio_core); 1818c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], 1828c2ecf20Sopenharmony_ci ar9485_1_1_radio_postamble); 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ci /* soc */ 1858c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], 1868c2ecf20Sopenharmony_ci ar9485_1_1_soc_preamble); 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci /* rx/tx gain */ 1898c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 1908c2ecf20Sopenharmony_ci ar9485Common_wo_xlna_rx_gain_1_1); 1918c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 1928c2ecf20Sopenharmony_ci ar9485_modes_lowest_ob_db_tx_gain_1_1); 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_ci /* Japan 2484 Mhz CCK */ 1958c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniCckfirJapan2484, 1968c2ecf20Sopenharmony_ci ar9485_1_1_baseband_core_txfir_coeff_japan_2484); 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_ci if (ah->config.pll_pwrsave & AR_PCIE_PLL_PWRSAVE_CONTROL) { 1998c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniPcieSerdes, 2008c2ecf20Sopenharmony_ci ar9485_1_1_pll_on_cdr_on_clkreq_disable_L1); 2018c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower, 2028c2ecf20Sopenharmony_ci ar9485_1_1_pll_on_cdr_on_clkreq_disable_L1); 2038c2ecf20Sopenharmony_ci } else { 2048c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniPcieSerdes, 2058c2ecf20Sopenharmony_ci ar9485_1_1_pcie_phy_clkreq_disable_L1); 2068c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower, 2078c2ecf20Sopenharmony_ci ar9485_1_1_pcie_phy_clkreq_disable_L1); 2088c2ecf20Sopenharmony_ci } 2098c2ecf20Sopenharmony_ci } else if (AR_SREV_9462_21(ah)) { 2108c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], 2118c2ecf20Sopenharmony_ci ar9462_2p1_mac_core); 2128c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], 2138c2ecf20Sopenharmony_ci ar9462_2p1_mac_postamble); 2148c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], 2158c2ecf20Sopenharmony_ci ar9462_2p1_baseband_core); 2168c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], 2178c2ecf20Sopenharmony_ci ar9462_2p1_baseband_postamble); 2188c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], 2198c2ecf20Sopenharmony_ci ar9462_2p1_radio_core); 2208c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], 2218c2ecf20Sopenharmony_ci ar9462_2p1_radio_postamble); 2228c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_radio_post_sys2ant, 2238c2ecf20Sopenharmony_ci ar9462_2p1_radio_postamble_sys2ant); 2248c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], 2258c2ecf20Sopenharmony_ci ar9462_2p1_soc_preamble); 2268c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], 2278c2ecf20Sopenharmony_ci ar9462_2p1_soc_postamble); 2288c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 2298c2ecf20Sopenharmony_ci ar9462_2p1_common_rx_gain); 2308c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesFastClock, 2318c2ecf20Sopenharmony_ci ar9462_2p1_modes_fast_clock); 2328c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniCckfirJapan2484, 2338c2ecf20Sopenharmony_ci ar9462_2p1_baseband_core_txfir_coeff_japan_2484); 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_ci /* Awake -> Sleep Setting */ 2368c2ecf20Sopenharmony_ci if ((ah->config.pll_pwrsave & AR_PCIE_PLL_PWRSAVE_CONTROL) && 2378c2ecf20Sopenharmony_ci (ah->config.pll_pwrsave & AR_PCIE_PLL_PWRSAVE_ON_D3)) { 2388c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniPcieSerdes, 2398c2ecf20Sopenharmony_ci ar9462_2p1_pciephy_clkreq_disable_L1); 2408c2ecf20Sopenharmony_ci } 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_ci /* Sleep -> Awake Setting */ 2438c2ecf20Sopenharmony_ci if ((ah->config.pll_pwrsave & AR_PCIE_PLL_PWRSAVE_CONTROL) && 2448c2ecf20Sopenharmony_ci (ah->config.pll_pwrsave & AR_PCIE_PLL_PWRSAVE_ON_D0)) { 2458c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower, 2468c2ecf20Sopenharmony_ci ar9462_2p1_pciephy_clkreq_disable_L1); 2478c2ecf20Sopenharmony_ci } 2488c2ecf20Sopenharmony_ci } else if (AR_SREV_9462_20(ah)) { 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], ar9462_2p0_mac_core); 2518c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], 2528c2ecf20Sopenharmony_ci ar9462_2p0_mac_postamble); 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], 2558c2ecf20Sopenharmony_ci ar9462_2p0_baseband_core); 2568c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], 2578c2ecf20Sopenharmony_ci ar9462_2p0_baseband_postamble); 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], 2608c2ecf20Sopenharmony_ci ar9462_2p0_radio_core); 2618c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], 2628c2ecf20Sopenharmony_ci ar9462_2p0_radio_postamble); 2638c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_radio_post_sys2ant, 2648c2ecf20Sopenharmony_ci ar9462_2p0_radio_postamble_sys2ant); 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], 2678c2ecf20Sopenharmony_ci ar9462_2p0_soc_preamble); 2688c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], 2698c2ecf20Sopenharmony_ci ar9462_2p0_soc_postamble); 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 2728c2ecf20Sopenharmony_ci ar9462_2p0_common_rx_gain); 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ci /* Awake -> Sleep Setting */ 2758c2ecf20Sopenharmony_ci if ((ah->config.pll_pwrsave & AR_PCIE_PLL_PWRSAVE_CONTROL) && 2768c2ecf20Sopenharmony_ci (ah->config.pll_pwrsave & AR_PCIE_PLL_PWRSAVE_ON_D3)) { 2778c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniPcieSerdes, 2788c2ecf20Sopenharmony_ci ar9462_2p0_pciephy_clkreq_disable_L1); 2798c2ecf20Sopenharmony_ci } 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_ci /* Sleep -> Awake Setting */ 2828c2ecf20Sopenharmony_ci if ((ah->config.pll_pwrsave & AR_PCIE_PLL_PWRSAVE_CONTROL) && 2838c2ecf20Sopenharmony_ci (ah->config.pll_pwrsave & AR_PCIE_PLL_PWRSAVE_ON_D0)) { 2848c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower, 2858c2ecf20Sopenharmony_ci ar9462_2p0_pciephy_clkreq_disable_L1); 2868c2ecf20Sopenharmony_ci } 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_ci /* Fast clock modal settings */ 2898c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesFastClock, 2908c2ecf20Sopenharmony_ci ar9462_2p0_modes_fast_clock); 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniCckfirJapan2484, 2938c2ecf20Sopenharmony_ci ar9462_2p0_baseband_core_txfir_coeff_japan_2484); 2948c2ecf20Sopenharmony_ci } else if (AR_SREV_9550(ah)) { 2958c2ecf20Sopenharmony_ci /* mac */ 2968c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], 2978c2ecf20Sopenharmony_ci ar955x_1p0_mac_core); 2988c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], 2998c2ecf20Sopenharmony_ci ar955x_1p0_mac_postamble); 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_ci /* bb */ 3028c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], 3038c2ecf20Sopenharmony_ci ar955x_1p0_baseband_core); 3048c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], 3058c2ecf20Sopenharmony_ci ar955x_1p0_baseband_postamble); 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ci /* radio */ 3088c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], 3098c2ecf20Sopenharmony_ci ar955x_1p0_radio_core); 3108c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], 3118c2ecf20Sopenharmony_ci ar955x_1p0_radio_postamble); 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci /* soc */ 3148c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], 3158c2ecf20Sopenharmony_ci ar955x_1p0_soc_preamble); 3168c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], 3178c2ecf20Sopenharmony_ci ar955x_1p0_soc_postamble); 3188c2ecf20Sopenharmony_ci 3198c2ecf20Sopenharmony_ci /* rx/tx gain */ 3208c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 3218c2ecf20Sopenharmony_ci ar955x_1p0_common_wo_xlna_rx_gain_table); 3228c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds, 3238c2ecf20Sopenharmony_ci ar955x_1p0_common_wo_xlna_rx_gain_bounds); 3248c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 3258c2ecf20Sopenharmony_ci ar955x_1p0_modes_xpa_tx_gain_table); 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_ci /* Fast clock modal settings */ 3288c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesFastClock, 3298c2ecf20Sopenharmony_ci ar955x_1p0_modes_fast_clock); 3308c2ecf20Sopenharmony_ci } else if (AR_SREV_9531(ah)) { 3318c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], 3328c2ecf20Sopenharmony_ci qca953x_1p0_mac_core); 3338c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], 3348c2ecf20Sopenharmony_ci qca953x_1p0_mac_postamble); 3358c2ecf20Sopenharmony_ci if (AR_SREV_9531_20(ah)) { 3368c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], 3378c2ecf20Sopenharmony_ci qca953x_2p0_baseband_core); 3388c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], 3398c2ecf20Sopenharmony_ci qca953x_2p0_baseband_postamble); 3408c2ecf20Sopenharmony_ci } else { 3418c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], 3428c2ecf20Sopenharmony_ci qca953x_1p0_baseband_core); 3438c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], 3448c2ecf20Sopenharmony_ci qca953x_1p0_baseband_postamble); 3458c2ecf20Sopenharmony_ci } 3468c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], 3478c2ecf20Sopenharmony_ci qca953x_1p0_radio_core); 3488c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], 3498c2ecf20Sopenharmony_ci qca953x_1p0_radio_postamble); 3508c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], 3518c2ecf20Sopenharmony_ci qca953x_1p0_soc_preamble); 3528c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], 3538c2ecf20Sopenharmony_ci qca953x_1p0_soc_postamble); 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_ci if (AR_SREV_9531_20(ah)) { 3568c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 3578c2ecf20Sopenharmony_ci qca953x_2p0_common_wo_xlna_rx_gain_table); 3588c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds, 3598c2ecf20Sopenharmony_ci qca953x_2p0_common_wo_xlna_rx_gain_bounds); 3608c2ecf20Sopenharmony_ci } else { 3618c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 3628c2ecf20Sopenharmony_ci qca953x_1p0_common_wo_xlna_rx_gain_table); 3638c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds, 3648c2ecf20Sopenharmony_ci qca953x_1p0_common_wo_xlna_rx_gain_bounds); 3658c2ecf20Sopenharmony_ci } 3668c2ecf20Sopenharmony_ci 3678c2ecf20Sopenharmony_ci if (AR_SREV_9531_20(ah)) 3688c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 3698c2ecf20Sopenharmony_ci qca953x_2p0_modes_no_xpa_tx_gain_table); 3708c2ecf20Sopenharmony_ci else if (AR_SREV_9531_11(ah)) 3718c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 3728c2ecf20Sopenharmony_ci qca953x_1p1_modes_no_xpa_tx_gain_table); 3738c2ecf20Sopenharmony_ci else 3748c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 3758c2ecf20Sopenharmony_ci qca953x_1p0_modes_no_xpa_tx_gain_table); 3768c2ecf20Sopenharmony_ci 3778c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesFastClock, 3788c2ecf20Sopenharmony_ci qca953x_1p0_modes_fast_clock); 3798c2ecf20Sopenharmony_ci } else if (AR_SREV_9561(ah)) { 3808c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], 3818c2ecf20Sopenharmony_ci qca956x_1p0_mac_core); 3828c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], 3838c2ecf20Sopenharmony_ci qca956x_1p0_mac_postamble); 3848c2ecf20Sopenharmony_ci 3858c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], 3868c2ecf20Sopenharmony_ci qca956x_1p0_baseband_core); 3878c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], 3888c2ecf20Sopenharmony_ci qca956x_1p0_baseband_postamble); 3898c2ecf20Sopenharmony_ci 3908c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], 3918c2ecf20Sopenharmony_ci qca956x_1p0_radio_core); 3928c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], 3938c2ecf20Sopenharmony_ci qca956x_1p0_radio_postamble); 3948c2ecf20Sopenharmony_ci 3958c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], 3968c2ecf20Sopenharmony_ci qca956x_1p0_soc_preamble); 3978c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], 3988c2ecf20Sopenharmony_ci qca956x_1p0_soc_postamble); 3998c2ecf20Sopenharmony_ci 4008c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 4018c2ecf20Sopenharmony_ci qca956x_1p0_common_wo_xlna_rx_gain_table); 4028c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds, 4038c2ecf20Sopenharmony_ci qca956x_1p0_common_wo_xlna_rx_gain_bounds); 4048c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 4058c2ecf20Sopenharmony_ci qca956x_1p0_modes_no_xpa_tx_gain_table); 4068c2ecf20Sopenharmony_ci 4078c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_dfs, 4088c2ecf20Sopenharmony_ci qca956x_1p0_baseband_postamble_dfs_channel); 4098c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniCckfirJapan2484, 4108c2ecf20Sopenharmony_ci qca956x_1p0_baseband_core_txfir_coeff_japan_2484); 4118c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesFastClock, 4128c2ecf20Sopenharmony_ci qca956x_1p0_modes_fast_clock); 4138c2ecf20Sopenharmony_ci } else if (AR_SREV_9580(ah)) { 4148c2ecf20Sopenharmony_ci /* mac */ 4158c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], 4168c2ecf20Sopenharmony_ci ar9580_1p0_mac_core); 4178c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], 4188c2ecf20Sopenharmony_ci ar9580_1p0_mac_postamble); 4198c2ecf20Sopenharmony_ci 4208c2ecf20Sopenharmony_ci /* bb */ 4218c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], 4228c2ecf20Sopenharmony_ci ar9580_1p0_baseband_core); 4238c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], 4248c2ecf20Sopenharmony_ci ar9580_1p0_baseband_postamble); 4258c2ecf20Sopenharmony_ci 4268c2ecf20Sopenharmony_ci /* radio */ 4278c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], 4288c2ecf20Sopenharmony_ci ar9580_1p0_radio_core); 4298c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], 4308c2ecf20Sopenharmony_ci ar9580_1p0_radio_postamble); 4318c2ecf20Sopenharmony_ci 4328c2ecf20Sopenharmony_ci /* soc */ 4338c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], 4348c2ecf20Sopenharmony_ci ar9580_1p0_soc_preamble); 4358c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], 4368c2ecf20Sopenharmony_ci ar9580_1p0_soc_postamble); 4378c2ecf20Sopenharmony_ci 4388c2ecf20Sopenharmony_ci /* rx/tx gain */ 4398c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 4408c2ecf20Sopenharmony_ci ar9580_1p0_rx_gain_table); 4418c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 4428c2ecf20Sopenharmony_ci ar9580_1p0_low_ob_db_tx_gain_table); 4438c2ecf20Sopenharmony_ci 4448c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesFastClock, 4458c2ecf20Sopenharmony_ci ar9580_1p0_modes_fast_clock); 4468c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniCckfirJapan2484, 4478c2ecf20Sopenharmony_ci ar9580_1p0_baseband_core_txfir_coeff_japan_2484); 4488c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_dfs, 4498c2ecf20Sopenharmony_ci ar9580_1p0_baseband_postamble_dfs_channel); 4508c2ecf20Sopenharmony_ci } else if (AR_SREV_9565_11_OR_LATER(ah)) { 4518c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], 4528c2ecf20Sopenharmony_ci ar9565_1p1_mac_core); 4538c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], 4548c2ecf20Sopenharmony_ci ar9565_1p1_mac_postamble); 4558c2ecf20Sopenharmony_ci 4568c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], 4578c2ecf20Sopenharmony_ci ar9565_1p1_baseband_core); 4588c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], 4598c2ecf20Sopenharmony_ci ar9565_1p1_baseband_postamble); 4608c2ecf20Sopenharmony_ci 4618c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], 4628c2ecf20Sopenharmony_ci ar9565_1p1_radio_core); 4638c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], 4648c2ecf20Sopenharmony_ci ar9565_1p1_radio_postamble); 4658c2ecf20Sopenharmony_ci 4668c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], 4678c2ecf20Sopenharmony_ci ar9565_1p1_soc_preamble); 4688c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], 4698c2ecf20Sopenharmony_ci ar9565_1p1_soc_postamble); 4708c2ecf20Sopenharmony_ci 4718c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 4728c2ecf20Sopenharmony_ci ar9565_1p1_Common_rx_gain_table); 4738c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 4748c2ecf20Sopenharmony_ci ar9565_1p1_Modes_lowest_ob_db_tx_gain_table); 4758c2ecf20Sopenharmony_ci 4768c2ecf20Sopenharmony_ci /* Awake -> Sleep Setting */ 4778c2ecf20Sopenharmony_ci if ((ah->config.pll_pwrsave & AR_PCIE_PLL_PWRSAVE_CONTROL) && 4788c2ecf20Sopenharmony_ci (ah->config.pll_pwrsave & AR_PCIE_PLL_PWRSAVE_ON_D3)) { 4798c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniPcieSerdes, 4808c2ecf20Sopenharmony_ci ar9565_1p1_pciephy_clkreq_disable_L1); 4818c2ecf20Sopenharmony_ci } 4828c2ecf20Sopenharmony_ci 4838c2ecf20Sopenharmony_ci /* Sleep -> Awake Setting */ 4848c2ecf20Sopenharmony_ci if ((ah->config.pll_pwrsave & AR_PCIE_PLL_PWRSAVE_CONTROL) && 4858c2ecf20Sopenharmony_ci (ah->config.pll_pwrsave & AR_PCIE_PLL_PWRSAVE_ON_D0)) { 4868c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower, 4878c2ecf20Sopenharmony_ci ar9565_1p1_pciephy_clkreq_disable_L1); 4888c2ecf20Sopenharmony_ci } 4898c2ecf20Sopenharmony_ci 4908c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesFastClock, 4918c2ecf20Sopenharmony_ci ar9565_1p1_modes_fast_clock); 4928c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniCckfirJapan2484, 4938c2ecf20Sopenharmony_ci ar9565_1p1_baseband_core_txfir_coeff_japan_2484); 4948c2ecf20Sopenharmony_ci } else if (AR_SREV_9565(ah)) { 4958c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], 4968c2ecf20Sopenharmony_ci ar9565_1p0_mac_core); 4978c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], 4988c2ecf20Sopenharmony_ci ar9565_1p0_mac_postamble); 4998c2ecf20Sopenharmony_ci 5008c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], 5018c2ecf20Sopenharmony_ci ar9565_1p0_baseband_core); 5028c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], 5038c2ecf20Sopenharmony_ci ar9565_1p0_baseband_postamble); 5048c2ecf20Sopenharmony_ci 5058c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], 5068c2ecf20Sopenharmony_ci ar9565_1p0_radio_core); 5078c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], 5088c2ecf20Sopenharmony_ci ar9565_1p0_radio_postamble); 5098c2ecf20Sopenharmony_ci 5108c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], 5118c2ecf20Sopenharmony_ci ar9565_1p0_soc_preamble); 5128c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], 5138c2ecf20Sopenharmony_ci ar9565_1p0_soc_postamble); 5148c2ecf20Sopenharmony_ci 5158c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 5168c2ecf20Sopenharmony_ci ar9565_1p0_Common_rx_gain_table); 5178c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 5188c2ecf20Sopenharmony_ci ar9565_1p0_Modes_lowest_ob_db_tx_gain_table); 5198c2ecf20Sopenharmony_ci 5208c2ecf20Sopenharmony_ci /* Awake -> Sleep Setting */ 5218c2ecf20Sopenharmony_ci if ((ah->config.pll_pwrsave & AR_PCIE_PLL_PWRSAVE_CONTROL) && 5228c2ecf20Sopenharmony_ci (ah->config.pll_pwrsave & AR_PCIE_PLL_PWRSAVE_ON_D3)) { 5238c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniPcieSerdes, 5248c2ecf20Sopenharmony_ci ar9565_1p0_pciephy_clkreq_disable_L1); 5258c2ecf20Sopenharmony_ci } 5268c2ecf20Sopenharmony_ci 5278c2ecf20Sopenharmony_ci /* Sleep -> Awake Setting */ 5288c2ecf20Sopenharmony_ci if ((ah->config.pll_pwrsave & AR_PCIE_PLL_PWRSAVE_CONTROL) && 5298c2ecf20Sopenharmony_ci (ah->config.pll_pwrsave & AR_PCIE_PLL_PWRSAVE_ON_D0)) { 5308c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower, 5318c2ecf20Sopenharmony_ci ar9565_1p0_pciephy_clkreq_disable_L1); 5328c2ecf20Sopenharmony_ci } 5338c2ecf20Sopenharmony_ci 5348c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesFastClock, 5358c2ecf20Sopenharmony_ci ar9565_1p0_modes_fast_clock); 5368c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniCckfirJapan2484, 5378c2ecf20Sopenharmony_ci ar9565_1p0_baseband_core_txfir_coeff_japan_2484); 5388c2ecf20Sopenharmony_ci } else { 5398c2ecf20Sopenharmony_ci /* mac */ 5408c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], 5418c2ecf20Sopenharmony_ci ar9300_2p2_mac_core); 5428c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST], 5438c2ecf20Sopenharmony_ci ar9300_2p2_mac_postamble); 5448c2ecf20Sopenharmony_ci 5458c2ecf20Sopenharmony_ci /* bb */ 5468c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE], 5478c2ecf20Sopenharmony_ci ar9300_2p2_baseband_core); 5488c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST], 5498c2ecf20Sopenharmony_ci ar9300_2p2_baseband_postamble); 5508c2ecf20Sopenharmony_ci 5518c2ecf20Sopenharmony_ci /* radio */ 5528c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE], 5538c2ecf20Sopenharmony_ci ar9300_2p2_radio_core); 5548c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], 5558c2ecf20Sopenharmony_ci ar9300_2p2_radio_postamble); 5568c2ecf20Sopenharmony_ci 5578c2ecf20Sopenharmony_ci /* soc */ 5588c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE], 5598c2ecf20Sopenharmony_ci ar9300_2p2_soc_preamble); 5608c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], 5618c2ecf20Sopenharmony_ci ar9300_2p2_soc_postamble); 5628c2ecf20Sopenharmony_ci 5638c2ecf20Sopenharmony_ci /* rx/tx gain */ 5648c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 5658c2ecf20Sopenharmony_ci ar9300Common_rx_gain_table_2p2); 5668c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 5678c2ecf20Sopenharmony_ci ar9300Modes_lowest_ob_db_tx_gain_table_2p2); 5688c2ecf20Sopenharmony_ci 5698c2ecf20Sopenharmony_ci /* Load PCIE SERDES settings from INI */ 5708c2ecf20Sopenharmony_ci 5718c2ecf20Sopenharmony_ci /* Awake Setting */ 5728c2ecf20Sopenharmony_ci 5738c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniPcieSerdes, 5748c2ecf20Sopenharmony_ci ar9300PciePhy_pll_on_clkreq_disable_L1_2p2); 5758c2ecf20Sopenharmony_ci 5768c2ecf20Sopenharmony_ci /* Sleep Setting */ 5778c2ecf20Sopenharmony_ci 5788c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower, 5798c2ecf20Sopenharmony_ci ar9300PciePhy_pll_on_clkreq_disable_L1_2p2); 5808c2ecf20Sopenharmony_ci 5818c2ecf20Sopenharmony_ci /* Fast clock modal settings */ 5828c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesFastClock, 5838c2ecf20Sopenharmony_ci ar9300Modes_fast_clock_2p2); 5848c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniCckfirJapan2484, 5858c2ecf20Sopenharmony_ci ar9300_2p2_baseband_core_txfir_coeff_japan_2484); 5868c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_dfs, 5878c2ecf20Sopenharmony_ci ar9300_2p2_baseband_postamble_dfs_channel); 5888c2ecf20Sopenharmony_ci } 5898c2ecf20Sopenharmony_ci} 5908c2ecf20Sopenharmony_ci 5918c2ecf20Sopenharmony_cistatic void ar9003_tx_gain_table_mode0(struct ath_hw *ah) 5928c2ecf20Sopenharmony_ci{ 5938c2ecf20Sopenharmony_ci if (AR_SREV_9330_12(ah)) 5948c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 5958c2ecf20Sopenharmony_ci ar9331_modes_lowest_ob_db_tx_gain_1p2); 5968c2ecf20Sopenharmony_ci else if (AR_SREV_9330_11(ah)) 5978c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 5988c2ecf20Sopenharmony_ci ar9331_modes_lowest_ob_db_tx_gain_1p1); 5998c2ecf20Sopenharmony_ci else if (AR_SREV_9340(ah)) 6008c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6018c2ecf20Sopenharmony_ci ar9340Modes_lowest_ob_db_tx_gain_table_1p0); 6028c2ecf20Sopenharmony_ci else if (AR_SREV_9485_11_OR_LATER(ah)) 6038c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6048c2ecf20Sopenharmony_ci ar9485_modes_lowest_ob_db_tx_gain_1_1); 6058c2ecf20Sopenharmony_ci else if (AR_SREV_9550(ah)) 6068c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6078c2ecf20Sopenharmony_ci ar955x_1p0_modes_xpa_tx_gain_table); 6088c2ecf20Sopenharmony_ci else if (AR_SREV_9531_10(ah)) 6098c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6108c2ecf20Sopenharmony_ci qca953x_1p0_modes_xpa_tx_gain_table); 6118c2ecf20Sopenharmony_ci else if (AR_SREV_9531_11(ah)) 6128c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6138c2ecf20Sopenharmony_ci qca953x_1p1_modes_xpa_tx_gain_table); 6148c2ecf20Sopenharmony_ci else if (AR_SREV_9531_20(ah)) 6158c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6168c2ecf20Sopenharmony_ci qca953x_2p0_modes_xpa_tx_gain_table); 6178c2ecf20Sopenharmony_ci else if (AR_SREV_9561(ah)) 6188c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6198c2ecf20Sopenharmony_ci qca956x_1p0_modes_xpa_tx_gain_table); 6208c2ecf20Sopenharmony_ci else if (AR_SREV_9580(ah)) 6218c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6228c2ecf20Sopenharmony_ci ar9580_1p0_lowest_ob_db_tx_gain_table); 6238c2ecf20Sopenharmony_ci else if (AR_SREV_9462_21(ah)) 6248c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6258c2ecf20Sopenharmony_ci ar9462_2p1_modes_low_ob_db_tx_gain); 6268c2ecf20Sopenharmony_ci else if (AR_SREV_9462_20(ah)) 6278c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6288c2ecf20Sopenharmony_ci ar9462_2p0_modes_low_ob_db_tx_gain); 6298c2ecf20Sopenharmony_ci else if (AR_SREV_9565_11(ah)) 6308c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6318c2ecf20Sopenharmony_ci ar9565_1p1_modes_low_ob_db_tx_gain_table); 6328c2ecf20Sopenharmony_ci else if (AR_SREV_9565(ah)) 6338c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6348c2ecf20Sopenharmony_ci ar9565_1p0_modes_low_ob_db_tx_gain_table); 6358c2ecf20Sopenharmony_ci else 6368c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6378c2ecf20Sopenharmony_ci ar9300Modes_lowest_ob_db_tx_gain_table_2p2); 6388c2ecf20Sopenharmony_ci} 6398c2ecf20Sopenharmony_ci 6408c2ecf20Sopenharmony_cistatic void ar9003_tx_gain_table_mode1(struct ath_hw *ah) 6418c2ecf20Sopenharmony_ci{ 6428c2ecf20Sopenharmony_ci if (AR_SREV_9330_12(ah)) 6438c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6448c2ecf20Sopenharmony_ci ar9331_modes_high_ob_db_tx_gain_1p2); 6458c2ecf20Sopenharmony_ci else if (AR_SREV_9330_11(ah)) 6468c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6478c2ecf20Sopenharmony_ci ar9331_modes_high_ob_db_tx_gain_1p1); 6488c2ecf20Sopenharmony_ci else if (AR_SREV_9340(ah)) 6498c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6508c2ecf20Sopenharmony_ci ar9340Modes_high_ob_db_tx_gain_table_1p0); 6518c2ecf20Sopenharmony_ci else if (AR_SREV_9485_11_OR_LATER(ah)) 6528c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6538c2ecf20Sopenharmony_ci ar9485Modes_high_ob_db_tx_gain_1_1); 6548c2ecf20Sopenharmony_ci else if (AR_SREV_9580(ah)) 6558c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6568c2ecf20Sopenharmony_ci ar9580_1p0_high_ob_db_tx_gain_table); 6578c2ecf20Sopenharmony_ci else if (AR_SREV_9550(ah)) 6588c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6598c2ecf20Sopenharmony_ci ar955x_1p0_modes_no_xpa_tx_gain_table); 6608c2ecf20Sopenharmony_ci else if (AR_SREV_9531(ah)) { 6618c2ecf20Sopenharmony_ci if (AR_SREV_9531_20(ah)) 6628c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6638c2ecf20Sopenharmony_ci qca953x_2p0_modes_no_xpa_tx_gain_table); 6648c2ecf20Sopenharmony_ci else if (AR_SREV_9531_11(ah)) 6658c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6668c2ecf20Sopenharmony_ci qca953x_1p1_modes_no_xpa_tx_gain_table); 6678c2ecf20Sopenharmony_ci else 6688c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6698c2ecf20Sopenharmony_ci qca953x_1p0_modes_no_xpa_tx_gain_table); 6708c2ecf20Sopenharmony_ci } else if (AR_SREV_9561(ah)) 6718c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6728c2ecf20Sopenharmony_ci qca956x_1p0_modes_no_xpa_tx_gain_table); 6738c2ecf20Sopenharmony_ci else if (AR_SREV_9462_21(ah)) 6748c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6758c2ecf20Sopenharmony_ci ar9462_2p1_modes_high_ob_db_tx_gain); 6768c2ecf20Sopenharmony_ci else if (AR_SREV_9462_20(ah)) 6778c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6788c2ecf20Sopenharmony_ci ar9462_2p0_modes_high_ob_db_tx_gain); 6798c2ecf20Sopenharmony_ci else if (AR_SREV_9565_11(ah)) 6808c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6818c2ecf20Sopenharmony_ci ar9565_1p1_modes_high_ob_db_tx_gain_table); 6828c2ecf20Sopenharmony_ci else if (AR_SREV_9565(ah)) 6838c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6848c2ecf20Sopenharmony_ci ar9565_1p0_modes_high_ob_db_tx_gain_table); 6858c2ecf20Sopenharmony_ci else 6868c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6878c2ecf20Sopenharmony_ci ar9300Modes_high_ob_db_tx_gain_table_2p2); 6888c2ecf20Sopenharmony_ci} 6898c2ecf20Sopenharmony_ci 6908c2ecf20Sopenharmony_cistatic void ar9003_tx_gain_table_mode2(struct ath_hw *ah) 6918c2ecf20Sopenharmony_ci{ 6928c2ecf20Sopenharmony_ci if (AR_SREV_9330_12(ah)) 6938c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6948c2ecf20Sopenharmony_ci ar9331_modes_low_ob_db_tx_gain_1p2); 6958c2ecf20Sopenharmony_ci else if (AR_SREV_9330_11(ah)) 6968c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 6978c2ecf20Sopenharmony_ci ar9331_modes_low_ob_db_tx_gain_1p1); 6988c2ecf20Sopenharmony_ci else if (AR_SREV_9340(ah)) 6998c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7008c2ecf20Sopenharmony_ci ar9340Modes_low_ob_db_tx_gain_table_1p0); 7018c2ecf20Sopenharmony_ci else if (AR_SREV_9531_11(ah)) 7028c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7038c2ecf20Sopenharmony_ci qca953x_1p1_modes_no_xpa_low_power_tx_gain_table); 7048c2ecf20Sopenharmony_ci else if (AR_SREV_9485_11_OR_LATER(ah)) 7058c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7068c2ecf20Sopenharmony_ci ar9485Modes_low_ob_db_tx_gain_1_1); 7078c2ecf20Sopenharmony_ci else if (AR_SREV_9580(ah)) 7088c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7098c2ecf20Sopenharmony_ci ar9580_1p0_low_ob_db_tx_gain_table); 7108c2ecf20Sopenharmony_ci else if (AR_SREV_9561(ah)) 7118c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7128c2ecf20Sopenharmony_ci qca956x_1p0_modes_no_xpa_low_ob_db_tx_gain_table); 7138c2ecf20Sopenharmony_ci else if (AR_SREV_9565_11(ah)) 7148c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7158c2ecf20Sopenharmony_ci ar9565_1p1_modes_low_ob_db_tx_gain_table); 7168c2ecf20Sopenharmony_ci else if (AR_SREV_9565(ah)) 7178c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7188c2ecf20Sopenharmony_ci ar9565_1p0_modes_low_ob_db_tx_gain_table); 7198c2ecf20Sopenharmony_ci else 7208c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7218c2ecf20Sopenharmony_ci ar9300Modes_low_ob_db_tx_gain_table_2p2); 7228c2ecf20Sopenharmony_ci} 7238c2ecf20Sopenharmony_ci 7248c2ecf20Sopenharmony_cistatic void ar9003_tx_gain_table_mode3(struct ath_hw *ah) 7258c2ecf20Sopenharmony_ci{ 7268c2ecf20Sopenharmony_ci if (AR_SREV_9330_12(ah)) 7278c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7288c2ecf20Sopenharmony_ci ar9331_modes_high_power_tx_gain_1p2); 7298c2ecf20Sopenharmony_ci else if (AR_SREV_9330_11(ah)) 7308c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7318c2ecf20Sopenharmony_ci ar9331_modes_high_power_tx_gain_1p1); 7328c2ecf20Sopenharmony_ci else if (AR_SREV_9340(ah)) 7338c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7348c2ecf20Sopenharmony_ci ar9340Modes_high_power_tx_gain_table_1p0); 7358c2ecf20Sopenharmony_ci else if (AR_SREV_9485_11_OR_LATER(ah)) 7368c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7378c2ecf20Sopenharmony_ci ar9485Modes_high_power_tx_gain_1_1); 7388c2ecf20Sopenharmony_ci else if (AR_SREV_9580(ah)) 7398c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7408c2ecf20Sopenharmony_ci ar9580_1p0_high_power_tx_gain_table); 7418c2ecf20Sopenharmony_ci else if (AR_SREV_9565_11(ah)) 7428c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7438c2ecf20Sopenharmony_ci ar9565_1p1_modes_high_power_tx_gain_table); 7448c2ecf20Sopenharmony_ci else if (AR_SREV_9565(ah)) 7458c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7468c2ecf20Sopenharmony_ci ar9565_1p0_modes_high_power_tx_gain_table); 7478c2ecf20Sopenharmony_ci else { 7488c2ecf20Sopenharmony_ci if (ah->config.tx_gain_buffalo) 7498c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7508c2ecf20Sopenharmony_ci ar9300Modes_high_power_tx_gain_table_buffalo); 7518c2ecf20Sopenharmony_ci else 7528c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7538c2ecf20Sopenharmony_ci ar9300Modes_high_power_tx_gain_table_2p2); 7548c2ecf20Sopenharmony_ci } 7558c2ecf20Sopenharmony_ci} 7568c2ecf20Sopenharmony_ci 7578c2ecf20Sopenharmony_cistatic void ar9003_tx_gain_table_mode4(struct ath_hw *ah) 7588c2ecf20Sopenharmony_ci{ 7598c2ecf20Sopenharmony_ci if (AR_SREV_9340(ah)) 7608c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7618c2ecf20Sopenharmony_ci ar9340Modes_mixed_ob_db_tx_gain_table_1p0); 7628c2ecf20Sopenharmony_ci else if (AR_SREV_9580(ah)) 7638c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7648c2ecf20Sopenharmony_ci ar9580_1p0_mixed_ob_db_tx_gain_table); 7658c2ecf20Sopenharmony_ci else if (AR_SREV_9462_21(ah)) 7668c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7678c2ecf20Sopenharmony_ci ar9462_2p1_modes_mix_ob_db_tx_gain); 7688c2ecf20Sopenharmony_ci else if (AR_SREV_9462_20(ah)) 7698c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7708c2ecf20Sopenharmony_ci ar9462_2p0_modes_mix_ob_db_tx_gain); 7718c2ecf20Sopenharmony_ci else 7728c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7738c2ecf20Sopenharmony_ci ar9300Modes_mixed_ob_db_tx_gain_table_2p2); 7748c2ecf20Sopenharmony_ci} 7758c2ecf20Sopenharmony_ci 7768c2ecf20Sopenharmony_cistatic void ar9003_tx_gain_table_mode5(struct ath_hw *ah) 7778c2ecf20Sopenharmony_ci{ 7788c2ecf20Sopenharmony_ci if (AR_SREV_9485_11_OR_LATER(ah)) 7798c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7808c2ecf20Sopenharmony_ci ar9485Modes_green_ob_db_tx_gain_1_1); 7818c2ecf20Sopenharmony_ci else if (AR_SREV_9580(ah)) 7828c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7838c2ecf20Sopenharmony_ci ar9580_1p0_type5_tx_gain_table); 7848c2ecf20Sopenharmony_ci else if (AR_SREV_9561(ah)) 7858c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7868c2ecf20Sopenharmony_ci qca956x_1p0_modes_no_xpa_green_tx_gain_table); 7878c2ecf20Sopenharmony_ci else if (AR_SREV_9300_22(ah)) 7888c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7898c2ecf20Sopenharmony_ci ar9300Modes_type5_tx_gain_table_2p2); 7908c2ecf20Sopenharmony_ci} 7918c2ecf20Sopenharmony_ci 7928c2ecf20Sopenharmony_cistatic void ar9003_tx_gain_table_mode6(struct ath_hw *ah) 7938c2ecf20Sopenharmony_ci{ 7948c2ecf20Sopenharmony_ci if (AR_SREV_9340(ah)) 7958c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7968c2ecf20Sopenharmony_ci ar9340Modes_low_ob_db_and_spur_tx_gain_table_1p0); 7978c2ecf20Sopenharmony_ci else if (AR_SREV_9485_11_OR_LATER(ah)) 7988c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 7998c2ecf20Sopenharmony_ci ar9485Modes_green_spur_ob_db_tx_gain_1_1); 8008c2ecf20Sopenharmony_ci else if (AR_SREV_9580(ah)) 8018c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 8028c2ecf20Sopenharmony_ci ar9580_1p0_type6_tx_gain_table); 8038c2ecf20Sopenharmony_ci} 8048c2ecf20Sopenharmony_ci 8058c2ecf20Sopenharmony_cistatic void ar9003_tx_gain_table_mode7(struct ath_hw *ah) 8068c2ecf20Sopenharmony_ci{ 8078c2ecf20Sopenharmony_ci if (AR_SREV_9340(ah)) 8088c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesTxGain, 8098c2ecf20Sopenharmony_ci ar9340_cus227_tx_gain_table_1p0); 8108c2ecf20Sopenharmony_ci} 8118c2ecf20Sopenharmony_ci 8128c2ecf20Sopenharmony_citypedef void (*ath_txgain_tab)(struct ath_hw *ah); 8138c2ecf20Sopenharmony_ci 8148c2ecf20Sopenharmony_cistatic void ar9003_tx_gain_table_apply(struct ath_hw *ah) 8158c2ecf20Sopenharmony_ci{ 8168c2ecf20Sopenharmony_ci static const ath_txgain_tab modes[] = { 8178c2ecf20Sopenharmony_ci ar9003_tx_gain_table_mode0, 8188c2ecf20Sopenharmony_ci ar9003_tx_gain_table_mode1, 8198c2ecf20Sopenharmony_ci ar9003_tx_gain_table_mode2, 8208c2ecf20Sopenharmony_ci ar9003_tx_gain_table_mode3, 8218c2ecf20Sopenharmony_ci ar9003_tx_gain_table_mode4, 8228c2ecf20Sopenharmony_ci ar9003_tx_gain_table_mode5, 8238c2ecf20Sopenharmony_ci ar9003_tx_gain_table_mode6, 8248c2ecf20Sopenharmony_ci ar9003_tx_gain_table_mode7, 8258c2ecf20Sopenharmony_ci }; 8268c2ecf20Sopenharmony_ci int idx = ar9003_hw_get_tx_gain_idx(ah); 8278c2ecf20Sopenharmony_ci 8288c2ecf20Sopenharmony_ci if (idx >= ARRAY_SIZE(modes)) 8298c2ecf20Sopenharmony_ci idx = 0; 8308c2ecf20Sopenharmony_ci 8318c2ecf20Sopenharmony_ci modes[idx](ah); 8328c2ecf20Sopenharmony_ci} 8338c2ecf20Sopenharmony_ci 8348c2ecf20Sopenharmony_cistatic void ar9003_rx_gain_table_mode0(struct ath_hw *ah) 8358c2ecf20Sopenharmony_ci{ 8368c2ecf20Sopenharmony_ci if (AR_SREV_9330_12(ah)) 8378c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 8388c2ecf20Sopenharmony_ci ar9331_common_rx_gain_1p2); 8398c2ecf20Sopenharmony_ci else if (AR_SREV_9330_11(ah)) 8408c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 8418c2ecf20Sopenharmony_ci ar9331_common_rx_gain_1p1); 8428c2ecf20Sopenharmony_ci else if (AR_SREV_9340(ah)) 8438c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 8448c2ecf20Sopenharmony_ci ar9340Common_rx_gain_table_1p0); 8458c2ecf20Sopenharmony_ci else if (AR_SREV_9485_11_OR_LATER(ah)) 8468c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 8478c2ecf20Sopenharmony_ci ar9485_common_rx_gain_1_1); 8488c2ecf20Sopenharmony_ci else if (AR_SREV_9550(ah)) { 8498c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 8508c2ecf20Sopenharmony_ci ar955x_1p0_common_rx_gain_table); 8518c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds, 8528c2ecf20Sopenharmony_ci ar955x_1p0_common_rx_gain_bounds); 8538c2ecf20Sopenharmony_ci } else if (AR_SREV_9531(ah)) { 8548c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 8558c2ecf20Sopenharmony_ci qca953x_1p0_common_rx_gain_table); 8568c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds, 8578c2ecf20Sopenharmony_ci qca953x_1p0_common_rx_gain_bounds); 8588c2ecf20Sopenharmony_ci } else if (AR_SREV_9561(ah)) { 8598c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 8608c2ecf20Sopenharmony_ci qca956x_1p0_common_rx_gain_table); 8618c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds, 8628c2ecf20Sopenharmony_ci qca956x_1p0_common_rx_gain_bounds); 8638c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rxgain_xlna, 8648c2ecf20Sopenharmony_ci qca956x_1p0_xlna_only); 8658c2ecf20Sopenharmony_ci } else if (AR_SREV_9580(ah)) 8668c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 8678c2ecf20Sopenharmony_ci ar9580_1p0_rx_gain_table); 8688c2ecf20Sopenharmony_ci else if (AR_SREV_9462_21(ah)) 8698c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 8708c2ecf20Sopenharmony_ci ar9462_2p1_common_rx_gain); 8718c2ecf20Sopenharmony_ci else if (AR_SREV_9462_20(ah)) 8728c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 8738c2ecf20Sopenharmony_ci ar9462_2p0_common_rx_gain); 8748c2ecf20Sopenharmony_ci else if (AR_SREV_9565_11(ah)) 8758c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 8768c2ecf20Sopenharmony_ci ar9565_1p1_Common_rx_gain_table); 8778c2ecf20Sopenharmony_ci else if (AR_SREV_9565(ah)) 8788c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 8798c2ecf20Sopenharmony_ci ar9565_1p0_Common_rx_gain_table); 8808c2ecf20Sopenharmony_ci else 8818c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 8828c2ecf20Sopenharmony_ci ar9300Common_rx_gain_table_2p2); 8838c2ecf20Sopenharmony_ci} 8848c2ecf20Sopenharmony_ci 8858c2ecf20Sopenharmony_cistatic void ar9003_rx_gain_table_mode1(struct ath_hw *ah) 8868c2ecf20Sopenharmony_ci{ 8878c2ecf20Sopenharmony_ci if (AR_SREV_9330_12(ah)) 8888c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 8898c2ecf20Sopenharmony_ci ar9331_common_wo_xlna_rx_gain_1p2); 8908c2ecf20Sopenharmony_ci else if (AR_SREV_9330_11(ah)) 8918c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 8928c2ecf20Sopenharmony_ci ar9331_common_wo_xlna_rx_gain_1p1); 8938c2ecf20Sopenharmony_ci else if (AR_SREV_9340(ah)) 8948c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 8958c2ecf20Sopenharmony_ci ar9340Common_wo_xlna_rx_gain_table_1p0); 8968c2ecf20Sopenharmony_ci else if (AR_SREV_9485_11_OR_LATER(ah)) 8978c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 8988c2ecf20Sopenharmony_ci ar9485Common_wo_xlna_rx_gain_1_1); 8998c2ecf20Sopenharmony_ci else if (AR_SREV_9462_21(ah)) 9008c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 9018c2ecf20Sopenharmony_ci ar9462_2p1_common_wo_xlna_rx_gain); 9028c2ecf20Sopenharmony_ci else if (AR_SREV_9462_20(ah)) 9038c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 9048c2ecf20Sopenharmony_ci ar9462_2p0_common_wo_xlna_rx_gain); 9058c2ecf20Sopenharmony_ci else if (AR_SREV_9550(ah)) { 9068c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 9078c2ecf20Sopenharmony_ci ar955x_1p0_common_wo_xlna_rx_gain_table); 9088c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds, 9098c2ecf20Sopenharmony_ci ar955x_1p0_common_wo_xlna_rx_gain_bounds); 9108c2ecf20Sopenharmony_ci } else if (AR_SREV_9531_10(ah) || AR_SREV_9531_11(ah)) { 9118c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 9128c2ecf20Sopenharmony_ci qca953x_1p0_common_wo_xlna_rx_gain_table); 9138c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds, 9148c2ecf20Sopenharmony_ci qca953x_1p0_common_wo_xlna_rx_gain_bounds); 9158c2ecf20Sopenharmony_ci } else if (AR_SREV_9531_20(ah)) { 9168c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 9178c2ecf20Sopenharmony_ci qca953x_2p0_common_wo_xlna_rx_gain_table); 9188c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds, 9198c2ecf20Sopenharmony_ci qca953x_2p0_common_wo_xlna_rx_gain_bounds); 9208c2ecf20Sopenharmony_ci } else if (AR_SREV_9561(ah)) { 9218c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 9228c2ecf20Sopenharmony_ci qca956x_1p0_common_wo_xlna_rx_gain_table); 9238c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds, 9248c2ecf20Sopenharmony_ci qca956x_1p0_common_wo_xlna_rx_gain_bounds); 9258c2ecf20Sopenharmony_ci } else if (AR_SREV_9580(ah)) 9268c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 9278c2ecf20Sopenharmony_ci ar9580_1p0_wo_xlna_rx_gain_table); 9288c2ecf20Sopenharmony_ci else if (AR_SREV_9565_11(ah)) 9298c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 9308c2ecf20Sopenharmony_ci ar9565_1p1_common_wo_xlna_rx_gain_table); 9318c2ecf20Sopenharmony_ci else if (AR_SREV_9565(ah)) 9328c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 9338c2ecf20Sopenharmony_ci ar9565_1p0_common_wo_xlna_rx_gain_table); 9348c2ecf20Sopenharmony_ci else 9358c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 9368c2ecf20Sopenharmony_ci ar9300Common_wo_xlna_rx_gain_table_2p2); 9378c2ecf20Sopenharmony_ci} 9388c2ecf20Sopenharmony_ci 9398c2ecf20Sopenharmony_cistatic void ar9003_rx_gain_table_mode2(struct ath_hw *ah) 9408c2ecf20Sopenharmony_ci{ 9418c2ecf20Sopenharmony_ci if (AR_SREV_9462_21(ah)) { 9428c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 9438c2ecf20Sopenharmony_ci ar9462_2p1_common_mixed_rx_gain); 9448c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rxgain_bb_core, 9458c2ecf20Sopenharmony_ci ar9462_2p1_baseband_core_mix_rxgain); 9468c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rxgain_bb_postamble, 9478c2ecf20Sopenharmony_ci ar9462_2p1_baseband_postamble_mix_rxgain); 9488c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rxgain_xlna, 9498c2ecf20Sopenharmony_ci ar9462_2p1_baseband_postamble_5g_xlna); 9508c2ecf20Sopenharmony_ci } else if (AR_SREV_9462_20(ah)) { 9518c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 9528c2ecf20Sopenharmony_ci ar9462_2p0_common_mixed_rx_gain); 9538c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rxgain_bb_core, 9548c2ecf20Sopenharmony_ci ar9462_2p0_baseband_core_mix_rxgain); 9558c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rxgain_bb_postamble, 9568c2ecf20Sopenharmony_ci ar9462_2p0_baseband_postamble_mix_rxgain); 9578c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rxgain_xlna, 9588c2ecf20Sopenharmony_ci ar9462_2p0_baseband_postamble_5g_xlna); 9598c2ecf20Sopenharmony_ci } 9608c2ecf20Sopenharmony_ci} 9618c2ecf20Sopenharmony_ci 9628c2ecf20Sopenharmony_cistatic void ar9003_rx_gain_table_mode3(struct ath_hw *ah) 9638c2ecf20Sopenharmony_ci{ 9648c2ecf20Sopenharmony_ci if (AR_SREV_9462_21(ah)) { 9658c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 9668c2ecf20Sopenharmony_ci ar9462_2p1_common_5g_xlna_only_rxgain); 9678c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rxgain_xlna, 9688c2ecf20Sopenharmony_ci ar9462_2p1_baseband_postamble_5g_xlna); 9698c2ecf20Sopenharmony_ci } else if (AR_SREV_9462_20(ah)) { 9708c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->iniModesRxGain, 9718c2ecf20Sopenharmony_ci ar9462_2p0_common_5g_xlna_only_rxgain); 9728c2ecf20Sopenharmony_ci INIT_INI_ARRAY(&ah->ini_modes_rxgain_xlna, 9738c2ecf20Sopenharmony_ci ar9462_2p0_baseband_postamble_5g_xlna); 9748c2ecf20Sopenharmony_ci } 9758c2ecf20Sopenharmony_ci} 9768c2ecf20Sopenharmony_ci 9778c2ecf20Sopenharmony_cistatic void ar9003_rx_gain_table_apply(struct ath_hw *ah) 9788c2ecf20Sopenharmony_ci{ 9798c2ecf20Sopenharmony_ci switch (ar9003_hw_get_rx_gain_idx(ah)) { 9808c2ecf20Sopenharmony_ci case 0: 9818c2ecf20Sopenharmony_ci default: 9828c2ecf20Sopenharmony_ci ar9003_rx_gain_table_mode0(ah); 9838c2ecf20Sopenharmony_ci break; 9848c2ecf20Sopenharmony_ci case 1: 9858c2ecf20Sopenharmony_ci ar9003_rx_gain_table_mode1(ah); 9868c2ecf20Sopenharmony_ci break; 9878c2ecf20Sopenharmony_ci case 2: 9888c2ecf20Sopenharmony_ci ar9003_rx_gain_table_mode2(ah); 9898c2ecf20Sopenharmony_ci break; 9908c2ecf20Sopenharmony_ci case 3: 9918c2ecf20Sopenharmony_ci ar9003_rx_gain_table_mode3(ah); 9928c2ecf20Sopenharmony_ci break; 9938c2ecf20Sopenharmony_ci } 9948c2ecf20Sopenharmony_ci} 9958c2ecf20Sopenharmony_ci 9968c2ecf20Sopenharmony_ci/* set gain table pointers according to values read from the eeprom */ 9978c2ecf20Sopenharmony_cistatic void ar9003_hw_init_mode_gain_regs(struct ath_hw *ah) 9988c2ecf20Sopenharmony_ci{ 9998c2ecf20Sopenharmony_ci ar9003_tx_gain_table_apply(ah); 10008c2ecf20Sopenharmony_ci ar9003_rx_gain_table_apply(ah); 10018c2ecf20Sopenharmony_ci} 10028c2ecf20Sopenharmony_ci 10038c2ecf20Sopenharmony_ci/* 10048c2ecf20Sopenharmony_ci * Helper for ASPM support. 10058c2ecf20Sopenharmony_ci * 10068c2ecf20Sopenharmony_ci * Disable PLL when in L0s as well as receiver clock when in L1. 10078c2ecf20Sopenharmony_ci * This power saving option must be enabled through the SerDes. 10088c2ecf20Sopenharmony_ci * 10098c2ecf20Sopenharmony_ci * Programming the SerDes must go through the same 288 bit serial shift 10108c2ecf20Sopenharmony_ci * register as the other analog registers. Hence the 9 writes. 10118c2ecf20Sopenharmony_ci */ 10128c2ecf20Sopenharmony_cistatic void ar9003_hw_configpcipowersave(struct ath_hw *ah, 10138c2ecf20Sopenharmony_ci bool power_off) 10148c2ecf20Sopenharmony_ci{ 10158c2ecf20Sopenharmony_ci unsigned int i; 10168c2ecf20Sopenharmony_ci struct ar5416IniArray *array; 10178c2ecf20Sopenharmony_ci 10188c2ecf20Sopenharmony_ci /* 10198c2ecf20Sopenharmony_ci * Increase L1 Entry Latency. Some WB222 boards don't have 10208c2ecf20Sopenharmony_ci * this change in eeprom/OTP. 10218c2ecf20Sopenharmony_ci * 10228c2ecf20Sopenharmony_ci */ 10238c2ecf20Sopenharmony_ci if (AR_SREV_9462(ah)) { 10248c2ecf20Sopenharmony_ci u32 val = ah->config.aspm_l1_fix; 10258c2ecf20Sopenharmony_ci if ((val & 0xff000000) == 0x17000000) { 10268c2ecf20Sopenharmony_ci val &= 0x00ffffff; 10278c2ecf20Sopenharmony_ci val |= 0x27000000; 10288c2ecf20Sopenharmony_ci REG_WRITE(ah, 0x570c, val); 10298c2ecf20Sopenharmony_ci } 10308c2ecf20Sopenharmony_ci } 10318c2ecf20Sopenharmony_ci 10328c2ecf20Sopenharmony_ci /* Nothing to do on restore for 11N */ 10338c2ecf20Sopenharmony_ci if (!power_off /* !restore */) { 10348c2ecf20Sopenharmony_ci /* set bit 19 to allow forcing of pcie core into L1 state */ 10358c2ecf20Sopenharmony_ci REG_SET_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA); 10368c2ecf20Sopenharmony_ci REG_WRITE(ah, AR_WA, ah->WARegVal); 10378c2ecf20Sopenharmony_ci } 10388c2ecf20Sopenharmony_ci 10398c2ecf20Sopenharmony_ci /* 10408c2ecf20Sopenharmony_ci * Configure PCIE after Ini init. SERDES values now come from ini file 10418c2ecf20Sopenharmony_ci * This enables PCIe low power mode. 10428c2ecf20Sopenharmony_ci */ 10438c2ecf20Sopenharmony_ci array = power_off ? &ah->iniPcieSerdes : 10448c2ecf20Sopenharmony_ci &ah->iniPcieSerdesLowPower; 10458c2ecf20Sopenharmony_ci 10468c2ecf20Sopenharmony_ci for (i = 0; i < array->ia_rows; i++) { 10478c2ecf20Sopenharmony_ci REG_WRITE(ah, 10488c2ecf20Sopenharmony_ci INI_RA(array, i, 0), 10498c2ecf20Sopenharmony_ci INI_RA(array, i, 1)); 10508c2ecf20Sopenharmony_ci } 10518c2ecf20Sopenharmony_ci} 10528c2ecf20Sopenharmony_ci 10538c2ecf20Sopenharmony_cistatic void ar9003_hw_init_hang_checks(struct ath_hw *ah) 10548c2ecf20Sopenharmony_ci{ 10558c2ecf20Sopenharmony_ci /* 10568c2ecf20Sopenharmony_ci * All chips support detection of BB/MAC hangs. 10578c2ecf20Sopenharmony_ci */ 10588c2ecf20Sopenharmony_ci ah->config.hw_hang_checks |= HW_BB_WATCHDOG; 10598c2ecf20Sopenharmony_ci ah->config.hw_hang_checks |= HW_MAC_HANG; 10608c2ecf20Sopenharmony_ci 10618c2ecf20Sopenharmony_ci /* 10628c2ecf20Sopenharmony_ci * This is not required for AR9580 1.0 10638c2ecf20Sopenharmony_ci */ 10648c2ecf20Sopenharmony_ci if (AR_SREV_9300_22(ah)) 10658c2ecf20Sopenharmony_ci ah->config.hw_hang_checks |= HW_PHYRESTART_CLC_WAR; 10668c2ecf20Sopenharmony_ci 10678c2ecf20Sopenharmony_ci if (AR_SREV_9330(ah)) 10688c2ecf20Sopenharmony_ci ah->bb_watchdog_timeout_ms = 85; 10698c2ecf20Sopenharmony_ci else 10708c2ecf20Sopenharmony_ci ah->bb_watchdog_timeout_ms = 25; 10718c2ecf20Sopenharmony_ci} 10728c2ecf20Sopenharmony_ci 10738c2ecf20Sopenharmony_ci/* 10748c2ecf20Sopenharmony_ci * MAC HW hang check 10758c2ecf20Sopenharmony_ci * ================= 10768c2ecf20Sopenharmony_ci * 10778c2ecf20Sopenharmony_ci * Signature: dcu_chain_state is 0x6 and dcu_complete_state is 0x1. 10788c2ecf20Sopenharmony_ci * 10798c2ecf20Sopenharmony_ci * The state of each DCU chain (mapped to TX queues) is available from these 10808c2ecf20Sopenharmony_ci * DMA debug registers: 10818c2ecf20Sopenharmony_ci * 10828c2ecf20Sopenharmony_ci * Chain 0 state : Bits 4:0 of AR_DMADBG_4 10838c2ecf20Sopenharmony_ci * Chain 1 state : Bits 9:5 of AR_DMADBG_4 10848c2ecf20Sopenharmony_ci * Chain 2 state : Bits 14:10 of AR_DMADBG_4 10858c2ecf20Sopenharmony_ci * Chain 3 state : Bits 19:15 of AR_DMADBG_4 10868c2ecf20Sopenharmony_ci * Chain 4 state : Bits 24:20 of AR_DMADBG_4 10878c2ecf20Sopenharmony_ci * Chain 5 state : Bits 29:25 of AR_DMADBG_4 10888c2ecf20Sopenharmony_ci * Chain 6 state : Bits 4:0 of AR_DMADBG_5 10898c2ecf20Sopenharmony_ci * Chain 7 state : Bits 9:5 of AR_DMADBG_5 10908c2ecf20Sopenharmony_ci * Chain 8 state : Bits 14:10 of AR_DMADBG_5 10918c2ecf20Sopenharmony_ci * Chain 9 state : Bits 19:15 of AR_DMADBG_5 10928c2ecf20Sopenharmony_ci * 10938c2ecf20Sopenharmony_ci * The DCU chain state "0x6" means "WAIT_FRDONE" - wait for TX frame to be done. 10948c2ecf20Sopenharmony_ci */ 10958c2ecf20Sopenharmony_ci 10968c2ecf20Sopenharmony_ci#define NUM_STATUS_READS 50 10978c2ecf20Sopenharmony_ci 10988c2ecf20Sopenharmony_cistatic bool ath9k_hw_verify_hang(struct ath_hw *ah, unsigned int queue) 10998c2ecf20Sopenharmony_ci{ 11008c2ecf20Sopenharmony_ci u32 dma_dbg_chain, dma_dbg_complete; 11018c2ecf20Sopenharmony_ci u8 dcu_chain_state, dcu_complete_state; 11028c2ecf20Sopenharmony_ci unsigned int dbg_reg, reg_offset; 11038c2ecf20Sopenharmony_ci int i; 11048c2ecf20Sopenharmony_ci 11058c2ecf20Sopenharmony_ci if (queue < 6) { 11068c2ecf20Sopenharmony_ci dbg_reg = AR_DMADBG_4; 11078c2ecf20Sopenharmony_ci reg_offset = queue * 5; 11088c2ecf20Sopenharmony_ci } else { 11098c2ecf20Sopenharmony_ci dbg_reg = AR_DMADBG_5; 11108c2ecf20Sopenharmony_ci reg_offset = (queue - 6) * 5; 11118c2ecf20Sopenharmony_ci } 11128c2ecf20Sopenharmony_ci 11138c2ecf20Sopenharmony_ci for (i = 0; i < NUM_STATUS_READS; i++) { 11148c2ecf20Sopenharmony_ci dma_dbg_chain = REG_READ(ah, dbg_reg); 11158c2ecf20Sopenharmony_ci dma_dbg_complete = REG_READ(ah, AR_DMADBG_6); 11168c2ecf20Sopenharmony_ci 11178c2ecf20Sopenharmony_ci dcu_chain_state = (dma_dbg_chain >> reg_offset) & 0x1f; 11188c2ecf20Sopenharmony_ci dcu_complete_state = dma_dbg_complete & 0x3; 11198c2ecf20Sopenharmony_ci 11208c2ecf20Sopenharmony_ci if ((dcu_chain_state != 0x6) || (dcu_complete_state != 0x1)) 11218c2ecf20Sopenharmony_ci return false; 11228c2ecf20Sopenharmony_ci } 11238c2ecf20Sopenharmony_ci 11248c2ecf20Sopenharmony_ci ath_dbg(ath9k_hw_common(ah), RESET, 11258c2ecf20Sopenharmony_ci "MAC Hang signature found for queue: %d\n", queue); 11268c2ecf20Sopenharmony_ci 11278c2ecf20Sopenharmony_ci return true; 11288c2ecf20Sopenharmony_ci} 11298c2ecf20Sopenharmony_ci 11308c2ecf20Sopenharmony_cistatic bool ar9003_hw_detect_mac_hang(struct ath_hw *ah) 11318c2ecf20Sopenharmony_ci{ 11328c2ecf20Sopenharmony_ci u32 dma_dbg_4, dma_dbg_5, dma_dbg_6, chk_dbg; 11338c2ecf20Sopenharmony_ci u8 dcu_chain_state, dcu_complete_state; 11348c2ecf20Sopenharmony_ci bool dcu_wait_frdone = false; 11358c2ecf20Sopenharmony_ci unsigned long chk_dcu = 0; 11368c2ecf20Sopenharmony_ci unsigned int reg_offset; 11378c2ecf20Sopenharmony_ci unsigned int i = 0; 11388c2ecf20Sopenharmony_ci 11398c2ecf20Sopenharmony_ci dma_dbg_4 = REG_READ(ah, AR_DMADBG_4); 11408c2ecf20Sopenharmony_ci dma_dbg_5 = REG_READ(ah, AR_DMADBG_5); 11418c2ecf20Sopenharmony_ci dma_dbg_6 = REG_READ(ah, AR_DMADBG_6); 11428c2ecf20Sopenharmony_ci 11438c2ecf20Sopenharmony_ci dcu_complete_state = dma_dbg_6 & 0x3; 11448c2ecf20Sopenharmony_ci if (dcu_complete_state != 0x1) 11458c2ecf20Sopenharmony_ci goto exit; 11468c2ecf20Sopenharmony_ci 11478c2ecf20Sopenharmony_ci for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { 11488c2ecf20Sopenharmony_ci if (i < 6) { 11498c2ecf20Sopenharmony_ci chk_dbg = dma_dbg_4; 11508c2ecf20Sopenharmony_ci reg_offset = i * 5; 11518c2ecf20Sopenharmony_ci } else { 11528c2ecf20Sopenharmony_ci chk_dbg = dma_dbg_5; 11538c2ecf20Sopenharmony_ci reg_offset = (i - 6) * 5; 11548c2ecf20Sopenharmony_ci } 11558c2ecf20Sopenharmony_ci 11568c2ecf20Sopenharmony_ci dcu_chain_state = (chk_dbg >> reg_offset) & 0x1f; 11578c2ecf20Sopenharmony_ci if (dcu_chain_state == 0x6) { 11588c2ecf20Sopenharmony_ci dcu_wait_frdone = true; 11598c2ecf20Sopenharmony_ci chk_dcu |= BIT(i); 11608c2ecf20Sopenharmony_ci } 11618c2ecf20Sopenharmony_ci } 11628c2ecf20Sopenharmony_ci 11638c2ecf20Sopenharmony_ci if ((dcu_complete_state == 0x1) && dcu_wait_frdone) { 11648c2ecf20Sopenharmony_ci for_each_set_bit(i, &chk_dcu, ATH9K_NUM_TX_QUEUES) { 11658c2ecf20Sopenharmony_ci if (ath9k_hw_verify_hang(ah, i)) 11668c2ecf20Sopenharmony_ci return true; 11678c2ecf20Sopenharmony_ci } 11688c2ecf20Sopenharmony_ci } 11698c2ecf20Sopenharmony_ciexit: 11708c2ecf20Sopenharmony_ci return false; 11718c2ecf20Sopenharmony_ci} 11728c2ecf20Sopenharmony_ci 11738c2ecf20Sopenharmony_ci/* Sets up the AR9003 hardware familiy callbacks */ 11748c2ecf20Sopenharmony_civoid ar9003_hw_attach_ops(struct ath_hw *ah) 11758c2ecf20Sopenharmony_ci{ 11768c2ecf20Sopenharmony_ci struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); 11778c2ecf20Sopenharmony_ci struct ath_hw_ops *ops = ath9k_hw_ops(ah); 11788c2ecf20Sopenharmony_ci 11798c2ecf20Sopenharmony_ci ar9003_hw_init_mode_regs(ah); 11808c2ecf20Sopenharmony_ci 11818c2ecf20Sopenharmony_ci if (AR_SREV_9003_PCOEM(ah)) { 11828c2ecf20Sopenharmony_ci WARN_ON(!ah->iniPcieSerdes.ia_array); 11838c2ecf20Sopenharmony_ci WARN_ON(!ah->iniPcieSerdesLowPower.ia_array); 11848c2ecf20Sopenharmony_ci } 11858c2ecf20Sopenharmony_ci 11868c2ecf20Sopenharmony_ci priv_ops->init_mode_gain_regs = ar9003_hw_init_mode_gain_regs; 11878c2ecf20Sopenharmony_ci priv_ops->init_hang_checks = ar9003_hw_init_hang_checks; 11888c2ecf20Sopenharmony_ci priv_ops->detect_mac_hang = ar9003_hw_detect_mac_hang; 11898c2ecf20Sopenharmony_ci 11908c2ecf20Sopenharmony_ci ops->config_pci_powersave = ar9003_hw_configpcipowersave; 11918c2ecf20Sopenharmony_ci 11928c2ecf20Sopenharmony_ci ar9003_hw_attach_phy_ops(ah); 11938c2ecf20Sopenharmony_ci ar9003_hw_attach_calib_ops(ah); 11948c2ecf20Sopenharmony_ci ar9003_hw_attach_mac_ops(ah); 11958c2ecf20Sopenharmony_ci ar9003_hw_attach_aic_ops(ah); 11968c2ecf20Sopenharmony_ci} 1197