aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2010-02-04 06:23:11 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-02-08 16:50:55 -0500
commitbbc6dc121de92dee506e359eeb9b1d3973d0740a (patch)
treeaa5aa8393ab65908c0837b785bcee33889cc0a75 /drivers
parent984ff4ffb7fa36b9ac440a3802fd19658eccc84e (diff)
b43: N-PHY: save calibration for further restore
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/b43/phy_n.c51
-rw-r--r--drivers/net/wireless/b43/phy_n.h1
2 files changed, 51 insertions, 1 deletions
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 3dd22bc527d0..b332ffbe59d8 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -2295,6 +2295,55 @@ static void b43_nphy_tx_cal_phy_setup(struct b43_wldev *dev)
2295 } 2295 }
2296} 2296}
2297 2297
2298/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SaveCal */
2299static void b43_nphy_save_cal(struct b43_wldev *dev)
2300{
2301 struct b43_phy_n *nphy = dev->phy.n;
2302
2303 struct b43_phy_n_iq_comp *rxcal_coeffs = NULL;
2304 u16 *txcal_radio_regs = NULL;
2305 u8 *iqcal_chanspec;
2306 u16 *table = NULL;
2307
2308 if (nphy->hang_avoid)
2309 b43_nphy_stay_in_carrier_search(dev, 1);
2310
2311 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
2312 rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_2G;
2313 txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_2G;
2314 iqcal_chanspec = &nphy->iqcal_chanspec_2G;
2315 table = nphy->cal_cache.txcal_coeffs_2G;
2316 } else {
2317 rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_5G;
2318 txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_5G;
2319 iqcal_chanspec = &nphy->iqcal_chanspec_5G;
2320 table = nphy->cal_cache.txcal_coeffs_5G;
2321 }
2322
2323 b43_nphy_rx_iq_coeffs(dev, false, rxcal_coeffs);
2324 /* TODO use some definitions */
2325 if (dev->phy.rev >= 3) {
2326 txcal_radio_regs[0] = b43_radio_read(dev, 0x2021);
2327 txcal_radio_regs[1] = b43_radio_read(dev, 0x2022);
2328 txcal_radio_regs[2] = b43_radio_read(dev, 0x3021);
2329 txcal_radio_regs[3] = b43_radio_read(dev, 0x3022);
2330 txcal_radio_regs[4] = b43_radio_read(dev, 0x2023);
2331 txcal_radio_regs[5] = b43_radio_read(dev, 0x2024);
2332 txcal_radio_regs[6] = b43_radio_read(dev, 0x3023);
2333 txcal_radio_regs[7] = b43_radio_read(dev, 0x3024);
2334 } else {
2335 txcal_radio_regs[0] = b43_radio_read(dev, 0x8B);
2336 txcal_radio_regs[1] = b43_radio_read(dev, 0xBA);
2337 txcal_radio_regs[2] = b43_radio_read(dev, 0x8D);
2338 txcal_radio_regs[3] = b43_radio_read(dev, 0xBC);
2339 }
2340 *iqcal_chanspec = nphy->radio_chanspec;
2341 b43_ntab_write_bulk(dev, B43_NTAB16(15, 80), 8, table);
2342
2343 if (nphy->hang_avoid)
2344 b43_nphy_stay_in_carrier_search(dev, 0);
2345}
2346
2298/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal */ 2347/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal */
2299static void b43_nphy_restore_cal(struct b43_wldev *dev) 2348static void b43_nphy_restore_cal(struct b43_wldev *dev)
2300{ 2349{
@@ -2992,7 +3041,7 @@ int b43_phy_initn(struct b43_wldev *dev)
2992 3041
2993 if (!b43_nphy_cal_tx_iq_lo(dev, target, true, false)) { 3042 if (!b43_nphy_cal_tx_iq_lo(dev, target, true, false)) {
2994 if (b43_nphy_cal_rx_iq(dev, target, 2, 0) == 0) 3043 if (b43_nphy_cal_rx_iq(dev, target, 2, 0) == 0)
2995 ;/* Call N PHY Save Cal */ 3044 b43_nphy_save_cal(dev);
2996 else if (nphy->mphase_cal_phase_id == 0) 3045 else if (nphy->mphase_cal_phase_id == 0)
2997 ;/* N PHY Periodic Calibration with argument 3 */ 3046 ;/* N PHY Periodic Calibration with argument 3 */
2998 } else { 3047 } else {
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h
index ae82f0fc2096..0400a2cb76a9 100644
--- a/drivers/net/wireless/b43/phy_n.h
+++ b/drivers/net/wireless/b43/phy_n.h
@@ -975,6 +975,7 @@ struct b43_phy_n {
975 u16 papd_epsilon_offset[2]; 975 u16 papd_epsilon_offset[2];
976 s32 preamble_override; 976 s32 preamble_override;
977 u32 bb_mult_save; 977 u32 bb_mult_save;
978 u16 radio_chanspec;
978 979
979 bool gain_boost; 980 bool gain_boost;
980 bool elna_gain_config; 981 bool elna_gain_config;