diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2010-01-21 19:53:14 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-01-22 16:11:38 -0500 |
commit | 10a798733e0f47923a1050231d8d39609c62be70 (patch) | |
tree | 7100f8ea0c4d373cdc6d866bfb4fe1f3675e9814 /drivers/net/wireless | |
parent | 75377b2476d85d90c0db07e780ee95741cff3a2d (diff) |
b43: N-PHY: add running samples
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/b43/phy_n.c | 68 |
1 files changed, 64 insertions, 4 deletions
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index d3c9783b76ba..f5900f04ff5c 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c | |||
@@ -816,6 +816,66 @@ static void b43_nphy_stop_playback(struct b43_wldev *dev) | |||
816 | b43_nphy_stay_in_carrier_search(dev, 0); | 816 | b43_nphy_stay_in_carrier_search(dev, 0); |
817 | } | 817 | } |
818 | 818 | ||
819 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RunSamples */ | ||
820 | static void b43_nphy_run_samples(struct b43_wldev *dev, u16 samps, u16 loops, | ||
821 | u16 wait, bool iqmode, bool dac_test) | ||
822 | { | ||
823 | struct b43_phy_n *nphy = dev->phy.n; | ||
824 | int i; | ||
825 | u16 seq_mode; | ||
826 | u32 tmp; | ||
827 | |||
828 | if (nphy->hang_avoid) | ||
829 | b43_nphy_stay_in_carrier_search(dev, true); | ||
830 | |||
831 | if ((nphy->bb_mult_save & 0x80000000) == 0) { | ||
832 | tmp = b43_ntab_read(dev, B43_NTAB16(15, 87)); | ||
833 | nphy->bb_mult_save = (tmp & 0xFFFF) | 0x80000000; | ||
834 | } | ||
835 | |||
836 | if (!dev->phy.is_40mhz) | ||
837 | tmp = 0x6464; | ||
838 | else | ||
839 | tmp = 0x4747; | ||
840 | b43_ntab_write(dev, B43_NTAB16(15, 87), tmp); | ||
841 | |||
842 | if (nphy->hang_avoid) | ||
843 | b43_nphy_stay_in_carrier_search(dev, false); | ||
844 | |||
845 | b43_phy_write(dev, B43_NPHY_SAMP_DEPCNT, (samps - 1)); | ||
846 | |||
847 | if (loops != 0xFFFF) | ||
848 | b43_phy_write(dev, B43_NPHY_SAMP_LOOPCNT, (loops - 1)); | ||
849 | else | ||
850 | b43_phy_write(dev, B43_NPHY_SAMP_LOOPCNT, loops); | ||
851 | |||
852 | b43_phy_write(dev, B43_NPHY_SAMP_WAITCNT, wait); | ||
853 | |||
854 | seq_mode = b43_phy_read(dev, B43_NPHY_RFSEQMODE); | ||
855 | |||
856 | b43_phy_set(dev, B43_NPHY_RFSEQMODE, B43_NPHY_RFSEQMODE_CAOVER); | ||
857 | if (iqmode) { | ||
858 | b43_phy_mask(dev, B43_NPHY_IQLOCAL_CMDGCTL, 0x7FFF); | ||
859 | b43_phy_set(dev, B43_NPHY_IQLOCAL_CMDGCTL, 0x8000); | ||
860 | } else { | ||
861 | if (dac_test) | ||
862 | b43_phy_write(dev, B43_NPHY_SAMP_CMD, 5); | ||
863 | else | ||
864 | b43_phy_write(dev, B43_NPHY_SAMP_CMD, 1); | ||
865 | } | ||
866 | for (i = 0; i < 100; i++) { | ||
867 | if (b43_phy_read(dev, B43_NPHY_RFSEQST) & 1) { | ||
868 | i = 0; | ||
869 | break; | ||
870 | } | ||
871 | udelay(10); | ||
872 | } | ||
873 | if (i) | ||
874 | b43err(dev->wl, "run samples timeout\n"); | ||
875 | |||
876 | b43_phy_write(dev, B43_NPHY_RFSEQMODE, seq_mode); | ||
877 | } | ||
878 | |||
819 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlCoefSetup */ | 879 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlCoefSetup */ |
820 | static void b43_nphy_tx_pwr_ctrl_coef_setup(struct b43_wldev *dev) | 880 | static void b43_nphy_tx_pwr_ctrl_coef_setup(struct b43_wldev *dev) |
821 | { | 881 | { |
@@ -1869,8 +1929,8 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev, | |||
1869 | freq = 5000; | 1929 | freq = 5000; |
1870 | 1930 | ||
1871 | if (nphy->mphase_cal_phase_id > 2) | 1931 | if (nphy->mphase_cal_phase_id > 2) |
1872 | ;/* TODO: Call N PHY Run Samples with (band width * 8), | 1932 | b43_nphy_run_samples(dev, (dev->phy.is_40mhz ? 40 : 20) * 8, |
1873 | 0xFFFF, 0, 1, 0 as arguments */ | 1933 | 0xFFFF, 0, true, false); |
1874 | else | 1934 | else |
1875 | ;/* TODO: Call N PHY TX Tone with freq, 250, 1, 0 as arguments | 1935 | ;/* TODO: Call N PHY TX Tone with freq, 250, 1, 0 as arguments |
1876 | and save result as error */ | 1936 | and save result as error */ |
@@ -2162,8 +2222,8 @@ static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev, | |||
2162 | as arguments and save result as ret */ | 2222 | as arguments and save result as ret */ |
2163 | playtone = false; | 2223 | playtone = false; |
2164 | } else { | 2224 | } else { |
2165 | /* TODO: Call N PHY Run Samples with 160, | 2225 | b43_nphy_run_samples(dev, 160, 0xFFFF, 0, |
2166 | 0xFFFF, 0, 0, 0 as arguments */ | 2226 | false, false); |
2167 | } | 2227 | } |
2168 | 2228 | ||
2169 | if (ret == 0) { | 2229 | if (ret == 0) { |