phy.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  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 "hw.h"
  41. /**
  42. * ath9k_hw_write_regs - ??
  43. *
  44. * @ah: atheros hardware structure
  45. * @modesIndex:
  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
  53. ath9k_hw_write_regs(struct ath_hw *ah, u32 modesIndex, u32 freqIndex,
  54. int regWrites)
  55. {
  56. REG_WRITE_ARRAY(&ah->iniBB_RfGain, freqIndex, regWrites);
  57. }
  58. /**
  59. * ath9k_hw_set_channel - tune to a channel on the external AR2133/AR5133 radios
  60. * @ah: atheros hardware stucture
  61. * @chan:
  62. *
  63. * For the external AR2133/AR5133 radios, takes the MHz channel value and set
  64. * the channel value. Assumes writes enabled to analog bus and bank6 register
  65. * cache in ah->analogBank6Data.
  66. */
  67. bool
  68. ath9k_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan)
  69. {
  70. struct ath_common *common = ath9k_hw_common(ah);
  71. u32 channelSel = 0;
  72. u32 bModeSynth = 0;
  73. u32 aModeRefSel = 0;
  74. u32 reg32 = 0;
  75. u16 freq;
  76. struct chan_centers centers;
  77. ath9k_hw_get_channel_centers(ah, chan, &centers);
  78. freq = centers.synth_center;
  79. if (freq < 4800) {
  80. u32 txctl;
  81. if (((freq - 2192) % 5) == 0) {
  82. channelSel = ((freq - 672) * 2 - 3040) / 10;
  83. bModeSynth = 0;
  84. } else if (((freq - 2224) % 5) == 0) {
  85. channelSel = ((freq - 704) * 2 - 3040) / 10;
  86. bModeSynth = 1;
  87. } else {
  88. ath_print(common, ATH_DBG_FATAL,
  89. "Invalid channel %u MHz\n", freq);
  90. return false;
  91. }
  92. channelSel = (channelSel << 2) & 0xff;
  93. channelSel = ath9k_hw_reverse_bits(channelSel, 8);
  94. txctl = REG_READ(ah, AR_PHY_CCK_TX_CTRL);
  95. if (freq == 2484) {
  96. REG_WRITE(ah, AR_PHY_CCK_TX_CTRL,
  97. txctl | AR_PHY_CCK_TX_CTRL_JAPAN);
  98. } else {
  99. REG_WRITE(ah, AR_PHY_CCK_TX_CTRL,
  100. txctl & ~AR_PHY_CCK_TX_CTRL_JAPAN);
  101. }
  102. } else if ((freq % 20) == 0 && freq >= 5120) {
  103. channelSel =
  104. ath9k_hw_reverse_bits(((freq - 4800) / 20 << 2), 8);
  105. aModeRefSel = ath9k_hw_reverse_bits(1, 2);
  106. } else if ((freq % 10) == 0) {
  107. channelSel =
  108. ath9k_hw_reverse_bits(((freq - 4800) / 10 << 1), 8);
  109. if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah))
  110. aModeRefSel = ath9k_hw_reverse_bits(2, 2);
  111. else
  112. aModeRefSel = ath9k_hw_reverse_bits(1, 2);
  113. } else if ((freq % 5) == 0) {
  114. channelSel = ath9k_hw_reverse_bits((freq - 4800) / 5, 8);
  115. aModeRefSel = ath9k_hw_reverse_bits(1, 2);
  116. } else {
  117. ath_print(common, ATH_DBG_FATAL,
  118. "Invalid channel %u MHz\n", freq);
  119. return false;
  120. }
  121. reg32 =
  122. (channelSel << 8) | (aModeRefSel << 2) | (bModeSynth << 1) |
  123. (1 << 5) | 0x1;
  124. REG_WRITE(ah, AR_PHY(0x37), reg32);
  125. ah->curchan = chan;
  126. ah->curchan_rad_index = -1;
  127. return true;
  128. }
  129. /**
  130. * ath9k_hw_ar9280_set_channel - set channel on single-chip device
  131. * @ah: atheros hardware structure
  132. * @chan:
  133. *
  134. * This is the function to change channel on single-chip devices, that is
  135. * all devices after ar9280.
  136. *
  137. * This function takes the channel value in MHz and sets
  138. * hardware channel value. Assumes writes have been enabled to analog bus.
  139. *
  140. * Actual Expression,
  141. *
  142. * For 2GHz channel,
  143. * Channel Frequency = (3/4) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^17)
  144. * (freq_ref = 40MHz)
  145. *
  146. * For 5GHz channel,
  147. * Channel Frequency = (3/2) * freq_ref * (chansel[8:0] + chanfrac[16:0]/2^10)
  148. * (freq_ref = 40MHz/(24>>amodeRefSel))
  149. */
  150. void ath9k_hw_ar9280_set_channel(struct ath_hw *ah,
  151. struct ath9k_channel *chan)
  152. {
  153. u16 bMode, fracMode, aModeRefSel = 0;
  154. u32 freq, ndiv, channelSel = 0, channelFrac = 0, reg32 = 0;
  155. struct chan_centers centers;
  156. u32 refDivA = 24;
  157. ath9k_hw_get_channel_centers(ah, chan, &centers);
  158. freq = centers.synth_center;
  159. reg32 = REG_READ(ah, AR_PHY_SYNTH_CONTROL);
  160. reg32 &= 0xc0000000;
  161. if (freq < 4800) { /* 2 GHz, fractional mode */
  162. u32 txctl;
  163. int regWrites = 0;
  164. bMode = 1;
  165. fracMode = 1;
  166. aModeRefSel = 0;
  167. channelSel = (freq * 0x10000) / 15;
  168. if (AR_SREV_9287_11_OR_LATER(ah)) {
  169. if (freq == 2484) {
  170. /* Enable channel spreading for channel 14 */
  171. REG_WRITE_ARRAY(&ah->iniCckfirJapan2484,
  172. 1, regWrites);
  173. } else {
  174. REG_WRITE_ARRAY(&ah->iniCckfirNormal,
  175. 1, regWrites);
  176. }
  177. } else {
  178. txctl = REG_READ(ah, AR_PHY_CCK_TX_CTRL);
  179. if (freq == 2484) {
  180. /* Enable channel spreading for channel 14 */
  181. REG_WRITE(ah, AR_PHY_CCK_TX_CTRL,
  182. txctl | AR_PHY_CCK_TX_CTRL_JAPAN);
  183. } else {
  184. REG_WRITE(ah, AR_PHY_CCK_TX_CTRL,
  185. txctl &~ AR_PHY_CCK_TX_CTRL_JAPAN);
  186. }
  187. }
  188. } else {
  189. bMode = 0;
  190. fracMode = 0;
  191. switch(ah->eep_ops->get_eeprom(ah, EEP_FRAC_N_5G)) {
  192. case 0:
  193. if ((freq % 20) == 0) {
  194. aModeRefSel = 3;
  195. } else if ((freq % 10) == 0) {
  196. aModeRefSel = 2;
  197. }
  198. if (aModeRefSel)
  199. break;
  200. case 1:
  201. default:
  202. aModeRefSel = 0;
  203. /*
  204. * Enable 2G (fractional) mode for channels
  205. * which are 5MHz spaced.
  206. */
  207. fracMode = 1;
  208. refDivA = 1;
  209. channelSel = (freq * 0x8000) / 15;
  210. /* RefDivA setting */
  211. REG_RMW_FIELD(ah, AR_AN_SYNTH9,
  212. AR_AN_SYNTH9_REFDIVA, refDivA);
  213. }
  214. if (!fracMode) {
  215. ndiv = (freq * (refDivA >> aModeRefSel)) / 60;
  216. channelSel = ndiv & 0x1ff;
  217. channelFrac = (ndiv & 0xfffffe00) * 2;
  218. channelSel = (channelSel << 17) | channelFrac;
  219. }
  220. }
  221. reg32 = reg32 |
  222. (bMode << 29) |
  223. (fracMode << 28) | (aModeRefSel << 26) | (channelSel);
  224. REG_WRITE(ah, AR_PHY_SYNTH_CONTROL, reg32);
  225. ah->curchan = chan;
  226. ah->curchan_rad_index = -1;
  227. }
  228. /**
  229. * ath9k_phy_modify_rx_buffer() - perform analog swizzling of parameters
  230. * @rfbuf:
  231. * @reg32:
  232. * @numBits:
  233. * @firstBit:
  234. * @column:
  235. *
  236. * Performs analog "swizzling" of parameters into their location.
  237. * Used on external AR2133/AR5133 radios.
  238. */
  239. static void
  240. ath9k_phy_modify_rx_buffer(u32 *rfBuf, u32 reg32,
  241. u32 numBits, u32 firstBit,
  242. u32 column)
  243. {
  244. u32 tmp32, mask, arrayEntry, lastBit;
  245. int32_t bitPosition, bitsLeft;
  246. tmp32 = ath9k_hw_reverse_bits(reg32, numBits);
  247. arrayEntry = (firstBit - 1) / 8;
  248. bitPosition = (firstBit - 1) % 8;
  249. bitsLeft = numBits;
  250. while (bitsLeft > 0) {
  251. lastBit = (bitPosition + bitsLeft > 8) ?
  252. 8 : bitPosition + bitsLeft;
  253. mask = (((1 << lastBit) - 1) ^ ((1 << bitPosition) - 1)) <<
  254. (column * 8);
  255. rfBuf[arrayEntry] &= ~mask;
  256. rfBuf[arrayEntry] |= ((tmp32 << bitPosition) <<
  257. (column * 8)) & mask;
  258. bitsLeft -= 8 - bitPosition;
  259. tmp32 = tmp32 >> (8 - bitPosition);
  260. bitPosition = 0;
  261. arrayEntry++;
  262. }
  263. }
  264. /* *
  265. * ath9k_hw_set_rf_regs - programs rf registers based on EEPROM
  266. * @ah: atheros hardware structure
  267. * @chan:
  268. * @modesIndex:
  269. *
  270. * Used for the external AR2133/AR5133 radios.
  271. *
  272. * Reads the EEPROM header info from the device structure and programs
  273. * all rf registers. This routine requires access to the analog
  274. * rf device. This is not required for single-chip devices.
  275. */
  276. bool
  277. ath9k_hw_set_rf_regs(struct ath_hw *ah, struct ath9k_channel *chan,
  278. u16 modesIndex)
  279. {
  280. u32 eepMinorRev;
  281. u32 ob5GHz = 0, db5GHz = 0;
  282. u32 ob2GHz = 0, db2GHz = 0;
  283. int regWrites = 0;
  284. /*
  285. * Software does not need to program bank data
  286. * for single chip devices, that is AR9280 or anything
  287. * after that.
  288. */
  289. if (AR_SREV_9280_10_OR_LATER(ah))
  290. return true;
  291. /* Setup rf parameters */
  292. eepMinorRev = ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV);
  293. /* Setup Bank 0 Write */
  294. RF_BANK_SETUP(ah->analogBank0Data, &ah->iniBank0, 1);
  295. /* Setup Bank 1 Write */
  296. RF_BANK_SETUP(ah->analogBank1Data, &ah->iniBank1, 1);
  297. /* Setup Bank 2 Write */
  298. RF_BANK_SETUP(ah->analogBank2Data, &ah->iniBank2, 1);
  299. /* Setup Bank 6 Write */
  300. RF_BANK_SETUP(ah->analogBank3Data, &ah->iniBank3,
  301. modesIndex);
  302. {
  303. int i;
  304. for (i = 0; i < ah->iniBank6TPC.ia_rows; i++) {
  305. ah->analogBank6Data[i] =
  306. INI_RA(&ah->iniBank6TPC, i, modesIndex);
  307. }
  308. }
  309. /* Only the 5 or 2 GHz OB/DB need to be set for a mode */
  310. if (eepMinorRev >= 2) {
  311. if (IS_CHAN_2GHZ(chan)) {
  312. ob2GHz = ah->eep_ops->get_eeprom(ah, EEP_OB_2);
  313. db2GHz = ah->eep_ops->get_eeprom(ah, EEP_DB_2);
  314. ath9k_phy_modify_rx_buffer(ah->analogBank6Data,
  315. ob2GHz, 3, 197, 0);
  316. ath9k_phy_modify_rx_buffer(ah->analogBank6Data,
  317. db2GHz, 3, 194, 0);
  318. } else {
  319. ob5GHz = ah->eep_ops->get_eeprom(ah, EEP_OB_5);
  320. db5GHz = ah->eep_ops->get_eeprom(ah, EEP_DB_5);
  321. ath9k_phy_modify_rx_buffer(ah->analogBank6Data,
  322. ob5GHz, 3, 203, 0);
  323. ath9k_phy_modify_rx_buffer(ah->analogBank6Data,
  324. db5GHz, 3, 200, 0);
  325. }
  326. }
  327. /* Setup Bank 7 Setup */
  328. RF_BANK_SETUP(ah->analogBank7Data, &ah->iniBank7, 1);
  329. /* Write Analog registers */
  330. REG_WRITE_RF_ARRAY(&ah->iniBank0, ah->analogBank0Data,
  331. regWrites);
  332. REG_WRITE_RF_ARRAY(&ah->iniBank1, ah->analogBank1Data,
  333. regWrites);
  334. REG_WRITE_RF_ARRAY(&ah->iniBank2, ah->analogBank2Data,
  335. regWrites);
  336. REG_WRITE_RF_ARRAY(&ah->iniBank3, ah->analogBank3Data,
  337. regWrites);
  338. REG_WRITE_RF_ARRAY(&ah->iniBank6TPC, ah->analogBank6Data,
  339. regWrites);
  340. REG_WRITE_RF_ARRAY(&ah->iniBank7, ah->analogBank7Data,
  341. regWrites);
  342. return true;
  343. }
  344. /**
  345. * ath9k_hw_rf_free_ext_banks - Free memory for analog bank scratch buffers
  346. * @ah: atheros hardware struture
  347. * For the external AR2133/AR5133 radios banks.
  348. */
  349. void
  350. ath9k_hw_rf_free_ext_banks(struct ath_hw *ah)
  351. {
  352. #define ATH_FREE_BANK(bank) do { \
  353. kfree(bank); \
  354. bank = NULL; \
  355. } while (0);
  356. BUG_ON(AR_SREV_9280_10_OR_LATER(ah));
  357. ATH_FREE_BANK(ah->analogBank0Data);
  358. ATH_FREE_BANK(ah->analogBank1Data);
  359. ATH_FREE_BANK(ah->analogBank2Data);
  360. ATH_FREE_BANK(ah->analogBank3Data);
  361. ATH_FREE_BANK(ah->analogBank6Data);
  362. ATH_FREE_BANK(ah->analogBank6TPCData);
  363. ATH_FREE_BANK(ah->analogBank7Data);
  364. ATH_FREE_BANK(ah->addac5416_21);
  365. ATH_FREE_BANK(ah->bank6Temp);
  366. #undef ATH_FREE_BANK
  367. }
  368. /**
  369. * ath9k_hw_rf_alloc_ext_banks - allocates banks for external radio programming
  370. * @ah: atheros hardware structure
  371. *
  372. * Only required for older devices with external AR2133/AR5133 radios.
  373. */
  374. int ath9k_hw_rf_alloc_ext_banks(struct ath_hw *ah)
  375. {
  376. #define ATH_ALLOC_BANK(bank, size) do { \
  377. bank = kzalloc((sizeof(u32) * size), GFP_KERNEL); \
  378. if (!bank) { \
  379. ath_print(common, ATH_DBG_FATAL, \
  380. "Cannot allocate RF banks\n"); \
  381. return -ENOMEM; \
  382. } \
  383. } while (0);
  384. struct ath_common *common = ath9k_hw_common(ah);
  385. BUG_ON(AR_SREV_9280_10_OR_LATER(ah));
  386. ATH_ALLOC_BANK(ah->analogBank0Data, ah->iniBank0.ia_rows);
  387. ATH_ALLOC_BANK(ah->analogBank1Data, ah->iniBank1.ia_rows);
  388. ATH_ALLOC_BANK(ah->analogBank2Data, ah->iniBank2.ia_rows);
  389. ATH_ALLOC_BANK(ah->analogBank3Data, ah->iniBank3.ia_rows);
  390. ATH_ALLOC_BANK(ah->analogBank6Data, ah->iniBank6.ia_rows);
  391. ATH_ALLOC_BANK(ah->analogBank6TPCData, ah->iniBank6TPC.ia_rows);
  392. ATH_ALLOC_BANK(ah->analogBank7Data, ah->iniBank7.ia_rows);
  393. ATH_ALLOC_BANK(ah->addac5416_21,
  394. ah->iniAddac.ia_rows * ah->iniAddac.ia_columns);
  395. ATH_ALLOC_BANK(ah->bank6Temp, ah->iniBank6.ia_rows);
  396. return 0;
  397. #undef ATH_ALLOC_BANK
  398. }
  399. /**
  400. * ath9k_hw_decrease_chain_power()
  401. *
  402. * @ah: atheros hardware structure
  403. * @chan:
  404. *
  405. * Only used on the AR5416 and AR5418 with the external AR2133/AR5133 radios.
  406. *
  407. * Sets a chain internal RF path to the lowest output power. Any
  408. * further writes to bank6 after this setting will override these
  409. * changes. Thus this function must be the last function in the
  410. * sequence to modify bank 6.
  411. *
  412. * This function must be called after ar5416SetRfRegs() which is
  413. * called from ath9k_hw_process_ini() due to swizzling of bank 6.
  414. * Depends on ah->analogBank6Data being initialized by
  415. * ath9k_hw_set_rf_regs()
  416. *
  417. * Additional additive reduction in power -
  418. * change chain's switch table so chain's tx state is actually the rx
  419. * state value. May produce different results in 2GHz/5GHz as well as
  420. * board to board but in general should be a reduction.
  421. *
  422. * Activated by #ifdef ALTER_SWITCH. Not tried yet. If so, must be
  423. * called after ah->eep_ops->set_board_values() due to RMW of
  424. * PHY_SWITCH_CHAIN_0.
  425. */
  426. void
  427. ath9k_hw_decrease_chain_power(struct ath_hw *ah, struct ath9k_channel *chan)
  428. {
  429. int i, regWrites = 0;
  430. u32 bank6SelMask;
  431. u32 *bank6Temp = ah->bank6Temp;
  432. switch (ah->config.diversity_control) {
  433. case ATH9K_ANT_FIXED_A:
  434. bank6SelMask =
  435. (ah->config.antenna_switch_swap & ANTSWAP_AB) ?
  436. REDUCE_CHAIN_0 : /* swapped, reduce chain 0 */
  437. REDUCE_CHAIN_1; /* normal, select chain 1/2 to reduce */
  438. break;
  439. case ATH9K_ANT_FIXED_B:
  440. bank6SelMask =
  441. (ah->config.antenna_switch_swap & ANTSWAP_AB) ?
  442. REDUCE_CHAIN_1 : /* swapped, reduce chain 1/2 */
  443. REDUCE_CHAIN_0; /* normal, select chain 0 to reduce */
  444. break;
  445. case ATH9K_ANT_VARIABLE:
  446. return; /* do not change anything */
  447. break;
  448. default:
  449. return; /* do not change anything */
  450. break;
  451. }
  452. for (i = 0; i < ah->iniBank6.ia_rows; i++)
  453. bank6Temp[i] = ah->analogBank6Data[i];
  454. /* Write Bank 5 to switch Bank 6 write to selected chain only */
  455. REG_WRITE(ah, AR_PHY_BASE + 0xD8, bank6SelMask);
  456. /*
  457. * Modify Bank6 selected chain to use lowest amplification.
  458. * Modifies the parameters to a value of 1.
  459. * Depends on existing bank 6 values to be cached in
  460. * ah->analogBank6Data
  461. */
  462. ath9k_phy_modify_rx_buffer(bank6Temp, 1, 1, 189, 0);
  463. ath9k_phy_modify_rx_buffer(bank6Temp, 1, 1, 190, 0);
  464. ath9k_phy_modify_rx_buffer(bank6Temp, 1, 1, 191, 0);
  465. ath9k_phy_modify_rx_buffer(bank6Temp, 1, 1, 192, 0);
  466. ath9k_phy_modify_rx_buffer(bank6Temp, 1, 1, 193, 0);
  467. ath9k_phy_modify_rx_buffer(bank6Temp, 1, 1, 222, 0);
  468. ath9k_phy_modify_rx_buffer(bank6Temp, 1, 1, 245, 0);
  469. ath9k_phy_modify_rx_buffer(bank6Temp, 1, 1, 246, 0);
  470. ath9k_phy_modify_rx_buffer(bank6Temp, 1, 1, 247, 0);
  471. REG_WRITE_RF_ARRAY(&ah->iniBank6, bank6Temp, regWrites);
  472. REG_WRITE(ah, AR_PHY_BASE + 0xD8, 0x00000053);
  473. #ifdef ALTER_SWITCH
  474. REG_WRITE(ah, PHY_SWITCH_CHAIN_0,
  475. (REG_READ(ah, PHY_SWITCH_CHAIN_0) & ~0x38)
  476. | ((REG_READ(ah, PHY_SWITCH_CHAIN_0) >> 3) & 0x38));
  477. #endif
  478. }