aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDaniel Drake <dsd@gentoo.org>2007-03-11 15:54:28 -0400
committerJeff Garzik <jeff@garzik.org>2007-04-28 11:00:59 -0400
commitf2a81a161d5089fe838ec6c4c7b6357f25aeacbe (patch)
tree89b0dc929eb29012802fd93987c9167ef3612281 /drivers/net
parent832855dc5a9beb78644d6163f94eccf2094bf30d (diff)
[PATCH] zd1211rw: Add AL2230S RF support
ZD1211 appears to be back in production: a number of new devices have been appearing! Some of them are using new radios. This patch adds support for the next generation AL2230 RF chip which has been spotted in a few new devices. Signed-off-by: Daniel Drake <dsd@gentoo.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.c5
-rw-r--r--drivers/net/wireless/zd1211rw/zd_rf.c2
-rw-r--r--drivers/net/wireless/zd1211rw/zd_rf.h2
-rw-r--r--drivers/net/wireless/zd1211rw/zd_rf_al2230.c89
4 files changed, 78 insertions, 20 deletions
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
index 680a1781a74c..8acaa6b64dd5 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/zd1211rw/zd_chip.c
@@ -67,11 +67,12 @@ static int scnprint_id(struct zd_chip *chip, char *buffer, size_t size)
67 i += scnprint_mac_oui(chip->e2p_mac, buffer+i, size-i); 67 i += scnprint_mac_oui(chip->e2p_mac, buffer+i, size-i);
68 i += scnprintf(buffer+i, size-i, " "); 68 i += scnprintf(buffer+i, size-i, " ");
69 i += zd_rf_scnprint_id(&chip->rf, buffer+i, size-i); 69 i += zd_rf_scnprint_id(&chip->rf, buffer+i, size-i);
70 i += scnprintf(buffer+i, size-i, " pa%1x %c%c%c%c", chip->pa_type, 70 i += scnprintf(buffer+i, size-i, " pa%1x %c%c%c%c%c", chip->pa_type,
71 chip->patch_cck_gain ? 'g' : '-', 71 chip->patch_cck_gain ? 'g' : '-',
72 chip->patch_cr157 ? '7' : '-', 72 chip->patch_cr157 ? '7' : '-',
73 chip->patch_6m_band_edge ? '6' : '-', 73 chip->patch_6m_band_edge ? '6' : '-',
74 chip->new_phy_layout ? 'N' : '-'); 74 chip->new_phy_layout ? 'N' : '-',
75 chip->al2230s_bit ? 'S' : '-');
75 return i; 76 return i;
76} 77}
77 78
diff --git a/drivers/net/wireless/zd1211rw/zd_rf.c b/drivers/net/wireless/zd1211rw/zd_rf.c
index f50cff3db916..e6d604b01dc2 100644
--- a/drivers/net/wireless/zd1211rw/zd_rf.c
+++ b/drivers/net/wireless/zd1211rw/zd_rf.c
@@ -34,7 +34,7 @@ static const char *rfs[] = {
34 [AL2210_RF] = "AL2210_RF", 34 [AL2210_RF] = "AL2210_RF",
35 [MAXIM_NEW_RF] = "MAXIM_NEW_RF", 35 [MAXIM_NEW_RF] = "MAXIM_NEW_RF",
36 [UW2453_RF] = "UW2453_RF", 36 [UW2453_RF] = "UW2453_RF",
37 [AL2230S_RF] = "AL2230S_RF", 37 [UNKNOWN_A_RF] = "UNKNOWN_A_RF",
38 [RALINK_RF] = "RALINK_RF", 38 [RALINK_RF] = "RALINK_RF",
39 [INTERSIL_RF] = "INTERSIL_RF", 39 [INTERSIL_RF] = "INTERSIL_RF",
40 [RF2959_RF] = "RF2959_RF", 40 [RF2959_RF] = "RF2959_RF",
diff --git a/drivers/net/wireless/zd1211rw/zd_rf.h b/drivers/net/wireless/zd1211rw/zd_rf.h
index a57732eb69e1..ee8ac3a95b9e 100644
--- a/drivers/net/wireless/zd1211rw/zd_rf.h
+++ b/drivers/net/wireless/zd1211rw/zd_rf.h
@@ -26,7 +26,7 @@
26#define AL2210_RF 0x7 26#define AL2210_RF 0x7
27#define MAXIM_NEW_RF 0x8 27#define MAXIM_NEW_RF 0x8
28#define UW2453_RF 0x9 28#define UW2453_RF 0x9
29#define AL2230S_RF 0xa 29#define UNKNOWN_A_RF 0xa
30#define RALINK_RF 0xb 30#define RALINK_RF 0xb
31#define INTERSIL_RF 0xc 31#define INTERSIL_RF 0xc
32#define RF2959_RF 0xd 32#define RF2959_RF 0xd
diff --git a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
index 5235a7827ac5..85a9ad2cf75b 100644
--- a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
+++ b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
@@ -59,6 +59,18 @@ static const struct zd_ioreq16 zd1211b_ioreqs_shared_1[] = {
59 { CR240, 0x57 }, { CR9, 0xe0 }, 59 { CR240, 0x57 }, { CR9, 0xe0 },
60}; 60};
61 61
62static const struct zd_ioreq16 ioreqs_init_al2230s[] = {
63 { CR47, 0x1e }, /* MARK_002 */
64 { CR106, 0x22 },
65 { CR107, 0x2a }, /* MARK_002 */
66 { CR109, 0x13 }, /* MARK_002 */
67 { CR118, 0xf8 }, /* MARK_002 */
68 { CR119, 0x12 }, { CR122, 0xe0 },
69 { CR128, 0x10 }, /* MARK_001 from 0xe->0x10 */
70 { CR129, 0x0e }, /* MARK_001 from 0xd->0x0e */
71 { CR130, 0x10 }, /* MARK_001 from 0xb->0x0d */
72};
73
62static int zd1211b_al2230_finalize_rf(struct zd_chip *chip) 74static int zd1211b_al2230_finalize_rf(struct zd_chip *chip)
63{ 75{
64 int r; 76 int r;
@@ -90,7 +102,7 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
90 int r; 102 int r;
91 struct zd_chip *chip = zd_rf_to_chip(rf); 103 struct zd_chip *chip = zd_rf_to_chip(rf);
92 104
93 static const struct zd_ioreq16 ioreqs[] = { 105 static const struct zd_ioreq16 ioreqs_init[] = {
94 { CR15, 0x20 }, { CR23, 0x40 }, { CR24, 0x20 }, 106 { CR15, 0x20 }, { CR23, 0x40 }, { CR24, 0x20 },
95 { CR26, 0x11 }, { CR28, 0x3e }, { CR29, 0x00 }, 107 { CR26, 0x11 }, { CR28, 0x3e }, { CR29, 0x00 },
96 { CR44, 0x33 }, { CR106, 0x2a }, { CR107, 0x1a }, 108 { CR44, 0x33 }, { CR106, 0x2a }, { CR107, 0x1a },
@@ -117,10 +129,9 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
117 { CR119, 0x10 }, { CR120, 0x4f }, { CR121, 0x77 }, 129 { CR119, 0x10 }, { CR120, 0x4f }, { CR121, 0x77 },
118 { CR122, 0xe0 }, { CR137, 0x88 }, { CR252, 0xff }, 130 { CR122, 0xe0 }, { CR137, 0x88 }, { CR252, 0xff },
119 { CR253, 0xff }, 131 { CR253, 0xff },
132 };
120 133
121 /* These following happen separately in the vendor driver */ 134 static const struct zd_ioreq16 ioreqs_pll[] = {
122 { },
123
124 /* shdnb(PLL_ON)=0 */ 135 /* shdnb(PLL_ON)=0 */
125 { CR251, 0x2f }, 136 { CR251, 0x2f },
126 /* shdnb(PLL_ON)=1 */ 137 /* shdnb(PLL_ON)=1 */
@@ -128,7 +139,7 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
128 { CR138, 0x28 }, { CR203, 0x06 }, 139 { CR138, 0x28 }, { CR203, 0x06 },
129 }; 140 };
130 141
131 static const u32 rv[] = { 142 static const u32 rv1[] = {
132 /* Channel 1 */ 143 /* Channel 1 */
133 0x03f790, 144 0x03f790,
134 0x033331, 145 0x033331,
@@ -137,6 +148,9 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
137 0x0b3331, 148 0x0b3331,
138 0x03b812, 149 0x03b812,
139 0x00fff3, 150 0x00fff3,
151 };
152
153 static const u32 rv2[] = {
140 0x000da4, 154 0x000da4,
141 0x0f4dc5, /* fix freq shift, 0x04edc5 */ 155 0x0f4dc5, /* fix freq shift, 0x04edc5 */
142 0x0805b6, 156 0x0805b6,
@@ -148,8 +162,9 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
148 0x0bdffc, 162 0x0bdffc,
149 0x00000d, 163 0x00000d,
150 0x00500f, 164 0x00500f,
165 };
151 166
152 /* These writes happen separately in the vendor driver */ 167 static const u32 rv3[] = {
153 0x00d00f, 168 0x00d00f,
154 0x004c0f, 169 0x004c0f,
155 0x00540f, 170 0x00540f,
@@ -157,11 +172,38 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
157 0x00500f, 172 0x00500f,
158 }; 173 };
159 174
160 r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); 175 r = zd_iowrite16a_locked(chip, ioreqs_init, ARRAY_SIZE(ioreqs_init));
161 if (r) 176 if (r)
162 return r; 177 return r;
163 178
164 r = zd_rfwritev_locked(chip, rv, ARRAY_SIZE(rv), RF_RV_BITS); 179 if (chip->al2230s_bit) {
180 r = zd_iowrite16a_locked(chip, ioreqs_init_al2230s,
181 ARRAY_SIZE(ioreqs_init_al2230s));
182 if (r)
183 return r;
184 }
185
186 r = zd_rfwritev_locked(chip, rv1, ARRAY_SIZE(rv1), RF_RV_BITS);
187 if (r)
188 return r;
189
190 /* improve band edge for AL2230S */
191 if (chip->al2230s_bit)
192 r = zd_rfwrite_locked(chip, 0x000824, RF_RV_BITS);
193 else
194 r = zd_rfwrite_locked(chip, 0x0005a4, RF_RV_BITS);
195 if (r)
196 return r;
197
198 r = zd_rfwritev_locked(chip, rv2, ARRAY_SIZE(rv2), RF_RV_BITS);
199 if (r)
200 return r;
201
202 r = zd_iowrite16a_locked(chip, ioreqs_pll, ARRAY_SIZE(ioreqs_pll));
203 if (r)
204 return r;
205
206 r = zd_rfwritev_locked(chip, rv3, ARRAY_SIZE(rv3), RF_RV_BITS);
165 if (r) 207 if (r)
166 return r; 208 return r;
167 209
@@ -227,7 +269,9 @@ static int zd1211b_al2230_init_hw(struct zd_rf *rf)
227 0x481dc0, 269 0x481dc0,
228 0xcfff00, 270 0xcfff00,
229 0x25a000, 271 0x25a000,
272 };
230 273
274 static const u32 rv2[] = {
231 /* To improve AL2230 yield, improve phase noise, 4713 */ 275 /* To improve AL2230 yield, improve phase noise, 4713 */
232 0x25a000, 276 0x25a000,
233 0xa3b2f0, 277 0xa3b2f0,
@@ -250,7 +294,7 @@ static int zd1211b_al2230_init_hw(struct zd_rf *rf)
250 { CR251, 0x7f }, /* shdnb(PLL_ON)=1 */ 294 { CR251, 0x7f }, /* shdnb(PLL_ON)=1 */
251 }; 295 };
252 296
253 static const u32 rv2[] = { 297 static const u32 rv3[] = {
254 /* To improve AL2230 yield, 4713 */ 298 /* To improve AL2230 yield, 4713 */
255 0xf01b00, 299 0xf01b00,
256 0xf01e00, 300 0xf01e00,
@@ -269,18 +313,37 @@ static int zd1211b_al2230_init_hw(struct zd_rf *rf)
269 r = zd_iowrite16a_locked(chip, ioreqs1, ARRAY_SIZE(ioreqs1)); 313 r = zd_iowrite16a_locked(chip, ioreqs1, ARRAY_SIZE(ioreqs1));
270 if (r) 314 if (r)
271 return r; 315 return r;
316
317 if (chip->al2230s_bit) {
318 r = zd_iowrite16a_locked(chip, ioreqs_init_al2230s,
319 ARRAY_SIZE(ioreqs_init_al2230s));
320 if (r)
321 return r;
322 }
323
272 r = zd_rfwritev_cr_locked(chip, zd1211b_al2230_table[0], 3); 324 r = zd_rfwritev_cr_locked(chip, zd1211b_al2230_table[0], 3);
273 if (r) 325 if (r)
274 return r; 326 return r;
275 r = zd_rfwritev_cr_locked(chip, rv1, ARRAY_SIZE(rv1)); 327 r = zd_rfwritev_cr_locked(chip, rv1, ARRAY_SIZE(rv1));
276 if (r) 328 if (r)
277 return r; 329 return r;
278 r = zd_iowrite16a_locked(chip, ioreqs2, ARRAY_SIZE(ioreqs2)); 330
331 if (chip->al2230s_bit)
332 r = zd_rfwrite_locked(chip, 0x241000, RF_RV_BITS);
333 else
334 r = zd_rfwrite_locked(chip, 0x25a000, RF_RV_BITS);
279 if (r) 335 if (r)
280 return r; 336 return r;
337
281 r = zd_rfwritev_cr_locked(chip, rv2, ARRAY_SIZE(rv2)); 338 r = zd_rfwritev_cr_locked(chip, rv2, ARRAY_SIZE(rv2));
282 if (r) 339 if (r)
283 return r; 340 return r;
341 r = zd_iowrite16a_locked(chip, ioreqs2, ARRAY_SIZE(ioreqs2));
342 if (r)
343 return r;
344 r = zd_rfwritev_cr_locked(chip, rv3, ARRAY_SIZE(rv3));
345 if (r)
346 return r;
284 r = zd_iowrite16a_locked(chip, ioreqs3, ARRAY_SIZE(ioreqs3)); 347 r = zd_iowrite16a_locked(chip, ioreqs3, ARRAY_SIZE(ioreqs3));
285 if (r) 348 if (r)
286 return r; 349 return r;
@@ -358,12 +421,6 @@ int zd_rf_init_al2230(struct zd_rf *rf)
358{ 421{
359 struct zd_chip *chip = zd_rf_to_chip(rf); 422 struct zd_chip *chip = zd_rf_to_chip(rf);
360 423
361 if (chip->al2230s_bit) {
362 dev_err(zd_chip_dev(chip), "AL2230S devices are not yet "
363 "supported by this driver.\n");
364 return -ENODEV;
365 }
366
367 rf->switch_radio_off = al2230_switch_radio_off; 424 rf->switch_radio_off = al2230_switch_radio_off;
368 if (chip->is_zd1211b) { 425 if (chip->is_zd1211b) {
369 rf->init_hw = zd1211b_al2230_init_hw; 426 rf->init_hw = zd1211b_al2230_init_hw;