diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2010-01-21 19:53:13 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-01-22 16:11:37 -0500 |
commit | 75377b2476d85d90c0db07e780ee95741cff3a2d (patch) | |
tree | a5a104387be23f3140307cc8ec93d2ca474e9f6e /drivers/net/wireless/b43/phy_n.c | |
parent | aa4c7b2a2547db95388f795f092ea286fbdd98a1 (diff) |
b43: N-PHY: implement overriding RF control
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/phy_n.c')
-rw-r--r-- | drivers/net/wireless/b43/phy_n.c | 82 |
1 files changed, 79 insertions, 3 deletions
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index 2cdf32e5fd9b..d3c9783b76ba 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c | |||
@@ -912,6 +912,82 @@ ok: | |||
912 | b43_phy_write(dev, B43_NPHY_RFSEQMODE, seq_mode); | 912 | b43_phy_write(dev, B43_NPHY_RFSEQMODE, seq_mode); |
913 | } | 913 | } |
914 | 914 | ||
915 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlOverride */ | ||
916 | static void b43_nphy_rf_control_override(struct b43_wldev *dev, u16 field, | ||
917 | u16 value, u8 core, bool off) | ||
918 | { | ||
919 | int i; | ||
920 | u8 index = fls(field); | ||
921 | u8 addr, en_addr, val_addr; | ||
922 | /* we expect only one bit set */ | ||
923 | B43_WARN_ON(field & (~(1 << index))); | ||
924 | |||
925 | if (dev->phy.rev >= 3) { | ||
926 | const struct nphy_rf_control_override_rev3 *rf_ctrl; | ||
927 | for (i = 0; i < 2; i++) { | ||
928 | if (index == 0 || index == 16) { | ||
929 | b43err(dev->wl, | ||
930 | "Unsupported RF Ctrl Override call\n"); | ||
931 | return; | ||
932 | } | ||
933 | |||
934 | rf_ctrl = &tbl_rf_control_override_rev3[index - 1]; | ||
935 | en_addr = B43_PHY_N((i == 0) ? | ||
936 | rf_ctrl->en_addr0 : rf_ctrl->en_addr1); | ||
937 | val_addr = B43_PHY_N((i == 0) ? | ||
938 | rf_ctrl->val_addr0 : rf_ctrl->val_addr1); | ||
939 | |||
940 | if (off) { | ||
941 | b43_phy_mask(dev, en_addr, ~(field)); | ||
942 | b43_phy_mask(dev, val_addr, | ||
943 | ~(rf_ctrl->val_mask)); | ||
944 | } else { | ||
945 | if (core == 0 || ((1 << core) & i) != 0) { | ||
946 | b43_phy_set(dev, en_addr, field); | ||
947 | b43_phy_maskset(dev, val_addr, | ||
948 | ~(rf_ctrl->val_mask), | ||
949 | (value << rf_ctrl->val_shift)); | ||
950 | } | ||
951 | } | ||
952 | } | ||
953 | } else { | ||
954 | const struct nphy_rf_control_override_rev2 *rf_ctrl; | ||
955 | if (off) { | ||
956 | b43_phy_mask(dev, B43_NPHY_RFCTL_OVER, ~(field)); | ||
957 | value = 0; | ||
958 | } else { | ||
959 | b43_phy_set(dev, B43_NPHY_RFCTL_OVER, field); | ||
960 | } | ||
961 | |||
962 | for (i = 0; i < 2; i++) { | ||
963 | if (index <= 1 || index == 16) { | ||
964 | b43err(dev->wl, | ||
965 | "Unsupported RF Ctrl Override call\n"); | ||
966 | return; | ||
967 | } | ||
968 | |||
969 | if (index == 2 || index == 10 || | ||
970 | (index >= 13 && index <= 15)) { | ||
971 | core = 1; | ||
972 | } | ||
973 | |||
974 | rf_ctrl = &tbl_rf_control_override_rev2[index - 2]; | ||
975 | addr = B43_PHY_N((i == 0) ? | ||
976 | rf_ctrl->addr0 : rf_ctrl->addr1); | ||
977 | |||
978 | if ((core & (1 << i)) != 0) | ||
979 | b43_phy_maskset(dev, addr, ~(rf_ctrl->bmask), | ||
980 | (value << rf_ctrl->shift)); | ||
981 | |||
982 | b43_phy_set(dev, B43_NPHY_RFCTL_OVER, 0x1); | ||
983 | b43_phy_set(dev, B43_NPHY_RFCTL_CMD, | ||
984 | B43_NPHY_RFCTL_CMD_START); | ||
985 | udelay(1); | ||
986 | b43_phy_mask(dev, B43_NPHY_RFCTL_OVER, 0xFFFE); | ||
987 | } | ||
988 | } | ||
989 | } | ||
990 | |||
915 | static void b43_nphy_bphy_init(struct b43_wldev *dev) | 991 | static void b43_nphy_bphy_init(struct b43_wldev *dev) |
916 | { | 992 | { |
917 | unsigned int i; | 993 | unsigned int i; |
@@ -2075,8 +2151,8 @@ static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev, | |||
2075 | 2151 | ||
2076 | tmp[0] = ((cur_hpf2 << 8) | (cur_hpf1 << 4) | | 2152 | tmp[0] = ((cur_hpf2 << 8) | (cur_hpf1 << 4) | |
2077 | (cur_lna << 2)); | 2153 | (cur_lna << 2)); |
2078 | /* TODO:Call N PHY RF Ctrl Override with 0x400, tmp[0], | 2154 | b43_nphy_rf_control_override(dev, 0x400, tmp[0], 3, |
2079 | 3, 0 as arguments */ | 2155 | false); |
2080 | b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX); | 2156 | b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX); |
2081 | b43_nphy_stop_playback(dev); | 2157 | b43_nphy_stop_playback(dev); |
2082 | 2158 | ||
@@ -2124,7 +2200,7 @@ static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev, | |||
2124 | break; | 2200 | break; |
2125 | } | 2201 | } |
2126 | 2202 | ||
2127 | /* TODO: Call N PHY RF Ctrl Override with 0x400, 0, 3, 1 as arguments*/ | 2203 | b43_nphy_rf_control_override(dev, 0x400, 0, 3, true); |
2128 | b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX); | 2204 | b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX); |
2129 | b43_ntab_write_bulk(dev, B43_NTAB16(7, 0x110), 2, gain_save); | 2205 | b43_ntab_write_bulk(dev, B43_NTAB16(7, 0x110), 2, gain_save); |
2130 | 2206 | ||