aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2011-12-20 16:45:49 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-01-04 14:30:41 -0500
commit3dda07b6f94b8f9777156be1bf37bf707ecea447 (patch)
tree4dd55bd340639f90f194ffec12cb041cc3bea2df
parent2c8ac7eb96e45997d99a5da6d0d5cdf265587437 (diff)
b43: N-PHY: get idle TSSI values
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/b43/phy_n.c125
-rw-r--r--drivers/net/wireless/b43/phy_n.h6
2 files changed, 130 insertions, 1 deletions
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index da6fa0360788..d3222b8b594a 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -2297,6 +2297,129 @@ static void b43_nphy_tx_power_fix(struct b43_wldev *dev)
2297 b43_nphy_stay_in_carrier_search(dev, 0); 2297 b43_nphy_stay_in_carrier_search(dev, 0);
2298} 2298}
2299 2299
2300static void b43_nphy_ipa_internal_tssi_setup(struct b43_wldev *dev)
2301{
2302 struct b43_phy *phy = &dev->phy;
2303
2304 u8 core;
2305 u16 r; /* routing */
2306
2307 if (phy->rev >= 7) {
2308 for (core = 0; core < 2; core++) {
2309 r = core ? 0x190 : 0x170;
2310 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
2311 b43_radio_write(dev, r + 0x5, 0x5);
2312 b43_radio_write(dev, r + 0x9, 0xE);
2313 if (phy->rev != 5)
2314 b43_radio_write(dev, r + 0xA, 0);
2315 if (phy->rev != 7)
2316 b43_radio_write(dev, r + 0xB, 1);
2317 else
2318 b43_radio_write(dev, r + 0xB, 0x31);
2319 } else {
2320 b43_radio_write(dev, r + 0x5, 0x9);
2321 b43_radio_write(dev, r + 0x9, 0xC);
2322 b43_radio_write(dev, r + 0xB, 0x0);
2323 if (phy->rev != 5)
2324 b43_radio_write(dev, r + 0xA, 1);
2325 else
2326 b43_radio_write(dev, r + 0xA, 0x31);
2327 }
2328 b43_radio_write(dev, r + 0x6, 0);
2329 b43_radio_write(dev, r + 0x7, 0);
2330 b43_radio_write(dev, r + 0x8, 3);
2331 b43_radio_write(dev, r + 0xC, 0);
2332 }
2333 } else {
2334 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
2335 b43_radio_write(dev, B2056_SYN_RESERVED_ADDR31, 0x128);
2336 else
2337 b43_radio_write(dev, B2056_SYN_RESERVED_ADDR31, 0x80);
2338 b43_radio_write(dev, B2056_SYN_RESERVED_ADDR30, 0);
2339 b43_radio_write(dev, B2056_SYN_GPIO_MASTER1, 0x29);
2340
2341 for (core = 0; core < 2; core++) {
2342 r = core ? B2056_TX1 : B2056_TX0;
2343
2344 b43_radio_write(dev, r | B2056_TX_IQCAL_VCM_HG, 0);
2345 b43_radio_write(dev, r | B2056_TX_IQCAL_IDAC, 0);
2346 b43_radio_write(dev, r | B2056_TX_TSSI_VCM, 3);
2347 b43_radio_write(dev, r | B2056_TX_TX_AMP_DET, 0);
2348 b43_radio_write(dev, r | B2056_TX_TSSI_MISC1, 8);
2349 b43_radio_write(dev, r | B2056_TX_TSSI_MISC2, 0);
2350 b43_radio_write(dev, r | B2056_TX_TSSI_MISC3, 0);
2351 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
2352 b43_radio_write(dev, r | B2056_TX_TX_SSI_MASTER,
2353 0x5);
2354 if (phy->rev != 5)
2355 b43_radio_write(dev, r | B2056_TX_TSSIA,
2356 0x00);
2357 if (phy->rev >= 5)
2358 b43_radio_write(dev, r | B2056_TX_TSSIG,
2359 0x31);
2360 else
2361 b43_radio_write(dev, r | B2056_TX_TSSIG,
2362 0x11);
2363 b43_radio_write(dev, r | B2056_TX_TX_SSI_MUX,
2364 0xE);
2365 } else {
2366 b43_radio_write(dev, r | B2056_TX_TX_SSI_MASTER,
2367 0x9);
2368 b43_radio_write(dev, r | B2056_TX_TSSIA, 0x31);
2369 b43_radio_write(dev, r | B2056_TX_TSSIG, 0x0);
2370 b43_radio_write(dev, r | B2056_TX_TX_SSI_MUX,
2371 0xC);
2372 }
2373 }
2374 }
2375}
2376
2377/*
2378 * Stop radio and transmit known signal. Then check received signal strength to
2379 * get TSSI (Transmit Signal Strength Indicator).
2380 * http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlIdleTssi
2381 */
2382static void b43_nphy_tx_power_ctl_idle_tssi(struct b43_wldev *dev)
2383{
2384 struct b43_phy *phy = &dev->phy;
2385 struct b43_phy_n *nphy = dev->phy.n;
2386
2387 u32 tmp;
2388 s32 rssi[4] = { };
2389
2390 /* TODO: check if we can transmit */
2391
2392 if (b43_nphy_ipa(dev))
2393 b43_nphy_ipa_internal_tssi_setup(dev);
2394
2395 if (phy->rev >= 7)
2396 ; /* TODO: Override Rev7 with 0x2000, 0, 3, 0, 0 as arguments */
2397 else if (phy->rev >= 3)
2398 b43_nphy_rf_control_override(dev, 0x2000, 0, 3, false);
2399
2400 b43_nphy_stop_playback(dev);
2401 b43_nphy_tx_tone(dev, 0xFA0, 0, false, false);
2402 udelay(20);
2403 tmp = b43_nphy_poll_rssi(dev, 4, rssi, 1);
2404 b43_nphy_stop_playback(dev);
2405 b43_nphy_rssi_select(dev, 0, 0);
2406
2407 if (phy->rev >= 7)
2408 ; /* TODO: Override Rev7 with 0x2000, 0, 3, 1, 0 as arguments */
2409 else if (phy->rev >= 3)
2410 b43_nphy_rf_control_override(dev, 0x2000, 0, 3, true);
2411
2412 if (phy->rev >= 3) {
2413 nphy->pwr_ctl_info[0].idle_tssi_5g = (tmp >> 24) & 0xFF;
2414 nphy->pwr_ctl_info[1].idle_tssi_5g = (tmp >> 8) & 0xFF;
2415 } else {
2416 nphy->pwr_ctl_info[0].idle_tssi_5g = (tmp >> 16) & 0xFF;
2417 nphy->pwr_ctl_info[1].idle_tssi_5g = tmp & 0xFF;
2418 }
2419 nphy->pwr_ctl_info[0].idle_tssi_2g = (tmp >> 24) & 0xFF;
2420 nphy->pwr_ctl_info[1].idle_tssi_2g = (tmp >> 8) & 0xFF;
2421}
2422
2300static void b43_nphy_tx_gain_table_upload(struct b43_wldev *dev) 2423static void b43_nphy_tx_gain_table_upload(struct b43_wldev *dev)
2301{ 2424{
2302 struct b43_phy *phy = &dev->phy; 2425 struct b43_phy *phy = &dev->phy;
@@ -3986,7 +4109,7 @@ int b43_phy_initn(struct b43_wldev *dev)
3986 tx_pwr_state = nphy->txpwrctrl; 4109 tx_pwr_state = nphy->txpwrctrl;
3987 b43_nphy_tx_power_ctrl(dev, false); 4110 b43_nphy_tx_power_ctrl(dev, false);
3988 b43_nphy_tx_power_fix(dev); 4111 b43_nphy_tx_power_fix(dev);
3989 /* TODO N PHY TX Power Control Idle TSSI */ 4112 b43_nphy_tx_power_ctl_idle_tssi(dev);
3990 /* TODO N PHY TX Power Control Setup */ 4113 /* TODO N PHY TX Power Control Setup */
3991 b43_nphy_tx_gain_table_upload(dev); 4114 b43_nphy_tx_gain_table_upload(dev);
3992 4115
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h
index 56ef97b5b815..5de8f74cc02f 100644
--- a/drivers/net/wireless/b43/phy_n.h
+++ b/drivers/net/wireless/b43/phy_n.h
@@ -765,6 +765,11 @@ struct b43_phy_n_txpwrindex {
765 u16 locomp; 765 u16 locomp;
766}; 766};
767 767
768struct b43_phy_n_pwr_ctl_info {
769 u8 idle_tssi_2g;
770 u8 idle_tssi_5g;
771};
772
768struct b43_phy_n { 773struct b43_phy_n {
769 u8 antsel_type; 774 u8 antsel_type;
770 u8 cal_orig_pwr_idx[2]; 775 u8 cal_orig_pwr_idx[2];
@@ -798,6 +803,7 @@ struct b43_phy_n {
798 u16 txiqlocal_bestc[11]; 803 u16 txiqlocal_bestc[11];
799 bool txiqlocal_coeffsvalid; 804 bool txiqlocal_coeffsvalid;
800 struct b43_phy_n_txpwrindex txpwrindex[2]; 805 struct b43_phy_n_txpwrindex txpwrindex[2];
806 struct b43_phy_n_pwr_ctl_info pwr_ctl_info[2];
801 struct b43_chanspec txiqlocal_chanspec; 807 struct b43_chanspec txiqlocal_chanspec;
802 808
803 u8 txrx_chain; 809 u8 txrx_chain;