diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2010-01-15 09:18:35 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-01-15 17:05:39 -0500 |
commit | 2f258b74d13c200944ef018c71ed9d9a7d4da0b0 (patch) | |
tree | cba88aa0deb51593bcfc852c7283da49f02d74d7 | |
parent | 0914640072570f5867818884b8b78c0468b9747f (diff) |
b43: N-PHY: implement restoring general configuration
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>a
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/b43/phy_n.c | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index d67ba207783a..68c1582db712 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c | |||
@@ -995,6 +995,96 @@ static void b43_nphy_restore_rssi_cal(struct b43_wldev *dev) | |||
995 | b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_RSSI_Y, rssical_phy_regs[11]); | 995 | b43_phy_write(dev, B43_NPHY_RSSIMC_1Q_RSSI_Y, rssical_phy_regs[11]); |
996 | } | 996 | } |
997 | 997 | ||
998 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/GetIpaGainTbl */ | ||
999 | static const u32 *b43_nphy_get_ipa_gain_table(struct b43_wldev *dev) | ||
1000 | { | ||
1001 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { | ||
1002 | if (dev->phy.rev >= 6) { | ||
1003 | /* TODO If the chip is 47162 | ||
1004 | return txpwrctrl_tx_gain_ipa_rev5 */ | ||
1005 | return txpwrctrl_tx_gain_ipa_rev6; | ||
1006 | } else if (dev->phy.rev >= 5) { | ||
1007 | return txpwrctrl_tx_gain_ipa_rev5; | ||
1008 | } else { | ||
1009 | return txpwrctrl_tx_gain_ipa; | ||
1010 | } | ||
1011 | } else { | ||
1012 | return txpwrctrl_tx_gain_ipa_5g; | ||
1013 | } | ||
1014 | } | ||
1015 | |||
1016 | /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal */ | ||
1017 | static void b43_nphy_restore_cal(struct b43_wldev *dev) | ||
1018 | { | ||
1019 | struct b43_phy_n *nphy = dev->phy.n; | ||
1020 | |||
1021 | u16 coef[4]; | ||
1022 | u16 *loft = NULL; | ||
1023 | u16 *table = NULL; | ||
1024 | |||
1025 | int i; | ||
1026 | u16 *txcal_radio_regs = NULL; | ||
1027 | struct b43_phy_n_iq_comp *rxcal_coeffs = NULL; | ||
1028 | |||
1029 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { | ||
1030 | if (nphy->iqcal_chanspec_2G == 0) | ||
1031 | return; | ||
1032 | table = nphy->cal_cache.txcal_coeffs_2G; | ||
1033 | loft = &nphy->cal_cache.txcal_coeffs_2G[5]; | ||
1034 | } else { | ||
1035 | if (nphy->iqcal_chanspec_5G == 0) | ||
1036 | return; | ||
1037 | table = nphy->cal_cache.txcal_coeffs_5G; | ||
1038 | loft = &nphy->cal_cache.txcal_coeffs_5G[5]; | ||
1039 | } | ||
1040 | |||
1041 | /* TODO: Write an N PHY table with ID 15, length 4, offset 80, | ||
1042 | width 16, and data from table */ | ||
1043 | |||
1044 | for (i = 0; i < 4; i++) { | ||
1045 | if (dev->phy.rev >= 3) | ||
1046 | table[i] = coef[i]; | ||
1047 | else | ||
1048 | coef[i] = 0; | ||
1049 | } | ||
1050 | |||
1051 | /* TODO: Write an N PHY table with ID 15, length 4, offset 88, | ||
1052 | width 16, and data from coef */ | ||
1053 | /* TODO: Write an N PHY table with ID 15, length 2, offset 85, | ||
1054 | width 16 and data from loft */ | ||
1055 | /* TODO: Write an N PHY table with ID 15, length 2, offset 93, | ||
1056 | width 16 and data from loft */ | ||
1057 | |||
1058 | if (dev->phy.rev < 2) | ||
1059 | b43_nphy_tx_iq_workaround(dev); | ||
1060 | |||
1061 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { | ||
1062 | txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_2G; | ||
1063 | rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_2G; | ||
1064 | } else { | ||
1065 | txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_5G; | ||
1066 | rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_5G; | ||
1067 | } | ||
1068 | |||
1069 | /* TODO use some definitions */ | ||
1070 | if (dev->phy.rev >= 3) { | ||
1071 | b43_radio_write(dev, 0x2021, txcal_radio_regs[0]); | ||
1072 | b43_radio_write(dev, 0x2022, txcal_radio_regs[1]); | ||
1073 | b43_radio_write(dev, 0x3021, txcal_radio_regs[2]); | ||
1074 | b43_radio_write(dev, 0x3022, txcal_radio_regs[3]); | ||
1075 | b43_radio_write(dev, 0x2023, txcal_radio_regs[4]); | ||
1076 | b43_radio_write(dev, 0x2024, txcal_radio_regs[5]); | ||
1077 | b43_radio_write(dev, 0x3023, txcal_radio_regs[6]); | ||
1078 | b43_radio_write(dev, 0x3024, txcal_radio_regs[7]); | ||
1079 | } else { | ||
1080 | b43_radio_write(dev, 0x8B, txcal_radio_regs[0]); | ||
1081 | b43_radio_write(dev, 0xBA, txcal_radio_regs[1]); | ||
1082 | b43_radio_write(dev, 0x8D, txcal_radio_regs[2]); | ||
1083 | b43_radio_write(dev, 0xBC, txcal_radio_regs[3]); | ||
1084 | } | ||
1085 | b43_nphy_rx_iq_coeffs(dev, true, rxcal_coeffs); | ||
1086 | } | ||
1087 | |||
998 | /* | 1088 | /* |
999 | * Init N-PHY | 1089 | * Init N-PHY |
1000 | * http://bcm-v4.sipsolutions.net/802.11/PHY/Init/N | 1090 | * http://bcm-v4.sipsolutions.net/802.11/PHY/Init/N |