ar9003_hw.c 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868
  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 "ar9580_1p0_initvals.h"
  24. #include "ar9462_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->iniModesAdditional,
  82. ar9331_1p1_xtal_25M,
  83. ARRAY_SIZE(ar9331_1p1_xtal_25M), 2);
  84. else
  85. INIT_INI_ARRAY(&ah->iniModesAdditional,
  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->iniModesAdditional,
  130. ar9331_1p2_xtal_25M,
  131. ARRAY_SIZE(ar9331_1p2_xtal_25M), 2);
  132. else
  133. INIT_INI_ARRAY(&ah->iniModesAdditional,
  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->iniModesAdditional,
  179. ar9340Modes_fast_clock_1p0,
  180. ARRAY_SIZE(ar9340Modes_fast_clock_1p0),
  181. 3);
  182. INIT_INI_ARRAY(&ah->iniModesAdditional_40M,
  183. ar9340_1p0_radio_core_40M,
  184. ARRAY_SIZE(ar9340_1p0_radio_core_40M),
  185. 2);
  186. } else if (AR_SREV_9485_11(ah)) {
  187. /* mac */
  188. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
  189. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
  190. ar9485_1_1_mac_core,
  191. ARRAY_SIZE(ar9485_1_1_mac_core), 2);
  192. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
  193. ar9485_1_1_mac_postamble,
  194. ARRAY_SIZE(ar9485_1_1_mac_postamble), 5);
  195. /* bb */
  196. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], ar9485_1_1,
  197. ARRAY_SIZE(ar9485_1_1), 2);
  198. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
  199. ar9485_1_1_baseband_core,
  200. ARRAY_SIZE(ar9485_1_1_baseband_core), 2);
  201. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
  202. ar9485_1_1_baseband_postamble,
  203. ARRAY_SIZE(ar9485_1_1_baseband_postamble), 5);
  204. /* radio */
  205. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
  206. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
  207. ar9485_1_1_radio_core,
  208. ARRAY_SIZE(ar9485_1_1_radio_core), 2);
  209. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
  210. ar9485_1_1_radio_postamble,
  211. ARRAY_SIZE(ar9485_1_1_radio_postamble), 2);
  212. /* soc */
  213. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
  214. ar9485_1_1_soc_preamble,
  215. ARRAY_SIZE(ar9485_1_1_soc_preamble), 2);
  216. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
  217. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST], NULL, 0, 0);
  218. /* rx/tx gain */
  219. INIT_INI_ARRAY(&ah->iniModesRxGain,
  220. ar9485Common_wo_xlna_rx_gain_1_1,
  221. ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_1), 2);
  222. INIT_INI_ARRAY(&ah->iniModesTxGain,
  223. ar9485_modes_lowest_ob_db_tx_gain_1_1,
  224. ARRAY_SIZE(ar9485_modes_lowest_ob_db_tx_gain_1_1),
  225. 5);
  226. /* Load PCIE SERDES settings from INI */
  227. /* Awake Setting */
  228. INIT_INI_ARRAY(&ah->iniPcieSerdes,
  229. ar9485_1_1_pcie_phy_clkreq_disable_L1,
  230. ARRAY_SIZE(ar9485_1_1_pcie_phy_clkreq_disable_L1),
  231. 2);
  232. /* Sleep Setting */
  233. INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
  234. ar9485_1_1_pcie_phy_clkreq_disable_L1,
  235. ARRAY_SIZE(ar9485_1_1_pcie_phy_clkreq_disable_L1),
  236. 2);
  237. } else if (AR_SREV_9462_10(ah)) {
  238. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
  239. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], ar9462_1p0_mac_core,
  240. ARRAY_SIZE(ar9462_1p0_mac_core), 2);
  241. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
  242. ar9462_1p0_mac_postamble,
  243. ARRAY_SIZE(ar9462_1p0_mac_postamble),
  244. 5);
  245. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
  246. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
  247. ar9462_1p0_baseband_core,
  248. ARRAY_SIZE(ar9462_1p0_baseband_core),
  249. 2);
  250. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
  251. ar9462_1p0_baseband_postamble,
  252. ARRAY_SIZE(ar9462_1p0_baseband_postamble), 5);
  253. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
  254. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
  255. ar9462_1p0_radio_core,
  256. ARRAY_SIZE(ar9462_1p0_radio_core), 2);
  257. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
  258. ar9462_1p0_radio_postamble,
  259. ARRAY_SIZE(ar9462_1p0_radio_postamble), 5);
  260. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
  261. ar9462_1p0_soc_preamble,
  262. ARRAY_SIZE(ar9462_1p0_soc_preamble), 2);
  263. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
  264. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
  265. ar9462_1p0_soc_postamble,
  266. ARRAY_SIZE(ar9462_1p0_soc_postamble), 5);
  267. INIT_INI_ARRAY(&ah->iniModesRxGain,
  268. ar9462_common_rx_gain_table_1p0,
  269. ARRAY_SIZE(ar9462_common_rx_gain_table_1p0), 2);
  270. /* Awake -> Sleep Setting */
  271. INIT_INI_ARRAY(&ah->iniPcieSerdes,
  272. ar9462_pcie_phy_clkreq_disable_L1_1p0,
  273. ARRAY_SIZE(ar9462_pcie_phy_clkreq_disable_L1_1p0),
  274. 2);
  275. /* Sleep -> Awake Setting */
  276. INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
  277. ar9462_pcie_phy_clkreq_disable_L1_1p0,
  278. ARRAY_SIZE(ar9462_pcie_phy_clkreq_disable_L1_1p0),
  279. 2);
  280. INIT_INI_ARRAY(&ah->iniModesAdditional,
  281. ar9462_modes_fast_clock_1p0,
  282. ARRAY_SIZE(ar9462_modes_fast_clock_1p0), 3);
  283. INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
  284. AR9462_BB_CTX_COEFJ(1p0),
  285. ARRAY_SIZE(AR9462_BB_CTX_COEFJ(1p0)), 2);
  286. } else if (AR_SREV_9462_20(ah)) {
  287. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
  288. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], ar9462_2p0_mac_core,
  289. ARRAY_SIZE(ar9462_2p0_mac_core), 2);
  290. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
  291. ar9462_2p0_mac_postamble,
  292. ARRAY_SIZE(ar9462_2p0_mac_postamble), 5);
  293. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
  294. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
  295. ar9462_2p0_baseband_core,
  296. ARRAY_SIZE(ar9462_2p0_baseband_core), 2);
  297. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
  298. ar9462_2p0_baseband_postamble,
  299. ARRAY_SIZE(ar9462_2p0_baseband_postamble), 5);
  300. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
  301. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
  302. ar9462_2p0_radio_core,
  303. ARRAY_SIZE(ar9462_2p0_radio_core), 2);
  304. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
  305. ar9462_2p0_radio_postamble,
  306. ARRAY_SIZE(ar9462_2p0_radio_postamble), 5);
  307. INIT_INI_ARRAY(&ah->ini_radio_post_sys2ant,
  308. ar9462_2p0_radio_postamble_sys2ant,
  309. ARRAY_SIZE(ar9462_2p0_radio_postamble_sys2ant),
  310. 5);
  311. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
  312. ar9462_2p0_soc_preamble,
  313. ARRAY_SIZE(ar9462_2p0_soc_preamble), 2);
  314. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
  315. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
  316. ar9462_2p0_soc_postamble,
  317. ARRAY_SIZE(ar9462_2p0_soc_postamble), 5);
  318. INIT_INI_ARRAY(&ah->iniModesRxGain,
  319. ar9462_common_rx_gain_table_2p0,
  320. ARRAY_SIZE(ar9462_common_rx_gain_table_2p0), 2);
  321. INIT_INI_ARRAY(&ah->ini_BTCOEX_MAX_TXPWR,
  322. ar9462_2p0_BTCOEX_MAX_TXPWR_table,
  323. ARRAY_SIZE(ar9462_2p0_BTCOEX_MAX_TXPWR_table),
  324. 2);
  325. /* Awake -> Sleep Setting */
  326. INIT_INI_ARRAY(&ah->iniPcieSerdes,
  327. PCIE_PLL_ON_CREQ_DIS_L1_2P0,
  328. ARRAY_SIZE(PCIE_PLL_ON_CREQ_DIS_L1_2P0),
  329. 2);
  330. /* Sleep -> Awake Setting */
  331. INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
  332. PCIE_PLL_ON_CREQ_DIS_L1_2P0,
  333. ARRAY_SIZE(PCIE_PLL_ON_CREQ_DIS_L1_2P0),
  334. 2);
  335. /* Fast clock modal settings */
  336. INIT_INI_ARRAY(&ah->iniModesAdditional,
  337. ar9462_modes_fast_clock_2p0,
  338. ARRAY_SIZE(ar9462_modes_fast_clock_2p0), 3);
  339. INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
  340. AR9462_BB_CTX_COEFJ(2p0),
  341. ARRAY_SIZE(AR9462_BB_CTX_COEFJ(2p0)), 2);
  342. INIT_INI_ARRAY(&ah->ini_japan2484, AR9462_BBC_TXIFR_COEFFJ,
  343. ARRAY_SIZE(AR9462_BBC_TXIFR_COEFFJ), 2);
  344. } else if (AR_SREV_9580(ah)) {
  345. /* mac */
  346. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
  347. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
  348. ar9580_1p0_mac_core,
  349. ARRAY_SIZE(ar9580_1p0_mac_core), 2);
  350. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
  351. ar9580_1p0_mac_postamble,
  352. ARRAY_SIZE(ar9580_1p0_mac_postamble), 5);
  353. /* bb */
  354. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
  355. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
  356. ar9580_1p0_baseband_core,
  357. ARRAY_SIZE(ar9580_1p0_baseband_core), 2);
  358. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
  359. ar9580_1p0_baseband_postamble,
  360. ARRAY_SIZE(ar9580_1p0_baseband_postamble), 5);
  361. /* radio */
  362. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
  363. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
  364. ar9580_1p0_radio_core,
  365. ARRAY_SIZE(ar9580_1p0_radio_core), 2);
  366. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
  367. ar9580_1p0_radio_postamble,
  368. ARRAY_SIZE(ar9580_1p0_radio_postamble), 5);
  369. /* soc */
  370. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
  371. ar9580_1p0_soc_preamble,
  372. ARRAY_SIZE(ar9580_1p0_soc_preamble), 2);
  373. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
  374. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
  375. ar9580_1p0_soc_postamble,
  376. ARRAY_SIZE(ar9580_1p0_soc_postamble), 5);
  377. /* rx/tx gain */
  378. INIT_INI_ARRAY(&ah->iniModesRxGain,
  379. ar9580_1p0_rx_gain_table,
  380. ARRAY_SIZE(ar9580_1p0_rx_gain_table), 2);
  381. INIT_INI_ARRAY(&ah->iniModesTxGain,
  382. ar9580_1p0_low_ob_db_tx_gain_table,
  383. ARRAY_SIZE(ar9580_1p0_low_ob_db_tx_gain_table),
  384. 5);
  385. INIT_INI_ARRAY(&ah->iniModesAdditional,
  386. ar9580_1p0_modes_fast_clock,
  387. ARRAY_SIZE(ar9580_1p0_modes_fast_clock),
  388. 3);
  389. } else {
  390. /* mac */
  391. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
  392. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
  393. ar9300_2p2_mac_core,
  394. ARRAY_SIZE(ar9300_2p2_mac_core), 2);
  395. INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
  396. ar9300_2p2_mac_postamble,
  397. ARRAY_SIZE(ar9300_2p2_mac_postamble), 5);
  398. /* bb */
  399. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
  400. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
  401. ar9300_2p2_baseband_core,
  402. ARRAY_SIZE(ar9300_2p2_baseband_core), 2);
  403. INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
  404. ar9300_2p2_baseband_postamble,
  405. ARRAY_SIZE(ar9300_2p2_baseband_postamble), 5);
  406. /* radio */
  407. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
  408. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
  409. ar9300_2p2_radio_core,
  410. ARRAY_SIZE(ar9300_2p2_radio_core), 2);
  411. INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
  412. ar9300_2p2_radio_postamble,
  413. ARRAY_SIZE(ar9300_2p2_radio_postamble), 5);
  414. /* soc */
  415. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
  416. ar9300_2p2_soc_preamble,
  417. ARRAY_SIZE(ar9300_2p2_soc_preamble), 2);
  418. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
  419. INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
  420. ar9300_2p2_soc_postamble,
  421. ARRAY_SIZE(ar9300_2p2_soc_postamble), 5);
  422. /* rx/tx gain */
  423. INIT_INI_ARRAY(&ah->iniModesRxGain,
  424. ar9300Common_rx_gain_table_2p2,
  425. ARRAY_SIZE(ar9300Common_rx_gain_table_2p2), 2);
  426. INIT_INI_ARRAY(&ah->iniModesTxGain,
  427. ar9300Modes_lowest_ob_db_tx_gain_table_2p2,
  428. ARRAY_SIZE(ar9300Modes_lowest_ob_db_tx_gain_table_2p2),
  429. 5);
  430. /* Load PCIE SERDES settings from INI */
  431. /* Awake Setting */
  432. INIT_INI_ARRAY(&ah->iniPcieSerdes,
  433. ar9300PciePhy_pll_on_clkreq_disable_L1_2p2,
  434. ARRAY_SIZE(ar9300PciePhy_pll_on_clkreq_disable_L1_2p2),
  435. 2);
  436. /* Sleep Setting */
  437. INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
  438. ar9300PciePhy_pll_on_clkreq_disable_L1_2p2,
  439. ARRAY_SIZE(ar9300PciePhy_pll_on_clkreq_disable_L1_2p2),
  440. 2);
  441. /* Fast clock modal settings */
  442. INIT_INI_ARRAY(&ah->iniModesAdditional,
  443. ar9300Modes_fast_clock_2p2,
  444. ARRAY_SIZE(ar9300Modes_fast_clock_2p2),
  445. 3);
  446. }
  447. }
  448. static void ar9003_tx_gain_table_mode0(struct ath_hw *ah)
  449. {
  450. if (AR_SREV_9330_12(ah))
  451. INIT_INI_ARRAY(&ah->iniModesTxGain,
  452. ar9331_modes_lowest_ob_db_tx_gain_1p2,
  453. ARRAY_SIZE(ar9331_modes_lowest_ob_db_tx_gain_1p2),
  454. 5);
  455. else if (AR_SREV_9330_11(ah))
  456. INIT_INI_ARRAY(&ah->iniModesTxGain,
  457. ar9331_modes_lowest_ob_db_tx_gain_1p1,
  458. ARRAY_SIZE(ar9331_modes_lowest_ob_db_tx_gain_1p1),
  459. 5);
  460. else if (AR_SREV_9340(ah))
  461. INIT_INI_ARRAY(&ah->iniModesTxGain,
  462. ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
  463. ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
  464. 5);
  465. else if (AR_SREV_9485_11(ah))
  466. INIT_INI_ARRAY(&ah->iniModesTxGain,
  467. ar9485_modes_lowest_ob_db_tx_gain_1_1,
  468. ARRAY_SIZE(ar9485_modes_lowest_ob_db_tx_gain_1_1),
  469. 5);
  470. else if (AR_SREV_9580(ah))
  471. INIT_INI_ARRAY(&ah->iniModesTxGain,
  472. ar9580_1p0_lowest_ob_db_tx_gain_table,
  473. ARRAY_SIZE(ar9580_1p0_lowest_ob_db_tx_gain_table),
  474. 5);
  475. else if (AR_SREV_9462_10(ah))
  476. INIT_INI_ARRAY(&ah->iniModesTxGain,
  477. ar9462_modes_low_ob_db_tx_gain_table_1p0,
  478. ARRAY_SIZE(ar9462_modes_low_ob_db_tx_gain_table_1p0),
  479. 5);
  480. else if (AR_SREV_9462_20(ah))
  481. INIT_INI_ARRAY(&ah->iniModesTxGain,
  482. ar9462_modes_low_ob_db_tx_gain_table_2p0,
  483. ARRAY_SIZE(ar9462_modes_low_ob_db_tx_gain_table_2p0),
  484. 5);
  485. else
  486. INIT_INI_ARRAY(&ah->iniModesTxGain,
  487. ar9300Modes_lowest_ob_db_tx_gain_table_2p2,
  488. ARRAY_SIZE(ar9300Modes_lowest_ob_db_tx_gain_table_2p2),
  489. 5);
  490. }
  491. static void ar9003_tx_gain_table_mode1(struct ath_hw *ah)
  492. {
  493. if (AR_SREV_9330_12(ah))
  494. INIT_INI_ARRAY(&ah->iniModesTxGain,
  495. ar9331_modes_high_ob_db_tx_gain_1p2,
  496. ARRAY_SIZE(ar9331_modes_high_ob_db_tx_gain_1p2),
  497. 5);
  498. else if (AR_SREV_9330_11(ah))
  499. INIT_INI_ARRAY(&ah->iniModesTxGain,
  500. ar9331_modes_high_ob_db_tx_gain_1p1,
  501. ARRAY_SIZE(ar9331_modes_high_ob_db_tx_gain_1p1),
  502. 5);
  503. else if (AR_SREV_9340(ah))
  504. INIT_INI_ARRAY(&ah->iniModesTxGain,
  505. ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
  506. ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
  507. 5);
  508. else if (AR_SREV_9485_11(ah))
  509. INIT_INI_ARRAY(&ah->iniModesTxGain,
  510. ar9485Modes_high_ob_db_tx_gain_1_1,
  511. ARRAY_SIZE(ar9485Modes_high_ob_db_tx_gain_1_1),
  512. 5);
  513. else if (AR_SREV_9580(ah))
  514. INIT_INI_ARRAY(&ah->iniModesTxGain,
  515. ar9580_1p0_high_ob_db_tx_gain_table,
  516. ARRAY_SIZE(ar9580_1p0_high_ob_db_tx_gain_table),
  517. 5);
  518. else if (AR_SREV_9462_10(ah))
  519. INIT_INI_ARRAY(&ah->iniModesTxGain,
  520. ar9462_modes_high_ob_db_tx_gain_table_1p0,
  521. ARRAY_SIZE(ar9462_modes_high_ob_db_tx_gain_table_1p0),
  522. 5);
  523. else if (AR_SREV_9462_20(ah))
  524. INIT_INI_ARRAY(&ah->iniModesTxGain,
  525. ar9462_modes_high_ob_db_tx_gain_table_2p0,
  526. ARRAY_SIZE(ar9462_modes_high_ob_db_tx_gain_table_2p0),
  527. 5);
  528. else
  529. INIT_INI_ARRAY(&ah->iniModesTxGain,
  530. ar9300Modes_high_ob_db_tx_gain_table_2p2,
  531. ARRAY_SIZE(ar9300Modes_high_ob_db_tx_gain_table_2p2),
  532. 5);
  533. }
  534. static void ar9003_tx_gain_table_mode2(struct ath_hw *ah)
  535. {
  536. if (AR_SREV_9330_12(ah))
  537. INIT_INI_ARRAY(&ah->iniModesTxGain,
  538. ar9331_modes_low_ob_db_tx_gain_1p2,
  539. ARRAY_SIZE(ar9331_modes_low_ob_db_tx_gain_1p2),
  540. 5);
  541. else if (AR_SREV_9330_11(ah))
  542. INIT_INI_ARRAY(&ah->iniModesTxGain,
  543. ar9331_modes_low_ob_db_tx_gain_1p1,
  544. ARRAY_SIZE(ar9331_modes_low_ob_db_tx_gain_1p1),
  545. 5);
  546. else if (AR_SREV_9340(ah))
  547. INIT_INI_ARRAY(&ah->iniModesTxGain,
  548. ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
  549. ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
  550. 5);
  551. else if (AR_SREV_9485_11(ah))
  552. INIT_INI_ARRAY(&ah->iniModesTxGain,
  553. ar9485Modes_low_ob_db_tx_gain_1_1,
  554. ARRAY_SIZE(ar9485Modes_low_ob_db_tx_gain_1_1),
  555. 5);
  556. else if (AR_SREV_9580(ah))
  557. INIT_INI_ARRAY(&ah->iniModesTxGain,
  558. ar9580_1p0_low_ob_db_tx_gain_table,
  559. ARRAY_SIZE(ar9580_1p0_low_ob_db_tx_gain_table),
  560. 5);
  561. else
  562. INIT_INI_ARRAY(&ah->iniModesTxGain,
  563. ar9300Modes_low_ob_db_tx_gain_table_2p2,
  564. ARRAY_SIZE(ar9300Modes_low_ob_db_tx_gain_table_2p2),
  565. 5);
  566. }
  567. static void ar9003_tx_gain_table_mode3(struct ath_hw *ah)
  568. {
  569. if (AR_SREV_9330_12(ah))
  570. INIT_INI_ARRAY(&ah->iniModesTxGain,
  571. ar9331_modes_high_power_tx_gain_1p2,
  572. ARRAY_SIZE(ar9331_modes_high_power_tx_gain_1p2),
  573. 5);
  574. else if (AR_SREV_9330_11(ah))
  575. INIT_INI_ARRAY(&ah->iniModesTxGain,
  576. ar9331_modes_high_power_tx_gain_1p1,
  577. ARRAY_SIZE(ar9331_modes_high_power_tx_gain_1p1),
  578. 5);
  579. else if (AR_SREV_9340(ah))
  580. INIT_INI_ARRAY(&ah->iniModesTxGain,
  581. ar9340Modes_lowest_ob_db_tx_gain_table_1p0,
  582. ARRAY_SIZE(ar9340Modes_lowest_ob_db_tx_gain_table_1p0),
  583. 5);
  584. else if (AR_SREV_9485_11(ah))
  585. INIT_INI_ARRAY(&ah->iniModesTxGain,
  586. ar9485Modes_high_power_tx_gain_1_1,
  587. ARRAY_SIZE(ar9485Modes_high_power_tx_gain_1_1),
  588. 5);
  589. else if (AR_SREV_9580(ah))
  590. INIT_INI_ARRAY(&ah->iniModesTxGain,
  591. ar9580_1p0_high_power_tx_gain_table,
  592. ARRAY_SIZE(ar9580_1p0_high_power_tx_gain_table),
  593. 5);
  594. else
  595. INIT_INI_ARRAY(&ah->iniModesTxGain,
  596. ar9300Modes_high_power_tx_gain_table_2p2,
  597. ARRAY_SIZE(ar9300Modes_high_power_tx_gain_table_2p2),
  598. 5);
  599. }
  600. static void ar9003_tx_gain_table_apply(struct ath_hw *ah)
  601. {
  602. switch (ar9003_hw_get_tx_gain_idx(ah)) {
  603. case 0:
  604. default:
  605. ar9003_tx_gain_table_mode0(ah);
  606. break;
  607. case 1:
  608. ar9003_tx_gain_table_mode1(ah);
  609. break;
  610. case 2:
  611. ar9003_tx_gain_table_mode2(ah);
  612. break;
  613. case 3:
  614. ar9003_tx_gain_table_mode3(ah);
  615. break;
  616. }
  617. }
  618. static void ar9003_rx_gain_table_mode0(struct ath_hw *ah)
  619. {
  620. if (AR_SREV_9330_12(ah))
  621. INIT_INI_ARRAY(&ah->iniModesRxGain,
  622. ar9331_common_rx_gain_1p2,
  623. ARRAY_SIZE(ar9331_common_rx_gain_1p2),
  624. 2);
  625. else if (AR_SREV_9330_11(ah))
  626. INIT_INI_ARRAY(&ah->iniModesRxGain,
  627. ar9331_common_rx_gain_1p1,
  628. ARRAY_SIZE(ar9331_common_rx_gain_1p1),
  629. 2);
  630. else if (AR_SREV_9340(ah))
  631. INIT_INI_ARRAY(&ah->iniModesRxGain,
  632. ar9340Common_rx_gain_table_1p0,
  633. ARRAY_SIZE(ar9340Common_rx_gain_table_1p0),
  634. 2);
  635. else if (AR_SREV_9485_11(ah))
  636. INIT_INI_ARRAY(&ah->iniModesRxGain,
  637. ar9485Common_wo_xlna_rx_gain_1_1,
  638. ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_1),
  639. 2);
  640. else if (AR_SREV_9580(ah))
  641. INIT_INI_ARRAY(&ah->iniModesRxGain,
  642. ar9580_1p0_rx_gain_table,
  643. ARRAY_SIZE(ar9580_1p0_rx_gain_table),
  644. 2);
  645. else if (AR_SREV_9462_10(ah))
  646. INIT_INI_ARRAY(&ah->iniModesRxGain,
  647. ar9462_common_rx_gain_table_1p0,
  648. ARRAY_SIZE(ar9462_common_rx_gain_table_1p0),
  649. 2);
  650. else if (AR_SREV_9462_20(ah))
  651. INIT_INI_ARRAY(&ah->iniModesRxGain,
  652. ar9462_common_rx_gain_table_2p0,
  653. ARRAY_SIZE(ar9462_common_rx_gain_table_2p0),
  654. 2);
  655. else
  656. INIT_INI_ARRAY(&ah->iniModesRxGain,
  657. ar9300Common_rx_gain_table_2p2,
  658. ARRAY_SIZE(ar9300Common_rx_gain_table_2p2),
  659. 2);
  660. }
  661. static void ar9003_rx_gain_table_mode1(struct ath_hw *ah)
  662. {
  663. if (AR_SREV_9330_12(ah))
  664. INIT_INI_ARRAY(&ah->iniModesRxGain,
  665. ar9331_common_wo_xlna_rx_gain_1p2,
  666. ARRAY_SIZE(ar9331_common_wo_xlna_rx_gain_1p2),
  667. 2);
  668. else if (AR_SREV_9330_11(ah))
  669. INIT_INI_ARRAY(&ah->iniModesRxGain,
  670. ar9331_common_wo_xlna_rx_gain_1p1,
  671. ARRAY_SIZE(ar9331_common_wo_xlna_rx_gain_1p1),
  672. 2);
  673. else if (AR_SREV_9340(ah))
  674. INIT_INI_ARRAY(&ah->iniModesRxGain,
  675. ar9340Common_wo_xlna_rx_gain_table_1p0,
  676. ARRAY_SIZE(ar9340Common_wo_xlna_rx_gain_table_1p0),
  677. 2);
  678. else if (AR_SREV_9485_11(ah))
  679. INIT_INI_ARRAY(&ah->iniModesRxGain,
  680. ar9485Common_wo_xlna_rx_gain_1_1,
  681. ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_1),
  682. 2);
  683. else if (AR_SREV_9462_10(ah))
  684. INIT_INI_ARRAY(&ah->iniModesRxGain,
  685. ar9462_common_wo_xlna_rx_gain_table_1p0,
  686. ARRAY_SIZE(ar9462_common_wo_xlna_rx_gain_table_1p0),
  687. 2);
  688. else if (AR_SREV_9462_20(ah))
  689. INIT_INI_ARRAY(&ah->iniModesRxGain,
  690. ar9462_common_wo_xlna_rx_gain_table_2p0,
  691. ARRAY_SIZE(ar9462_common_wo_xlna_rx_gain_table_2p0),
  692. 2);
  693. else if (AR_SREV_9580(ah))
  694. INIT_INI_ARRAY(&ah->iniModesRxGain,
  695. ar9580_1p0_wo_xlna_rx_gain_table,
  696. ARRAY_SIZE(ar9580_1p0_wo_xlna_rx_gain_table),
  697. 2);
  698. else
  699. INIT_INI_ARRAY(&ah->iniModesRxGain,
  700. ar9300Common_wo_xlna_rx_gain_table_2p2,
  701. ARRAY_SIZE(ar9300Common_wo_xlna_rx_gain_table_2p2),
  702. 2);
  703. }
  704. static void ar9003_rx_gain_table_mode2(struct ath_hw *ah)
  705. {
  706. if (AR_SREV_9462_10(ah))
  707. INIT_INI_ARRAY(&ah->iniModesRxGain,
  708. ar9462_common_mixed_rx_gain_table_1p0,
  709. ARRAY_SIZE(ar9462_common_mixed_rx_gain_table_1p0), 2);
  710. else if (AR_SREV_9462_20(ah))
  711. INIT_INI_ARRAY(&ah->iniModesRxGain,
  712. ar9462_common_mixed_rx_gain_table_2p0,
  713. ARRAY_SIZE(ar9462_common_mixed_rx_gain_table_2p0), 2);
  714. }
  715. static void ar9003_rx_gain_table_apply(struct ath_hw *ah)
  716. {
  717. switch (ar9003_hw_get_rx_gain_idx(ah)) {
  718. case 0:
  719. default:
  720. ar9003_rx_gain_table_mode0(ah);
  721. break;
  722. case 1:
  723. ar9003_rx_gain_table_mode1(ah);
  724. break;
  725. case 2:
  726. ar9003_rx_gain_table_mode2(ah);
  727. break;
  728. }
  729. }
  730. /* set gain table pointers according to values read from the eeprom */
  731. static void ar9003_hw_init_mode_gain_regs(struct ath_hw *ah)
  732. {
  733. ar9003_tx_gain_table_apply(ah);
  734. ar9003_rx_gain_table_apply(ah);
  735. }
  736. /*
  737. * Helper for ASPM support.
  738. *
  739. * Disable PLL when in L0s as well as receiver clock when in L1.
  740. * This power saving option must be enabled through the SerDes.
  741. *
  742. * Programming the SerDes must go through the same 288 bit serial shift
  743. * register as the other analog registers. Hence the 9 writes.
  744. */
  745. static void ar9003_hw_configpcipowersave(struct ath_hw *ah,
  746. bool power_off)
  747. {
  748. /* Nothing to do on restore for 11N */
  749. if (!power_off /* !restore */) {
  750. /* set bit 19 to allow forcing of pcie core into L1 state */
  751. REG_SET_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA);
  752. /* Several PCIe massages to ensure proper behaviour */
  753. if (ah->config.pcie_waen)
  754. REG_WRITE(ah, AR_WA, ah->config.pcie_waen);
  755. else
  756. REG_WRITE(ah, AR_WA, ah->WARegVal);
  757. }
  758. /*
  759. * Configire PCIE after Ini init. SERDES values now come from ini file
  760. * This enables PCIe low power mode.
  761. */
  762. if (ah->config.pcieSerDesWrite) {
  763. unsigned int i;
  764. struct ar5416IniArray *array;
  765. array = power_off ? &ah->iniPcieSerdes :
  766. &ah->iniPcieSerdesLowPower;
  767. for (i = 0; i < array->ia_rows; i++) {
  768. REG_WRITE(ah,
  769. INI_RA(array, i, 0),
  770. INI_RA(array, i, 1));
  771. }
  772. }
  773. }
  774. /* Sets up the AR9003 hardware familiy callbacks */
  775. void ar9003_hw_attach_ops(struct ath_hw *ah)
  776. {
  777. struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
  778. struct ath_hw_ops *ops = ath9k_hw_ops(ah);
  779. priv_ops->init_mode_regs = ar9003_hw_init_mode_regs;
  780. priv_ops->init_mode_gain_regs = ar9003_hw_init_mode_gain_regs;
  781. ops->config_pci_powersave = ar9003_hw_configpcipowersave;
  782. ar9003_hw_attach_phy_ops(ah);
  783. ar9003_hw_attach_calib_ops(ah);
  784. ar9003_hw_attach_mac_ops(ah);
  785. }