initvals.c 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606
  1. /*
  2. * Initial register settings functions
  3. *
  4. * Copyright (c) 2004-2007 Reyk Floeter <reyk@openbsd.org>
  5. * Copyright (c) 2006-2009 Nick Kossifidis <mickflemm@gmail.com>
  6. * Copyright (c) 2007-2008 Jiri Slaby <jirislaby@gmail.com>
  7. *
  8. * Permission to use, copy, modify, and distribute this software for any
  9. * purpose with or without fee is hereby granted, provided that the above
  10. * copyright notice and this permission notice appear in all copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  13. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  14. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  15. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  16. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  17. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  18. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  19. *
  20. */
  21. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  22. #include "ath5k.h"
  23. #include "reg.h"
  24. #include "debug.h"
  25. /**
  26. * struct ath5k_ini - Mode-independent initial register writes
  27. * @ini_register: Register address
  28. * @ini_value: Default value
  29. * @ini_mode: 0 to write 1 to read (and clear)
  30. */
  31. struct ath5k_ini {
  32. u16 ini_register;
  33. u32 ini_value;
  34. enum {
  35. AR5K_INI_WRITE = 0, /* Default */
  36. AR5K_INI_READ = 1,
  37. } ini_mode;
  38. };
  39. /**
  40. * struct ath5k_ini_mode - Mode specific initial register values
  41. * @mode_register: Register address
  42. * @mode_value: Set of values for each enum ath5k_driver_mode
  43. */
  44. struct ath5k_ini_mode {
  45. u16 mode_register;
  46. u32 mode_value[3];
  47. };
  48. /* Initial register settings for AR5210 */
  49. static const struct ath5k_ini ar5210_ini[] = {
  50. /* PCU and MAC registers */
  51. { AR5K_NOQCU_TXDP0, 0 },
  52. { AR5K_NOQCU_TXDP1, 0 },
  53. { AR5K_RXDP, 0 },
  54. { AR5K_CR, 0 },
  55. { AR5K_ISR, 0, AR5K_INI_READ },
  56. { AR5K_IMR, 0 },
  57. { AR5K_IER, AR5K_IER_DISABLE },
  58. { AR5K_BSR, 0, AR5K_INI_READ },
  59. { AR5K_TXCFG, AR5K_DMASIZE_128B },
  60. { AR5K_RXCFG, AR5K_DMASIZE_128B },
  61. { AR5K_CFG, AR5K_INIT_CFG },
  62. { AR5K_TOPS, 8 },
  63. { AR5K_RXNOFRM, 8 },
  64. { AR5K_RPGTO, 0 },
  65. { AR5K_TXNOFRM, 0 },
  66. { AR5K_SFR, 0 },
  67. { AR5K_MIBC, 0 },
  68. { AR5K_MISC, 0 },
  69. { AR5K_RX_FILTER_5210, 0 },
  70. { AR5K_MCAST_FILTER0_5210, 0 },
  71. { AR5K_MCAST_FILTER1_5210, 0 },
  72. { AR5K_TX_MASK0, 0 },
  73. { AR5K_TX_MASK1, 0 },
  74. { AR5K_CLR_TMASK, 0 },
  75. { AR5K_TRIG_LVL, AR5K_TUNE_MIN_TX_FIFO_THRES },
  76. { AR5K_DIAG_SW_5210, 0 },
  77. { AR5K_RSSI_THR, AR5K_TUNE_RSSI_THRES },
  78. { AR5K_TSF_L32_5210, 0 },
  79. { AR5K_TIMER0_5210, 0 },
  80. { AR5K_TIMER1_5210, 0xffffffff },
  81. { AR5K_TIMER2_5210, 0xffffffff },
  82. { AR5K_TIMER3_5210, 1 },
  83. { AR5K_CFP_DUR_5210, 0 },
  84. { AR5K_CFP_PERIOD_5210, 0 },
  85. /* PHY registers */
  86. { AR5K_PHY(0), 0x00000047 },
  87. { AR5K_PHY_AGC, 0x00000000 },
  88. { AR5K_PHY(3), 0x09848ea6 },
  89. { AR5K_PHY(4), 0x3d32e000 },
  90. { AR5K_PHY(5), 0x0000076b },
  91. { AR5K_PHY_ACT, AR5K_PHY_ACT_DISABLE },
  92. { AR5K_PHY(8), 0x02020200 },
  93. { AR5K_PHY(9), 0x00000e0e },
  94. { AR5K_PHY(10), 0x0a020201 },
  95. { AR5K_PHY(11), 0x00036ffc },
  96. { AR5K_PHY(12), 0x00000000 },
  97. { AR5K_PHY(13), 0x00000e0e },
  98. { AR5K_PHY(14), 0x00000007 },
  99. { AR5K_PHY(15), 0x00020100 },
  100. { AR5K_PHY(16), 0x89630000 },
  101. { AR5K_PHY(17), 0x1372169c },
  102. { AR5K_PHY(18), 0x0018b633 },
  103. { AR5K_PHY(19), 0x1284613c },
  104. { AR5K_PHY(20), 0x0de8b8e0 },
  105. { AR5K_PHY(21), 0x00074859 },
  106. { AR5K_PHY(22), 0x7e80beba },
  107. { AR5K_PHY(23), 0x313a665e },
  108. { AR5K_PHY_AGCCTL, 0x00001d08 },
  109. { AR5K_PHY(25), 0x0001ce00 },
  110. { AR5K_PHY(26), 0x409a4190 },
  111. { AR5K_PHY(28), 0x0000000f },
  112. { AR5K_PHY(29), 0x00000080 },
  113. { AR5K_PHY(30), 0x00000004 },
  114. { AR5K_PHY(31), 0x00000018 }, /* 0x987c */
  115. { AR5K_PHY(64), 0x00000000 }, /* 0x9900 */
  116. { AR5K_PHY(65), 0x00000000 },
  117. { AR5K_PHY(66), 0x00000000 },
  118. { AR5K_PHY(67), 0x00800000 },
  119. { AR5K_PHY(68), 0x00000003 },
  120. /* BB gain table (64bytes) */
  121. { AR5K_BB_GAIN(0), 0x00000000 },
  122. { AR5K_BB_GAIN(1), 0x00000020 },
  123. { AR5K_BB_GAIN(2), 0x00000010 },
  124. { AR5K_BB_GAIN(3), 0x00000030 },
  125. { AR5K_BB_GAIN(4), 0x00000008 },
  126. { AR5K_BB_GAIN(5), 0x00000028 },
  127. { AR5K_BB_GAIN(6), 0x00000028 },
  128. { AR5K_BB_GAIN(7), 0x00000004 },
  129. { AR5K_BB_GAIN(8), 0x00000024 },
  130. { AR5K_BB_GAIN(9), 0x00000014 },
  131. { AR5K_BB_GAIN(10), 0x00000034 },
  132. { AR5K_BB_GAIN(11), 0x0000000c },
  133. { AR5K_BB_GAIN(12), 0x0000002c },
  134. { AR5K_BB_GAIN(13), 0x00000002 },
  135. { AR5K_BB_GAIN(14), 0x00000022 },
  136. { AR5K_BB_GAIN(15), 0x00000012 },
  137. { AR5K_BB_GAIN(16), 0x00000032 },
  138. { AR5K_BB_GAIN(17), 0x0000000a },
  139. { AR5K_BB_GAIN(18), 0x0000002a },
  140. { AR5K_BB_GAIN(19), 0x00000001 },
  141. { AR5K_BB_GAIN(20), 0x00000021 },
  142. { AR5K_BB_GAIN(21), 0x00000011 },
  143. { AR5K_BB_GAIN(22), 0x00000031 },
  144. { AR5K_BB_GAIN(23), 0x00000009 },
  145. { AR5K_BB_GAIN(24), 0x00000029 },
  146. { AR5K_BB_GAIN(25), 0x00000005 },
  147. { AR5K_BB_GAIN(26), 0x00000025 },
  148. { AR5K_BB_GAIN(27), 0x00000015 },
  149. { AR5K_BB_GAIN(28), 0x00000035 },
  150. { AR5K_BB_GAIN(29), 0x0000000d },
  151. { AR5K_BB_GAIN(30), 0x0000002d },
  152. { AR5K_BB_GAIN(31), 0x00000003 },
  153. { AR5K_BB_GAIN(32), 0x00000023 },
  154. { AR5K_BB_GAIN(33), 0x00000013 },
  155. { AR5K_BB_GAIN(34), 0x00000033 },
  156. { AR5K_BB_GAIN(35), 0x0000000b },
  157. { AR5K_BB_GAIN(36), 0x0000002b },
  158. { AR5K_BB_GAIN(37), 0x00000007 },
  159. { AR5K_BB_GAIN(38), 0x00000027 },
  160. { AR5K_BB_GAIN(39), 0x00000017 },
  161. { AR5K_BB_GAIN(40), 0x00000037 },
  162. { AR5K_BB_GAIN(41), 0x0000000f },
  163. { AR5K_BB_GAIN(42), 0x0000002f },
  164. { AR5K_BB_GAIN(43), 0x0000002f },
  165. { AR5K_BB_GAIN(44), 0x0000002f },
  166. { AR5K_BB_GAIN(45), 0x0000002f },
  167. { AR5K_BB_GAIN(46), 0x0000002f },
  168. { AR5K_BB_GAIN(47), 0x0000002f },
  169. { AR5K_BB_GAIN(48), 0x0000002f },
  170. { AR5K_BB_GAIN(49), 0x0000002f },
  171. { AR5K_BB_GAIN(50), 0x0000002f },
  172. { AR5K_BB_GAIN(51), 0x0000002f },
  173. { AR5K_BB_GAIN(52), 0x0000002f },
  174. { AR5K_BB_GAIN(53), 0x0000002f },
  175. { AR5K_BB_GAIN(54), 0x0000002f },
  176. { AR5K_BB_GAIN(55), 0x0000002f },
  177. { AR5K_BB_GAIN(56), 0x0000002f },
  178. { AR5K_BB_GAIN(57), 0x0000002f },
  179. { AR5K_BB_GAIN(58), 0x0000002f },
  180. { AR5K_BB_GAIN(59), 0x0000002f },
  181. { AR5K_BB_GAIN(60), 0x0000002f },
  182. { AR5K_BB_GAIN(61), 0x0000002f },
  183. { AR5K_BB_GAIN(62), 0x0000002f },
  184. { AR5K_BB_GAIN(63), 0x0000002f },
  185. /* 5110 RF gain table (64btes) */
  186. { AR5K_RF_GAIN(0), 0x0000001d },
  187. { AR5K_RF_GAIN(1), 0x0000005d },
  188. { AR5K_RF_GAIN(2), 0x0000009d },
  189. { AR5K_RF_GAIN(3), 0x000000dd },
  190. { AR5K_RF_GAIN(4), 0x0000011d },
  191. { AR5K_RF_GAIN(5), 0x00000021 },
  192. { AR5K_RF_GAIN(6), 0x00000061 },
  193. { AR5K_RF_GAIN(7), 0x000000a1 },
  194. { AR5K_RF_GAIN(8), 0x000000e1 },
  195. { AR5K_RF_GAIN(9), 0x00000031 },
  196. { AR5K_RF_GAIN(10), 0x00000071 },
  197. { AR5K_RF_GAIN(11), 0x000000b1 },
  198. { AR5K_RF_GAIN(12), 0x0000001c },
  199. { AR5K_RF_GAIN(13), 0x0000005c },
  200. { AR5K_RF_GAIN(14), 0x00000029 },
  201. { AR5K_RF_GAIN(15), 0x00000069 },
  202. { AR5K_RF_GAIN(16), 0x000000a9 },
  203. { AR5K_RF_GAIN(17), 0x00000020 },
  204. { AR5K_RF_GAIN(18), 0x00000019 },
  205. { AR5K_RF_GAIN(19), 0x00000059 },
  206. { AR5K_RF_GAIN(20), 0x00000099 },
  207. { AR5K_RF_GAIN(21), 0x00000030 },
  208. { AR5K_RF_GAIN(22), 0x00000005 },
  209. { AR5K_RF_GAIN(23), 0x00000025 },
  210. { AR5K_RF_GAIN(24), 0x00000065 },
  211. { AR5K_RF_GAIN(25), 0x000000a5 },
  212. { AR5K_RF_GAIN(26), 0x00000028 },
  213. { AR5K_RF_GAIN(27), 0x00000068 },
  214. { AR5K_RF_GAIN(28), 0x0000001f },
  215. { AR5K_RF_GAIN(29), 0x0000001e },
  216. { AR5K_RF_GAIN(30), 0x00000018 },
  217. { AR5K_RF_GAIN(31), 0x00000058 },
  218. { AR5K_RF_GAIN(32), 0x00000098 },
  219. { AR5K_RF_GAIN(33), 0x00000003 },
  220. { AR5K_RF_GAIN(34), 0x00000004 },
  221. { AR5K_RF_GAIN(35), 0x00000044 },
  222. { AR5K_RF_GAIN(36), 0x00000084 },
  223. { AR5K_RF_GAIN(37), 0x00000013 },
  224. { AR5K_RF_GAIN(38), 0x00000012 },
  225. { AR5K_RF_GAIN(39), 0x00000052 },
  226. { AR5K_RF_GAIN(40), 0x00000092 },
  227. { AR5K_RF_GAIN(41), 0x000000d2 },
  228. { AR5K_RF_GAIN(42), 0x0000002b },
  229. { AR5K_RF_GAIN(43), 0x0000002a },
  230. { AR5K_RF_GAIN(44), 0x0000006a },
  231. { AR5K_RF_GAIN(45), 0x000000aa },
  232. { AR5K_RF_GAIN(46), 0x0000001b },
  233. { AR5K_RF_GAIN(47), 0x0000001a },
  234. { AR5K_RF_GAIN(48), 0x0000005a },
  235. { AR5K_RF_GAIN(49), 0x0000009a },
  236. { AR5K_RF_GAIN(50), 0x000000da },
  237. { AR5K_RF_GAIN(51), 0x00000006 },
  238. { AR5K_RF_GAIN(52), 0x00000006 },
  239. { AR5K_RF_GAIN(53), 0x00000006 },
  240. { AR5K_RF_GAIN(54), 0x00000006 },
  241. { AR5K_RF_GAIN(55), 0x00000006 },
  242. { AR5K_RF_GAIN(56), 0x00000006 },
  243. { AR5K_RF_GAIN(57), 0x00000006 },
  244. { AR5K_RF_GAIN(58), 0x00000006 },
  245. { AR5K_RF_GAIN(59), 0x00000006 },
  246. { AR5K_RF_GAIN(60), 0x00000006 },
  247. { AR5K_RF_GAIN(61), 0x00000006 },
  248. { AR5K_RF_GAIN(62), 0x00000006 },
  249. { AR5K_RF_GAIN(63), 0x00000006 },
  250. /* PHY activation */
  251. { AR5K_PHY(53), 0x00000020 },
  252. { AR5K_PHY(51), 0x00000004 },
  253. { AR5K_PHY(50), 0x00060106 },
  254. { AR5K_PHY(39), 0x0000006d },
  255. { AR5K_PHY(48), 0x00000000 },
  256. { AR5K_PHY(52), 0x00000014 },
  257. { AR5K_PHY_ACT, AR5K_PHY_ACT_ENABLE },
  258. };
  259. /* Initial register settings for AR5211 */
  260. static const struct ath5k_ini ar5211_ini[] = {
  261. { AR5K_RXDP, 0x00000000 },
  262. { AR5K_RTSD0, 0x84849c9c },
  263. { AR5K_RTSD1, 0x7c7c7c7c },
  264. { AR5K_RXCFG, 0x00000005 },
  265. { AR5K_MIBC, 0x00000000 },
  266. { AR5K_TOPS, 0x00000008 },
  267. { AR5K_RXNOFRM, 0x00000008 },
  268. { AR5K_TXNOFRM, 0x00000010 },
  269. { AR5K_RPGTO, 0x00000000 },
  270. { AR5K_RFCNT, 0x0000001f },
  271. { AR5K_QUEUE_TXDP(0), 0x00000000 },
  272. { AR5K_QUEUE_TXDP(1), 0x00000000 },
  273. { AR5K_QUEUE_TXDP(2), 0x00000000 },
  274. { AR5K_QUEUE_TXDP(3), 0x00000000 },
  275. { AR5K_QUEUE_TXDP(4), 0x00000000 },
  276. { AR5K_QUEUE_TXDP(5), 0x00000000 },
  277. { AR5K_QUEUE_TXDP(6), 0x00000000 },
  278. { AR5K_QUEUE_TXDP(7), 0x00000000 },
  279. { AR5K_QUEUE_TXDP(8), 0x00000000 },
  280. { AR5K_QUEUE_TXDP(9), 0x00000000 },
  281. { AR5K_DCU_FP, 0x00000000 },
  282. { AR5K_STA_ID1, 0x00000000 },
  283. { AR5K_BSS_ID0, 0x00000000 },
  284. { AR5K_BSS_ID1, 0x00000000 },
  285. { AR5K_RSSI_THR, 0x00000000 },
  286. { AR5K_CFP_PERIOD_5211, 0x00000000 },
  287. { AR5K_TIMER0_5211, 0x00000030 },
  288. { AR5K_TIMER1_5211, 0x0007ffff },
  289. { AR5K_TIMER2_5211, 0x01ffffff },
  290. { AR5K_TIMER3_5211, 0x00000031 },
  291. { AR5K_CFP_DUR_5211, 0x00000000 },
  292. { AR5K_RX_FILTER_5211, 0x00000000 },
  293. { AR5K_MCAST_FILTER0_5211, 0x00000000 },
  294. { AR5K_MCAST_FILTER1_5211, 0x00000002 },
  295. { AR5K_DIAG_SW_5211, 0x00000000 },
  296. { AR5K_ADDAC_TEST, 0x00000000 },
  297. { AR5K_DEFAULT_ANTENNA, 0x00000000 },
  298. /* PHY registers */
  299. { AR5K_PHY_AGC, 0x00000000 },
  300. { AR5K_PHY(3), 0x2d849093 },
  301. { AR5K_PHY(4), 0x7d32e000 },
  302. { AR5K_PHY(5), 0x00000f6b },
  303. { AR5K_PHY_ACT, 0x00000000 },
  304. { AR5K_PHY(11), 0x00026ffe },
  305. { AR5K_PHY(12), 0x00000000 },
  306. { AR5K_PHY(15), 0x00020100 },
  307. { AR5K_PHY(16), 0x206a017a },
  308. { AR5K_PHY(19), 0x1284613c },
  309. { AR5K_PHY(21), 0x00000859 },
  310. { AR5K_PHY(26), 0x409a4190 }, /* 0x9868 */
  311. { AR5K_PHY(27), 0x050cb081 },
  312. { AR5K_PHY(28), 0x0000000f },
  313. { AR5K_PHY(29), 0x00000080 },
  314. { AR5K_PHY(30), 0x0000000c },
  315. { AR5K_PHY(64), 0x00000000 },
  316. { AR5K_PHY(65), 0x00000000 },
  317. { AR5K_PHY(66), 0x00000000 },
  318. { AR5K_PHY(67), 0x00800000 },
  319. { AR5K_PHY(68), 0x00000001 },
  320. { AR5K_PHY(71), 0x0000092a },
  321. { AR5K_PHY_IQ, 0x00000000 },
  322. { AR5K_PHY(73), 0x00058a05 },
  323. { AR5K_PHY(74), 0x00000001 },
  324. { AR5K_PHY(75), 0x00000000 },
  325. { AR5K_PHY_PAPD_PROBE, 0x00000000 },
  326. { AR5K_PHY(77), 0x00000000 }, /* 0x9934 */
  327. { AR5K_PHY(78), 0x00000000 }, /* 0x9938 */
  328. { AR5K_PHY(79), 0x0000003f }, /* 0x993c */
  329. { AR5K_PHY(80), 0x00000004 },
  330. { AR5K_PHY(82), 0x00000000 },
  331. { AR5K_PHY(83), 0x00000000 },
  332. { AR5K_PHY(84), 0x00000000 },
  333. { AR5K_PHY_RADAR, 0x5d50f14c },
  334. { AR5K_PHY(86), 0x00000018 },
  335. { AR5K_PHY(87), 0x004b6a8e },
  336. /* Initial Power table (32bytes)
  337. * common on all cards/modes.
  338. * Note: Table is rewritten during
  339. * txpower setup later using calibration
  340. * data etc. so next write is non-common */
  341. { AR5K_PHY_PCDAC_TXPOWER(1), 0x06ff05ff },
  342. { AR5K_PHY_PCDAC_TXPOWER(2), 0x07ff07ff },
  343. { AR5K_PHY_PCDAC_TXPOWER(3), 0x08ff08ff },
  344. { AR5K_PHY_PCDAC_TXPOWER(4), 0x09ff09ff },
  345. { AR5K_PHY_PCDAC_TXPOWER(5), 0x0aff0aff },
  346. { AR5K_PHY_PCDAC_TXPOWER(6), 0x0bff0bff },
  347. { AR5K_PHY_PCDAC_TXPOWER(7), 0x0cff0cff },
  348. { AR5K_PHY_PCDAC_TXPOWER(8), 0x0dff0dff },
  349. { AR5K_PHY_PCDAC_TXPOWER(9), 0x0fff0eff },
  350. { AR5K_PHY_PCDAC_TXPOWER(10), 0x12ff12ff },
  351. { AR5K_PHY_PCDAC_TXPOWER(11), 0x14ff13ff },
  352. { AR5K_PHY_PCDAC_TXPOWER(12), 0x16ff15ff },
  353. { AR5K_PHY_PCDAC_TXPOWER(13), 0x19ff17ff },
  354. { AR5K_PHY_PCDAC_TXPOWER(14), 0x1bff1aff },
  355. { AR5K_PHY_PCDAC_TXPOWER(15), 0x1eff1dff },
  356. { AR5K_PHY_PCDAC_TXPOWER(16), 0x23ff20ff },
  357. { AR5K_PHY_PCDAC_TXPOWER(17), 0x27ff25ff },
  358. { AR5K_PHY_PCDAC_TXPOWER(18), 0x2cff29ff },
  359. { AR5K_PHY_PCDAC_TXPOWER(19), 0x31ff2fff },
  360. { AR5K_PHY_PCDAC_TXPOWER(20), 0x37ff34ff },
  361. { AR5K_PHY_PCDAC_TXPOWER(21), 0x3aff3aff },
  362. { AR5K_PHY_PCDAC_TXPOWER(22), 0x3aff3aff },
  363. { AR5K_PHY_PCDAC_TXPOWER(23), 0x3aff3aff },
  364. { AR5K_PHY_PCDAC_TXPOWER(24), 0x3aff3aff },
  365. { AR5K_PHY_PCDAC_TXPOWER(25), 0x3aff3aff },
  366. { AR5K_PHY_PCDAC_TXPOWER(26), 0x3aff3aff },
  367. { AR5K_PHY_PCDAC_TXPOWER(27), 0x3aff3aff },
  368. { AR5K_PHY_PCDAC_TXPOWER(28), 0x3aff3aff },
  369. { AR5K_PHY_PCDAC_TXPOWER(29), 0x3aff3aff },
  370. { AR5K_PHY_PCDAC_TXPOWER(30), 0x3aff3aff },
  371. { AR5K_PHY_PCDAC_TXPOWER(31), 0x3aff3aff },
  372. { AR5K_PHY_CCKTXCTL, 0x00000000 },
  373. { AR5K_PHY(642), 0x503e4646 },
  374. { AR5K_PHY_GAIN_2GHZ, 0x6480416c },
  375. { AR5K_PHY(644), 0x0199a003 },
  376. { AR5K_PHY(645), 0x044cd610 },
  377. { AR5K_PHY(646), 0x13800040 },
  378. { AR5K_PHY(647), 0x1be00060 },
  379. { AR5K_PHY(648), 0x0c53800a },
  380. { AR5K_PHY(649), 0x0014df3b },
  381. { AR5K_PHY(650), 0x000001b5 },
  382. { AR5K_PHY(651), 0x00000020 },
  383. };
  384. /* Initial mode-specific settings for AR5211
  385. * 5211 supports OFDM-only g (draft g) but we
  386. * need to test it ! */
  387. static const struct ath5k_ini_mode ar5211_ini_mode[] = {
  388. { AR5K_TXCFG,
  389. /* A B G */
  390. { 0x00000015, 0x0000001d, 0x00000015 } },
  391. { AR5K_QUEUE_DFS_LOCAL_IFS(0),
  392. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  393. { AR5K_QUEUE_DFS_LOCAL_IFS(1),
  394. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  395. { AR5K_QUEUE_DFS_LOCAL_IFS(2),
  396. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  397. { AR5K_QUEUE_DFS_LOCAL_IFS(3),
  398. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  399. { AR5K_QUEUE_DFS_LOCAL_IFS(4),
  400. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  401. { AR5K_QUEUE_DFS_LOCAL_IFS(5),
  402. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  403. { AR5K_QUEUE_DFS_LOCAL_IFS(6),
  404. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  405. { AR5K_QUEUE_DFS_LOCAL_IFS(7),
  406. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  407. { AR5K_QUEUE_DFS_LOCAL_IFS(8),
  408. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  409. { AR5K_QUEUE_DFS_LOCAL_IFS(9),
  410. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  411. { AR5K_DCU_GBL_IFS_SLOT,
  412. { 0x00000168, 0x000001b8, 0x00000168 } },
  413. { AR5K_DCU_GBL_IFS_SIFS,
  414. { 0x00000230, 0x000000b0, 0x00000230 } },
  415. { AR5K_DCU_GBL_IFS_EIFS,
  416. { 0x00000d98, 0x00001f48, 0x00000d98 } },
  417. { AR5K_DCU_GBL_IFS_MISC,
  418. { 0x0000a0e0, 0x00005880, 0x0000a0e0 } },
  419. { AR5K_TIME_OUT,
  420. { 0x04000400, 0x20003000, 0x04000400 } },
  421. { AR5K_USEC_5211,
  422. { 0x0e8d8fa7, 0x01608f95, 0x0e8d8fa7 } },
  423. { AR5K_PHY(8),
  424. { 0x02020200, 0x02010200, 0x02020200 } },
  425. { AR5K_PHY_RF_CTL2,
  426. { 0x00000e0e, 0x00000707, 0x00000e0e } },
  427. { AR5K_PHY_RF_CTL3,
  428. { 0x0a020001, 0x05010000, 0x0a020001 } },
  429. { AR5K_PHY_RF_CTL4,
  430. { 0x00000e0e, 0x00000e0e, 0x00000e0e } },
  431. { AR5K_PHY_PA_CTL,
  432. { 0x00000007, 0x0000000b, 0x0000000b } },
  433. { AR5K_PHY_SETTLING,
  434. { 0x1372169c, 0x137216a8, 0x1372169c } },
  435. { AR5K_PHY_GAIN,
  436. { 0x0018ba67, 0x0018ba69, 0x0018ba69 } },
  437. { AR5K_PHY_DESIRED_SIZE,
  438. { 0x0c28b4e0, 0x0c28b4e0, 0x0c28b4e0 } },
  439. { AR5K_PHY_SIG,
  440. { 0x7e800d2e, 0x7ec00d2e, 0x7e800d2e } },
  441. { AR5K_PHY_AGCCOARSE,
  442. { 0x31375d5e, 0x313a5d5e, 0x31375d5e } },
  443. { AR5K_PHY_AGCCTL,
  444. { 0x0000bd10, 0x0000bd38, 0x0000bd10 } },
  445. { AR5K_PHY_NF,
  446. { 0x0001ce00, 0x0001ce00, 0x0001ce00 } },
  447. { AR5K_PHY_RX_DELAY,
  448. { 0x00002710, 0x0000157c, 0x00002710 } },
  449. { AR5K_PHY(70),
  450. { 0x00000190, 0x00000084, 0x00000190 } },
  451. { AR5K_PHY_FRAME_CTL_5211,
  452. { 0x6fe01020, 0x6fe00920, 0x6fe01020 } },
  453. { AR5K_PHY_PCDAC_TXPOWER_BASE,
  454. { 0x05ff14ff, 0x05ff14ff, 0x05ff19ff } },
  455. { AR5K_RF_BUFFER_CONTROL_4,
  456. { 0x00000010, 0x00000010, 0x00000010 } },
  457. };
  458. /* Initial register settings for AR5212 and newer chips */
  459. static const struct ath5k_ini ar5212_ini_common_start[] = {
  460. { AR5K_RXDP, 0x00000000 },
  461. { AR5K_RXCFG, 0x00000005 },
  462. { AR5K_MIBC, 0x00000000 },
  463. { AR5K_TOPS, 0x00000008 },
  464. { AR5K_RXNOFRM, 0x00000008 },
  465. { AR5K_TXNOFRM, 0x00000010 },
  466. { AR5K_RPGTO, 0x00000000 },
  467. { AR5K_RFCNT, 0x0000001f },
  468. { AR5K_QUEUE_TXDP(0), 0x00000000 },
  469. { AR5K_QUEUE_TXDP(1), 0x00000000 },
  470. { AR5K_QUEUE_TXDP(2), 0x00000000 },
  471. { AR5K_QUEUE_TXDP(3), 0x00000000 },
  472. { AR5K_QUEUE_TXDP(4), 0x00000000 },
  473. { AR5K_QUEUE_TXDP(5), 0x00000000 },
  474. { AR5K_QUEUE_TXDP(6), 0x00000000 },
  475. { AR5K_QUEUE_TXDP(7), 0x00000000 },
  476. { AR5K_QUEUE_TXDP(8), 0x00000000 },
  477. { AR5K_QUEUE_TXDP(9), 0x00000000 },
  478. { AR5K_DCU_FP, 0x00000000 },
  479. { AR5K_DCU_TXP, 0x00000000 },
  480. /* Tx filter table 0 (32 entries) */
  481. { AR5K_DCU_TX_FILTER_0(0), 0x00000000 }, /* DCU 0 */
  482. { AR5K_DCU_TX_FILTER_0(1), 0x00000000 },
  483. { AR5K_DCU_TX_FILTER_0(2), 0x00000000 },
  484. { AR5K_DCU_TX_FILTER_0(3), 0x00000000 },
  485. { AR5K_DCU_TX_FILTER_0(4), 0x00000000 }, /* DCU 1 */
  486. { AR5K_DCU_TX_FILTER_0(5), 0x00000000 },
  487. { AR5K_DCU_TX_FILTER_0(6), 0x00000000 },
  488. { AR5K_DCU_TX_FILTER_0(7), 0x00000000 },
  489. { AR5K_DCU_TX_FILTER_0(8), 0x00000000 }, /* DCU 2 */
  490. { AR5K_DCU_TX_FILTER_0(9), 0x00000000 },
  491. { AR5K_DCU_TX_FILTER_0(10), 0x00000000 },
  492. { AR5K_DCU_TX_FILTER_0(11), 0x00000000 },
  493. { AR5K_DCU_TX_FILTER_0(12), 0x00000000 }, /* DCU 3 */
  494. { AR5K_DCU_TX_FILTER_0(13), 0x00000000 },
  495. { AR5K_DCU_TX_FILTER_0(14), 0x00000000 },
  496. { AR5K_DCU_TX_FILTER_0(15), 0x00000000 },
  497. { AR5K_DCU_TX_FILTER_0(16), 0x00000000 }, /* DCU 4 */
  498. { AR5K_DCU_TX_FILTER_0(17), 0x00000000 },
  499. { AR5K_DCU_TX_FILTER_0(18), 0x00000000 },
  500. { AR5K_DCU_TX_FILTER_0(19), 0x00000000 },
  501. { AR5K_DCU_TX_FILTER_0(20), 0x00000000 }, /* DCU 5 */
  502. { AR5K_DCU_TX_FILTER_0(21), 0x00000000 },
  503. { AR5K_DCU_TX_FILTER_0(22), 0x00000000 },
  504. { AR5K_DCU_TX_FILTER_0(23), 0x00000000 },
  505. { AR5K_DCU_TX_FILTER_0(24), 0x00000000 }, /* DCU 6 */
  506. { AR5K_DCU_TX_FILTER_0(25), 0x00000000 },
  507. { AR5K_DCU_TX_FILTER_0(26), 0x00000000 },
  508. { AR5K_DCU_TX_FILTER_0(27), 0x00000000 },
  509. { AR5K_DCU_TX_FILTER_0(28), 0x00000000 }, /* DCU 7 */
  510. { AR5K_DCU_TX_FILTER_0(29), 0x00000000 },
  511. { AR5K_DCU_TX_FILTER_0(30), 0x00000000 },
  512. { AR5K_DCU_TX_FILTER_0(31), 0x00000000 },
  513. /* Tx filter table 1 (16 entries) */
  514. { AR5K_DCU_TX_FILTER_1(0), 0x00000000 },
  515. { AR5K_DCU_TX_FILTER_1(1), 0x00000000 },
  516. { AR5K_DCU_TX_FILTER_1(2), 0x00000000 },
  517. { AR5K_DCU_TX_FILTER_1(3), 0x00000000 },
  518. { AR5K_DCU_TX_FILTER_1(4), 0x00000000 },
  519. { AR5K_DCU_TX_FILTER_1(5), 0x00000000 },
  520. { AR5K_DCU_TX_FILTER_1(6), 0x00000000 },
  521. { AR5K_DCU_TX_FILTER_1(7), 0x00000000 },
  522. { AR5K_DCU_TX_FILTER_1(8), 0x00000000 },
  523. { AR5K_DCU_TX_FILTER_1(9), 0x00000000 },
  524. { AR5K_DCU_TX_FILTER_1(10), 0x00000000 },
  525. { AR5K_DCU_TX_FILTER_1(11), 0x00000000 },
  526. { AR5K_DCU_TX_FILTER_1(12), 0x00000000 },
  527. { AR5K_DCU_TX_FILTER_1(13), 0x00000000 },
  528. { AR5K_DCU_TX_FILTER_1(14), 0x00000000 },
  529. { AR5K_DCU_TX_FILTER_1(15), 0x00000000 },
  530. { AR5K_DCU_TX_FILTER_CLR, 0x00000000 },
  531. { AR5K_DCU_TX_FILTER_SET, 0x00000000 },
  532. { AR5K_STA_ID1, 0x00000000 },
  533. { AR5K_BSS_ID0, 0x00000000 },
  534. { AR5K_BSS_ID1, 0x00000000 },
  535. { AR5K_BEACON_5211, 0x00000000 },
  536. { AR5K_CFP_PERIOD_5211, 0x00000000 },
  537. { AR5K_TIMER0_5211, 0x00000030 },
  538. { AR5K_TIMER1_5211, 0x0007ffff },
  539. { AR5K_TIMER2_5211, 0x01ffffff },
  540. { AR5K_TIMER3_5211, 0x00000031 },
  541. { AR5K_CFP_DUR_5211, 0x00000000 },
  542. { AR5K_RX_FILTER_5211, 0x00000000 },
  543. { AR5K_DIAG_SW_5211, 0x00000000 },
  544. { AR5K_ADDAC_TEST, 0x00000000 },
  545. { AR5K_DEFAULT_ANTENNA, 0x00000000 },
  546. { AR5K_FRAME_CTL_QOSM, 0x000fc78f },
  547. { AR5K_XRMODE, 0x2a82301a },
  548. { AR5K_XRDELAY, 0x05dc01e0 },
  549. { AR5K_XRTIMEOUT, 0x1f402710 },
  550. { AR5K_XRCHIRP, 0x01f40000 },
  551. { AR5K_XRSTOMP, 0x00001e1c },
  552. { AR5K_SLEEP0, 0x0002aaaa },
  553. { AR5K_SLEEP1, 0x02005555 },
  554. { AR5K_SLEEP2, 0x00000000 },
  555. { AR_BSSMSKL, 0xffffffff },
  556. { AR_BSSMSKU, 0x0000ffff },
  557. { AR5K_TXPC, 0x00000000 },
  558. { AR5K_PROFCNT_TX, 0x00000000 },
  559. { AR5K_PROFCNT_RX, 0x00000000 },
  560. { AR5K_PROFCNT_RXCLR, 0x00000000 },
  561. { AR5K_PROFCNT_CYCLE, 0x00000000 },
  562. { AR5K_QUIET_CTL1, 0x00000088 },
  563. /* Initial rate duration table (32 entries )*/
  564. { AR5K_RATE_DUR(0), 0x00000000 },
  565. { AR5K_RATE_DUR(1), 0x0000008c },
  566. { AR5K_RATE_DUR(2), 0x000000e4 },
  567. { AR5K_RATE_DUR(3), 0x000002d5 },
  568. { AR5K_RATE_DUR(4), 0x00000000 },
  569. { AR5K_RATE_DUR(5), 0x00000000 },
  570. { AR5K_RATE_DUR(6), 0x000000a0 },
  571. { AR5K_RATE_DUR(7), 0x000001c9 },
  572. { AR5K_RATE_DUR(8), 0x0000002c },
  573. { AR5K_RATE_DUR(9), 0x0000002c },
  574. { AR5K_RATE_DUR(10), 0x00000030 },
  575. { AR5K_RATE_DUR(11), 0x0000003c },
  576. { AR5K_RATE_DUR(12), 0x0000002c },
  577. { AR5K_RATE_DUR(13), 0x0000002c },
  578. { AR5K_RATE_DUR(14), 0x00000030 },
  579. { AR5K_RATE_DUR(15), 0x0000003c },
  580. { AR5K_RATE_DUR(16), 0x00000000 },
  581. { AR5K_RATE_DUR(17), 0x00000000 },
  582. { AR5K_RATE_DUR(18), 0x00000000 },
  583. { AR5K_RATE_DUR(19), 0x00000000 },
  584. { AR5K_RATE_DUR(20), 0x00000000 },
  585. { AR5K_RATE_DUR(21), 0x00000000 },
  586. { AR5K_RATE_DUR(22), 0x00000000 },
  587. { AR5K_RATE_DUR(23), 0x00000000 },
  588. { AR5K_RATE_DUR(24), 0x000000d5 },
  589. { AR5K_RATE_DUR(25), 0x000000df },
  590. { AR5K_RATE_DUR(26), 0x00000102 },
  591. { AR5K_RATE_DUR(27), 0x0000013a },
  592. { AR5K_RATE_DUR(28), 0x00000075 },
  593. { AR5K_RATE_DUR(29), 0x0000007f },
  594. { AR5K_RATE_DUR(30), 0x000000a2 },
  595. { AR5K_RATE_DUR(31), 0x00000000 },
  596. { AR5K_QUIET_CTL2, 0x00010002 },
  597. { AR5K_TSF_PARM, 0x00000001 },
  598. { AR5K_QOS_NOACK, 0x000000c0 },
  599. { AR5K_PHY_ERR_FIL, 0x00000000 },
  600. { AR5K_XRLAT_TX, 0x00000168 },
  601. { AR5K_ACKSIFS, 0x00000000 },
  602. /* Rate -> db table
  603. * notice ...03<-02<-01<-00 ! */
  604. { AR5K_RATE2DB(0), 0x03020100 },
  605. { AR5K_RATE2DB(1), 0x07060504 },
  606. { AR5K_RATE2DB(2), 0x0b0a0908 },
  607. { AR5K_RATE2DB(3), 0x0f0e0d0c },
  608. { AR5K_RATE2DB(4), 0x13121110 },
  609. { AR5K_RATE2DB(5), 0x17161514 },
  610. { AR5K_RATE2DB(6), 0x1b1a1918 },
  611. { AR5K_RATE2DB(7), 0x1f1e1d1c },
  612. /* Db -> Rate table */
  613. { AR5K_DB2RATE(0), 0x03020100 },
  614. { AR5K_DB2RATE(1), 0x07060504 },
  615. { AR5K_DB2RATE(2), 0x0b0a0908 },
  616. { AR5K_DB2RATE(3), 0x0f0e0d0c },
  617. { AR5K_DB2RATE(4), 0x13121110 },
  618. { AR5K_DB2RATE(5), 0x17161514 },
  619. { AR5K_DB2RATE(6), 0x1b1a1918 },
  620. { AR5K_DB2RATE(7), 0x1f1e1d1c },
  621. /* PHY registers (Common settings
  622. * for all chips/modes) */
  623. { AR5K_PHY(3), 0xad848e19 },
  624. { AR5K_PHY(4), 0x7d28e000 },
  625. { AR5K_PHY_TIMING_3, 0x9c0a9f6b },
  626. { AR5K_PHY_ACT, 0x00000000 },
  627. { AR5K_PHY(16), 0x206a017a },
  628. { AR5K_PHY(21), 0x00000859 },
  629. { AR5K_PHY_BIN_MASK_1, 0x00000000 },
  630. { AR5K_PHY_BIN_MASK_2, 0x00000000 },
  631. { AR5K_PHY_BIN_MASK_3, 0x00000000 },
  632. { AR5K_PHY_BIN_MASK_CTL, 0x00800000 },
  633. { AR5K_PHY_ANT_CTL, 0x00000001 },
  634. /*{ AR5K_PHY(71), 0x0000092a },*/ /* Old value */
  635. { AR5K_PHY_MAX_RX_LEN, 0x00000c80 },
  636. { AR5K_PHY_IQ, 0x05100000 },
  637. { AR5K_PHY_WARM_RESET, 0x00000001 },
  638. { AR5K_PHY_CTL, 0x00000004 },
  639. { AR5K_PHY_TXPOWER_RATE1, 0x1e1f2022 },
  640. { AR5K_PHY_TXPOWER_RATE2, 0x0a0b0c0d },
  641. { AR5K_PHY_TXPOWER_RATE_MAX, 0x0000003f },
  642. { AR5K_PHY(82), 0x9280b212 },
  643. { AR5K_PHY_RADAR, 0x5d50e188 },
  644. /*{ AR5K_PHY(86), 0x000000ff },*/
  645. { AR5K_PHY(87), 0x004b6a8e },
  646. { AR5K_PHY_NFTHRES, 0x000003ce },
  647. { AR5K_PHY_RESTART, 0x192fb515 },
  648. { AR5K_PHY(94), 0x00000001 },
  649. { AR5K_PHY_RFBUS_REQ, 0x00000000 },
  650. /*{ AR5K_PHY(644), 0x0080a333 },*/ /* Old value */
  651. /*{ AR5K_PHY(645), 0x00206c10 },*/ /* Old value */
  652. { AR5K_PHY(644), 0x00806333 },
  653. { AR5K_PHY(645), 0x00106c10 },
  654. { AR5K_PHY(646), 0x009c4060 },
  655. /* { AR5K_PHY(647), 0x1483800a }, */
  656. /* { AR5K_PHY(648), 0x01831061 }, */ /* Old value */
  657. { AR5K_PHY(648), 0x018830c6 },
  658. { AR5K_PHY(649), 0x00000400 },
  659. /*{ AR5K_PHY(650), 0x000001b5 },*/
  660. { AR5K_PHY(651), 0x00000000 },
  661. { AR5K_PHY_TXPOWER_RATE3, 0x20202020 },
  662. { AR5K_PHY_TXPOWER_RATE4, 0x20202020 },
  663. /*{ AR5K_PHY(655), 0x13c889af },*/
  664. { AR5K_PHY(656), 0x38490a20 },
  665. { AR5K_PHY(657), 0x00007bb6 },
  666. { AR5K_PHY(658), 0x0fff3ffc },
  667. };
  668. /* Initial mode-specific settings for AR5212 (Written before ar5212_ini) */
  669. static const struct ath5k_ini_mode ar5212_ini_mode_start[] = {
  670. { AR5K_QUEUE_DFS_LOCAL_IFS(0),
  671. /* A/XR B G */
  672. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  673. { AR5K_QUEUE_DFS_LOCAL_IFS(1),
  674. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  675. { AR5K_QUEUE_DFS_LOCAL_IFS(2),
  676. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  677. { AR5K_QUEUE_DFS_LOCAL_IFS(3),
  678. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  679. { AR5K_QUEUE_DFS_LOCAL_IFS(4),
  680. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  681. { AR5K_QUEUE_DFS_LOCAL_IFS(5),
  682. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  683. { AR5K_QUEUE_DFS_LOCAL_IFS(6),
  684. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  685. { AR5K_QUEUE_DFS_LOCAL_IFS(7),
  686. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  687. { AR5K_QUEUE_DFS_LOCAL_IFS(8),
  688. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  689. { AR5K_QUEUE_DFS_LOCAL_IFS(9),
  690. { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
  691. { AR5K_DCU_GBL_IFS_SIFS,
  692. { 0x00000230, 0x000000b0, 0x00000160 } },
  693. { AR5K_DCU_GBL_IFS_SLOT,
  694. { 0x00000168, 0x000001b8, 0x0000018c } },
  695. { AR5K_DCU_GBL_IFS_EIFS,
  696. { 0x00000e60, 0x00001f1c, 0x00003e38 } },
  697. { AR5K_DCU_GBL_IFS_MISC,
  698. { 0x0000a0e0, 0x00005880, 0x0000b0e0 } },
  699. { AR5K_TIME_OUT,
  700. { 0x03e803e8, 0x04200420, 0x08400840 } },
  701. { AR5K_PHY(8),
  702. { 0x02020200, 0x02010200, 0x02020200 } },
  703. { AR5K_PHY_RF_CTL2,
  704. { 0x00000e0e, 0x00000707, 0x00000e0e } },
  705. { AR5K_PHY_SETTLING,
  706. { 0x1372161c, 0x13721722, 0x137216a2 } },
  707. { AR5K_PHY_AGCCTL,
  708. { 0x00009d10, 0x00009d18, 0x00009d18 } },
  709. { AR5K_PHY_NF,
  710. { 0x0001ce00, 0x0001ce00, 0x0001ce00 } },
  711. { AR5K_PHY_WEAK_OFDM_HIGH_THR,
  712. { 0x409a4190, 0x409a4190, 0x409a4190 } },
  713. { AR5K_PHY(70),
  714. { 0x000001b8, 0x00000084, 0x00000108 } },
  715. { AR5K_PHY_OFDM_SELFCORR,
  716. { 0x10058a05, 0x10058a05, 0x10058a05 } },
  717. { 0xa230,
  718. { 0x00000000, 0x00000000, 0x00000108 } },
  719. };
  720. /* Initial mode-specific settings for AR5212 + RF5111
  721. * (Written after ar5212_ini) */
  722. static const struct ath5k_ini_mode rf5111_ini_mode_end[] = {
  723. { AR5K_TXCFG,
  724. /* A/XR B G */
  725. { 0x00008015, 0x00008015, 0x00008015 } },
  726. { AR5K_USEC_5211,
  727. { 0x128d8fa7, 0x04e00f95, 0x12e00fab } },
  728. { AR5K_PHY_RF_CTL3,
  729. { 0x0a020001, 0x05010100, 0x0a020001 } },
  730. { AR5K_PHY_RF_CTL4,
  731. { 0x00000e0e, 0x00000e0e, 0x00000e0e } },
  732. { AR5K_PHY_PA_CTL,
  733. { 0x00000007, 0x0000000b, 0x0000000b } },
  734. { AR5K_PHY_GAIN,
  735. { 0x0018da5a, 0x0018ca69, 0x0018ca69 } },
  736. { AR5K_PHY_DESIRED_SIZE,
  737. { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } },
  738. { AR5K_PHY_SIG,
  739. { 0x7e800d2e, 0x7ee84d2e, 0x7ee84d2e } },
  740. { AR5K_PHY_AGCCOARSE,
  741. { 0x3137665e, 0x3137665e, 0x3137665e } },
  742. { AR5K_PHY_WEAK_OFDM_LOW_THR,
  743. { 0x050cb081, 0x050cb081, 0x050cb080 } },
  744. { AR5K_PHY_RX_DELAY,
  745. { 0x00002710, 0x0000157c, 0x00002af8 } },
  746. { AR5K_PHY_FRAME_CTL_5211,
  747. { 0xf7b81020, 0xf7b80d20, 0xf7b81020 } },
  748. { AR5K_PHY_GAIN_2GHZ,
  749. { 0x642c416a, 0x6440416a, 0x6440416a } },
  750. { AR5K_PHY_CCK_RX_CTL_4,
  751. { 0x1883800a, 0x1873800a, 0x1883800a } },
  752. };
  753. /* Common for all modes */
  754. static const struct ath5k_ini rf5111_ini_common_end[] = {
  755. { AR5K_DCU_FP, 0x00000000 },
  756. { AR5K_PHY_AGC, 0x00000000 },
  757. { AR5K_PHY_ADC_CTL, 0x00022ffe },
  758. { 0x983c, 0x00020100 },
  759. { AR5K_PHY_GAIN_OFFSET, 0x1284613c },
  760. { AR5K_PHY_PAPD_PROBE, 0x00004883 },
  761. { 0x9940, 0x00000004 },
  762. { 0x9958, 0x000000ff },
  763. { 0x9974, 0x00000000 },
  764. { AR5K_PHY_SPENDING, 0x00000018 },
  765. { AR5K_PHY_CCKTXCTL, 0x00000000 },
  766. { AR5K_PHY_CCK_CROSSCORR, 0xd03e6788 },
  767. { AR5K_PHY_DAG_CCK_CTL, 0x000001b5 },
  768. { 0xa23c, 0x13c889af },
  769. };
  770. /* Initial mode-specific settings for AR5212 + RF5112
  771. * (Written after ar5212_ini) */
  772. static const struct ath5k_ini_mode rf5112_ini_mode_end[] = {
  773. { AR5K_TXCFG,
  774. /* A/XR B G */
  775. { 0x00008015, 0x00008015, 0x00008015 } },
  776. { AR5K_USEC_5211,
  777. { 0x128d93a7, 0x04e01395, 0x12e013ab } },
  778. { AR5K_PHY_RF_CTL3,
  779. { 0x0a020001, 0x05020100, 0x0a020001 } },
  780. { AR5K_PHY_RF_CTL4,
  781. { 0x00000e0e, 0x00000e0e, 0x00000e0e } },
  782. { AR5K_PHY_PA_CTL,
  783. { 0x00000007, 0x0000000b, 0x0000000b } },
  784. { AR5K_PHY_GAIN,
  785. { 0x0018da6d, 0x0018ca75, 0x0018ca75 } },
  786. { AR5K_PHY_DESIRED_SIZE,
  787. { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } },
  788. { AR5K_PHY_SIG,
  789. { 0x7e800d2e, 0x7ee80d2e, 0x7ee80d2e } },
  790. { AR5K_PHY_AGCCOARSE,
  791. { 0x3137665e, 0x3137665e, 0x3137665e } },
  792. { AR5K_PHY_WEAK_OFDM_LOW_THR,
  793. { 0x050cb081, 0x050cb081, 0x050cb081 } },
  794. { AR5K_PHY_RX_DELAY,
  795. { 0x000007d0, 0x0000044c, 0x00000898 } },
  796. { AR5K_PHY_FRAME_CTL_5211,
  797. { 0xf7b81020, 0xf7b80d10, 0xf7b81010 } },
  798. { AR5K_PHY_CCKTXCTL,
  799. { 0x00000000, 0x00000008, 0x00000008 } },
  800. { AR5K_PHY_CCK_CROSSCORR,
  801. { 0xd6be6788, 0xd03e6788, 0xd03e6788 } },
  802. { AR5K_PHY_GAIN_2GHZ,
  803. { 0x642c0140, 0x6442c160, 0x6442c160 } },
  804. { AR5K_PHY_CCK_RX_CTL_4,
  805. { 0x1883800a, 0x1873800a, 0x1883800a } },
  806. };
  807. static const struct ath5k_ini rf5112_ini_common_end[] = {
  808. { AR5K_DCU_FP, 0x00000000 },
  809. { AR5K_PHY_AGC, 0x00000000 },
  810. { AR5K_PHY_ADC_CTL, 0x00022ffe },
  811. { 0x983c, 0x00020100 },
  812. { AR5K_PHY_GAIN_OFFSET, 0x1284613c },
  813. { AR5K_PHY_PAPD_PROBE, 0x00004882 },
  814. { 0x9940, 0x00000004 },
  815. { 0x9958, 0x000000ff },
  816. { 0x9974, 0x00000000 },
  817. { AR5K_PHY_DAG_CCK_CTL, 0x000001b5 },
  818. { 0xa23c, 0x13c889af },
  819. };
  820. /* Initial mode-specific settings for RF5413/5414
  821. * (Written after ar5212_ini) */
  822. static const struct ath5k_ini_mode rf5413_ini_mode_end[] = {
  823. { AR5K_TXCFG,
  824. /* A/XR B G */
  825. { 0x00000015, 0x00000015, 0x00000015 } },
  826. { AR5K_USEC_5211,
  827. { 0x128d93a7, 0x04e01395, 0x12e013ab } },
  828. { AR5K_PHY_RF_CTL3,
  829. { 0x0a020001, 0x05020100, 0x0a020001 } },
  830. { AR5K_PHY_RF_CTL4,
  831. { 0x00000e0e, 0x00000e0e, 0x00000e0e } },
  832. { AR5K_PHY_PA_CTL,
  833. { 0x00000007, 0x0000000b, 0x0000000b } },
  834. { AR5K_PHY_GAIN,
  835. { 0x0018fa61, 0x001a1a63, 0x001a1a63 } },
  836. { AR5K_PHY_DESIRED_SIZE,
  837. { 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da } },
  838. { AR5K_PHY_SIG,
  839. { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } },
  840. { AR5K_PHY_AGCCOARSE,
  841. { 0x3139605e, 0x3139605e, 0x3139605e } },
  842. { AR5K_PHY_WEAK_OFDM_LOW_THR,
  843. { 0x050cb081, 0x050cb081, 0x050cb081 } },
  844. { AR5K_PHY_RX_DELAY,
  845. { 0x000007d0, 0x0000044c, 0x00000898 } },
  846. { AR5K_PHY_FRAME_CTL_5211,
  847. { 0xf7b81000, 0xf7b80d00, 0xf7b81000 } },
  848. { AR5K_PHY_CCKTXCTL,
  849. { 0x00000000, 0x00000000, 0x00000000 } },
  850. { AR5K_PHY_CCK_CROSSCORR,
  851. { 0xd6be6788, 0xd03e6788, 0xd03e6788 } },
  852. { AR5K_PHY_GAIN_2GHZ,
  853. { 0x002ec1e0, 0x002ac120, 0x002ac120 } },
  854. { AR5K_PHY_CCK_RX_CTL_4,
  855. { 0x1883800a, 0x1863800a, 0x1883800a } },
  856. { 0xa300,
  857. { 0x18010000, 0x18010000, 0x18010000 } },
  858. { 0xa304,
  859. { 0x30032602, 0x30032602, 0x30032602 } },
  860. { 0xa308,
  861. { 0x48073e06, 0x48073e06, 0x48073e06 } },
  862. { 0xa30c,
  863. { 0x560b4c0a, 0x560b4c0a, 0x560b4c0a } },
  864. { 0xa310,
  865. { 0x641a600f, 0x641a600f, 0x641a600f } },
  866. { 0xa314,
  867. { 0x784f6e1b, 0x784f6e1b, 0x784f6e1b } },
  868. { 0xa318,
  869. { 0x868f7c5a, 0x868f7c5a, 0x868f7c5a } },
  870. { 0xa31c,
  871. { 0x90cf865b, 0x8ecf865b, 0x8ecf865b } },
  872. { 0xa320,
  873. { 0x9d4f970f, 0x9b4f970f, 0x9b4f970f } },
  874. { 0xa324,
  875. { 0xa7cfa38f, 0xa3cf9f8f, 0xa3cf9f8f } },
  876. { 0xa328,
  877. { 0xb55faf1f, 0xb35faf1f, 0xb35faf1f } },
  878. { 0xa32c,
  879. { 0xbddfb99f, 0xbbdfb99f, 0xbbdfb99f } },
  880. { 0xa330,
  881. { 0xcb7fc53f, 0xcb7fc73f, 0xcb7fc73f } },
  882. { 0xa334,
  883. { 0xd5ffd1bf, 0xd3ffd1bf, 0xd3ffd1bf } },
  884. };
  885. static const struct ath5k_ini rf5413_ini_common_end[] = {
  886. { AR5K_DCU_FP, 0x000003e0 },
  887. { AR5K_5414_CBCFG, 0x00000010 },
  888. { AR5K_SEQ_MASK, 0x0000000f },
  889. { 0x809c, 0x00000000 },
  890. { 0x80a0, 0x00000000 },
  891. { AR5K_MIC_QOS_CTL, 0x00000000 },
  892. { AR5K_MIC_QOS_SEL, 0x00000000 },
  893. { AR5K_MISC_MODE, 0x00000000 },
  894. { AR5K_OFDM_FIL_CNT, 0x00000000 },
  895. { AR5K_CCK_FIL_CNT, 0x00000000 },
  896. { AR5K_PHYERR_CNT1, 0x00000000 },
  897. { AR5K_PHYERR_CNT1_MASK, 0x00000000 },
  898. { AR5K_PHYERR_CNT2, 0x00000000 },
  899. { AR5K_PHYERR_CNT2_MASK, 0x00000000 },
  900. { AR5K_TSF_THRES, 0x00000000 },
  901. { 0x8140, 0x800003f9 },
  902. { 0x8144, 0x00000000 },
  903. { AR5K_PHY_AGC, 0x00000000 },
  904. { AR5K_PHY_ADC_CTL, 0x0000a000 },
  905. { 0x983c, 0x00200400 },
  906. { AR5K_PHY_GAIN_OFFSET, 0x1284233c },
  907. { AR5K_PHY_SCR, 0x0000001f },
  908. { AR5K_PHY_SLMT, 0x00000080 },
  909. { AR5K_PHY_SCAL, 0x0000000e },
  910. { 0x9958, 0x00081fff },
  911. { AR5K_PHY_TIMING_7, 0x00000000 },
  912. { AR5K_PHY_TIMING_8, 0x02800000 },
  913. { AR5K_PHY_TIMING_11, 0x00000000 },
  914. { AR5K_PHY_HEAVY_CLIP_ENABLE, 0x00000000 },
  915. { 0x99e4, 0xaaaaaaaa },
  916. { 0x99e8, 0x3c466478 },
  917. { 0x99ec, 0x000000aa },
  918. { AR5K_PHY_SCLOCK, 0x0000000c },
  919. { AR5K_PHY_SDELAY, 0x000000ff },
  920. { AR5K_PHY_SPENDING, 0x00000014 },
  921. { AR5K_PHY_DAG_CCK_CTL, 0x000009b5 },
  922. { 0xa23c, 0x93c889af },
  923. { AR5K_PHY_FAST_ADC, 0x00000001 },
  924. { 0xa250, 0x0000a000 },
  925. { AR5K_PHY_BLUETOOTH, 0x00000000 },
  926. { AR5K_PHY_TPC_RG1, 0x0cc75380 },
  927. { 0xa25c, 0x0f0f0f01 },
  928. { 0xa260, 0x5f690f01 },
  929. { 0xa264, 0x00418a11 },
  930. { 0xa268, 0x00000000 },
  931. { AR5K_PHY_TPC_RG5, 0x0c30c16a },
  932. { 0xa270, 0x00820820 },
  933. { 0xa274, 0x081b7caa },
  934. { 0xa278, 0x1ce739ce },
  935. { 0xa27c, 0x051701ce },
  936. { 0xa338, 0x00000000 },
  937. { 0xa33c, 0x00000000 },
  938. { 0xa340, 0x00000000 },
  939. { 0xa344, 0x00000000 },
  940. { 0xa348, 0x3fffffff },
  941. { 0xa34c, 0x3fffffff },
  942. { 0xa350, 0x3fffffff },
  943. { 0xa354, 0x0003ffff },
  944. { 0xa358, 0x79a8aa1f },
  945. { 0xa35c, 0x066c420f },
  946. { 0xa360, 0x0f282207 },
  947. { 0xa364, 0x17601685 },
  948. { 0xa368, 0x1f801104 },
  949. { 0xa36c, 0x37a00c03 },
  950. { 0xa370, 0x3fc40883 },
  951. { 0xa374, 0x57c00803 },
  952. { 0xa378, 0x5fd80682 },
  953. { 0xa37c, 0x7fe00482 },
  954. { 0xa380, 0x7f3c7bba },
  955. { 0xa384, 0xf3307ff0 },
  956. };
  957. /* Initial mode-specific settings for RF2413/2414
  958. * (Written after ar5212_ini) */
  959. /* XXX: a mode ? */
  960. static const struct ath5k_ini_mode rf2413_ini_mode_end[] = {
  961. { AR5K_TXCFG,
  962. /* A/XR B G */
  963. { 0x00000015, 0x00000015, 0x00000015 } },
  964. { AR5K_USEC_5211,
  965. { 0x128d93a7, 0x04e01395, 0x12e013ab } },
  966. { AR5K_PHY_RF_CTL3,
  967. { 0x0a020001, 0x05020000, 0x0a020001 } },
  968. { AR5K_PHY_RF_CTL4,
  969. { 0x00000e00, 0x00000e00, 0x00000e00 } },
  970. { AR5K_PHY_PA_CTL,
  971. { 0x00000002, 0x0000000a, 0x0000000a } },
  972. { AR5K_PHY_GAIN,
  973. { 0x0018da6d, 0x001a6a64, 0x001a6a64 } },
  974. { AR5K_PHY_DESIRED_SIZE,
  975. { 0x0de8b4e0, 0x0de8b0da, 0x0c98b0da } },
  976. { AR5K_PHY_SIG,
  977. { 0x7e800d2e, 0x7ee80d2e, 0x7ec80d2e } },
  978. { AR5K_PHY_AGCCOARSE,
  979. { 0x3137665e, 0x3137665e, 0x3139605e } },
  980. { AR5K_PHY_WEAK_OFDM_LOW_THR,
  981. { 0x050cb081, 0x050cb081, 0x050cb081 } },
  982. { AR5K_PHY_RX_DELAY,
  983. { 0x000007d0, 0x0000044c, 0x00000898 } },
  984. { AR5K_PHY_FRAME_CTL_5211,
  985. { 0xf7b81000, 0xf7b80d00, 0xf7b81000 } },
  986. { AR5K_PHY_CCKTXCTL,
  987. { 0x00000000, 0x00000000, 0x00000000 } },
  988. { AR5K_PHY_CCK_CROSSCORR,
  989. { 0xd6be6788, 0xd03e6788, 0xd03e6788 } },
  990. { AR5K_PHY_GAIN_2GHZ,
  991. { 0x002c0140, 0x0042c140, 0x0042c140 } },
  992. { AR5K_PHY_CCK_RX_CTL_4,
  993. { 0x1883800a, 0x1863800a, 0x1883800a } },
  994. };
  995. static const struct ath5k_ini rf2413_ini_common_end[] = {
  996. { AR5K_DCU_FP, 0x000003e0 },
  997. { AR5K_SEQ_MASK, 0x0000000f },
  998. { AR5K_MIC_QOS_CTL, 0x00000000 },
  999. { AR5K_MIC_QOS_SEL, 0x00000000 },
  1000. { AR5K_MISC_MODE, 0x00000000 },
  1001. { AR5K_OFDM_FIL_CNT, 0x00000000 },
  1002. { AR5K_CCK_FIL_CNT, 0x00000000 },
  1003. { AR5K_PHYERR_CNT1, 0x00000000 },
  1004. { AR5K_PHYERR_CNT1_MASK, 0x00000000 },
  1005. { AR5K_PHYERR_CNT2, 0x00000000 },
  1006. { AR5K_PHYERR_CNT2_MASK, 0x00000000 },
  1007. { AR5K_TSF_THRES, 0x00000000 },
  1008. { 0x8140, 0x800000a8 },
  1009. { 0x8144, 0x00000000 },
  1010. { AR5K_PHY_AGC, 0x00000000 },
  1011. { AR5K_PHY_ADC_CTL, 0x0000a000 },
  1012. { 0x983c, 0x00200400 },
  1013. { AR5K_PHY_GAIN_OFFSET, 0x1284233c },
  1014. { AR5K_PHY_SCR, 0x0000001f },
  1015. { AR5K_PHY_SLMT, 0x00000080 },
  1016. { AR5K_PHY_SCAL, 0x0000000e },
  1017. { 0x9958, 0x000000ff },
  1018. { AR5K_PHY_TIMING_7, 0x00000000 },
  1019. { AR5K_PHY_TIMING_8, 0x02800000 },
  1020. { AR5K_PHY_TIMING_11, 0x00000000 },
  1021. { AR5K_PHY_HEAVY_CLIP_ENABLE, 0x00000000 },
  1022. { 0x99e4, 0xaaaaaaaa },
  1023. { 0x99e8, 0x3c466478 },
  1024. { 0x99ec, 0x000000aa },
  1025. { AR5K_PHY_SCLOCK, 0x0000000c },
  1026. { AR5K_PHY_SDELAY, 0x000000ff },
  1027. { AR5K_PHY_SPENDING, 0x00000014 },
  1028. { AR5K_PHY_DAG_CCK_CTL, 0x000009b5 },
  1029. { 0xa23c, 0x93c889af },
  1030. { AR5K_PHY_FAST_ADC, 0x00000001 },
  1031. { 0xa250, 0x0000a000 },
  1032. { AR5K_PHY_BLUETOOTH, 0x00000000 },
  1033. { AR5K_PHY_TPC_RG1, 0x0cc75380 },
  1034. { 0xa25c, 0x0f0f0f01 },
  1035. { 0xa260, 0x5f690f01 },
  1036. { 0xa264, 0x00418a11 },
  1037. { 0xa268, 0x00000000 },
  1038. { AR5K_PHY_TPC_RG5, 0x0c30c16a },
  1039. { 0xa270, 0x00820820 },
  1040. { 0xa274, 0x001b7caa },
  1041. { 0xa278, 0x1ce739ce },
  1042. { 0xa27c, 0x051701ce },
  1043. { 0xa300, 0x18010000 },
  1044. { 0xa304, 0x30032602 },
  1045. { 0xa308, 0x48073e06 },
  1046. { 0xa30c, 0x560b4c0a },
  1047. { 0xa310, 0x641a600f },
  1048. { 0xa314, 0x784f6e1b },
  1049. { 0xa318, 0x868f7c5a },
  1050. { 0xa31c, 0x8ecf865b },
  1051. { 0xa320, 0x9d4f970f },
  1052. { 0xa324, 0xa5cfa18f },
  1053. { 0xa328, 0xb55faf1f },
  1054. { 0xa32c, 0xbddfb99f },
  1055. { 0xa330, 0xcd7fc73f },
  1056. { 0xa334, 0xd5ffd1bf },
  1057. { 0xa338, 0x00000000 },
  1058. { 0xa33c, 0x00000000 },
  1059. { 0xa340, 0x00000000 },
  1060. { 0xa344, 0x00000000 },
  1061. { 0xa348, 0x3fffffff },
  1062. { 0xa34c, 0x3fffffff },
  1063. { 0xa350, 0x3fffffff },
  1064. { 0xa354, 0x0003ffff },
  1065. { 0xa358, 0x79a8aa1f },
  1066. { 0xa35c, 0x066c420f },
  1067. { 0xa360, 0x0f282207 },
  1068. { 0xa364, 0x17601685 },
  1069. { 0xa368, 0x1f801104 },
  1070. { 0xa36c, 0x37a00c03 },
  1071. { 0xa370, 0x3fc40883 },
  1072. { 0xa374, 0x57c00803 },
  1073. { 0xa378, 0x5fd80682 },
  1074. { 0xa37c, 0x7fe00482 },
  1075. { 0xa380, 0x7f3c7bba },
  1076. { 0xa384, 0xf3307ff0 },
  1077. };
  1078. /* Initial mode-specific settings for RF2425
  1079. * (Written after ar5212_ini) */
  1080. /* XXX: a mode ? */
  1081. static const struct ath5k_ini_mode rf2425_ini_mode_end[] = {
  1082. { AR5K_TXCFG,
  1083. /* A/XR B G */
  1084. { 0x00000015, 0x00000015, 0x00000015 } },
  1085. { AR5K_USEC_5211,
  1086. { 0x128d93a7, 0x04e01395, 0x12e013ab } },
  1087. { AR5K_PHY_RF_CTL3,
  1088. { 0x0a020001, 0x05020100, 0x0a020001 } },
  1089. { AR5K_PHY_RF_CTL4,
  1090. { 0x00000e0e, 0x00000e0e, 0x00000e0e } },
  1091. { AR5K_PHY_PA_CTL,
  1092. { 0x00000003, 0x0000000b, 0x0000000b } },
  1093. { AR5K_PHY_SETTLING,
  1094. { 0x1372161c, 0x13721722, 0x13721422 } },
  1095. { AR5K_PHY_GAIN,
  1096. { 0x0018fa61, 0x00199a65, 0x00199a65 } },
  1097. { AR5K_PHY_DESIRED_SIZE,
  1098. { 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da } },
  1099. { AR5K_PHY_SIG,
  1100. { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } },
  1101. { AR5K_PHY_AGCCOARSE,
  1102. { 0x3139605e, 0x3139605e, 0x3139605e } },
  1103. { AR5K_PHY_WEAK_OFDM_LOW_THR,
  1104. { 0x050cb081, 0x050cb081, 0x050cb081 } },
  1105. { AR5K_PHY_RX_DELAY,
  1106. { 0x000007d0, 0x0000044c, 0x00000898 } },
  1107. { AR5K_PHY_FRAME_CTL_5211,
  1108. { 0xf7b81000, 0xf7b80d00, 0xf7b81000 } },
  1109. { AR5K_PHY_CCKTXCTL,
  1110. { 0x00000000, 0x00000000, 0x00000000 } },
  1111. { AR5K_PHY_CCK_CROSSCORR,
  1112. { 0xd6be6788, 0xd03e6788, 0xd03e6788 } },
  1113. { AR5K_PHY_GAIN_2GHZ,
  1114. { 0x00000140, 0x0052c140, 0x0052c140 } },
  1115. { AR5K_PHY_CCK_RX_CTL_4,
  1116. { 0x1883800a, 0x1863800a, 0x1883800a } },
  1117. { 0xa324,
  1118. { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
  1119. { 0xa328,
  1120. { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
  1121. { 0xa32c,
  1122. { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
  1123. { 0xa330,
  1124. { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
  1125. { 0xa334,
  1126. { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
  1127. };
  1128. static const struct ath5k_ini rf2425_ini_common_end[] = {
  1129. { AR5K_DCU_FP, 0x000003e0 },
  1130. { AR5K_SEQ_MASK, 0x0000000f },
  1131. { 0x809c, 0x00000000 },
  1132. { 0x80a0, 0x00000000 },
  1133. { AR5K_MIC_QOS_CTL, 0x00000000 },
  1134. { AR5K_MIC_QOS_SEL, 0x00000000 },
  1135. { AR5K_MISC_MODE, 0x00000000 },
  1136. { AR5K_OFDM_FIL_CNT, 0x00000000 },
  1137. { AR5K_CCK_FIL_CNT, 0x00000000 },
  1138. { AR5K_PHYERR_CNT1, 0x00000000 },
  1139. { AR5K_PHYERR_CNT1_MASK, 0x00000000 },
  1140. { AR5K_PHYERR_CNT2, 0x00000000 },
  1141. { AR5K_PHYERR_CNT2_MASK, 0x00000000 },
  1142. { AR5K_TSF_THRES, 0x00000000 },
  1143. { 0x8140, 0x800003f9 },
  1144. { 0x8144, 0x00000000 },
  1145. { AR5K_PHY_AGC, 0x00000000 },
  1146. { AR5K_PHY_ADC_CTL, 0x0000a000 },
  1147. { 0x983c, 0x00200400 },
  1148. { AR5K_PHY_GAIN_OFFSET, 0x1284233c },
  1149. { AR5K_PHY_SCR, 0x0000001f },
  1150. { AR5K_PHY_SLMT, 0x00000080 },
  1151. { AR5K_PHY_SCAL, 0x0000000e },
  1152. { 0x9958, 0x00081fff },
  1153. { AR5K_PHY_TIMING_7, 0x00000000 },
  1154. { AR5K_PHY_TIMING_8, 0x02800000 },
  1155. { AR5K_PHY_TIMING_11, 0x00000000 },
  1156. { 0x99dc, 0xfebadbe8 },
  1157. { AR5K_PHY_HEAVY_CLIP_ENABLE, 0x00000000 },
  1158. { 0x99e4, 0xaaaaaaaa },
  1159. { 0x99e8, 0x3c466478 },
  1160. { 0x99ec, 0x000000aa },
  1161. { AR5K_PHY_SCLOCK, 0x0000000c },
  1162. { AR5K_PHY_SDELAY, 0x000000ff },
  1163. { AR5K_PHY_SPENDING, 0x00000014 },
  1164. { AR5K_PHY_DAG_CCK_CTL, 0x000009b5 },
  1165. { AR5K_PHY_TXPOWER_RATE3, 0x20202020 },
  1166. { AR5K_PHY_TXPOWER_RATE4, 0x20202020 },
  1167. { 0xa23c, 0x93c889af },
  1168. { AR5K_PHY_FAST_ADC, 0x00000001 },
  1169. { 0xa250, 0x0000a000 },
  1170. { AR5K_PHY_BLUETOOTH, 0x00000000 },
  1171. { AR5K_PHY_TPC_RG1, 0x0cc75380 },
  1172. { 0xa25c, 0x0f0f0f01 },
  1173. { 0xa260, 0x5f690f01 },
  1174. { 0xa264, 0x00418a11 },
  1175. { 0xa268, 0x00000000 },
  1176. { AR5K_PHY_TPC_RG5, 0x0c30c166 },
  1177. { 0xa270, 0x00820820 },
  1178. { 0xa274, 0x081a3caa },
  1179. { 0xa278, 0x1ce739ce },
  1180. { 0xa27c, 0x051701ce },
  1181. { 0xa300, 0x16010000 },
  1182. { 0xa304, 0x2c032402 },
  1183. { 0xa308, 0x48433e42 },
  1184. { 0xa30c, 0x5a0f500b },
  1185. { 0xa310, 0x6c4b624a },
  1186. { 0xa314, 0x7e8b748a },
  1187. { 0xa318, 0x96cf8ccb },
  1188. { 0xa31c, 0xa34f9d0f },
  1189. { 0xa320, 0xa7cfa58f },
  1190. { 0xa348, 0x3fffffff },
  1191. { 0xa34c, 0x3fffffff },
  1192. { 0xa350, 0x3fffffff },
  1193. { 0xa354, 0x0003ffff },
  1194. { 0xa358, 0x79a8aa1f },
  1195. { 0xa35c, 0x066c420f },
  1196. { 0xa360, 0x0f282207 },
  1197. { 0xa364, 0x17601685 },
  1198. { 0xa368, 0x1f801104 },
  1199. { 0xa36c, 0x37a00c03 },
  1200. { 0xa370, 0x3fc40883 },
  1201. { 0xa374, 0x57c00803 },
  1202. { 0xa378, 0x5fd80682 },
  1203. { 0xa37c, 0x7fe00482 },
  1204. { 0xa380, 0x7f3c7bba },
  1205. { 0xa384, 0xf3307ff0 },
  1206. };
  1207. /*
  1208. * Initial BaseBand Gain settings for RF5111/5112 (AR5210 comes with
  1209. * RF5110 only so initial BB Gain settings are included in AR5K_AR5210_INI)
  1210. */
  1211. /* RF5111 Initial BaseBand Gain settings */
  1212. static const struct ath5k_ini rf5111_ini_bbgain[] = {
  1213. { AR5K_BB_GAIN(0), 0x00000000 },
  1214. { AR5K_BB_GAIN(1), 0x00000020 },
  1215. { AR5K_BB_GAIN(2), 0x00000010 },
  1216. { AR5K_BB_GAIN(3), 0x00000030 },
  1217. { AR5K_BB_GAIN(4), 0x00000008 },
  1218. { AR5K_BB_GAIN(5), 0x00000028 },
  1219. { AR5K_BB_GAIN(6), 0x00000004 },
  1220. { AR5K_BB_GAIN(7), 0x00000024 },
  1221. { AR5K_BB_GAIN(8), 0x00000014 },
  1222. { AR5K_BB_GAIN(9), 0x00000034 },
  1223. { AR5K_BB_GAIN(10), 0x0000000c },
  1224. { AR5K_BB_GAIN(11), 0x0000002c },
  1225. { AR5K_BB_GAIN(12), 0x00000002 },
  1226. { AR5K_BB_GAIN(13), 0x00000022 },
  1227. { AR5K_BB_GAIN(14), 0x00000012 },
  1228. { AR5K_BB_GAIN(15), 0x00000032 },
  1229. { AR5K_BB_GAIN(16), 0x0000000a },
  1230. { AR5K_BB_GAIN(17), 0x0000002a },
  1231. { AR5K_BB_GAIN(18), 0x00000006 },
  1232. { AR5K_BB_GAIN(19), 0x00000026 },
  1233. { AR5K_BB_GAIN(20), 0x00000016 },
  1234. { AR5K_BB_GAIN(21), 0x00000036 },
  1235. { AR5K_BB_GAIN(22), 0x0000000e },
  1236. { AR5K_BB_GAIN(23), 0x0000002e },
  1237. { AR5K_BB_GAIN(24), 0x00000001 },
  1238. { AR5K_BB_GAIN(25), 0x00000021 },
  1239. { AR5K_BB_GAIN(26), 0x00000011 },
  1240. { AR5K_BB_GAIN(27), 0x00000031 },
  1241. { AR5K_BB_GAIN(28), 0x00000009 },
  1242. { AR5K_BB_GAIN(29), 0x00000029 },
  1243. { AR5K_BB_GAIN(30), 0x00000005 },
  1244. { AR5K_BB_GAIN(31), 0x00000025 },
  1245. { AR5K_BB_GAIN(32), 0x00000015 },
  1246. { AR5K_BB_GAIN(33), 0x00000035 },
  1247. { AR5K_BB_GAIN(34), 0x0000000d },
  1248. { AR5K_BB_GAIN(35), 0x0000002d },
  1249. { AR5K_BB_GAIN(36), 0x00000003 },
  1250. { AR5K_BB_GAIN(37), 0x00000023 },
  1251. { AR5K_BB_GAIN(38), 0x00000013 },
  1252. { AR5K_BB_GAIN(39), 0x00000033 },
  1253. { AR5K_BB_GAIN(40), 0x0000000b },
  1254. { AR5K_BB_GAIN(41), 0x0000002b },
  1255. { AR5K_BB_GAIN(42), 0x0000002b },
  1256. { AR5K_BB_GAIN(43), 0x0000002b },
  1257. { AR5K_BB_GAIN(44), 0x0000002b },
  1258. { AR5K_BB_GAIN(45), 0x0000002b },
  1259. { AR5K_BB_GAIN(46), 0x0000002b },
  1260. { AR5K_BB_GAIN(47), 0x0000002b },
  1261. { AR5K_BB_GAIN(48), 0x0000002b },
  1262. { AR5K_BB_GAIN(49), 0x0000002b },
  1263. { AR5K_BB_GAIN(50), 0x0000002b },
  1264. { AR5K_BB_GAIN(51), 0x0000002b },
  1265. { AR5K_BB_GAIN(52), 0x0000002b },
  1266. { AR5K_BB_GAIN(53), 0x0000002b },
  1267. { AR5K_BB_GAIN(54), 0x0000002b },
  1268. { AR5K_BB_GAIN(55), 0x0000002b },
  1269. { AR5K_BB_GAIN(56), 0x0000002b },
  1270. { AR5K_BB_GAIN(57), 0x0000002b },
  1271. { AR5K_BB_GAIN(58), 0x0000002b },
  1272. { AR5K_BB_GAIN(59), 0x0000002b },
  1273. { AR5K_BB_GAIN(60), 0x0000002b },
  1274. { AR5K_BB_GAIN(61), 0x0000002b },
  1275. { AR5K_BB_GAIN(62), 0x00000002 },
  1276. { AR5K_BB_GAIN(63), 0x00000016 },
  1277. };
  1278. /* RF5112 Initial BaseBand Gain settings (Same for RF5413/5414+) */
  1279. static const struct ath5k_ini rf5112_ini_bbgain[] = {
  1280. { AR5K_BB_GAIN(0), 0x00000000 },
  1281. { AR5K_BB_GAIN(1), 0x00000001 },
  1282. { AR5K_BB_GAIN(2), 0x00000002 },
  1283. { AR5K_BB_GAIN(3), 0x00000003 },
  1284. { AR5K_BB_GAIN(4), 0x00000004 },
  1285. { AR5K_BB_GAIN(5), 0x00000005 },
  1286. { AR5K_BB_GAIN(6), 0x00000008 },
  1287. { AR5K_BB_GAIN(7), 0x00000009 },
  1288. { AR5K_BB_GAIN(8), 0x0000000a },
  1289. { AR5K_BB_GAIN(9), 0x0000000b },
  1290. { AR5K_BB_GAIN(10), 0x0000000c },
  1291. { AR5K_BB_GAIN(11), 0x0000000d },
  1292. { AR5K_BB_GAIN(12), 0x00000010 },
  1293. { AR5K_BB_GAIN(13), 0x00000011 },
  1294. { AR5K_BB_GAIN(14), 0x00000012 },
  1295. { AR5K_BB_GAIN(15), 0x00000013 },
  1296. { AR5K_BB_GAIN(16), 0x00000014 },
  1297. { AR5K_BB_GAIN(17), 0x00000015 },
  1298. { AR5K_BB_GAIN(18), 0x00000018 },
  1299. { AR5K_BB_GAIN(19), 0x00000019 },
  1300. { AR5K_BB_GAIN(20), 0x0000001a },
  1301. { AR5K_BB_GAIN(21), 0x0000001b },
  1302. { AR5K_BB_GAIN(22), 0x0000001c },
  1303. { AR5K_BB_GAIN(23), 0x0000001d },
  1304. { AR5K_BB_GAIN(24), 0x00000020 },
  1305. { AR5K_BB_GAIN(25), 0x00000021 },
  1306. { AR5K_BB_GAIN(26), 0x00000022 },
  1307. { AR5K_BB_GAIN(27), 0x00000023 },
  1308. { AR5K_BB_GAIN(28), 0x00000024 },
  1309. { AR5K_BB_GAIN(29), 0x00000025 },
  1310. { AR5K_BB_GAIN(30), 0x00000028 },
  1311. { AR5K_BB_GAIN(31), 0x00000029 },
  1312. { AR5K_BB_GAIN(32), 0x0000002a },
  1313. { AR5K_BB_GAIN(33), 0x0000002b },
  1314. { AR5K_BB_GAIN(34), 0x0000002c },
  1315. { AR5K_BB_GAIN(35), 0x0000002d },
  1316. { AR5K_BB_GAIN(36), 0x00000030 },
  1317. { AR5K_BB_GAIN(37), 0x00000031 },
  1318. { AR5K_BB_GAIN(38), 0x00000032 },
  1319. { AR5K_BB_GAIN(39), 0x00000033 },
  1320. { AR5K_BB_GAIN(40), 0x00000034 },
  1321. { AR5K_BB_GAIN(41), 0x00000035 },
  1322. { AR5K_BB_GAIN(42), 0x00000035 },
  1323. { AR5K_BB_GAIN(43), 0x00000035 },
  1324. { AR5K_BB_GAIN(44), 0x00000035 },
  1325. { AR5K_BB_GAIN(45), 0x00000035 },
  1326. { AR5K_BB_GAIN(46), 0x00000035 },
  1327. { AR5K_BB_GAIN(47), 0x00000035 },
  1328. { AR5K_BB_GAIN(48), 0x00000035 },
  1329. { AR5K_BB_GAIN(49), 0x00000035 },
  1330. { AR5K_BB_GAIN(50), 0x00000035 },
  1331. { AR5K_BB_GAIN(51), 0x00000035 },
  1332. { AR5K_BB_GAIN(52), 0x00000035 },
  1333. { AR5K_BB_GAIN(53), 0x00000035 },
  1334. { AR5K_BB_GAIN(54), 0x00000035 },
  1335. { AR5K_BB_GAIN(55), 0x00000035 },
  1336. { AR5K_BB_GAIN(56), 0x00000035 },
  1337. { AR5K_BB_GAIN(57), 0x00000035 },
  1338. { AR5K_BB_GAIN(58), 0x00000035 },
  1339. { AR5K_BB_GAIN(59), 0x00000035 },
  1340. { AR5K_BB_GAIN(60), 0x00000035 },
  1341. { AR5K_BB_GAIN(61), 0x00000035 },
  1342. { AR5K_BB_GAIN(62), 0x00000010 },
  1343. { AR5K_BB_GAIN(63), 0x0000001a },
  1344. };
  1345. /**
  1346. * ath5k_hw_ini_registers() - Write initial register dump common for all modes
  1347. * @ah: The &struct ath5k_hw
  1348. * @size: Dump size
  1349. * @ini_regs: The array of &struct ath5k_ini
  1350. * @skip_pcu: Skip PCU registers
  1351. */
  1352. static void
  1353. ath5k_hw_ini_registers(struct ath5k_hw *ah, unsigned int size,
  1354. const struct ath5k_ini *ini_regs, bool skip_pcu)
  1355. {
  1356. unsigned int i;
  1357. /* Write initial registers */
  1358. for (i = 0; i < size; i++) {
  1359. /* Skip PCU registers if
  1360. * requested */
  1361. if (skip_pcu &&
  1362. ini_regs[i].ini_register >= AR5K_PCU_MIN &&
  1363. ini_regs[i].ini_register <= AR5K_PCU_MAX)
  1364. continue;
  1365. switch (ini_regs[i].ini_mode) {
  1366. case AR5K_INI_READ:
  1367. /* Cleared on read */
  1368. ath5k_hw_reg_read(ah, ini_regs[i].ini_register);
  1369. break;
  1370. case AR5K_INI_WRITE:
  1371. default:
  1372. AR5K_REG_WAIT(i);
  1373. ath5k_hw_reg_write(ah, ini_regs[i].ini_value,
  1374. ini_regs[i].ini_register);
  1375. }
  1376. }
  1377. }
  1378. /**
  1379. * ath5k_hw_ini_mode_registers() - Write initial mode-specific register dump
  1380. * @ah: The &struct ath5k_hw
  1381. * @size: Dump size
  1382. * @ini_mode: The array of &struct ath5k_ini_mode
  1383. * @mode: One of enum ath5k_driver_mode
  1384. */
  1385. static void
  1386. ath5k_hw_ini_mode_registers(struct ath5k_hw *ah,
  1387. unsigned int size, const struct ath5k_ini_mode *ini_mode,
  1388. u8 mode)
  1389. {
  1390. unsigned int i;
  1391. for (i = 0; i < size; i++) {
  1392. AR5K_REG_WAIT(i);
  1393. ath5k_hw_reg_write(ah, ini_mode[i].mode_value[mode],
  1394. (u32)ini_mode[i].mode_register);
  1395. }
  1396. }
  1397. /**
  1398. * ath5k_hw_write_initvals() - Write initial chip-specific register dump
  1399. * @ah: The &struct ath5k_hw
  1400. * @mode: One of enum ath5k_driver_mode
  1401. * @skip_pcu: Skip PCU registers
  1402. *
  1403. * Write initial chip-specific register dump, to get the chipset on a
  1404. * clean and ready-to-work state after warm reset.
  1405. */
  1406. int
  1407. ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool skip_pcu)
  1408. {
  1409. /*
  1410. * Write initial register settings
  1411. */
  1412. /* For AR5212 and compatible */
  1413. if (ah->ah_version == AR5K_AR5212) {
  1414. /* First set of mode-specific settings */
  1415. ath5k_hw_ini_mode_registers(ah,
  1416. ARRAY_SIZE(ar5212_ini_mode_start),
  1417. ar5212_ini_mode_start, mode);
  1418. /*
  1419. * Write initial settings common for all modes
  1420. */
  1421. ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5212_ini_common_start),
  1422. ar5212_ini_common_start, skip_pcu);
  1423. /* Second set of mode-specific settings */
  1424. switch (ah->ah_radio) {
  1425. case AR5K_RF5111:
  1426. ath5k_hw_ini_mode_registers(ah,
  1427. ARRAY_SIZE(rf5111_ini_mode_end),
  1428. rf5111_ini_mode_end, mode);
  1429. ath5k_hw_ini_registers(ah,
  1430. ARRAY_SIZE(rf5111_ini_common_end),
  1431. rf5111_ini_common_end, skip_pcu);
  1432. /* Baseband gain table */
  1433. ath5k_hw_ini_registers(ah,
  1434. ARRAY_SIZE(rf5111_ini_bbgain),
  1435. rf5111_ini_bbgain, skip_pcu);
  1436. break;
  1437. case AR5K_RF5112:
  1438. ath5k_hw_ini_mode_registers(ah,
  1439. ARRAY_SIZE(rf5112_ini_mode_end),
  1440. rf5112_ini_mode_end, mode);
  1441. ath5k_hw_ini_registers(ah,
  1442. ARRAY_SIZE(rf5112_ini_common_end),
  1443. rf5112_ini_common_end, skip_pcu);
  1444. ath5k_hw_ini_registers(ah,
  1445. ARRAY_SIZE(rf5112_ini_bbgain),
  1446. rf5112_ini_bbgain, skip_pcu);
  1447. break;
  1448. case AR5K_RF5413:
  1449. ath5k_hw_ini_mode_registers(ah,
  1450. ARRAY_SIZE(rf5413_ini_mode_end),
  1451. rf5413_ini_mode_end, mode);
  1452. ath5k_hw_ini_registers(ah,
  1453. ARRAY_SIZE(rf5413_ini_common_end),
  1454. rf5413_ini_common_end, skip_pcu);
  1455. ath5k_hw_ini_registers(ah,
  1456. ARRAY_SIZE(rf5112_ini_bbgain),
  1457. rf5112_ini_bbgain, skip_pcu);
  1458. break;
  1459. case AR5K_RF2316:
  1460. case AR5K_RF2413:
  1461. ath5k_hw_ini_mode_registers(ah,
  1462. ARRAY_SIZE(rf2413_ini_mode_end),
  1463. rf2413_ini_mode_end, mode);
  1464. ath5k_hw_ini_registers(ah,
  1465. ARRAY_SIZE(rf2413_ini_common_end),
  1466. rf2413_ini_common_end, skip_pcu);
  1467. /* Override settings from rf2413_ini_common_end */
  1468. if (ah->ah_radio == AR5K_RF2316) {
  1469. ath5k_hw_reg_write(ah, 0x00004000,
  1470. AR5K_PHY_AGC);
  1471. ath5k_hw_reg_write(ah, 0x081b7caa,
  1472. 0xa274);
  1473. }
  1474. ath5k_hw_ini_registers(ah,
  1475. ARRAY_SIZE(rf5112_ini_bbgain),
  1476. rf5112_ini_bbgain, skip_pcu);
  1477. break;
  1478. case AR5K_RF2317:
  1479. ath5k_hw_ini_mode_registers(ah,
  1480. ARRAY_SIZE(rf2413_ini_mode_end),
  1481. rf2413_ini_mode_end, mode);
  1482. ath5k_hw_ini_registers(ah,
  1483. ARRAY_SIZE(rf2425_ini_common_end),
  1484. rf2425_ini_common_end, skip_pcu);
  1485. /* Override settings from rf2413_ini_mode_end */
  1486. ath5k_hw_reg_write(ah, 0x00180a65, AR5K_PHY_GAIN);
  1487. /* Override settings from rf2413_ini_common_end */
  1488. ath5k_hw_reg_write(ah, 0x00004000, AR5K_PHY_AGC);
  1489. AR5K_REG_WRITE_BITS(ah, AR5K_PHY_TPC_RG5,
  1490. AR5K_PHY_TPC_RG5_PD_GAIN_OVERLAP, 0xa);
  1491. ath5k_hw_reg_write(ah, 0x800000a8, 0x8140);
  1492. ath5k_hw_reg_write(ah, 0x000000ff, 0x9958);
  1493. ath5k_hw_ini_registers(ah,
  1494. ARRAY_SIZE(rf5112_ini_bbgain),
  1495. rf5112_ini_bbgain, skip_pcu);
  1496. break;
  1497. case AR5K_RF2425:
  1498. ath5k_hw_ini_mode_registers(ah,
  1499. ARRAY_SIZE(rf2425_ini_mode_end),
  1500. rf2425_ini_mode_end, mode);
  1501. ath5k_hw_ini_registers(ah,
  1502. ARRAY_SIZE(rf2425_ini_common_end),
  1503. rf2425_ini_common_end, skip_pcu);
  1504. ath5k_hw_ini_registers(ah,
  1505. ARRAY_SIZE(rf5112_ini_bbgain),
  1506. rf5112_ini_bbgain, skip_pcu);
  1507. break;
  1508. default:
  1509. return -EINVAL;
  1510. }
  1511. /* For AR5211 */
  1512. } else if (ah->ah_version == AR5K_AR5211) {
  1513. /* AR5K_MODE_11B */
  1514. if (mode > 2) {
  1515. ATH5K_ERR(ah, "unsupported channel mode: %d\n", mode);
  1516. return -EINVAL;
  1517. }
  1518. /* Mode-specific settings */
  1519. ath5k_hw_ini_mode_registers(ah, ARRAY_SIZE(ar5211_ini_mode),
  1520. ar5211_ini_mode, mode);
  1521. /*
  1522. * Write initial settings common for all modes
  1523. */
  1524. ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5211_ini),
  1525. ar5211_ini, skip_pcu);
  1526. /* AR5211 only comes with 5111 */
  1527. /* Baseband gain table */
  1528. ath5k_hw_ini_registers(ah, ARRAY_SIZE(rf5111_ini_bbgain),
  1529. rf5111_ini_bbgain, skip_pcu);
  1530. /* For AR5210 (for mode settings check out ath5k_hw_reset_tx_queue) */
  1531. } else if (ah->ah_version == AR5K_AR5210) {
  1532. ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5210_ini),
  1533. ar5210_ini, skip_pcu);
  1534. }
  1535. return 0;
  1536. }