1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 
4   Broadcom B43 wireless driver
5   IEEE 802.11n HT-PHY data tables
6 
7   Copyright (c) 2011 Rafał Miłecki <zajec5@gmail.com>
8 
9 
10 */
11 
12 #include "b43.h"
13 #include "tables_phy_ht.h"
14 #include "phy_common.h"
15 #include "phy_ht.h"
16 
17 static const u16 b43_httab_0x12[] = {
18 	0x0000, 0x0008, 0x000a, 0x0010, 0x0012, 0x0019,
19 	0x001a, 0x001c, 0x0080, 0x0088, 0x008a, 0x0090,
20 	0x0092, 0x0099, 0x009a, 0x009c, 0x0100, 0x0108,
21 	0x010a, 0x0110, 0x0112, 0x0119, 0x011a, 0x011c,
22 	0x0180, 0x0188, 0x018a, 0x0190, 0x0192, 0x0199,
23 	0x019a, 0x019c, 0x0000, 0x0098, 0x00a0, 0x00a8,
24 	0x009a, 0x00a2, 0x00aa, 0x0120, 0x0128, 0x0128,
25 	0x0130, 0x0138, 0x0138, 0x0140, 0x0122, 0x012a,
26 	0x012a, 0x0132, 0x013a, 0x013a, 0x0142, 0x01a8,
27 	0x01b0, 0x01b8, 0x01b0, 0x01b8, 0x01c0, 0x01c8,
28 	0x01c0, 0x01c8, 0x01d0, 0x01d0, 0x01d8, 0x01aa,
29 	0x01b2, 0x01ba, 0x01b2, 0x01ba, 0x01c2, 0x01ca,
30 	0x01c2, 0x01ca, 0x01d2, 0x01d2, 0x01da, 0x0001,
31 	0x0002, 0x0004, 0x0009, 0x000c, 0x0011, 0x0014,
32 	0x0018, 0x0020, 0x0021, 0x0022, 0x0024, 0x0081,
33 	0x0082, 0x0084, 0x0089, 0x008c, 0x0091, 0x0094,
34 	0x0098, 0x00a0, 0x00a1, 0x00a2, 0x00a4, 0x0007,
35 	0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007,
36 	0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007,
37 	0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007,
38 	0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007,
39 	0x0007, 0x0007,
40 };
41 
42 static const u16 b43_httab_0x27[] = {
43 	0x0009, 0x000e, 0x0011, 0x0014, 0x0017, 0x001a,
44 	0x001d, 0x0020, 0x0009, 0x000e, 0x0011, 0x0014,
45 	0x0017, 0x001a, 0x001d, 0x0020, 0x0009, 0x000e,
46 	0x0011, 0x0014, 0x0017, 0x001a, 0x001d, 0x0020,
47 	0x0009, 0x000e, 0x0011, 0x0014, 0x0017, 0x001a,
48 	0x001d, 0x0020,
49 };
50 
51 static const u16 b43_httab_0x26[] = {
52 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
53 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
54 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
55 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
56 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
57 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
58 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
59 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
60 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
61 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
62 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
63 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
64 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
65 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
66 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
67 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
68 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
69 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
70 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
71 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
72 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
73 	0x0000, 0x0000,
74 };
75 
76 static const u32 b43_httab_0x25[] = {
77 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
78 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
79 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
80 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
81 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
82 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
83 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
84 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
85 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
86 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
87 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
88 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
89 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
90 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
91 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
92 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
93 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
94 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
95 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
96 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
97 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
98 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
99 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
100 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
101 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
102 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
103 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
104 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
105 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
106 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
107 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
108 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
109 };
110 
111 static const u32 b43_httab_0x2f[] = {
112 	0x00035700, 0x0002cc9a, 0x00026666, 0x0001581f,
113 	0x0001581f, 0x0001581f, 0x0001581f, 0x0001581f,
114 	0x0001581f, 0x0001581f, 0x0001581f, 0x00035700,
115 	0x0002cc9a, 0x00026666, 0x0001581f, 0x0001581f,
116 	0x0001581f, 0x0001581f, 0x0001581f, 0x0001581f,
117 	0x0001581f, 0x0001581f,
118 };
119 
120 static const u16 b43_httab_0x1a[] = {
121 	0x0055, 0x0054, 0x0054, 0x0053, 0x0052, 0x0052,
122 	0x0051, 0x0051, 0x0050, 0x004f, 0x004f, 0x004e,
123 	0x004e, 0x004d, 0x004c, 0x004c, 0x004b, 0x004a,
124 	0x0049, 0x0049, 0x0048, 0x0047, 0x0046, 0x0046,
125 	0x0045, 0x0044, 0x0043, 0x0042, 0x0041, 0x0040,
126 	0x0040, 0x003f, 0x003e, 0x003d, 0x003c, 0x003a,
127 	0x0039, 0x0038, 0x0037, 0x0036, 0x0035, 0x0033,
128 	0x0032, 0x0031, 0x002f, 0x002e, 0x002c, 0x002b,
129 	0x0029, 0x0027, 0x0025, 0x0023, 0x0021, 0x001f,
130 	0x001d, 0x001a, 0x0018, 0x0015, 0x0012, 0x000e,
131 	0x000b, 0x0007, 0x0002, 0x00fd,
132 };
133 
134 static const u16 b43_httab_0x1b[] = {
135 	0x0055, 0x0054, 0x0054, 0x0053, 0x0052, 0x0052,
136 	0x0051, 0x0051, 0x0050, 0x004f, 0x004f, 0x004e,
137 	0x004e, 0x004d, 0x004c, 0x004c, 0x004b, 0x004a,
138 	0x0049, 0x0049, 0x0048, 0x0047, 0x0046, 0x0046,
139 	0x0045, 0x0044, 0x0043, 0x0042, 0x0041, 0x0040,
140 	0x0040, 0x003f, 0x003e, 0x003d, 0x003c, 0x003a,
141 	0x0039, 0x0038, 0x0037, 0x0036, 0x0035, 0x0033,
142 	0x0032, 0x0031, 0x002f, 0x002e, 0x002c, 0x002b,
143 	0x0029, 0x0027, 0x0025, 0x0023, 0x0021, 0x001f,
144 	0x001d, 0x001a, 0x0018, 0x0015, 0x0012, 0x000e,
145 	0x000b, 0x0007, 0x0002, 0x00fd,
146 };
147 
148 static const u16 b43_httab_0x1c[] = {
149 	0x0055, 0x0054, 0x0054, 0x0053, 0x0052, 0x0052,
150 	0x0051, 0x0051, 0x0050, 0x004f, 0x004f, 0x004e,
151 	0x004e, 0x004d, 0x004c, 0x004c, 0x004b, 0x004a,
152 	0x0049, 0x0049, 0x0048, 0x0047, 0x0046, 0x0046,
153 	0x0045, 0x0044, 0x0043, 0x0042, 0x0041, 0x0040,
154 	0x0040, 0x003f, 0x003e, 0x003d, 0x003c, 0x003a,
155 	0x0039, 0x0038, 0x0037, 0x0036, 0x0035, 0x0033,
156 	0x0032, 0x0031, 0x002f, 0x002e, 0x002c, 0x002b,
157 	0x0029, 0x0027, 0x0025, 0x0023, 0x0021, 0x001f,
158 	0x001d, 0x001a, 0x0018, 0x0015, 0x0012, 0x000e,
159 	0x000b, 0x0007, 0x0002, 0x00fd,
160 };
161 
162 static const u32 b43_httab_0x1a_0xc0[] = {
163 	0x5bf70044, 0x5bf70042, 0x5bf70040, 0x5bf7003e,
164 	0x5bf7003c, 0x5bf7003b, 0x5bf70039, 0x5bf70037,
165 	0x5bf70036, 0x5bf70034, 0x5bf70033, 0x5bf70031,
166 	0x5bf70030, 0x5ba70044, 0x5ba70042, 0x5ba70040,
167 	0x5ba7003e, 0x5ba7003c, 0x5ba7003b, 0x5ba70039,
168 	0x5ba70037, 0x5ba70036, 0x5ba70034, 0x5ba70033,
169 	0x5b770044, 0x5b770042, 0x5b770040, 0x5b77003e,
170 	0x5b77003c, 0x5b77003b, 0x5b770039, 0x5b770037,
171 	0x5b770036, 0x5b770034, 0x5b770033, 0x5b770031,
172 	0x5b770030, 0x5b77002f, 0x5b77002d, 0x5b77002c,
173 	0x5b470044, 0x5b470042, 0x5b470040, 0x5b47003e,
174 	0x5b47003c, 0x5b47003b, 0x5b470039, 0x5b470037,
175 	0x5b470036, 0x5b470034, 0x5b470033, 0x5b470031,
176 	0x5b470030, 0x5b47002f, 0x5b47002d, 0x5b47002c,
177 	0x5b47002b, 0x5b47002a, 0x5b270044, 0x5b270042,
178 	0x5b270040, 0x5b27003e, 0x5b27003c, 0x5b27003b,
179 	0x5b270039, 0x5b270037, 0x5b270036, 0x5b270034,
180 	0x5b270033, 0x5b270031, 0x5b270030, 0x5b27002f,
181 	0x5b170044, 0x5b170042, 0x5b170040, 0x5b17003e,
182 	0x5b17003c, 0x5b17003b, 0x5b170039, 0x5b170037,
183 	0x5b170036, 0x5b170034, 0x5b170033, 0x5b170031,
184 	0x5b170030, 0x5b17002f, 0x5b17002d, 0x5b17002c,
185 	0x5b17002b, 0x5b17002a, 0x5b170028, 0x5b170027,
186 	0x5b170026, 0x5b170025, 0x5b170024, 0x5b170023,
187 	0x5b070044, 0x5b070042, 0x5b070040, 0x5b07003e,
188 	0x5b07003c, 0x5b07003b, 0x5b070039, 0x5b070037,
189 	0x5b070036, 0x5b070034, 0x5b070033, 0x5b070031,
190 	0x5b070030, 0x5b07002f, 0x5b07002d, 0x5b07002c,
191 	0x5b07002b, 0x5b07002a, 0x5b070028, 0x5b070027,
192 	0x5b070026, 0x5b070025, 0x5b070024, 0x5b070023,
193 	0x5b070022, 0x5b070021, 0x5b070020, 0x5b07001f,
194 	0x5b07001e, 0x5b07001d, 0x5b07001d, 0x5b07001c,
195 };
196 
197 static const u32 b43_httab_0x1a_0x140[] = {
198 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
199 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
200 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
201 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
202 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
203 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
204 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
205 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
206 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
207 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
208 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
209 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
210 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
211 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
212 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
213 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
214 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
215 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
216 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
217 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
218 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
219 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
220 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
221 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
222 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
223 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
224 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
225 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
226 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
227 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
228 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
229 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
230 };
231 
232 static const u32 b43_httab_0x1b_0x140[] = {
233 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
234 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
235 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
236 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
237 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
238 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
239 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
240 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
241 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
242 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
243 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
244 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
245 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
246 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
247 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
248 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
249 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
250 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
251 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
252 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
253 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
254 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
255 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
256 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
257 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
258 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
259 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
260 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
261 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
262 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
263 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
264 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
265 };
266 
267 static const u32 b43_httab_0x1c_0x140[] = {
268 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
269 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
270 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
271 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
272 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
273 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
274 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
275 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
276 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
277 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
278 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
279 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
280 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
281 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
282 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
283 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
284 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
285 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
286 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
287 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
288 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
289 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
290 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
291 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
292 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
293 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
294 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
295 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
296 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
297 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
298 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
299 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
300 };
301 
302 static const u16 b43_httab_0x1a_0x1c0[] = {
303 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
304 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
305 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
306 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
307 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
308 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
309 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
310 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
311 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
312 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
313 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
314 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
315 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
316 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
317 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
318 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
319 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
320 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
321 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
322 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
323 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
324 	0x0000, 0x0000,
325 };
326 
327 static const u16 b43_httab_0x1b_0x1c0[] = {
328 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
329 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
330 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
331 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
332 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
333 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
334 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
335 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
336 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
337 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
338 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
339 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
340 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
341 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
342 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
343 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
344 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
345 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
346 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
347 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
348 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
349 	0x0000, 0x0000,
350 };
351 
352 static const u16 b43_httab_0x1c_0x1c0[] = {
353 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
354 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
355 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
356 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
357 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
358 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
359 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
360 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
361 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
362 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
363 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
364 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
365 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
366 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
367 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
368 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
369 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
370 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
371 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
372 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
373 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
374 	0x0000, 0x0000,
375 };
376 
377 static const u16 b43_httab_0x1a_0x240[] = {
378 	0x0036, 0x0036, 0x0036, 0x0036, 0x0036, 0x0036,
379 	0x0036, 0x0036, 0x0036, 0x0036, 0x0036, 0x0036,
380 	0x0036, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a,
381 	0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a,
382 	0x001e, 0x001e, 0x001e, 0x001e, 0x001e, 0x001e,
383 	0x001e, 0x001e, 0x001e, 0x001e, 0x001e, 0x001e,
384 	0x001e, 0x001e, 0x001e, 0x001e, 0x000e, 0x000e,
385 	0x000e, 0x000e, 0x000e, 0x000e, 0x000e, 0x000e,
386 	0x000e, 0x000e, 0x000e, 0x000e, 0x000e, 0x000e,
387 	0x000e, 0x000e, 0x000e, 0x000e, 0x01fc, 0x01fc,
388 	0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc,
389 	0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc,
390 	0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee,
391 	0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee,
392 	0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee,
393 	0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee,
394 	0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6,
395 	0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6,
396 	0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6,
397 	0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6,
398 	0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6,
399 	0x01d6, 0x01d6,
400 };
401 
402 static const u16 b43_httab_0x1b_0x240[] = {
403 	0x0036, 0x0036, 0x0036, 0x0036, 0x0036, 0x0036,
404 	0x0036, 0x0036, 0x0036, 0x0036, 0x0036, 0x0036,
405 	0x0036, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a,
406 	0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a,
407 	0x001e, 0x001e, 0x001e, 0x001e, 0x001e, 0x001e,
408 	0x001e, 0x001e, 0x001e, 0x001e, 0x001e, 0x001e,
409 	0x001e, 0x001e, 0x001e, 0x001e, 0x000e, 0x000e,
410 	0x000e, 0x000e, 0x000e, 0x000e, 0x000e, 0x000e,
411 	0x000e, 0x000e, 0x000e, 0x000e, 0x000e, 0x000e,
412 	0x000e, 0x000e, 0x000e, 0x000e, 0x01fc, 0x01fc,
413 	0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc,
414 	0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc,
415 	0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee,
416 	0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee,
417 	0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee,
418 	0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee,
419 	0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6,
420 	0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6,
421 	0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6,
422 	0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6,
423 	0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6,
424 	0x01d6, 0x01d6,
425 };
426 
427 static const u16 b43_httab_0x1c_0x240[] = {
428 	0x0036, 0x0036, 0x0036, 0x0036, 0x0036, 0x0036,
429 	0x0036, 0x0036, 0x0036, 0x0036, 0x0036, 0x0036,
430 	0x0036, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a,
431 	0x002a, 0x002a, 0x002a, 0x002a, 0x002a, 0x002a,
432 	0x001e, 0x001e, 0x001e, 0x001e, 0x001e, 0x001e,
433 	0x001e, 0x001e, 0x001e, 0x001e, 0x001e, 0x001e,
434 	0x001e, 0x001e, 0x001e, 0x001e, 0x000e, 0x000e,
435 	0x000e, 0x000e, 0x000e, 0x000e, 0x000e, 0x000e,
436 	0x000e, 0x000e, 0x000e, 0x000e, 0x000e, 0x000e,
437 	0x000e, 0x000e, 0x000e, 0x000e, 0x01fc, 0x01fc,
438 	0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc,
439 	0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc, 0x01fc,
440 	0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee,
441 	0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee,
442 	0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee,
443 	0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee, 0x01ee,
444 	0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6,
445 	0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6,
446 	0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6,
447 	0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6,
448 	0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6, 0x01d6,
449 	0x01d6, 0x01d6,
450 };
451 
452 static const u32 b43_httab_0x1f[] = {
453 	0x00000000, 0x00000000, 0x00016023, 0x00006028,
454 	0x00034036, 0x0003402e, 0x0007203c, 0x0006e037,
455 	0x00070030, 0x0009401f, 0x0009a00f, 0x000b600d,
456 	0x000c8007, 0x000ce007, 0x00101fff, 0x00121ff9,
457 	0x0012e004, 0x0014dffc, 0x0016dff6, 0x0018dfe9,
458 	0x001b3fe5, 0x001c5fd0, 0x001ddfc2, 0x001f1fb6,
459 	0x00207fa4, 0x00219f8f, 0x0022ff7d, 0x00247f6c,
460 	0x0024df5b, 0x00267f4b, 0x0027df3b, 0x0029bf3b,
461 	0x002b5f2f, 0x002d3f2e, 0x002f5f2a, 0x002fff15,
462 	0x00315f0b, 0x0032defa, 0x0033beeb, 0x0034fed9,
463 	0x00353ec5, 0x00361eb0, 0x00363e9b, 0x0036be87,
464 	0x0036be70, 0x0038fe67, 0x0044beb2, 0x00513ef3,
465 	0x00595f11, 0x00669f3d, 0x0078dfdf, 0x00a143aa,
466 	0x01642fff, 0x0162afff, 0x01620fff, 0x0160cfff,
467 	0x015f0fff, 0x015dafff, 0x015bcfff, 0x015bcfff,
468 	0x015b4fff, 0x015acfff, 0x01590fff, 0x0156cfff,
469 };
470 
471 static const u32 b43_httab_0x21[] = {
472 	0x00000000, 0x00000000, 0x00016023, 0x00006028,
473 	0x00034036, 0x0003402e, 0x0007203c, 0x0006e037,
474 	0x00070030, 0x0009401f, 0x0009a00f, 0x000b600d,
475 	0x000c8007, 0x000ce007, 0x00101fff, 0x00121ff9,
476 	0x0012e004, 0x0014dffc, 0x0016dff6, 0x0018dfe9,
477 	0x001b3fe5, 0x001c5fd0, 0x001ddfc2, 0x001f1fb6,
478 	0x00207fa4, 0x00219f8f, 0x0022ff7d, 0x00247f6c,
479 	0x0024df5b, 0x00267f4b, 0x0027df3b, 0x0029bf3b,
480 	0x002b5f2f, 0x002d3f2e, 0x002f5f2a, 0x002fff15,
481 	0x00315f0b, 0x0032defa, 0x0033beeb, 0x0034fed9,
482 	0x00353ec5, 0x00361eb0, 0x00363e9b, 0x0036be87,
483 	0x0036be70, 0x0038fe67, 0x0044beb2, 0x00513ef3,
484 	0x00595f11, 0x00669f3d, 0x0078dfdf, 0x00a143aa,
485 	0x01642fff, 0x0162afff, 0x01620fff, 0x0160cfff,
486 	0x015f0fff, 0x015dafff, 0x015bcfff, 0x015bcfff,
487 	0x015b4fff, 0x015acfff, 0x01590fff, 0x0156cfff,
488 };
489 
490 static const u32 b43_httab_0x23[] = {
491 	0x00000000, 0x00000000, 0x00016023, 0x00006028,
492 	0x00034036, 0x0003402e, 0x0007203c, 0x0006e037,
493 	0x00070030, 0x0009401f, 0x0009a00f, 0x000b600d,
494 	0x000c8007, 0x000ce007, 0x00101fff, 0x00121ff9,
495 	0x0012e004, 0x0014dffc, 0x0016dff6, 0x0018dfe9,
496 	0x001b3fe5, 0x001c5fd0, 0x001ddfc2, 0x001f1fb6,
497 	0x00207fa4, 0x00219f8f, 0x0022ff7d, 0x00247f6c,
498 	0x0024df5b, 0x00267f4b, 0x0027df3b, 0x0029bf3b,
499 	0x002b5f2f, 0x002d3f2e, 0x002f5f2a, 0x002fff15,
500 	0x00315f0b, 0x0032defa, 0x0033beeb, 0x0034fed9,
501 	0x00353ec5, 0x00361eb0, 0x00363e9b, 0x0036be87,
502 	0x0036be70, 0x0038fe67, 0x0044beb2, 0x00513ef3,
503 	0x00595f11, 0x00669f3d, 0x0078dfdf, 0x00a143aa,
504 	0x01642fff, 0x0162afff, 0x01620fff, 0x0160cfff,
505 	0x015f0fff, 0x015dafff, 0x015bcfff, 0x015bcfff,
506 	0x015b4fff, 0x015acfff, 0x01590fff, 0x0156cfff,
507 };
508 
509 static const u32 b43_httab_0x20[] = {
510 	0x0b5e002d, 0x0ae2002f, 0x0a3b0032, 0x09a70035,
511 	0x09220038, 0x08ab003b, 0x081f003f, 0x07a20043,
512 	0x07340047, 0x06d2004b, 0x067a004f, 0x06170054,
513 	0x05bf0059, 0x0571005e, 0x051e0064, 0x04d3006a,
514 	0x04910070, 0x044c0077, 0x040f007e, 0x03d90085,
515 	0x03a1008d, 0x036f0095, 0x033d009e, 0x030b00a8,
516 	0x02e000b2, 0x02b900bc, 0x029200c7, 0x026d00d3,
517 	0x024900e0, 0x022900ed, 0x020a00fb, 0x01ec010a,
518 	0x01d20119, 0x01b7012a, 0x019e013c, 0x0188014e,
519 	0x01720162, 0x015d0177, 0x0149018e, 0x013701a5,
520 	0x012601be, 0x011501d8, 0x010601f4, 0x00f70212,
521 	0x00e90231, 0x00dc0253, 0x00d00276, 0x00c4029b,
522 	0x00b902c3, 0x00af02ed, 0x00a50319, 0x009c0348,
523 	0x0093037a, 0x008b03af, 0x008303e6, 0x007c0422,
524 	0x00750460, 0x006e04a3, 0x006804e9, 0x00620533,
525 	0x005d0582, 0x005805d6, 0x0053062e, 0x004e068c,
526 };
527 
528 static const u32 b43_httab_0x22[] = {
529 	0x0b5e002d, 0x0ae2002f, 0x0a3b0032, 0x09a70035,
530 	0x09220038, 0x08ab003b, 0x081f003f, 0x07a20043,
531 	0x07340047, 0x06d2004b, 0x067a004f, 0x06170054,
532 	0x05bf0059, 0x0571005e, 0x051e0064, 0x04d3006a,
533 	0x04910070, 0x044c0077, 0x040f007e, 0x03d90085,
534 	0x03a1008d, 0x036f0095, 0x033d009e, 0x030b00a8,
535 	0x02e000b2, 0x02b900bc, 0x029200c7, 0x026d00d3,
536 	0x024900e0, 0x022900ed, 0x020a00fb, 0x01ec010a,
537 	0x01d20119, 0x01b7012a, 0x019e013c, 0x0188014e,
538 	0x01720162, 0x015d0177, 0x0149018e, 0x013701a5,
539 	0x012601be, 0x011501d8, 0x010601f4, 0x00f70212,
540 	0x00e90231, 0x00dc0253, 0x00d00276, 0x00c4029b,
541 	0x00b902c3, 0x00af02ed, 0x00a50319, 0x009c0348,
542 	0x0093037a, 0x008b03af, 0x008303e6, 0x007c0422,
543 	0x00750460, 0x006e04a3, 0x006804e9, 0x00620533,
544 	0x005d0582, 0x005805d6, 0x0053062e, 0x004e068c,
545 };
546 
547 static const u32 b43_httab_0x24[] = {
548 	0x0b5e002d, 0x0ae2002f, 0x0a3b0032, 0x09a70035,
549 	0x09220038, 0x08ab003b, 0x081f003f, 0x07a20043,
550 	0x07340047, 0x06d2004b, 0x067a004f, 0x06170054,
551 	0x05bf0059, 0x0571005e, 0x051e0064, 0x04d3006a,
552 	0x04910070, 0x044c0077, 0x040f007e, 0x03d90085,
553 	0x03a1008d, 0x036f0095, 0x033d009e, 0x030b00a8,
554 	0x02e000b2, 0x02b900bc, 0x029200c7, 0x026d00d3,
555 	0x024900e0, 0x022900ed, 0x020a00fb, 0x01ec010a,
556 	0x01d20119, 0x01b7012a, 0x019e013c, 0x0188014e,
557 	0x01720162, 0x015d0177, 0x0149018e, 0x013701a5,
558 	0x012601be, 0x011501d8, 0x010601f4, 0x00f70212,
559 	0x00e90231, 0x00dc0253, 0x00d00276, 0x00c4029b,
560 	0x00b902c3, 0x00af02ed, 0x00a50319, 0x009c0348,
561 	0x0093037a, 0x008b03af, 0x008303e6, 0x007c0422,
562 	0x00750460, 0x006e04a3, 0x006804e9, 0x00620533,
563 	0x005d0582, 0x005805d6, 0x0053062e, 0x004e068c,
564 };
565 
566 /* Some late-init table */
567 const u32 b43_httab_0x1a_0xc0_late[] = {
568 	0x10f90040, 0x10e10040, 0x10e1003c, 0x10c9003d,
569 	0x10b9003c, 0x10a9003d, 0x10a1003c, 0x1099003b,
570 	0x1091003b, 0x1089003a, 0x1081003a, 0x10790039,
571 	0x10710039, 0x1069003a, 0x1061003b, 0x1059003d,
572 	0x1051003f, 0x10490042, 0x1049003e, 0x1049003b,
573 	0x1041003e, 0x1041003b, 0x1039003e, 0x1039003b,
574 	0x10390038, 0x10390035, 0x1031003a, 0x10310036,
575 	0x10310033, 0x1029003a, 0x10290037, 0x10290034,
576 	0x10290031, 0x10210039, 0x10210036, 0x10210033,
577 	0x10210030, 0x1019003c, 0x10190039, 0x10190036,
578 	0x10190033, 0x10190030, 0x1019002d, 0x1019002b,
579 	0x10190028, 0x1011003a, 0x10110036, 0x10110033,
580 	0x10110030, 0x1011002e, 0x1011002b, 0x10110029,
581 	0x10110027, 0x10110024, 0x10110022, 0x10110020,
582 	0x1011001f, 0x1011001d, 0x1009003a, 0x10090037,
583 	0x10090034, 0x10090031, 0x1009002e, 0x1009002c,
584 	0x10090029, 0x10090027, 0x10090025, 0x10090023,
585 	0x10090021, 0x1009001f, 0x1009001d, 0x1009001b,
586 	0x1009001a, 0x10090018, 0x10090017, 0x10090016,
587 	0x10090015, 0x10090013, 0x10090012, 0x10090011,
588 	0x10090010, 0x1009000f, 0x1009000f, 0x1009000e,
589 	0x1009000d, 0x1009000c, 0x1009000c, 0x1009000b,
590 	0x1009000a, 0x1009000a, 0x10090009, 0x10090009,
591 	0x10090008, 0x10090008, 0x10090007, 0x10090007,
592 	0x10090007, 0x10090006, 0x10090006, 0x10090005,
593 	0x10090005, 0x10090005, 0x10090005, 0x10090004,
594 	0x10090004, 0x10090004, 0x10090004, 0x10090003,
595 	0x10090003, 0x10090003, 0x10090003, 0x10090003,
596 	0x10090003, 0x10090002, 0x10090002, 0x10090002,
597 	0x10090002, 0x10090002, 0x10090002, 0x10090002,
598 	0x10090002, 0x10090002, 0x10090001, 0x10090001,
599 	0x10090001, 0x10090001, 0x10090001, 0x10090001,
600 };
601 
602 /**************************************************
603  * R/W ops.
604  **************************************************/
605 
606 u32 b43_httab_read(struct b43_wldev *dev, u32 offset)
607 {
608 	u32 type, value;
609 
610 	type = offset & B43_HTTAB_TYPEMASK;
611 	offset &= ~B43_HTTAB_TYPEMASK;
612 	B43_WARN_ON(offset > 0xFFFF);
613 
614 	switch (type) {
615 	case B43_HTTAB_8BIT:
616 		b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
617 		value = b43_phy_read(dev, B43_PHY_HT_TABLE_DATALO) & 0xFF;
618 		break;
619 	case B43_HTTAB_16BIT:
620 		b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
621 		value = b43_phy_read(dev, B43_PHY_HT_TABLE_DATALO);
622 		break;
623 	case B43_HTTAB_32BIT:
624 		b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
625 		value = b43_phy_read(dev, B43_PHY_HT_TABLE_DATAHI);
626 		value <<= 16;
627 		value |= b43_phy_read(dev, B43_PHY_HT_TABLE_DATALO);
628 		break;
629 	default:
630 		B43_WARN_ON(1);
631 		value = 0;
632 	}
633 
634 	return value;
635 }
636 
637 void b43_httab_read_bulk(struct b43_wldev *dev, u32 offset,
638 			 unsigned int nr_elements, void *_data)
639 {
640 	u32 type;
641 	u8 *data = _data;
642 	unsigned int i;
643 
644 	type = offset & B43_HTTAB_TYPEMASK;
645 	offset &= ~B43_HTTAB_TYPEMASK;
646 	B43_WARN_ON(offset > 0xFFFF);
647 
648 	b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
649 
650 	for (i = 0; i < nr_elements; i++) {
651 		switch (type) {
652 		case B43_HTTAB_8BIT:
653 			*data = b43_phy_read(dev, B43_PHY_HT_TABLE_DATALO) & 0xFF;
654 			data++;
655 			break;
656 		case B43_HTTAB_16BIT:
657 			*((u16 *)data) = b43_phy_read(dev, B43_PHY_HT_TABLE_DATALO);
658 			data += 2;
659 			break;
660 		case B43_HTTAB_32BIT:
661 			*((u32 *)data) = b43_phy_read(dev, B43_PHY_HT_TABLE_DATAHI);
662 			*((u32 *)data) <<= 16;
663 			*((u32 *)data) |= b43_phy_read(dev, B43_PHY_HT_TABLE_DATALO);
664 			data += 4;
665 			break;
666 		default:
667 			B43_WARN_ON(1);
668 		}
669 	}
670 }
671 
672 void b43_httab_write(struct b43_wldev *dev, u32 offset, u32 value)
673 {
674 	u32 type;
675 
676 	type = offset & B43_HTTAB_TYPEMASK;
677 	offset &= 0xFFFF;
678 
679 	switch (type) {
680 	case B43_HTTAB_8BIT:
681 		B43_WARN_ON(value & ~0xFF);
682 		b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
683 		b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value);
684 		break;
685 	case B43_HTTAB_16BIT:
686 		B43_WARN_ON(value & ~0xFFFF);
687 		b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
688 		b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value);
689 		break;
690 	case B43_HTTAB_32BIT:
691 		b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
692 		b43_phy_write(dev, B43_PHY_HT_TABLE_DATAHI, value >> 16);
693 		b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value & 0xFFFF);
694 		break;
695 	default:
696 		B43_WARN_ON(1);
697 	}
698 
699 	return;
700 }
701 
702 void b43_httab_write_few(struct b43_wldev *dev, u32 offset, size_t num, ...)
703 {
704 	va_list args;
705 	u32 type, value;
706 	unsigned int i;
707 
708 	type = offset & B43_HTTAB_TYPEMASK;
709 	offset &= 0xFFFF;
710 
711 	va_start(args, num);
712 	switch (type) {
713 	case B43_HTTAB_8BIT:
714 		b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
715 		for (i = 0; i < num; i++) {
716 			value = va_arg(args, int);
717 			B43_WARN_ON(value & ~0xFF);
718 			b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value);
719 		}
720 		break;
721 	case B43_HTTAB_16BIT:
722 		b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
723 		for (i = 0; i < num; i++) {
724 			value = va_arg(args, int);
725 			B43_WARN_ON(value & ~0xFFFF);
726 			b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value);
727 		}
728 		break;
729 	case B43_HTTAB_32BIT:
730 		b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
731 		for (i = 0; i < num; i++) {
732 			value = va_arg(args, int);
733 			b43_phy_write(dev, B43_PHY_HT_TABLE_DATAHI,
734 				      value >> 16);
735 			b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO,
736 				      value & 0xFFFF);
737 		}
738 		break;
739 	default:
740 		B43_WARN_ON(1);
741 	}
742 	va_end(args);
743 
744 	return;
745 }
746 
747 void b43_httab_write_bulk(struct b43_wldev *dev, u32 offset,
748 			  unsigned int nr_elements, const void *_data)
749 {
750 	u32 type, value;
751 	const u8 *data = _data;
752 	unsigned int i;
753 
754 	type = offset & B43_HTTAB_TYPEMASK;
755 	offset &= ~B43_HTTAB_TYPEMASK;
756 	B43_WARN_ON(offset > 0xFFFF);
757 
758 	b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
759 
760 	for (i = 0; i < nr_elements; i++) {
761 		switch (type) {
762 		case B43_HTTAB_8BIT:
763 			value = *data;
764 			data++;
765 			B43_WARN_ON(value & ~0xFF);
766 			b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value);
767 			break;
768 		case B43_HTTAB_16BIT:
769 			value = *((u16 *)data);
770 			data += 2;
771 			B43_WARN_ON(value & ~0xFFFF);
772 			b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value);
773 			break;
774 		case B43_HTTAB_32BIT:
775 			value = *((u32 *)data);
776 			data += 4;
777 			b43_phy_write(dev, B43_PHY_HT_TABLE_DATAHI, value >> 16);
778 			b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO,
779 					value & 0xFFFF);
780 			break;
781 		default:
782 			B43_WARN_ON(1);
783 		}
784 	}
785 }
786 
787 /**************************************************
788  * Tables ops.
789  **************************************************/
790 
791 #define httab_upload(dev, offset, data) do { \
792 		b43_httab_write_bulk(dev, offset, ARRAY_SIZE(data), data); \
793 	} while (0)
794 void b43_phy_ht_tables_init(struct b43_wldev *dev)
795 {
796 	BUILD_BUG_ON(ARRAY_SIZE(b43_httab_0x1a_0xc0_late) !=
797 			B43_HTTAB_1A_C0_LATE_SIZE);
798 
799 	httab_upload(dev, B43_HTTAB16(0x12, 0), b43_httab_0x12);
800 	httab_upload(dev, B43_HTTAB16(0x27, 0), b43_httab_0x27);
801 	httab_upload(dev, B43_HTTAB16(0x26, 0), b43_httab_0x26);
802 	httab_upload(dev, B43_HTTAB32(0x25, 0), b43_httab_0x25);
803 	httab_upload(dev, B43_HTTAB32(0x2f, 0), b43_httab_0x2f);
804 	httab_upload(dev, B43_HTTAB16(0x1a, 0), b43_httab_0x1a);
805 	httab_upload(dev, B43_HTTAB16(0x1b, 0), b43_httab_0x1b);
806 	httab_upload(dev, B43_HTTAB16(0x1c, 0), b43_httab_0x1c);
807 	httab_upload(dev, B43_HTTAB32(0x1a, 0x0c0), b43_httab_0x1a_0xc0);
808 	httab_upload(dev, B43_HTTAB32(0x1a, 0x140), b43_httab_0x1a_0x140);
809 	httab_upload(dev, B43_HTTAB32(0x1b, 0x140), b43_httab_0x1b_0x140);
810 	httab_upload(dev, B43_HTTAB32(0x1c, 0x140), b43_httab_0x1c_0x140);
811 	httab_upload(dev, B43_HTTAB16(0x1a, 0x1c0), b43_httab_0x1a_0x1c0);
812 	httab_upload(dev, B43_HTTAB16(0x1b, 0x1c0), b43_httab_0x1b_0x1c0);
813 	httab_upload(dev, B43_HTTAB16(0x1c, 0x1c0), b43_httab_0x1c_0x1c0);
814 	httab_upload(dev, B43_HTTAB16(0x1a, 0x240), b43_httab_0x1a_0x240);
815 	httab_upload(dev, B43_HTTAB16(0x1b, 0x240), b43_httab_0x1b_0x240);
816 	httab_upload(dev, B43_HTTAB16(0x1c, 0x240), b43_httab_0x1c_0x240);
817 	httab_upload(dev, B43_HTTAB32(0x1f, 0), b43_httab_0x1f);
818 	httab_upload(dev, B43_HTTAB32(0x21, 0), b43_httab_0x21);
819 	httab_upload(dev, B43_HTTAB32(0x23, 0), b43_httab_0x23);
820 	httab_upload(dev, B43_HTTAB32(0x20, 0), b43_httab_0x20);
821 	httab_upload(dev, B43_HTTAB32(0x22, 0), b43_httab_0x22);
822 	httab_upload(dev, B43_HTTAB32(0x24, 0), b43_httab_0x24);
823 }
824