aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/phy_n.c
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2010-01-15 08:31:39 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-01-15 17:05:34 -0500
commitbbec398c1b7baa1dbde1e49446d1cbf4c6c20fa1 (patch)
treebeee82ffb026274828bc26715ea1efbe0f9c10fa /drivers/net/wireless/b43/phy_n.c
parent4cb9977516d0f52a779d12a430ccf263d35802fc (diff)
b43: N-PHY: add clip detection reading/writing and some classifier function
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.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 30b9dacb666c..72b1c410b7ff 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -28,6 +28,7 @@
28#include "b43.h" 28#include "b43.h"
29#include "phy_n.h" 29#include "phy_n.h"
30#include "tables_nphy.h" 30#include "tables_nphy.h"
31#include "main.h"
31 32
32struct nphy_txgains { 33struct nphy_txgains {
33 u16 txgm[2]; 34 u16 txgm[2];
@@ -373,6 +374,41 @@ static void b43_nphy_reset_cca(struct b43_wldev *dev)
373 /* TODO: N PHY Force RF Seq with argument 2 */ 374 /* TODO: N PHY Force RF Seq with argument 2 */
374} 375}
375 376
377/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/clip-detection */
378static void b43_nphy_write_clip_detection(struct b43_wldev *dev, u16 *clip_st)
379{
380 b43_phy_write(dev, B43_NPHY_C1_CLIP1THRES, clip_st[0]);
381 b43_phy_write(dev, B43_NPHY_C2_CLIP1THRES, clip_st[1]);
382}
383
384/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/clip-detection */
385static void b43_nphy_read_clip_detection(struct b43_wldev *dev, u16 *clip_st)
386{
387 clip_st[0] = b43_phy_read(dev, B43_NPHY_C1_CLIP1THRES);
388 clip_st[1] = b43_phy_read(dev, B43_NPHY_C2_CLIP1THRES);
389}
390
391/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/classifier */
392static u16 b43_nphy_classifier(struct b43_wldev *dev, u16 mask, u16 val)
393{
394 u16 tmp;
395
396 if (dev->dev->id.revision == 16)
397 b43_mac_suspend(dev);
398
399 tmp = b43_phy_read(dev, B43_NPHY_CLASSCTL);
400 tmp &= (B43_NPHY_CLASSCTL_CCKEN | B43_NPHY_CLASSCTL_OFDMEN |
401 B43_NPHY_CLASSCTL_WAITEDEN);
402 tmp &= ~mask;
403 tmp |= (val & mask);
404 b43_phy_maskset(dev, B43_NPHY_CLASSCTL, 0xFFF8, tmp);
405
406 if (dev->dev->id.revision == 16)
407 b43_mac_enable(dev);
408
409 return tmp;
410}
411
376enum b43_nphy_rf_sequence { 412enum b43_nphy_rf_sequence {
377 B43_RFSEQ_RX2TX, 413 B43_RFSEQ_RX2TX,
378 B43_RFSEQ_TX2RX, 414 B43_RFSEQ_TX2RX,
@@ -563,8 +599,8 @@ int b43_phy_initn(struct b43_wldev *dev)
563 b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX); 599 b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX);
564 /* b43_nphy_pa_override(dev, true); */ 600 /* b43_nphy_pa_override(dev, true); */
565 601
566 /* b43_nphy_classifier(dev, 0, 0); */ 602 b43_nphy_classifier(dev, 0, 0);
567 /* b43_nphy_read_clip_detection(dev, clip); */ 603 b43_nphy_read_clip_detection(dev, clip);
568 tx_pwr_state = nphy->txpwrctrl; 604 tx_pwr_state = nphy->txpwrctrl;
569 /* TODO N PHY TX power control with argument 0 605 /* TODO N PHY TX power control with argument 0
570 (turning off power control) */ 606 (turning off power control) */