blob: d8c1eee8ea53014dfde6536d507ec36862b0062f [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,
Sujith Manoharan2c8672c2013-12-02 09:56:31 +0530152 ar9340Modes_fast_clock_1p0);
153 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
154 ar9340_1p0_baseband_core_txfir_coeff_japan_2484);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530155
Felix Fietkauc7d36f92012-03-14 16:40:31 +0100156 if (!ah->is_clk_25mhz)
157 INIT_INI_ARRAY(&ah->iniAdditional,
Felix Fietkaua3645172012-07-15 19:53:33 +0200158 ar9340_1p0_radio_core_40M);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530159 } else if (AR_SREV_9485_11_OR_LATER(ah)) {
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530160 /* mac */
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530161 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200162 ar9485_1_1_mac_core);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530163 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200164 ar9485_1_1_mac_postamble);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530165
166 /* bb */
Felix Fietkaua3645172012-07-15 19:53:33 +0200167 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], ar9485_1_1);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530168 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200169 ar9485_1_1_baseband_core);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530170 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200171 ar9485_1_1_baseband_postamble);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530172
173 /* radio */
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530174 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200175 ar9485_1_1_radio_core);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530176 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200177 ar9485_1_1_radio_postamble);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530178
179 /* soc */
180 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200181 ar9485_1_1_soc_preamble);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530182
183 /* rx/tx gain */
184 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200185 ar9485Common_wo_xlna_rx_gain_1_1);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530186 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200187 ar9485_modes_lowest_ob_db_tx_gain_1_1);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530188
Sujith Manoharan57527f82012-11-13 11:33:53 +0530189 /* Japan 2484 Mhz CCK */
190 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
191 ar9485_1_1_baseband_core_txfir_coeff_japan_2484);
192
Sujith Manoharan2d22c7d2013-11-08 11:45:25 +0530193 if (ah->config.no_pll_pwrsave) {
194 INIT_INI_ARRAY(&ah->iniPcieSerdes,
195 ar9485_1_1_pcie_phy_clkreq_disable_L1);
196 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
197 ar9485_1_1_pcie_phy_clkreq_disable_L1);
198 } else {
199 INIT_INI_ARRAY(&ah->iniPcieSerdes,
200 ar9485_1_1_pll_on_cdr_on_clkreq_disable_L1);
201 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
202 ar9485_1_1_pll_on_cdr_on_clkreq_disable_L1);
203 }
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530204 } else if (AR_SREV_9462_21(ah)) {
205 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
206 ar9462_2p1_mac_core);
207 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
208 ar9462_2p1_mac_postamble);
209 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
210 ar9462_2p1_baseband_core);
211 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
212 ar9462_2p1_baseband_postamble);
213 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
214 ar9462_2p1_radio_core);
215 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
216 ar9462_2p1_radio_postamble);
217 INIT_INI_ARRAY(&ah->ini_radio_post_sys2ant,
218 ar9462_2p1_radio_postamble_sys2ant);
219 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
220 ar9462_2p1_soc_preamble);
221 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
222 ar9462_2p1_soc_postamble);
223 INIT_INI_ARRAY(&ah->iniModesRxGain,
224 ar9462_2p1_common_rx_gain);
225 INIT_INI_ARRAY(&ah->iniModesFastClock,
226 ar9462_2p1_modes_fast_clock);
227 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
228 ar9462_2p1_baseband_core_txfir_coeff_japan_2484);
Sujith Manoharanf51ecd72013-10-29 11:35:31 +0530229 INIT_INI_ARRAY(&ah->iniPcieSerdes,
230 ar9462_2p1_pciephy_clkreq_disable_L1);
231 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
232 ar9462_2p1_pciephy_clkreq_disable_L1);
Rajkumar Manoharan423e38e2011-10-13 11:00:44 +0530233 } else if (AR_SREV_9462_20(ah)) {
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530234
Felix Fietkaua3645172012-07-15 19:53:33 +0200235 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], ar9462_2p0_mac_core);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530236 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200237 ar9462_2p0_mac_postamble);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530238
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530239 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200240 ar9462_2p0_baseband_core);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530241 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200242 ar9462_2p0_baseband_postamble);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530243
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530244 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200245 ar9462_2p0_radio_core);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530246 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200247 ar9462_2p0_radio_postamble);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530248 INIT_INI_ARRAY(&ah->ini_radio_post_sys2ant,
Felix Fietkaua3645172012-07-15 19:53:33 +0200249 ar9462_2p0_radio_postamble_sys2ant);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530250
251 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200252 ar9462_2p0_soc_preamble);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530253 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200254 ar9462_2p0_soc_postamble);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530255
256 INIT_INI_ARRAY(&ah->iniModesRxGain,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530257 ar9462_2p0_common_rx_gain);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530258
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530259 /* Awake -> Sleep Setting */
260 INIT_INI_ARRAY(&ah->iniPcieSerdes,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530261 ar9462_2p0_pciephy_clkreq_disable_L1);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530262 /* Sleep -> Awake Setting */
263 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530264 ar9462_2p0_pciephy_clkreq_disable_L1);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530265
266 /* Fast clock modal settings */
Felix Fietkauc7d36f92012-03-14 16:40:31 +0100267 INIT_INI_ARRAY(&ah->iniModesFastClock,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530268 ar9462_2p0_modes_fast_clock);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530269
270 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
Sujith Manoharan57527f82012-11-13 11:33:53 +0530271 ar9462_2p0_baseband_core_txfir_coeff_japan_2484);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200272 } else if (AR_SREV_9550(ah)) {
273 /* mac */
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200274 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200275 ar955x_1p0_mac_core);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200276 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200277 ar955x_1p0_mac_postamble);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530278
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200279 /* bb */
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200280 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200281 ar955x_1p0_baseband_core);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200282 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200283 ar955x_1p0_baseband_postamble);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200284
285 /* radio */
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200286 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200287 ar955x_1p0_radio_core);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200288 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200289 ar955x_1p0_radio_postamble);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200290
291 /* soc */
292 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200293 ar955x_1p0_soc_preamble);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200294 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200295 ar955x_1p0_soc_postamble);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200296
297 /* rx/tx gain */
298 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200299 ar955x_1p0_common_wo_xlna_rx_gain_table);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200300 INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds,
Felix Fietkaua3645172012-07-15 19:53:33 +0200301 ar955x_1p0_common_wo_xlna_rx_gain_bounds);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200302 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200303 ar955x_1p0_modes_xpa_tx_gain_table);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200304
305 /* Fast clock modal settings */
306 INIT_INI_ARRAY(&ah->iniModesFastClock,
Felix Fietkaua3645172012-07-15 19:53:33 +0200307 ar955x_1p0_modes_fast_clock);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700308 } else if (AR_SREV_9580(ah)) {
309 /* mac */
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700310 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200311 ar9580_1p0_mac_core);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700312 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200313 ar9580_1p0_mac_postamble);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700314
315 /* bb */
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700316 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200317 ar9580_1p0_baseband_core);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700318 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200319 ar9580_1p0_baseband_postamble);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700320
321 /* radio */
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700322 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200323 ar9580_1p0_radio_core);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700324 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200325 ar9580_1p0_radio_postamble);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700326
327 /* soc */
328 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200329 ar9580_1p0_soc_preamble);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700330 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200331 ar9580_1p0_soc_postamble);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700332
333 /* rx/tx gain */
334 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200335 ar9580_1p0_rx_gain_table);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700336 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200337 ar9580_1p0_low_ob_db_tx_gain_table);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700338
Felix Fietkauc7d36f92012-03-14 16:40:31 +0100339 INIT_INI_ARRAY(&ah->iniModesFastClock,
Sujith Manoharan2c8672c2013-12-02 09:56:31 +0530340 ar9580_1p0_modes_fast_clock);
341 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
342 ar9580_1p0_baseband_core_txfir_coeff_japan_2484);
Sujith Manoharan3777f7d2013-11-19 12:11:13 +0530343 } else if (AR_SREV_9565_11_OR_LATER(ah)) {
344 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
345 ar9565_1p1_mac_core);
346 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
347 ar9565_1p1_mac_postamble);
348
349 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
350 ar9565_1p1_baseband_core);
351 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
352 ar9565_1p1_baseband_postamble);
353
354 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
355 ar9565_1p1_radio_core);
356 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
357 ar9565_1p1_radio_postamble);
358
359 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
360 ar9565_1p1_soc_preamble);
361 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
362 ar9565_1p1_soc_postamble);
363
364 INIT_INI_ARRAY(&ah->iniModesRxGain,
365 ar9565_1p1_Common_rx_gain_table);
366 INIT_INI_ARRAY(&ah->iniModesTxGain,
367 ar9565_1p1_Modes_lowest_ob_db_tx_gain_table);
368
369 INIT_INI_ARRAY(&ah->iniPcieSerdes,
370 ar9565_1p1_pciephy_clkreq_disable_L1);
371 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
372 ar9565_1p1_pciephy_clkreq_disable_L1);
373
374 INIT_INI_ARRAY(&ah->iniModesFastClock,
375 ar9565_1p1_modes_fast_clock);
376 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
377 ar9565_1p1_baseband_core_txfir_coeff_japan_2484);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530378 } else if (AR_SREV_9565(ah)) {
379 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
380 ar9565_1p0_mac_core);
381 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
382 ar9565_1p0_mac_postamble);
383
384 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
385 ar9565_1p0_baseband_core);
386 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
387 ar9565_1p0_baseband_postamble);
388
389 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
390 ar9565_1p0_radio_core);
391 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
392 ar9565_1p0_radio_postamble);
393
394 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
395 ar9565_1p0_soc_preamble);
396 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
397 ar9565_1p0_soc_postamble);
398
399 INIT_INI_ARRAY(&ah->iniModesRxGain,
400 ar9565_1p0_Common_rx_gain_table);
401 INIT_INI_ARRAY(&ah->iniModesTxGain,
402 ar9565_1p0_Modes_lowest_ob_db_tx_gain_table);
403
404 INIT_INI_ARRAY(&ah->iniPcieSerdes,
Rajkumar Manoharan84464842012-10-25 17:16:51 +0530405 ar9565_1p0_pciephy_clkreq_disable_L1);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530406 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
Rajkumar Manoharan84464842012-10-25 17:16:51 +0530407 ar9565_1p0_pciephy_clkreq_disable_L1);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530408
409 INIT_INI_ARRAY(&ah->iniModesFastClock,
410 ar9565_1p0_modes_fast_clock);
Sujith Manoharan6d5228f2013-09-03 10:28:56 +0530411 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
412 ar9565_1p0_baseband_core_txfir_coeff_japan_2484);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800413 } else {
414 /* mac */
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800415 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200416 ar9300_2p2_mac_core);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800417 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200418 ar9300_2p2_mac_postamble);
Luis R. Rodriguez72846352010-05-12 21:15:05 -0400419
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800420 /* bb */
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800421 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200422 ar9300_2p2_baseband_core);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800423 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200424 ar9300_2p2_baseband_postamble);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800425
426 /* radio */
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800427 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200428 ar9300_2p2_radio_core);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800429 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200430 ar9300_2p2_radio_postamble);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800431
432 /* soc */
433 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200434 ar9300_2p2_soc_preamble);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800435 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200436 ar9300_2p2_soc_postamble);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800437
438 /* rx/tx gain */
439 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200440 ar9300Common_rx_gain_table_2p2);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800441 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200442 ar9300Modes_lowest_ob_db_tx_gain_table_2p2);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800443
444 /* Load PCIE SERDES settings from INI */
445
446 /* Awake Setting */
447
448 INIT_INI_ARRAY(&ah->iniPcieSerdes,
Felix Fietkaua3645172012-07-15 19:53:33 +0200449 ar9300PciePhy_pll_on_clkreq_disable_L1_2p2);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800450
451 /* Sleep Setting */
452
453 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
Felix Fietkaua3645172012-07-15 19:53:33 +0200454 ar9300PciePhy_pll_on_clkreq_disable_L1_2p2);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800455
456 /* Fast clock modal settings */
Felix Fietkauc7d36f92012-03-14 16:40:31 +0100457 INIT_INI_ARRAY(&ah->iniModesFastClock,
Sujith Manoharan2c8672c2013-12-02 09:56:31 +0530458 ar9300Modes_fast_clock_2p2);
459 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
460 ar9300_2p2_baseband_core_txfir_coeff_japan_2484);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800461 }
Luis R. Rodriguez72846352010-05-12 21:15:05 -0400462}
463
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530464static void ar9003_tx_gain_table_mode0(struct ath_hw *ah)
465{
466 if (AR_SREV_9330_12(ah))
467 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200468 ar9331_modes_lowest_ob_db_tx_gain_1p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530469 else if (AR_SREV_9330_11(ah))
470 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200471 ar9331_modes_lowest_ob_db_tx_gain_1p1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530472 else if (AR_SREV_9340(ah))
473 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200474 ar9340Modes_lowest_ob_db_tx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530475 else if (AR_SREV_9485_11_OR_LATER(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530476 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200477 ar9485_modes_lowest_ob_db_tx_gain_1_1);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200478 else if (AR_SREV_9550(ah))
479 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200480 ar955x_1p0_modes_xpa_tx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530481 else if (AR_SREV_9580(ah))
482 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200483 ar9580_1p0_lowest_ob_db_tx_gain_table);
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530484 else if (AR_SREV_9462_21(ah))
485 INIT_INI_ARRAY(&ah->iniModesTxGain,
486 ar9462_2p1_modes_low_ob_db_tx_gain);
Rajkumar Manoharan423e38e2011-10-13 11:00:44 +0530487 else if (AR_SREV_9462_20(ah))
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530488 INIT_INI_ARRAY(&ah->iniModesTxGain,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530489 ar9462_2p0_modes_low_ob_db_tx_gain);
Sujith Manoharan3777f7d2013-11-19 12:11:13 +0530490 else if (AR_SREV_9565_11(ah))
491 INIT_INI_ARRAY(&ah->iniModesTxGain,
492 ar9565_1p1_modes_low_ob_db_tx_gain_table);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530493 else if (AR_SREV_9565(ah))
494 INIT_INI_ARRAY(&ah->iniModesTxGain,
495 ar9565_1p0_modes_low_ob_db_tx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530496 else
497 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200498 ar9300Modes_lowest_ob_db_tx_gain_table_2p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530499}
500
501static void ar9003_tx_gain_table_mode1(struct ath_hw *ah)
502{
503 if (AR_SREV_9330_12(ah))
504 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200505 ar9331_modes_high_ob_db_tx_gain_1p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530506 else if (AR_SREV_9330_11(ah))
507 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200508 ar9331_modes_high_ob_db_tx_gain_1p1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530509 else if (AR_SREV_9340(ah))
510 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200511 ar9340Modes_high_ob_db_tx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530512 else if (AR_SREV_9485_11_OR_LATER(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530513 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200514 ar9485Modes_high_ob_db_tx_gain_1_1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530515 else if (AR_SREV_9580(ah))
516 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200517 ar9580_1p0_high_ob_db_tx_gain_table);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200518 else if (AR_SREV_9550(ah))
519 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200520 ar955x_1p0_modes_no_xpa_tx_gain_table);
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530521 else if (AR_SREV_9462_21(ah))
522 INIT_INI_ARRAY(&ah->iniModesTxGain,
523 ar9462_2p1_modes_high_ob_db_tx_gain);
Rajkumar Manoharan423e38e2011-10-13 11:00:44 +0530524 else if (AR_SREV_9462_20(ah))
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530525 INIT_INI_ARRAY(&ah->iniModesTxGain,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530526 ar9462_2p0_modes_high_ob_db_tx_gain);
Sujith Manoharan3777f7d2013-11-19 12:11:13 +0530527 else if (AR_SREV_9565_11(ah))
528 INIT_INI_ARRAY(&ah->iniModesTxGain,
529 ar9565_1p1_modes_high_ob_db_tx_gain_table);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530530 else if (AR_SREV_9565(ah))
531 INIT_INI_ARRAY(&ah->iniModesTxGain,
532 ar9565_1p0_modes_high_ob_db_tx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530533 else
534 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200535 ar9300Modes_high_ob_db_tx_gain_table_2p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530536}
537
538static void ar9003_tx_gain_table_mode2(struct ath_hw *ah)
539{
540 if (AR_SREV_9330_12(ah))
541 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200542 ar9331_modes_low_ob_db_tx_gain_1p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530543 else if (AR_SREV_9330_11(ah))
544 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200545 ar9331_modes_low_ob_db_tx_gain_1p1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530546 else if (AR_SREV_9340(ah))
547 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200548 ar9340Modes_low_ob_db_tx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530549 else if (AR_SREV_9485_11_OR_LATER(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530550 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200551 ar9485Modes_low_ob_db_tx_gain_1_1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530552 else if (AR_SREV_9580(ah))
553 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200554 ar9580_1p0_low_ob_db_tx_gain_table);
Sujith Manoharan3777f7d2013-11-19 12:11:13 +0530555 else if (AR_SREV_9565_11(ah))
556 INIT_INI_ARRAY(&ah->iniModesTxGain,
557 ar9565_1p1_modes_low_ob_db_tx_gain_table);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530558 else if (AR_SREV_9565(ah))
559 INIT_INI_ARRAY(&ah->iniModesTxGain,
560 ar9565_1p0_modes_low_ob_db_tx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530561 else
562 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200563 ar9300Modes_low_ob_db_tx_gain_table_2p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530564}
565
566static void ar9003_tx_gain_table_mode3(struct ath_hw *ah)
567{
568 if (AR_SREV_9330_12(ah))
569 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200570 ar9331_modes_high_power_tx_gain_1p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530571 else if (AR_SREV_9330_11(ah))
572 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200573 ar9331_modes_high_power_tx_gain_1p1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530574 else if (AR_SREV_9340(ah))
575 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200576 ar9340Modes_high_power_tx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530577 else if (AR_SREV_9485_11_OR_LATER(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530578 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200579 ar9485Modes_high_power_tx_gain_1_1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530580 else if (AR_SREV_9580(ah))
581 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200582 ar9580_1p0_high_power_tx_gain_table);
Sujith Manoharan3777f7d2013-11-19 12:11:13 +0530583 else if (AR_SREV_9565_11(ah))
584 INIT_INI_ARRAY(&ah->iniModesTxGain,
585 ar9565_1p1_modes_high_power_tx_gain_table);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530586 else if (AR_SREV_9565(ah))
587 INIT_INI_ARRAY(&ah->iniModesTxGain,
588 ar9565_1p0_modes_high_power_tx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530589 else
590 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200591 ar9300Modes_high_power_tx_gain_table_2p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530592}
593
Felix Fietkaub05a0112012-07-15 19:53:32 +0200594static void ar9003_tx_gain_table_mode4(struct ath_hw *ah)
595{
596 if (AR_SREV_9340(ah))
597 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200598 ar9340Modes_mixed_ob_db_tx_gain_table_1p0);
Felix Fietkaub05a0112012-07-15 19:53:32 +0200599 else if (AR_SREV_9580(ah))
600 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200601 ar9580_1p0_mixed_ob_db_tx_gain_table);
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530602 else if (AR_SREV_9462_21(ah))
603 INIT_INI_ARRAY(&ah->iniModesTxGain,
604 ar9462_2p1_modes_mix_ob_db_tx_gain);
Sujith Manoharan9a54c172013-06-25 12:29:23 +0530605 else if (AR_SREV_9462_20(ah))
606 INIT_INI_ARRAY(&ah->iniModesTxGain,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530607 ar9462_2p0_modes_mix_ob_db_tx_gain);
Felix Fietkaueab6d792013-01-10 19:41:52 +0100608 else
609 INIT_INI_ARRAY(&ah->iniModesTxGain,
610 ar9300Modes_mixed_ob_db_tx_gain_table_2p2);
Felix Fietkaub05a0112012-07-15 19:53:32 +0200611}
612
Felix Fietkaueab6d792013-01-10 19:41:52 +0100613static void ar9003_tx_gain_table_mode5(struct ath_hw *ah)
614{
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530615 if (AR_SREV_9485_11_OR_LATER(ah))
Felix Fietkaueab6d792013-01-10 19:41:52 +0100616 INIT_INI_ARRAY(&ah->iniModesTxGain,
617 ar9485Modes_green_ob_db_tx_gain_1_1);
618 else if (AR_SREV_9340(ah))
619 INIT_INI_ARRAY(&ah->iniModesTxGain,
620 ar9340Modes_ub124_tx_gain_table_1p0);
621 else if (AR_SREV_9580(ah))
622 INIT_INI_ARRAY(&ah->iniModesTxGain,
623 ar9580_1p0_type5_tx_gain_table);
624 else if (AR_SREV_9300_22(ah))
625 INIT_INI_ARRAY(&ah->iniModesTxGain,
626 ar9300Modes_type5_tx_gain_table_2p2);
627}
628
629static void ar9003_tx_gain_table_mode6(struct ath_hw *ah)
630{
631 if (AR_SREV_9340(ah))
632 INIT_INI_ARRAY(&ah->iniModesTxGain,
633 ar9340Modes_low_ob_db_and_spur_tx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530634 else if (AR_SREV_9485_11_OR_LATER(ah))
Felix Fietkaueab6d792013-01-10 19:41:52 +0100635 INIT_INI_ARRAY(&ah->iniModesTxGain,
636 ar9485Modes_green_spur_ob_db_tx_gain_1_1);
637 else if (AR_SREV_9580(ah))
638 INIT_INI_ARRAY(&ah->iniModesTxGain,
639 ar9580_1p0_type6_tx_gain_table);
640}
641
Sujith Manoharan8fd007a2013-11-05 05:54:59 +0530642static void ar9003_tx_gain_table_mode7(struct ath_hw *ah)
643{
644 if (AR_SREV_9340(ah))
645 INIT_INI_ARRAY(&ah->iniModesTxGain,
646 ar9340_cus227_tx_gain_table_1p0);
647}
648
Felix Fietkaueab6d792013-01-10 19:41:52 +0100649typedef void (*ath_txgain_tab)(struct ath_hw *ah);
650
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400651static void ar9003_tx_gain_table_apply(struct ath_hw *ah)
652{
Felix Fietkaueab6d792013-01-10 19:41:52 +0100653 static const ath_txgain_tab modes[] = {
654 ar9003_tx_gain_table_mode0,
655 ar9003_tx_gain_table_mode1,
656 ar9003_tx_gain_table_mode2,
657 ar9003_tx_gain_table_mode3,
658 ar9003_tx_gain_table_mode4,
659 ar9003_tx_gain_table_mode5,
660 ar9003_tx_gain_table_mode6,
Sujith Manoharan8fd007a2013-11-05 05:54:59 +0530661 ar9003_tx_gain_table_mode7,
Felix Fietkaueab6d792013-01-10 19:41:52 +0100662 };
663 int idx = ar9003_hw_get_tx_gain_idx(ah);
664
665 if (idx >= ARRAY_SIZE(modes))
666 idx = 0;
667
668 modes[idx](ah);
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400669}
670
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530671static void ar9003_rx_gain_table_mode0(struct ath_hw *ah)
672{
673 if (AR_SREV_9330_12(ah))
674 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200675 ar9331_common_rx_gain_1p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530676 else if (AR_SREV_9330_11(ah))
677 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200678 ar9331_common_rx_gain_1p1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530679 else if (AR_SREV_9340(ah))
680 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200681 ar9340Common_rx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530682 else if (AR_SREV_9485_11_OR_LATER(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530683 INIT_INI_ARRAY(&ah->iniModesRxGain,
Sujith Manoharana796a1d2012-12-26 12:27:39 +0530684 ar9485_common_rx_gain_1_1);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200685 else if (AR_SREV_9550(ah)) {
686 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200687 ar955x_1p0_common_rx_gain_table);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200688 INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds,
Felix Fietkaua3645172012-07-15 19:53:33 +0200689 ar955x_1p0_common_rx_gain_bounds);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200690 } else if (AR_SREV_9580(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530691 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200692 ar9580_1p0_rx_gain_table);
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530693 else if (AR_SREV_9462_21(ah))
694 INIT_INI_ARRAY(&ah->iniModesRxGain,
695 ar9462_2p1_common_rx_gain);
Rajkumar Manoharan423e38e2011-10-13 11:00:44 +0530696 else if (AR_SREV_9462_20(ah))
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530697 INIT_INI_ARRAY(&ah->iniModesRxGain,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530698 ar9462_2p0_common_rx_gain);
Sujith Manoharan3777f7d2013-11-19 12:11:13 +0530699 else if (AR_SREV_9565_11(ah))
700 INIT_INI_ARRAY(&ah->iniModesRxGain,
701 ar9565_1p1_Common_rx_gain_table);
Sujith Manoharan6ac21502013-09-02 13:59:02 +0530702 else if (AR_SREV_9565(ah))
703 INIT_INI_ARRAY(&ah->iniModesRxGain,
704 ar9565_1p0_Common_rx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530705 else
706 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200707 ar9300Common_rx_gain_table_2p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530708}
709
710static void ar9003_rx_gain_table_mode1(struct ath_hw *ah)
711{
712 if (AR_SREV_9330_12(ah))
713 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200714 ar9331_common_wo_xlna_rx_gain_1p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530715 else if (AR_SREV_9330_11(ah))
716 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200717 ar9331_common_wo_xlna_rx_gain_1p1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530718 else if (AR_SREV_9340(ah))
719 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200720 ar9340Common_wo_xlna_rx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530721 else if (AR_SREV_9485_11_OR_LATER(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530722 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200723 ar9485Common_wo_xlna_rx_gain_1_1);
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530724 else if (AR_SREV_9462_21(ah))
725 INIT_INI_ARRAY(&ah->iniModesRxGain,
726 ar9462_2p1_common_wo_xlna_rx_gain);
Rajkumar Manoharan423e38e2011-10-13 11:00:44 +0530727 else if (AR_SREV_9462_20(ah))
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530728 INIT_INI_ARRAY(&ah->iniModesRxGain,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530729 ar9462_2p0_common_wo_xlna_rx_gain);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200730 else if (AR_SREV_9550(ah)) {
731 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200732 ar955x_1p0_common_wo_xlna_rx_gain_table);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200733 INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds,
Felix Fietkaua3645172012-07-15 19:53:33 +0200734 ar955x_1p0_common_wo_xlna_rx_gain_bounds);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200735 } else if (AR_SREV_9580(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530736 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200737 ar9580_1p0_wo_xlna_rx_gain_table);
Sujith Manoharan3777f7d2013-11-19 12:11:13 +0530738 else if (AR_SREV_9565_11(ah))
739 INIT_INI_ARRAY(&ah->iniModesRxGain,
740 ar9565_1p1_common_wo_xlna_rx_gain_table);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530741 else if (AR_SREV_9565(ah))
742 INIT_INI_ARRAY(&ah->iniModesRxGain,
743 ar9565_1p0_common_wo_xlna_rx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530744 else
745 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200746 ar9300Common_wo_xlna_rx_gain_table_2p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530747}
748
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530749static void ar9003_rx_gain_table_mode2(struct ath_hw *ah)
750{
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530751 if (AR_SREV_9462_21(ah)) {
752 INIT_INI_ARRAY(&ah->iniModesRxGain,
753 ar9462_2p1_common_mixed_rx_gain);
754 INIT_INI_ARRAY(&ah->ini_modes_rxgain_bb_core,
755 ar9462_2p1_baseband_core_mix_rxgain);
756 INIT_INI_ARRAY(&ah->ini_modes_rxgain_bb_postamble,
757 ar9462_2p1_baseband_postamble_mix_rxgain);
758 INIT_INI_ARRAY(&ah->ini_modes_rxgain_5g_xlna,
759 ar9462_2p1_baseband_postamble_5g_xlna);
760 } else if (AR_SREV_9462_20(ah)) {
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530761 INIT_INI_ARRAY(&ah->iniModesRxGain,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530762 ar9462_2p0_common_mixed_rx_gain);
Sujith Manoharanc177fab2013-06-18 15:42:38 +0530763 INIT_INI_ARRAY(&ah->ini_modes_rxgain_bb_core,
764 ar9462_2p0_baseband_core_mix_rxgain);
765 INIT_INI_ARRAY(&ah->ini_modes_rxgain_bb_postamble,
766 ar9462_2p0_baseband_postamble_mix_rxgain);
Sujith Manoharan51dbd0a2013-06-18 10:13:42 +0530767 INIT_INI_ARRAY(&ah->ini_modes_rxgain_5g_xlna,
768 ar9462_2p0_baseband_postamble_5g_xlna);
769 }
770}
771
772static void ar9003_rx_gain_table_mode3(struct ath_hw *ah)
773{
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530774 if (AR_SREV_9462_21(ah)) {
775 INIT_INI_ARRAY(&ah->iniModesRxGain,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530776 ar9462_2p1_common_5g_xlna_only_rxgain);
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530777 INIT_INI_ARRAY(&ah->ini_modes_rxgain_5g_xlna,
778 ar9462_2p1_baseband_postamble_5g_xlna);
779 } else if (AR_SREV_9462_20(ah)) {
Sujith Manoharan51dbd0a2013-06-18 10:13:42 +0530780 INIT_INI_ARRAY(&ah->iniModesRxGain,
Sujith Manoharandbb3e2f2013-11-26 15:04:55 +0530781 ar9462_2p0_common_5g_xlna_only_rxgain);
Sujith Manoharan51dbd0a2013-06-18 10:13:42 +0530782 INIT_INI_ARRAY(&ah->ini_modes_rxgain_5g_xlna,
783 ar9462_2p0_baseband_postamble_5g_xlna);
784 }
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530785}
786
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400787static void ar9003_rx_gain_table_apply(struct ath_hw *ah)
788{
789 switch (ar9003_hw_get_rx_gain_idx(ah)) {
790 case 0:
791 default:
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530792 ar9003_rx_gain_table_mode0(ah);
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400793 break;
794 case 1:
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530795 ar9003_rx_gain_table_mode1(ah);
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400796 break;
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530797 case 2:
798 ar9003_rx_gain_table_mode2(ah);
799 break;
Sujith Manoharan51dbd0a2013-06-18 10:13:42 +0530800 case 3:
801 ar9003_rx_gain_table_mode3(ah);
802 break;
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400803 }
804}
805
806/* set gain table pointers according to values read from the eeprom */
807static void ar9003_hw_init_mode_gain_regs(struct ath_hw *ah)
808{
809 ar9003_tx_gain_table_apply(ah);
810 ar9003_rx_gain_table_apply(ah);
811}
812
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400813/*
814 * Helper for ASPM support.
815 *
816 * Disable PLL when in L0s as well as receiver clock when in L1.
817 * This power saving option must be enabled through the SerDes.
818 *
819 * Programming the SerDes must go through the same 288 bit serial shift
820 * register as the other analog registers. Hence the 9 writes.
821 */
822static void ar9003_hw_configpcipowersave(struct ath_hw *ah,
Stanislaw Gruszka84c87dc2011-08-05 13:10:32 +0200823 bool power_off)
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400824{
Sujith Manoharanc6fc7e62013-10-29 11:52:06 +0530825 unsigned int i;
826 struct ar5416IniArray *array;
827
Sujith Manoharanb380a43b2013-08-25 14:43:09 +0530828 /*
829 * Increase L1 Entry Latency. Some WB222 boards don't have
830 * this change in eeprom/OTP.
831 *
832 */
833 if (AR_SREV_9462(ah)) {
834 u32 val = ah->config.aspm_l1_fix;
835 if ((val & 0xff000000) == 0x17000000) {
836 val &= 0x00ffffff;
837 val |= 0x27000000;
838 REG_WRITE(ah, 0x570c, val);
839 }
840 }
841
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400842 /* Nothing to do on restore for 11N */
Stanislaw Gruszka84c87dc2011-08-05 13:10:32 +0200843 if (!power_off /* !restore */) {
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400844 /* set bit 19 to allow forcing of pcie core into L1 state */
845 REG_SET_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA);
Sujith Manoharand1ae25a2013-08-25 16:30:40 +0530846 REG_WRITE(ah, AR_WA, ah->WARegVal);
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400847 }
Luis R. Rodriguez653fe372010-06-21 18:38:48 -0400848
849 /*
850 * Configire PCIE after Ini init. SERDES values now come from ini file
851 * This enables PCIe low power mode.
852 */
Sujith Manoharanc6fc7e62013-10-29 11:52:06 +0530853 array = power_off ? &ah->iniPcieSerdes :
854 &ah->iniPcieSerdesLowPower;
Luis R. Rodriguez653fe372010-06-21 18:38:48 -0400855
Sujith Manoharanc6fc7e62013-10-29 11:52:06 +0530856 for (i = 0; i < array->ia_rows; i++) {
857 REG_WRITE(ah,
858 INI_RA(array, i, 0),
859 INI_RA(array, i, 1));
Luis R. Rodriguez653fe372010-06-21 18:38:48 -0400860 }
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400861}
862
863/* Sets up the AR9003 hardware familiy callbacks */
864void ar9003_hw_attach_ops(struct ath_hw *ah)
865{
866 struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
867 struct ath_hw_ops *ops = ath9k_hw_ops(ah);
868
Felix Fietkau6aaacd82013-01-13 19:54:58 +0100869 ar9003_hw_init_mode_regs(ah);
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400870 priv_ops->init_mode_gain_regs = ar9003_hw_init_mode_gain_regs;
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400871
872 ops->config_pci_powersave = ar9003_hw_configpcipowersave;
873
874 ar9003_hw_attach_phy_ops(ah);
875 ar9003_hw_attach_calib_ops(ah);
876 ar9003_hw_attach_mac_ops(ah);
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400877}