aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2011-08-14 19:23:09 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-08-24 14:41:42 -0400
commitba2d00e816a11b532e0c035e5cf7b9311e72ac00 (patch)
treeb052c713cbbbb828fc7e96426fc1630c17c3a0ee /drivers/net
parent7ed88528884bd477bddef367e8676b9e5ff99668 (diff)
b43: LCN-PHY: add init tables
They were taken from MMIO dump with few RegExps and vim. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/b43/phy_lcn.h3
-rw-r--r--drivers/net/wireless/b43/tables_phy_lcn.c432
-rw-r--r--drivers/net/wireless/b43/tables_phy_lcn.h16
3 files changed, 451 insertions, 0 deletions
diff --git a/drivers/net/wireless/b43/phy_lcn.h b/drivers/net/wireless/b43/phy_lcn.h
index 371e07d2be3b..25f06e8d4531 100644
--- a/drivers/net/wireless/b43/phy_lcn.h
+++ b/drivers/net/wireless/b43/phy_lcn.h
@@ -8,6 +8,9 @@
8#define B43_PHY_LCN_AFE_CTL2 B43_PHY_OFDM(0x03C) 8#define B43_PHY_LCN_AFE_CTL2 B43_PHY_OFDM(0x03C)
9#define B43_PHY_LCN_RF_CTL1 B43_PHY_OFDM(0x04C) 9#define B43_PHY_LCN_RF_CTL1 B43_PHY_OFDM(0x04C)
10#define B43_PHY_LCN_RF_CTL2 B43_PHY_OFDM(0x04D) 10#define B43_PHY_LCN_RF_CTL2 B43_PHY_OFDM(0x04D)
11#define B43_PHY_LCN_TABLE_ADDR B43_PHY_OFDM(0x055) /* Table address */
12#define B43_PHY_LCN_TABLE_DATALO B43_PHY_OFDM(0x056) /* Table data low */
13#define B43_PHY_LCN_TABLE_DATAHI B43_PHY_OFDM(0x057) /* Table data high */
11#define B43_PHY_LCN_RF_CTL3 B43_PHY_OFDM(0x0B0) 14#define B43_PHY_LCN_RF_CTL3 B43_PHY_OFDM(0x0B0)
12#define B43_PHY_LCN_RF_CTL4 B43_PHY_OFDM(0x0B1) 15#define B43_PHY_LCN_RF_CTL4 B43_PHY_OFDM(0x0B1)
13#define B43_PHY_LCN_RF_CTL5 B43_PHY_OFDM(0x0B7) 16#define B43_PHY_LCN_RF_CTL5 B43_PHY_OFDM(0x0B7)
diff --git a/drivers/net/wireless/b43/tables_phy_lcn.c b/drivers/net/wireless/b43/tables_phy_lcn.c
index 40c1d0915dd3..0a5842808a78 100644
--- a/drivers/net/wireless/b43/tables_phy_lcn.c
+++ b/drivers/net/wireless/b43/tables_phy_lcn.c
@@ -25,10 +25,442 @@
25#include "phy_common.h" 25#include "phy_common.h"
26#include "phy_lcn.h" 26#include "phy_lcn.h"
27 27
28static const u16 b43_lcntab_0x02[] = {
29 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d,
30 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d,
31 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d,
32 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d,
33 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d,
34 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d,
35 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d,
36 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d,
37 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d,
38 0x014d, 0x014d, 0x014d, 0x014d, 0x014d, 0x014d,
39 0x014d, 0x014d, 0x014d, 0x014d,
40};
41
42static const u16 b43_lcntab_0x01[] = {
43 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
44 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
45 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
46 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
47 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
48 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
49 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
50 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
51 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
52 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
53 0x0000, 0x0000, 0x0000, 0x0000,
54};
55
56static const u32 b43_lcntab_0x0b[] = {
57 0x000141f8, 0x000021f8, 0x000021fb, 0x000041fb,
58 0x0001fedb, 0x0000217b, 0x00002133, 0x000040eb,
59 0x0001fea3, 0x0000024b,
60};
61
62static const u32 b43_lcntab_0x0c[] = {
63 0x00100001, 0x00200010, 0x00300001, 0x00400010,
64 0x00500022, 0x00600122, 0x00700222, 0x00800322,
65 0x00900422, 0x00a00522, 0x00b00622, 0x00c00722,
66 0x00d00822, 0x00f00922, 0x00100a22, 0x00200b22,
67 0x00300c22, 0x00400d22, 0x00500e22, 0x00600f22,
68};
69
70static const u32 b43_lcntab_0x0d[] = {
71 0x00000000, 0x00000000, 0x10000000, 0x00000000,
72 0x20000000, 0x00000000, 0x30000000, 0x00000000,
73 0x40000000, 0x00000000, 0x50000000, 0x00000000,
74 0x60000000, 0x00000000, 0x70000000, 0x00000000,
75 0x80000000, 0x00000000, 0x90000000, 0x00000008,
76 0xa0000000, 0x00000008, 0xb0000000, 0x00000008,
77 0xc0000000, 0x00000008, 0xd0000000, 0x00000008,
78 0xe0000000, 0x00000008, 0xf0000000, 0x00000008,
79 0x00000000, 0x00000009, 0x10000000, 0x00000009,
80 0x20000000, 0x00000019, 0x30000000, 0x00000019,
81 0x40000000, 0x00000019, 0x50000000, 0x00000019,
82 0x60000000, 0x00000019, 0x70000000, 0x00000019,
83 0x80000000, 0x00000019, 0x90000000, 0x00000019,
84 0xa0000000, 0x00000019, 0xb0000000, 0x00000019,
85 0xc0000000, 0x00000019, 0xd0000000, 0x00000019,
86 0xe0000000, 0x00000019, 0xf0000000, 0x00000019,
87 0x00000000, 0x0000001a, 0x10000000, 0x0000001a,
88 0x20000000, 0x0000001a, 0x30000000, 0x0000001a,
89 0x40000000, 0x0000001a, 0x50000000, 0x00000002,
90 0x60000000, 0x00000002, 0x70000000, 0x00000002,
91 0x80000000, 0x00000002, 0x90000000, 0x00000002,
92 0xa0000000, 0x00000002, 0xb0000000, 0x00000002,
93 0xc0000000, 0x0000000a, 0xd0000000, 0x0000000a,
94 0xe0000000, 0x0000000a, 0xf0000000, 0x0000000a,
95 0x00000000, 0x0000000b, 0x10000000, 0x0000000b,
96 0x20000000, 0x0000000b, 0x30000000, 0x0000000b,
97 0x40000000, 0x0000000b, 0x50000000, 0x0000001b,
98 0x60000000, 0x0000001b, 0x70000000, 0x0000001b,
99 0x80000000, 0x0000001b, 0x90000000, 0x0000001b,
100 0xa0000000, 0x0000001b, 0xb0000000, 0x0000001b,
101 0xc0000000, 0x0000001b, 0xd0000000, 0x0000001b,
102 0xe0000000, 0x0000001b, 0xf0000000, 0x0000001b,
103 0x00000000, 0x0000001c, 0x10000000, 0x0000001c,
104 0x20000000, 0x0000001c, 0x30000000, 0x0000001c,
105 0x40000000, 0x0000001c, 0x50000000, 0x0000001c,
106 0x60000000, 0x0000001c, 0x70000000, 0x0000001c,
107 0x80000000, 0x0000001c, 0x90000000, 0x0000001c,
108};
109
110static const u16 b43_lcntab_0x0e[] = {
111 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406,
112 0x0407, 0x0408, 0x0409, 0x040a, 0x058b, 0x058c,
113 0x058d, 0x058e, 0x058f, 0x0090, 0x0091, 0x0092,
114 0x0193, 0x0194, 0x0195, 0x0196, 0x0197, 0x0198,
115 0x0199, 0x019a, 0x019b, 0x019c, 0x019d, 0x019e,
116 0x019f, 0x01a0, 0x01a1, 0x01a2, 0x01a3, 0x01a4,
117 0x01a5, 0x0000,
118};
119
120static const u16 b43_lcntab_0x0f[] = {
121 0x000a, 0x0009, 0x0006, 0x0005, 0x000a, 0x0009,
122 0x0006, 0x0005, 0x000a, 0x0009, 0x0006, 0x0005,
123 0x000a, 0x0009, 0x0006, 0x0005, 0x000a, 0x0009,
124 0x0006, 0x0005, 0x000a, 0x0009, 0x0006, 0x0005,
125 0x000a, 0x0009, 0x0006, 0x0005, 0x000a, 0x0009,
126 0x0006, 0x0005, 0x000a, 0x0009, 0x0006, 0x0005,
127 0x000a, 0x0009, 0x0006, 0x0005, 0x000a, 0x0009,
128 0x0006, 0x0005, 0x000a, 0x0009, 0x0006, 0x0005,
129 0x000a, 0x0009, 0x0006, 0x0005, 0x000a, 0x0009,
130 0x0006, 0x0005, 0x000a, 0x0009, 0x0006, 0x0005,
131 0x000a, 0x0009, 0x0006, 0x0005,
132};
133
134static const u16 b43_lcntab_0x10[] = {
135 0x005f, 0x0036, 0x0029, 0x001f, 0x005f, 0x0036,
136 0x0029, 0x001f, 0x005f, 0x0036, 0x0029, 0x001f,
137 0x005f, 0x0036, 0x0029, 0x001f,
138};
139
140static const u16 b43_lcntab_0x11[] = {
141 0x0009, 0x000f, 0x0014, 0x0018, 0x00fe, 0x0007,
142 0x000b, 0x000f, 0x00fb, 0x00fe, 0x0001, 0x0005,
143 0x0008, 0x000b, 0x000e, 0x0011, 0x0014, 0x0017,
144 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
145 0x0000, 0x0003, 0x0006, 0x0009, 0x000c, 0x000f,
146 0x0012, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
147 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0003,
148 0x0006, 0x0009, 0x000c, 0x000f, 0x0012, 0x0015,
149 0x0018, 0x001b, 0x0000, 0x0000, 0x0000, 0x0000,
150 0x0000, 0x0000, 0x0003, 0x00eb, 0x0000, 0x0000,
151};
152
153static const u32 b43_lcntab_0x12[] = {
154 0x00000000, 0x00000000, 0x00000000, 0x00000000,
155 0x00000000, 0x00000000, 0x00000000, 0x00000000,
156 0x00000004, 0x00000000, 0x00000004, 0x00000008,
157 0x00000001, 0x00000005, 0x00000009, 0x0000000d,
158 0x0000004d, 0x0000008d, 0x0000000d, 0x0000004d,
159 0x0000008d, 0x000000cd, 0x0000004f, 0x0000008f,
160 0x000000cf, 0x000000d3, 0x00000113, 0x00000513,
161 0x00000913, 0x00000953, 0x00000d53, 0x00001153,
162 0x00001193, 0x00005193, 0x00009193, 0x0000d193,
163 0x00011193, 0x00000000, 0x00000000, 0x00000000,
164 0x00000000, 0x00000000, 0x00000000, 0x00000004,
165 0x00000000, 0x00000004, 0x00000008, 0x00000001,
166 0x00000005, 0x00000009, 0x0000000d, 0x0000004d,
167 0x0000008d, 0x0000000d, 0x0000004d, 0x0000008d,
168 0x000000cd, 0x0000004f, 0x0000008f, 0x000000cf,
169 0x000000d3, 0x00000113, 0x00000513, 0x00000913,
170 0x00000953, 0x00000d53, 0x00001153, 0x00005153,
171 0x00009153, 0x0000d153, 0x00011153, 0x00015153,
172 0x00019153, 0x0001d153, 0x00000000, 0x00000000,
173 0x00000000, 0x00000000, 0x00000000, 0x00000000,
174 0x00000000, 0x00000000, 0x00000000, 0x00000000,
175 0x00000000, 0x00000000, 0x00000000, 0x00000000,
176 0x00000000, 0x00000000, 0x00000000, 0x00000000,
177 0x00000000, 0x00000000, 0x00000000, 0x00000000,
178};
179
180static const u16 b43_lcntab_0x14[] = {
181 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
182 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
183 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
184 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
185 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
186 0x0002, 0x0003, 0x0001, 0x0003, 0x0002, 0x0001,
187 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
188 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
189 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
190 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
191 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
192 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
193 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
194 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
195 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
196 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0003,
197 0x0001, 0x0003, 0x0002, 0x0001, 0x0001, 0x0001,
198 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
199 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
200 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
201 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
202 0x0001, 0x0001,
203};
204
205static const u16 b43_lcntab_0x17[] = {
206 0x001a, 0x0034, 0x004e, 0x0068, 0x009c, 0x00d0,
207 0x00ea, 0x0104, 0x0034, 0x0068, 0x009c, 0x00d0,
208 0x0138, 0x01a0, 0x01d4, 0x0208, 0x004e, 0x009c,
209 0x00ea, 0x0138, 0x01d4, 0x0270, 0x02be, 0x030c,
210 0x0068, 0x00d0, 0x0138, 0x01a0, 0x0270, 0x0340,
211 0x03a8, 0x0410, 0x0018, 0x009c, 0x00d0, 0x0104,
212 0x00ea, 0x0138, 0x0186, 0x00d0, 0x0104, 0x0104,
213 0x0138, 0x016c, 0x016c, 0x01a0, 0x0138, 0x0186,
214 0x0186, 0x01d4, 0x0222, 0x0222, 0x0270, 0x0104,
215 0x0138, 0x016c, 0x0138, 0x016c, 0x01a0, 0x01d4,
216 0x01a0, 0x01d4, 0x0208, 0x0208, 0x023c, 0x0186,
217 0x01d4, 0x0222, 0x01d4, 0x0222, 0x0270, 0x02be,
218 0x0270, 0x02be, 0x030c, 0x030c, 0x035a, 0x0036,
219 0x006c, 0x00a2, 0x00d8, 0x0144, 0x01b0, 0x01e6,
220 0x021c, 0x006c, 0x00d8, 0x0144, 0x01b0, 0x0288,
221 0x0360, 0x03cc, 0x0438, 0x00a2, 0x0144, 0x01e6,
222 0x0288, 0x03cc, 0x0510, 0x05b2, 0x0654, 0x00d8,
223 0x01b0, 0x0288, 0x0360, 0x0510, 0x06c0, 0x0798,
224 0x0870, 0x0018, 0x0144, 0x01b0, 0x021c, 0x01e6,
225 0x0288, 0x032a, 0x01b0, 0x021c, 0x021c, 0x0288,
226 0x02f4, 0x02f4, 0x0360, 0x0288, 0x032a, 0x032a,
227 0x03cc, 0x046e, 0x046e, 0x0510, 0x021c, 0x0288,
228 0x02f4, 0x0288, 0x02f4, 0x0360, 0x03cc, 0x0360,
229 0x03cc, 0x0438, 0x0438, 0x04a4, 0x032a, 0x03cc,
230 0x046e, 0x03cc, 0x046e, 0x0510, 0x05b2, 0x0510,
231 0x05b2, 0x0654, 0x0654, 0x06f6,
232};
233
234static const u16 b43_lcntab_0x00[] = {
235 0x0200, 0x0300, 0x0400, 0x0600, 0x0800, 0x0b00,
236 0x1000, 0x1001, 0x1002, 0x1003, 0x1004, 0x1005,
237 0x1006, 0x1007, 0x1707, 0x2007, 0x2d07, 0x4007,
238 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
239 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
240 0x0000, 0x0000, 0x0200, 0x0300, 0x0400, 0x0600,
241 0x0800, 0x0b00, 0x1000, 0x1001, 0x1002, 0x1003,
242 0x1004, 0x1005, 0x1006, 0x1007, 0x1707, 0x2007,
243 0x2d07, 0x4007, 0x0000, 0x0000, 0x0000, 0x0000,
244 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
245 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
246 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
247 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
248 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
249 0x0000, 0x0000, 0x0000, 0x4000, 0x0000, 0x0000,
250 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
251 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
252 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
253};
254
255static const u32 b43_lcntab_0x18[] = {
256 0x00080000, 0x00080000, 0x00080000, 0x00080000,
257 0x00080000, 0x00080000, 0x00080000, 0x00080000,
258 0x00080000, 0x00080000, 0x00080000, 0x00080000,
259 0x00080000, 0x00080000, 0x00080000, 0x00080000,
260 0x00080000, 0x00080000, 0x00080000, 0x00080000,
261 0x00080000, 0x00080000, 0x00080000, 0x00080000,
262 0x00080000, 0x00080000, 0x00080000, 0x00080000,
263 0x00080000, 0x00080000, 0x00080000, 0x00080000,
264 0x00080000, 0x00080000, 0x00080000, 0x00080000,
265 0x00080000, 0x00080000, 0x00080000, 0x00080000,
266 0x00080000, 0x00080000, 0x00080000, 0x00080000,
267 0x00080000, 0x00080000, 0x00080000, 0x00080000,
268 0x00080000, 0x00080000, 0x00080000, 0x00080000,
269 0x00080000, 0x00080000, 0x00080000, 0x00080000,
270 0x00080000, 0x00080000, 0x00080000, 0x00080000,
271 0x00080000, 0x00080000, 0x00080000, 0x00080000,
272 0x00080000, 0x00080000, 0x00080000, 0x00080000,
273 0x00080000, 0x00080000, 0x00080000, 0x00080000,
274 0x00080000, 0x00080000, 0x00080000, 0x00080000,
275 0x00080000, 0x00080000, 0x00080000, 0x00080000,
276 0x00080000, 0x00080000, 0x00080000, 0x00080000,
277 0x00080000, 0x00080000, 0x00080000, 0x00080000,
278 0x00080000, 0x00080000, 0x00080000, 0x00080000,
279 0x00080000, 0x00080000, 0x00080000, 0x00080000,
280 0x00080000, 0x00080000, 0x00080000, 0x00080000,
281 0x00080000, 0x00080000, 0x00080000, 0x00080000,
282 0x00080000, 0x00080000, 0x00080000, 0x00080000,
283 0x00080000, 0x00080000, 0x00080000, 0x00080000,
284 0x00080000, 0x00080000, 0x00080000, 0x00080000,
285 0x00080000, 0x00080000, 0x00080000, 0x00080000,
286 0x00080000, 0x00080000, 0x00080000, 0x00080000,
287 0x00080000, 0x00080000, 0x00080000, 0x00080000,
288 0x00080000, 0x00080000, 0x00080000, 0x00080000,
289 0x00080000, 0x00080000, 0x00080000, 0x00080000,
290 0x00080000, 0x00080000, 0x00080000, 0x00080000,
291 0x00080000, 0x00080000, 0x00080000, 0x00080000,
292 0x00080000, 0x00080000, 0x00080000, 0x00080000,
293 0x00080000, 0x00080000, 0x00080000, 0x00080000,
294 0x00080000, 0x00080000, 0x00080000, 0x00080000,
295 0x00080000, 0x00080000, 0x00080000, 0x00080000,
296};
297
298/**************************************************
299 * R/W ops.
300 **************************************************/
301
302u32 b43_lcntab_read(struct b43_wldev *dev, u32 offset)
303{
304 u32 type, value;
305
306 type = offset & B43_LCNTAB_TYPEMASK;
307 offset &= ~B43_LCNTAB_TYPEMASK;
308 B43_WARN_ON(offset > 0xFFFF);
309
310 switch (type) {
311 case B43_LCNTAB_8BIT:
312 b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, offset);
313 value = b43_phy_read(dev, B43_PHY_LCN_TABLE_DATALO) & 0xFF;
314 break;
315 case B43_LCNTAB_16BIT:
316 b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, offset);
317 value = b43_phy_read(dev, B43_PHY_LCN_TABLE_DATALO);
318 break;
319 case B43_LCNTAB_32BIT:
320 b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, offset);
321 value = b43_phy_read(dev, B43_PHY_LCN_TABLE_DATAHI);
322 value <<= 16;
323 value |= b43_phy_read(dev, B43_PHY_LCN_TABLE_DATALO);
324 break;
325 default:
326 B43_WARN_ON(1);
327 value = 0;
328 }
329
330 return value;
331}
332
333void b43_lcntab_read_bulk(struct b43_wldev *dev, u32 offset,
334 unsigned int nr_elements, void *_data)
335{
336 u32 type;
337 u8 *data = _data;
338 unsigned int i;
339
340 type = offset & B43_LCNTAB_TYPEMASK;
341 offset &= ~B43_LCNTAB_TYPEMASK;
342 B43_WARN_ON(offset > 0xFFFF);
343
344 b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, offset);
345
346 for (i = 0; i < nr_elements; i++) {
347 switch (type) {
348 case B43_LCNTAB_8BIT:
349 *data = b43_phy_read(dev,
350 B43_PHY_LCN_TABLE_DATALO) & 0xFF;
351 data++;
352 break;
353 case B43_LCNTAB_16BIT:
354 *((u16 *)data) = b43_phy_read(dev,
355 B43_PHY_LCN_TABLE_DATALO);
356 data += 2;
357 break;
358 case B43_LCNTAB_32BIT:
359 *((u32 *)data) = b43_phy_read(dev,
360 B43_PHY_LCN_TABLE_DATAHI);
361 *((u32 *)data) <<= 16;
362 *((u32 *)data) |= b43_phy_read(dev,
363 B43_PHY_LCN_TABLE_DATALO);
364 data += 4;
365 break;
366 default:
367 B43_WARN_ON(1);
368 }
369 }
370}
371
372void b43_lcntab_write(struct b43_wldev *dev, u32 offset, u32 value)
373{
374 u32 type;
375
376 type = offset & B43_LCNTAB_TYPEMASK;
377 offset &= 0xFFFF;
378
379 switch (type) {
380 case B43_LCNTAB_8BIT:
381 B43_WARN_ON(value & ~0xFF);
382 b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, offset);
383 b43_phy_write(dev, B43_PHY_LCN_TABLE_DATALO, value);
384 break;
385 case B43_LCNTAB_16BIT:
386 B43_WARN_ON(value & ~0xFFFF);
387 b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, offset);
388 b43_phy_write(dev, B43_PHY_LCN_TABLE_DATALO, value);
389 break;
390 case B43_LCNTAB_32BIT:
391 b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, offset);
392 b43_phy_write(dev, B43_PHY_LCN_TABLE_DATAHI, value >> 16);
393 b43_phy_write(dev, B43_PHY_LCN_TABLE_DATALO, value & 0xFFFF);
394 break;
395 default:
396 B43_WARN_ON(1);
397 }
398
399 return;
400}
401
402void b43_lcntab_write_bulk(struct b43_wldev *dev, u32 offset,
403 unsigned int nr_elements, const void *_data)
404{
405 u32 type, value;
406 const u8 *data = _data;
407 unsigned int i;
408
409 type = offset & B43_LCNTAB_TYPEMASK;
410 offset &= ~B43_LCNTAB_TYPEMASK;
411 B43_WARN_ON(offset > 0xFFFF);
412
413 b43_phy_write(dev, B43_PHY_LCN_TABLE_ADDR, offset);
414
415 for (i = 0; i < nr_elements; i++) {
416 switch (type) {
417 case B43_LCNTAB_8BIT:
418 value = *data;
419 data++;
420 B43_WARN_ON(value & ~0xFF);
421 b43_phy_write(dev, B43_PHY_LCN_TABLE_DATALO, value);
422 break;
423 case B43_LCNTAB_16BIT:
424 value = *((u16 *)data);
425 data += 2;
426 B43_WARN_ON(value & ~0xFFFF);
427 b43_phy_write(dev, B43_PHY_LCN_TABLE_DATALO, value);
428 break;
429 case B43_LCNTAB_32BIT:
430 value = *((u32 *)data);
431 data += 4;
432 b43_phy_write(dev, B43_PHY_LCN_TABLE_DATAHI,
433 value >> 16);
434 b43_phy_write(dev, B43_PHY_LCN_TABLE_DATALO,
435 value & 0xFFFF);
436 break;
437 default:
438 B43_WARN_ON(1);
439 }
440 }
441}
442
28/************************************************** 443/**************************************************
29 * Tables ops. 444 * Tables ops.
30 **************************************************/ 445 **************************************************/
31 446
447#define lcntab_upload(dev, offset, data) do { \
448 b43_lcntab_write_bulk(dev, offset, ARRAY_SIZE(data), data); \
449 } while (0)
32void b43_phy_lcn_tables_init(struct b43_wldev *dev) 450void b43_phy_lcn_tables_init(struct b43_wldev *dev)
33{ 451{
452 lcntab_upload(dev, B43_LCNTAB16(0x02, 0), b43_lcntab_0x02);
453 lcntab_upload(dev, B43_LCNTAB16(0x01, 0), b43_lcntab_0x01);
454 lcntab_upload(dev, B43_LCNTAB32(0x0b, 0), b43_lcntab_0x0b);
455 lcntab_upload(dev, B43_LCNTAB32(0x0c, 0), b43_lcntab_0x0c);
456 lcntab_upload(dev, B43_LCNTAB32(0x0d, 0), b43_lcntab_0x0d);
457 lcntab_upload(dev, B43_LCNTAB16(0x0e, 0), b43_lcntab_0x0e);
458 lcntab_upload(dev, B43_LCNTAB16(0x0f, 0), b43_lcntab_0x0f);
459 lcntab_upload(dev, B43_LCNTAB16(0x10, 0), b43_lcntab_0x10);
460 lcntab_upload(dev, B43_LCNTAB16(0x11, 0), b43_lcntab_0x11);
461 lcntab_upload(dev, B43_LCNTAB32(0x12, 0), b43_lcntab_0x12);
462 lcntab_upload(dev, B43_LCNTAB16(0x14, 0), b43_lcntab_0x14);
463 lcntab_upload(dev, B43_LCNTAB16(0x17, 0), b43_lcntab_0x17);
464 lcntab_upload(dev, B43_LCNTAB16(0x00, 0), b43_lcntab_0x00);
465 lcntab_upload(dev, B43_LCNTAB32(0x18, 0), b43_lcntab_0x18);
34} 466}
diff --git a/drivers/net/wireless/b43/tables_phy_lcn.h b/drivers/net/wireless/b43/tables_phy_lcn.h
index 5e31b15b81ec..b6471e89c36f 100644
--- a/drivers/net/wireless/b43/tables_phy_lcn.h
+++ b/drivers/net/wireless/b43/tables_phy_lcn.h
@@ -1,6 +1,22 @@
1#ifndef B43_TABLES_PHY_LCN_H_ 1#ifndef B43_TABLES_PHY_LCN_H_
2#define B43_TABLES_PHY_LCN_H_ 2#define B43_TABLES_PHY_LCN_H_
3 3
4/* The LCN-PHY tables. */
5#define B43_LCNTAB_TYPEMASK 0xF0000000
6#define B43_LCNTAB_8BIT 0x10000000
7#define B43_LCNTAB_16BIT 0x20000000
8#define B43_LCNTAB_32BIT 0x30000000
9#define B43_LCNTAB8(table, offset) (((table) << 10) | (offset) | B43_LCNTAB_8BIT)
10#define B43_LCNTAB16(table, offset) (((table) << 10) | (offset) | B43_LCNTAB_16BIT)
11#define B43_LCNTAB32(table, offset) (((table) << 10) | (offset) | B43_LCNTAB_32BIT)
12
13u32 b43_lcntab_read(struct b43_wldev *dev, u32 offset);
14void b43_lcntab_read_bulk(struct b43_wldev *dev, u32 offset,
15 unsigned int nr_elements, void *_data);
16void b43_lcntab_write(struct b43_wldev *dev, u32 offset, u32 value);
17void b43_lcntab_write_bulk(struct b43_wldev *dev, u32 offset,
18 unsigned int nr_elements, const void *_data);
19
4void b43_phy_lcn_tables_init(struct b43_wldev *dev); 20void b43_phy_lcn_tables_init(struct b43_wldev *dev);
5 21
6#endif /* B43_TABLES_PHY_LCN_H_ */ 22#endif /* B43_TABLES_PHY_LCN_H_ */