ar9003_hw.c 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865
  1. /*
  2. * Copyright (c) 2008-2011 Atheros Communications Inc.
  3. *
  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. #include "hw.h"
  17. #include "ar9003_mac.h"
  18. #include "ar9003_2p2_initvals.h"
  19. #include "ar9485_initvals.h"
  20. #include "ar9340_initvals.h"
  21. #include "ar9330_1p1_initvals.h"
  22. #include "ar9330_1p2_initvals.h"
  23. #include "ar955x_1p0_initvals.h"
  24. #include "ar9580_1p0_initvals.h"
  25. #include "ar9462_2p0_initvals.h"
  26. /* General hardware code for the AR9003 hadware family */
  27. /*
  28. * The AR9003 family uses a new INI format (pre, core, post
  29. * arrays per subsystem). This provides support for the
  30. * AR9003 2.2 chipsets.
  31. */
  32. static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
  33. {
  34. #define PCIE_PLL_ON_CREQ_DIS_L1_2P0 \
  35. ar9462_pciephy_pll_on_clkreq_disable_L1_2p0
  36. #define AR9462_BB_CTX_COEFJ(x) \
  37. ar9462_##x##_baseband_core_txfir_coeff_japan_2484
  38. #define AR9462_BBC_TXIFR_COEFFJ \
  39. ar9462_2p0_baseband_core_txfir_coeff_japan_2484
  40. if (AR_SREV_9330_11(ah)) {
  41. /* mac */
  42. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
  43. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
  44. ar9331_1p1_mac_core,
  45. ARRAY_SIZE(ar9331_1p1_mac_core), 2);
  46. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
  47. ar9331_1p1_mac_postamble,
  48. ARRAY_SIZE(ar9331_1p1_mac_postamble), 5);
  49. /* bb */
  50. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
  51. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
  52. ar9331_1p1_baseband_core,
  53. ARRAY_SIZE(ar9331_1p1_baseband_core), 2);
  54. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
  55. ar9331_1p1_baseband_postamble,
  56. ARRAY_SIZE(ar9331_1p1_baseband_postamble), 5);
  57. /* radio */
  58. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
  59. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
  60. ar9331_1p1_radio_core,
  61. ARRAY_SIZE(ar9331_1p1_radio_core), 2);
  62. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], NULL, 0, 0);
  63. /* soc */
  64. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
  65. ar9331_1p1_soc_preamble,
  66. ARRAY_SIZE(ar9331_1p1_soc_preamble), 2);
  67. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
  68. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
  69. ar9331_1p1_soc_postamble,
  70. ARRAY_SIZE(ar9331_1p1_soc_postamble), 2);
  71. /* rx/tx gain */
  72. INIT_INI_ARRAY(&ah->iniModesRxGain,
  73. ar9331_common_rx_gain_1p1,
  74. ARRAY_SIZE(ar9331_common_rx_gain_1p1), 2);
  75. INIT_INI_ARRAY(&ah->iniModesTxGain,
  76. ar9331_modes_lowest_ob_db_tx_gain_1p1,
  77. ARRAY_SIZE(ar9331_modes_lowest_ob_db_tx_gain_1p1),
  78. 5);
  79. /* additional clock settings */
  80. if (ah->is_clk_25mhz)
  81. INIT_INI_ARRAY(&ah->iniAdditional,
  82. ar9331_1p1_xtal_25M,
  83. ARRAY_SIZE(ar9331_1p1_xtal_25M), 2);
  84. else
  85. INIT_INI_ARRAY(&ah->iniAdditional,
  86. ar9331_1p1_xtal_40M,
  87. ARRAY_SIZE(ar9331_1p1_xtal_40M), 2);
  88. } else if (AR_SREV_9330_12(ah)) {
  89. /* mac */
  90. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
  91. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
  92. ar9331_1p2_mac_core,
  93. ARRAY_SIZE(ar9331_1p2_mac_core), 2);
  94. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
  95. ar9331_1p2_mac_postamble,
  96. ARRAY_SIZE(ar9331_1p2_mac_postamble), 5);
  97. /* bb */
  98. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
  99. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
  100. ar9331_1p2_baseband_core,
  101. ARRAY_SIZE(ar9331_1p2_baseband_core), 2);
  102. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
  103. ar9331_1p2_baseband_postamble,
  104. ARRAY_SIZE(ar9331_1p2_baseband_postamble), 5);
  105. /* radio */
  106. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
  107. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
  108. ar9331_1p2_radio_core,
  109. ARRAY_SIZE(ar9331_1p2_radio_core), 2);
  110. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST], NULL, 0, 0);
  111. /* soc */
  112. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
  113. ar9331_1p2_soc_preamble,
  114. ARRAY_SIZE(ar9331_1p2_soc_preamble), 2);
  115. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
  116. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
  117. ar9331_1p2_soc_postamble,
  118. ARRAY_SIZE(ar9331_1p2_soc_postamble), 2);
  119. /* rx/tx gain */
  120. INIT_INI_ARRAY(&ah->iniModesRxGain,
  121. ar9331_common_rx_gain_1p2,
  122. ARRAY_SIZE(ar9331_common_rx_gain_1p2), 2);
  123. INIT_INI_ARRAY(&ah->iniModesTxGain,
  124. ar9331_modes_lowest_ob_db_tx_gain_1p2,
  125. ARRAY_SIZE(ar9331_modes_lowest_ob_db_tx_gain_1p2),
  126. 5);
  127. /* additional clock settings */
  128. if (ah->is_clk_25mhz)
  129. INIT_INI_ARRAY(&ah->iniAdditional,
  130. ar9331_1p2_xtal_25M,
  131. ARRAY_SIZE(ar9331_1p2_xtal_25M), 2);
  132. else
  133. INIT_INI_ARRAY(&ah->iniAdditional,
  134. ar9331_1p2_xtal_40M,
  135. ARRAY_SIZE(ar9331_1p2_xtal_40M), 2);
  136. } else if (AR_SREV_9340(ah)) {
  137. /* mac */
  138. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
  139. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
  140. ar9340_1p0_mac_core,
  141. ARRAY_SIZE(ar9340_1p0_mac_core), 2);
  142. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
  143. ar9340_1p0_mac_postamble,
  144. ARRAY_SIZE(ar9340_1p0_mac_postamble), 5);
  145. /* bb */
  146. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
  147. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
  148. ar9340_1p0_baseband_core,
  149. ARRAY_SIZE(ar9340_1p0_baseband_core), 2);
  150. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
  151. ar9340_1p0_baseband_postamble,
  152. ARRAY_SIZE(ar9340_1p0_baseband_postamble), 5);
  153. /* radio */
  154. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
  155. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
  156. ar9340_1p0_radio_core,
  157. ARRAY_SIZE(ar9340_1p0_radio_core), 2);
  158. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
  159. ar9340_1p0_radio_postamble,
  160. ARRAY_SIZE(ar9340_1p0_radio_postamble), 5);
  161. /* soc */
  162. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
  163. ar9340_1p0_soc_preamble,
  164. ARRAY_SIZE(ar9340_1p0_soc_preamble), 2);
  165. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
  166. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
  167. ar9340_1p0_soc_postamble,
  168. ARRAY_SIZE(ar9340_1p0_soc_postamble), 5);
  169. /* rx/tx gain */
  170. INIT_INI_ARRAY(&ah->iniModesRxGain,
  171. ar9340Common_wo_xlna_rx_gain_table_1p0,
  172. ARRAY_SIZE(ar9340Common_wo_xlna_rx_gain_table_1p0),
  173. 5);
  174. INIT_INI_ARRAY(&ah->iniModesTxGain,
  175. ar9340Modes_high_ob_db_tx_gain_table_1p0,
  176. ARRAY_SIZE(ar9340Modes_high_ob_db_tx_gain_table_1p0),
  177. 5);
  178. INIT_INI_ARRAY(&ah->iniModesFastClock,
  179. ar9340Modes_fast_clock_1p0,
  180. ARRAY_SIZE(ar9340Modes_fast_clock_1p0),
  181. 3);
  182. if (!ah->is_clk_25mhz)
  183. INIT_INI_ARRAY(&ah->iniAdditional,
  184. ar9340_1p0_radio_core_40M,
  185. ARRAY_SIZE(ar9340_1p0_radio_core_40M),
  186. 2);
  187. } else if (AR_SREV_9485_11(ah)) {
  188. /* mac */
  189. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
  190. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
  191. ar9485_1_1_mac_core,
  192. ARRAY_SIZE(ar9485_1_1_mac_core), 2);
  193. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
  194. ar9485_1_1_mac_postamble,
  195. ARRAY_SIZE(ar9485_1_1_mac_postamble), 5);
  196. /* bb */
  197. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], ar9485_1_1,
  198. ARRAY_SIZE(ar9485_1_1), 2);
  199. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
  200. ar9485_1_1_baseband_core,
  201. ARRAY_SIZE(ar9485_1_1_baseband_core), 2);
  202. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
  203. ar9485_1_1_baseband_postamble,
  204. ARRAY_SIZE(ar9485_1_1_baseband_postamble), 5);
  205. /* radio */
  206. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
  207. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
  208. ar9485_1_1_radio_core,
  209. ARRAY_SIZE(ar9485_1_1_radio_core), 2);
  210. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
  211. ar9485_1_1_radio_postamble,
  212. ARRAY_SIZE(ar9485_1_1_radio_postamble), 2);
  213. /* soc */
  214. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
  215. ar9485_1_1_soc_preamble,
  216. ARRAY_SIZE(ar9485_1_1_soc_preamble), 2);
  217. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
  218. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], NULL, 0, 0);
  219. /* rx/tx gain */
  220. INIT_INI_ARRAY(&ah->iniModesRxGain,
  221. ar9485Common_wo_xlna_rx_gain_1_1,
  222. ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_1), 2);
  223. INIT_INI_ARRAY(&ah->iniModesTxGain,
  224. ar9485_modes_lowest_ob_db_tx_gain_1_1,
  225. ARRAY_SIZE(ar9485_modes_lowest_ob_db_tx_gain_1_1),
  226. 5);
  227. /* Load PCIE SERDES settings from INI */
  228. /* Awake Setting */
  229. INIT_INI_ARRAY(&ah->iniPcieSerdes,
  230. ar9485_1_1_pcie_phy_clkreq_disable_L1,
  231. ARRAY_SIZE(ar9485_1_1_pcie_phy_clkreq_disable_L1),
  232. 2);
  233. /* Sleep Setting */
  234. INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
  235. ar9485_1_1_pcie_phy_clkreq_disable_L1,
  236. ARRAY_SIZE(ar9485_1_1_pcie_phy_clkreq_disable_L1),
  237. 2);
  238. } else if (AR_SREV_9462_20(ah)) {
  239. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
  240. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], ar9462_2p0_mac_core,
  241. ARRAY_SIZE(ar9462_2p0_mac_core), 2);
  242. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
  243. ar9462_2p0_mac_postamble,
  244. ARRAY_SIZE(ar9462_2p0_mac_postamble), 5);
  245. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
  246. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
  247. ar9462_2p0_baseband_core,
  248. ARRAY_SIZE(ar9462_2p0_baseband_core), 2);
  249. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
  250. ar9462_2p0_baseband_postamble,
  251. ARRAY_SIZE(ar9462_2p0_baseband_postamble), 5);
  252. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
  253. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
  254. ar9462_2p0_radio_core,
  255. ARRAY_SIZE(ar9462_2p0_radio_core), 2);
  256. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
  257. ar9462_2p0_radio_postamble,
  258. ARRAY_SIZE(ar9462_2p0_radio_postamble), 5);
  259. INIT_INI_ARRAY(&ah->ini_radio_post_sys2ant,
  260. ar9462_2p0_radio_postamble_sys2ant,
  261. ARRAY_SIZE(ar9462_2p0_radio_postamble_sys2ant),
  262. 5);
  263. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
  264. ar9462_2p0_soc_preamble,
  265. ARRAY_SIZE(ar9462_2p0_soc_preamble), 2);
  266. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
  267. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
  268. ar9462_2p0_soc_postamble,
  269. ARRAY_SIZE(ar9462_2p0_soc_postamble), 5);
  270. INIT_INI_ARRAY(&ah->iniModesRxGain,
  271. ar9462_common_rx_gain_table_2p0,
  272. ARRAY_SIZE(ar9462_common_rx_gain_table_2p0), 2);
  273. /* Awake -> Sleep Setting */
  274. INIT_INI_ARRAY(&ah->iniPcieSerdes,
  275. PCIE_PLL_ON_CREQ_DIS_L1_2P0,
  276. ARRAY_SIZE(PCIE_PLL_ON_CREQ_DIS_L1_2P0),
  277. 2);
  278. /* Sleep -> Awake Setting */
  279. INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
  280. PCIE_PLL_ON_CREQ_DIS_L1_2P0,
  281. ARRAY_SIZE(PCIE_PLL_ON_CREQ_DIS_L1_2P0),
  282. 2);
  283. /* Fast clock modal settings */
  284. INIT_INI_ARRAY(&ah->iniModesFastClock,
  285. ar9462_modes_fast_clock_2p0,
  286. ARRAY_SIZE(ar9462_modes_fast_clock_2p0), 3);
  287. INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
  288. AR9462_BB_CTX_COEFJ(2p0),
  289. ARRAY_SIZE(AR9462_BB_CTX_COEFJ(2p0)), 2);
  290. INIT_INI_ARRAY(&ah->ini_japan2484, AR9462_BBC_TXIFR_COEFFJ,
  291. ARRAY_SIZE(AR9462_BBC_TXIFR_COEFFJ), 2);
  292. } else if (AR_SREV_9550(ah)) {
  293. /* mac */
  294. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
  295. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
  296. ar955x_1p0_mac_core,
  297. ARRAY_SIZE(ar955x_1p0_mac_core), 2);
  298. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
  299. ar955x_1p0_mac_postamble,
  300. ARRAY_SIZE(ar955x_1p0_mac_postamble), 5);
  301. /* bb */
  302. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
  303. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
  304. ar955x_1p0_baseband_core,
  305. ARRAY_SIZE(ar955x_1p0_baseband_core), 2);
  306. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
  307. ar955x_1p0_baseband_postamble,
  308. ARRAY_SIZE(ar955x_1p0_baseband_postamble), 5);
  309. /* radio */
  310. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
  311. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
  312. ar955x_1p0_radio_core,
  313. ARRAY_SIZE(ar955x_1p0_radio_core), 2);
  314. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
  315. ar955x_1p0_radio_postamble,
  316. ARRAY_SIZE(ar955x_1p0_radio_postamble), 5);
  317. /* soc */
  318. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
  319. ar955x_1p0_soc_preamble,
  320. ARRAY_SIZE(ar955x_1p0_soc_preamble), 2);
  321. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
  322. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
  323. ar955x_1p0_soc_postamble,
  324. ARRAY_SIZE(ar955x_1p0_soc_postamble), 5);
  325. /* rx/tx gain */
  326. INIT_INI_ARRAY(&ah->iniModesRxGain,
  327. ar955x_1p0_common_wo_xlna_rx_gain_table,
  328. ARRAY_SIZE(ar955x_1p0_common_wo_xlna_rx_gain_table),
  329. 2);
  330. INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds,
  331. ar955x_1p0_common_wo_xlna_rx_gain_bounds,
  332. ARRAY_SIZE(ar955x_1p0_common_wo_xlna_rx_gain_bounds),
  333. 5);
  334. INIT_INI_ARRAY(&ah->iniModesTxGain,
  335. ar955x_1p0_modes_xpa_tx_gain_table,
  336. ARRAY_SIZE(ar955x_1p0_modes_xpa_tx_gain_table),
  337. 9);
  338. /* Fast clock modal settings */
  339. INIT_INI_ARRAY(&ah->iniModesFastClock,
  340. ar955x_1p0_modes_fast_clock,
  341. ARRAY_SIZE(ar955x_1p0_modes_fast_clock), 3);
  342. } else if (AR_SREV_9580(ah)) {
  343. /* mac */
  344. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
  345. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
  346. ar9580_1p0_mac_core,
  347. ARRAY_SIZE(ar9580_1p0_mac_core), 2);
  348. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
  349. ar9580_1p0_mac_postamble,
  350. ARRAY_SIZE(ar9580_1p0_mac_postamble), 5);
  351. /* bb */
  352. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
  353. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
  354. ar9580_1p0_baseband_core,
  355. ARRAY_SIZE(ar9580_1p0_baseband_core), 2);
  356. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
  357. ar9580_1p0_baseband_postamble,
  358. ARRAY_SIZE(ar9580_1p0_baseband_postamble), 5);
  359. /* radio */
  360. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
  361. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
  362. ar9580_1p0_radio_core,
  363. ARRAY_SIZE(ar9580_1p0_radio_core), 2);
  364. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
  365. ar9580_1p0_radio_postamble,
  366. ARRAY_SIZE(ar9580_1p0_radio_postamble), 5);
  367. /* soc */
  368. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
  369. ar9580_1p0_soc_preamble,
  370. ARRAY_SIZE(ar9580_1p0_soc_preamble), 2);
  371. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
  372. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
  373. ar9580_1p0_soc_postamble,
  374. ARRAY_SIZE(ar9580_1p0_soc_postamble), 5);
  375. /* rx/tx gain */
  376. INIT_INI_ARRAY(&ah->iniModesRxGain,
  377. ar9580_1p0_rx_gain_table,
  378. ARRAY_SIZE(ar9580_1p0_rx_gain_table), 2);
  379. INIT_INI_ARRAY(&ah->iniModesTxGain,
  380. ar9580_1p0_low_ob_db_tx_gain_table,
  381. ARRAY_SIZE(ar9580_1p0_low_ob_db_tx_gain_table),
  382. 5);
  383. INIT_INI_ARRAY(&ah->iniModesFastClock,
  384. ar9580_1p0_modes_fast_clock,
  385. ARRAY_SIZE(ar9580_1p0_modes_fast_clock),
  386. 3);
  387. } else {
  388. /* mac */
  389. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
  390. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
  391. ar9300_2p2_mac_core,
  392. ARRAY_SIZE(ar9300_2p2_mac_core), 2);
  393. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
  394. ar9300_2p2_mac_postamble,
  395. ARRAY_SIZE(ar9300_2p2_mac_postamble), 5);
  396. /* bb */
  397. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
  398. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
  399. ar9300_2p2_baseband_core,
  400. ARRAY_SIZE(ar9300_2p2_baseband_core), 2);
  401. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
  402. ar9300_2p2_baseband_postamble,
  403. ARRAY_SIZE(ar9300_2p2_baseband_postamble), 5);
  404. /* radio */
  405. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
  406. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
  407. ar9300_2p2_radio_core,
  408. ARRAY_SIZE(ar9300_2p2_radio_core), 2);
  409. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
  410. ar9300_2p2_radio_postamble,
  411. ARRAY_SIZE(ar9300_2p2_radio_postamble), 5);
  412. /* soc */
  413. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
  414. ar9300_2p2_soc_preamble,
  415. ARRAY_SIZE(ar9300_2p2_soc_preamble), 2);
  416. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
  417. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
  418. ar9300_2p2_soc_postamble,
  419. ARRAY_SIZE(ar9300_2p2_soc_postamble), 5);
  420. /* rx/tx gain */
  421. INIT_INI_ARRAY(&ah->iniModesRxGain,
  422. ar9300Common_rx_gain_table_2p2,
  423. ARRAY_SIZE(ar9300Common_rx_gain_table_2p2), 2);
  424. INIT_INI_ARRAY(&ah->iniModesTxGain,
  425. ar9300Modes_lowest_ob_db_tx_gain_table_2p2,
  426. ARRAY_SIZE(ar9300Modes_lowest_ob_db_tx_gain_table_2p2),
  427. 5);
  428. /* Load PCIE SERDES settings from INI */
  429. /* Awake Setting */
  430. INIT_INI_ARRAY(&ah->iniPcieSerdes,
  431. ar9300PciePhy_pll_on_clkreq_disable_L1_2p2,
  432. ARRAY_SIZE(ar9300PciePhy_pll_on_clkreq_disable_L1_2p2),
  433. 2);
  434. /* Sleep Setting */
  435. INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
  436. ar9300PciePhy_pll_on_clkreq_disable_L1_2p2,
  437. ARRAY_SIZE(ar9300PciePhy_pll_on_clkreq_disable_L1_2p2),
  438. 2);
  439. /* Fast clock modal settings */
  440. INIT_INI_ARRAY(&ah->iniModesFastClock,
  441. ar9300Modes_fast_clock_2p2,
  442. ARRAY_SIZE(ar9300Modes_fast_clock_2p2),
  443. 3);
  444. }
  445. }
  446. static void ar9003_tx_gain_table_mode0(struct ath_hw *ah)
  447. {
  448. if (AR_SREV_9330_12(ah))
  449. INIT_INI_ARRAY(&ah->iniModesTxGain,
  450. ar9331_modes_lowest_ob_db_tx_gain_1p2,
  451. ARRAY_SIZE(ar9331_modes_lowest_ob_db_tx_gain_1p2),
  452. 5);
  453. else if (AR_SREV_9330_11(ah))
  454. INIT_INI_ARRAY(&ah->iniModesTxGain,
  455. ar9331_modes_lowest_ob_db_tx_gain_1p1,
  456. ARRAY_SIZE(ar9331_modes_lowest_ob_db_tx_gain_1p1),
  457. 5);
  458. else if (AR_SREV_9340(ah))
  459. INIT_INI_ARRAY(&ah->iniModesTxGain,
  460. ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
  461. ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
  462. 5);
  463. else if (AR_SREV_9485_11(ah))
  464. INIT_INI_ARRAY(&ah->iniModesTxGain,
  465. ar9485_modes_lowest_ob_db_tx_gain_1_1,
  466. ARRAY_SIZE(ar9485_modes_lowest_ob_db_tx_gain_1_1),
  467. 5);
  468. else if (AR_SREV_9550(ah))
  469. INIT_INI_ARRAY(&ah->iniModesTxGain,
  470. ar955x_1p0_modes_xpa_tx_gain_table,
  471. ARRAY_SIZE(ar955x_1p0_modes_xpa_tx_gain_table),
  472. 9);
  473. else if (AR_SREV_9580(ah))
  474. INIT_INI_ARRAY(&ah->iniModesTxGain,
  475. ar9580_1p0_lowest_ob_db_tx_gain_table,
  476. ARRAY_SIZE(ar9580_1p0_lowest_ob_db_tx_gain_table),
  477. 5);
  478. else if (AR_SREV_9462_20(ah))
  479. INIT_INI_ARRAY(&ah->iniModesTxGain,
  480. ar9462_modes_low_ob_db_tx_gain_table_2p0,
  481. ARRAY_SIZE(ar9462_modes_low_ob_db_tx_gain_table_2p0),
  482. 5);
  483. else
  484. INIT_INI_ARRAY(&ah->iniModesTxGain,
  485. ar9300Modes_lowest_ob_db_tx_gain_table_2p2,
  486. ARRAY_SIZE(ar9300Modes_lowest_ob_db_tx_gain_table_2p2),
  487. 5);
  488. }
  489. static void ar9003_tx_gain_table_mode1(struct ath_hw *ah)
  490. {
  491. if (AR_SREV_9330_12(ah))
  492. INIT_INI_ARRAY(&ah->iniModesTxGain,
  493. ar9331_modes_high_ob_db_tx_gain_1p2,
  494. ARRAY_SIZE(ar9331_modes_high_ob_db_tx_gain_1p2),
  495. 5);
  496. else if (AR_SREV_9330_11(ah))
  497. INIT_INI_ARRAY(&ah->iniModesTxGain,
  498. ar9331_modes_high_ob_db_tx_gain_1p1,
  499. ARRAY_SIZE(ar9331_modes_high_ob_db_tx_gain_1p1),
  500. 5);
  501. else if (AR_SREV_9340(ah))
  502. INIT_INI_ARRAY(&ah->iniModesTxGain,
  503. ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
  504. ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
  505. 5);
  506. else if (AR_SREV_9485_11(ah))
  507. INIT_INI_ARRAY(&ah->iniModesTxGain,
  508. ar9485Modes_high_ob_db_tx_gain_1_1,
  509. ARRAY_SIZE(ar9485Modes_high_ob_db_tx_gain_1_1),
  510. 5);
  511. else if (AR_SREV_9580(ah))
  512. INIT_INI_ARRAY(&ah->iniModesTxGain,
  513. ar9580_1p0_high_ob_db_tx_gain_table,
  514. ARRAY_SIZE(ar9580_1p0_high_ob_db_tx_gain_table),
  515. 5);
  516. else if (AR_SREV_9550(ah))
  517. INIT_INI_ARRAY(&ah->iniModesTxGain,
  518. ar955x_1p0_modes_no_xpa_tx_gain_table,
  519. ARRAY_SIZE(ar955x_1p0_modes_no_xpa_tx_gain_table),
  520. 9);
  521. else if (AR_SREV_9462_20(ah))
  522. INIT_INI_ARRAY(&ah->iniModesTxGain,
  523. ar9462_modes_high_ob_db_tx_gain_table_2p0,
  524. ARRAY_SIZE(ar9462_modes_high_ob_db_tx_gain_table_2p0),
  525. 5);
  526. else
  527. INIT_INI_ARRAY(&ah->iniModesTxGain,
  528. ar9300Modes_high_ob_db_tx_gain_table_2p2,
  529. ARRAY_SIZE(ar9300Modes_high_ob_db_tx_gain_table_2p2),
  530. 5);
  531. }
  532. static void ar9003_tx_gain_table_mode2(struct ath_hw *ah)
  533. {
  534. if (AR_SREV_9330_12(ah))
  535. INIT_INI_ARRAY(&ah->iniModesTxGain,
  536. ar9331_modes_low_ob_db_tx_gain_1p2,
  537. ARRAY_SIZE(ar9331_modes_low_ob_db_tx_gain_1p2),
  538. 5);
  539. else if (AR_SREV_9330_11(ah))
  540. INIT_INI_ARRAY(&ah->iniModesTxGain,
  541. ar9331_modes_low_ob_db_tx_gain_1p1,
  542. ARRAY_SIZE(ar9331_modes_low_ob_db_tx_gain_1p1),
  543. 5);
  544. else if (AR_SREV_9340(ah))
  545. INIT_INI_ARRAY(&ah->iniModesTxGain,
  546. ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
  547. ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
  548. 5);
  549. else if (AR_SREV_9485_11(ah))
  550. INIT_INI_ARRAY(&ah->iniModesTxGain,
  551. ar9485Modes_low_ob_db_tx_gain_1_1,
  552. ARRAY_SIZE(ar9485Modes_low_ob_db_tx_gain_1_1),
  553. 5);
  554. else if (AR_SREV_9580(ah))
  555. INIT_INI_ARRAY(&ah->iniModesTxGain,
  556. ar9580_1p0_low_ob_db_tx_gain_table,
  557. ARRAY_SIZE(ar9580_1p0_low_ob_db_tx_gain_table),
  558. 5);
  559. else
  560. INIT_INI_ARRAY(&ah->iniModesTxGain,
  561. ar9300Modes_low_ob_db_tx_gain_table_2p2,
  562. ARRAY_SIZE(ar9300Modes_low_ob_db_tx_gain_table_2p2),
  563. 5);
  564. }
  565. static void ar9003_tx_gain_table_mode3(struct ath_hw *ah)
  566. {
  567. if (AR_SREV_9330_12(ah))
  568. INIT_INI_ARRAY(&ah->iniModesTxGain,
  569. ar9331_modes_high_power_tx_gain_1p2,
  570. ARRAY_SIZE(ar9331_modes_high_power_tx_gain_1p2),
  571. 5);
  572. else if (AR_SREV_9330_11(ah))
  573. INIT_INI_ARRAY(&ah->iniModesTxGain,
  574. ar9331_modes_high_power_tx_gain_1p1,
  575. ARRAY_SIZE(ar9331_modes_high_power_tx_gain_1p1),
  576. 5);
  577. else if (AR_SREV_9340(ah))
  578. INIT_INI_ARRAY(&ah->iniModesTxGain,
  579. ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
  580. ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
  581. 5);
  582. else if (AR_SREV_9485_11(ah))
  583. INIT_INI_ARRAY(&ah->iniModesTxGain,
  584. ar9485Modes_high_power_tx_gain_1_1,
  585. ARRAY_SIZE(ar9485Modes_high_power_tx_gain_1_1),
  586. 5);
  587. else if (AR_SREV_9580(ah))
  588. INIT_INI_ARRAY(&ah->iniModesTxGain,
  589. ar9580_1p0_high_power_tx_gain_table,
  590. ARRAY_SIZE(ar9580_1p0_high_power_tx_gain_table),
  591. 5);
  592. else
  593. INIT_INI_ARRAY(&ah->iniModesTxGain,
  594. ar9300Modes_high_power_tx_gain_table_2p2,
  595. ARRAY_SIZE(ar9300Modes_high_power_tx_gain_table_2p2),
  596. 5);
  597. }
  598. static void ar9003_tx_gain_table_apply(struct ath_hw *ah)
  599. {
  600. switch (ar9003_hw_get_tx_gain_idx(ah)) {
  601. case 0:
  602. default:
  603. ar9003_tx_gain_table_mode0(ah);
  604. break;
  605. case 1:
  606. ar9003_tx_gain_table_mode1(ah);
  607. break;
  608. case 2:
  609. ar9003_tx_gain_table_mode2(ah);
  610. break;
  611. case 3:
  612. ar9003_tx_gain_table_mode3(ah);
  613. break;
  614. }
  615. }
  616. static void ar9003_rx_gain_table_mode0(struct ath_hw *ah)
  617. {
  618. if (AR_SREV_9330_12(ah))
  619. INIT_INI_ARRAY(&ah->iniModesRxGain,
  620. ar9331_common_rx_gain_1p2,
  621. ARRAY_SIZE(ar9331_common_rx_gain_1p2),
  622. 2);
  623. else if (AR_SREV_9330_11(ah))
  624. INIT_INI_ARRAY(&ah->iniModesRxGain,
  625. ar9331_common_rx_gain_1p1,
  626. ARRAY_SIZE(ar9331_common_rx_gain_1p1),
  627. 2);
  628. else if (AR_SREV_9340(ah))
  629. INIT_INI_ARRAY(&ah->iniModesRxGain,
  630. ar9340Common_rx_gain_table_1p0,
  631. ARRAY_SIZE(ar9340Common_rx_gain_table_1p0),
  632. 2);
  633. else if (AR_SREV_9485_11(ah))
  634. INIT_INI_ARRAY(&ah->iniModesRxGain,
  635. ar9485Common_wo_xlna_rx_gain_1_1,
  636. ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_1),
  637. 2);
  638. else if (AR_SREV_9550(ah)) {
  639. INIT_INI_ARRAY(&ah->iniModesRxGain,
  640. ar955x_1p0_common_rx_gain_table,
  641. ARRAY_SIZE(ar955x_1p0_common_rx_gain_table),
  642. 2);
  643. INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds,
  644. ar955x_1p0_common_rx_gain_bounds,
  645. ARRAY_SIZE(ar955x_1p0_common_rx_gain_bounds),
  646. 5);
  647. } else if (AR_SREV_9580(ah))
  648. INIT_INI_ARRAY(&ah->iniModesRxGain,
  649. ar9580_1p0_rx_gain_table,
  650. ARRAY_SIZE(ar9580_1p0_rx_gain_table),
  651. 2);
  652. else if (AR_SREV_9462_20(ah))
  653. INIT_INI_ARRAY(&ah->iniModesRxGain,
  654. ar9462_common_rx_gain_table_2p0,
  655. ARRAY_SIZE(ar9462_common_rx_gain_table_2p0),
  656. 2);
  657. else
  658. INIT_INI_ARRAY(&ah->iniModesRxGain,
  659. ar9300Common_rx_gain_table_2p2,
  660. ARRAY_SIZE(ar9300Common_rx_gain_table_2p2),
  661. 2);
  662. }
  663. static void ar9003_rx_gain_table_mode1(struct ath_hw *ah)
  664. {
  665. if (AR_SREV_9330_12(ah))
  666. INIT_INI_ARRAY(&ah->iniModesRxGain,
  667. ar9331_common_wo_xlna_rx_gain_1p2,
  668. ARRAY_SIZE(ar9331_common_wo_xlna_rx_gain_1p2),
  669. 2);
  670. else if (AR_SREV_9330_11(ah))
  671. INIT_INI_ARRAY(&ah->iniModesRxGain,
  672. ar9331_common_wo_xlna_rx_gain_1p1,
  673. ARRAY_SIZE(ar9331_common_wo_xlna_rx_gain_1p1),
  674. 2);
  675. else if (AR_SREV_9340(ah))
  676. INIT_INI_ARRAY(&ah->iniModesRxGain,
  677. ar9340Common_wo_xlna_rx_gain_table_1p0,
  678. ARRAY_SIZE(ar9340Common_wo_xlna_rx_gain_table_1p0),
  679. 2);
  680. else if (AR_SREV_9485_11(ah))
  681. INIT_INI_ARRAY(&ah->iniModesRxGain,
  682. ar9485Common_wo_xlna_rx_gain_1_1,
  683. ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_1),
  684. 2);
  685. else if (AR_SREV_9462_20(ah))
  686. INIT_INI_ARRAY(&ah->iniModesRxGain,
  687. ar9462_common_wo_xlna_rx_gain_table_2p0,
  688. ARRAY_SIZE(ar9462_common_wo_xlna_rx_gain_table_2p0),
  689. 2);
  690. else if (AR_SREV_9550(ah)) {
  691. INIT_INI_ARRAY(&ah->iniModesRxGain,
  692. ar955x_1p0_common_wo_xlna_rx_gain_table,
  693. ARRAY_SIZE(ar955x_1p0_common_wo_xlna_rx_gain_table),
  694. 2);
  695. INIT_INI_ARRAY(&ah->ini_modes_rx_gain_bounds,
  696. ar955x_1p0_common_wo_xlna_rx_gain_bounds,
  697. ARRAY_SIZE(ar955x_1p0_common_wo_xlna_rx_gain_bounds),
  698. 5);
  699. } else if (AR_SREV_9580(ah))
  700. INIT_INI_ARRAY(&ah->iniModesRxGain,
  701. ar9580_1p0_wo_xlna_rx_gain_table,
  702. ARRAY_SIZE(ar9580_1p0_wo_xlna_rx_gain_table),
  703. 2);
  704. else
  705. INIT_INI_ARRAY(&ah->iniModesRxGain,
  706. ar9300Common_wo_xlna_rx_gain_table_2p2,
  707. ARRAY_SIZE(ar9300Common_wo_xlna_rx_gain_table_2p2),
  708. 2);
  709. }
  710. static void ar9003_rx_gain_table_mode2(struct ath_hw *ah)
  711. {
  712. if (AR_SREV_9462_20(ah))
  713. INIT_INI_ARRAY(&ah->iniModesRxGain,
  714. ar9462_common_mixed_rx_gain_table_2p0,
  715. ARRAY_SIZE(ar9462_common_mixed_rx_gain_table_2p0), 2);
  716. }
  717. static void ar9003_rx_gain_table_apply(struct ath_hw *ah)
  718. {
  719. switch (ar9003_hw_get_rx_gain_idx(ah)) {
  720. case 0:
  721. default:
  722. ar9003_rx_gain_table_mode0(ah);
  723. break;
  724. case 1:
  725. ar9003_rx_gain_table_mode1(ah);
  726. break;
  727. case 2:
  728. ar9003_rx_gain_table_mode2(ah);
  729. break;
  730. }
  731. }
  732. /* set gain table pointers according to values read from the eeprom */
  733. static void ar9003_hw_init_mode_gain_regs(struct ath_hw *ah)
  734. {
  735. ar9003_tx_gain_table_apply(ah);
  736. ar9003_rx_gain_table_apply(ah);
  737. }
  738. /*
  739. * Helper for ASPM support.
  740. *
  741. * Disable PLL when in L0s as well as receiver clock when in L1.
  742. * This power saving option must be enabled through the SerDes.
  743. *
  744. * Programming the SerDes must go through the same 288 bit serial shift
  745. * register as the other analog registers. Hence the 9 writes.
  746. */
  747. static void ar9003_hw_configpcipowersave(struct ath_hw *ah,
  748. bool power_off)
  749. {
  750. /* Nothing to do on restore for 11N */
  751. if (!power_off /* !restore */) {
  752. /* set bit 19 to allow forcing of pcie core into L1 state */
  753. REG_SET_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA);
  754. /* Several PCIe massages to ensure proper behaviour */
  755. if (ah->config.pcie_waen)
  756. REG_WRITE(ah, AR_WA, ah->config.pcie_waen);
  757. else
  758. REG_WRITE(ah, AR_WA, ah->WARegVal);
  759. }
  760. /*
  761. * Configire PCIE after Ini init. SERDES values now come from ini file
  762. * This enables PCIe low power mode.
  763. */
  764. if (ah->config.pcieSerDesWrite) {
  765. unsigned int i;
  766. struct ar5416IniArray *array;
  767. array = power_off ? &ah->iniPcieSerdes :
  768. &ah->iniPcieSerdesLowPower;
  769. for (i = 0; i < array->ia_rows; i++) {
  770. REG_WRITE(ah,
  771. INI_RA(array, i, 0),
  772. INI_RA(array, i, 1));
  773. }
  774. }
  775. }
  776. /* Sets up the AR9003 hardware familiy callbacks */
  777. void ar9003_hw_attach_ops(struct ath_hw *ah)
  778. {
  779. struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
  780. struct ath_hw_ops *ops = ath9k_hw_ops(ah);
  781. priv_ops->init_mode_regs = ar9003_hw_init_mode_regs;
  782. priv_ops->init_mode_gain_regs = ar9003_hw_init_mode_gain_regs;
  783. ops->config_pci_powersave = ar9003_hw_configpcipowersave;
  784. ar9003_hw_attach_phy_ops(ah);
  785. ar9003_hw_attach_calib_ops(ah);
  786. ar9003_hw_attach_mac_ops(ah);
  787. }