aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2007-02-13 17:54:56 -0500
committerJohn W. Linville <linville@tuxdriver.com>2007-02-14 15:45:05 -0500
commit740ac4fb08866d702be90f167665d03759bd27d0 (patch)
tree4528dfcbcbb0198640421f94f6132fae154205ce /drivers/net
parentb5c41651645f7604dda7abc3445e1622f9b1b9ab (diff)
[PATCH] bcm43xx: Fix for 4311 and 02/07/07 specification changes
The specifications for the bcm43xx driver have been modified. This patch incorporates these changes in the code, which results in the BCM4311 and BCM4312 working. The name of one of the PHY parameters, previously known as "version", has been changed to "analog", short for "analog core version" . Signed-off-by: Larry Finger<Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx.h4
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_main.c10
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_phy.c187
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_radio.c13
4 files changed, 95 insertions, 119 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx.h b/drivers/net/wireless/bcm43xx/bcm43xx.h
index f649143627aa..6b1749bb7242 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx.h
@@ -333,7 +333,7 @@
333#define BCM43xx_SBF_PS2 0x04000000 333#define BCM43xx_SBF_PS2 0x04000000
334#define BCM43xx_SBF_NO_SSID_BCAST 0x08000000 334#define BCM43xx_SBF_NO_SSID_BCAST 0x08000000
335#define BCM43xx_SBF_TIME_UPDATE 0x10000000 335#define BCM43xx_SBF_TIME_UPDATE 0x10000000
336#define BCM43xx_SBF_80000000 0x80000000 /*FIXME: fix name*/ 336#define BCM43xx_SBF_MODE_G 0x80000000
337 337
338/* Microcode */ 338/* Microcode */
339#define BCM43xx_UCODE_REVISION 0x0000 339#define BCM43xx_UCODE_REVISION 0x0000
@@ -536,7 +536,7 @@ struct bcm43xx_lopair {
536 536
537struct bcm43xx_phyinfo { 537struct bcm43xx_phyinfo {
538 /* Hardware Data */ 538 /* Hardware Data */
539 u8 version; 539 u8 analog;
540 u8 type; 540 u8 type;
541 u8 rev; 541 u8 rev;
542 u16 antenna_diversity; 542 u16 antenna_diversity;
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
index 85077ba6ce11..e5336facd158 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -3674,7 +3674,7 @@ static int bcm43xx_read_phyinfo(struct bcm43xx_private *bcm)
3674{ 3674{
3675 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); 3675 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
3676 u16 value; 3676 u16 value;
3677 u8 phy_version; 3677 u8 phy_analog;
3678 u8 phy_type; 3678 u8 phy_type;
3679 u8 phy_rev; 3679 u8 phy_rev;
3680 int phy_rev_ok = 1; 3680 int phy_rev_ok = 1;
@@ -3682,12 +3682,12 @@ static int bcm43xx_read_phyinfo(struct bcm43xx_private *bcm)
3682 3682
3683 value = bcm43xx_read16(bcm, BCM43xx_MMIO_PHY_VER); 3683 value = bcm43xx_read16(bcm, BCM43xx_MMIO_PHY_VER);
3684 3684
3685 phy_version = (value & 0xF000) >> 12; 3685 phy_analog = (value & 0xF000) >> 12;
3686 phy_type = (value & 0x0F00) >> 8; 3686 phy_type = (value & 0x0F00) >> 8;
3687 phy_rev = (value & 0x000F); 3687 phy_rev = (value & 0x000F);
3688 3688
3689 dprintk(KERN_INFO PFX "Detected PHY: Version: %x, Type %x, Revision %x\n", 3689 dprintk(KERN_INFO PFX "Detected PHY: Analog: %x, Type %x, Revision %x\n",
3690 phy_version, phy_type, phy_rev); 3690 phy_analog, phy_type, phy_rev);
3691 3691
3692 switch (phy_type) { 3692 switch (phy_type) {
3693 case BCM43xx_PHYTYPE_A: 3693 case BCM43xx_PHYTYPE_A:
@@ -3730,7 +3730,7 @@ static int bcm43xx_read_phyinfo(struct bcm43xx_private *bcm)
3730 phy_rev); 3730 phy_rev);
3731 } 3731 }
3732 3732
3733 phy->version = phy_version; 3733 phy->analog = phy_analog;
3734 phy->type = phy_type; 3734 phy->type = phy_type;
3735 phy->rev = phy_rev; 3735 phy->rev = phy_rev;
3736 if ((phy_type == BCM43xx_PHYTYPE_B) || (phy_type == BCM43xx_PHYTYPE_G)) { 3736 if ((phy_type == BCM43xx_PHYTYPE_B) || (phy_type == BCM43xx_PHYTYPE_G)) {
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
index 52ce2a9334fb..a08f9d1bd57d 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
@@ -205,8 +205,8 @@ static void bcm43xx_phy_init_pctl(struct bcm43xx_private *bcm)
205 (bcm->board_type == 0x0416)) 205 (bcm->board_type == 0x0416))
206 return; 206 return;
207 207
208 bcm43xx_write16(bcm, 0x03E6, bcm43xx_read16(bcm, 0x03E6) & 0xFFDF);
209 bcm43xx_phy_write(bcm, 0x0028, 0x8018); 208 bcm43xx_phy_write(bcm, 0x0028, 0x8018);
209 bcm43xx_write16(bcm, 0x03E6, bcm43xx_read16(bcm, 0x03E6) & 0xFFDF);
210 210
211 if (phy->type == BCM43xx_PHYTYPE_G) { 211 if (phy->type == BCM43xx_PHYTYPE_G) {
212 if (!phy->connected) 212 if (!phy->connected)
@@ -317,6 +317,13 @@ static void bcm43xx_phy_agcsetup(struct bcm43xx_private *bcm)
317 bcm43xx_ilt_write(bcm, offset + 0x0801, 7); 317 bcm43xx_ilt_write(bcm, offset + 0x0801, 7);
318 bcm43xx_ilt_write(bcm, offset + 0x0802, 16); 318 bcm43xx_ilt_write(bcm, offset + 0x0802, 16);
319 bcm43xx_ilt_write(bcm, offset + 0x0803, 28); 319 bcm43xx_ilt_write(bcm, offset + 0x0803, 28);
320
321 if (phy->rev >= 6) {
322 bcm43xx_phy_write(bcm, 0x0426, (bcm43xx_phy_read(bcm, 0x0426)
323 & 0xFFFC));
324 bcm43xx_phy_write(bcm, 0x0426, (bcm43xx_phy_read(bcm, 0x0426)
325 & 0xEFFF));
326 }
320} 327}
321 328
322static void bcm43xx_phy_setupg(struct bcm43xx_private *bcm) 329static void bcm43xx_phy_setupg(struct bcm43xx_private *bcm)
@@ -729,19 +736,19 @@ static void bcm43xx_phy_initb5(struct bcm43xx_private *bcm)
729 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); 736 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
730 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); 737 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
731 u16 offset; 738 u16 offset;
739 u16 value;
740 u8 old_channel;
732 741
733 if (phy->version == 1 && 742 if (phy->analog == 1)
734 radio->version == 0x2050) {
735 bcm43xx_radio_write16(bcm, 0x007A, 743 bcm43xx_radio_write16(bcm, 0x007A,
736 bcm43xx_radio_read16(bcm, 0x007A) 744 bcm43xx_radio_read16(bcm, 0x007A)
737 | 0x0050); 745 | 0x0050);
738 }
739 if ((bcm->board_vendor != PCI_VENDOR_ID_BROADCOM) && 746 if ((bcm->board_vendor != PCI_VENDOR_ID_BROADCOM) &&
740 (bcm->board_type != 0x0416)) { 747 (bcm->board_type != 0x0416)) {
748 value = 0x2120;
741 for (offset = 0x00A8 ; offset < 0x00C7; offset++) { 749 for (offset = 0x00A8 ; offset < 0x00C7; offset++) {
742 bcm43xx_phy_write(bcm, offset, 750 bcm43xx_phy_write(bcm, offset, value);
743 (bcm43xx_phy_read(bcm, offset) + 0x2020) 751 value += 0x0202;
744 & 0x3F3F);
745 } 752 }
746 } 753 }
747 bcm43xx_phy_write(bcm, 0x0035, 754 bcm43xx_phy_write(bcm, 0x0035,
@@ -750,7 +757,7 @@ static void bcm43xx_phy_initb5(struct bcm43xx_private *bcm)
750 if (radio->version == 0x2050) 757 if (radio->version == 0x2050)
751 bcm43xx_phy_write(bcm, 0x0038, 0x0667); 758 bcm43xx_phy_write(bcm, 0x0038, 0x0667);
752 759
753 if (phy->connected) { 760 if (phy->type == BCM43xx_PHYTYPE_G) {
754 if (radio->version == 0x2050) { 761 if (radio->version == 0x2050) {
755 bcm43xx_radio_write16(bcm, 0x007A, 762 bcm43xx_radio_write16(bcm, 0x007A,
756 bcm43xx_radio_read16(bcm, 0x007A) 763 bcm43xx_radio_read16(bcm, 0x007A)
@@ -776,7 +783,7 @@ static void bcm43xx_phy_initb5(struct bcm43xx_private *bcm)
776 bcm43xx_phy_read(bcm, BCM43xx_PHY_RADIO_BITFIELD) | (1 << 11)); 783 bcm43xx_phy_read(bcm, BCM43xx_PHY_RADIO_BITFIELD) | (1 << 11));
777 } 784 }
778 785
779 if (phy->version == 1 && radio->version == 0x2050) { 786 if (phy->analog == 1) {
780 bcm43xx_phy_write(bcm, 0x0026, 0xCE00); 787 bcm43xx_phy_write(bcm, 0x0026, 0xCE00);
781 bcm43xx_phy_write(bcm, 0x0021, 0x3763); 788 bcm43xx_phy_write(bcm, 0x0021, 0x3763);
782 bcm43xx_phy_write(bcm, 0x0022, 0x1BC3); 789 bcm43xx_phy_write(bcm, 0x0022, 0x1BC3);
@@ -787,14 +794,15 @@ static void bcm43xx_phy_initb5(struct bcm43xx_private *bcm)
787 bcm43xx_phy_write(bcm, 0x0030, 0x00C6); 794 bcm43xx_phy_write(bcm, 0x0030, 0x00C6);
788 bcm43xx_write16(bcm, 0x03EC, 0x3F22); 795 bcm43xx_write16(bcm, 0x03EC, 0x3F22);
789 796
790 if (phy->version == 1 && radio->version == 0x2050) 797 if (phy->analog == 1)
791 bcm43xx_phy_write(bcm, 0x0020, 0x3E1C); 798 bcm43xx_phy_write(bcm, 0x0020, 0x3E1C);
792 else 799 else
793 bcm43xx_phy_write(bcm, 0x0020, 0x301C); 800 bcm43xx_phy_write(bcm, 0x0020, 0x301C);
794 801
795 if (phy->version == 0) 802 if (phy->analog == 0)
796 bcm43xx_write16(bcm, 0x03E4, 0x3000); 803 bcm43xx_write16(bcm, 0x03E4, 0x3000);
797 804
805 old_channel = radio->channel;
798 /* Force to channel 7, even if not supported. */ 806 /* Force to channel 7, even if not supported. */
799 bcm43xx_radio_selectchannel(bcm, 7, 0); 807 bcm43xx_radio_selectchannel(bcm, 7, 0);
800 808
@@ -816,11 +824,11 @@ static void bcm43xx_phy_initb5(struct bcm43xx_private *bcm)
816 824
817 bcm43xx_radio_write16(bcm, 0x007A, bcm43xx_radio_read16(bcm, 0x007A) | 0x0007); 825 bcm43xx_radio_write16(bcm, 0x007A, bcm43xx_radio_read16(bcm, 0x007A) | 0x0007);
818 826
819 bcm43xx_radio_selectchannel(bcm, BCM43xx_RADIO_DEFAULT_CHANNEL_BG, 0); 827 bcm43xx_radio_selectchannel(bcm, old_channel, 0);
820 828
821 bcm43xx_phy_write(bcm, 0x0014, 0x0080); 829 bcm43xx_phy_write(bcm, 0x0014, 0x0080);
822 bcm43xx_phy_write(bcm, 0x0032, 0x00CA); 830 bcm43xx_phy_write(bcm, 0x0032, 0x00CA);
823 bcm43xx_phy_write(bcm, 0x88A3, 0x002A); 831 bcm43xx_phy_write(bcm, 0x002A, 0x88A3);
824 832
825 bcm43xx_radio_set_txpower_bg(bcm, 0xFFFF, 0xFFFF, 0xFFFF); 833 bcm43xx_radio_set_txpower_bg(bcm, 0xFFFF, 0xFFFF, 0xFFFF);
826 834
@@ -835,61 +843,24 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm)
835 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); 843 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
836 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); 844 struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
837 u16 offset, val; 845 u16 offset, val;
846 u8 old_channel;
838 847
839 bcm43xx_phy_write(bcm, 0x003E, 0x817A); 848 bcm43xx_phy_write(bcm, 0x003E, 0x817A);
840 bcm43xx_radio_write16(bcm, 0x007A, 849 bcm43xx_radio_write16(bcm, 0x007A,
841 (bcm43xx_radio_read16(bcm, 0x007A) | 0x0058)); 850 (bcm43xx_radio_read16(bcm, 0x007A) | 0x0058));
842 if ((radio->manufact == 0x17F) && 851 if (radio->revision == 4 ||
843 (radio->version == 0x2050) && 852 radio->revision == 5) {
844 (radio->revision == 3 || 853 bcm43xx_radio_write16(bcm, 0x0051, 0x0037);
845 radio->revision == 4 || 854 bcm43xx_radio_write16(bcm, 0x0052, 0x0070);
846 radio->revision == 5)) { 855 bcm43xx_radio_write16(bcm, 0x0053, 0x00B3);
847 bcm43xx_radio_write16(bcm, 0x0051, 0x001F); 856 bcm43xx_radio_write16(bcm, 0x0054, 0x009B);
848 bcm43xx_radio_write16(bcm, 0x0052, 0x0040);
849 bcm43xx_radio_write16(bcm, 0x0053, 0x005B);
850 bcm43xx_radio_write16(bcm, 0x0054, 0x0098);
851 bcm43xx_radio_write16(bcm, 0x005A, 0x0088); 857 bcm43xx_radio_write16(bcm, 0x005A, 0x0088);
852 bcm43xx_radio_write16(bcm, 0x005B, 0x0088); 858 bcm43xx_radio_write16(bcm, 0x005B, 0x0088);
853 bcm43xx_radio_write16(bcm, 0x005D, 0x0088); 859 bcm43xx_radio_write16(bcm, 0x005D, 0x0088);
854 bcm43xx_radio_write16(bcm, 0x005E, 0x0088); 860 bcm43xx_radio_write16(bcm, 0x005E, 0x0088);
855 bcm43xx_radio_write16(bcm, 0x007D, 0x0088); 861 bcm43xx_radio_write16(bcm, 0x007D, 0x0088);
856 } 862 }
857 if ((radio->manufact == 0x17F) && 863 if (radio->revision == 8) {
858 (radio->version == 0x2050) &&
859 (radio->revision == 6)) {
860 bcm43xx_radio_write16(bcm, 0x0051, 0x0000);
861 bcm43xx_radio_write16(bcm, 0x0052, 0x0040);
862 bcm43xx_radio_write16(bcm, 0x0053, 0x00B7);
863 bcm43xx_radio_write16(bcm, 0x0054, 0x0098);
864 bcm43xx_radio_write16(bcm, 0x005A, 0x0088);
865 bcm43xx_radio_write16(bcm, 0x005B, 0x008B);
866 bcm43xx_radio_write16(bcm, 0x005C, 0x00B5);
867 bcm43xx_radio_write16(bcm, 0x005D, 0x0088);
868 bcm43xx_radio_write16(bcm, 0x005E, 0x0088);
869 bcm43xx_radio_write16(bcm, 0x007D, 0x0088);
870 bcm43xx_radio_write16(bcm, 0x007C, 0x0001);
871 bcm43xx_radio_write16(bcm, 0x007E, 0x0008);
872 }
873 if ((radio->manufact == 0x17F) &&
874 (radio->version == 0x2050) &&
875 (radio->revision == 7)) {
876 bcm43xx_radio_write16(bcm, 0x0051, 0x0000);
877 bcm43xx_radio_write16(bcm, 0x0052, 0x0040);
878 bcm43xx_radio_write16(bcm, 0x0053, 0x00B7);
879 bcm43xx_radio_write16(bcm, 0x0054, 0x0098);
880 bcm43xx_radio_write16(bcm, 0x005A, 0x0088);
881 bcm43xx_radio_write16(bcm, 0x005B, 0x00A8);
882 bcm43xx_radio_write16(bcm, 0x005C, 0x0075);
883 bcm43xx_radio_write16(bcm, 0x005D, 0x00F5);
884 bcm43xx_radio_write16(bcm, 0x005E, 0x00B8);
885 bcm43xx_radio_write16(bcm, 0x007D, 0x00E8);
886 bcm43xx_radio_write16(bcm, 0x007C, 0x0001);
887 bcm43xx_radio_write16(bcm, 0x007E, 0x0008);
888 bcm43xx_radio_write16(bcm, 0x007B, 0x0000);
889 }
890 if ((radio->manufact == 0x17F) &&
891 (radio->version == 0x2050) &&
892 (radio->revision == 8)) {
893 bcm43xx_radio_write16(bcm, 0x0051, 0x0000); 864 bcm43xx_radio_write16(bcm, 0x0051, 0x0000);
894 bcm43xx_radio_write16(bcm, 0x0052, 0x0040); 865 bcm43xx_radio_write16(bcm, 0x0052, 0x0040);
895 bcm43xx_radio_write16(bcm, 0x0053, 0x00B7); 866 bcm43xx_radio_write16(bcm, 0x0053, 0x00B7);
@@ -933,20 +904,26 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm)
933 bcm43xx_phy_read(bcm, 0x0802) | 0x0100); 904 bcm43xx_phy_read(bcm, 0x0802) | 0x0100);
934 bcm43xx_phy_write(bcm, 0x042B, 905 bcm43xx_phy_write(bcm, 0x042B,
935 bcm43xx_phy_read(bcm, 0x042B) | 0x2000); 906 bcm43xx_phy_read(bcm, 0x042B) | 0x2000);
907 bcm43xx_phy_write(bcm, 0x5B, 0x0000);
908 bcm43xx_phy_write(bcm, 0x5C, 0x0000);
936 } 909 }
937 910
938 /* Force to channel 7, even if not supported. */ 911 old_channel = radio->channel;
939 bcm43xx_radio_selectchannel(bcm, 7, 0); 912 if (old_channel >= 8)
913 bcm43xx_radio_selectchannel(bcm, 1, 0);
914 else
915 bcm43xx_radio_selectchannel(bcm, 13, 0);
940 916
941 bcm43xx_radio_write16(bcm, 0x0050, 0x0020); 917 bcm43xx_radio_write16(bcm, 0x0050, 0x0020);
942 bcm43xx_radio_write16(bcm, 0x0050, 0x0023); 918 bcm43xx_radio_write16(bcm, 0x0050, 0x0023);
943 udelay(40); 919 udelay(40);
944 bcm43xx_radio_write16(bcm, 0x007C, (bcm43xx_radio_read16(bcm, 0x007C) | 0x0002)); 920 if (radio->revision < 6 || radio-> revision == 8) {
945 bcm43xx_radio_write16(bcm, 0x0050, 0x0020); 921 bcm43xx_radio_write16(bcm, 0x007C, (bcm43xx_radio_read16(bcm, 0x007C)
946 if (radio->manufact == 0x17F && 922 | 0x0002));
947 radio->version == 0x2050 &&
948 radio->revision <= 2) {
949 bcm43xx_radio_write16(bcm, 0x0050, 0x0020); 923 bcm43xx_radio_write16(bcm, 0x0050, 0x0020);
924 }
925 if (radio->revision <= 2) {
926 bcm43xx_radio_write16(bcm, 0x007C, 0x0020);
950 bcm43xx_radio_write16(bcm, 0x005A, 0x0070); 927 bcm43xx_radio_write16(bcm, 0x005A, 0x0070);
951 bcm43xx_radio_write16(bcm, 0x005B, 0x007B); 928 bcm43xx_radio_write16(bcm, 0x005B, 0x007B);
952 bcm43xx_radio_write16(bcm, 0x005C, 0x00B0); 929 bcm43xx_radio_write16(bcm, 0x005C, 0x00B0);
@@ -954,46 +931,41 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm)
954 bcm43xx_radio_write16(bcm, 0x007A, 931 bcm43xx_radio_write16(bcm, 0x007A,
955 (bcm43xx_radio_read16(bcm, 0x007A) & 0x00F8) | 0x0007); 932 (bcm43xx_radio_read16(bcm, 0x007A) & 0x00F8) | 0x0007);
956 933
957 bcm43xx_radio_selectchannel(bcm, BCM43xx_RADIO_DEFAULT_CHANNEL_BG, 0); 934 bcm43xx_radio_selectchannel(bcm, old_channel, 0);
958 935
959 bcm43xx_phy_write(bcm, 0x0014, 0x0200); 936 bcm43xx_phy_write(bcm, 0x0014, 0x0200);
960 if (radio->version == 0x2050){ 937 if (radio->revision >= 6)
961 if (radio->revision == 3 || 938 bcm43xx_phy_write(bcm, 0x002A, 0x88C2);
962 radio->revision == 4 || 939 else
963 radio->revision == 5) 940 bcm43xx_phy_write(bcm, 0x002A, 0x8AC0);
964 bcm43xx_phy_write(bcm, 0x002A, 0x8AC0);
965 else
966 bcm43xx_phy_write(bcm, 0x002A, 0x88C2);
967 }
968 bcm43xx_phy_write(bcm, 0x0038, 0x0668); 941 bcm43xx_phy_write(bcm, 0x0038, 0x0668);
969 bcm43xx_radio_set_txpower_bg(bcm, 0xFFFF, 0xFFFF, 0xFFFF); 942 bcm43xx_radio_set_txpower_bg(bcm, 0xFFFF, 0xFFFF, 0xFFFF);
970 if (radio->version == 0x2050) { 943 if (radio->revision <= 5)
971 if (radio->revision == 3 || 944 bcm43xx_phy_write(bcm, 0x005D, bcm43xx_phy_read(bcm, 0x005D) | 0x0003);
972 radio->revision == 4 || 945 if (radio->revision <= 2)
973 radio->revision == 5) 946 bcm43xx_radio_write16(bcm, 0x005D, 0x000D);
974 bcm43xx_phy_write(bcm, 0x005D, bcm43xx_phy_read(bcm, 0x005D) | 0x0003);
975 else if (radio->revision <= 2)
976 bcm43xx_radio_write16(bcm, 0x005D, 0x000D);
977 }
978 947
979 if (phy->rev == 4) 948 if (phy->analog == 4){
980 bcm43xx_phy_write(bcm, 0x0002, (bcm43xx_phy_read(bcm, 0x0002) & 0xFFC0) | 0x0004);
981 else
982 bcm43xx_write16(bcm, 0x03E4, 0x0009); 949 bcm43xx_write16(bcm, 0x03E4, 0x0009);
950 bcm43xx_phy_write(bcm, 0x61, bcm43xx_phy_read(bcm, 0x61) & 0xFFF);
951 } else {
952 bcm43xx_phy_write(bcm, 0x0002, (bcm43xx_phy_read(bcm, 0x0002) & 0xFFC0) | 0x0004);
953 }
954 if (phy->type == BCM43xx_PHYTYPE_G)
955 bcm43xx_write16(bcm, 0x03E6, 0x0);
983 if (phy->type == BCM43xx_PHYTYPE_B) { 956 if (phy->type == BCM43xx_PHYTYPE_B) {
984 bcm43xx_write16(bcm, 0x03E6, 0x8140); 957 bcm43xx_write16(bcm, 0x03E6, 0x8140);
985 bcm43xx_phy_write(bcm, 0x0016, 0x0410); 958 bcm43xx_phy_write(bcm, 0x0016, 0x0410);
986 bcm43xx_phy_write(bcm, 0x0017, 0x0820); 959 bcm43xx_phy_write(bcm, 0x0017, 0x0820);
987 bcm43xx_phy_write(bcm, 0x0062, 0x0007); 960 bcm43xx_phy_write(bcm, 0x0062, 0x0007);
988 (void) bcm43xx_radio_calibrationvalue(bcm); 961 (void) bcm43xx_radio_calibrationvalue(bcm);
989 bcm43xx_phy_lo_b_measure(bcm); 962 bcm43xx_phy_lo_g_measure(bcm);
990 if (bcm->sprom.boardflags & BCM43xx_BFL_RSSI) { 963 if (bcm->sprom.boardflags & BCM43xx_BFL_RSSI) {
991 bcm43xx_calc_nrssi_slope(bcm); 964 bcm43xx_calc_nrssi_slope(bcm);
992 bcm43xx_calc_nrssi_threshold(bcm); 965 bcm43xx_calc_nrssi_threshold(bcm);
993 } 966 }
994 bcm43xx_phy_init_pctl(bcm); 967 bcm43xx_phy_init_pctl(bcm);
995 } else 968 }
996 bcm43xx_write16(bcm, 0x03E6, 0x0);
997} 969}
998 970
999static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm) 971static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
@@ -1063,7 +1035,7 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
1063 bcm43xx_phy_write(bcm, 0x005A, 0x0780); 1035 bcm43xx_phy_write(bcm, 0x005A, 0x0780);
1064 bcm43xx_phy_write(bcm, 0x0059, 0xC810); 1036 bcm43xx_phy_write(bcm, 0x0059, 0xC810);
1065 bcm43xx_phy_write(bcm, 0x0058, 0x000D); 1037 bcm43xx_phy_write(bcm, 0x0058, 0x000D);
1066 if (phy->version == 0) { 1038 if (phy->analog == 0) {
1067 bcm43xx_phy_write(bcm, 0x0003, 0x0122); 1039 bcm43xx_phy_write(bcm, 0x0003, 0x0122);
1068 } else { 1040 } else {
1069 bcm43xx_phy_write(bcm, 0x000A, 1041 bcm43xx_phy_write(bcm, 0x000A,
@@ -1205,27 +1177,30 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
1205 if (phy->rev >= 2) { 1177 if (phy->rev >= 2) {
1206 bcm43xx_phy_write(bcm, 0x0814, 0x0000); 1178 bcm43xx_phy_write(bcm, 0x0814, 0x0000);
1207 bcm43xx_phy_write(bcm, 0x0815, 0x0000); 1179 bcm43xx_phy_write(bcm, 0x0815, 0x0000);
1208 if (phy->rev == 2) 1180 }
1209 bcm43xx_phy_write(bcm, 0x0811, 0x0000); 1181 if (phy->rev == 2) {
1210 else if (phy->rev >= 3) 1182 bcm43xx_phy_write(bcm, 0x0811, 0x0000);
1211 bcm43xx_phy_write(bcm, 0x0811, 0x0400);
1212 bcm43xx_phy_write(bcm, 0x0015, 0x00C0); 1183 bcm43xx_phy_write(bcm, 0x0015, 0x00C0);
1213 if (phy->connected) { 1184 }
1214 tmp = bcm43xx_phy_read(bcm, 0x0400) & 0xFF; 1185 if (phy->rev >= 3) {
1215 if (tmp < 6) { 1186 bcm43xx_phy_write(bcm, 0x0811, 0x0400);
1216 bcm43xx_phy_write(bcm, 0x04C2, 0x1816); 1187 bcm43xx_phy_write(bcm, 0x0015, 0x00C0);
1217 bcm43xx_phy_write(bcm, 0x04C3, 0x8006); 1188 }
1218 if (tmp != 3) { 1189 if (phy->connected) {
1219 bcm43xx_phy_write(bcm, 0x04CC, 1190 tmp = bcm43xx_phy_read(bcm, 0x0400) & 0xFF;
1220 (bcm43xx_phy_read(bcm, 0x04CC) 1191 if (tmp < 6) {
1221 & 0x00FF) | 0x1F00); 1192 bcm43xx_phy_write(bcm, 0x04C2, 0x1816);
1222 } 1193 bcm43xx_phy_write(bcm, 0x04C3, 0x8006);
1194 if (tmp != 3) {
1195 bcm43xx_phy_write(bcm, 0x04CC,
1196 (bcm43xx_phy_read(bcm, 0x04CC)
1197 & 0x00FF) | 0x1F00);
1223 } 1198 }
1224 } 1199 }
1225 } 1200 }
1226 if (phy->rev < 3 && phy->connected) 1201 if (phy->rev < 3 && phy->connected)
1227 bcm43xx_phy_write(bcm, 0x047E, 0x0078); 1202 bcm43xx_phy_write(bcm, 0x047E, 0x0078);
1228 if (phy->rev >= 6 && phy->rev <= 8) { 1203 if (radio->revision == 8) {
1229 bcm43xx_phy_write(bcm, 0x0801, bcm43xx_phy_read(bcm, 0x0801) | 0x0080); 1204 bcm43xx_phy_write(bcm, 0x0801, bcm43xx_phy_read(bcm, 0x0801) | 0x0080);
1230 bcm43xx_phy_write(bcm, 0x043E, bcm43xx_phy_read(bcm, 0x043E) | 0x0004); 1205 bcm43xx_phy_write(bcm, 0x043E, bcm43xx_phy_read(bcm, 0x043E) | 0x0004);
1231 } 1206 }
@@ -1638,14 +1613,14 @@ void bcm43xx_phy_set_baseband_attenuation(struct bcm43xx_private *bcm,
1638 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); 1613 struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
1639 u16 value; 1614 u16 value;
1640 1615
1641 if (phy->version == 0) { 1616 if (phy->analog == 0) {
1642 value = (bcm43xx_read16(bcm, 0x03E6) & 0xFFF0); 1617 value = (bcm43xx_read16(bcm, 0x03E6) & 0xFFF0);
1643 value |= (baseband_attenuation & 0x000F); 1618 value |= (baseband_attenuation & 0x000F);
1644 bcm43xx_write16(bcm, 0x03E6, value); 1619 bcm43xx_write16(bcm, 0x03E6, value);
1645 return; 1620 return;
1646 } 1621 }
1647 1622
1648 if (phy->version > 1) { 1623 if (phy->analog > 1) {
1649 value = bcm43xx_phy_read(bcm, 0x0060) & ~0x003C; 1624 value = bcm43xx_phy_read(bcm, 0x0060) & ~0x003C;
1650 value |= (baseband_attenuation << 2) & 0x003C; 1625 value |= (baseband_attenuation << 2) & 0x003C;
1651 } else { 1626 } else {
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
index bb9c484d7e19..3fbb3c6f779e 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
@@ -1393,11 +1393,12 @@ u16 bcm43xx_radio_init2050(struct bcm43xx_private *bcm)
1393 backup[12] = bcm43xx_read16(bcm, BCM43xx_MMIO_CHANNEL_EXT); 1393 backup[12] = bcm43xx_read16(bcm, BCM43xx_MMIO_CHANNEL_EXT);
1394 1394
1395 // Initialization 1395 // Initialization
1396 if (phy->version == 0) { 1396 if (phy->analog == 0) {
1397 bcm43xx_write16(bcm, 0x03E6, 0x0122); 1397 bcm43xx_write16(bcm, 0x03E6, 0x0122);
1398 } else { 1398 } else {
1399 if (phy->version >= 2) 1399 if (phy->analog >= 2)
1400 bcm43xx_write16(bcm, 0x03E6, 0x0040); 1400 bcm43xx_phy_write(bcm, 0x0003, (bcm43xx_phy_read(bcm, 0x0003)
1401 & 0xFFBF) | 0x0040);
1401 bcm43xx_write16(bcm, BCM43xx_MMIO_CHANNEL_EXT, 1402 bcm43xx_write16(bcm, BCM43xx_MMIO_CHANNEL_EXT,
1402 (bcm43xx_read16(bcm, BCM43xx_MMIO_CHANNEL_EXT) | 0x2000)); 1403 (bcm43xx_read16(bcm, BCM43xx_MMIO_CHANNEL_EXT) | 0x2000));
1403 } 1404 }
@@ -1405,7 +1406,7 @@ u16 bcm43xx_radio_init2050(struct bcm43xx_private *bcm)
1405 ret = bcm43xx_radio_calibrationvalue(bcm); 1406 ret = bcm43xx_radio_calibrationvalue(bcm);
1406 1407
1407 if (phy->type == BCM43xx_PHYTYPE_B) 1408 if (phy->type == BCM43xx_PHYTYPE_B)
1408 bcm43xx_radio_write16(bcm, 0x0078, 0x0003); 1409 bcm43xx_radio_write16(bcm, 0x0078, 0x0026);
1409 1410
1410 bcm43xx_phy_write(bcm, 0x0015, 0xBFAF); 1411 bcm43xx_phy_write(bcm, 0x0015, 0xBFAF);
1411 bcm43xx_phy_write(bcm, 0x002B, 0x1403); 1412 bcm43xx_phy_write(bcm, 0x002B, 0x1403);
@@ -1416,7 +1417,7 @@ u16 bcm43xx_radio_init2050(struct bcm43xx_private *bcm)
1416 (bcm43xx_radio_read16(bcm, 0x0051) | 0x0004)); 1417 (bcm43xx_radio_read16(bcm, 0x0051) | 0x0004));
1417 bcm43xx_radio_write16(bcm, 0x0052, 0x0000); 1418 bcm43xx_radio_write16(bcm, 0x0052, 0x0000);
1418 bcm43xx_radio_write16(bcm, 0x0043, 1419 bcm43xx_radio_write16(bcm, 0x0043,
1419 bcm43xx_radio_read16(bcm, 0x0043) | 0x0009); 1420 (bcm43xx_radio_read16(bcm, 0x0043) & 0xFFF0) | 0x0009);
1420 bcm43xx_phy_write(bcm, 0x0058, 0x0000); 1421 bcm43xx_phy_write(bcm, 0x0058, 0x0000);
1421 1422
1422 for (i = 0; i < 16; i++) { 1423 for (i = 0; i < 16; i++) {
@@ -1488,7 +1489,7 @@ u16 bcm43xx_radio_init2050(struct bcm43xx_private *bcm)
1488 bcm43xx_phy_write(bcm, 0x0059, backup[17]); 1489 bcm43xx_phy_write(bcm, 0x0059, backup[17]);
1489 bcm43xx_phy_write(bcm, 0x0058, backup[18]); 1490 bcm43xx_phy_write(bcm, 0x0058, backup[18]);
1490 bcm43xx_write16(bcm, 0x03E6, backup[11]); 1491 bcm43xx_write16(bcm, 0x03E6, backup[11]);
1491 if (phy->version != 0) 1492 if (phy->analog != 0)
1492 bcm43xx_write16(bcm, BCM43xx_MMIO_CHANNEL_EXT, backup[12]); 1493 bcm43xx_write16(bcm, BCM43xx_MMIO_CHANNEL_EXT, backup[12]);
1493 bcm43xx_phy_write(bcm, 0x0035, backup[10]); 1494 bcm43xx_phy_write(bcm, 0x0035, backup[10]);
1494 bcm43xx_radio_selectchannel(bcm, radio->channel, 1); 1495 bcm43xx_radio_selectchannel(bcm, radio->channel, 1);