blob: 84b83e1e71302f63221bf266b1b77881d42fab91 [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"
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -040029
30/* General hardware code for the AR9003 hadware family */
31
Luis R. Rodriguez886b42b2010-10-14 11:44:27 -070032/*
33 * The AR9003 family uses a new INI format (pre, core, post
34 * arrays per subsystem). This provides support for the
35 * AR9003 2.2 chipsets.
36 */
37static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
Luis R. Rodriguez72846352010-05-12 21:15:05 -040038{
Gabor Juhos172805a2011-06-21 11:23:26 +020039 if (AR_SREV_9330_11(ah)) {
40 /* mac */
Gabor Juhos172805a2011-06-21 11:23:26 +020041 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +020042 ar9331_1p1_mac_core);
Gabor Juhos172805a2011-06-21 11:23:26 +020043 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +020044 ar9331_1p1_mac_postamble);
Gabor Juhos172805a2011-06-21 11:23:26 +020045
46 /* bb */
Gabor Juhos172805a2011-06-21 11:23:26 +020047 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +020048 ar9331_1p1_baseband_core);
Gabor Juhos172805a2011-06-21 11:23:26 +020049 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +020050 ar9331_1p1_baseband_postamble);
Gabor Juhos172805a2011-06-21 11:23:26 +020051
52 /* radio */
Gabor Juhos172805a2011-06-21 11:23:26 +020053 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +020054 ar9331_1p1_radio_core);
Gabor Juhos172805a2011-06-21 11:23:26 +020055
56 /* soc */
57 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +020058 ar9331_1p1_soc_preamble);
Gabor Juhos172805a2011-06-21 11:23:26 +020059 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +020060 ar9331_1p1_soc_postamble);
Gabor Juhos172805a2011-06-21 11:23:26 +020061
62 /* rx/tx gain */
63 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +020064 ar9331_common_rx_gain_1p1);
Gabor Juhos172805a2011-06-21 11:23:26 +020065 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +020066 ar9331_modes_lowest_ob_db_tx_gain_1p1);
Gabor Juhos172805a2011-06-21 11:23:26 +020067
Sujith Manoharan57527f82012-11-13 11:33:53 +053068 /* Japan 2484 Mhz CCK */
69 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
70 ar9331_1p1_baseband_core_txfir_coeff_japan_2484);
71
Gabor Juhos172805a2011-06-21 11:23:26 +020072 /* additional clock settings */
73 if (ah->is_clk_25mhz)
Felix Fietkauc7d36f92012-03-14 16:40:31 +010074 INIT_INI_ARRAY(&ah->iniAdditional,
Felix Fietkaua3645172012-07-15 19:53:33 +020075 ar9331_1p1_xtal_25M);
Gabor Juhos172805a2011-06-21 11:23:26 +020076 else
Felix Fietkauc7d36f92012-03-14 16:40:31 +010077 INIT_INI_ARRAY(&ah->iniAdditional,
Felix Fietkaua3645172012-07-15 19:53:33 +020078 ar9331_1p1_xtal_40M);
Gabor Juhos172805a2011-06-21 11:23:26 +020079 } else if (AR_SREV_9330_12(ah)) {
80 /* mac */
Gabor Juhos172805a2011-06-21 11:23:26 +020081 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +020082 ar9331_1p2_mac_core);
Gabor Juhos172805a2011-06-21 11:23:26 +020083 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +020084 ar9331_1p2_mac_postamble);
Gabor Juhos172805a2011-06-21 11:23:26 +020085
86 /* bb */
Gabor Juhos172805a2011-06-21 11:23:26 +020087 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +020088 ar9331_1p2_baseband_core);
Gabor Juhos172805a2011-06-21 11:23:26 +020089 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +020090 ar9331_1p2_baseband_postamble);
Gabor Juhos172805a2011-06-21 11:23:26 +020091
92 /* radio */
Gabor Juhos172805a2011-06-21 11:23:26 +020093 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +020094 ar9331_1p2_radio_core);
Gabor Juhos172805a2011-06-21 11:23:26 +020095
96 /* soc */
97 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +020098 ar9331_1p2_soc_preamble);
Gabor Juhos172805a2011-06-21 11:23:26 +020099 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200100 ar9331_1p2_soc_postamble);
Gabor Juhos172805a2011-06-21 11:23:26 +0200101
102 /* rx/tx gain */
103 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200104 ar9331_common_rx_gain_1p2);
Gabor Juhos172805a2011-06-21 11:23:26 +0200105 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200106 ar9331_modes_lowest_ob_db_tx_gain_1p2);
Gabor Juhos172805a2011-06-21 11:23:26 +0200107
Sujith Manoharan57527f82012-11-13 11:33:53 +0530108 /* Japan 2484 Mhz CCK */
109 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
110 ar9331_1p2_baseband_core_txfir_coeff_japan_2484);
111
Gabor Juhos172805a2011-06-21 11:23:26 +0200112 /* additional clock settings */
113 if (ah->is_clk_25mhz)
Felix Fietkauc7d36f92012-03-14 16:40:31 +0100114 INIT_INI_ARRAY(&ah->iniAdditional,
Felix Fietkaua3645172012-07-15 19:53:33 +0200115 ar9331_1p2_xtal_25M);
Gabor Juhos172805a2011-06-21 11:23:26 +0200116 else
Felix Fietkauc7d36f92012-03-14 16:40:31 +0100117 INIT_INI_ARRAY(&ah->iniAdditional,
Felix Fietkaua3645172012-07-15 19:53:33 +0200118 ar9331_1p2_xtal_40M);
Gabor Juhos172805a2011-06-21 11:23:26 +0200119 } else if (AR_SREV_9340(ah)) {
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530120 /* mac */
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530121 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200122 ar9340_1p0_mac_core);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530123 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200124 ar9340_1p0_mac_postamble);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530125
126 /* bb */
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530127 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200128 ar9340_1p0_baseband_core);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530129 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200130 ar9340_1p0_baseband_postamble);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530131
132 /* radio */
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530133 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200134 ar9340_1p0_radio_core);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530135 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200136 ar9340_1p0_radio_postamble);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530137
138 /* soc */
139 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200140 ar9340_1p0_soc_preamble);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530141 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200142 ar9340_1p0_soc_postamble);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530143
144 /* rx/tx gain */
145 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200146 ar9340Common_wo_xlna_rx_gain_table_1p0);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530147 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200148 ar9340Modes_high_ob_db_tx_gain_table_1p0);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530149
Felix Fietkauc7d36f92012-03-14 16:40:31 +0100150 INIT_INI_ARRAY(&ah->iniModesFastClock,
Felix Fietkaua3645172012-07-15 19:53:33 +0200151 ar9340Modes_fast_clock_1p0);
Vasanthakumar Thiagarajand89baac2011-04-19 19:29:04 +0530152
Felix Fietkauc7d36f92012-03-14 16:40:31 +0100153 if (!ah->is_clk_25mhz)
154 INIT_INI_ARRAY(&ah->iniAdditional,
Felix Fietkaua3645172012-07-15 19:53:33 +0200155 ar9340_1p0_radio_core_40M);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530156 } else if (AR_SREV_9485_11_OR_LATER(ah)) {
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530157 /* mac */
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530158 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200159 ar9485_1_1_mac_core);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530160 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200161 ar9485_1_1_mac_postamble);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530162
163 /* bb */
Felix Fietkaua3645172012-07-15 19:53:33 +0200164 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], ar9485_1_1);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530165 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200166 ar9485_1_1_baseband_core);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530167 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200168 ar9485_1_1_baseband_postamble);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530169
170 /* radio */
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530171 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200172 ar9485_1_1_radio_core);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530173 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200174 ar9485_1_1_radio_postamble);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530175
176 /* soc */
177 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200178 ar9485_1_1_soc_preamble);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530179
180 /* rx/tx gain */
181 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200182 ar9485Common_wo_xlna_rx_gain_1_1);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530183 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200184 ar9485_modes_lowest_ob_db_tx_gain_1_1);
Vivek Natarajan1a63e2c2011-02-18 16:49:47 +0530185
Sujith Manoharan57527f82012-11-13 11:33:53 +0530186 /* Japan 2484 Mhz CCK */
187 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
188 ar9485_1_1_baseband_core_txfir_coeff_japan_2484);
189
Sujith Manoharan2d22c7d2013-11-08 11:45:25 +0530190 if (ah->config.no_pll_pwrsave) {
191 INIT_INI_ARRAY(&ah->iniPcieSerdes,
192 ar9485_1_1_pcie_phy_clkreq_disable_L1);
193 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
194 ar9485_1_1_pcie_phy_clkreq_disable_L1);
195 } else {
196 INIT_INI_ARRAY(&ah->iniPcieSerdes,
197 ar9485_1_1_pll_on_cdr_on_clkreq_disable_L1);
198 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
199 ar9485_1_1_pll_on_cdr_on_clkreq_disable_L1);
200 }
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530201 } else if (AR_SREV_9462_21(ah)) {
202 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
203 ar9462_2p1_mac_core);
204 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
205 ar9462_2p1_mac_postamble);
206 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
207 ar9462_2p1_baseband_core);
208 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
209 ar9462_2p1_baseband_postamble);
210 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
211 ar9462_2p1_radio_core);
212 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
213 ar9462_2p1_radio_postamble);
214 INIT_INI_ARRAY(&ah->ini_radio_post_sys2ant,
215 ar9462_2p1_radio_postamble_sys2ant);
216 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
217 ar9462_2p1_soc_preamble);
218 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
219 ar9462_2p1_soc_postamble);
220 INIT_INI_ARRAY(&ah->iniModesRxGain,
221 ar9462_2p1_common_rx_gain);
222 INIT_INI_ARRAY(&ah->iniModesFastClock,
223 ar9462_2p1_modes_fast_clock);
224 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
225 ar9462_2p1_baseband_core_txfir_coeff_japan_2484);
Sujith Manoharanf51ecd72013-10-29 11:35:31 +0530226 INIT_INI_ARRAY(&ah->iniPcieSerdes,
227 ar9462_2p1_pciephy_clkreq_disable_L1);
228 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
229 ar9462_2p1_pciephy_clkreq_disable_L1);
Rajkumar Manoharan423e38e2011-10-13 11:00:44 +0530230 } else if (AR_SREV_9462_20(ah)) {
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530231
Felix Fietkaua3645172012-07-15 19:53:33 +0200232 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], ar9462_2p0_mac_core);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530233 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200234 ar9462_2p0_mac_postamble);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530235
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530236 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200237 ar9462_2p0_baseband_core);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530238 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200239 ar9462_2p0_baseband_postamble);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530240
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530241 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200242 ar9462_2p0_radio_core);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530243 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200244 ar9462_2p0_radio_postamble);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530245 INIT_INI_ARRAY(&ah->ini_radio_post_sys2ant,
Felix Fietkaua3645172012-07-15 19:53:33 +0200246 ar9462_2p0_radio_postamble_sys2ant);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530247
248 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200249 ar9462_2p0_soc_preamble);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530250 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200251 ar9462_2p0_soc_postamble);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530252
253 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200254 ar9462_common_rx_gain_table_2p0);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530255
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530256 /* Awake -> Sleep Setting */
257 INIT_INI_ARRAY(&ah->iniPcieSerdes,
Rajkumar Manoharan16802602012-10-25 17:11:31 +0530258 ar9462_pciephy_clkreq_disable_L1_2p0);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530259 /* Sleep -> Awake Setting */
260 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
Rajkumar Manoharan16802602012-10-25 17:11:31 +0530261 ar9462_pciephy_clkreq_disable_L1_2p0);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530262
263 /* Fast clock modal settings */
Felix Fietkauc7d36f92012-03-14 16:40:31 +0100264 INIT_INI_ARRAY(&ah->iniModesFastClock,
Felix Fietkaua3645172012-07-15 19:53:33 +0200265 ar9462_modes_fast_clock_2p0);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530266
267 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
Sujith Manoharan57527f82012-11-13 11:33:53 +0530268 ar9462_2p0_baseband_core_txfir_coeff_japan_2484);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200269 } else if (AR_SREV_9550(ah)) {
270 /* mac */
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200271 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200272 ar955x_1p0_mac_core);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200273 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200274 ar955x_1p0_mac_postamble);
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530275
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200276 /* bb */
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200277 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200278 ar955x_1p0_baseband_core);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200279 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200280 ar955x_1p0_baseband_postamble);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200281
282 /* radio */
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200283 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200284 ar955x_1p0_radio_core);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200285 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200286 ar955x_1p0_radio_postamble);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200287
288 /* soc */
289 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200290 ar955x_1p0_soc_preamble);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200291 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200292 ar955x_1p0_soc_postamble);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200293
294 /* rx/tx gain */
295 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200296 ar955x_1p0_common_wo_xlna_rx_gain_table);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200297 INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds,
Felix Fietkaua3645172012-07-15 19:53:33 +0200298 ar955x_1p0_common_wo_xlna_rx_gain_bounds);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200299 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200300 ar955x_1p0_modes_xpa_tx_gain_table);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200301
302 /* Fast clock modal settings */
303 INIT_INI_ARRAY(&ah->iniModesFastClock,
Felix Fietkaua3645172012-07-15 19:53:33 +0200304 ar955x_1p0_modes_fast_clock);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700305 } else if (AR_SREV_9580(ah)) {
306 /* mac */
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700307 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200308 ar9580_1p0_mac_core);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700309 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200310 ar9580_1p0_mac_postamble);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700311
312 /* bb */
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700313 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200314 ar9580_1p0_baseband_core);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700315 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200316 ar9580_1p0_baseband_postamble);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700317
318 /* radio */
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700319 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200320 ar9580_1p0_radio_core);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700321 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200322 ar9580_1p0_radio_postamble);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700323
324 /* soc */
325 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200326 ar9580_1p0_soc_preamble);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700327 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200328 ar9580_1p0_soc_postamble);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700329
330 /* rx/tx gain */
331 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200332 ar9580_1p0_rx_gain_table);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700333 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200334 ar9580_1p0_low_ob_db_tx_gain_table);
Luis R. Rodriguez5a63ef02011-08-24 15:36:08 -0700335
Felix Fietkauc7d36f92012-03-14 16:40:31 +0100336 INIT_INI_ARRAY(&ah->iniModesFastClock,
Felix Fietkaua3645172012-07-15 19:53:33 +0200337 ar9580_1p0_modes_fast_clock);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530338 } else if (AR_SREV_9565(ah)) {
339 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
340 ar9565_1p0_mac_core);
341 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
342 ar9565_1p0_mac_postamble);
343
344 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
345 ar9565_1p0_baseband_core);
346 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
347 ar9565_1p0_baseband_postamble);
348
349 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
350 ar9565_1p0_radio_core);
351 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
352 ar9565_1p0_radio_postamble);
353
354 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
355 ar9565_1p0_soc_preamble);
356 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
357 ar9565_1p0_soc_postamble);
358
359 INIT_INI_ARRAY(&ah->iniModesRxGain,
360 ar9565_1p0_Common_rx_gain_table);
361 INIT_INI_ARRAY(&ah->iniModesTxGain,
362 ar9565_1p0_Modes_lowest_ob_db_tx_gain_table);
363
364 INIT_INI_ARRAY(&ah->iniPcieSerdes,
Rajkumar Manoharan84464842012-10-25 17:16:51 +0530365 ar9565_1p0_pciephy_clkreq_disable_L1);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530366 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
Rajkumar Manoharan84464842012-10-25 17:16:51 +0530367 ar9565_1p0_pciephy_clkreq_disable_L1);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530368
369 INIT_INI_ARRAY(&ah->iniModesFastClock,
370 ar9565_1p0_modes_fast_clock);
Sujith Manoharan6d5228f2013-09-03 10:28:56 +0530371 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
372 ar9565_1p0_baseband_core_txfir_coeff_japan_2484);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800373 } else {
374 /* mac */
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800375 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200376 ar9300_2p2_mac_core);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800377 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200378 ar9300_2p2_mac_postamble);
Luis R. Rodriguez72846352010-05-12 21:15:05 -0400379
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800380 /* bb */
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800381 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200382 ar9300_2p2_baseband_core);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800383 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200384 ar9300_2p2_baseband_postamble);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800385
386 /* radio */
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800387 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200388 ar9300_2p2_radio_core);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800389 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200390 ar9300_2p2_radio_postamble);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800391
392 /* soc */
393 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
Felix Fietkaua3645172012-07-15 19:53:33 +0200394 ar9300_2p2_soc_preamble);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800395 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
Felix Fietkaua3645172012-07-15 19:53:33 +0200396 ar9300_2p2_soc_postamble);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800397
398 /* rx/tx gain */
399 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200400 ar9300Common_rx_gain_table_2p2);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800401 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200402 ar9300Modes_lowest_ob_db_tx_gain_table_2p2);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800403
404 /* Load PCIE SERDES settings from INI */
405
406 /* Awake Setting */
407
408 INIT_INI_ARRAY(&ah->iniPcieSerdes,
Felix Fietkaua3645172012-07-15 19:53:33 +0200409 ar9300PciePhy_pll_on_clkreq_disable_L1_2p2);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800410
411 /* Sleep Setting */
412
413 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
Felix Fietkaua3645172012-07-15 19:53:33 +0200414 ar9300PciePhy_pll_on_clkreq_disable_L1_2p2);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800415
416 /* Fast clock modal settings */
Felix Fietkauc7d36f92012-03-14 16:40:31 +0100417 INIT_INI_ARRAY(&ah->iniModesFastClock,
Felix Fietkaua3645172012-07-15 19:53:33 +0200418 ar9300Modes_fast_clock_2p2);
Vasanthakumar Thiagarajanc88457e2010-12-06 04:27:37 -0800419 }
Luis R. Rodriguez72846352010-05-12 21:15:05 -0400420}
421
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530422static void ar9003_tx_gain_table_mode0(struct ath_hw *ah)
423{
424 if (AR_SREV_9330_12(ah))
425 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200426 ar9331_modes_lowest_ob_db_tx_gain_1p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530427 else if (AR_SREV_9330_11(ah))
428 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200429 ar9331_modes_lowest_ob_db_tx_gain_1p1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530430 else if (AR_SREV_9340(ah))
431 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200432 ar9340Modes_lowest_ob_db_tx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530433 else if (AR_SREV_9485_11_OR_LATER(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530434 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200435 ar9485_modes_lowest_ob_db_tx_gain_1_1);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200436 else if (AR_SREV_9550(ah))
437 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200438 ar955x_1p0_modes_xpa_tx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530439 else if (AR_SREV_9580(ah))
440 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200441 ar9580_1p0_lowest_ob_db_tx_gain_table);
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530442 else if (AR_SREV_9462_21(ah))
443 INIT_INI_ARRAY(&ah->iniModesTxGain,
444 ar9462_2p1_modes_low_ob_db_tx_gain);
Rajkumar Manoharan423e38e2011-10-13 11:00:44 +0530445 else if (AR_SREV_9462_20(ah))
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530446 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200447 ar9462_modes_low_ob_db_tx_gain_table_2p0);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530448 else if (AR_SREV_9565(ah))
449 INIT_INI_ARRAY(&ah->iniModesTxGain,
450 ar9565_1p0_modes_low_ob_db_tx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530451 else
452 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200453 ar9300Modes_lowest_ob_db_tx_gain_table_2p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530454}
455
456static void ar9003_tx_gain_table_mode1(struct ath_hw *ah)
457{
458 if (AR_SREV_9330_12(ah))
459 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200460 ar9331_modes_high_ob_db_tx_gain_1p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530461 else if (AR_SREV_9330_11(ah))
462 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200463 ar9331_modes_high_ob_db_tx_gain_1p1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530464 else if (AR_SREV_9340(ah))
465 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200466 ar9340Modes_high_ob_db_tx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530467 else if (AR_SREV_9485_11_OR_LATER(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530468 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200469 ar9485Modes_high_ob_db_tx_gain_1_1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530470 else if (AR_SREV_9580(ah))
471 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200472 ar9580_1p0_high_ob_db_tx_gain_table);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200473 else if (AR_SREV_9550(ah))
474 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200475 ar955x_1p0_modes_no_xpa_tx_gain_table);
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530476 else if (AR_SREV_9462_21(ah))
477 INIT_INI_ARRAY(&ah->iniModesTxGain,
478 ar9462_2p1_modes_high_ob_db_tx_gain);
Rajkumar Manoharan423e38e2011-10-13 11:00:44 +0530479 else if (AR_SREV_9462_20(ah))
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530480 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200481 ar9462_modes_high_ob_db_tx_gain_table_2p0);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530482 else if (AR_SREV_9565(ah))
483 INIT_INI_ARRAY(&ah->iniModesTxGain,
484 ar9565_1p0_modes_high_ob_db_tx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530485 else
486 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200487 ar9300Modes_high_ob_db_tx_gain_table_2p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530488}
489
490static void ar9003_tx_gain_table_mode2(struct ath_hw *ah)
491{
492 if (AR_SREV_9330_12(ah))
493 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200494 ar9331_modes_low_ob_db_tx_gain_1p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530495 else if (AR_SREV_9330_11(ah))
496 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200497 ar9331_modes_low_ob_db_tx_gain_1p1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530498 else if (AR_SREV_9340(ah))
499 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200500 ar9340Modes_low_ob_db_tx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530501 else if (AR_SREV_9485_11_OR_LATER(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530502 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200503 ar9485Modes_low_ob_db_tx_gain_1_1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530504 else if (AR_SREV_9580(ah))
505 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200506 ar9580_1p0_low_ob_db_tx_gain_table);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530507 else if (AR_SREV_9565(ah))
508 INIT_INI_ARRAY(&ah->iniModesTxGain,
509 ar9565_1p0_modes_low_ob_db_tx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530510 else
511 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200512 ar9300Modes_low_ob_db_tx_gain_table_2p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530513}
514
515static void ar9003_tx_gain_table_mode3(struct ath_hw *ah)
516{
517 if (AR_SREV_9330_12(ah))
518 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200519 ar9331_modes_high_power_tx_gain_1p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530520 else if (AR_SREV_9330_11(ah))
521 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200522 ar9331_modes_high_power_tx_gain_1p1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530523 else if (AR_SREV_9340(ah))
524 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200525 ar9340Modes_high_power_tx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530526 else if (AR_SREV_9485_11_OR_LATER(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530527 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200528 ar9485Modes_high_power_tx_gain_1_1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530529 else if (AR_SREV_9580(ah))
530 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200531 ar9580_1p0_high_power_tx_gain_table);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530532 else if (AR_SREV_9565(ah))
533 INIT_INI_ARRAY(&ah->iniModesTxGain,
534 ar9565_1p0_modes_high_power_tx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530535 else
536 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200537 ar9300Modes_high_power_tx_gain_table_2p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530538}
539
Felix Fietkaub05a0112012-07-15 19:53:32 +0200540static void ar9003_tx_gain_table_mode4(struct ath_hw *ah)
541{
542 if (AR_SREV_9340(ah))
543 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200544 ar9340Modes_mixed_ob_db_tx_gain_table_1p0);
Felix Fietkaub05a0112012-07-15 19:53:32 +0200545 else if (AR_SREV_9580(ah))
546 INIT_INI_ARRAY(&ah->iniModesTxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200547 ar9580_1p0_mixed_ob_db_tx_gain_table);
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530548 else if (AR_SREV_9462_21(ah))
549 INIT_INI_ARRAY(&ah->iniModesTxGain,
550 ar9462_2p1_modes_mix_ob_db_tx_gain);
Sujith Manoharan9a54c172013-06-25 12:29:23 +0530551 else if (AR_SREV_9462_20(ah))
552 INIT_INI_ARRAY(&ah->iniModesTxGain,
553 ar9462_modes_mix_ob_db_tx_gain_table_2p0);
Felix Fietkaueab6d792013-01-10 19:41:52 +0100554 else
555 INIT_INI_ARRAY(&ah->iniModesTxGain,
556 ar9300Modes_mixed_ob_db_tx_gain_table_2p2);
Felix Fietkaub05a0112012-07-15 19:53:32 +0200557}
558
Felix Fietkaueab6d792013-01-10 19:41:52 +0100559static void ar9003_tx_gain_table_mode5(struct ath_hw *ah)
560{
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530561 if (AR_SREV_9485_11_OR_LATER(ah))
Felix Fietkaueab6d792013-01-10 19:41:52 +0100562 INIT_INI_ARRAY(&ah->iniModesTxGain,
563 ar9485Modes_green_ob_db_tx_gain_1_1);
564 else if (AR_SREV_9340(ah))
565 INIT_INI_ARRAY(&ah->iniModesTxGain,
566 ar9340Modes_ub124_tx_gain_table_1p0);
567 else if (AR_SREV_9580(ah))
568 INIT_INI_ARRAY(&ah->iniModesTxGain,
569 ar9580_1p0_type5_tx_gain_table);
570 else if (AR_SREV_9300_22(ah))
571 INIT_INI_ARRAY(&ah->iniModesTxGain,
572 ar9300Modes_type5_tx_gain_table_2p2);
573}
574
575static void ar9003_tx_gain_table_mode6(struct ath_hw *ah)
576{
577 if (AR_SREV_9340(ah))
578 INIT_INI_ARRAY(&ah->iniModesTxGain,
579 ar9340Modes_low_ob_db_and_spur_tx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530580 else if (AR_SREV_9485_11_OR_LATER(ah))
Felix Fietkaueab6d792013-01-10 19:41:52 +0100581 INIT_INI_ARRAY(&ah->iniModesTxGain,
582 ar9485Modes_green_spur_ob_db_tx_gain_1_1);
583 else if (AR_SREV_9580(ah))
584 INIT_INI_ARRAY(&ah->iniModesTxGain,
585 ar9580_1p0_type6_tx_gain_table);
586}
587
588typedef void (*ath_txgain_tab)(struct ath_hw *ah);
589
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400590static void ar9003_tx_gain_table_apply(struct ath_hw *ah)
591{
Felix Fietkaueab6d792013-01-10 19:41:52 +0100592 static const ath_txgain_tab modes[] = {
593 ar9003_tx_gain_table_mode0,
594 ar9003_tx_gain_table_mode1,
595 ar9003_tx_gain_table_mode2,
596 ar9003_tx_gain_table_mode3,
597 ar9003_tx_gain_table_mode4,
598 ar9003_tx_gain_table_mode5,
599 ar9003_tx_gain_table_mode6,
600 };
601 int idx = ar9003_hw_get_tx_gain_idx(ah);
602
603 if (idx >= ARRAY_SIZE(modes))
604 idx = 0;
605
606 modes[idx](ah);
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400607}
608
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530609static void ar9003_rx_gain_table_mode0(struct ath_hw *ah)
610{
611 if (AR_SREV_9330_12(ah))
612 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200613 ar9331_common_rx_gain_1p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530614 else if (AR_SREV_9330_11(ah))
615 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200616 ar9331_common_rx_gain_1p1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530617 else if (AR_SREV_9340(ah))
618 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200619 ar9340Common_rx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530620 else if (AR_SREV_9485_11_OR_LATER(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530621 INIT_INI_ARRAY(&ah->iniModesRxGain,
Sujith Manoharana796a1d2012-12-26 12:27:39 +0530622 ar9485_common_rx_gain_1_1);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200623 else if (AR_SREV_9550(ah)) {
624 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200625 ar955x_1p0_common_rx_gain_table);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200626 INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds,
Felix Fietkaua3645172012-07-15 19:53:33 +0200627 ar955x_1p0_common_rx_gain_bounds);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200628 } else if (AR_SREV_9580(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530629 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200630 ar9580_1p0_rx_gain_table);
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530631 else if (AR_SREV_9462_21(ah))
632 INIT_INI_ARRAY(&ah->iniModesRxGain,
633 ar9462_2p1_common_rx_gain);
Rajkumar Manoharan423e38e2011-10-13 11:00:44 +0530634 else if (AR_SREV_9462_20(ah))
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530635 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200636 ar9462_common_rx_gain_table_2p0);
Sujith Manoharan6ac21502013-09-02 13:59:02 +0530637 else if (AR_SREV_9565(ah))
638 INIT_INI_ARRAY(&ah->iniModesRxGain,
639 ar9565_1p0_Common_rx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530640 else
641 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200642 ar9300Common_rx_gain_table_2p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530643}
644
645static void ar9003_rx_gain_table_mode1(struct ath_hw *ah)
646{
647 if (AR_SREV_9330_12(ah))
648 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200649 ar9331_common_wo_xlna_rx_gain_1p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530650 else if (AR_SREV_9330_11(ah))
651 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200652 ar9331_common_wo_xlna_rx_gain_1p1);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530653 else if (AR_SREV_9340(ah))
654 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200655 ar9340Common_wo_xlna_rx_gain_table_1p0);
Sujith Manoharanfb5a2dc2013-08-19 11:03:43 +0530656 else if (AR_SREV_9485_11_OR_LATER(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530657 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200658 ar9485Common_wo_xlna_rx_gain_1_1);
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530659 else if (AR_SREV_9462_21(ah))
660 INIT_INI_ARRAY(&ah->iniModesRxGain,
661 ar9462_2p1_common_wo_xlna_rx_gain);
Rajkumar Manoharan423e38e2011-10-13 11:00:44 +0530662 else if (AR_SREV_9462_20(ah))
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530663 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200664 ar9462_common_wo_xlna_rx_gain_table_2p0);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200665 else if (AR_SREV_9550(ah)) {
666 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200667 ar955x_1p0_common_wo_xlna_rx_gain_table);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200668 INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds,
Felix Fietkaua3645172012-07-15 19:53:33 +0200669 ar955x_1p0_common_wo_xlna_rx_gain_bounds);
Gabor Juhos8bc45c62012-07-03 19:13:23 +0200670 } else if (AR_SREV_9580(ah))
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530671 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200672 ar9580_1p0_wo_xlna_rx_gain_table);
Sujith Manoharanaaa53ee2012-09-10 09:19:54 +0530673 else if (AR_SREV_9565(ah))
674 INIT_INI_ARRAY(&ah->iniModesRxGain,
675 ar9565_1p0_common_wo_xlna_rx_gain_table);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530676 else
677 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200678 ar9300Common_wo_xlna_rx_gain_table_2p2);
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530679}
680
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530681static void ar9003_rx_gain_table_mode2(struct ath_hw *ah)
682{
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530683 if (AR_SREV_9462_21(ah)) {
684 INIT_INI_ARRAY(&ah->iniModesRxGain,
685 ar9462_2p1_common_mixed_rx_gain);
686 INIT_INI_ARRAY(&ah->ini_modes_rxgain_bb_core,
687 ar9462_2p1_baseband_core_mix_rxgain);
688 INIT_INI_ARRAY(&ah->ini_modes_rxgain_bb_postamble,
689 ar9462_2p1_baseband_postamble_mix_rxgain);
690 INIT_INI_ARRAY(&ah->ini_modes_rxgain_5g_xlna,
691 ar9462_2p1_baseband_postamble_5g_xlna);
692 } else if (AR_SREV_9462_20(ah)) {
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530693 INIT_INI_ARRAY(&ah->iniModesRxGain,
Felix Fietkaua3645172012-07-15 19:53:33 +0200694 ar9462_common_mixed_rx_gain_table_2p0);
Sujith Manoharanc177fab2013-06-18 15:42:38 +0530695 INIT_INI_ARRAY(&ah->ini_modes_rxgain_bb_core,
696 ar9462_2p0_baseband_core_mix_rxgain);
697 INIT_INI_ARRAY(&ah->ini_modes_rxgain_bb_postamble,
698 ar9462_2p0_baseband_postamble_mix_rxgain);
Sujith Manoharan51dbd0a2013-06-18 10:13:42 +0530699 INIT_INI_ARRAY(&ah->ini_modes_rxgain_5g_xlna,
700 ar9462_2p0_baseband_postamble_5g_xlna);
701 }
702}
703
704static void ar9003_rx_gain_table_mode3(struct ath_hw *ah)
705{
Sujith Manoharand567e4e2013-06-24 18:18:45 +0530706 if (AR_SREV_9462_21(ah)) {
707 INIT_INI_ARRAY(&ah->iniModesRxGain,
708 ar9462_2p1_common_5g_xlna_only_rx_gain);
709 INIT_INI_ARRAY(&ah->ini_modes_rxgain_5g_xlna,
710 ar9462_2p1_baseband_postamble_5g_xlna);
711 } else if (AR_SREV_9462_20(ah)) {
Sujith Manoharan51dbd0a2013-06-18 10:13:42 +0530712 INIT_INI_ARRAY(&ah->iniModesRxGain,
713 ar9462_2p0_5g_xlna_only_rxgain);
714 INIT_INI_ARRAY(&ah->ini_modes_rxgain_5g_xlna,
715 ar9462_2p0_baseband_postamble_5g_xlna);
716 }
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530717}
718
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400719static void ar9003_rx_gain_table_apply(struct ath_hw *ah)
720{
721 switch (ar9003_hw_get_rx_gain_idx(ah)) {
722 case 0:
723 default:
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530724 ar9003_rx_gain_table_mode0(ah);
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400725 break;
726 case 1:
Senthil Balasubramanian4d0707e2011-09-13 22:38:17 +0530727 ar9003_rx_gain_table_mode1(ah);
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400728 break;
Senthil Balasubramanian2577c6e2011-09-13 22:38:18 +0530729 case 2:
730 ar9003_rx_gain_table_mode2(ah);
731 break;
Sujith Manoharan51dbd0a2013-06-18 10:13:42 +0530732 case 3:
733 ar9003_rx_gain_table_mode3(ah);
734 break;
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400735 }
736}
737
738/* set gain table pointers according to values read from the eeprom */
739static void ar9003_hw_init_mode_gain_regs(struct ath_hw *ah)
740{
741 ar9003_tx_gain_table_apply(ah);
742 ar9003_rx_gain_table_apply(ah);
743}
744
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400745/*
746 * Helper for ASPM support.
747 *
748 * Disable PLL when in L0s as well as receiver clock when in L1.
749 * This power saving option must be enabled through the SerDes.
750 *
751 * Programming the SerDes must go through the same 288 bit serial shift
752 * register as the other analog registers. Hence the 9 writes.
753 */
754static void ar9003_hw_configpcipowersave(struct ath_hw *ah,
Stanislaw Gruszka84c87dc2011-08-05 13:10:32 +0200755 bool power_off)
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400756{
Sujith Manoharanb380a43b2013-08-25 14:43:09 +0530757 /*
758 * Increase L1 Entry Latency. Some WB222 boards don't have
759 * this change in eeprom/OTP.
760 *
761 */
762 if (AR_SREV_9462(ah)) {
763 u32 val = ah->config.aspm_l1_fix;
764 if ((val & 0xff000000) == 0x17000000) {
765 val &= 0x00ffffff;
766 val |= 0x27000000;
767 REG_WRITE(ah, 0x570c, val);
768 }
769 }
770
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400771 /* Nothing to do on restore for 11N */
Stanislaw Gruszka84c87dc2011-08-05 13:10:32 +0200772 if (!power_off /* !restore */) {
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400773 /* set bit 19 to allow forcing of pcie core into L1 state */
774 REG_SET_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA);
Sujith Manoharand1ae25a2013-08-25 16:30:40 +0530775 REG_WRITE(ah, AR_WA, ah->WARegVal);
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400776 }
Luis R. Rodriguez653fe372010-06-21 18:38:48 -0400777
778 /*
779 * Configire PCIE after Ini init. SERDES values now come from ini file
780 * This enables PCIe low power mode.
781 */
Luis R. Rodriguez6a0ec302010-06-21 18:38:49 -0400782 if (ah->config.pcieSerDesWrite) {
Luis R. Rodriguez653fe372010-06-21 18:38:48 -0400783 unsigned int i;
Luis R. Rodriguezd5c4d192010-06-21 18:38:50 -0400784 struct ar5416IniArray *array;
Luis R. Rodriguez653fe372010-06-21 18:38:48 -0400785
Luis R. Rodriguezd5c4d192010-06-21 18:38:50 -0400786 array = power_off ? &ah->iniPcieSerdes :
787 &ah->iniPcieSerdesLowPower;
788
789 for (i = 0; i < array->ia_rows; i++) {
Luis R. Rodriguez653fe372010-06-21 18:38:48 -0400790 REG_WRITE(ah,
Luis R. Rodriguezd5c4d192010-06-21 18:38:50 -0400791 INI_RA(array, i, 0),
792 INI_RA(array, i, 1));
Luis R. Rodriguez653fe372010-06-21 18:38:48 -0400793 }
794 }
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400795}
796
797/* Sets up the AR9003 hardware familiy callbacks */
798void ar9003_hw_attach_ops(struct ath_hw *ah)
799{
800 struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
801 struct ath_hw_ops *ops = ath9k_hw_ops(ah);
802
Felix Fietkau6aaacd82013-01-13 19:54:58 +0100803 ar9003_hw_init_mode_regs(ah);
Luis R. Rodriguezc14a85d2010-04-15 17:39:21 -0400804 priv_ops->init_mode_gain_regs = ar9003_hw_init_mode_gain_regs;
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400805
806 ops->config_pci_powersave = ar9003_hw_configpcipowersave;
807
808 ar9003_hw_attach_phy_ops(ah);
809 ar9003_hw_attach_calib_ops(ah);
810 ar9003_hw_attach_mac_ops(ah);
Luis R. Rodriguezb3950e62010-04-15 17:39:03 -0400811}