/[linux-patches]/genpatches-2.6/trunk/2.6.21/4000_zd1211rw-al2230s.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.21/4000_zd1211rw-al2230s.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 954 - (show annotations) (download)
Thu May 17 01:52:41 2007 UTC (11 years, 5 months ago) by dsd
File size: 8103 byte(s)
Add support for AL2230S-based ZD1211 USB-WLAN devices
1 From: Daniel Drake <dsd@gentoo.org>
2 Date: Sun, 11 Mar 2007 19:54:28 +0000 (+0000)
3 Subject: [PATCH] zd1211rw: Add AL2230S RF support
4 X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=f2a81a161d5089fe838ec6c4c7b6357f25aeacbe
5
6 [PATCH] zd1211rw: Add AL2230S RF support
7
8 ZD1211 appears to be back in production: a number of new devices have
9 been appearing! Some of them are using new radios.
10
11 This patch adds support for the next generation AL2230 RF chip which has
12 been spotted in a few new devices.
13
14 [As this patch was too late for 2.6.21, the kernel was modified to reject
15 AL2230S devices because for me and others, the devices silently failed (and
16 this looked like a driver bug). After doing so, a few people reported that
17 AL2230S devices were working correctly for them even before AL2230S support was
18 present. I'd like to propose that we fix both situations by backporting
19 the AL2230S support into 2.6.21-stable]
20
21 Signed-off-by: Daniel Drake <dsd@gentoo.org>
22 Signed-off-by: John W. Linville <linville@tuxdriver.com>
23 ---
24
25 diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
26 index 680a178..8acaa6b 100644
27 --- a/drivers/net/wireless/zd1211rw/zd_chip.c
28 +++ b/drivers/net/wireless/zd1211rw/zd_chip.c
29 @@ -67,11 +67,12 @@ static int scnprint_id(struct zd_chip *chip, char *buffer, size_t size)
30 i += scnprint_mac_oui(chip->e2p_mac, buffer+i, size-i);
31 i += scnprintf(buffer+i, size-i, " ");
32 i += zd_rf_scnprint_id(&chip->rf, buffer+i, size-i);
33 - i += scnprintf(buffer+i, size-i, " pa%1x %c%c%c%c", chip->pa_type,
34 + i += scnprintf(buffer+i, size-i, " pa%1x %c%c%c%c%c", chip->pa_type,
35 chip->patch_cck_gain ? 'g' : '-',
36 chip->patch_cr157 ? '7' : '-',
37 chip->patch_6m_band_edge ? '6' : '-',
38 - chip->new_phy_layout ? 'N' : '-');
39 + chip->new_phy_layout ? 'N' : '-',
40 + chip->al2230s_bit ? 'S' : '-');
41 return i;
42 }
43
44 diff --git a/drivers/net/wireless/zd1211rw/zd_rf.c b/drivers/net/wireless/zd1211rw/zd_rf.c
45 index f50cff3..e6d604b 100644
46 --- a/drivers/net/wireless/zd1211rw/zd_rf.c
47 +++ b/drivers/net/wireless/zd1211rw/zd_rf.c
48 @@ -34,7 +34,7 @@ static const char *rfs[] = {
49 [AL2210_RF] = "AL2210_RF",
50 [MAXIM_NEW_RF] = "MAXIM_NEW_RF",
51 [UW2453_RF] = "UW2453_RF",
52 - [AL2230S_RF] = "AL2230S_RF",
53 + [UNKNOWN_A_RF] = "UNKNOWN_A_RF",
54 [RALINK_RF] = "RALINK_RF",
55 [INTERSIL_RF] = "INTERSIL_RF",
56 [RF2959_RF] = "RF2959_RF",
57 diff --git a/drivers/net/wireless/zd1211rw/zd_rf.h b/drivers/net/wireless/zd1211rw/zd_rf.h
58 index a57732e..ee8ac3a 100644
59 --- a/drivers/net/wireless/zd1211rw/zd_rf.h
60 +++ b/drivers/net/wireless/zd1211rw/zd_rf.h
61 @@ -26,7 +26,7 @@
62 #define AL2210_RF 0x7
63 #define MAXIM_NEW_RF 0x8
64 #define UW2453_RF 0x9
65 -#define AL2230S_RF 0xa
66 +#define UNKNOWN_A_RF 0xa
67 #define RALINK_RF 0xb
68 #define INTERSIL_RF 0xc
69 #define RF2959_RF 0xd
70 diff --git a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
71 index 5235a78..85a9ad2 100644
72 --- a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
73 +++ b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c
74 @@ -59,6 +59,18 @@ static const struct zd_ioreq16 zd1211b_ioreqs_shared_1[] = {
75 { CR240, 0x57 }, { CR9, 0xe0 },
76 };
77
78 +static const struct zd_ioreq16 ioreqs_init_al2230s[] = {
79 + { CR47, 0x1e }, /* MARK_002 */
80 + { CR106, 0x22 },
81 + { CR107, 0x2a }, /* MARK_002 */
82 + { CR109, 0x13 }, /* MARK_002 */
83 + { CR118, 0xf8 }, /* MARK_002 */
84 + { CR119, 0x12 }, { CR122, 0xe0 },
85 + { CR128, 0x10 }, /* MARK_001 from 0xe->0x10 */
86 + { CR129, 0x0e }, /* MARK_001 from 0xd->0x0e */
87 + { CR130, 0x10 }, /* MARK_001 from 0xb->0x0d */
88 +};
89 +
90 static int zd1211b_al2230_finalize_rf(struct zd_chip *chip)
91 {
92 int r;
93 @@ -90,7 +102,7 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
94 int r;
95 struct zd_chip *chip = zd_rf_to_chip(rf);
96
97 - static const struct zd_ioreq16 ioreqs[] = {
98 + static const struct zd_ioreq16 ioreqs_init[] = {
99 { CR15, 0x20 }, { CR23, 0x40 }, { CR24, 0x20 },
100 { CR26, 0x11 }, { CR28, 0x3e }, { CR29, 0x00 },
101 { CR44, 0x33 }, { CR106, 0x2a }, { CR107, 0x1a },
102 @@ -117,10 +129,9 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
103 { CR119, 0x10 }, { CR120, 0x4f }, { CR121, 0x77 },
104 { CR122, 0xe0 }, { CR137, 0x88 }, { CR252, 0xff },
105 { CR253, 0xff },
106 + };
107
108 - /* These following happen separately in the vendor driver */
109 - { },
110 -
111 + static const struct zd_ioreq16 ioreqs_pll[] = {
112 /* shdnb(PLL_ON)=0 */
113 { CR251, 0x2f },
114 /* shdnb(PLL_ON)=1 */
115 @@ -128,7 +139,7 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
116 { CR138, 0x28 }, { CR203, 0x06 },
117 };
118
119 - static const u32 rv[] = {
120 + static const u32 rv1[] = {
121 /* Channel 1 */
122 0x03f790,
123 0x033331,
124 @@ -137,6 +148,9 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
125 0x0b3331,
126 0x03b812,
127 0x00fff3,
128 + };
129 +
130 + static const u32 rv2[] = {
131 0x000da4,
132 0x0f4dc5, /* fix freq shift, 0x04edc5 */
133 0x0805b6,
134 @@ -148,8 +162,9 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
135 0x0bdffc,
136 0x00000d,
137 0x00500f,
138 + };
139
140 - /* These writes happen separately in the vendor driver */
141 + static const u32 rv3[] = {
142 0x00d00f,
143 0x004c0f,
144 0x00540f,
145 @@ -157,11 +172,38 @@ static int zd1211_al2230_init_hw(struct zd_rf *rf)
146 0x00500f,
147 };
148
149 - r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs));
150 + r = zd_iowrite16a_locked(chip, ioreqs_init, ARRAY_SIZE(ioreqs_init));
151 if (r)
152 return r;
153
154 - r = zd_rfwritev_locked(chip, rv, ARRAY_SIZE(rv), RF_RV_BITS);
155 + if (chip->al2230s_bit) {
156 + r = zd_iowrite16a_locked(chip, ioreqs_init_al2230s,
157 + ARRAY_SIZE(ioreqs_init_al2230s));
158 + if (r)
159 + return r;
160 + }
161 +
162 + r = zd_rfwritev_locked(chip, rv1, ARRAY_SIZE(rv1), RF_RV_BITS);
163 + if (r)
164 + return r;
165 +
166 + /* improve band edge for AL2230S */
167 + if (chip->al2230s_bit)
168 + r = zd_rfwrite_locked(chip, 0x000824, RF_RV_BITS);
169 + else
170 + r = zd_rfwrite_locked(chip, 0x0005a4, RF_RV_BITS);
171 + if (r)
172 + return r;
173 +
174 + r = zd_rfwritev_locked(chip, rv2, ARRAY_SIZE(rv2), RF_RV_BITS);
175 + if (r)
176 + return r;
177 +
178 + r = zd_iowrite16a_locked(chip, ioreqs_pll, ARRAY_SIZE(ioreqs_pll));
179 + if (r)
180 + return r;
181 +
182 + r = zd_rfwritev_locked(chip, rv3, ARRAY_SIZE(rv3), RF_RV_BITS);
183 if (r)
184 return r;
185
186 @@ -227,7 +269,9 @@ static int zd1211b_al2230_init_hw(struct zd_rf *rf)
187 0x481dc0,
188 0xcfff00,
189 0x25a000,
190 + };
191
192 + static const u32 rv2[] = {
193 /* To improve AL2230 yield, improve phase noise, 4713 */
194 0x25a000,
195 0xa3b2f0,
196 @@ -250,7 +294,7 @@ static int zd1211b_al2230_init_hw(struct zd_rf *rf)
197 { CR251, 0x7f }, /* shdnb(PLL_ON)=1 */
198 };
199
200 - static const u32 rv2[] = {
201 + static const u32 rv3[] = {
202 /* To improve AL2230 yield, 4713 */
203 0xf01b00,
204 0xf01e00,
205 @@ -269,18 +313,37 @@ static int zd1211b_al2230_init_hw(struct zd_rf *rf)
206 r = zd_iowrite16a_locked(chip, ioreqs1, ARRAY_SIZE(ioreqs1));
207 if (r)
208 return r;
209 +
210 + if (chip->al2230s_bit) {
211 + r = zd_iowrite16a_locked(chip, ioreqs_init_al2230s,
212 + ARRAY_SIZE(ioreqs_init_al2230s));
213 + if (r)
214 + return r;
215 + }
216 +
217 r = zd_rfwritev_cr_locked(chip, zd1211b_al2230_table[0], 3);
218 if (r)
219 return r;
220 r = zd_rfwritev_cr_locked(chip, rv1, ARRAY_SIZE(rv1));
221 if (r)
222 return r;
223 - r = zd_iowrite16a_locked(chip, ioreqs2, ARRAY_SIZE(ioreqs2));
224 +
225 + if (chip->al2230s_bit)
226 + r = zd_rfwrite_locked(chip, 0x241000, RF_RV_BITS);
227 + else
228 + r = zd_rfwrite_locked(chip, 0x25a000, RF_RV_BITS);
229 if (r)
230 return r;
231 +
232 r = zd_rfwritev_cr_locked(chip, rv2, ARRAY_SIZE(rv2));
233 if (r)
234 return r;
235 + r = zd_iowrite16a_locked(chip, ioreqs2, ARRAY_SIZE(ioreqs2));
236 + if (r)
237 + return r;
238 + r = zd_rfwritev_cr_locked(chip, rv3, ARRAY_SIZE(rv3));
239 + if (r)
240 + return r;
241 r = zd_iowrite16a_locked(chip, ioreqs3, ARRAY_SIZE(ioreqs3));
242 if (r)
243 return r;
244 @@ -358,12 +421,6 @@ int zd_rf_init_al2230(struct zd_rf *rf)
245 {
246 struct zd_chip *chip = zd_rf_to_chip(rf);
247
248 - if (chip->al2230s_bit) {
249 - dev_err(zd_chip_dev(chip), "AL2230S devices are not yet "
250 - "supported by this driver.\n");
251 - return -ENODEV;
252 - }
253 -
254 rf->switch_radio_off = al2230_switch_radio_off;
255 if (chip->is_zd1211b) {
256 rf->init_hw = zd1211b_al2230_init_hw;

  ViewVC Help
Powered by ViewVC 1.1.20