radio_2059.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. /*
  2. Broadcom B43 wireless driver
  3. IEEE 802.11n 2059 radio device data tables
  4. Copyright (c) 2011 Rafał Miłecki <zajec5@gmail.com>
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; see the file COPYING. If not, write to
  15. the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
  16. Boston, MA 02110-1301, USA.
  17. */
  18. #include "b43.h"
  19. #include "radio_2059.h"
  20. /* Extracted from MMIO dump of 6.30.223.141 */
  21. static u16 r2059_phy_rev1_init[][2] = {
  22. { 0x051, 0x70 }, { 0x05a, 0x03 }, { 0x079, 0x01 }, { 0x082, 0x70 },
  23. { 0x083, 0x00 }, { 0x084, 0x70 }, { 0x09a, 0x7f }, { 0x0b6, 0x10 },
  24. { 0x188, 0x05 },
  25. };
  26. #define RADIOREGS(r00, r01, r02, r03, r04, r05, r06, r07, r08, r09, \
  27. r10, r11, r12, r13, r14, r15, r16, r17, r18, r19, \
  28. r20) \
  29. .radio_syn16 = r00, \
  30. .radio_syn17 = r01, \
  31. .radio_syn22 = r02, \
  32. .radio_syn25 = r03, \
  33. .radio_syn27 = r04, \
  34. .radio_syn28 = r05, \
  35. .radio_syn29 = r06, \
  36. .radio_syn2c = r07, \
  37. .radio_syn2d = r08, \
  38. .radio_syn37 = r09, \
  39. .radio_syn41 = r10, \
  40. .radio_syn43 = r11, \
  41. .radio_syn47 = r12, \
  42. .radio_rxtx4a = r13, \
  43. .radio_rxtx58 = r14, \
  44. .radio_rxtx5a = r15, \
  45. .radio_rxtx6a = r16, \
  46. .radio_rxtx6d = r17, \
  47. .radio_rxtx6e = r18, \
  48. .radio_rxtx92 = r19, \
  49. .radio_rxtx98 = r20
  50. #define PHYREGS(r0, r1, r2, r3, r4, r5) \
  51. .phy_regs.bw1 = r0, \
  52. .phy_regs.bw2 = r1, \
  53. .phy_regs.bw3 = r2, \
  54. .phy_regs.bw4 = r3, \
  55. .phy_regs.bw5 = r4, \
  56. .phy_regs.bw6 = r5
  57. /* Extracted from MMIO dump of 6.30.223.141
  58. * TODO: Values for channels 12 & 13 are outdated (from some old 5.x driver)!
  59. */
  60. static const struct b43_phy_ht_channeltab_e_radio2059 b43_phy_ht_channeltab_radio2059[] = {
  61. {
  62. .freq = 2412,
  63. RADIOREGS(0x48, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x6c,
  64. 0x09, 0x0f, 0x0a, 0x00, 0x0a, 0x00, 0x61, 0x73,
  65. 0x00, 0x00, 0x00, 0xd0, 0x00),
  66. PHYREGS(0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443),
  67. },
  68. {
  69. .freq = 2417,
  70. RADIOREGS(0x4b, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x71,
  71. 0x09, 0x0f, 0x0a, 0x00, 0x0a, 0x00, 0x61, 0x73,
  72. 0x00, 0x00, 0x00, 0xd0, 0x00),
  73. PHYREGS(0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441),
  74. },
  75. {
  76. .freq = 2422,
  77. RADIOREGS(0x4e, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x76,
  78. 0x09, 0x0f, 0x09, 0x00, 0x09, 0x00, 0x61, 0x73,
  79. 0x00, 0x00, 0x00, 0xd0, 0x00),
  80. PHYREGS(0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f),
  81. },
  82. {
  83. .freq = 2427,
  84. RADIOREGS(0x52, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x7b,
  85. 0x09, 0x0f, 0x09, 0x00, 0x09, 0x00, 0x61, 0x73,
  86. 0x00, 0x00, 0x00, 0xa0, 0x00),
  87. PHYREGS(0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d),
  88. },
  89. {
  90. .freq = 2432,
  91. RADIOREGS(0x55, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x80,
  92. 0x09, 0x0f, 0x08, 0x00, 0x08, 0x00, 0x61, 0x73,
  93. 0x00, 0x00, 0x00, 0xa0, 0x00),
  94. PHYREGS(0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a),
  95. },
  96. {
  97. .freq = 2437,
  98. RADIOREGS(0x58, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x85,
  99. 0x09, 0x0f, 0x08, 0x00, 0x08, 0x00, 0x61, 0x73,
  100. 0x00, 0x00, 0x00, 0xa0, 0x00),
  101. PHYREGS(0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438),
  102. },
  103. {
  104. .freq = 2442,
  105. RADIOREGS(0x5c, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8a,
  106. 0x09, 0x0f, 0x07, 0x00, 0x07, 0x00, 0x61, 0x73,
  107. 0x00, 0x00, 0x00, 0x80, 0x00),
  108. PHYREGS(0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436),
  109. },
  110. {
  111. .freq = 2447,
  112. RADIOREGS(0x5f, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8f,
  113. 0x09, 0x0f, 0x07, 0x00, 0x07, 0x00, 0x61, 0x73,
  114. 0x00, 0x00, 0x00, 0x80, 0x00),
  115. PHYREGS(0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434),
  116. },
  117. {
  118. .freq = 2452,
  119. RADIOREGS(0x62, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x94,
  120. 0x09, 0x0f, 0x07, 0x00, 0x07, 0x00, 0x61, 0x73,
  121. 0x00, 0x00, 0x00, 0x80, 0x00),
  122. PHYREGS(0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431),
  123. },
  124. {
  125. .freq = 2457,
  126. RADIOREGS(0x66, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x99,
  127. 0x09, 0x0f, 0x06, 0x00, 0x06, 0x00, 0x61, 0x73,
  128. 0x00, 0x00, 0x00, 0x60, 0x00),
  129. PHYREGS(0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f),
  130. },
  131. {
  132. .freq = 2462,
  133. RADIOREGS(0x69, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x9e,
  134. 0x09, 0x0f, 0x06, 0x00, 0x06, 0x00, 0x61, 0x73,
  135. 0x00, 0x00, 0x00, 0x60, 0x00),
  136. PHYREGS(0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d),
  137. },
  138. { .freq = 2467,
  139. RADIOREGS(0x6c, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xa3,
  140. 0x09, 0x0f, 0x05, 0x00, 0x05, 0x00, 0x61, 0x03,
  141. 0x00, 0x00, 0x00, 0xf0, 0x00),
  142. PHYREGS(0x03df, 0x03db, 0x03d7, 0x0422, 0x0427, 0x042b),
  143. },
  144. { .freq = 2472,
  145. RADIOREGS(0x70, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xa8,
  146. 0x09, 0x0f, 0x05, 0x00, 0x05, 0x00, 0x61, 0x03,
  147. 0x00, 0x00, 0x00, 0xf0, 0x00),
  148. PHYREGS(0x03e1, 0x03dd, 0x03d9, 0x0420, 0x0424, 0x0429),
  149. },
  150. {
  151. .freq = 5180,
  152. RADIOREGS(0xbe, 0x16, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x06,
  153. 0x02, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x00,
  154. 0x0f, 0x4f, 0xa3, 0x00, 0xfc),
  155. PHYREGS(0x081c, 0x0818, 0x0814, 0x01f9, 0x01fa, 0x01fb),
  156. },
  157. {
  158. .freq = 5200,
  159. RADIOREGS(0xc5, 0x16, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x08,
  160. 0x02, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x00,
  161. 0x0f, 0x4f, 0x93, 0x00, 0xfb),
  162. PHYREGS(0x0824, 0x0820, 0x081c, 0x01f7, 0x01f8, 0x01f9),
  163. },
  164. {
  165. .freq = 5220,
  166. RADIOREGS(0xcc, 0x16, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x0a,
  167. 0x02, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x00,
  168. 0x0f, 0x4f, 0x93, 0x00, 0xea),
  169. PHYREGS(0x082c, 0x0828, 0x0824, 0x01f5, 0x01f6, 0x01f7),
  170. },
  171. {
  172. .freq = 5240,
  173. RADIOREGS(0xd2, 0x16, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x0c,
  174. 0x02, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x00,
  175. 0x0f, 0x4f, 0x93, 0x00, 0xda),
  176. PHYREGS(0x0834, 0x0830, 0x082c, 0x01f3, 0x01f4, 0x01f5),
  177. },
  178. {
  179. .freq = 5260,
  180. RADIOREGS(0xd9, 0x16, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x0e,
  181. 0x02, 0x0b, 0x00, 0x0b, 0x00, 0x0b, 0x00, 0x00,
  182. 0x0f, 0x4f, 0x93, 0x00, 0xca),
  183. PHYREGS(0x083c, 0x0838, 0x0834, 0x01f1, 0x01f2, 0x01f3),
  184. },
  185. {
  186. .freq = 5280,
  187. RADIOREGS(0xe0, 0x16, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x10,
  188. 0x02, 0x0b, 0x00, 0x0b, 0x00, 0x0b, 0x00, 0x00,
  189. 0x0f, 0x4f, 0x93, 0x00, 0xb9),
  190. PHYREGS(0x0844, 0x0840, 0x083c, 0x01f0, 0x01f0, 0x01f1),
  191. },
  192. {
  193. .freq = 5300,
  194. RADIOREGS(0xe6, 0x16, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x12,
  195. 0x02, 0x0b, 0x00, 0x0b, 0x00, 0x0b, 0x00, 0x00,
  196. 0x0f, 0x4c, 0x83, 0x00, 0xb8),
  197. PHYREGS(0x084c, 0x0848, 0x0844, 0x01ee, 0x01ef, 0x01f0),
  198. },
  199. {
  200. .freq = 5320,
  201. RADIOREGS(0xed, 0x16, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x14,
  202. 0x02, 0x0b, 0x00, 0x0b, 0x00, 0x0b, 0x00, 0x00,
  203. 0x0f, 0x4c, 0x83, 0x00, 0xa8),
  204. PHYREGS(0x0854, 0x0850, 0x084c, 0x01ec, 0x01ed, 0x01ee),
  205. },
  206. {
  207. .freq = 5500,
  208. RADIOREGS(0x29, 0x17, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x26,
  209. 0x02, 0x09, 0x00, 0x09, 0x00, 0x09, 0x00, 0x00,
  210. 0x0a, 0x46, 0x43, 0x00, 0x75),
  211. PHYREGS(0x089c, 0x0898, 0x0894, 0x01dc, 0x01dd, 0x01dd),
  212. },
  213. {
  214. .freq = 5520,
  215. RADIOREGS(0x30, 0x17, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x28,
  216. 0x02, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00,
  217. 0x0a, 0x46, 0x43, 0x00, 0x75),
  218. PHYREGS(0x08a4, 0x08a0, 0x089c, 0x01da, 0x01db, 0x01dc),
  219. },
  220. {
  221. .freq = 5540,
  222. RADIOREGS(0x36, 0x17, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x2a,
  223. 0x02, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00,
  224. 0x0a, 0x46, 0x43, 0x00, 0x75),
  225. PHYREGS(0x08ac, 0x08a8, 0x08a4, 0x01d8, 0x01d9, 0x01da),
  226. },
  227. {
  228. .freq = 5560,
  229. RADIOREGS(0x3d, 0x17, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x2c,
  230. 0x02, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00,
  231. 0x0a, 0x46, 0x43, 0x00, 0x75),
  232. PHYREGS(0x08b4, 0x08b0, 0x08ac, 0x01d7, 0x01d7, 0x01d8),
  233. },
  234. {
  235. .freq = 5580,
  236. RADIOREGS(0x44, 0x17, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x2e,
  237. 0x02, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00,
  238. 0x0a, 0x46, 0x43, 0x00, 0x74),
  239. PHYREGS(0x08bc, 0x08b8, 0x08b4, 0x01d5, 0x01d6, 0x01d7),
  240. },
  241. {
  242. .freq = 5600,
  243. RADIOREGS(0x4a, 0x17, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x30,
  244. 0x02, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00,
  245. 0x09, 0x44, 0x23, 0x00, 0x54),
  246. PHYREGS(0x08c4, 0x08c0, 0x08bc, 0x01d3, 0x01d4, 0x01d5),
  247. },
  248. {
  249. .freq = 5620,
  250. RADIOREGS(0x51, 0x17, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x32,
  251. 0x02, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00,
  252. 0x09, 0x44, 0x23, 0x00, 0x54),
  253. PHYREGS(0x08cc, 0x08c8, 0x08c4, 0x01d2, 0x01d2, 0x01d3),
  254. },
  255. {
  256. .freq = 5640,
  257. RADIOREGS(0x58, 0x17, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x34,
  258. 0x02, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00,
  259. 0x09, 0x44, 0x23, 0x00, 0x43),
  260. PHYREGS(0x08d4, 0x08d0, 0x08cc, 0x01d0, 0x01d1, 0x01d2),
  261. },
  262. {
  263. .freq = 5660,
  264. RADIOREGS(0x5e, 0x17, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x36,
  265. 0x02, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00,
  266. 0x09, 0x43, 0x23, 0x00, 0x43),
  267. PHYREGS(0x08dc, 0x08d8, 0x08d4, 0x01ce, 0x01cf, 0x01d0),
  268. },
  269. {
  270. .freq = 5680,
  271. RADIOREGS(0x65, 0x17, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x38,
  272. 0x02, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00,
  273. 0x09, 0x42, 0x23, 0x00, 0x43),
  274. PHYREGS(0x08e4, 0x08e0, 0x08dc, 0x01cd, 0x01ce, 0x01ce),
  275. },
  276. {
  277. .freq = 5700,
  278. RADIOREGS(0x6c, 0x17, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x3a,
  279. 0x02, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00,
  280. 0x08, 0x42, 0x13, 0x00, 0x32),
  281. PHYREGS(0x08ec, 0x08e8, 0x08e4, 0x01cb, 0x01cc, 0x01cd),
  282. },
  283. {
  284. .freq = 5745,
  285. RADIOREGS(0x7b, 0x17, 0x20, 0x1f, 0x08, 0x08, 0x3f, 0x7d,
  286. 0x04, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00,
  287. 0x08, 0x42, 0x13, 0x00, 0x21),
  288. PHYREGS(0x08fe, 0x08fa, 0x08f6, 0x01c8, 0x01c8, 0x01c9),
  289. },
  290. {
  291. .freq = 5765,
  292. RADIOREGS(0x81, 0x17, 0x20, 0x1f, 0x08, 0x08, 0x3f, 0x81,
  293. 0x04, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00,
  294. 0x08, 0x42, 0x13, 0x00, 0x11),
  295. PHYREGS(0x0906, 0x0902, 0x08fe, 0x01c6, 0x01c7, 0x01c8),
  296. },
  297. {
  298. .freq = 5785,
  299. RADIOREGS(0x88, 0x17, 0x20, 0x1f, 0x08, 0x08, 0x3f, 0x85,
  300. 0x04, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x00,
  301. 0x08, 0x42, 0x13, 0x00, 0x00),
  302. PHYREGS(0x090e, 0x090a, 0x0906, 0x01c4, 0x01c5, 0x01c6),
  303. },
  304. {
  305. .freq = 5805,
  306. RADIOREGS(0x8f, 0x17, 0x20, 0x1f, 0x08, 0x08, 0x3f, 0x89,
  307. 0x04, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x00,
  308. 0x06, 0x41, 0x03, 0x00, 0x00),
  309. PHYREGS(0x0916, 0x0912, 0x090e, 0x01c3, 0x01c4, 0x01c4),
  310. },
  311. {
  312. .freq = 5825,
  313. RADIOREGS(0x95, 0x17, 0x20, 0x1f, 0x08, 0x08, 0x3f, 0x8d,
  314. 0x04, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x00,
  315. 0x06, 0x41, 0x03, 0x00, 0x00),
  316. PHYREGS(0x091e, 0x091a, 0x0916, 0x01c1, 0x01c2, 0x01c3),
  317. },
  318. };
  319. void r2059_upload_inittabs(struct b43_wldev *dev)
  320. {
  321. struct b43_phy *phy = &dev->phy;
  322. u16 *table = NULL;
  323. u16 size, i;
  324. switch (phy->rev) {
  325. case 1:
  326. table = r2059_phy_rev1_init[0];
  327. size = ARRAY_SIZE(r2059_phy_rev1_init);
  328. break;
  329. default:
  330. B43_WARN_ON(1);
  331. return;
  332. }
  333. for (i = 0; i < size; i++, table += 2)
  334. b43_radio_write(dev, R2059_ALL | table[0], table[1]);
  335. }
  336. const struct b43_phy_ht_channeltab_e_radio2059
  337. *b43_phy_ht_get_channeltab_e_r2059(struct b43_wldev *dev, u16 freq)
  338. {
  339. const struct b43_phy_ht_channeltab_e_radio2059 *e;
  340. unsigned int i;
  341. e = b43_phy_ht_channeltab_radio2059;
  342. for (i = 0; i < ARRAY_SIZE(b43_phy_ht_channeltab_radio2059); i++, e++) {
  343. if (e->freq == freq)
  344. return e;
  345. }
  346. return NULL;
  347. }