xref: /linux/drivers/net/wireless/broadcom/b43/radio_2057.c (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 
4   Broadcom B43 wireless driver
5   IEEE 802.11n 2057 radio device data tables
6 
7   Copyright (c) 2010 Rafał Miłecki <zajec5@gmail.com>
8 
9 
10 */
11 
12 #include "b43.h"
13 #include "radio_2057.h"
14 #include "phy_common.h"
15 
16 static u16 r2057_rev4_init[][2] = {
17 	{ 0x0E, 0x20 }, { 0x31, 0x00 }, { 0x32, 0x00 }, { 0x33, 0x00 },
18 	{ 0x35, 0x26 }, { 0x3C, 0xff }, { 0x3D, 0xff }, { 0x3E, 0xff },
19 	{ 0x3F, 0xff }, { 0x62, 0x33 }, { 0x8A, 0xf0 }, { 0x8B, 0x10 },
20 	{ 0x8C, 0xf0 }, { 0x91, 0x3f }, { 0x92, 0x36 }, { 0xA4, 0x8c },
21 	{ 0xA8, 0x55 }, { 0xAF, 0x01 }, { 0x10F, 0xf0 }, { 0x110, 0x10 },
22 	{ 0x111, 0xf0 }, { 0x116, 0x3f }, { 0x117, 0x36 }, { 0x129, 0x8c },
23 	{ 0x12D, 0x55 }, { 0x134, 0x01 }, { 0x15E, 0x00 }, { 0x15F, 0x00 },
24 	{ 0x160, 0x00 }, { 0x161, 0x00 }, { 0x162, 0x00 }, { 0x163, 0x00 },
25 	{ 0x169, 0x02 }, { 0x16A, 0x00 }, { 0x16B, 0x00 }, { 0x16C, 0x00 },
26 	{ 0x1A4, 0x00 }, { 0x1A5, 0x00 }, { 0x1A6, 0x00 }, { 0x1AA, 0x00 },
27 	{ 0x1AB, 0x00 }, { 0x1AC, 0x00 },
28 };
29 
30 static u16 r2057_rev5_init[][2] = {
31 	{ 0x00, 0x00 }, { 0x01, 0x57 }, { 0x02, 0x20 }, { 0x23, 0x6 },
32 	{ 0x31, 0x00 }, { 0x32, 0x00 }, { 0x33, 0x00 }, { 0x51, 0x70 },
33 	{ 0x59, 0x88 }, { 0x5C, 0x20 }, { 0x62, 0x33 }, { 0x63, 0x0f },
34 	{ 0x64, 0x0f }, { 0x81, 0x01 }, { 0x91, 0x3f }, { 0x92, 0x36 },
35 	{ 0xA1, 0x20 }, { 0xD6, 0x70 }, { 0xDE, 0x88 }, { 0xE1, 0x20 },
36 	{ 0xE8, 0x0f }, { 0xE9, 0x0f }, { 0x106, 0x01 }, { 0x116, 0x3f },
37 	{ 0x117, 0x36 }, { 0x126, 0x20 }, { 0x15E, 0x00 }, { 0x15F, 0x00 },
38 	{ 0x160, 0x00 }, { 0x161, 0x00 }, { 0x162, 0x00 }, { 0x163, 0x00 },
39 	{ 0x16A, 0x00 }, { 0x16B, 0x00 }, { 0x16C, 0x00 }, { 0x1A4, 0x00 },
40 	{ 0x1A5, 0x00 }, { 0x1A6, 0x00 }, { 0x1AA, 0x00 }, { 0x1AB, 0x00 },
41 	{ 0x1AC, 0x00 }, { 0x1B7, 0x0c }, { 0x1C1, 0x01 }, { 0x1C2, 0x80 },
42 };
43 
44 static u16 r2057_rev5a_init[][2] = {
45 	{ 0x00, 0x15 }, { 0x01, 0x57 }, { 0x02, 0x20 }, { 0x23, 0x6 },
46 	{ 0x31, 0x00 }, { 0x32, 0x00 }, { 0x33, 0x00 }, { 0x51, 0x70 },
47 	{ 0x59, 0x88 }, { 0x5C, 0x20 }, { 0x62, 0x33 }, { 0x63, 0x0f },
48 	{ 0x64, 0x0f }, { 0x81, 0x01 }, { 0x91, 0x3f }, { 0x92, 0x36 },
49 	{ 0xC9, 0x01 }, { 0xD6, 0x70 }, { 0xDE, 0x88 }, { 0xE1, 0x20 },
50 	{ 0xE8, 0x0f }, { 0xE9, 0x0f }, { 0x106, 0x01 }, { 0x116, 0x3f },
51 	{ 0x117, 0x36 }, { 0x126, 0x20 }, { 0x14E, 0x01 }, { 0x15E, 0x00 },
52 	{ 0x15F, 0x00 }, { 0x160, 0x00 }, { 0x161, 0x00 }, { 0x162, 0x00 },
53 	{ 0x163, 0x00 }, { 0x16A, 0x00 }, { 0x16B, 0x00 }, { 0x16C, 0x00 },
54 	{ 0x1A4, 0x00 }, { 0x1A5, 0x00 }, { 0x1A6, 0x00 }, { 0x1AA, 0x00 },
55 	{ 0x1AB, 0x00 }, { 0x1AC, 0x00 }, { 0x1B7, 0x0c }, { 0x1C1, 0x01 },
56 	{ 0x1C2, 0x80 },
57 };
58 
59 static u16 r2057_rev7_init[][2] = {
60 	{ 0x00, 0x00 }, { 0x01, 0x57 }, { 0x02, 0x20 }, { 0x31, 0x00 },
61 	{ 0x32, 0x00 }, { 0x33, 0x00 }, { 0x51, 0x70 }, { 0x59, 0x88 },
62 	{ 0x5C, 0x20 }, { 0x62, 0x33 }, { 0x63, 0x0f }, { 0x64, 0x13 },
63 	{ 0x66, 0xee }, { 0x6E, 0x58 }, { 0x75, 0x13 }, { 0x7B, 0x13 },
64 	{ 0x7C, 0x14 }, { 0x7D, 0xee }, { 0x81, 0x01 }, { 0x91, 0x3f },
65 	{ 0x92, 0x36 }, { 0xA1, 0x20 }, { 0xD6, 0x70 }, { 0xDE, 0x88 },
66 	{ 0xE1, 0x20 }, { 0xE8, 0x0f }, { 0xE9, 0x13 }, { 0xEB, 0xee },
67 	{ 0xF3, 0x58 }, { 0xFA, 0x13 }, { 0x100, 0x13 }, { 0x101, 0x14 },
68 	{ 0x102, 0xee }, { 0x106, 0x01 }, { 0x116, 0x3f }, { 0x117, 0x36 },
69 	{ 0x126, 0x20 }, { 0x15E, 0x00 }, { 0x15F, 0x00 }, { 0x160, 0x00 },
70 	{ 0x161, 0x00 }, { 0x162, 0x00 }, { 0x163, 0x00 }, { 0x16A, 0x00 },
71 	{ 0x16B, 0x00 }, { 0x16C, 0x00 }, { 0x1A4, 0x00 }, { 0x1A5, 0x00 },
72 	{ 0x1A6, 0x00 }, { 0x1AA, 0x00 }, { 0x1AB, 0x00 }, { 0x1AC, 0x00 },
73 	{ 0x1B7, 0x05 }, { 0x1C2, 0xa0 },
74 };
75 
76 /* TODO: Which devices should use it?
77 static u16 r2057_rev8_init[][2] = {
78 	{ 0x00, 0x08 }, { 0x01, 0x57 }, { 0x02, 0x20 }, { 0x31, 0x00 },
79 	{ 0x32, 0x00 }, { 0x33, 0x00 }, { 0x51, 0x70 }, { 0x59, 0x88 },
80 	{ 0x5C, 0x20 }, { 0x62, 0x33 }, { 0x63, 0x0f }, { 0x64, 0x0f },
81 	{ 0x6E, 0x58 }, { 0x75, 0x13 }, { 0x7B, 0x13 }, { 0x7C, 0x0f },
82 	{ 0x7D, 0xee }, { 0x81, 0x01 }, { 0x91, 0x3f }, { 0x92, 0x36 },
83 	{ 0xA1, 0x20 }, { 0xC9, 0x01 }, { 0xD6, 0x70 }, { 0xDE, 0x88 },
84 	{ 0xE1, 0x20 }, { 0xE8, 0x0f }, { 0xE9, 0x0f }, { 0xF3, 0x58 },
85 	{ 0xFA, 0x13 }, { 0x100, 0x13 }, { 0x101, 0x0f }, { 0x102, 0xee },
86 	{ 0x106, 0x01 }, { 0x116, 0x3f }, { 0x117, 0x36 }, { 0x126, 0x20 },
87 	{ 0x14E, 0x01 }, { 0x15E, 0x00 }, { 0x15F, 0x00 }, { 0x160, 0x00 },
88 	{ 0x161, 0x00 }, { 0x162, 0x00 }, { 0x163, 0x00 }, { 0x16A, 0x00 },
89 	{ 0x16B, 0x00 }, { 0x16C, 0x00 }, { 0x1A4, 0x00 }, { 0x1A5, 0x00 },
90 	{ 0x1A6, 0x00 }, { 0x1AA, 0x00 }, { 0x1AB, 0x00 }, { 0x1AC, 0x00 },
91 	{ 0x1B7, 0x05 }, { 0x1C2, 0xa0 },
92 };
93 */
94 
95 /* Extracted from MMIO dump of 6.30.223.141 */
96 static u16 r2057_rev9_init[][2] = {
97 	{ 0x27, 0x1f }, { 0x28, 0x0a }, { 0x29, 0x2f }, { 0x42, 0x1f },
98 	{ 0x48, 0x3f }, { 0x5c, 0x41 }, { 0x63, 0x14 }, { 0x64, 0x12 },
99 	{ 0x66, 0xff }, { 0x74, 0xa3 }, { 0x7b, 0x14 }, { 0x7c, 0x14 },
100 	{ 0x7d, 0xee }, { 0x86, 0xc0 }, { 0xc4, 0x10 }, { 0xc9, 0x01 },
101 	{ 0xe1, 0x41 }, { 0xe8, 0x14 }, { 0xe9, 0x12 }, { 0xeb, 0xff },
102 	{ 0xf5, 0x0a }, { 0xf8, 0x09 }, { 0xf9, 0xa3 }, { 0x100, 0x14 },
103 	{ 0x101, 0x10 }, { 0x102, 0xee }, { 0x10b, 0xc0 }, { 0x149, 0x10 },
104 	{ 0x14e, 0x01 }, { 0x1b7, 0x05 }, { 0x1c2, 0xa0 },
105 };
106 
107 /* Extracted from MMIO dump of 6.30.223.248 */
108 static u16 r2057_rev14_init[][2] = {
109 	{ 0x011, 0xfc }, { 0x030, 0x24 }, { 0x040, 0x1c }, { 0x082, 0x08 },
110 	{ 0x0b4, 0x44 }, { 0x0c8, 0x01 }, { 0x0c9, 0x01 }, { 0x107, 0x08 },
111 	{ 0x14d, 0x01 }, { 0x14e, 0x01 }, { 0x1af, 0x40 }, { 0x1b0, 0x40 },
112 	{ 0x1cc, 0x01 }, { 0x1cf, 0x10 }, { 0x1d0, 0x0f }, { 0x1d3, 0x10 },
113 	{ 0x1d4, 0x0f },
114 };
115 
116 #define RADIOREGS7(r00, r01, r02, r03, r04, r05, r06, r07, r08, r09, \
117 		   r10, r11, r12, r13, r14, r15, r16, r17, r18, r19, \
118 		   r20, r21, r22, r23, r24, r25, r26, r27) \
119 	.radio_vcocal_countval0			= r00,	\
120 	.radio_vcocal_countval1			= r01,	\
121 	.radio_rfpll_refmaster_sparextalsize	= r02,	\
122 	.radio_rfpll_loopfilter_r1		= r03,	\
123 	.radio_rfpll_loopfilter_c2		= r04,	\
124 	.radio_rfpll_loopfilter_c1		= r05,	\
125 	.radio_cp_kpd_idac			= r06,	\
126 	.radio_rfpll_mmd0			= r07,	\
127 	.radio_rfpll_mmd1			= r08,	\
128 	.radio_vcobuf_tune			= r09,	\
129 	.radio_logen_mx2g_tune			= r10,	\
130 	.radio_logen_mx5g_tune			= r11,	\
131 	.radio_logen_indbuf2g_tune		= r12,	\
132 	.radio_logen_indbuf5g_tune		= r13,	\
133 	.radio_txmix2g_tune_boost_pu_core0	= r14,	\
134 	.radio_pad2g_tune_pus_core0		= r15,	\
135 	.radio_pga_boost_tune_core0		= r16,	\
136 	.radio_txmix5g_boost_tune_core0		= r17,	\
137 	.radio_pad5g_tune_misc_pus_core0	= r18,	\
138 	.radio_lna2g_tune_core0			= r19,	\
139 	.radio_lna5g_tune_core0			= r20,	\
140 	.radio_txmix2g_tune_boost_pu_core1	= r21,	\
141 	.radio_pad2g_tune_pus_core1		= r22,	\
142 	.radio_pga_boost_tune_core1		= r23,	\
143 	.radio_txmix5g_boost_tune_core1		= r24,	\
144 	.radio_pad5g_tune_misc_pus_core1	= r25,	\
145 	.radio_lna2g_tune_core1			= r26,	\
146 	.radio_lna5g_tune_core1			= r27
147 
148 #define RADIOREGS7_2G(r00, r01, r02, r03, r04, r05, r06, r07, r08, r09, \
149 		      r10, r11, r12, r13, r14, r15, r16, r17) \
150 	.radio_vcocal_countval0			= r00,	\
151 	.radio_vcocal_countval1			= r01,	\
152 	.radio_rfpll_refmaster_sparextalsize	= r02,	\
153 	.radio_rfpll_loopfilter_r1		= r03,	\
154 	.radio_rfpll_loopfilter_c2		= r04,	\
155 	.radio_rfpll_loopfilter_c1		= r05,	\
156 	.radio_cp_kpd_idac			= r06,	\
157 	.radio_rfpll_mmd0			= r07,	\
158 	.radio_rfpll_mmd1			= r08,	\
159 	.radio_vcobuf_tune			= r09,	\
160 	.radio_logen_mx2g_tune			= r10,	\
161 	.radio_logen_indbuf2g_tune		= r11,	\
162 	.radio_txmix2g_tune_boost_pu_core0	= r12,	\
163 	.radio_pad2g_tune_pus_core0		= r13,	\
164 	.radio_lna2g_tune_core0			= r14,	\
165 	.radio_txmix2g_tune_boost_pu_core1	= r15,	\
166 	.radio_pad2g_tune_pus_core1		= r16,	\
167 	.radio_lna2g_tune_core1			= r17
168 
169 #define PHYREGS(r0, r1, r2, r3, r4, r5)	\
170 	.phy_regs.phy_bw1a	= r0,	\
171 	.phy_regs.phy_bw2	= r1,	\
172 	.phy_regs.phy_bw3	= r2,	\
173 	.phy_regs.phy_bw4	= r3,	\
174 	.phy_regs.phy_bw5	= r4,	\
175 	.phy_regs.phy_bw6	= r5
176 
177 /* Copied from brcmsmac (5.75.11): chan_info_nphyrev8_2057_rev5 */
178 static const struct b43_nphy_chantabent_rev7_2g b43_nphy_chantab_phy_rev8_radio_rev5[] = {
179 	{
180 		.freq			= 2412,
181 		RADIOREGS7_2G(0x48, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x6c,
182 			      0x09, 0x0d, 0x08, 0x0e, 0x61, 0x03, 0xff, 0x61,
183 			      0x03, 0xff),
184 		PHYREGS(0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443),
185 	},
186 	{
187 		.freq			= 2417,
188 		RADIOREGS7_2G(0x4b, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x71,
189 			      0x09, 0x0d, 0x08, 0x0e, 0x61, 0x03, 0xff, 0x61,
190 			      0x03, 0xff),
191 		PHYREGS(0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441),
192 	},
193 	{
194 		.freq			= 2422,
195 		RADIOREGS7_2G(0x4e, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x76,
196 			      0x09, 0x0d, 0x08, 0x0e, 0x61, 0x03, 0xef, 0x61,
197 			      0x03, 0xef),
198 		PHYREGS(0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f),
199 	},
200 	{
201 		.freq			= 2427,
202 		RADIOREGS7_2G(0x52, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x7b,
203 			      0x09, 0x0c, 0x08, 0x0e, 0x61, 0x03, 0xdf, 0x61,
204 			      0x03, 0xdf),
205 		PHYREGS(0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d),
206 	},
207 	{
208 		.freq			= 2432,
209 		RADIOREGS7_2G(0x55, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x80,
210 			      0x09, 0x0c, 0x07, 0x0d, 0x61, 0x03, 0xcf, 0x61,
211 			      0x03, 0xcf),
212 		PHYREGS(0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a),
213 	},
214 	{
215 		.freq			= 2437,
216 		RADIOREGS7_2G(0x58, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x85,
217 			      0x09, 0x0c, 0x07, 0x0d, 0x61, 0x03, 0xbf, 0x61,
218 			      0x03, 0xbf),
219 		PHYREGS(0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438),
220 	},
221 	{
222 		.freq			= 2442,
223 		RADIOREGS7_2G(0x5c, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8a,
224 			      0x09, 0x0b, 0x07, 0x0d, 0x61, 0x03, 0xaf, 0x61,
225 			      0x03, 0xaf),
226 		PHYREGS(0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436),
227 	},
228 	{
229 		.freq			= 2447,
230 		RADIOREGS7_2G(0x5f, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8f,
231 			      0x09, 0x0b, 0x07, 0x0d, 0x61, 0x03, 0x9f, 0x61,
232 			      0x03, 0x9f),
233 		PHYREGS(0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434),
234 	},
235 	{
236 		.freq			= 2452,
237 		RADIOREGS7_2G(0x62, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x94,
238 			      0x09, 0x0b, 0x07, 0x0d, 0x61, 0x03, 0x8f, 0x61,
239 			      0x03, 0x8f),
240 		PHYREGS(0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431),
241 	},
242 	{
243 		.freq			= 2457,
244 		RADIOREGS7_2G(0x66, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x99,
245 			      0x09, 0x0b, 0x07, 0x0c, 0x61, 0x03, 0x7f, 0x61,
246 			      0x03, 0x7f),
247 		PHYREGS(0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f),
248 	},
249 	{
250 		.freq			= 2462,
251 		RADIOREGS7_2G(0x69, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x9e,
252 			      0x09, 0x0b, 0x07, 0x0c, 0x61, 0x03, 0x6f, 0x61,
253 			      0x03, 0x6f),
254 		PHYREGS(0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d),
255 	},
256 	{
257 		.freq			= 2467,
258 		RADIOREGS7_2G(0x6c, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xa3,
259 			      0x09, 0x0b, 0x06, 0x0c, 0x61, 0x03, 0x5f, 0x61,
260 			      0x03, 0x5f),
261 		PHYREGS(0x03df, 0x03db, 0x03d7, 0x0422, 0x0427, 0x042b),
262 	},
263 	{
264 		.freq			= 2472,
265 		RADIOREGS7_2G(0x70, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xa8,
266 			      0x09, 0x0a, 0x06, 0x0b, 0x61, 0x03, 0x4f, 0x61,
267 			      0x03, 0x4f),
268 		PHYREGS(0x03e1, 0x03dd, 0x03d9, 0x0420, 0x0424, 0x0429),
269 	},
270 	{
271 		.freq			= 2484,
272 		RADIOREGS7_2G(0x78, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0xb4,
273 			      0x09, 0x0a, 0x06, 0x0b, 0x61, 0x03, 0x3f, 0x61,
274 			      0x03, 0x3f),
275 		PHYREGS(0x03e6, 0x03e2, 0x03de, 0x041b, 0x041f, 0x0424),
276 	}
277 };
278 
279 /* Extracted from MMIO dump of 6.30.223.248 */
280 static const struct b43_nphy_chantabent_rev7_2g b43_nphy_chantab_phy_rev17_radio_rev14[] = {
281 	{
282 		.freq			= 2412,
283 		RADIOREGS7_2G(0x48, 0x16, 0x30, 0x2b, 0x1f, 0x1f, 0x30, 0x6c,
284 			      0x09, 0x0d, 0x09, 0x03, 0x21, 0x53, 0xff, 0x21,
285 			      0x53, 0xff),
286 		PHYREGS(0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443),
287 	},
288 	{
289 		.freq			= 2417,
290 		RADIOREGS7_2G(0x4b, 0x16, 0x30, 0x2b, 0x1f, 0x1f, 0x30, 0x71,
291 			      0x09, 0x0d, 0x08, 0x03, 0x21, 0x53, 0xff, 0x21,
292 			      0x53, 0xff),
293 		PHYREGS(0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441),
294 	},
295 	{
296 		.freq			= 2422,
297 		RADIOREGS7_2G(0x4e, 0x16, 0x30, 0x2b, 0x1f, 0x1f, 0x30, 0x76,
298 			      0x09, 0x0d, 0x08, 0x03, 0x21, 0x53, 0xff, 0x21,
299 			      0x53, 0xff),
300 		PHYREGS(0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f),
301 	},
302 	{
303 		.freq			= 2427,
304 		RADIOREGS7_2G(0x52, 0x16, 0x30, 0x2b, 0x1f, 0x1f, 0x30, 0x7b,
305 			      0x09, 0x0c, 0x08, 0x03, 0x21, 0x53, 0xff, 0x21,
306 			      0x53, 0xff),
307 		PHYREGS(0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d),
308 	},
309 	{
310 		.freq			= 2432,
311 		RADIOREGS7_2G(0x55, 0x16, 0x30, 0x2b, 0x1f, 0x1f, 0x30, 0x80,
312 			      0x09, 0x0c, 0x08, 0x03, 0x21, 0x53, 0xff, 0x21,
313 			      0x53, 0xff),
314 		PHYREGS(0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a),
315 	},
316 	{
317 		.freq			= 2437,
318 		RADIOREGS7_2G(0x58, 0x16, 0x30, 0x2b, 0x1f, 0x1f, 0x30, 0x85,
319 			      0x09, 0x0c, 0x08, 0x03, 0x21, 0x53, 0xff, 0x21,
320 			      0x53, 0xff),
321 		PHYREGS(0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438),
322 	},
323 	{
324 		.freq			= 2442,
325 		RADIOREGS7_2G(0x5c, 0x16, 0x30, 0x2b, 0x1f, 0x1f, 0x30, 0x8a,
326 			      0x09, 0x0c, 0x08, 0x03, 0x21, 0x43, 0xff, 0x21,
327 			      0x43, 0xff),
328 		PHYREGS(0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436),
329 	},
330 	{
331 		.freq			= 2447,
332 		RADIOREGS7_2G(0x5f, 0x16, 0x30, 0x2b, 0x1f, 0x1f, 0x30, 0x8f,
333 			      0x09, 0x0c, 0x08, 0x03, 0x21, 0x43, 0xff, 0x21,
334 			      0x43, 0xff),
335 		PHYREGS(0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434),
336 	},
337 	{
338 		.freq			= 2452,
339 		RADIOREGS7_2G(0x62, 0x16, 0x30, 0x2b, 0x1f, 0x1f, 0x30, 0x94,
340 			      0x09, 0x0c, 0x08, 0x03, 0x21, 0x43, 0xff, 0x21,
341 			      0x43, 0xff),
342 		PHYREGS(0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431),
343 	},
344 	{
345 		.freq			= 2457,
346 		RADIOREGS7_2G(0x66, 0x16, 0x30, 0x2b, 0x1f, 0x1f, 0x30, 0x99,
347 			      0x09, 0x0b, 0x07, 0x03, 0x21, 0x43, 0xff, 0x21,
348 			      0x43, 0xff),
349 		PHYREGS(0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f),
350 	},
351 	{
352 		.freq			= 2462,
353 		RADIOREGS7_2G(0x69, 0x16, 0x30, 0x2b, 0x1f, 0x1f, 0x30, 0x9e,
354 			      0x09, 0x0b, 0x07, 0x03, 0x01, 0x43, 0xff, 0x01,
355 			      0x43, 0xff),
356 		PHYREGS(0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d),
357 	},
358 };
359 
360 /* Extracted from MMIO dump of 6.30.223.141 */
361 static const struct b43_nphy_chantabent_rev7 b43_nphy_chantab_phy_rev16_radio_rev9[] = {
362 	{
363 		.freq			= 2412,
364 		RADIOREGS7(0x48, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x6c,
365 			   0x09, 0x0f, 0x0a, 0x00, 0x0a, 0x00, 0x41, 0x63,
366 			   0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
367 			   0x00, 0x00, 0xf0, 0x00),
368 		PHYREGS(0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443),
369 	},
370 	{
371 		.freq			= 2417,
372 		RADIOREGS7(0x4b, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x71,
373 			   0x09, 0x0f, 0x0a, 0x00, 0x0a, 0x00, 0x41, 0x63,
374 			   0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
375 			   0x00, 0x00, 0xf0, 0x00),
376 		PHYREGS(0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441),
377 	},
378 	{
379 		.freq			= 2422,
380 		RADIOREGS7(0x4e, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x76,
381 			   0x09, 0x0f, 0x09, 0x00, 0x09, 0x00, 0x41, 0x63,
382 			   0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
383 			   0x00, 0x00, 0xf0, 0x00),
384 		PHYREGS(0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f),
385 	},
386 	{
387 		.freq			= 2427,
388 		RADIOREGS7(0x52, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x7b,
389 			   0x09, 0x0f, 0x09, 0x00, 0x09, 0x00, 0x41, 0x63,
390 			   0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
391 			   0x00, 0x00, 0xf0, 0x00),
392 		PHYREGS(0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d),
393 	},
394 	{
395 		.freq			= 2432,
396 		RADIOREGS7(0x55, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x80,
397 			   0x09, 0x0f, 0x08, 0x00, 0x08, 0x00, 0x41, 0x63,
398 			   0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
399 			   0x00, 0x00, 0xf0, 0x00),
400 		PHYREGS(0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a),
401 	},
402 	{
403 		.freq			= 2437,
404 		RADIOREGS7(0x58, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x85,
405 			   0x09, 0x0f, 0x08, 0x00, 0x08, 0x00, 0x41, 0x63,
406 			   0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
407 			   0x00, 0x00, 0xf0, 0x00),
408 		PHYREGS(0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438),
409 	},
410 	{
411 		.freq			= 2442,
412 		RADIOREGS7(0x5c, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8a,
413 			   0x09, 0x0f, 0x07, 0x00, 0x07, 0x00, 0x41, 0x63,
414 			   0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
415 			   0x00, 0x00, 0xf0, 0x00),
416 		PHYREGS(0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436),
417 	},
418 	{
419 		.freq			= 2447,
420 		RADIOREGS7(0x5f, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8f,
421 			   0x09, 0x0f, 0x07, 0x00, 0x07, 0x00, 0x41, 0x63,
422 			   0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
423 			   0x00, 0x00, 0xf0, 0x00),
424 		PHYREGS(0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434),
425 	},
426 	{
427 		.freq			= 2452,
428 		RADIOREGS7(0x62, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x94,
429 			   0x09, 0x0f, 0x07, 0x00, 0x07, 0x00, 0x41, 0x63,
430 			   0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
431 			   0x00, 0x00, 0xf0, 0x00),
432 		PHYREGS(0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431),
433 	},
434 	{
435 		.freq			= 2457,
436 		RADIOREGS7(0x66, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x99,
437 			   0x09, 0x0f, 0x06, 0x00, 0x06, 0x00, 0x41, 0x63,
438 			   0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
439 			   0x00, 0x00, 0xf0, 0x00),
440 		PHYREGS(0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f),
441 	},
442 	{
443 		.freq			= 2462,
444 		RADIOREGS7(0x69, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x9e,
445 			   0x09, 0x0f, 0x06, 0x00, 0x06, 0x00, 0x41, 0x63,
446 			   0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
447 			   0x00, 0x00, 0xf0, 0x00),
448 		PHYREGS(0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d),
449 	},
450 	{
451 		.freq			= 5180,
452 		RADIOREGS7(0xbe, 0x16, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x06,
453 			   0x02, 0x0e, 0x00, 0x0e, 0x00, 0x9e, 0x00, 0x00,
454 			   0x9f, 0x2f, 0xa3, 0x00, 0xfc, 0x00, 0x00, 0x4f,
455 			   0x3a, 0x83, 0x00, 0xfc),
456 		PHYREGS(0x081c, 0x0818, 0x0814, 0x01f9, 0x01fa, 0x01fb),
457 	},
458 	{
459 		.freq			= 5200,
460 		RADIOREGS7(0xc5, 0x16, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x08,
461 			   0x02, 0x0e, 0x00, 0x0e, 0x00, 0x9e, 0x00, 0x00,
462 			   0x7f, 0x2f, 0x83, 0x00, 0xf8, 0x00, 0x00, 0x4c,
463 			   0x4a, 0x83, 0x00, 0xf8),
464 		PHYREGS(0x0824, 0x0820, 0x081c, 0x01f7, 0x01f8, 0x01f9),
465 	},
466 	{
467 		.freq			= 5220,
468 		RADIOREGS7(0xcc, 0x16, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x0a,
469 			   0x02, 0x0e, 0x00, 0x0e, 0x00, 0x9e, 0x00, 0x00,
470 			   0x6d, 0x3d, 0x83, 0x00, 0xf8, 0x00, 0x00, 0x2d,
471 			   0x2a, 0x73, 0x00, 0xf8),
472 		PHYREGS(0x082c, 0x0828, 0x0824, 0x01f5, 0x01f6, 0x01f7),
473 	},
474 	{
475 		.freq			= 5240,
476 		RADIOREGS7(0xd2, 0x16, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x0c,
477 			   0x02, 0x0d, 0x00, 0x0d, 0x00, 0x8d, 0x00, 0x00,
478 			   0x4d, 0x1c, 0x73, 0x00, 0xf8, 0x00, 0x00, 0x4d,
479 			   0x2b, 0x73, 0x00, 0xf8),
480 		PHYREGS(0x0834, 0x0830, 0x082c, 0x01f3, 0x01f4, 0x01f5),
481 	},
482 	{
483 		.freq			= 5745,
484 		RADIOREGS7(0x7b, 0x17, 0x20, 0x1f, 0x08, 0x08, 0x3f, 0x7d,
485 			   0x04, 0x08, 0x00, 0x06, 0x00, 0x15, 0x00, 0x00,
486 			   0x08, 0x03, 0x03, 0x00, 0x30, 0x00, 0x00, 0x06,
487 			   0x02, 0x03, 0x00, 0x30),
488 		PHYREGS(0x08fe, 0x08fa, 0x08f6, 0x01c8, 0x01c8, 0x01c9),
489 	},
490 	{
491 		.freq			= 5765,
492 		RADIOREGS7(0x81, 0x17, 0x20, 0x1f, 0x08, 0x08, 0x3f, 0x81,
493 			   0x04, 0x08, 0x00, 0x06, 0x00, 0x15, 0x00, 0x00,
494 			   0x06, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05,
495 			   0x02, 0x03, 0x00, 0x00),
496 		PHYREGS(0x0906, 0x0902, 0x08fe, 0x01c6, 0x01c7, 0x01c8),
497 	},
498 	{
499 		.freq			= 5785,
500 		RADIOREGS7(0x88, 0x17, 0x20, 0x1f, 0x08, 0x08, 0x3f, 0x85,
501 			   0x04, 0x08, 0x00, 0x06, 0x00, 0x15, 0x00, 0x00,
502 			   0x08, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05,
503 			   0x21, 0x03, 0x00, 0x00),
504 		PHYREGS(0x090e, 0x090a, 0x0906, 0x01c4, 0x01c5, 0x01c6),
505 	},
506 	{
507 		.freq			= 5805,
508 		RADIOREGS7(0x8f, 0x17, 0x20, 0x1f, 0x08, 0x08, 0x3f, 0x89,
509 			   0x04, 0x07, 0x00, 0x06, 0x00, 0x04, 0x00, 0x00,
510 			   0x06, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03,
511 			   0x00, 0x03, 0x00, 0x00),
512 		PHYREGS(0x0916, 0x0912, 0x090e, 0x01c3, 0x01c4, 0x01c4),
513 	},
514 	{
515 		.freq			= 5825,
516 		RADIOREGS7(0x95, 0x17, 0x20, 0x1f, 0x08, 0x08, 0x3f, 0x8d,
517 			   0x04, 0x07, 0x00, 0x05, 0x00, 0x03, 0x00, 0x00,
518 			   0x05, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03,
519 			   0x00, 0x03, 0x00, 0x00),
520 		PHYREGS(0x091e, 0x091a, 0x0916, 0x01c1, 0x01c2, 0x01c3),
521 	},
522 };
523 
524 void r2057_upload_inittabs(struct b43_wldev *dev)
525 {
526 	struct b43_phy *phy = &dev->phy;
527 	u16 *table = NULL;
528 	u16 size, i;
529 
530 	switch (phy->rev) {
531 	case 7:
532 		table = r2057_rev4_init[0];
533 		size = ARRAY_SIZE(r2057_rev4_init);
534 		break;
535 	case 8:
536 		if (phy->radio_rev == 5) {
537 			table = r2057_rev5_init[0];
538 			size = ARRAY_SIZE(r2057_rev5_init);
539 		} else if (phy->radio_rev == 7) {
540 			table = r2057_rev7_init[0];
541 			size = ARRAY_SIZE(r2057_rev7_init);
542 		}
543 		break;
544 	case 9:
545 		if (phy->radio_rev == 5) {
546 			table = r2057_rev5a_init[0];
547 			size = ARRAY_SIZE(r2057_rev5a_init);
548 		}
549 		break;
550 	case 16:
551 		if (phy->radio_rev == 9) {
552 			table = r2057_rev9_init[0];
553 			size = ARRAY_SIZE(r2057_rev9_init);
554 		}
555 		break;
556 	case 17:
557 		if (phy->radio_rev == 14) {
558 			table = r2057_rev14_init[0];
559 			size = ARRAY_SIZE(r2057_rev14_init);
560 		}
561 		break;
562 	}
563 
564 	B43_WARN_ON(!table);
565 
566 	if (table) {
567 		for (i = 0; i < size; i++, table += 2)
568 			b43_radio_write(dev, table[0], table[1]);
569 	}
570 }
571 
572 void r2057_get_chantabent_rev7(struct b43_wldev *dev, u16 freq,
573 			       const struct b43_nphy_chantabent_rev7 **tabent_r7,
574 			       const struct b43_nphy_chantabent_rev7_2g **tabent_r7_2g)
575 {
576 	struct b43_phy *phy = &dev->phy;
577 	const struct b43_nphy_chantabent_rev7 *e_r7 = NULL;
578 	const struct b43_nphy_chantabent_rev7_2g *e_r7_2g = NULL;
579 	unsigned int len, i;
580 
581 	*tabent_r7 = NULL;
582 	*tabent_r7_2g = NULL;
583 
584 	switch (phy->rev) {
585 	case 8:
586 		if (phy->radio_rev == 5) {
587 			e_r7_2g = b43_nphy_chantab_phy_rev8_radio_rev5;
588 			len = ARRAY_SIZE(b43_nphy_chantab_phy_rev8_radio_rev5);
589 		}
590 		break;
591 	case 16:
592 		if (phy->radio_rev == 9) {
593 			e_r7 = b43_nphy_chantab_phy_rev16_radio_rev9;
594 			len = ARRAY_SIZE(b43_nphy_chantab_phy_rev16_radio_rev9);
595 		}
596 		break;
597 	case 17:
598 		if (phy->radio_rev == 14) {
599 			e_r7_2g = b43_nphy_chantab_phy_rev17_radio_rev14;
600 			len = ARRAY_SIZE(b43_nphy_chantab_phy_rev17_radio_rev14);
601 		}
602 		break;
603 	default:
604 		break;
605 	}
606 
607 	if (e_r7) {
608 		for (i = 0; i < len; i++, e_r7++) {
609 			if (e_r7->freq == freq) {
610 				*tabent_r7 = e_r7;
611 				return;
612 			}
613 		}
614 	} else if (e_r7_2g) {
615 		for (i = 0; i < len; i++, e_r7_2g++) {
616 			if (e_r7_2g->freq == freq) {
617 				*tabent_r7_2g = e_r7_2g;
618 				return;
619 			}
620 		}
621 	} else {
622 		B43_WARN_ON(1);
623 	}
624 }
625