diff options
author | Gábor Stefanik <netrolller.3d@gmail.com> | 2009-08-10 14:57:06 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-14 09:13:58 -0400 |
commit | a3e14f3d2a55fa1268f64ec8a839b6dfa4ff9ea2 (patch) | |
tree | d9535d7ee8aa26ff0fd3acfe3f3958aa8b7ae0f2 /drivers/net/wireless/b43/phy_lp.c | |
parent | c65d6fbf91517a0a955de7ce029940bc63ea8203 (diff) |
b43: Update LP-PHY rev2+ baseband init to match the specs
The rev2+ BB init spec has changed behind us, and thus the code is
no longer up to date. Update the code to match the current specs.
Also implement save/restore dig filt state, as required by the
new specification.
Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/phy_lp.c')
-rw-r--r-- | drivers/net/wireless/b43/phy_lp.c | 73 |
1 files changed, 69 insertions, 4 deletions
diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c index 79039c3f60c8..6b1989490aec 100644 --- a/drivers/net/wireless/b43/phy_lp.c +++ b/drivers/net/wireless/b43/phy_lp.c | |||
@@ -195,6 +195,56 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev) | |||
195 | } | 195 | } |
196 | } | 196 | } |
197 | 197 | ||
198 | static void lpphy_save_dig_flt_state(struct b43_wldev *dev) | ||
199 | { | ||
200 | static const u16 addr[] = { | ||
201 | B43_PHY_OFDM(0xC1), | ||
202 | B43_PHY_OFDM(0xC2), | ||
203 | B43_PHY_OFDM(0xC3), | ||
204 | B43_PHY_OFDM(0xC4), | ||
205 | B43_PHY_OFDM(0xC5), | ||
206 | B43_PHY_OFDM(0xC6), | ||
207 | B43_PHY_OFDM(0xC7), | ||
208 | B43_PHY_OFDM(0xC8), | ||
209 | B43_PHY_OFDM(0xCF), | ||
210 | }; | ||
211 | |||
212 | static const u16 coefs[] = { | ||
213 | 0xDE5E, 0xE832, 0xE331, 0x4D26, | ||
214 | 0x0026, 0x1420, 0x0020, 0xFE08, | ||
215 | 0x0008, | ||
216 | }; | ||
217 | |||
218 | struct b43_phy_lp *lpphy = dev->phy.lp; | ||
219 | int i; | ||
220 | |||
221 | for (i = 0; i < ARRAY_SIZE(addr); i++) { | ||
222 | lpphy->dig_flt_state[i] = b43_phy_read(dev, addr[i]); | ||
223 | b43_phy_write(dev, addr[i], coefs[i]); | ||
224 | } | ||
225 | } | ||
226 | |||
227 | static void lpphy_restore_dig_flt_state(struct b43_wldev *dev) | ||
228 | { | ||
229 | static const u16 addr[] = { | ||
230 | B43_PHY_OFDM(0xC1), | ||
231 | B43_PHY_OFDM(0xC2), | ||
232 | B43_PHY_OFDM(0xC3), | ||
233 | B43_PHY_OFDM(0xC4), | ||
234 | B43_PHY_OFDM(0xC5), | ||
235 | B43_PHY_OFDM(0xC6), | ||
236 | B43_PHY_OFDM(0xC7), | ||
237 | B43_PHY_OFDM(0xC8), | ||
238 | B43_PHY_OFDM(0xCF), | ||
239 | }; | ||
240 | |||
241 | struct b43_phy_lp *lpphy = dev->phy.lp; | ||
242 | int i; | ||
243 | |||
244 | for (i = 0; i < ARRAY_SIZE(addr); i++) | ||
245 | b43_phy_write(dev, addr[i], lpphy->dig_flt_state[i]); | ||
246 | } | ||
247 | |||
198 | static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev) | 248 | static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev) |
199 | { | 249 | { |
200 | struct ssb_bus *bus = dev->dev->bus; | 250 | struct ssb_bus *bus = dev->dev->bus; |
@@ -209,7 +259,7 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev) | |||
209 | b43_phy_write(dev, B43_PHY_OFDM(0xF9), 0); | 259 | b43_phy_write(dev, B43_PHY_OFDM(0xF9), 0); |
210 | b43_phy_write(dev, B43_LPPHY_TR_LOOKUP_1, 0); | 260 | b43_phy_write(dev, B43_LPPHY_TR_LOOKUP_1, 0); |
211 | b43_phy_set(dev, B43_LPPHY_ADC_COMPENSATION_CTL, 0x10); | 261 | b43_phy_set(dev, B43_LPPHY_ADC_COMPENSATION_CTL, 0x10); |
212 | b43_phy_maskset(dev, B43_LPPHY_OFDMSYNCTHRESH0, 0xFF00, 0x78); | 262 | b43_phy_maskset(dev, B43_LPPHY_OFDMSYNCTHRESH0, 0xFF00, 0xB4); |
213 | b43_phy_maskset(dev, B43_LPPHY_DCOFFSETTRANSIENT, 0xF8FF, 0x200); | 263 | b43_phy_maskset(dev, B43_LPPHY_DCOFFSETTRANSIENT, 0xF8FF, 0x200); |
214 | b43_phy_maskset(dev, B43_LPPHY_DCOFFSETTRANSIENT, 0xFF00, 0x7F); | 264 | b43_phy_maskset(dev, B43_LPPHY_DCOFFSETTRANSIENT, 0xFF00, 0x7F); |
215 | b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xFF0F, 0x40); | 265 | b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xFF0F, 0x40); |
@@ -217,7 +267,12 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev) | |||
217 | b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x4000); | 267 | b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x4000); |
218 | b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x2000); | 268 | b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x2000); |
219 | b43_phy_set(dev, B43_PHY_OFDM(0x10A), 0x1); | 269 | b43_phy_set(dev, B43_PHY_OFDM(0x10A), 0x1); |
220 | b43_phy_maskset(dev, B43_PHY_OFDM(0x10A), 0xFF01, 0x10); | 270 | if (bus->boardinfo.rev >= 0x18) { |
271 | b43_lptab_write(dev, B43_LPTAB32(17, 65), 0xEC); | ||
272 | b43_phy_maskset(dev, B43_PHY_OFDM(0x10A), 0xFF01, 0x14); | ||
273 | } else { | ||
274 | b43_phy_maskset(dev, B43_PHY_OFDM(0x10A), 0xFF01, 0x10); | ||
275 | } | ||
221 | b43_phy_maskset(dev, B43_PHY_OFDM(0xDF), 0xFF00, 0xF4); | 276 | b43_phy_maskset(dev, B43_PHY_OFDM(0xDF), 0xFF00, 0xF4); |
222 | b43_phy_maskset(dev, B43_PHY_OFDM(0xDF), 0x00FF, 0xF100); | 277 | b43_phy_maskset(dev, B43_PHY_OFDM(0xDF), 0x00FF, 0xF100); |
223 | b43_phy_write(dev, B43_LPPHY_CLIPTHRESH, 0x48); | 278 | b43_phy_write(dev, B43_LPPHY_CLIPTHRESH, 0x48); |
@@ -247,8 +302,10 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev) | |||
247 | b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFFE0, 0x12); | 302 | b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFFE0, 0x12); |
248 | b43_phy_maskset(dev, B43_LPPHY_GAINMISMATCH, 0x0FFF, 0x9000); | 303 | b43_phy_maskset(dev, B43_LPPHY_GAINMISMATCH, 0x0FFF, 0x9000); |
249 | 304 | ||
250 | b43_lptab_write(dev, B43_LPTAB16(0x08, 0x14), 0); | 305 | if ((bus->chip_id == 0x4325) && (bus->chip_rev == 1)) { |
251 | b43_lptab_write(dev, B43_LPTAB16(0x08, 0x12), 0x40); | 306 | b43_lptab_write(dev, B43_LPTAB16(0x08, 0x14), 0); |
307 | b43_lptab_write(dev, B43_LPTAB16(0x08, 0x12), 0x40); | ||
308 | } | ||
252 | 309 | ||
253 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { | 310 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { |
254 | b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x40); | 311 | b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x40); |
@@ -268,6 +325,14 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev) | |||
268 | b43_phy_write(dev, B43_LPPHY_AFE_RSSI_CTL_1, | 325 | b43_phy_write(dev, B43_LPPHY_AFE_RSSI_CTL_1, |
269 | 0x2000 | ((u16)lpphy->rssi_gs << 10) | | 326 | 0x2000 | ((u16)lpphy->rssi_gs << 10) | |
270 | ((u16)lpphy->rssi_vc << 4) | lpphy->rssi_vf); | 327 | ((u16)lpphy->rssi_vc << 4) | lpphy->rssi_vf); |
328 | |||
329 | if ((bus->chip_id == 0x4325) && (bus->chip_rev == 0)) { | ||
330 | b43_phy_set(dev, B43_LPPHY_AFE_ADC_CTL_0, 0x1C); | ||
331 | b43_phy_maskset(dev, B43_LPPHY_AFE_CTL, 0x00FF, 0x8800); | ||
332 | b43_phy_maskset(dev, B43_LPPHY_AFE_ADC_CTL_1, 0xFC3C, 0x0400); | ||
333 | } | ||
334 | |||
335 | lpphy_save_dig_flt_state(dev); | ||
271 | } | 336 | } |
272 | 337 | ||
273 | static void lpphy_baseband_init(struct b43_wldev *dev) | 338 | static void lpphy_baseband_init(struct b43_wldev *dev) |