blob: d3eca0cec9cd31725012049e69977abeaf46fb89 [file] [log] [blame]
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -04001/*
Sujith Manoharan5b681382011-05-17 13:36:18 +05302 * Copyright (c) 2008-2011 Atheros Communications Inc.
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -04003 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include "hw.h"
Luis R. Rodriguezb622a722010-04-15 17:39:28 -040018#include "ar9003_mac.h"
Luis R. Rodriguez72846352010-05-12 21:15:05 -040019#include "ar9003_2p2_initvals.h"
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -080020#include "ar9485_initvals.h"
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +053021#include "ar9340_initvals.h"
Gabor Juhos172805a2011-06-21 11:23:26 +020022#include "ar9330_1p1_initvals.h"
23#include "ar9330_1p2_initvals.h"
Gabor Juhosa0fbb9b2012-07-03 19:13:22 +020024#include "ar955x_1p0_initvals.h"
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -070025#include "ar9580_1p0_initvals.h"
Rajkumar Manoharan76db2f82011-10-13 11:00:43 +053026#include "ar9462_2p0_initvals.h"
Sujith Manoharand567e4e2013-06-24 18:18:45 +053027#include "ar9462_2p1_initvals.h"
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +053028#include "ar9565_1p0_initvals.h"
Sujith Manoharan3777f7d2013-11-19 12:11:13 +053029#include "ar9565_1p1_initvals.h"
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -040030
31/* General hardware code for the AR9003 hadware family */
32
Luis R. Rodriguez886b42b2010-10-14 11:44:27 -070033/*
34 * The AR9003 family uses a new INI format (pre, core, post
35 * arrays per subsystem). This provides support for the
36 * AR9003 2.2 chipsets.
37 */
38static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
Luis R. Rodriguez72846352010-05-12 21:15:05 -040039{
Gabor Juhos172805a2011-06-21 11:23:26 +020040 if (AR_SREV_9330_11(ah)) {
41 /* mac */
Gabor Juhos172805a2011-06-21 11:23:26 +020042 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +020043 ar9331_1p1_mac_core);
Gabor Juhos172805a2011-06-21 11:23:26 +020044 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +020045 ar9331_1p1_mac_postamble);
Gabor Juhos172805a2011-06-21 11:23:26 +020046
47 /* bb */
Gabor Juhos172805a2011-06-21 11:23:26 +020048 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +020049 ar9331_1p1_baseband_core);
Gabor Juhos172805a2011-06-21 11:23:26 +020050 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +020051 ar9331_1p1_baseband_postamble);
Gabor Juhos172805a2011-06-21 11:23:26 +020052
53 /* radio */
Gabor Juhos172805a2011-06-21 11:23:26 +020054 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +020055 ar9331_1p1_radio_core);
Gabor Juhos172805a2011-06-21 11:23:26 +020056
57 /* soc */
58 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +020059 ar9331_1p1_soc_preamble);
Gabor Juhos172805a2011-06-21 11:23:26 +020060 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +020061 ar9331_1p1_soc_postamble);
Gabor Juhos172805a2011-06-21 11:23:26 +020062
63 /* rx/tx gain */
64 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +020065 ar9331_common_rx_gain_1p1);
Gabor Juhos172805a2011-06-21 11:23:26 +020066 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +020067 ar9331_modes_lowest_ob_db_tx_gain_1p1);
Gabor Juhos172805a2011-06-21 11:23:26 +020068
Sujith Manoharan57527f82012-11-13 11:33:53 +053069 /* Japan 2484 Mhz CCK */
70 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
71 ar9331_1p1_baseband_core_txfir_coeff_japan_2484);
72
Gabor Juhos172805a2011-06-21 11:23:26 +020073 /* additional clock settings */
74 if (ah->is_clk_25mhz)
Felix Fietkauc7d36f92012-03-14 16:40:31 +010075 INIT_INI_ARRAY(&ah->iniAdditional,
Felix Fietkaua3645172012-07-15 19:53:33 +020076 ar9331_1p1_xtal_25M);
Gabor Juhos172805a2011-06-21 11:23:26 +020077 else
Felix Fietkauc7d36f92012-03-14 16:40:31 +010078 INIT_INI_ARRAY(&ah->iniAdditional,
Felix Fietkaua3645172012-07-15 19:53:33 +020079 ar9331_1p1_xtal_40M);
Gabor Juhos172805a2011-06-21 11:23:26 +020080 } else if (AR_SREV_9330_12(ah)) {
81 /* mac */
Gabor Juhos172805a2011-06-21 11:23:26 +020082 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +020083 ar9331_1p2_mac_core);
Gabor Juhos172805a2011-06-21 11:23:26 +020084 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +020085 ar9331_1p2_mac_postamble);
Gabor Juhos172805a2011-06-21 11:23:26 +020086
87 /* bb */
Gabor Juhos172805a2011-06-21 11:23:26 +020088 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +020089 ar9331_1p2_baseband_core);
Gabor Juhos172805a2011-06-21 11:23:26 +020090 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +020091 ar9331_1p2_baseband_postamble);
Gabor Juhos172805a2011-06-21 11:23:26 +020092
93 /* radio */
Gabor Juhos172805a2011-06-21 11:23:26 +020094 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +020095 ar9331_1p2_radio_core);
Gabor Juhos172805a2011-06-21 11:23:26 +020096
97 /* soc */
98 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +020099 ar9331_1p2_soc_preamble);
Gabor Juhos172805a2011-06-21 11:23:26 +0200100 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200101 ar9331_1p2_soc_postamble);
Gabor Juhos172805a2011-06-21 11:23:26 +0200102
103 /* rx/tx gain */
104 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200105 ar9331_common_rx_gain_1p2);
Gabor Juhos172805a2011-06-21 11:23:26 +0200106 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200107 ar9331_modes_lowest_ob_db_tx_gain_1p2);
Gabor Juhos172805a2011-06-21 11:23:26 +0200108
Sujith Manoharan57527f82012-11-13 11:33:53 +0530109 /* Japan 2484 Mhz CCK */
110 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
111 ar9331_1p2_baseband_core_txfir_coeff_japan_2484);
112
Gabor Juhos172805a2011-06-21 11:23:26 +0200113 /* additional clock settings */
114 if (ah->is_clk_25mhz)
Felix Fietkauc7d36f92012-03-14 16:40:31 +0100115 INIT_INI_ARRAY(&ah->iniAdditional,
Felix Fietkaua3645172012-07-15 19:53:33 +0200116 ar9331_1p2_xtal_25M);
Gabor Juhos172805a2011-06-21 11:23:26 +0200117 else
Felix Fietkauc7d36f92012-03-14 16:40:31 +0100118 INIT_INI_ARRAY(&ah->iniAdditional,
Felix Fietkaua3645172012-07-15 19:53:33 +0200119 ar9331_1p2_xtal_40M);
Gabor Juhos172805a2011-06-21 11:23:26 +0200120 } else if (AR_SREV_9340(ah)) {
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530121 /* mac */
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530122 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200123 ar9340_1p0_mac_core);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530124 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200125 ar9340_1p0_mac_postamble);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530126
127 /* bb */
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530128 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200129 ar9340_1p0_baseband_core);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530130 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200131 ar9340_1p0_baseband_postamble);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530132
133 /* radio */
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530134 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200135 ar9340_1p0_radio_core);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530136 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200137 ar9340_1p0_radio_postamble);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530138
139 /* soc */
140 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200141 ar9340_1p0_soc_preamble);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530142 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200143 ar9340_1p0_soc_postamble);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530144
145 /* rx/tx gain */
146 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200147 ar9340Common_wo_xlna_rx_gain_table_1p0);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530148 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200149 ar9340Modes_high_ob_db_tx_gain_table_1p0);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530150
Felix Fietkauc7d36f92012-03-14 16:40:31 +0100151 INIT_INI_ARRAY(&ah->iniModesFastClock,
Felix Fietkaua3645172012-07-15 19:53:33 +0200152 ar9340Modes_fast_clock_1p0);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530153
Felix Fietkauc7d36f92012-03-14 16:40:31 +0100154 if (!ah->is_clk_25mhz)
155 INIT_INI_ARRAY(&ah->iniAdditional,
Felix Fietkaua3645172012-07-15 19:53:33 +0200156 ar9340_1p0_radio_core_40M);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530157 } else if (AR_SREV_9485_11_OR_LATER(ah)) {
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530158 /* mac */
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530159 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200160 ar9485_1_1_mac_core);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530161 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200162 ar9485_1_1_mac_postamble);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530163
164 /* bb */
Felix Fietkaua3645172012-07-15 19:53:33 +0200165 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], ar9485_1_1);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530166 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200167 ar9485_1_1_baseband_core);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530168 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200169 ar9485_1_1_baseband_postamble);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530170
171 /* radio */
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530172 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200173 ar9485_1_1_radio_core);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530174 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200175 ar9485_1_1_radio_postamble);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530176
177 /* soc */
178 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200179 ar9485_1_1_soc_preamble);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530180
181 /* rx/tx gain */
182 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200183 ar9485Common_wo_xlna_rx_gain_1_1);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530184 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200185 ar9485_modes_lowest_ob_db_tx_gain_1_1);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530186
Sujith Manoharan57527f82012-11-13 11:33:53 +0530187 /* Japan 2484 Mhz CCK */
188 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
189 ar9485_1_1_baseband_core_txfir_coeff_japan_2484);
190
Sujith Manoharan2d22c7d2013-11-08 11:45:25 +0530191 if (ah->config.no_pll_pwrsave) {
192 INIT_INI_ARRAY(&ah->iniPcieSerdes,
193 ar9485_1_1_pcie_phy_clkreq_disable_L1);
194 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
195 ar9485_1_1_pcie_phy_clkreq_disable_L1);
196 } else {
197 INIT_INI_ARRAY(&ah->iniPcieSerdes,
198 ar9485_1_1_pll_on_cdr_on_clkreq_disable_L1);
199 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
200 ar9485_1_1_pll_on_cdr_on_clkreq_disable_L1);
201 }
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530202 } else if (AR_SREV_9462_21(ah)) {
203 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
204 ar9462_2p1_mac_core);
205 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
206 ar9462_2p1_mac_postamble);
207 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
208 ar9462_2p1_baseband_core);
209 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
210 ar9462_2p1_baseband_postamble);
211 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
212 ar9462_2p1_radio_core);
213 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
214 ar9462_2p1_radio_postamble);
215 INIT_INI_ARRAY(&ah->ini_radio_post_sys2ant,
216 ar9462_2p1_radio_postamble_sys2ant);
217 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
218 ar9462_2p1_soc_preamble);
219 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
220 ar9462_2p1_soc_postamble);
221 INIT_INI_ARRAY(&ah->iniModesRxGain,
222 ar9462_2p1_common_rx_gain);
223 INIT_INI_ARRAY(&ah->iniModesFastClock,
224 ar9462_2p1_modes_fast_clock);
225 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
226 ar9462_2p1_baseband_core_txfir_coeff_japan_2484);
Sujith Manoharanf51ecd72013-10-29 11:35:31 +0530227 INIT_INI_ARRAY(&ah->iniPcieSerdes,
228 ar9462_2p1_pciephy_clkreq_disable_L1);
229 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
230 ar9462_2p1_pciephy_clkreq_disable_L1);
Rajkumar Manoharan423e38e2011-10-13 11:00:44 +0530231 } else if (AR_SREV_9462_20(ah)) {
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530232
Felix Fietkaua3645172012-07-15 19:53:33 +0200233 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], ar9462_2p0_mac_core);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530234 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200235 ar9462_2p0_mac_postamble);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530236
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530237 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200238 ar9462_2p0_baseband_core);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530239 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200240 ar9462_2p0_baseband_postamble);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530241
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530242 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200243 ar9462_2p0_radio_core);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530244 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200245 ar9462_2p0_radio_postamble);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530246 INIT_INI_ARRAY(&ah->ini_radio_post_sys2ant,
Felix Fietkaua3645172012-07-15 19:53:33 +0200247 ar9462_2p0_radio_postamble_sys2ant);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530248
249 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200250 ar9462_2p0_soc_preamble);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530251 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200252 ar9462_2p0_soc_postamble);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530253
254 INIT_INI_ARRAY(&ah->iniModesRxGain,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530255 ar9462_2p0_common_rx_gain);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530256
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530257 /* Awake -> Sleep Setting */
258 INIT_INI_ARRAY(&ah->iniPcieSerdes,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530259 ar9462_2p0_pciephy_clkreq_disable_L1);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530260 /* Sleep -> Awake Setting */
261 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530262 ar9462_2p0_pciephy_clkreq_disable_L1);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530263
264 /* Fast clock modal settings */
Felix Fietkauc7d36f92012-03-14 16:40:31 +0100265 INIT_INI_ARRAY(&ah->iniModesFastClock,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530266 ar9462_2p0_modes_fast_clock);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530267
268 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
Sujith Manoharan57527f82012-11-13 11:33:53 +0530269 ar9462_2p0_baseband_core_txfir_coeff_japan_2484);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200270 } else if (AR_SREV_9550(ah)) {
271 /* mac */
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200272 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200273 ar955x_1p0_mac_core);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200274 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200275 ar955x_1p0_mac_postamble);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530276
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200277 /* bb */
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200278 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200279 ar955x_1p0_baseband_core);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200280 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200281 ar955x_1p0_baseband_postamble);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200282
283 /* radio */
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200284 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200285 ar955x_1p0_radio_core);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200286 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200287 ar955x_1p0_radio_postamble);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200288
289 /* soc */
290 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200291 ar955x_1p0_soc_preamble);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200292 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200293 ar955x_1p0_soc_postamble);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200294
295 /* rx/tx gain */
296 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200297 ar955x_1p0_common_wo_xlna_rx_gain_table);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200298 INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds,
Felix Fietkaua3645172012-07-15 19:53:33 +0200299 ar955x_1p0_common_wo_xlna_rx_gain_bounds);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200300 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200301 ar955x_1p0_modes_xpa_tx_gain_table);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200302
303 /* Fast clock modal settings */
304 INIT_INI_ARRAY(&ah->iniModesFastClock,
Felix Fietkaua3645172012-07-15 19:53:33 +0200305 ar955x_1p0_modes_fast_clock);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700306 } else if (AR_SREV_9580(ah)) {
307 /* mac */
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700308 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200309 ar9580_1p0_mac_core);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700310 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200311 ar9580_1p0_mac_postamble);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700312
313 /* bb */
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700314 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200315 ar9580_1p0_baseband_core);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700316 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200317 ar9580_1p0_baseband_postamble);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700318
319 /* radio */
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700320 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200321 ar9580_1p0_radio_core);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700322 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200323 ar9580_1p0_radio_postamble);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700324
325 /* soc */
326 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200327 ar9580_1p0_soc_preamble);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700328 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200329 ar9580_1p0_soc_postamble);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700330
331 /* rx/tx gain */
332 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200333 ar9580_1p0_rx_gain_table);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700334 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200335 ar9580_1p0_low_ob_db_tx_gain_table);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700336
Felix Fietkauc7d36f92012-03-14 16:40:31 +0100337 INIT_INI_ARRAY(&ah->iniModesFastClock,
Felix Fietkaua3645172012-07-15 19:53:33 +0200338 ar9580_1p0_modes_fast_clock);
Sujith Manoharan3777f7d2013-11-19 12:11:13 +0530339 } else if (AR_SREV_9565_11_OR_LATER(ah)) {
340 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
341 ar9565_1p1_mac_core);
342 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
343 ar9565_1p1_mac_postamble);
344
345 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
346 ar9565_1p1_baseband_core);
347 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
348 ar9565_1p1_baseband_postamble);
349
350 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
351 ar9565_1p1_radio_core);
352 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
353 ar9565_1p1_radio_postamble);
354
355 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
356 ar9565_1p1_soc_preamble);
357 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
358 ar9565_1p1_soc_postamble);
359
360 INIT_INI_ARRAY(&ah->iniModesRxGain,
361 ar9565_1p1_Common_rx_gain_table);
362 INIT_INI_ARRAY(&ah->iniModesTxGain,
363 ar9565_1p1_Modes_lowest_ob_db_tx_gain_table);
364
365 INIT_INI_ARRAY(&ah->iniPcieSerdes,
366 ar9565_1p1_pciephy_clkreq_disable_L1);
367 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
368 ar9565_1p1_pciephy_clkreq_disable_L1);
369
370 INIT_INI_ARRAY(&ah->iniModesFastClock,
371 ar9565_1p1_modes_fast_clock);
372 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
373 ar9565_1p1_baseband_core_txfir_coeff_japan_2484);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530374 } else if (AR_SREV_9565(ah)) {
375 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
376 ar9565_1p0_mac_core);
377 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
378 ar9565_1p0_mac_postamble);
379
380 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
381 ar9565_1p0_baseband_core);
382 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
383 ar9565_1p0_baseband_postamble);
384
385 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
386 ar9565_1p0_radio_core);
387 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
388 ar9565_1p0_radio_postamble);
389
390 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
391 ar9565_1p0_soc_preamble);
392 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
393 ar9565_1p0_soc_postamble);
394
395 INIT_INI_ARRAY(&ah->iniModesRxGain,
396 ar9565_1p0_Common_rx_gain_table);
397 INIT_INI_ARRAY(&ah->iniModesTxGain,
398 ar9565_1p0_Modes_lowest_ob_db_tx_gain_table);
399
400 INIT_INI_ARRAY(&ah->iniPcieSerdes,
Rajkumar Manoharan84464842012-10-25 17:16:51 +0530401 ar9565_1p0_pciephy_clkreq_disable_L1);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530402 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
Rajkumar Manoharan84464842012-10-25 17:16:51 +0530403 ar9565_1p0_pciephy_clkreq_disable_L1);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530404
405 INIT_INI_ARRAY(&ah->iniModesFastClock,
406 ar9565_1p0_modes_fast_clock);
Sujith Manoharan6d5228f2013-09-03 10:28:56 +0530407 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
408 ar9565_1p0_baseband_core_txfir_coeff_japan_2484);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800409 } else {
410 /* mac */
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800411 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200412 ar9300_2p2_mac_core);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800413 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200414 ar9300_2p2_mac_postamble);
Luis R. Rodriguez72846352010-05-12 21:15:05 -0400415
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800416 /* bb */
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800417 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200418 ar9300_2p2_baseband_core);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800419 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200420 ar9300_2p2_baseband_postamble);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800421
422 /* radio */
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800423 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200424 ar9300_2p2_radio_core);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800425 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200426 ar9300_2p2_radio_postamble);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800427
428 /* soc */
429 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200430 ar9300_2p2_soc_preamble);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800431 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200432 ar9300_2p2_soc_postamble);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800433
434 /* rx/tx gain */
435 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200436 ar9300Common_rx_gain_table_2p2);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800437 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200438 ar9300Modes_lowest_ob_db_tx_gain_table_2p2);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800439
440 /* Load PCIE SERDES settings from INI */
441
442 /* Awake Setting */
443
444 INIT_INI_ARRAY(&ah->iniPcieSerdes,
Felix Fietkaua3645172012-07-15 19:53:33 +0200445 ar9300PciePhy_pll_on_clkreq_disable_L1_2p2);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800446
447 /* Sleep Setting */
448
449 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
Felix Fietkaua3645172012-07-15 19:53:33 +0200450 ar9300PciePhy_pll_on_clkreq_disable_L1_2p2);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800451
452 /* Fast clock modal settings */
Felix Fietkauc7d36f92012-03-14 16:40:31 +0100453 INIT_INI_ARRAY(&ah->iniModesFastClock,
Felix Fietkaua3645172012-07-15 19:53:33 +0200454 ar9300Modes_fast_clock_2p2);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800455 }
Luis R. Rodriguez72846352010-05-12 21:15:05 -0400456}
457
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530458static void ar9003_tx_gain_table_mode0(struct ath_hw *ah)
459{
460 if (AR_SREV_9330_12(ah))
461 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200462 ar9331_modes_lowest_ob_db_tx_gain_1p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530463 else if (AR_SREV_9330_11(ah))
464 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200465 ar9331_modes_lowest_ob_db_tx_gain_1p1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530466 else if (AR_SREV_9340(ah))
467 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200468 ar9340Modes_lowest_ob_db_tx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530469 else if (AR_SREV_9485_11_OR_LATER(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530470 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200471 ar9485_modes_lowest_ob_db_tx_gain_1_1);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200472 else if (AR_SREV_9550(ah))
473 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200474 ar955x_1p0_modes_xpa_tx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530475 else if (AR_SREV_9580(ah))
476 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200477 ar9580_1p0_lowest_ob_db_tx_gain_table);
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530478 else if (AR_SREV_9462_21(ah))
479 INIT_INI_ARRAY(&ah->iniModesTxGain,
480 ar9462_2p1_modes_low_ob_db_tx_gain);
Rajkumar Manoharan423e38e2011-10-13 11:00:44 +0530481 else if (AR_SREV_9462_20(ah))
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530482 INIT_INI_ARRAY(&ah->iniModesTxGain,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530483 ar9462_2p0_modes_low_ob_db_tx_gain);
Sujith Manoharan3777f7d2013-11-19 12:11:13 +0530484 else if (AR_SREV_9565_11(ah))
485 INIT_INI_ARRAY(&ah->iniModesTxGain,
486 ar9565_1p1_modes_low_ob_db_tx_gain_table);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530487 else if (AR_SREV_9565(ah))
488 INIT_INI_ARRAY(&ah->iniModesTxGain,
489 ar9565_1p0_modes_low_ob_db_tx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530490 else
491 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200492 ar9300Modes_lowest_ob_db_tx_gain_table_2p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530493}
494
495static void ar9003_tx_gain_table_mode1(struct ath_hw *ah)
496{
497 if (AR_SREV_9330_12(ah))
498 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200499 ar9331_modes_high_ob_db_tx_gain_1p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530500 else if (AR_SREV_9330_11(ah))
501 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200502 ar9331_modes_high_ob_db_tx_gain_1p1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530503 else if (AR_SREV_9340(ah))
504 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200505 ar9340Modes_high_ob_db_tx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530506 else if (AR_SREV_9485_11_OR_LATER(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530507 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200508 ar9485Modes_high_ob_db_tx_gain_1_1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530509 else if (AR_SREV_9580(ah))
510 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200511 ar9580_1p0_high_ob_db_tx_gain_table);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200512 else if (AR_SREV_9550(ah))
513 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200514 ar955x_1p0_modes_no_xpa_tx_gain_table);
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530515 else if (AR_SREV_9462_21(ah))
516 INIT_INI_ARRAY(&ah->iniModesTxGain,
517 ar9462_2p1_modes_high_ob_db_tx_gain);
Rajkumar Manoharan423e38e2011-10-13 11:00:44 +0530518 else if (AR_SREV_9462_20(ah))
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530519 INIT_INI_ARRAY(&ah->iniModesTxGain,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530520 ar9462_2p0_modes_high_ob_db_tx_gain);
Sujith Manoharan3777f7d2013-11-19 12:11:13 +0530521 else if (AR_SREV_9565_11(ah))
522 INIT_INI_ARRAY(&ah->iniModesTxGain,
523 ar9565_1p1_modes_high_ob_db_tx_gain_table);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530524 else if (AR_SREV_9565(ah))
525 INIT_INI_ARRAY(&ah->iniModesTxGain,
526 ar9565_1p0_modes_high_ob_db_tx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530527 else
528 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200529 ar9300Modes_high_ob_db_tx_gain_table_2p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530530}
531
532static void ar9003_tx_gain_table_mode2(struct ath_hw *ah)
533{
534 if (AR_SREV_9330_12(ah))
535 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200536 ar9331_modes_low_ob_db_tx_gain_1p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530537 else if (AR_SREV_9330_11(ah))
538 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200539 ar9331_modes_low_ob_db_tx_gain_1p1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530540 else if (AR_SREV_9340(ah))
541 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200542 ar9340Modes_low_ob_db_tx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530543 else if (AR_SREV_9485_11_OR_LATER(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530544 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200545 ar9485Modes_low_ob_db_tx_gain_1_1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530546 else if (AR_SREV_9580(ah))
547 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200548 ar9580_1p0_low_ob_db_tx_gain_table);
Sujith Manoharan3777f7d2013-11-19 12:11:13 +0530549 else if (AR_SREV_9565_11(ah))
550 INIT_INI_ARRAY(&ah->iniModesTxGain,
551 ar9565_1p1_modes_low_ob_db_tx_gain_table);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530552 else if (AR_SREV_9565(ah))
553 INIT_INI_ARRAY(&ah->iniModesTxGain,
554 ar9565_1p0_modes_low_ob_db_tx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530555 else
556 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200557 ar9300Modes_low_ob_db_tx_gain_table_2p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530558}
559
560static void ar9003_tx_gain_table_mode3(struct ath_hw *ah)
561{
562 if (AR_SREV_9330_12(ah))
563 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200564 ar9331_modes_high_power_tx_gain_1p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530565 else if (AR_SREV_9330_11(ah))
566 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200567 ar9331_modes_high_power_tx_gain_1p1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530568 else if (AR_SREV_9340(ah))
569 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200570 ar9340Modes_high_power_tx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530571 else if (AR_SREV_9485_11_OR_LATER(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530572 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200573 ar9485Modes_high_power_tx_gain_1_1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530574 else if (AR_SREV_9580(ah))
575 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200576 ar9580_1p0_high_power_tx_gain_table);
Sujith Manoharan3777f7d2013-11-19 12:11:13 +0530577 else if (AR_SREV_9565_11(ah))
578 INIT_INI_ARRAY(&ah->iniModesTxGain,
579 ar9565_1p1_modes_high_power_tx_gain_table);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530580 else if (AR_SREV_9565(ah))
581 INIT_INI_ARRAY(&ah->iniModesTxGain,
582 ar9565_1p0_modes_high_power_tx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530583 else
584 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200585 ar9300Modes_high_power_tx_gain_table_2p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530586}
587
Felix Fietkaub05a0112012-07-15 19:53:32 +0200588static void ar9003_tx_gain_table_mode4(struct ath_hw *ah)
589{
590 if (AR_SREV_9340(ah))
591 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200592 ar9340Modes_mixed_ob_db_tx_gain_table_1p0);
Felix Fietkaub05a0112012-07-15 19:53:32 +0200593 else if (AR_SREV_9580(ah))
594 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200595 ar9580_1p0_mixed_ob_db_tx_gain_table);
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530596 else if (AR_SREV_9462_21(ah))
597 INIT_INI_ARRAY(&ah->iniModesTxGain,
598 ar9462_2p1_modes_mix_ob_db_tx_gain);
Sujith Manoharan9a54c172013-06-25 12:29:23 +0530599 else if (AR_SREV_9462_20(ah))
600 INIT_INI_ARRAY(&ah->iniModesTxGain,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530601 ar9462_2p0_modes_mix_ob_db_tx_gain);
Felix Fietkaueab6d792013-01-10 19:41:52 +0100602 else
603 INIT_INI_ARRAY(&ah->iniModesTxGain,
604 ar9300Modes_mixed_ob_db_tx_gain_table_2p2);
Felix Fietkaub05a0112012-07-15 19:53:32 +0200605}
606
Felix Fietkaueab6d792013-01-10 19:41:52 +0100607static void ar9003_tx_gain_table_mode5(struct ath_hw *ah)
608{
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530609 if (AR_SREV_9485_11_OR_LATER(ah))
Felix Fietkaueab6d792013-01-10 19:41:52 +0100610 INIT_INI_ARRAY(&ah->iniModesTxGain,
611 ar9485Modes_green_ob_db_tx_gain_1_1);
612 else if (AR_SREV_9340(ah))
613 INIT_INI_ARRAY(&ah->iniModesTxGain,
614 ar9340Modes_ub124_tx_gain_table_1p0);
615 else if (AR_SREV_9580(ah))
616 INIT_INI_ARRAY(&ah->iniModesTxGain,
617 ar9580_1p0_type5_tx_gain_table);
618 else if (AR_SREV_9300_22(ah))
619 INIT_INI_ARRAY(&ah->iniModesTxGain,
620 ar9300Modes_type5_tx_gain_table_2p2);
621}
622
623static void ar9003_tx_gain_table_mode6(struct ath_hw *ah)
624{
625 if (AR_SREV_9340(ah))
626 INIT_INI_ARRAY(&ah->iniModesTxGain,
627 ar9340Modes_low_ob_db_and_spur_tx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530628 else if (AR_SREV_9485_11_OR_LATER(ah))
Felix Fietkaueab6d792013-01-10 19:41:52 +0100629 INIT_INI_ARRAY(&ah->iniModesTxGain,
630 ar9485Modes_green_spur_ob_db_tx_gain_1_1);
631 else if (AR_SREV_9580(ah))
632 INIT_INI_ARRAY(&ah->iniModesTxGain,
633 ar9580_1p0_type6_tx_gain_table);
634}
635
Sujith Manoharan8fd007a2013-11-05 05:54:59 +0530636static void ar9003_tx_gain_table_mode7(struct ath_hw *ah)
637{
638 if (AR_SREV_9340(ah))
639 INIT_INI_ARRAY(&ah->iniModesTxGain,
640 ar9340_cus227_tx_gain_table_1p0);
641}
642
Felix Fietkaueab6d792013-01-10 19:41:52 +0100643typedef void (*ath_txgain_tab)(struct ath_hw *ah);
644
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400645static void ar9003_tx_gain_table_apply(struct ath_hw *ah)
646{
Felix Fietkaueab6d792013-01-10 19:41:52 +0100647 static const ath_txgain_tab modes[] = {
648 ar9003_tx_gain_table_mode0,
649 ar9003_tx_gain_table_mode1,
650 ar9003_tx_gain_table_mode2,
651 ar9003_tx_gain_table_mode3,
652 ar9003_tx_gain_table_mode4,
653 ar9003_tx_gain_table_mode5,
654 ar9003_tx_gain_table_mode6,
Sujith Manoharan8fd007a2013-11-05 05:54:59 +0530655 ar9003_tx_gain_table_mode7,
Felix Fietkaueab6d792013-01-10 19:41:52 +0100656 };
657 int idx = ar9003_hw_get_tx_gain_idx(ah);
658
659 if (idx >= ARRAY_SIZE(modes))
660 idx = 0;
661
662 modes[idx](ah);
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400663}
664
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530665static void ar9003_rx_gain_table_mode0(struct ath_hw *ah)
666{
667 if (AR_SREV_9330_12(ah))
668 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200669 ar9331_common_rx_gain_1p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530670 else if (AR_SREV_9330_11(ah))
671 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200672 ar9331_common_rx_gain_1p1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530673 else if (AR_SREV_9340(ah))
674 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200675 ar9340Common_rx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530676 else if (AR_SREV_9485_11_OR_LATER(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530677 INIT_INI_ARRAY(&ah->iniModesRxGain,
Sujith Manoharana796a1d2012-12-26 12:27:39 +0530678 ar9485_common_rx_gain_1_1);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200679 else if (AR_SREV_9550(ah)) {
680 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200681 ar955x_1p0_common_rx_gain_table);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200682 INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds,
Felix Fietkaua3645172012-07-15 19:53:33 +0200683 ar955x_1p0_common_rx_gain_bounds);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200684 } else if (AR_SREV_9580(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530685 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200686 ar9580_1p0_rx_gain_table);
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530687 else if (AR_SREV_9462_21(ah))
688 INIT_INI_ARRAY(&ah->iniModesRxGain,
689 ar9462_2p1_common_rx_gain);
Rajkumar Manoharan423e38e2011-10-13 11:00:44 +0530690 else if (AR_SREV_9462_20(ah))
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530691 INIT_INI_ARRAY(&ah->iniModesRxGain,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530692 ar9462_2p0_common_rx_gain);
Sujith Manoharan3777f7d2013-11-19 12:11:13 +0530693 else if (AR_SREV_9565_11(ah))
694 INIT_INI_ARRAY(&ah->iniModesRxGain,
695 ar9565_1p1_Common_rx_gain_table);
Sujith Manoharan6ac21502013-09-02 13:59:02 +0530696 else if (AR_SREV_9565(ah))
697 INIT_INI_ARRAY(&ah->iniModesRxGain,
698 ar9565_1p0_Common_rx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530699 else
700 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200701 ar9300Common_rx_gain_table_2p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530702}
703
704static void ar9003_rx_gain_table_mode1(struct ath_hw *ah)
705{
706 if (AR_SREV_9330_12(ah))
707 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200708 ar9331_common_wo_xlna_rx_gain_1p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530709 else if (AR_SREV_9330_11(ah))
710 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200711 ar9331_common_wo_xlna_rx_gain_1p1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530712 else if (AR_SREV_9340(ah))
713 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200714 ar9340Common_wo_xlna_rx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530715 else if (AR_SREV_9485_11_OR_LATER(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530716 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200717 ar9485Common_wo_xlna_rx_gain_1_1);
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530718 else if (AR_SREV_9462_21(ah))
719 INIT_INI_ARRAY(&ah->iniModesRxGain,
720 ar9462_2p1_common_wo_xlna_rx_gain);
Rajkumar Manoharan423e38e2011-10-13 11:00:44 +0530721 else if (AR_SREV_9462_20(ah))
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530722 INIT_INI_ARRAY(&ah->iniModesRxGain,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530723 ar9462_2p0_common_wo_xlna_rx_gain);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200724 else if (AR_SREV_9550(ah)) {
725 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200726 ar955x_1p0_common_wo_xlna_rx_gain_table);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200727 INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds,
Felix Fietkaua3645172012-07-15 19:53:33 +0200728 ar955x_1p0_common_wo_xlna_rx_gain_bounds);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200729 } else if (AR_SREV_9580(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530730 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200731 ar9580_1p0_wo_xlna_rx_gain_table);
Sujith Manoharan3777f7d2013-11-19 12:11:13 +0530732 else if (AR_SREV_9565_11(ah))
733 INIT_INI_ARRAY(&ah->iniModesRxGain,
734 ar9565_1p1_common_wo_xlna_rx_gain_table);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530735 else if (AR_SREV_9565(ah))
736 INIT_INI_ARRAY(&ah->iniModesRxGain,
737 ar9565_1p0_common_wo_xlna_rx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530738 else
739 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200740 ar9300Common_wo_xlna_rx_gain_table_2p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530741}
742
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530743static void ar9003_rx_gain_table_mode2(struct ath_hw *ah)
744{
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530745 if (AR_SREV_9462_21(ah)) {
746 INIT_INI_ARRAY(&ah->iniModesRxGain,
747 ar9462_2p1_common_mixed_rx_gain);
748 INIT_INI_ARRAY(&ah->ini_modes_rxgain_bb_core,
749 ar9462_2p1_baseband_core_mix_rxgain);
750 INIT_INI_ARRAY(&ah->ini_modes_rxgain_bb_postamble,
751 ar9462_2p1_baseband_postamble_mix_rxgain);
752 INIT_INI_ARRAY(&ah->ini_modes_rxgain_5g_xlna,
753 ar9462_2p1_baseband_postamble_5g_xlna);
754 } else if (AR_SREV_9462_20(ah)) {
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530755 INIT_INI_ARRAY(&ah->iniModesRxGain,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530756 ar9462_2p0_common_mixed_rx_gain);
Sujith Manoharanc177fab2013-06-18 15:42:38 +0530757 INIT_INI_ARRAY(&ah->ini_modes_rxgain_bb_core,
758 ar9462_2p0_baseband_core_mix_rxgain);
759 INIT_INI_ARRAY(&ah->ini_modes_rxgain_bb_postamble,
760 ar9462_2p0_baseband_postamble_mix_rxgain);
Sujith Manoharan51dbd0a2013-06-18 10:13:42 +0530761 INIT_INI_ARRAY(&ah->ini_modes_rxgain_5g_xlna,
762 ar9462_2p0_baseband_postamble_5g_xlna);
763 }
764}
765
766static void ar9003_rx_gain_table_mode3(struct ath_hw *ah)
767{
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530768 if (AR_SREV_9462_21(ah)) {
769 INIT_INI_ARRAY(&ah->iniModesRxGain,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530770 ar9462_2p1_common_5g_xlna_only_rxgain);
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530771 INIT_INI_ARRAY(&ah->ini_modes_rxgain_5g_xlna,
772 ar9462_2p1_baseband_postamble_5g_xlna);
773 } else if (AR_SREV_9462_20(ah)) {
Sujith Manoharan51dbd0a2013-06-18 10:13:42 +0530774 INIT_INI_ARRAY(&ah->iniModesRxGain,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530775 ar9462_2p0_common_5g_xlna_only_rxgain);
Sujith Manoharan51dbd0a2013-06-18 10:13:42 +0530776 INIT_INI_ARRAY(&ah->ini_modes_rxgain_5g_xlna,
777 ar9462_2p0_baseband_postamble_5g_xlna);
778 }
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530779}
780
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400781static void ar9003_rx_gain_table_apply(struct ath_hw *ah)
782{
783 switch (ar9003_hw_get_rx_gain_idx(ah)) {
784 case 0:
785 default:
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530786 ar9003_rx_gain_table_mode0(ah);
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400787 break;
788 case 1:
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530789 ar9003_rx_gain_table_mode1(ah);
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400790 break;
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530791 case 2:
792 ar9003_rx_gain_table_mode2(ah);
793 break;
Sujith Manoharan51dbd0a2013-06-18 10:13:42 +0530794 case 3:
795 ar9003_rx_gain_table_mode3(ah);
796 break;
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400797 }
798}
799
800/* set gain table pointers according to values read from the eeprom */
801static void ar9003_hw_init_mode_gain_regs(struct ath_hw *ah)
802{
803 ar9003_tx_gain_table_apply(ah);
804 ar9003_rx_gain_table_apply(ah);
805}
806
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400807/*
808 * Helper for ASPM support.
809 *
810 * Disable PLL when in L0s as well as receiver clock when in L1.
811 * This power saving option must be enabled through the SerDes.
812 *
813 * Programming the SerDes must go through the same 288 bit serial shift
814 * register as the other analog registers. Hence the 9 writes.
815 */
816static void ar9003_hw_configpcipowersave(struct ath_hw *ah,
Stanislaw Gruszka84c87dc2011-08-05 13:10:32 +0200817 bool power_off)
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400818{
Sujith Manoharanc6fc7e62013-10-29 11:52:06 +0530819 unsigned int i;
820 struct ar5416IniArray *array;
821
Sujith Manoharanb380a43b2013-08-25 14:43:09 +0530822 /*
823 * Increase L1 Entry Latency. Some WB222 boards don't have
824 * this change in eeprom/OTP.
825 *
826 */
827 if (AR_SREV_9462(ah)) {
828 u32 val = ah->config.aspm_l1_fix;
829 if ((val & 0xff000000) == 0x17000000) {
830 val &= 0x00ffffff;
831 val |= 0x27000000;
832 REG_WRITE(ah, 0x570c, val);
833 }
834 }
835
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400836 /* Nothing to do on restore for 11N */
Stanislaw Gruszka84c87dc2011-08-05 13:10:32 +0200837 if (!power_off /* !restore */) {
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400838 /* set bit 19 to allow forcing of pcie core into L1 state */
839 REG_SET_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA);
Sujith Manoharand1ae25a2013-08-25 16:30:40 +0530840 REG_WRITE(ah, AR_WA, ah->WARegVal);
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400841 }
Luis R. Rodriguez653fe372010-06-21 18:38:48 -0400842
843 /*
844 * Configire PCIE after Ini init. SERDES values now come from ini file
845 * This enables PCIe low power mode.
846 */
Sujith Manoharanc6fc7e62013-10-29 11:52:06 +0530847 array = power_off ? &ah->iniPcieSerdes :
848 &ah->iniPcieSerdesLowPower;
Luis R. Rodriguez653fe372010-06-21 18:38:48 -0400849
Sujith Manoharanc6fc7e62013-10-29 11:52:06 +0530850 for (i = 0; i < array->ia_rows; i++) {
851 REG_WRITE(ah,
852 INI_RA(array, i, 0),
853 INI_RA(array, i, 1));
Luis R. Rodriguez653fe372010-06-21 18:38:48 -0400854 }
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400855}
856
857/* Sets up the AR9003 hardware familiy callbacks */
858void ar9003_hw_attach_ops(struct ath_hw *ah)
859{
860 struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
861 struct ath_hw_ops *ops = ath9k_hw_ops(ah);
862
Felix Fietkau6aaacd82013-01-13 19:54:58 +0100863 ar9003_hw_init_mode_regs(ah);
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400864 priv_ops->init_mode_gain_regs = ar9003_hw_init_mode_gain_regs;
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400865
866 ops->config_pci_powersave = ar9003_hw_configpcipowersave;
867
868 ar9003_hw_attach_phy_ops(ah);
869 ar9003_hw_attach_calib_ops(ah);
870 ar9003_hw_attach_mac_ops(ah);
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400871}