rf.c 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
  4. * All rights reserved.
  5. *
  6. * File: rf.c
  7. *
  8. * Purpose: rf function code
  9. *
  10. * Author: Jerry Chen
  11. *
  12. * Date: Feb. 19, 2004
  13. *
  14. * Functions:
  15. * IFRFbWriteEmbedded - Embedded write RF register via MAC
  16. *
  17. * Revision History:
  18. * RobertYu 2005
  19. * chester 2008
  20. *
  21. */
  22. #include "mac.h"
  23. #include "srom.h"
  24. #include "rf.h"
  25. #include "baseband.h"
  26. #define BY_AL2230_REG_LEN 23 /* 24bit */
  27. #define CB_AL2230_INIT_SEQ 15
  28. #define SWITCH_CHANNEL_DELAY_AL2230 200 /* us */
  29. #define AL2230_PWR_IDX_LEN 64
  30. #define BY_AL7230_REG_LEN 23 /* 24bit */
  31. #define CB_AL7230_INIT_SEQ 16
  32. #define SWITCH_CHANNEL_DELAY_AL7230 200 /* us */
  33. #define AL7230_PWR_IDX_LEN 64
  34. static const unsigned long dwAL2230InitTable[CB_AL2230_INIT_SEQ] = {
  35. 0x03F79000 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  36. 0x03333100 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  37. 0x01A00200 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  38. 0x00FFF300 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  39. 0x0005A400 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  40. 0x0F4DC500 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  41. 0x0805B600 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  42. 0x0146C700 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  43. 0x00068800 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  44. 0x0403B900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  45. 0x00DBBA00 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  46. 0x00099B00 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  47. 0x0BDFFC00 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  48. 0x00000D00 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  49. 0x00580F00 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW
  50. };
  51. static const unsigned long dwAL2230ChannelTable0[CB_MAX_CHANNEL] = {
  52. 0x03F79000 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 1, Tf = 2412MHz */
  53. 0x03F79000 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 2, Tf = 2417MHz */
  54. 0x03E79000 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 3, Tf = 2422MHz */
  55. 0x03E79000 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 4, Tf = 2427MHz */
  56. 0x03F7A000 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 5, Tf = 2432MHz */
  57. 0x03F7A000 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 6, Tf = 2437MHz */
  58. 0x03E7A000 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 7, Tf = 2442MHz */
  59. 0x03E7A000 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 8, Tf = 2447MHz */
  60. 0x03F7B000 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 9, Tf = 2452MHz */
  61. 0x03F7B000 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 10, Tf = 2457MHz */
  62. 0x03E7B000 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 11, Tf = 2462MHz */
  63. 0x03E7B000 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 12, Tf = 2467MHz */
  64. 0x03F7C000 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 13, Tf = 2472MHz */
  65. 0x03E7C000 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW /* channel = 14, Tf = 2412M */
  66. };
  67. static const unsigned long dwAL2230ChannelTable1[CB_MAX_CHANNEL] = {
  68. 0x03333100 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 1, Tf = 2412MHz */
  69. 0x0B333100 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 2, Tf = 2417MHz */
  70. 0x03333100 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 3, Tf = 2422MHz */
  71. 0x0B333100 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 4, Tf = 2427MHz */
  72. 0x03333100 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 5, Tf = 2432MHz */
  73. 0x0B333100 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 6, Tf = 2437MHz */
  74. 0x03333100 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 7, Tf = 2442MHz */
  75. 0x0B333100 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 8, Tf = 2447MHz */
  76. 0x03333100 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 9, Tf = 2452MHz */
  77. 0x0B333100 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 10, Tf = 2457MHz */
  78. 0x03333100 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 11, Tf = 2462MHz */
  79. 0x0B333100 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 12, Tf = 2467MHz */
  80. 0x03333100 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 13, Tf = 2472MHz */
  81. 0x06666100 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW /* channel = 14, Tf = 2412M */
  82. };
  83. static unsigned long dwAL2230PowerTable[AL2230_PWR_IDX_LEN] = {
  84. 0x04040900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  85. 0x04041900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  86. 0x04042900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  87. 0x04043900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  88. 0x04044900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  89. 0x04045900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  90. 0x04046900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  91. 0x04047900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  92. 0x04048900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  93. 0x04049900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  94. 0x0404A900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  95. 0x0404B900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  96. 0x0404C900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  97. 0x0404D900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  98. 0x0404E900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  99. 0x0404F900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  100. 0x04050900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  101. 0x04051900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  102. 0x04052900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  103. 0x04053900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  104. 0x04054900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  105. 0x04055900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  106. 0x04056900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  107. 0x04057900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  108. 0x04058900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  109. 0x04059900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  110. 0x0405A900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  111. 0x0405B900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  112. 0x0405C900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  113. 0x0405D900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  114. 0x0405E900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  115. 0x0405F900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  116. 0x04060900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  117. 0x04061900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  118. 0x04062900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  119. 0x04063900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  120. 0x04064900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  121. 0x04065900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  122. 0x04066900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  123. 0x04067900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  124. 0x04068900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  125. 0x04069900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  126. 0x0406A900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  127. 0x0406B900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  128. 0x0406C900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  129. 0x0406D900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  130. 0x0406E900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  131. 0x0406F900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  132. 0x04070900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  133. 0x04071900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  134. 0x04072900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  135. 0x04073900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  136. 0x04074900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  137. 0x04075900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  138. 0x04076900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  139. 0x04077900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  140. 0x04078900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  141. 0x04079900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  142. 0x0407A900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  143. 0x0407B900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  144. 0x0407C900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  145. 0x0407D900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  146. 0x0407E900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW,
  147. 0x0407F900 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW
  148. };
  149. /* 40MHz reference frequency
  150. * Need to Pull PLLON(PE3) low when writing channel registers through 3-wire.
  151. */
  152. static const unsigned long dwAL7230InitTable[CB_AL7230_INIT_SEQ] = {
  153. 0x00379000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Channel1 // Need modify for 11a */
  154. 0x13333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Channel1 // Need modify for 11a */
  155. 0x841FF200 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11a: 451FE2 */
  156. 0x3FDFA300 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11a: 5FDFA3 */
  157. 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* 11b/g // Need modify for 11a */
  158. /* RoberYu:20050113, Rev0.47 Regsiter Setting Guide */
  159. 0x802B5500 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11a: 8D1B55 */
  160. 0x56AF3600 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW,
  161. 0xCE020700 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11a: 860207 */
  162. 0x6EBC0800 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW,
  163. 0x221BB900 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW,
  164. 0xE0000A00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11a: E0600A */
  165. 0x08031B00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* init 0x080B1B00 => 0x080F1B00 for 3 wire control TxGain(D10) */
  166. /* RoberYu:20050113, Rev0.47 Regsiter Setting Guide */
  167. 0x000A3C00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11a: 00143C */
  168. 0xFFFFFD00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW,
  169. 0x00000E00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW,
  170. 0x1ABA8F00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW /* Need modify for 11a: 12BACF */
  171. };
  172. static const unsigned long dwAL7230InitTableAMode[CB_AL7230_INIT_SEQ] = {
  173. 0x0FF52000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Channel184 // Need modify for 11b/g */
  174. 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Channel184 // Need modify for 11b/g */
  175. 0x451FE200 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11b/g */
  176. 0x5FDFA300 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11b/g */
  177. 0x67F78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* 11a // Need modify for 11b/g */
  178. 0x853F5500 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11b/g, RoberYu:20050113 */
  179. 0x56AF3600 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW,
  180. 0xCE020700 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11b/g */
  181. 0x6EBC0800 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW,
  182. 0x221BB900 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW,
  183. 0xE0600A00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11b/g */
  184. 0x08031B00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* init 0x080B1B00 => 0x080F1B00 for 3 wire control TxGain(D10) */
  185. 0x00147C00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* Need modify for 11b/g */
  186. 0xFFFFFD00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW,
  187. 0x00000E00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW,
  188. 0x12BACF00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW /* Need modify for 11b/g */
  189. };
  190. static const unsigned long dwAL7230ChannelTable0[CB_MAX_CHANNEL] = {
  191. 0x00379000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 1, Tf = 2412MHz */
  192. 0x00379000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 2, Tf = 2417MHz */
  193. 0x00379000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 3, Tf = 2422MHz */
  194. 0x00379000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 4, Tf = 2427MHz */
  195. 0x0037A000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 5, Tf = 2432MHz */
  196. 0x0037A000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 6, Tf = 2437MHz */
  197. 0x0037A000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 7, Tf = 2442MHz */
  198. 0x0037A000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 8, Tf = 2447MHz //RobertYu: 20050218, update for APNode 0.49 */
  199. 0x0037B000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 9, Tf = 2452MHz //RobertYu: 20050218, update for APNode 0.49 */
  200. 0x0037B000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 10, Tf = 2457MHz //RobertYu: 20050218, update for APNode 0.49 */
  201. 0x0037B000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 11, Tf = 2462MHz //RobertYu: 20050218, update for APNode 0.49 */
  202. 0x0037B000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 12, Tf = 2467MHz //RobertYu: 20050218, update for APNode 0.49 */
  203. 0x0037C000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 13, Tf = 2472MHz //RobertYu: 20050218, update for APNode 0.49 */
  204. 0x0037C000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 14, Tf = 2484MHz */
  205. /* 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) */
  206. 0x0FF52000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 183, Tf = 4915MHz (15) */
  207. 0x0FF52000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 184, Tf = 4920MHz (16) */
  208. 0x0FF52000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 185, Tf = 4925MHz (17) */
  209. 0x0FF52000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 187, Tf = 4935MHz (18) */
  210. 0x0FF52000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 188, Tf = 4940MHz (19) */
  211. 0x0FF52000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 189, Tf = 4945MHz (20) */
  212. 0x0FF53000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 192, Tf = 4960MHz (21) */
  213. 0x0FF53000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 196, Tf = 4980MHz (22) */
  214. /* 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64,
  215. * 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56)
  216. */
  217. 0x0FF54000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 7, Tf = 5035MHz (23) */
  218. 0x0FF54000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 8, Tf = 5040MHz (24) */
  219. 0x0FF54000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 9, Tf = 5045MHz (25) */
  220. 0x0FF54000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 11, Tf = 5055MHz (26) */
  221. 0x0FF54000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 12, Tf = 5060MHz (27) */
  222. 0x0FF55000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 16, Tf = 5080MHz (28) */
  223. 0x0FF56000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 34, Tf = 5170MHz (29) */
  224. 0x0FF56000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 36, Tf = 5180MHz (30) */
  225. 0x0FF57000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 38, Tf = 5190MHz (31) //RobertYu: 20050218, update for APNode 0.49 */
  226. 0x0FF57000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 40, Tf = 5200MHz (32) */
  227. 0x0FF57000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 42, Tf = 5210MHz (33) */
  228. 0x0FF57000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 44, Tf = 5220MHz (34) */
  229. 0x0FF57000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 46, Tf = 5230MHz (35) */
  230. 0x0FF57000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 48, Tf = 5240MHz (36) */
  231. 0x0FF58000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 52, Tf = 5260MHz (37) */
  232. 0x0FF58000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 56, Tf = 5280MHz (38) */
  233. 0x0FF58000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 60, Tf = 5300MHz (39) */
  234. 0x0FF59000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 64, Tf = 5320MHz (40) */
  235. 0x0FF5C000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 100, Tf = 5500MHz (41) */
  236. 0x0FF5C000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 104, Tf = 5520MHz (42) */
  237. 0x0FF5C000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 108, Tf = 5540MHz (43) */
  238. 0x0FF5D000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 112, Tf = 5560MHz (44) */
  239. 0x0FF5D000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 116, Tf = 5580MHz (45) */
  240. 0x0FF5D000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 120, Tf = 5600MHz (46) */
  241. 0x0FF5E000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 124, Tf = 5620MHz (47) */
  242. 0x0FF5E000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 128, Tf = 5640MHz (48) */
  243. 0x0FF5E000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 132, Tf = 5660MHz (49) */
  244. 0x0FF5F000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 136, Tf = 5680MHz (50) */
  245. 0x0FF5F000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 140, Tf = 5700MHz (51) */
  246. 0x0FF60000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 149, Tf = 5745MHz (52) */
  247. 0x0FF60000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 153, Tf = 5765MHz (53) */
  248. 0x0FF60000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 157, Tf = 5785MHz (54) */
  249. 0x0FF61000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 161, Tf = 5805MHz (55) */
  250. 0x0FF61000 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW /* channel = 165, Tf = 5825MHz (56) */
  251. };
  252. static const unsigned long dwAL7230ChannelTable1[CB_MAX_CHANNEL] = {
  253. 0x13333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 1, Tf = 2412MHz */
  254. 0x1B333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 2, Tf = 2417MHz */
  255. 0x03333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 3, Tf = 2422MHz */
  256. 0x0B333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 4, Tf = 2427MHz */
  257. 0x13333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 5, Tf = 2432MHz */
  258. 0x1B333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 6, Tf = 2437MHz */
  259. 0x03333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 7, Tf = 2442MHz */
  260. 0x0B333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 8, Tf = 2447MHz */
  261. 0x13333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 9, Tf = 2452MHz */
  262. 0x1B333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 10, Tf = 2457MHz */
  263. 0x03333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 11, Tf = 2462MHz */
  264. 0x0B333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 12, Tf = 2467MHz */
  265. 0x13333100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 13, Tf = 2472MHz */
  266. 0x06666100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 14, Tf = 2484MHz */
  267. /* 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) */
  268. 0x1D555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 183, Tf = 4915MHz (15) */
  269. 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 184, Tf = 4920MHz (16) */
  270. 0x02AAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 185, Tf = 4925MHz (17) */
  271. 0x08000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 187, Tf = 4935MHz (18) */
  272. 0x0AAAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 188, Tf = 4940MHz (19) */
  273. 0x0D555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 189, Tf = 4945MHz (20) */
  274. 0x15555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 192, Tf = 4960MHz (21) */
  275. 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 196, Tf = 4980MHz (22) */
  276. /* 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64,
  277. * 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56)
  278. */
  279. 0x1D555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 7, Tf = 5035MHz (23) */
  280. 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 8, Tf = 5040MHz (24) */
  281. 0x02AAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 9, Tf = 5045MHz (25) */
  282. 0x08000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 11, Tf = 5055MHz (26) */
  283. 0x0AAAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 12, Tf = 5060MHz (27) */
  284. 0x15555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 16, Tf = 5080MHz (28) */
  285. 0x05555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 34, Tf = 5170MHz (29) */
  286. 0x0AAAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 36, Tf = 5180MHz (30) */
  287. 0x10000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 38, Tf = 5190MHz (31) */
  288. 0x15555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 40, Tf = 5200MHz (32) */
  289. 0x1AAAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 42, Tf = 5210MHz (33) */
  290. 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 44, Tf = 5220MHz (34) */
  291. 0x05555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 46, Tf = 5230MHz (35) */
  292. 0x0AAAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 48, Tf = 5240MHz (36) */
  293. 0x15555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 52, Tf = 5260MHz (37) */
  294. 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 56, Tf = 5280MHz (38) */
  295. 0x0AAAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 60, Tf = 5300MHz (39) */
  296. 0x15555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 64, Tf = 5320MHz (40) */
  297. 0x15555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 100, Tf = 5500MHz (41) */
  298. 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 104, Tf = 5520MHz (42) */
  299. 0x0AAAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 108, Tf = 5540MHz (43) */
  300. 0x15555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 112, Tf = 5560MHz (44) */
  301. 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 116, Tf = 5580MHz (45) */
  302. 0x0AAAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 120, Tf = 5600MHz (46) */
  303. 0x15555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 124, Tf = 5620MHz (47) */
  304. 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 128, Tf = 5640MHz (48) */
  305. 0x0AAAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 132, Tf = 5660MHz (49) */
  306. 0x15555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 136, Tf = 5680MHz (50) */
  307. 0x00000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 140, Tf = 5700MHz (51) */
  308. 0x18000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 149, Tf = 5745MHz (52) */
  309. 0x02AAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 153, Tf = 5765MHz (53) */
  310. 0x0D555100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 157, Tf = 5785MHz (54) */
  311. 0x18000100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 161, Tf = 5805MHz (55) */
  312. 0x02AAA100 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW /* channel = 165, Tf = 5825MHz (56) */
  313. };
  314. static const unsigned long dwAL7230ChannelTable2[CB_MAX_CHANNEL] = {
  315. 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 1, Tf = 2412MHz */
  316. 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 2, Tf = 2417MHz */
  317. 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 3, Tf = 2422MHz */
  318. 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 4, Tf = 2427MHz */
  319. 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 5, Tf = 2432MHz */
  320. 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 6, Tf = 2437MHz */
  321. 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 7, Tf = 2442MHz */
  322. 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 8, Tf = 2447MHz */
  323. 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 9, Tf = 2452MHz */
  324. 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 10, Tf = 2457MHz */
  325. 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 11, Tf = 2462MHz */
  326. 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 12, Tf = 2467MHz */
  327. 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 13, Tf = 2472MHz */
  328. 0x7FD78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 14, Tf = 2484MHz */
  329. /* 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) */
  330. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 183, Tf = 4915MHz (15) */
  331. 0x67D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 184, Tf = 4920MHz (16) */
  332. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 185, Tf = 4925MHz (17) */
  333. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 187, Tf = 4935MHz (18) */
  334. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 188, Tf = 4940MHz (19) */
  335. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 189, Tf = 4945MHz (20) */
  336. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 192, Tf = 4960MHz (21) */
  337. 0x67D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 196, Tf = 4980MHz (22) */
  338. /* 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64,
  339. * 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165 (Value 23 ~ 56)
  340. */
  341. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 7, Tf = 5035MHz (23) */
  342. 0x67D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 8, Tf = 5040MHz (24) */
  343. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 9, Tf = 5045MHz (25) */
  344. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 11, Tf = 5055MHz (26) */
  345. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 12, Tf = 5060MHz (27) */
  346. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 16, Tf = 5080MHz (28) */
  347. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 34, Tf = 5170MHz (29) */
  348. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 36, Tf = 5180MHz (30) */
  349. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 38, Tf = 5190MHz (31) */
  350. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 40, Tf = 5200MHz (32) */
  351. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 42, Tf = 5210MHz (33) */
  352. 0x67D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 44, Tf = 5220MHz (34) */
  353. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 46, Tf = 5230MHz (35) */
  354. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 48, Tf = 5240MHz (36) */
  355. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 52, Tf = 5260MHz (37) */
  356. 0x67D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 56, Tf = 5280MHz (38) */
  357. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 60, Tf = 5300MHz (39) */
  358. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 64, Tf = 5320MHz (40) */
  359. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 100, Tf = 5500MHz (41) */
  360. 0x67D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 104, Tf = 5520MHz (42) */
  361. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 108, Tf = 5540MHz (43) */
  362. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 112, Tf = 5560MHz (44) */
  363. 0x67D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 116, Tf = 5580MHz (45) */
  364. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 120, Tf = 5600MHz (46) */
  365. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 124, Tf = 5620MHz (47) */
  366. 0x67D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 128, Tf = 5640MHz (48) */
  367. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 132, Tf = 5660MHz (49) */
  368. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 136, Tf = 5680MHz (50) */
  369. 0x67D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 140, Tf = 5700MHz (51) */
  370. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 149, Tf = 5745MHz (52) */
  371. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 153, Tf = 5765MHz (53) */
  372. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 157, Tf = 5785MHz (54) */
  373. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW, /* channel = 161, Tf = 5805MHz (55) */
  374. 0x77D78400 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW /* channel = 165, Tf = 5825MHz (56) */
  375. };
  376. /*
  377. * Description: AIROHA IFRF chip init function
  378. *
  379. * Parameters:
  380. * In:
  381. * iobase - I/O base address
  382. * Out:
  383. * none
  384. *
  385. * Return Value: true if succeeded; false if failed.
  386. *
  387. */
  388. static bool s_bAL7230Init(struct vnt_private *priv)
  389. {
  390. void __iomem *iobase = priv->PortOffset;
  391. int ii;
  392. bool ret;
  393. ret = true;
  394. /* 3-wire control for normal mode */
  395. VNSvOutPortB(iobase + MAC_REG_SOFTPWRCTL, 0);
  396. MACvWordRegBitsOn(iobase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPECTI |
  397. SOFTPWRCTL_TXPEINV));
  398. BBvPowerSaveModeOFF(priv); /* RobertYu:20050106, have DC value for Calibration */
  399. for (ii = 0; ii < CB_AL7230_INIT_SEQ; ii++)
  400. ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[ii]);
  401. /* PLL On */
  402. MACvWordRegBitsOn(iobase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
  403. /* Calibration */
  404. MACvTimer0MicroSDelay(priv, 150);/* 150us */
  405. /* TXDCOC:active, RCK:disable */
  406. ret &= IFRFbWriteEmbedded(priv, (0x9ABA8F00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW));
  407. MACvTimer0MicroSDelay(priv, 30);/* 30us */
  408. /* TXDCOC:disable, RCK:active */
  409. ret &= IFRFbWriteEmbedded(priv, (0x3ABA8F00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW));
  410. MACvTimer0MicroSDelay(priv, 30);/* 30us */
  411. /* TXDCOC:disable, RCK:disable */
  412. ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[CB_AL7230_INIT_SEQ-1]);
  413. MACvWordRegBitsOn(iobase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE3 |
  414. SOFTPWRCTL_SWPE2 |
  415. SOFTPWRCTL_SWPECTI |
  416. SOFTPWRCTL_TXPEINV));
  417. BBvPowerSaveModeON(priv); /* RobertYu:20050106 */
  418. /* PE1: TX_ON, PE2: RX_ON, PE3: PLLON */
  419. /* 3-wire control for power saving mode */
  420. VNSvOutPortB(iobase + MAC_REG_PSPWRSIG, (PSSIG_WPE3 | PSSIG_WPE2)); /* 1100 0000 */
  421. return ret;
  422. }
  423. /* Need to Pull PLLON low when writing channel registers through
  424. * 3-wire interface
  425. */
  426. static bool s_bAL7230SelectChannel(struct vnt_private *priv, unsigned char byChannel)
  427. {
  428. void __iomem *iobase = priv->PortOffset;
  429. bool ret;
  430. ret = true;
  431. /* PLLON Off */
  432. MACvWordRegBitsOff(iobase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
  433. ret &= IFRFbWriteEmbedded(priv, dwAL7230ChannelTable0[byChannel - 1]);
  434. ret &= IFRFbWriteEmbedded(priv, dwAL7230ChannelTable1[byChannel - 1]);
  435. ret &= IFRFbWriteEmbedded(priv, dwAL7230ChannelTable2[byChannel - 1]);
  436. /* PLLOn On */
  437. MACvWordRegBitsOn(iobase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
  438. /* Set Channel[7] = 0 to tell H/W channel is changing now. */
  439. VNSvOutPortB(iobase + MAC_REG_CHANNEL, (byChannel & 0x7F));
  440. MACvTimer0MicroSDelay(priv, SWITCH_CHANNEL_DELAY_AL7230);
  441. /* Set Channel[7] = 1 to tell H/W channel change is done. */
  442. VNSvOutPortB(iobase + MAC_REG_CHANNEL, (byChannel | 0x80));
  443. return ret;
  444. }
  445. /*
  446. * Description: Write to IF/RF, by embedded programming
  447. *
  448. * Parameters:
  449. * In:
  450. * iobase - I/O base address
  451. * dwData - data to write
  452. * Out:
  453. * none
  454. *
  455. * Return Value: true if succeeded; false if failed.
  456. *
  457. */
  458. bool IFRFbWriteEmbedded(struct vnt_private *priv, unsigned long dwData)
  459. {
  460. void __iomem *iobase = priv->PortOffset;
  461. unsigned short ww;
  462. unsigned long dwValue;
  463. VNSvOutPortD(iobase + MAC_REG_IFREGCTL, dwData);
  464. /* W_MAX_TIMEOUT is the timeout period */
  465. for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
  466. VNSvInPortD(iobase + MAC_REG_IFREGCTL, &dwValue);
  467. if (dwValue & IFREGCTL_DONE)
  468. break;
  469. }
  470. if (ww == W_MAX_TIMEOUT)
  471. return false;
  472. return true;
  473. }
  474. /*
  475. * Description: AIROHA IFRF chip init function
  476. *
  477. * Parameters:
  478. * In:
  479. * iobase - I/O base address
  480. * Out:
  481. * none
  482. *
  483. * Return Value: true if succeeded; false if failed.
  484. *
  485. */
  486. static bool RFbAL2230Init(struct vnt_private *priv)
  487. {
  488. void __iomem *iobase = priv->PortOffset;
  489. int ii;
  490. bool ret;
  491. ret = true;
  492. /* 3-wire control for normal mode */
  493. VNSvOutPortB(iobase + MAC_REG_SOFTPWRCTL, 0);
  494. MACvWordRegBitsOn(iobase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPECTI |
  495. SOFTPWRCTL_TXPEINV));
  496. /* PLL Off */
  497. MACvWordRegBitsOff(iobase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
  498. /* patch abnormal AL2230 frequency output */
  499. IFRFbWriteEmbedded(priv, (0x07168700 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW));
  500. for (ii = 0; ii < CB_AL2230_INIT_SEQ; ii++)
  501. ret &= IFRFbWriteEmbedded(priv, dwAL2230InitTable[ii]);
  502. MACvTimer0MicroSDelay(priv, 30); /* delay 30 us */
  503. /* PLL On */
  504. MACvWordRegBitsOn(iobase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
  505. MACvTimer0MicroSDelay(priv, 150);/* 150us */
  506. ret &= IFRFbWriteEmbedded(priv, (0x00d80f00 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW));
  507. MACvTimer0MicroSDelay(priv, 30);/* 30us */
  508. ret &= IFRFbWriteEmbedded(priv, (0x00780f00 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW));
  509. MACvTimer0MicroSDelay(priv, 30);/* 30us */
  510. ret &= IFRFbWriteEmbedded(priv, dwAL2230InitTable[CB_AL2230_INIT_SEQ-1]);
  511. MACvWordRegBitsOn(iobase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE3 |
  512. SOFTPWRCTL_SWPE2 |
  513. SOFTPWRCTL_SWPECTI |
  514. SOFTPWRCTL_TXPEINV));
  515. /* 3-wire control for power saving mode */
  516. VNSvOutPortB(iobase + MAC_REG_PSPWRSIG, (PSSIG_WPE3 | PSSIG_WPE2)); /* 1100 0000 */
  517. return ret;
  518. }
  519. static bool RFbAL2230SelectChannel(struct vnt_private *priv, unsigned char byChannel)
  520. {
  521. void __iomem *iobase = priv->PortOffset;
  522. bool ret;
  523. ret = true;
  524. ret &= IFRFbWriteEmbedded(priv, dwAL2230ChannelTable0[byChannel - 1]);
  525. ret &= IFRFbWriteEmbedded(priv, dwAL2230ChannelTable1[byChannel - 1]);
  526. /* Set Channel[7] = 0 to tell H/W channel is changing now. */
  527. VNSvOutPortB(iobase + MAC_REG_CHANNEL, (byChannel & 0x7F));
  528. MACvTimer0MicroSDelay(priv, SWITCH_CHANNEL_DELAY_AL2230);
  529. /* Set Channel[7] = 1 to tell H/W channel change is done. */
  530. VNSvOutPortB(iobase + MAC_REG_CHANNEL, (byChannel | 0x80));
  531. return ret;
  532. }
  533. /*
  534. * Description: RF init function
  535. *
  536. * Parameters:
  537. * In:
  538. * byBBType
  539. * byRFType
  540. * Out:
  541. * none
  542. *
  543. * Return Value: true if succeeded; false if failed.
  544. *
  545. */
  546. bool RFbInit(struct vnt_private *priv)
  547. {
  548. bool ret = true;
  549. switch (priv->byRFType) {
  550. case RF_AIROHA:
  551. case RF_AL2230S:
  552. priv->byMaxPwrLevel = AL2230_PWR_IDX_LEN;
  553. ret = RFbAL2230Init(priv);
  554. break;
  555. case RF_AIROHA7230:
  556. priv->byMaxPwrLevel = AL7230_PWR_IDX_LEN;
  557. ret = s_bAL7230Init(priv);
  558. break;
  559. case RF_NOTHING:
  560. ret = true;
  561. break;
  562. default:
  563. ret = false;
  564. break;
  565. }
  566. return ret;
  567. }
  568. /*
  569. * Description: Select channel
  570. *
  571. * Parameters:
  572. * In:
  573. * byRFType
  574. * byChannel - Channel number
  575. * Out:
  576. * none
  577. *
  578. * Return Value: true if succeeded; false if failed.
  579. *
  580. */
  581. bool RFbSelectChannel(struct vnt_private *priv, unsigned char byRFType,
  582. u16 byChannel)
  583. {
  584. bool ret = true;
  585. switch (byRFType) {
  586. case RF_AIROHA:
  587. case RF_AL2230S:
  588. ret = RFbAL2230SelectChannel(priv, byChannel);
  589. break;
  590. /*{{ RobertYu: 20050104 */
  591. case RF_AIROHA7230:
  592. ret = s_bAL7230SelectChannel(priv, byChannel);
  593. break;
  594. /*}} RobertYu */
  595. case RF_NOTHING:
  596. ret = true;
  597. break;
  598. default:
  599. ret = false;
  600. break;
  601. }
  602. return ret;
  603. }
  604. /*
  605. * Description: Write WakeProgSyn
  606. *
  607. * Parameters:
  608. * In:
  609. * iobase - I/O base address
  610. * uChannel - channel number
  611. * bySleepCnt - SleepProgSyn count
  612. *
  613. * Return Value: None.
  614. *
  615. */
  616. bool RFvWriteWakeProgSyn(struct vnt_private *priv, unsigned char byRFType,
  617. u16 uChannel)
  618. {
  619. void __iomem *iobase = priv->PortOffset;
  620. int ii;
  621. unsigned char byInitCount = 0;
  622. unsigned char bySleepCount = 0;
  623. VNSvOutPortW(iobase + MAC_REG_MISCFFNDEX, 0);
  624. switch (byRFType) {
  625. case RF_AIROHA:
  626. case RF_AL2230S:
  627. if (uChannel > CB_MAX_CHANNEL_24G)
  628. return false;
  629. /* Init Reg + Channel Reg (2) */
  630. byInitCount = CB_AL2230_INIT_SEQ + 2;
  631. bySleepCount = 0;
  632. if (byInitCount > (MISCFIFO_SYNDATASIZE - bySleepCount))
  633. return false;
  634. for (ii = 0; ii < CB_AL2230_INIT_SEQ; ii++)
  635. MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL2230InitTable[ii]);
  636. MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL2230ChannelTable0[uChannel-1]);
  637. ii++;
  638. MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL2230ChannelTable1[uChannel-1]);
  639. break;
  640. /* Need to check, PLLON need to be low for channel setting */
  641. case RF_AIROHA7230:
  642. /* Init Reg + Channel Reg (3) */
  643. byInitCount = CB_AL7230_INIT_SEQ + 3;
  644. bySleepCount = 0;
  645. if (byInitCount > (MISCFIFO_SYNDATASIZE - bySleepCount))
  646. return false;
  647. if (uChannel <= CB_MAX_CHANNEL_24G) {
  648. for (ii = 0; ii < CB_AL7230_INIT_SEQ; ii++)
  649. MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230InitTable[ii]);
  650. } else {
  651. for (ii = 0; ii < CB_AL7230_INIT_SEQ; ii++)
  652. MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230InitTableAMode[ii]);
  653. }
  654. MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230ChannelTable0[uChannel-1]);
  655. ii++;
  656. MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230ChannelTable1[uChannel-1]);
  657. ii++;
  658. MACvSetMISCFifo(priv, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230ChannelTable2[uChannel-1]);
  659. break;
  660. case RF_NOTHING:
  661. return true;
  662. default:
  663. return false;
  664. }
  665. MACvSetMISCFifo(priv, MISCFIFO_SYNINFO_IDX, (unsigned long)MAKEWORD(bySleepCount, byInitCount));
  666. return true;
  667. }
  668. /*
  669. * Description: Set Tx power
  670. *
  671. * Parameters:
  672. * In:
  673. * iobase - I/O base address
  674. * dwRFPowerTable - RF Tx Power Setting
  675. * Out:
  676. * none
  677. *
  678. * Return Value: true if succeeded; false if failed.
  679. *
  680. */
  681. bool RFbSetPower(
  682. struct vnt_private *priv,
  683. unsigned int rate,
  684. u16 uCH
  685. )
  686. {
  687. bool ret = true;
  688. unsigned char byPwr = 0;
  689. unsigned char byDec = 0;
  690. if (priv->dwDiagRefCount != 0)
  691. return true;
  692. if ((uCH < 1) || (uCH > CB_MAX_CHANNEL))
  693. return false;
  694. switch (rate) {
  695. case RATE_1M:
  696. case RATE_2M:
  697. case RATE_5M:
  698. case RATE_11M:
  699. if (uCH > CB_MAX_CHANNEL_24G)
  700. return false;
  701. byPwr = priv->abyCCKPwrTbl[uCH];
  702. break;
  703. case RATE_6M:
  704. case RATE_9M:
  705. case RATE_12M:
  706. case RATE_18M:
  707. byPwr = priv->abyOFDMPwrTbl[uCH];
  708. if (priv->byRFType == RF_UW2452)
  709. byDec = byPwr + 14;
  710. else
  711. byDec = byPwr + 10;
  712. if (byDec >= priv->byMaxPwrLevel)
  713. byDec = priv->byMaxPwrLevel-1;
  714. byPwr = byDec;
  715. break;
  716. case RATE_24M:
  717. case RATE_36M:
  718. case RATE_48M:
  719. case RATE_54M:
  720. byPwr = priv->abyOFDMPwrTbl[uCH];
  721. break;
  722. }
  723. if (priv->byCurPwr == byPwr)
  724. return true;
  725. ret = RFbRawSetPower(priv, byPwr, rate);
  726. if (ret)
  727. priv->byCurPwr = byPwr;
  728. return ret;
  729. }
  730. /*
  731. * Description: Set Tx power
  732. *
  733. * Parameters:
  734. * In:
  735. * iobase - I/O base address
  736. * dwRFPowerTable - RF Tx Power Setting
  737. * Out:
  738. * none
  739. *
  740. * Return Value: true if succeeded; false if failed.
  741. *
  742. */
  743. bool RFbRawSetPower(
  744. struct vnt_private *priv,
  745. unsigned char byPwr,
  746. unsigned int rate
  747. )
  748. {
  749. bool ret = true;
  750. unsigned long dwMax7230Pwr = 0;
  751. if (byPwr >= priv->byMaxPwrLevel)
  752. return false;
  753. switch (priv->byRFType) {
  754. case RF_AIROHA:
  755. ret &= IFRFbWriteEmbedded(priv, dwAL2230PowerTable[byPwr]);
  756. if (rate <= RATE_11M)
  757. ret &= IFRFbWriteEmbedded(priv, 0x0001B400 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW);
  758. else
  759. ret &= IFRFbWriteEmbedded(priv, 0x0005A400 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW);
  760. break;
  761. case RF_AL2230S:
  762. ret &= IFRFbWriteEmbedded(priv, dwAL2230PowerTable[byPwr]);
  763. if (rate <= RATE_11M) {
  764. ret &= IFRFbWriteEmbedded(priv, 0x040C1400 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW);
  765. ret &= IFRFbWriteEmbedded(priv, 0x00299B00 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW);
  766. } else {
  767. ret &= IFRFbWriteEmbedded(priv, 0x0005A400 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW);
  768. ret &= IFRFbWriteEmbedded(priv, 0x00099B00 + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW);
  769. }
  770. break;
  771. case RF_AIROHA7230:
  772. /* 0x080F1B00 for 3 wire control TxGain(D10)
  773. * and 0x31 as TX Gain value
  774. */
  775. dwMax7230Pwr = 0x080C0B00 | ((byPwr) << 12) |
  776. (BY_AL7230_REG_LEN << 3) | IFREGCTL_REGW;
  777. ret &= IFRFbWriteEmbedded(priv, dwMax7230Pwr);
  778. break;
  779. default:
  780. break;
  781. }
  782. return ret;
  783. }
  784. /*
  785. *
  786. * Routine Description:
  787. * Translate RSSI to dBm
  788. *
  789. * Parameters:
  790. * In:
  791. * priv - The adapter to be translated
  792. * byCurrRSSI - RSSI to be translated
  793. * Out:
  794. * pdwdbm - Translated dbm number
  795. *
  796. * Return Value: none
  797. *
  798. */
  799. void
  800. RFvRSSITodBm(
  801. struct vnt_private *priv,
  802. unsigned char byCurrRSSI,
  803. long *pldBm
  804. )
  805. {
  806. unsigned char byIdx = (((byCurrRSSI & 0xC0) >> 6) & 0x03);
  807. long b = (byCurrRSSI & 0x3F);
  808. long a = 0;
  809. unsigned char abyAIROHARF[4] = {0, 18, 0, 40};
  810. switch (priv->byRFType) {
  811. case RF_AIROHA:
  812. case RF_AL2230S:
  813. case RF_AIROHA7230:
  814. a = abyAIROHARF[byIdx];
  815. break;
  816. default:
  817. break;
  818. }
  819. *pldBm = -1 * (a + b * 2);
  820. }
  821. /* Post processing for the 11b/g and 11a.
  822. * for save time on changing Reg2,3,5,7,10,12,15
  823. */
  824. bool RFbAL7230SelectChannelPostProcess(struct vnt_private *priv,
  825. u16 byOldChannel,
  826. u16 byNewChannel)
  827. {
  828. bool ret;
  829. ret = true;
  830. /* if change between 11 b/g and 11a need to update the following
  831. * register
  832. * Channel Index 1~14
  833. */
  834. if ((byOldChannel <= CB_MAX_CHANNEL_24G) && (byNewChannel > CB_MAX_CHANNEL_24G)) {
  835. /* Change from 2.4G to 5G [Reg] */
  836. ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[2]);
  837. ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[3]);
  838. ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[5]);
  839. ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[7]);
  840. ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[10]);
  841. ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[12]);
  842. ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTableAMode[15]);
  843. } else if ((byOldChannel > CB_MAX_CHANNEL_24G) && (byNewChannel <= CB_MAX_CHANNEL_24G)) {
  844. /* Change from 5G to 2.4G [Reg] */
  845. ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[2]);
  846. ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[3]);
  847. ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[5]);
  848. ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[7]);
  849. ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[10]);
  850. ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[12]);
  851. ret &= IFRFbWriteEmbedded(priv, dwAL7230InitTable[15]);
  852. }
  853. return ret;
  854. }