diff options
author | Gábor Stefanik <netrolller.3d@gmail.com> | 2009-08-28 15:37:00 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-31 14:42:12 -0400 |
commit | c206a39d58fa335275403088171482f66fdbedcf (patch) | |
tree | da967cbf5b8813ba3ab8e998d7587e3bba38b6d5 /drivers/net/wireless/b43/phy_a.c | |
parent | af472a953ef23d6b9fe717486974d7caff3fa194 (diff) |
b43: Refactor and update antenna diversity for A/G-PHY
-Make use of the b43_phy_set/mask/maskset helpers.
-Fix a few errors in the code.
-Make the code more readable.
Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/phy_a.c')
-rw-r--r-- | drivers/net/wireless/b43/phy_a.c | 48 |
1 files changed, 15 insertions, 33 deletions
diff --git a/drivers/net/wireless/b43/phy_a.c b/drivers/net/wireless/b43/phy_a.c index 809ec97031cb..d90217c3a706 100644 --- a/drivers/net/wireless/b43/phy_a.c +++ b/drivers/net/wireless/b43/phy_a.c | |||
@@ -518,58 +518,40 @@ static unsigned int b43_aphy_op_get_default_chan(struct b43_wldev *dev) | |||
518 | static void b43_aphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna) | 518 | static void b43_aphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna) |
519 | {//TODO | 519 | {//TODO |
520 | struct b43_phy *phy = &dev->phy; | 520 | struct b43_phy *phy = &dev->phy; |
521 | u64 hf; | ||
522 | u16 tmp; | 521 | u16 tmp; |
523 | int autodiv = 0; | 522 | int autodiv = 0; |
524 | 523 | ||
525 | if (antenna == B43_ANTENNA_AUTO0 || antenna == B43_ANTENNA_AUTO1) | 524 | if (antenna == B43_ANTENNA_AUTO0 || antenna == B43_ANTENNA_AUTO1) |
526 | autodiv = 1; | 525 | autodiv = 1; |
527 | 526 | ||
528 | hf = b43_hf_read(dev); | 527 | b43_hf_write(dev, b43_hf_read(dev) & ~B43_HF_ANTDIVHELP); |
529 | hf &= ~B43_HF_ANTDIVHELP; | ||
530 | b43_hf_write(dev, hf); | ||
531 | 528 | ||
532 | tmp = b43_phy_read(dev, B43_PHY_BBANDCFG); | 529 | b43_phy_maskset(dev, B43_PHY_BBANDCFG, ~B43_PHY_BBANDCFG_RXANT, |
533 | tmp &= ~B43_PHY_BBANDCFG_RXANT; | 530 | (autodiv ? B43_ANTENNA_AUTO1 : antenna) << |
534 | tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna) | 531 | B43_PHY_BBANDCFG_RXANT_SHIFT); |
535 | << B43_PHY_BBANDCFG_RXANT_SHIFT; | ||
536 | b43_phy_write(dev, B43_PHY_BBANDCFG, tmp); | ||
537 | 532 | ||
538 | if (autodiv) { | 533 | if (autodiv) { |
539 | tmp = b43_phy_read(dev, B43_PHY_ANTDWELL); | 534 | tmp = b43_phy_read(dev, B43_PHY_ANTDWELL); |
540 | if (antenna == B43_ANTENNA_AUTO0) | 535 | if (antenna == B43_ANTENNA_AUTO1) |
541 | tmp &= ~B43_PHY_ANTDWELL_AUTODIV1; | 536 | tmp &= ~B43_PHY_ANTDWELL_AUTODIV1; |
542 | else | 537 | else |
543 | tmp |= B43_PHY_ANTDWELL_AUTODIV1; | 538 | tmp |= B43_PHY_ANTDWELL_AUTODIV1; |
544 | b43_phy_write(dev, B43_PHY_ANTDWELL, tmp); | 539 | b43_phy_write(dev, B43_PHY_ANTDWELL, tmp); |
545 | } | 540 | } |
546 | if (phy->rev < 3) { | 541 | if (phy->rev < 3) |
547 | tmp = b43_phy_read(dev, B43_PHY_ANTDWELL); | 542 | b43_phy_maskset(dev, B43_PHY_ANTDWELL, 0xFF00, 0x24); |
548 | tmp = (tmp & 0xFF00) | 0x24; | 543 | else { |
549 | b43_phy_write(dev, B43_PHY_ANTDWELL, tmp); | 544 | b43_phy_set(dev, B43_PHY_OFDM61, 0x10); |
550 | } else { | 545 | if (phy->rev == 3) { |
551 | tmp = b43_phy_read(dev, B43_PHY_OFDM61); | 546 | b43_phy_write(dev, B43_PHY_CLIPPWRDOWNT, 0x1D); |
552 | tmp |= 0x10; | 547 | b43_phy_write(dev, B43_PHY_ADIVRELATED, 8); |
553 | b43_phy_write(dev, B43_PHY_OFDM61, tmp); | ||
554 | if (phy->analog == 3) { | ||
555 | b43_phy_write(dev, B43_PHY_CLIPPWRDOWNT, | ||
556 | 0x1D); | ||
557 | b43_phy_write(dev, B43_PHY_ADIVRELATED, | ||
558 | 8); | ||
559 | } else { | 548 | } else { |
560 | b43_phy_write(dev, B43_PHY_CLIPPWRDOWNT, | 549 | b43_phy_write(dev, B43_PHY_CLIPPWRDOWNT, 0x3A); |
561 | 0x3A); | 550 | b43_phy_maskset(dev, B43_PHY_ADIVRELATED, 0xFF00, 8); |
562 | tmp = | ||
563 | b43_phy_read(dev, | ||
564 | B43_PHY_ADIVRELATED); | ||
565 | tmp = (tmp & 0xFF00) | 8; | ||
566 | b43_phy_write(dev, B43_PHY_ADIVRELATED, | ||
567 | tmp); | ||
568 | } | 551 | } |
569 | } | 552 | } |
570 | 553 | ||
571 | hf |= B43_HF_ANTDIVHELP; | 554 | b43_hf_write(dev, b43_hf_read(dev) | B43_HF_ANTDIVHELP); |
572 | b43_hf_write(dev, hf); | ||
573 | } | 555 | } |
574 | 556 | ||
575 | static void b43_aphy_op_adjust_txpower(struct b43_wldev *dev) | 557 | static void b43_aphy_op_adjust_txpower(struct b43_wldev *dev) |