diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2012-07-25 18:07:38 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-08-06 14:56:35 -0400 |
commit | d3d178f050813ec6b82b77cc2df668272e10daba (patch) | |
tree | 40d6d64314052a34969d50e0668ead846dc13b10 /drivers/net/wireless/b43 | |
parent | 0f941777c696e43e773b713a0078599aa22b3551 (diff) |
b43: N-PHY: finish 0x2056 radio setup
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')
-rw-r--r-- | drivers/net/wireless/b43/phy_n.c | 95 | ||||
-rw-r--r-- | drivers/net/wireless/b43/phy_n.h | 1 |
2 files changed, 90 insertions, 6 deletions
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index 0963d593b247..0e75c3567f5d 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c | |||
@@ -545,7 +545,9 @@ static void b43_radio_2056_setup(struct b43_wldev *dev, | |||
545 | enum ieee80211_band band = b43_current_band(dev->wl); | 545 | enum ieee80211_band band = b43_current_band(dev->wl); |
546 | u16 offset; | 546 | u16 offset; |
547 | u8 i; | 547 | u8 i; |
548 | u16 bias, cbias, pag_boost, pgag_boost, mixg_boost, padg_boost; | 548 | u16 bias, cbias; |
549 | u16 pag_boost, padg_boost, pgag_boost, mixg_boost; | ||
550 | u16 paa_boost, pada_boost, pgaa_boost, mixa_boost; | ||
549 | 551 | ||
550 | B43_WARN_ON(dev->phy.rev < 3); | 552 | B43_WARN_ON(dev->phy.rev < 3); |
551 | 553 | ||
@@ -630,7 +632,56 @@ static void b43_radio_2056_setup(struct b43_wldev *dev, | |||
630 | b43_radio_write(dev, offset | B2056_TX_PA_SPARE1, 0xee); | 632 | b43_radio_write(dev, offset | B2056_TX_PA_SPARE1, 0xee); |
631 | } | 633 | } |
632 | } else if (dev->phy.n->ipa5g_on && band == IEEE80211_BAND_5GHZ) { | 634 | } else if (dev->phy.n->ipa5g_on && band == IEEE80211_BAND_5GHZ) { |
633 | /* TODO */ | 635 | u16 freq = dev->phy.channel_freq; |
636 | if (freq < 5100) { | ||
637 | paa_boost = 0xA; | ||
638 | pada_boost = 0x77; | ||
639 | pgaa_boost = 0xF; | ||
640 | mixa_boost = 0xF; | ||
641 | } else if (freq < 5340) { | ||
642 | paa_boost = 0x8; | ||
643 | pada_boost = 0x77; | ||
644 | pgaa_boost = 0xFB; | ||
645 | mixa_boost = 0xF; | ||
646 | } else if (freq < 5650) { | ||
647 | paa_boost = 0x0; | ||
648 | pada_boost = 0x77; | ||
649 | pgaa_boost = 0xB; | ||
650 | mixa_boost = 0xF; | ||
651 | } else { | ||
652 | paa_boost = 0x0; | ||
653 | pada_boost = 0x77; | ||
654 | if (freq != 5825) | ||
655 | pgaa_boost = -(freq - 18) / 36 + 168; | ||
656 | else | ||
657 | pgaa_boost = 6; | ||
658 | mixa_boost = 0xF; | ||
659 | } | ||
660 | |||
661 | for (i = 0; i < 2; i++) { | ||
662 | offset = i ? B2056_TX1 : B2056_TX0; | ||
663 | |||
664 | b43_radio_write(dev, | ||
665 | offset | B2056_TX_INTPAA_BOOST_TUNE, paa_boost); | ||
666 | b43_radio_write(dev, | ||
667 | offset | B2056_TX_PADA_BOOST_TUNE, pada_boost); | ||
668 | b43_radio_write(dev, | ||
669 | offset | B2056_TX_PGAA_BOOST_TUNE, pgaa_boost); | ||
670 | b43_radio_write(dev, | ||
671 | offset | B2056_TX_MIXA_BOOST_TUNE, mixa_boost); | ||
672 | b43_radio_write(dev, | ||
673 | offset | B2056_TX_TXSPARE1, 0x30); | ||
674 | b43_radio_write(dev, | ||
675 | offset | B2056_TX_PA_SPARE2, 0xee); | ||
676 | b43_radio_write(dev, | ||
677 | offset | B2056_TX_PADA_CASCBIAS, 0x03); | ||
678 | b43_radio_write(dev, | ||
679 | offset | B2056_TX_INTPAA_IAUX_STAT, 0x50); | ||
680 | b43_radio_write(dev, | ||
681 | offset | B2056_TX_INTPAA_IMAIN_STAT, 0x50); | ||
682 | b43_radio_write(dev, | ||
683 | offset | B2056_TX_INTPAA_CASCBIAS, 0x30); | ||
684 | } | ||
634 | } | 685 | } |
635 | 686 | ||
636 | udelay(50); | 687 | udelay(50); |
@@ -643,6 +694,37 @@ static void b43_radio_2056_setup(struct b43_wldev *dev, | |||
643 | udelay(300); | 694 | udelay(300); |
644 | } | 695 | } |
645 | 696 | ||
697 | static u8 b43_radio_2056_rcal(struct b43_wldev *dev) | ||
698 | { | ||
699 | struct b43_phy *phy = &dev->phy; | ||
700 | u16 mast2, tmp; | ||
701 | |||
702 | if (phy->rev != 3) | ||
703 | return 0; | ||
704 | |||
705 | mast2 = b43_radio_read(dev, B2056_SYN_PLL_MAST2); | ||
706 | b43_radio_write(dev, B2056_SYN_PLL_MAST2, mast2 | 0x7); | ||
707 | |||
708 | udelay(10); | ||
709 | b43_radio_write(dev, B2056_SYN_RCAL_MASTER, 0x01); | ||
710 | udelay(10); | ||
711 | b43_radio_write(dev, B2056_SYN_RCAL_MASTER, 0x09); | ||
712 | |||
713 | if (!b43_radio_wait_value(dev, B2056_SYN_RCAL_CODE_OUT, 0x80, 0x80, 100, | ||
714 | 1000000)) { | ||
715 | b43err(dev->wl, "Radio recalibration timeout\n"); | ||
716 | return 0; | ||
717 | } | ||
718 | |||
719 | b43_radio_write(dev, B2056_SYN_RCAL_MASTER, 0x01); | ||
720 | tmp = b43_radio_read(dev, B2056_SYN_RCAL_CODE_OUT); | ||
721 | b43_radio_write(dev, B2056_SYN_RCAL_MASTER, 0x00); | ||
722 | |||
723 | b43_radio_write(dev, B2056_SYN_PLL_MAST2, mast2); | ||
724 | |||
725 | return tmp & 0x1f; | ||
726 | } | ||
727 | |||
646 | static void b43_radio_init2056_pre(struct b43_wldev *dev) | 728 | static void b43_radio_init2056_pre(struct b43_wldev *dev) |
647 | { | 729 | { |
648 | b43_phy_mask(dev, B43_NPHY_RFCTL_CMD, | 730 | b43_phy_mask(dev, B43_NPHY_RFCTL_CMD, |
@@ -665,10 +747,8 @@ static void b43_radio_init2056_post(struct b43_wldev *dev) | |||
665 | b43_radio_mask(dev, B2056_SYN_COM_RESET, ~0x2); | 747 | b43_radio_mask(dev, B2056_SYN_COM_RESET, ~0x2); |
666 | b43_radio_mask(dev, B2056_SYN_PLL_MAST2, ~0xFC); | 748 | b43_radio_mask(dev, B2056_SYN_PLL_MAST2, ~0xFC); |
667 | b43_radio_mask(dev, B2056_SYN_RCCAL_CTRL0, ~0x1); | 749 | b43_radio_mask(dev, B2056_SYN_RCCAL_CTRL0, ~0x1); |
668 | /* | 750 | if (dev->phy.n->init_por) |
669 | if (nphy->init_por) | 751 | b43_radio_2056_rcal(dev); |
670 | Call Radio 2056 Recalibrate | ||
671 | */ | ||
672 | } | 752 | } |
673 | 753 | ||
674 | /* | 754 | /* |
@@ -680,6 +760,8 @@ static void b43_radio_init2056(struct b43_wldev *dev) | |||
680 | b43_radio_init2056_pre(dev); | 760 | b43_radio_init2056_pre(dev); |
681 | b2056_upload_inittabs(dev, 0, 0); | 761 | b2056_upload_inittabs(dev, 0, 0); |
682 | b43_radio_init2056_post(dev); | 762 | b43_radio_init2056_post(dev); |
763 | |||
764 | dev->phy.n->init_por = false; | ||
683 | } | 765 | } |
684 | 766 | ||
685 | /************************************************** | 767 | /************************************************** |
@@ -5089,6 +5171,7 @@ static void b43_nphy_op_prepare_structs(struct b43_wldev *dev) | |||
5089 | nphy->hang_avoid = (phy->rev == 3 || phy->rev == 4); | 5171 | nphy->hang_avoid = (phy->rev == 3 || phy->rev == 4); |
5090 | nphy->spur_avoid = (phy->rev >= 3) ? | 5172 | nphy->spur_avoid = (phy->rev >= 3) ? |
5091 | B43_SPUR_AVOID_AUTO : B43_SPUR_AVOID_DISABLE; | 5173 | B43_SPUR_AVOID_AUTO : B43_SPUR_AVOID_DISABLE; |
5174 | nphy->init_por = true; | ||
5092 | nphy->gain_boost = true; /* this way we follow wl, assume it is true */ | 5175 | nphy->gain_boost = true; /* this way we follow wl, assume it is true */ |
5093 | nphy->txrx_chain = 2; /* sth different than 0 and 1 for now */ | 5176 | nphy->txrx_chain = 2; /* sth different than 0 and 1 for now */ |
5094 | nphy->phyrxchain = 3; /* to avoid b43_nphy_set_rx_core_state like wl */ | 5177 | nphy->phyrxchain = 3; /* to avoid b43_nphy_set_rx_core_state like wl */ |
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h index fd12b386fea1..092c0140c249 100644 --- a/drivers/net/wireless/b43/phy_n.h +++ b/drivers/net/wireless/b43/phy_n.h | |||
@@ -785,6 +785,7 @@ struct b43_phy_n { | |||
785 | u16 papd_epsilon_offset[2]; | 785 | u16 papd_epsilon_offset[2]; |
786 | s32 preamble_override; | 786 | s32 preamble_override; |
787 | u32 bb_mult_save; | 787 | u32 bb_mult_save; |
788 | bool init_por; | ||
788 | 789 | ||
789 | bool gain_boost; | 790 | bool gain_boost; |
790 | bool elna_gain_config; | 791 | bool elna_gain_config; |