diff options
author | Michael Buesch <mbuesch@freenet.de> | 2006-03-25 14:36:57 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-03-27 11:19:47 -0500 |
commit | adc40e9796d03d56e99bdac62492492a1098124b (patch) | |
tree | 47d257ea6817e74ea274cb480af424ccc4f4661a /drivers | |
parent | 8afceb1e6a3b6361c7c2456ef488ee9c6db7b370 (diff) |
[PATCH] bcm43xx: sync GPHY init with the specs.
Signed-off-by: Michael Buesch <mbuesch@freenet.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx.h | 5 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_main.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_phy.c | 275 |
3 files changed, 255 insertions, 29 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx.h b/drivers/net/wireless/bcm43xx/bcm43xx.h index ae0fe5cf1d44..dcadd295de4f 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx.h +++ b/drivers/net/wireless/bcm43xx/bcm43xx.h | |||
@@ -495,6 +495,10 @@ struct bcm43xx_phyinfo { | |||
495 | const s8 *tssi2dbm; | 495 | const s8 *tssi2dbm; |
496 | /* idle TSSI value */ | 496 | /* idle TSSI value */ |
497 | s8 idle_tssi; | 497 | s8 idle_tssi; |
498 | |||
499 | /* Values from bcm43xx_calc_loopback_gain() */ | ||
500 | u16 loopback_gain[2]; | ||
501 | |||
498 | /* PHY lock for core.rev < 3 | 502 | /* PHY lock for core.rev < 3 |
499 | * This lock is only used by bcm43xx_phy_{un}lock() | 503 | * This lock is only used by bcm43xx_phy_{un}lock() |
500 | */ | 504 | */ |
@@ -674,6 +678,7 @@ struct bcm43xx_private { | |||
674 | 678 | ||
675 | u16 chip_id; | 679 | u16 chip_id; |
676 | u8 chip_rev; | 680 | u8 chip_rev; |
681 | u8 chip_package; | ||
677 | 682 | ||
678 | struct bcm43xx_sprominfo sprom; | 683 | struct bcm43xx_sprominfo sprom; |
679 | #define BCM43xx_NR_LEDS 4 | 684 | #define BCM43xx_NR_LEDS 4 |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c index 7c1d72fc6289..2b7ef9b46ccd 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c | |||
@@ -570,6 +570,7 @@ static int bcm43xx_read_radioinfo(struct bcm43xx_private *bcm) | |||
570 | radio->baseband_atten = bcm43xx_default_baseband_attenuation(bcm); | 570 | radio->baseband_atten = bcm43xx_default_baseband_attenuation(bcm); |
571 | radio->radio_atten = bcm43xx_default_radio_attenuation(bcm); | 571 | radio->radio_atten = bcm43xx_default_radio_attenuation(bcm); |
572 | radio->txctl1 = bcm43xx_default_txctl1(bcm); | 572 | radio->txctl1 = bcm43xx_default_txctl1(bcm); |
573 | radio->txctl2 = 0xFFFF; | ||
573 | if (phy->type == BCM43xx_PHYTYPE_A) | 574 | if (phy->type == BCM43xx_PHYTYPE_A) |
574 | radio->txpower_desired = bcm->sprom.maxpower_aphy; | 575 | radio->txpower_desired = bcm->sprom.maxpower_aphy; |
575 | else | 576 | else |
@@ -2635,7 +2636,8 @@ static int bcm43xx_probe_cores(struct bcm43xx_private *bcm) | |||
2635 | } | 2636 | } |
2636 | 2637 | ||
2637 | bcm->chip_id = chip_id_16; | 2638 | bcm->chip_id = chip_id_16; |
2638 | bcm->chip_rev = (chip_id_32 & 0x000f0000) >> 16; | 2639 | bcm->chip_rev = (chip_id_32 & 0x000F0000) >> 16; |
2640 | bcm->chip_package = (chip_id_32 & 0x00F00000) >> 20; | ||
2639 | 2641 | ||
2640 | dprintk(KERN_INFO PFX "Chip ID 0x%x, rev 0x%x\n", | 2642 | dprintk(KERN_INFO PFX "Chip ID 0x%x, rev 0x%x\n", |
2641 | bcm->chip_id, bcm->chip_rev); | 2643 | bcm->chip_id, bcm->chip_rev); |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c index 4ab17a7f7e91..0a66f43ca0c0 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c | |||
@@ -994,12 +994,205 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm) | |||
994 | bcm43xx_write16(bcm, 0x03E6, 0x0); | 994 | bcm43xx_write16(bcm, 0x03E6, 0x0); |
995 | } | 995 | } |
996 | 996 | ||
997 | static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm) | ||
998 | { | ||
999 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | ||
1000 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); | ||
1001 | u16 backup_phy[15]; | ||
1002 | u16 backup_radio[3]; | ||
1003 | u16 backup_bband; | ||
1004 | u16 i; | ||
1005 | u16 loop1_cnt, loop1_done, loop1_omitted; | ||
1006 | u16 loop2_done; | ||
1007 | |||
1008 | backup_phy[0] = bcm43xx_phy_read(bcm, 0x0429); | ||
1009 | backup_phy[1] = bcm43xx_phy_read(bcm, 0x0001); | ||
1010 | backup_phy[2] = bcm43xx_phy_read(bcm, 0x0811); | ||
1011 | backup_phy[3] = bcm43xx_phy_read(bcm, 0x0812); | ||
1012 | backup_phy[4] = bcm43xx_phy_read(bcm, 0x0814); | ||
1013 | backup_phy[5] = bcm43xx_phy_read(bcm, 0x0815); | ||
1014 | backup_phy[6] = bcm43xx_phy_read(bcm, 0x005A); | ||
1015 | backup_phy[7] = bcm43xx_phy_read(bcm, 0x0059); | ||
1016 | backup_phy[8] = bcm43xx_phy_read(bcm, 0x0058); | ||
1017 | backup_phy[9] = bcm43xx_phy_read(bcm, 0x000A); | ||
1018 | backup_phy[10] = bcm43xx_phy_read(bcm, 0x0003); | ||
1019 | backup_phy[11] = bcm43xx_phy_read(bcm, 0x080F); | ||
1020 | backup_phy[12] = bcm43xx_phy_read(bcm, 0x0810); | ||
1021 | backup_phy[13] = bcm43xx_phy_read(bcm, 0x002B); | ||
1022 | backup_phy[14] = bcm43xx_phy_read(bcm, 0x0015); | ||
1023 | bcm43xx_phy_read(bcm, 0x002D); /* dummy read */ | ||
1024 | backup_bband = radio->baseband_atten; | ||
1025 | backup_radio[0] = bcm43xx_radio_read16(bcm, 0x0052); | ||
1026 | backup_radio[1] = bcm43xx_radio_read16(bcm, 0x0043); | ||
1027 | backup_radio[2] = bcm43xx_radio_read16(bcm, 0x007A); | ||
1028 | |||
1029 | bcm43xx_phy_write(bcm, 0x0429, | ||
1030 | bcm43xx_phy_read(bcm, 0x0429) & 0x3FFF); | ||
1031 | bcm43xx_phy_write(bcm, 0x0001, | ||
1032 | bcm43xx_phy_read(bcm, 0x0001) & 0x8000); | ||
1033 | bcm43xx_phy_write(bcm, 0x0811, | ||
1034 | bcm43xx_phy_read(bcm, 0x0811) | 0x0002); | ||
1035 | bcm43xx_phy_write(bcm, 0x0812, | ||
1036 | bcm43xx_phy_read(bcm, 0x0812) & 0xFFFD); | ||
1037 | bcm43xx_phy_write(bcm, 0x0811, | ||
1038 | bcm43xx_phy_read(bcm, 0x0811) | 0x0001); | ||
1039 | bcm43xx_phy_write(bcm, 0x0812, | ||
1040 | bcm43xx_phy_read(bcm, 0x0812) & 0xFFFE); | ||
1041 | bcm43xx_phy_write(bcm, 0x0814, | ||
1042 | bcm43xx_phy_read(bcm, 0x0814) | 0x0001); | ||
1043 | bcm43xx_phy_write(bcm, 0x0815, | ||
1044 | bcm43xx_phy_read(bcm, 0x0815) & 0xFFFE); | ||
1045 | bcm43xx_phy_write(bcm, 0x0814, | ||
1046 | bcm43xx_phy_read(bcm, 0x0814) | 0x0002); | ||
1047 | bcm43xx_phy_write(bcm, 0x0815, | ||
1048 | bcm43xx_phy_read(bcm, 0x0815) & 0xFFFD); | ||
1049 | bcm43xx_phy_write(bcm, 0x0811, | ||
1050 | bcm43xx_phy_read(bcm, 0x0811) | 0x000C); | ||
1051 | bcm43xx_phy_write(bcm, 0x0812, | ||
1052 | bcm43xx_phy_read(bcm, 0x0812) | 0x000C); | ||
1053 | |||
1054 | bcm43xx_phy_write(bcm, 0x0811, | ||
1055 | (bcm43xx_phy_read(bcm, 0x0811) | ||
1056 | & 0xFFCF) | 0x0030); | ||
1057 | bcm43xx_phy_write(bcm, 0x0812, | ||
1058 | (bcm43xx_phy_read(bcm, 0x0812) | ||
1059 | & 0xFFCF) | 0x0010); | ||
1060 | |||
1061 | bcm43xx_phy_write(bcm, 0x005A, 0x0780); | ||
1062 | bcm43xx_phy_write(bcm, 0x0059, 0xC810); | ||
1063 | bcm43xx_phy_write(bcm, 0x0058, 0x000D); | ||
1064 | if (phy->version == 0) { | ||
1065 | bcm43xx_phy_write(bcm, 0x0003, 0x0122); | ||
1066 | } else { | ||
1067 | bcm43xx_phy_write(bcm, 0x000A, | ||
1068 | bcm43xx_phy_read(bcm, 0x000A) | ||
1069 | | 0x2000); | ||
1070 | } | ||
1071 | bcm43xx_phy_write(bcm, 0x0814, | ||
1072 | bcm43xx_phy_read(bcm, 0x0814) | 0x0004); | ||
1073 | bcm43xx_phy_write(bcm, 0x0815, | ||
1074 | bcm43xx_phy_read(bcm, 0x0815) & 0xFFFB); | ||
1075 | bcm43xx_phy_write(bcm, 0x0003, | ||
1076 | (bcm43xx_phy_read(bcm, 0x0003) | ||
1077 | & 0xFF9F) | 0x0040); | ||
1078 | if (radio->version == 0x2050 && radio->revision == 2) { | ||
1079 | bcm43xx_radio_write16(bcm, 0x0052, 0x0000); | ||
1080 | bcm43xx_radio_write16(bcm, 0x0043, | ||
1081 | (bcm43xx_radio_read16(bcm, 0x0043) | ||
1082 | & 0xFFF0) | 0x0009); | ||
1083 | loop1_cnt = 9; | ||
1084 | } else if (radio->revision == 8) { | ||
1085 | bcm43xx_radio_write16(bcm, 0x0043, 0x000F); | ||
1086 | loop1_cnt = 15; | ||
1087 | } else | ||
1088 | loop1_cnt = 0; | ||
1089 | |||
1090 | bcm43xx_phy_set_baseband_attenuation(bcm, 11); | ||
1091 | |||
1092 | if (phy->rev >= 3) | ||
1093 | bcm43xx_phy_write(bcm, 0x080F, 0xC020); | ||
1094 | else | ||
1095 | bcm43xx_phy_write(bcm, 0x080F, 0x8020); | ||
1096 | bcm43xx_phy_write(bcm, 0x0810, 0x0000); | ||
1097 | |||
1098 | bcm43xx_phy_write(bcm, 0x002B, | ||
1099 | (bcm43xx_phy_read(bcm, 0x002B) | ||
1100 | & 0xFFC0) | 0x0001); | ||
1101 | bcm43xx_phy_write(bcm, 0x002B, | ||
1102 | (bcm43xx_phy_read(bcm, 0x002B) | ||
1103 | & 0xC0FF) | 0x0800); | ||
1104 | bcm43xx_phy_write(bcm, 0x0811, | ||
1105 | bcm43xx_phy_read(bcm, 0x0811) | 0x0100); | ||
1106 | bcm43xx_phy_write(bcm, 0x0812, | ||
1107 | bcm43xx_phy_read(bcm, 0x0812) & 0xCFFF); | ||
1108 | if (bcm->sprom.boardflags & BCM43xx_BFL_EXTLNA) { | ||
1109 | if (phy->rev >= 7) { | ||
1110 | bcm43xx_phy_write(bcm, 0x0811, | ||
1111 | bcm43xx_phy_read(bcm, 0x0811) | ||
1112 | | 0x0800); | ||
1113 | bcm43xx_phy_write(bcm, 0x0812, | ||
1114 | bcm43xx_phy_read(bcm, 0x0812) | ||
1115 | | 0x8000); | ||
1116 | } | ||
1117 | } | ||
1118 | bcm43xx_radio_write16(bcm, 0x007A, | ||
1119 | bcm43xx_radio_read16(bcm, 0x007A) | ||
1120 | & 0x00F7); | ||
1121 | |||
1122 | for (i = 0; i < loop1_cnt; i++) { | ||
1123 | bcm43xx_radio_write16(bcm, 0x0043, loop1_cnt); | ||
1124 | bcm43xx_phy_write(bcm, 0x0812, | ||
1125 | (bcm43xx_phy_read(bcm, 0x0812) | ||
1126 | & 0xF0FF) | (i << 8)); | ||
1127 | bcm43xx_phy_write(bcm, 0x0015, | ||
1128 | (bcm43xx_phy_read(bcm, 0x0015) | ||
1129 | & 0x0FFF) | 0xA000); | ||
1130 | bcm43xx_phy_write(bcm, 0x0015, | ||
1131 | (bcm43xx_phy_read(bcm, 0x0015) | ||
1132 | & 0x0FFF) | 0xF000); | ||
1133 | udelay(20); | ||
1134 | if (bcm43xx_phy_read(bcm, 0x002D) >= 0x0DFC) | ||
1135 | break; | ||
1136 | } | ||
1137 | loop1_done = i; | ||
1138 | loop1_omitted = loop1_cnt - loop1_done; | ||
1139 | |||
1140 | loop2_done = 0; | ||
1141 | if (loop1_done >= 8) { | ||
1142 | bcm43xx_phy_write(bcm, 0x0812, | ||
1143 | bcm43xx_phy_read(bcm, 0x0812) | ||
1144 | | 0x0030); | ||
1145 | for (i = loop1_done - 8; i < 16; i++) { | ||
1146 | bcm43xx_phy_write(bcm, 0x0812, | ||
1147 | (bcm43xx_phy_read(bcm, 0x0812) | ||
1148 | & 0xF0FF) | (i << 8)); | ||
1149 | bcm43xx_phy_write(bcm, 0x0015, | ||
1150 | (bcm43xx_phy_read(bcm, 0x0015) | ||
1151 | & 0x0FFF) | 0xA000); | ||
1152 | bcm43xx_phy_write(bcm, 0x0015, | ||
1153 | (bcm43xx_phy_read(bcm, 0x0015) | ||
1154 | & 0x0FFF) | 0xF000); | ||
1155 | udelay(20); | ||
1156 | if (bcm43xx_phy_read(bcm, 0x002D) >= 0x0DFC) | ||
1157 | break; | ||
1158 | } | ||
1159 | } | ||
1160 | |||
1161 | bcm43xx_phy_write(bcm, 0x0814, backup_phy[4]); | ||
1162 | bcm43xx_phy_write(bcm, 0x0815, backup_phy[5]); | ||
1163 | bcm43xx_phy_write(bcm, 0x005A, backup_phy[6]); | ||
1164 | bcm43xx_phy_write(bcm, 0x0059, backup_phy[7]); | ||
1165 | bcm43xx_phy_write(bcm, 0x0058, backup_phy[8]); | ||
1166 | bcm43xx_phy_write(bcm, 0x000A, backup_phy[9]); | ||
1167 | bcm43xx_phy_write(bcm, 0x0003, backup_phy[10]); | ||
1168 | bcm43xx_phy_write(bcm, 0x080F, backup_phy[11]); | ||
1169 | bcm43xx_phy_write(bcm, 0x0810, backup_phy[12]); | ||
1170 | bcm43xx_phy_write(bcm, 0x002B, backup_phy[13]); | ||
1171 | bcm43xx_phy_write(bcm, 0x0015, backup_phy[14]); | ||
1172 | |||
1173 | bcm43xx_phy_set_baseband_attenuation(bcm, backup_bband); | ||
1174 | |||
1175 | bcm43xx_radio_write16(bcm, 0x0052, backup_radio[0]); | ||
1176 | bcm43xx_radio_write16(bcm, 0x0043, backup_radio[1]); | ||
1177 | bcm43xx_radio_write16(bcm, 0x007A, backup_radio[2]); | ||
1178 | |||
1179 | bcm43xx_phy_write(bcm, 0x0811, backup_phy[2] | 0x0003); | ||
1180 | udelay(10); | ||
1181 | bcm43xx_phy_write(bcm, 0x0811, backup_phy[2]); | ||
1182 | bcm43xx_phy_write(bcm, 0x0812, backup_phy[3]); | ||
1183 | bcm43xx_phy_write(bcm, 0x0429, backup_phy[0]); | ||
1184 | bcm43xx_phy_write(bcm, 0x0001, backup_phy[1]); | ||
1185 | |||
1186 | phy->loopback_gain[0] = ((loop1_done * 6) - (loop1_omitted * 4)) - 11; | ||
1187 | phy->loopback_gain[1] = (24 - (3 * loop2_done)) * 2; | ||
1188 | } | ||
1189 | |||
997 | static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) | 1190 | static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) |
998 | { | 1191 | { |
999 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | 1192 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1000 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); | 1193 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
1001 | u16 tmp; | 1194 | u16 tmp; |
1002 | 1195 | ||
1003 | if (phy->rev == 1) | 1196 | if (phy->rev == 1) |
1004 | bcm43xx_phy_initb5(bcm); | 1197 | bcm43xx_phy_initb5(bcm); |
1005 | else if (phy->rev >= 2 && phy->rev <= 7) | 1198 | else if (phy->rev >= 2 && phy->rev <= 7) |
@@ -1015,47 +1208,63 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) | |||
1015 | else if (phy->rev >= 3) | 1208 | else if (phy->rev >= 3) |
1016 | bcm43xx_phy_write(bcm, 0x0811, 0x0400); | 1209 | bcm43xx_phy_write(bcm, 0x0811, 0x0400); |
1017 | bcm43xx_phy_write(bcm, 0x0015, 0x00C0); | 1210 | bcm43xx_phy_write(bcm, 0x0015, 0x00C0); |
1018 | tmp = bcm43xx_phy_read(bcm, 0x0400) & 0xFF; | 1211 | if (phy->connected) { |
1019 | if (tmp == 3) { | 1212 | tmp = bcm43xx_phy_read(bcm, 0x0400) & 0xFF; |
1020 | bcm43xx_phy_write(bcm, 0x04C2, 0x1816); | 1213 | if (tmp < 6) { |
1021 | bcm43xx_phy_write(bcm, 0x04C3, 0x8606); | 1214 | bcm43xx_phy_write(bcm, 0x04C2, 0x1816); |
1022 | } else if (tmp == 4 || tmp == 5) { | 1215 | bcm43xx_phy_write(bcm, 0x04C3, 0x8006); |
1023 | bcm43xx_phy_write(bcm, 0x04C2, 0x1816); | 1216 | if (tmp != 3) { |
1024 | bcm43xx_phy_write(bcm, 0x04C3, 0x8006); | 1217 | bcm43xx_phy_write(bcm, 0x04CC, |
1025 | bcm43xx_phy_write(bcm, 0x04CC, (bcm43xx_phy_read(bcm, 0x04CC) | 1218 | (bcm43xx_phy_read(bcm, 0x04CC) |
1026 | & 0x00FF) | 0x1F00); | 1219 | & 0x00FF) | 0x1F00); |
1220 | } | ||
1221 | } | ||
1027 | } | 1222 | } |
1028 | } | 1223 | } |
1029 | if (radio->revision <= 3 && phy->connected) | 1224 | if (phy->rev < 3 && phy->connected) |
1030 | bcm43xx_phy_write(bcm, 0x047E, 0x0078); | 1225 | bcm43xx_phy_write(bcm, 0x047E, 0x0078); |
1031 | if (radio->revision >= 6 && radio->revision <= 8) { | 1226 | if (phy->rev >= 6 && phy->rev <= 8) { |
1032 | bcm43xx_phy_write(bcm, 0x0801, bcm43xx_phy_read(bcm, 0x0801) | 0x0080); | 1227 | bcm43xx_phy_write(bcm, 0x0801, bcm43xx_phy_read(bcm, 0x0801) | 0x0080); |
1033 | bcm43xx_phy_write(bcm, 0x043E, bcm43xx_phy_read(bcm, 0x043E) | 0x0004); | 1228 | bcm43xx_phy_write(bcm, 0x043E, bcm43xx_phy_read(bcm, 0x043E) | 0x0004); |
1034 | } | 1229 | } |
1035 | if (radio->initval == 0xFFFF) { | 1230 | if (phy->rev >= 2 && phy->connected) |
1036 | radio->initval = bcm43xx_radio_init2050(bcm); | 1231 | bcm43xx_calc_loopback_gain(bcm); |
1232 | if (radio->revision != 8) { | ||
1233 | if (radio->initval == 0xFFFF) | ||
1234 | radio->initval = bcm43xx_radio_init2050(bcm); | ||
1235 | else | ||
1236 | bcm43xx_radio_write16(bcm, 0x0078, radio->initval); | ||
1237 | } | ||
1238 | if (radio->txctl2 == 0xFFFF) { | ||
1037 | bcm43xx_phy_lo_g_measure(bcm); | 1239 | bcm43xx_phy_lo_g_measure(bcm); |
1038 | } else { | 1240 | } else { |
1039 | bcm43xx_radio_write16(bcm, 0x0078, radio->initval); | 1241 | if (radio->version == 0x2050 && radio->revision == 8) { |
1040 | bcm43xx_radio_write16(bcm, 0x0052, | 1242 | //FIXME |
1041 | (bcm43xx_radio_read16(bcm, 0x0052) & 0xFFF0) | 1243 | } else { |
1042 | | radio->txctl2); | 1244 | bcm43xx_radio_write16(bcm, 0x0052, |
1043 | } | 1245 | (bcm43xx_radio_read16(bcm, 0x0052) |
1044 | 1246 | & 0xFFF0) | radio->txctl1); | |
1045 | if (phy->connected) { | 1247 | } |
1046 | bcm43xx_phy_lo_adjust(bcm, 0); | 1248 | if (phy->rev >= 6) { |
1047 | bcm43xx_phy_write(bcm, 0x080F, 0x8078); | 1249 | /* |
1048 | 1250 | bcm43xx_phy_write(bcm, 0x0036, | |
1251 | (bcm43xx_phy_read(bcm, 0x0036) | ||
1252 | & 0xF000) | (FIXME << 12)); | ||
1253 | */ | ||
1254 | } | ||
1049 | if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL) | 1255 | if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL) |
1050 | bcm43xx_phy_write(bcm, 0x002E, 0x807F); | ||
1051 | else | ||
1052 | bcm43xx_phy_write(bcm, 0x002E, 0x8075); | 1256 | bcm43xx_phy_write(bcm, 0x002E, 0x8075); |
1053 | 1257 | else | |
1258 | bcm43xx_phy_write(bcm, 0x003E, 0x807F); | ||
1054 | if (phy->rev < 2) | 1259 | if (phy->rev < 2) |
1055 | bcm43xx_phy_write(bcm, 0x002F, 0x0101); | 1260 | bcm43xx_phy_write(bcm, 0x002F, 0x0101); |
1056 | else | 1261 | else |
1057 | bcm43xx_phy_write(bcm, 0x002F, 0x0202); | 1262 | bcm43xx_phy_write(bcm, 0x002F, 0x0202); |
1058 | } | 1263 | } |
1264 | if (phy->connected) { | ||
1265 | bcm43xx_phy_lo_adjust(bcm, 0); | ||
1266 | bcm43xx_phy_write(bcm, 0x080F, 0x8078); | ||
1267 | } | ||
1059 | 1268 | ||
1060 | if (!(bcm->sprom.boardflags & BCM43xx_BFL_RSSI)) { | 1269 | if (!(bcm->sprom.boardflags & BCM43xx_BFL_RSSI)) { |
1061 | /* The specs state to update the NRSSI LT with | 1270 | /* The specs state to update the NRSSI LT with |
@@ -1070,10 +1279,20 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) | |||
1070 | if (radio->nrssi[0] == -1000) { | 1279 | if (radio->nrssi[0] == -1000) { |
1071 | assert(radio->nrssi[1] == -1000); | 1280 | assert(radio->nrssi[1] == -1000); |
1072 | bcm43xx_calc_nrssi_slope(bcm); | 1281 | bcm43xx_calc_nrssi_slope(bcm); |
1073 | } else | 1282 | } else { |
1283 | assert(radio->nrssi[1] != -1000); | ||
1074 | bcm43xx_calc_nrssi_threshold(bcm); | 1284 | bcm43xx_calc_nrssi_threshold(bcm); |
1285 | } | ||
1075 | } | 1286 | } |
1287 | if (radio->revision == 8) | ||
1288 | bcm43xx_phy_write(bcm, 0x0805, 0x3230); | ||
1076 | bcm43xx_phy_init_pctl(bcm); | 1289 | bcm43xx_phy_init_pctl(bcm); |
1290 | if (bcm->chip_id == 0x4306 && bcm->chip_package != 2) { | ||
1291 | bcm43xx_phy_write(bcm, 0x0429, | ||
1292 | bcm43xx_phy_read(bcm, 0x0429) & 0xBFFF); | ||
1293 | bcm43xx_phy_write(bcm, 0x04C3, | ||
1294 | bcm43xx_phy_read(bcm, 0x04C3) & 0x7FFF); | ||
1295 | } | ||
1077 | } | 1296 | } |
1078 | 1297 | ||
1079 | static u16 bcm43xx_phy_lo_b_r15_loop(struct bcm43xx_private *bcm) | 1298 | static u16 bcm43xx_phy_lo_b_r15_loop(struct bcm43xx_private *bcm) |