phy.c 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978
  1. /*
  2. * Copyright (c) 2008-2009 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. /**
  17. * DOC: Programming Atheros 802.11n analog front end radios
  18. *
  19. * AR5416 MAC based PCI devices and AR518 MAC based PCI-Express
  20. * devices have either an external AR2133 analog front end radio for single
  21. * band 2.4 GHz communication or an AR5133 analog front end radio for dual
  22. * band 2.4 GHz / 5 GHz communication.
  23. *
  24. * All devices after the AR5416 and AR5418 family starting with the AR9280
  25. * have their analog front radios, MAC/BB and host PCIe/USB interface embedded
  26. * into a single-chip and require less programming.
  27. *
  28. * The following single-chips exist with a respective embedded radio:
  29. *
  30. * AR9280 - 11n dual-band 2x2 MIMO for PCIe
  31. * AR9281 - 11n single-band 1x2 MIMO for PCIe
  32. * AR9285 - 11n single-band 1x1 for PCIe
  33. * AR9287 - 11n single-band 2x2 MIMO for PCIe
  34. *
  35. * AR9220 - 11n dual-band 2x2 MIMO for PCI
  36. * AR9223 - 11n single-band 2x2 MIMO for PCI
  37. *
  38. * AR9287 - 11n single-band 1x1 MIMO for USB
  39. */
  40. #include <linux/slab.h>
  41. #include "hw.h"
  42. /**
  43. * ath9k_hw_write_regs - ??
  44. *
  45. * @ah: atheros hardware structure
  46. * @freqIndex:
  47. * @regWrites:
  48. *
  49. * Used for both the chipsets with an external AR2133/AR5133 radios and
  50. * single-chip devices.
  51. */
  52. void ath9k_hw_write_regs(struct ath_hw *ah, u32 freqIndex, int regWrites)
  53. {
  54. REG_WRITE_ARRAY(&ah->iniBB_RfGain, freqIndex, regWrites);
  55. }
  56. /**
  57. * ath9k_hw_ar9280_set_channel - set channel on single-chip device
  58. * @ah: atheros hardware structure
  59. * @chan:
  60. *
  61. * This is the function to change channel on single-chip devices, that is
  62. * all devices after ar9280.
  63. *
  64. * This function takes the channel value in MHz and sets
  65. * hardware channel value. Assumes writes have been enabled to analog bus.
  66. *
  67. * Actual Expression,
  68. *
  69. * For 2GHz channel,
  70. * Channel Frequency = (3/4) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^17)
  71. * (freq_ref = 40MHz)
  72. *
  73. * For 5GHz channel,
  74. * Channel Frequency = (3/2) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^10)
  75. * (freq_ref = 40MHz/(24>>amodeRefSel))
  76. */
  77. int ath9k_hw_ar9280_set_channel(struct ath_hw *ah, struct ath9k_channel *chan)
  78. {
  79. u16 bMode, fracMode, aModeRefSel = 0;
  80. u32 freq, ndiv, channelSel = 0, channelFrac = 0, reg32 = 0;
  81. struct chan_centers centers;
  82. u32 refDivA = 24;
  83. ath9k_hw_get_channel_centers(ah, chan, &centers);
  84. freq = centers.synth_center;
  85. reg32 = REG_READ(ah, AR_PHY_SYNTH_CONTROL);
  86. reg32 &= 0xc0000000;
  87. if (freq < 4800) { /* 2 GHz, fractional mode */
  88. u32 txctl;
  89. int regWrites = 0;
  90. bMode = 1;
  91. fracMode = 1;
  92. aModeRefSel = 0;
  93. channelSel = (freq * 0x10000) / 15;
  94. if (AR_SREV_9287_11_OR_LATER(ah)) {
  95. if (freq == 2484) {
  96. /* Enable channel spreading for channel 14 */
  97. REG_WRITE_ARRAY(&ah->iniCckfirJapan2484,
  98. 1, regWrites);
  99. } else {
  100. REG_WRITE_ARRAY(&ah->iniCckfirNormal,
  101. 1, regWrites);
  102. }
  103. } else {
  104. txctl = REG_READ(ah, AR_PHY_CCK_TX_CTRL);
  105. if (freq == 2484) {
  106. /* Enable channel spreading for channel 14 */
  107. REG_WRITE(ah, AR_PHY_CCK_TX_CTRL,
  108. txctl | AR_PHY_CCK_TX_CTRL_JAPAN);
  109. } else {
  110. REG_WRITE(ah, AR_PHY_CCK_TX_CTRL,
  111. txctl &~ AR_PHY_CCK_TX_CTRL_JAPAN);
  112. }
  113. }
  114. } else {
  115. bMode = 0;
  116. fracMode = 0;
  117. switch(ah->eep_ops->get_eeprom(ah, EEP_FRAC_N_5G)) {
  118. case 0:
  119. if ((freq % 20) == 0) {
  120. aModeRefSel = 3;
  121. } else if ((freq % 10) == 0) {
  122. aModeRefSel = 2;
  123. }
  124. if (aModeRefSel)
  125. break;
  126. case 1:
  127. default:
  128. aModeRefSel = 0;
  129. /*
  130. * Enable 2G (fractional) mode for channels
  131. * which are 5MHz spaced.
  132. */
  133. fracMode = 1;
  134. refDivA = 1;
  135. channelSel = (freq * 0x8000) / 15;
  136. /* RefDivA setting */
  137. REG_RMW_FIELD(ah, AR_AN_SYNTH9,
  138. AR_AN_SYNTH9_REFDIVA, refDivA);
  139. }
  140. if (!fracMode) {
  141. ndiv = (freq * (refDivA >> aModeRefSel)) / 60;
  142. channelSel = ndiv & 0x1ff;
  143. channelFrac = (ndiv & 0xfffffe00) * 2;
  144. channelSel = (channelSel << 17) | channelFrac;
  145. }
  146. }
  147. reg32 = reg32 |
  148. (bMode << 29) |
  149. (fracMode << 28) | (aModeRefSel << 26) | (channelSel);
  150. REG_WRITE(ah, AR_PHY_SYNTH_CONTROL, reg32);
  151. ah->curchan = chan;
  152. ah->curchan_rad_index = -1;
  153. return 0;
  154. }
  155. /**
  156. * ath9k_hw_9280_spur_mitigate - convert baseband spur frequency
  157. * @ah: atheros hardware structure
  158. * @chan:
  159. *
  160. * For single-chip solutions. Converts to baseband spur frequency given the
  161. * input channel frequency and compute register settings below.
  162. */
  163. void ath9k_hw_9280_spur_mitigate(struct ath_hw *ah, struct ath9k_channel *chan)
  164. {
  165. int bb_spur = AR_NO_SPUR;
  166. int freq;
  167. int bin, cur_bin;
  168. int bb_spur_off, spur_subchannel_sd;
  169. int spur_freq_sd;
  170. int spur_delta_phase;
  171. int denominator;
  172. int upper, lower, cur_vit_mask;
  173. int tmp, newVal;
  174. int i;
  175. int pilot_mask_reg[4] = { AR_PHY_TIMING7, AR_PHY_TIMING8,
  176. AR_PHY_PILOT_MASK_01_30, AR_PHY_PILOT_MASK_31_60
  177. };
  178. int chan_mask_reg[4] = { AR_PHY_TIMING9, AR_PHY_TIMING10,
  179. AR_PHY_CHANNEL_MASK_01_30, AR_PHY_CHANNEL_MASK_31_60
  180. };
  181. int inc[4] = { 0, 100, 0, 0 };
  182. struct chan_centers centers;
  183. int8_t mask_m[123];
  184. int8_t mask_p[123];
  185. int8_t mask_amt;
  186. int tmp_mask;
  187. int cur_bb_spur;
  188. bool is2GHz = IS_CHAN_2GHZ(chan);
  189. memset(&mask_m, 0, sizeof(int8_t) * 123);
  190. memset(&mask_p, 0, sizeof(int8_t) * 123);
  191. ath9k_hw_get_channel_centers(ah, chan, &centers);
  192. freq = centers.synth_center;
  193. ah->config.spurmode = SPUR_ENABLE_EEPROM;
  194. for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
  195. cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz);
  196. if (is2GHz)
  197. cur_bb_spur = (cur_bb_spur / 10) + AR_BASE_FREQ_2GHZ;
  198. else
  199. cur_bb_spur = (cur_bb_spur / 10) + AR_BASE_FREQ_5GHZ;
  200. if (AR_NO_SPUR == cur_bb_spur)
  201. break;
  202. cur_bb_spur = cur_bb_spur - freq;
  203. if (IS_CHAN_HT40(chan)) {
  204. if ((cur_bb_spur > -AR_SPUR_FEEQ_BOUND_HT40) &&
  205. (cur_bb_spur < AR_SPUR_FEEQ_BOUND_HT40)) {
  206. bb_spur = cur_bb_spur;
  207. break;
  208. }
  209. } else if ((cur_bb_spur > -AR_SPUR_FEEQ_BOUND_HT20) &&
  210. (cur_bb_spur < AR_SPUR_FEEQ_BOUND_HT20)) {
  211. bb_spur = cur_bb_spur;
  212. break;
  213. }
  214. }
  215. if (AR_NO_SPUR == bb_spur) {
  216. REG_CLR_BIT(ah, AR_PHY_FORCE_CLKEN_CCK,
  217. AR_PHY_FORCE_CLKEN_CCK_MRC_MUX);
  218. return;
  219. } else {
  220. REG_CLR_BIT(ah, AR_PHY_FORCE_CLKEN_CCK,
  221. AR_PHY_FORCE_CLKEN_CCK_MRC_MUX);
  222. }
  223. bin = bb_spur * 320;
  224. tmp = REG_READ(ah, AR_PHY_TIMING_CTRL4(0));
  225. newVal = tmp | (AR_PHY_TIMING_CTRL4_ENABLE_SPUR_RSSI |
  226. AR_PHY_TIMING_CTRL4_ENABLE_SPUR_FILTER |
  227. AR_PHY_TIMING_CTRL4_ENABLE_CHAN_MASK |
  228. AR_PHY_TIMING_CTRL4_ENABLE_PILOT_MASK);
  229. REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0), newVal);
  230. newVal = (AR_PHY_SPUR_REG_MASK_RATE_CNTL |
  231. AR_PHY_SPUR_REG_ENABLE_MASK_PPM |
  232. AR_PHY_SPUR_REG_MASK_RATE_SELECT |
  233. AR_PHY_SPUR_REG_ENABLE_VIT_SPUR_RSSI |
  234. SM(SPUR_RSSI_THRESH, AR_PHY_SPUR_REG_SPUR_RSSI_THRESH));
  235. REG_WRITE(ah, AR_PHY_SPUR_REG, newVal);
  236. if (IS_CHAN_HT40(chan)) {
  237. if (bb_spur < 0) {
  238. spur_subchannel_sd = 1;
  239. bb_spur_off = bb_spur + 10;
  240. } else {
  241. spur_subchannel_sd = 0;
  242. bb_spur_off = bb_spur - 10;
  243. }
  244. } else {
  245. spur_subchannel_sd = 0;
  246. bb_spur_off = bb_spur;
  247. }
  248. if (IS_CHAN_HT40(chan))
  249. spur_delta_phase =
  250. ((bb_spur * 262144) /
  251. 10) & AR_PHY_TIMING11_SPUR_DELTA_PHASE;
  252. else
  253. spur_delta_phase =
  254. ((bb_spur * 524288) /
  255. 10) & AR_PHY_TIMING11_SPUR_DELTA_PHASE;
  256. denominator = IS_CHAN_2GHZ(chan) ? 44 : 40;
  257. spur_freq_sd = ((bb_spur_off * 2048) / denominator) & 0x3ff;
  258. newVal = (AR_PHY_TIMING11_USE_SPUR_IN_AGC |
  259. SM(spur_freq_sd, AR_PHY_TIMING11_SPUR_FREQ_SD) |
  260. SM(spur_delta_phase, AR_PHY_TIMING11_SPUR_DELTA_PHASE));
  261. REG_WRITE(ah, AR_PHY_TIMING11, newVal);
  262. newVal = spur_subchannel_sd << AR_PHY_SFCORR_SPUR_SUBCHNL_SD_S;
  263. REG_WRITE(ah, AR_PHY_SFCORR_EXT, newVal);
  264. cur_bin = -6000;
  265. upper = bin + 100;
  266. lower = bin - 100;
  267. for (i = 0; i < 4; i++) {
  268. int pilot_mask = 0;
  269. int chan_mask = 0;
  270. int bp = 0;
  271. for (bp = 0; bp < 30; bp++) {
  272. if ((cur_bin > lower) && (cur_bin < upper)) {
  273. pilot_mask = pilot_mask | 0x1 << bp;
  274. chan_mask = chan_mask | 0x1 << bp;
  275. }
  276. cur_bin += 100;
  277. }
  278. cur_bin += inc[i];
  279. REG_WRITE(ah, pilot_mask_reg[i], pilot_mask);
  280. REG_WRITE(ah, chan_mask_reg[i], chan_mask);
  281. }
  282. cur_vit_mask = 6100;
  283. upper = bin + 120;
  284. lower = bin - 120;
  285. for (i = 0; i < 123; i++) {
  286. if ((cur_vit_mask > lower) && (cur_vit_mask < upper)) {
  287. /* workaround for gcc bug #37014 */
  288. volatile int tmp_v = abs(cur_vit_mask - bin);
  289. if (tmp_v < 75)
  290. mask_amt = 1;
  291. else
  292. mask_amt = 0;
  293. if (cur_vit_mask < 0)
  294. mask_m[abs(cur_vit_mask / 100)] = mask_amt;
  295. else
  296. mask_p[cur_vit_mask / 100] = mask_amt;
  297. }
  298. cur_vit_mask -= 100;
  299. }
  300. tmp_mask = (mask_m[46] << 30) | (mask_m[47] << 28)
  301. | (mask_m[48] << 26) | (mask_m[49] << 24)
  302. | (mask_m[50] << 22) | (mask_m[51] << 20)
  303. | (mask_m[52] << 18) | (mask_m[53] << 16)
  304. | (mask_m[54] << 14) | (mask_m[55] << 12)
  305. | (mask_m[56] << 10) | (mask_m[57] << 8)
  306. | (mask_m[58] << 6) | (mask_m[59] << 4)
  307. | (mask_m[60] << 2) | (mask_m[61] << 0);
  308. REG_WRITE(ah, AR_PHY_BIN_MASK_1, tmp_mask);
  309. REG_WRITE(ah, AR_PHY_VIT_MASK2_M_46_61, tmp_mask);
  310. tmp_mask = (mask_m[31] << 28)
  311. | (mask_m[32] << 26) | (mask_m[33] << 24)
  312. | (mask_m[34] << 22) | (mask_m[35] << 20)
  313. | (mask_m[36] << 18) | (mask_m[37] << 16)
  314. | (mask_m[48] << 14) | (mask_m[39] << 12)
  315. | (mask_m[40] << 10) | (mask_m[41] << 8)
  316. | (mask_m[42] << 6) | (mask_m[43] << 4)
  317. | (mask_m[44] << 2) | (mask_m[45] << 0);
  318. REG_WRITE(ah, AR_PHY_BIN_MASK_2, tmp_mask);
  319. REG_WRITE(ah, AR_PHY_MASK2_M_31_45, tmp_mask);
  320. tmp_mask = (mask_m[16] << 30) | (mask_m[16] << 28)
  321. | (mask_m[18] << 26) | (mask_m[18] << 24)
  322. | (mask_m[20] << 22) | (mask_m[20] << 20)
  323. | (mask_m[22] << 18) | (mask_m[22] << 16)
  324. | (mask_m[24] << 14) | (mask_m[24] << 12)
  325. | (mask_m[25] << 10) | (mask_m[26] << 8)
  326. | (mask_m[27] << 6) | (mask_m[28] << 4)
  327. | (mask_m[29] << 2) | (mask_m[30] << 0);
  328. REG_WRITE(ah, AR_PHY_BIN_MASK_3, tmp_mask);
  329. REG_WRITE(ah, AR_PHY_MASK2_M_16_30, tmp_mask);
  330. tmp_mask = (mask_m[0] << 30) | (mask_m[1] << 28)
  331. | (mask_m[2] << 26) | (mask_m[3] << 24)
  332. | (mask_m[4] << 22) | (mask_m[5] << 20)
  333. | (mask_m[6] << 18) | (mask_m[7] << 16)
  334. | (mask_m[8] << 14) | (mask_m[9] << 12)
  335. | (mask_m[10] << 10) | (mask_m[11] << 8)
  336. | (mask_m[12] << 6) | (mask_m[13] << 4)
  337. | (mask_m[14] << 2) | (mask_m[15] << 0);
  338. REG_WRITE(ah, AR_PHY_MASK_CTL, tmp_mask);
  339. REG_WRITE(ah, AR_PHY_MASK2_M_00_15, tmp_mask);
  340. tmp_mask = (mask_p[15] << 28)
  341. | (mask_p[14] << 26) | (mask_p[13] << 24)
  342. | (mask_p[12] << 22) | (mask_p[11] << 20)
  343. | (mask_p[10] << 18) | (mask_p[9] << 16)
  344. | (mask_p[8] << 14) | (mask_p[7] << 12)
  345. | (mask_p[6] << 10) | (mask_p[5] << 8)
  346. | (mask_p[4] << 6) | (mask_p[3] << 4)
  347. | (mask_p[2] << 2) | (mask_p[1] << 0);
  348. REG_WRITE(ah, AR_PHY_BIN_MASK2_1, tmp_mask);
  349. REG_WRITE(ah, AR_PHY_MASK2_P_15_01, tmp_mask);
  350. tmp_mask = (mask_p[30] << 28)
  351. | (mask_p[29] << 26) | (mask_p[28] << 24)
  352. | (mask_p[27] << 22) | (mask_p[26] << 20)
  353. | (mask_p[25] << 18) | (mask_p[24] << 16)
  354. | (mask_p[23] << 14) | (mask_p[22] << 12)
  355. | (mask_p[21] << 10) | (mask_p[20] << 8)
  356. | (mask_p[19] << 6) | (mask_p[18] << 4)
  357. | (mask_p[17] << 2) | (mask_p[16] << 0);
  358. REG_WRITE(ah, AR_PHY_BIN_MASK2_2, tmp_mask);
  359. REG_WRITE(ah, AR_PHY_MASK2_P_30_16, tmp_mask);
  360. tmp_mask = (mask_p[45] << 28)
  361. | (mask_p[44] << 26) | (mask_p[43] << 24)
  362. | (mask_p[42] << 22) | (mask_p[41] << 20)
  363. | (mask_p[40] << 18) | (mask_p[39] << 16)
  364. | (mask_p[38] << 14) | (mask_p[37] << 12)
  365. | (mask_p[36] << 10) | (mask_p[35] << 8)
  366. | (mask_p[34] << 6) | (mask_p[33] << 4)
  367. | (mask_p[32] << 2) | (mask_p[31] << 0);
  368. REG_WRITE(ah, AR_PHY_BIN_MASK2_3, tmp_mask);
  369. REG_WRITE(ah, AR_PHY_MASK2_P_45_31, tmp_mask);
  370. tmp_mask = (mask_p[61] << 30) | (mask_p[60] << 28)
  371. | (mask_p[59] << 26) | (mask_p[58] << 24)
  372. | (mask_p[57] << 22) | (mask_p[56] << 20)
  373. | (mask_p[55] << 18) | (mask_p[54] << 16)
  374. | (mask_p[53] << 14) | (mask_p[52] << 12)
  375. | (mask_p[51] << 10) | (mask_p[50] << 8)
  376. | (mask_p[49] << 6) | (mask_p[48] << 4)
  377. | (mask_p[47] << 2) | (mask_p[46] << 0);
  378. REG_WRITE(ah, AR_PHY_BIN_MASK2_4, tmp_mask);
  379. REG_WRITE(ah, AR_PHY_MASK2_P_61_45, tmp_mask);
  380. }
  381. /* All code below is for non single-chip solutions */
  382. /**
  383. * ath9k_phy_modify_rx_buffer() - perform analog swizzling of parameters
  384. * @rfbuf:
  385. * @reg32:
  386. * @numBits:
  387. * @firstBit:
  388. * @column:
  389. *
  390. * Performs analog "swizzling" of parameters into their location.
  391. * Used on external AR2133/AR5133 radios.
  392. */
  393. static void ath9k_phy_modify_rx_buffer(u32 *rfBuf, u32 reg32,
  394. u32 numBits, u32 firstBit,
  395. u32 column)
  396. {
  397. u32 tmp32, mask, arrayEntry, lastBit;
  398. int32_t bitPosition, bitsLeft;
  399. tmp32 = ath9k_hw_reverse_bits(reg32, numBits);
  400. arrayEntry = (firstBit - 1) / 8;
  401. bitPosition = (firstBit - 1) % 8;
  402. bitsLeft = numBits;
  403. while (bitsLeft > 0) {
  404. lastBit = (bitPosition + bitsLeft > 8) ?
  405. 8 : bitPosition + bitsLeft;
  406. mask = (((1 << lastBit) - 1) ^ ((1 << bitPosition) - 1)) <<
  407. (column * 8);
  408. rfBuf[arrayEntry] &= ~mask;
  409. rfBuf[arrayEntry] |= ((tmp32 << bitPosition) <<
  410. (column * 8)) & mask;
  411. bitsLeft -= 8 - bitPosition;
  412. tmp32 = tmp32 >> (8 - bitPosition);
  413. bitPosition = 0;
  414. arrayEntry++;
  415. }
  416. }
  417. /*
  418. * Fix on 2.4 GHz band for orientation sensitivity issue by increasing
  419. * rf_pwd_icsyndiv.
  420. *
  421. * Theoretical Rules:
  422. * if 2 GHz band
  423. * if forceBiasAuto
  424. * if synth_freq < 2412
  425. * bias = 0
  426. * else if 2412 <= synth_freq <= 2422
  427. * bias = 1
  428. * else // synth_freq > 2422
  429. * bias = 2
  430. * else if forceBias > 0
  431. * bias = forceBias & 7
  432. * else
  433. * no change, use value from ini file
  434. * else
  435. * no change, invalid band
  436. *
  437. * 1st Mod:
  438. * 2422 also uses value of 2
  439. * <approved>
  440. *
  441. * 2nd Mod:
  442. * Less than 2412 uses value of 0, 2412 and above uses value of 2
  443. */
  444. static void ath9k_hw_force_bias(struct ath_hw *ah, u16 synth_freq)
  445. {
  446. struct ath_common *common = ath9k_hw_common(ah);
  447. u32 tmp_reg;
  448. int reg_writes = 0;
  449. u32 new_bias = 0;
  450. if (!AR_SREV_5416(ah) || synth_freq >= 3000) {
  451. return;
  452. }
  453. BUG_ON(AR_SREV_9280_10_OR_LATER(ah));
  454. if (synth_freq < 2412)
  455. new_bias = 0;
  456. else if (synth_freq < 2422)
  457. new_bias = 1;
  458. else
  459. new_bias = 2;
  460. /* pre-reverse this field */
  461. tmp_reg = ath9k_hw_reverse_bits(new_bias, 3);
  462. ath_print(common, ATH_DBG_CONFIG,
  463. "Force rf_pwd_icsyndiv to %1d on %4d\n",
  464. new_bias, synth_freq);
  465. /* swizzle rf_pwd_icsyndiv */
  466. ath9k_phy_modify_rx_buffer(ah->analogBank6Data, tmp_reg, 3, 181, 3);
  467. /* write Bank 6 with new params */
  468. REG_WRITE_RF_ARRAY(&ah->iniBank6, ah->analogBank6Data, reg_writes);
  469. }
  470. /**
  471. * ath9k_hw_set_channel - tune to a channel on the external AR2133/AR5133 radios
  472. * @ah: atheros hardware stucture
  473. * @chan:
  474. *
  475. * For the external AR2133/AR5133 radios, takes the MHz channel value and set
  476. * the channel value. Assumes writes enabled to analog bus and bank6 register
  477. * cache in ah->analogBank6Data.
  478. */
  479. int ath9k_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan)
  480. {
  481. struct ath_common *common = ath9k_hw_common(ah);
  482. u32 channelSel = 0;
  483. u32 bModeSynth = 0;
  484. u32 aModeRefSel = 0;
  485. u32 reg32 = 0;
  486. u16 freq;
  487. struct chan_centers centers;
  488. ath9k_hw_get_channel_centers(ah, chan, &centers);
  489. freq = centers.synth_center;
  490. if (freq < 4800) {
  491. u32 txctl;
  492. if (((freq - 2192) % 5) == 0) {
  493. channelSel = ((freq - 672) * 2 - 3040) / 10;
  494. bModeSynth = 0;
  495. } else if (((freq - 2224) % 5) == 0) {
  496. channelSel = ((freq - 704) * 2 - 3040) / 10;
  497. bModeSynth = 1;
  498. } else {
  499. ath_print(common, ATH_DBG_FATAL,
  500. "Invalid channel %u MHz\n", freq);
  501. return -EINVAL;
  502. }
  503. channelSel = (channelSel << 2) & 0xff;
  504. channelSel = ath9k_hw_reverse_bits(channelSel, 8);
  505. txctl = REG_READ(ah, AR_PHY_CCK_TX_CTRL);
  506. if (freq == 2484) {
  507. REG_WRITE(ah, AR_PHY_CCK_TX_CTRL,
  508. txctl | AR_PHY_CCK_TX_CTRL_JAPAN);
  509. } else {
  510. REG_WRITE(ah, AR_PHY_CCK_TX_CTRL,
  511. txctl & ~AR_PHY_CCK_TX_CTRL_JAPAN);
  512. }
  513. } else if ((freq % 20) == 0 && freq >= 5120) {
  514. channelSel =
  515. ath9k_hw_reverse_bits(((freq - 4800) / 20 << 2), 8);
  516. aModeRefSel = ath9k_hw_reverse_bits(1, 2);
  517. } else if ((freq % 10) == 0) {
  518. channelSel =
  519. ath9k_hw_reverse_bits(((freq - 4800) / 10 << 1), 8);
  520. if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah))
  521. aModeRefSel = ath9k_hw_reverse_bits(2, 2);
  522. else
  523. aModeRefSel = ath9k_hw_reverse_bits(1, 2);
  524. } else if ((freq % 5) == 0) {
  525. channelSel = ath9k_hw_reverse_bits((freq - 4800) / 5, 8);
  526. aModeRefSel = ath9k_hw_reverse_bits(1, 2);
  527. } else {
  528. ath_print(common, ATH_DBG_FATAL,
  529. "Invalid channel %u MHz\n", freq);
  530. return -EINVAL;
  531. }
  532. ath9k_hw_force_bias(ah, freq);
  533. reg32 =
  534. (channelSel << 8) | (aModeRefSel << 2) | (bModeSynth << 1) |
  535. (1 << 5) | 0x1;
  536. REG_WRITE(ah, AR_PHY(0x37), reg32);
  537. ah->curchan = chan;
  538. ah->curchan_rad_index = -1;
  539. return 0;
  540. }
  541. /**
  542. * ath9k_hw_spur_mitigate - convert baseband spur frequency for external radios
  543. * @ah: atheros hardware structure
  544. * @chan:
  545. *
  546. * For non single-chip solutions. Converts to baseband spur frequency given the
  547. * input channel frequency and compute register settings below.
  548. */
  549. void ath9k_hw_spur_mitigate(struct ath_hw *ah, struct ath9k_channel *chan)
  550. {
  551. int bb_spur = AR_NO_SPUR;
  552. int bin, cur_bin;
  553. int spur_freq_sd;
  554. int spur_delta_phase;
  555. int denominator;
  556. int upper, lower, cur_vit_mask;
  557. int tmp, new;
  558. int i;
  559. int pilot_mask_reg[4] = { AR_PHY_TIMING7, AR_PHY_TIMING8,
  560. AR_PHY_PILOT_MASK_01_30, AR_PHY_PILOT_MASK_31_60
  561. };
  562. int chan_mask_reg[4] = { AR_PHY_TIMING9, AR_PHY_TIMING10,
  563. AR_PHY_CHANNEL_MASK_01_30, AR_PHY_CHANNEL_MASK_31_60
  564. };
  565. int inc[4] = { 0, 100, 0, 0 };
  566. int8_t mask_m[123];
  567. int8_t mask_p[123];
  568. int8_t mask_amt;
  569. int tmp_mask;
  570. int cur_bb_spur;
  571. bool is2GHz = IS_CHAN_2GHZ(chan);
  572. memset(&mask_m, 0, sizeof(int8_t) * 123);
  573. memset(&mask_p, 0, sizeof(int8_t) * 123);
  574. for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
  575. cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz);
  576. if (AR_NO_SPUR == cur_bb_spur)
  577. break;
  578. cur_bb_spur = cur_bb_spur - (chan->channel * 10);
  579. if ((cur_bb_spur > -95) && (cur_bb_spur < 95)) {
  580. bb_spur = cur_bb_spur;
  581. break;
  582. }
  583. }
  584. if (AR_NO_SPUR == bb_spur)
  585. return;
  586. bin = bb_spur * 32;
  587. tmp = REG_READ(ah, AR_PHY_TIMING_CTRL4(0));
  588. new = tmp | (AR_PHY_TIMING_CTRL4_ENABLE_SPUR_RSSI |
  589. AR_PHY_TIMING_CTRL4_ENABLE_SPUR_FILTER |
  590. AR_PHY_TIMING_CTRL4_ENABLE_CHAN_MASK |
  591. AR_PHY_TIMING_CTRL4_ENABLE_PILOT_MASK);
  592. REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0), new);
  593. new = (AR_PHY_SPUR_REG_MASK_RATE_CNTL |
  594. AR_PHY_SPUR_REG_ENABLE_MASK_PPM |
  595. AR_PHY_SPUR_REG_MASK_RATE_SELECT |
  596. AR_PHY_SPUR_REG_ENABLE_VIT_SPUR_RSSI |
  597. SM(SPUR_RSSI_THRESH, AR_PHY_SPUR_REG_SPUR_RSSI_THRESH));
  598. REG_WRITE(ah, AR_PHY_SPUR_REG, new);
  599. spur_delta_phase = ((bb_spur * 524288) / 100) &
  600. AR_PHY_TIMING11_SPUR_DELTA_PHASE;
  601. denominator = IS_CHAN_2GHZ(chan) ? 440 : 400;
  602. spur_freq_sd = ((bb_spur * 2048) / denominator) & 0x3ff;
  603. new = (AR_PHY_TIMING11_USE_SPUR_IN_AGC |
  604. SM(spur_freq_sd, AR_PHY_TIMING11_SPUR_FREQ_SD) |
  605. SM(spur_delta_phase, AR_PHY_TIMING11_SPUR_DELTA_PHASE));
  606. REG_WRITE(ah, AR_PHY_TIMING11, new);
  607. cur_bin = -6000;
  608. upper = bin + 100;
  609. lower = bin - 100;
  610. for (i = 0; i < 4; i++) {
  611. int pilot_mask = 0;
  612. int chan_mask = 0;
  613. int bp = 0;
  614. for (bp = 0; bp < 30; bp++) {
  615. if ((cur_bin > lower) && (cur_bin < upper)) {
  616. pilot_mask = pilot_mask | 0x1 << bp;
  617. chan_mask = chan_mask | 0x1 << bp;
  618. }
  619. cur_bin += 100;
  620. }
  621. cur_bin += inc[i];
  622. REG_WRITE(ah, pilot_mask_reg[i], pilot_mask);
  623. REG_WRITE(ah, chan_mask_reg[i], chan_mask);
  624. }
  625. cur_vit_mask = 6100;
  626. upper = bin + 120;
  627. lower = bin - 120;
  628. for (i = 0; i < 123; i++) {
  629. if ((cur_vit_mask > lower) && (cur_vit_mask < upper)) {
  630. /* workaround for gcc bug #37014 */
  631. volatile int tmp_v = abs(cur_vit_mask - bin);
  632. if (tmp_v < 75)
  633. mask_amt = 1;
  634. else
  635. mask_amt = 0;
  636. if (cur_vit_mask < 0)
  637. mask_m[abs(cur_vit_mask / 100)] = mask_amt;
  638. else
  639. mask_p[cur_vit_mask / 100] = mask_amt;
  640. }
  641. cur_vit_mask -= 100;
  642. }
  643. tmp_mask = (mask_m[46] << 30) | (mask_m[47] << 28)
  644. | (mask_m[48] << 26) | (mask_m[49] << 24)
  645. | (mask_m[50] << 22) | (mask_m[51] << 20)
  646. | (mask_m[52] << 18) | (mask_m[53] << 16)
  647. | (mask_m[54] << 14) | (mask_m[55] << 12)
  648. | (mask_m[56] << 10) | (mask_m[57] << 8)
  649. | (mask_m[58] << 6) | (mask_m[59] << 4)
  650. | (mask_m[60] << 2) | (mask_m[61] << 0);
  651. REG_WRITE(ah, AR_PHY_BIN_MASK_1, tmp_mask);
  652. REG_WRITE(ah, AR_PHY_VIT_MASK2_M_46_61, tmp_mask);
  653. tmp_mask = (mask_m[31] << 28)
  654. | (mask_m[32] << 26) | (mask_m[33] << 24)
  655. | (mask_m[34] << 22) | (mask_m[35] << 20)
  656. | (mask_m[36] << 18) | (mask_m[37] << 16)
  657. | (mask_m[48] << 14) | (mask_m[39] << 12)
  658. | (mask_m[40] << 10) | (mask_m[41] << 8)
  659. | (mask_m[42] << 6) | (mask_m[43] << 4)
  660. | (mask_m[44] << 2) | (mask_m[45] << 0);
  661. REG_WRITE(ah, AR_PHY_BIN_MASK_2, tmp_mask);
  662. REG_WRITE(ah, AR_PHY_MASK2_M_31_45, tmp_mask);
  663. tmp_mask = (mask_m[16] << 30) | (mask_m[16] << 28)
  664. | (mask_m[18] << 26) | (mask_m[18] << 24)
  665. | (mask_m[20] << 22) | (mask_m[20] << 20)
  666. | (mask_m[22] << 18) | (mask_m[22] << 16)
  667. | (mask_m[24] << 14) | (mask_m[24] << 12)
  668. | (mask_m[25] << 10) | (mask_m[26] << 8)
  669. | (mask_m[27] << 6) | (mask_m[28] << 4)
  670. | (mask_m[29] << 2) | (mask_m[30] << 0);
  671. REG_WRITE(ah, AR_PHY_BIN_MASK_3, tmp_mask);
  672. REG_WRITE(ah, AR_PHY_MASK2_M_16_30, tmp_mask);
  673. tmp_mask = (mask_m[0] << 30) | (mask_m[1] << 28)
  674. | (mask_m[2] << 26) | (mask_m[3] << 24)
  675. | (mask_m[4] << 22) | (mask_m[5] << 20)
  676. | (mask_m[6] << 18) | (mask_m[7] << 16)
  677. | (mask_m[8] << 14) | (mask_m[9] << 12)
  678. | (mask_m[10] << 10) | (mask_m[11] << 8)
  679. | (mask_m[12] << 6) | (mask_m[13] << 4)
  680. | (mask_m[14] << 2) | (mask_m[15] << 0);
  681. REG_WRITE(ah, AR_PHY_MASK_CTL, tmp_mask);
  682. REG_WRITE(ah, AR_PHY_MASK2_M_00_15, tmp_mask);
  683. tmp_mask = (mask_p[15] << 28)
  684. | (mask_p[14] << 26) | (mask_p[13] << 24)
  685. | (mask_p[12] << 22) | (mask_p[11] << 20)
  686. | (mask_p[10] << 18) | (mask_p[9] << 16)
  687. | (mask_p[8] << 14) | (mask_p[7] << 12)
  688. | (mask_p[6] << 10) | (mask_p[5] << 8)
  689. | (mask_p[4] << 6) | (mask_p[3] << 4)
  690. | (mask_p[2] << 2) | (mask_p[1] << 0);
  691. REG_WRITE(ah, AR_PHY_BIN_MASK2_1, tmp_mask);
  692. REG_WRITE(ah, AR_PHY_MASK2_P_15_01, tmp_mask);
  693. tmp_mask = (mask_p[30] << 28)
  694. | (mask_p[29] << 26) | (mask_p[28] << 24)
  695. | (mask_p[27] << 22) | (mask_p[26] << 20)
  696. | (mask_p[25] << 18) | (mask_p[24] << 16)
  697. | (mask_p[23] << 14) | (mask_p[22] << 12)
  698. | (mask_p[21] << 10) | (mask_p[20] << 8)
  699. | (mask_p[19] << 6) | (mask_p[18] << 4)
  700. | (mask_p[17] << 2) | (mask_p[16] << 0);
  701. REG_WRITE(ah, AR_PHY_BIN_MASK2_2, tmp_mask);
  702. REG_WRITE(ah, AR_PHY_MASK2_P_30_16, tmp_mask);
  703. tmp_mask = (mask_p[45] << 28)
  704. | (mask_p[44] << 26) | (mask_p[43] << 24)
  705. | (mask_p[42] << 22) | (mask_p[41] << 20)
  706. | (mask_p[40] << 18) | (mask_p[39] << 16)
  707. | (mask_p[38] << 14) | (mask_p[37] << 12)
  708. | (mask_p[36] << 10) | (mask_p[35] << 8)
  709. | (mask_p[34] << 6) | (mask_p[33] << 4)
  710. | (mask_p[32] << 2) | (mask_p[31] << 0);
  711. REG_WRITE(ah, AR_PHY_BIN_MASK2_3, tmp_mask);
  712. REG_WRITE(ah, AR_PHY_MASK2_P_45_31, tmp_mask);
  713. tmp_mask = (mask_p[61] << 30) | (mask_p[60] << 28)
  714. | (mask_p[59] << 26) | (mask_p[58] << 24)
  715. | (mask_p[57] << 22) | (mask_p[56] << 20)
  716. | (mask_p[55] << 18) | (mask_p[54] << 16)
  717. | (mask_p[53] << 14) | (mask_p[52] << 12)
  718. | (mask_p[51] << 10) | (mask_p[50] << 8)
  719. | (mask_p[49] << 6) | (mask_p[48] << 4)
  720. | (mask_p[47] << 2) | (mask_p[46] << 0);
  721. REG_WRITE(ah, AR_PHY_BIN_MASK2_4, tmp_mask);
  722. REG_WRITE(ah, AR_PHY_MASK2_P_61_45, tmp_mask);
  723. }
  724. /**
  725. * ath9k_hw_rf_alloc_ext_banks - allocates banks for external radio programming
  726. * @ah: atheros hardware structure
  727. *
  728. * Only required for older devices with external AR2133/AR5133 radios.
  729. */
  730. int ath9k_hw_rf_alloc_ext_banks(struct ath_hw *ah)
  731. {
  732. #define ATH_ALLOC_BANK(bank, size) do { \
  733. bank = kzalloc((sizeof(u32) * size), GFP_KERNEL); \
  734. if (!bank) { \
  735. ath_print(common, ATH_DBG_FATAL, \
  736. "Cannot allocate RF banks\n"); \
  737. return -ENOMEM; \
  738. } \
  739. } while (0);
  740. struct ath_common *common = ath9k_hw_common(ah);
  741. BUG_ON(AR_SREV_9280_10_OR_LATER(ah));
  742. ATH_ALLOC_BANK(ah->analogBank0Data, ah->iniBank0.ia_rows);
  743. ATH_ALLOC_BANK(ah->analogBank1Data, ah->iniBank1.ia_rows);
  744. ATH_ALLOC_BANK(ah->analogBank2Data, ah->iniBank2.ia_rows);
  745. ATH_ALLOC_BANK(ah->analogBank3Data, ah->iniBank3.ia_rows);
  746. ATH_ALLOC_BANK(ah->analogBank6Data, ah->iniBank6.ia_rows);
  747. ATH_ALLOC_BANK(ah->analogBank6TPCData, ah->iniBank6TPC.ia_rows);
  748. ATH_ALLOC_BANK(ah->analogBank7Data, ah->iniBank7.ia_rows);
  749. ATH_ALLOC_BANK(ah->addac5416_21,
  750. ah->iniAddac.ia_rows * ah->iniAddac.ia_columns);
  751. ATH_ALLOC_BANK(ah->bank6Temp, ah->iniBank6.ia_rows);
  752. return 0;
  753. #undef ATH_ALLOC_BANK
  754. }
  755. /**
  756. * ath9k_hw_rf_free_ext_banks - Free memory for analog bank scratch buffers
  757. * @ah: atheros hardware struture
  758. * For the external AR2133/AR5133 radios banks.
  759. */
  760. void
  761. ath9k_hw_rf_free_ext_banks(struct ath_hw *ah)
  762. {
  763. #define ATH_FREE_BANK(bank) do { \
  764. kfree(bank); \
  765. bank = NULL; \
  766. } while (0);
  767. BUG_ON(AR_SREV_9280_10_OR_LATER(ah));
  768. ATH_FREE_BANK(ah->analogBank0Data);
  769. ATH_FREE_BANK(ah->analogBank1Data);
  770. ATH_FREE_BANK(ah->analogBank2Data);
  771. ATH_FREE_BANK(ah->analogBank3Data);
  772. ATH_FREE_BANK(ah->analogBank6Data);
  773. ATH_FREE_BANK(ah->analogBank6TPCData);
  774. ATH_FREE_BANK(ah->analogBank7Data);
  775. ATH_FREE_BANK(ah->addac5416_21);
  776. ATH_FREE_BANK(ah->bank6Temp);
  777. #undef ATH_FREE_BANK
  778. }
  779. /* *
  780. * ath9k_hw_set_rf_regs - programs rf registers based on EEPROM
  781. * @ah: atheros hardware structure
  782. * @chan:
  783. * @modesIndex:
  784. *
  785. * Used for the external AR2133/AR5133 radios.
  786. *
  787. * Reads the EEPROM header info from the device structure and programs
  788. * all rf registers. This routine requires access to the analog
  789. * rf device. This is not required for single-chip devices.
  790. */
  791. bool ath9k_hw_set_rf_regs(struct ath_hw *ah, struct ath9k_channel *chan,
  792. u16 modesIndex)
  793. {
  794. u32 eepMinorRev;
  795. u32 ob5GHz = 0, db5GHz = 0;
  796. u32 ob2GHz = 0, db2GHz = 0;
  797. int regWrites = 0;
  798. /*
  799. * Software does not need to program bank data
  800. * for single chip devices, that is AR9280 or anything
  801. * after that.
  802. */
  803. if (AR_SREV_9280_10_OR_LATER(ah))
  804. return true;
  805. /* Setup rf parameters */
  806. eepMinorRev = ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV);
  807. /* Setup Bank 0 Write */
  808. RF_BANK_SETUP(ah->analogBank0Data, &ah->iniBank0, 1);
  809. /* Setup Bank 1 Write */
  810. RF_BANK_SETUP(ah->analogBank1Data, &ah->iniBank1, 1);
  811. /* Setup Bank 2 Write */
  812. RF_BANK_SETUP(ah->analogBank2Data, &ah->iniBank2, 1);
  813. /* Setup Bank 6 Write */
  814. RF_BANK_SETUP(ah->analogBank3Data, &ah->iniBank3,
  815. modesIndex);
  816. {
  817. int i;
  818. for (i = 0; i < ah->iniBank6TPC.ia_rows; i++) {
  819. ah->analogBank6Data[i] =
  820. INI_RA(&ah->iniBank6TPC, i, modesIndex);
  821. }
  822. }
  823. /* Only the 5 or 2 GHz OB/DB need to be set for a mode */
  824. if (eepMinorRev >= 2) {
  825. if (IS_CHAN_2GHZ(chan)) {
  826. ob2GHz = ah->eep_ops->get_eeprom(ah, EEP_OB_2);
  827. db2GHz = ah->eep_ops->get_eeprom(ah, EEP_DB_2);
  828. ath9k_phy_modify_rx_buffer(ah->analogBank6Data,
  829. ob2GHz, 3, 197, 0);
  830. ath9k_phy_modify_rx_buffer(ah->analogBank6Data,
  831. db2GHz, 3, 194, 0);
  832. } else {
  833. ob5GHz = ah->eep_ops->get_eeprom(ah, EEP_OB_5);
  834. db5GHz = ah->eep_ops->get_eeprom(ah, EEP_DB_5);
  835. ath9k_phy_modify_rx_buffer(ah->analogBank6Data,
  836. ob5GHz, 3, 203, 0);
  837. ath9k_phy_modify_rx_buffer(ah->analogBank6Data,
  838. db5GHz, 3, 200, 0);
  839. }
  840. }
  841. /* Setup Bank 7 Setup */
  842. RF_BANK_SETUP(ah->analogBank7Data, &ah->iniBank7, 1);
  843. /* Write Analog registers */
  844. REG_WRITE_RF_ARRAY(&ah->iniBank0, ah->analogBank0Data,
  845. regWrites);
  846. REG_WRITE_RF_ARRAY(&ah->iniBank1, ah->analogBank1Data,
  847. regWrites);
  848. REG_WRITE_RF_ARRAY(&ah->iniBank2, ah->analogBank2Data,
  849. regWrites);
  850. REG_WRITE_RF_ARRAY(&ah->iniBank3, ah->analogBank3Data,
  851. regWrites);
  852. REG_WRITE_RF_ARRAY(&ah->iniBank6TPC, ah->analogBank6Data,
  853. regWrites);
  854. REG_WRITE_RF_ARRAY(&ah->iniBank7, ah->analogBank7Data,
  855. regWrites);
  856. return true;
  857. }