diff options
author | Larry Finger <Larry.Finger@lwfinger.net> | 2007-04-07 15:11:03 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2007-04-10 14:35:57 -0400 |
commit | ec759a2b383b50950be37fbe470c4cc2ca18e2ce (patch) | |
tree | 0ed7475a867e09bf340027f2a0d3e25cc7ba47bb /drivers/net | |
parent | 81e880064dd32b3efdc41ad4cc2416c4744693ee (diff) |
[PATCH] bcm43xx: Fix PPC machine checks and match loopback gain specs
The specifications for loopback_gain calculation and for G PHY
initialization have been updated. This patch implements them and
fixes a machine check error that occurs for PPC architecture with a
phy->rev of 1.
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_phy.c | 57 |
1 files changed, 32 insertions, 25 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c index d1e89be965cd..72529a440f15 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c | |||
@@ -978,7 +978,7 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm) | |||
978 | { | 978 | { |
979 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | 979 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
980 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); | 980 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
981 | u16 backup_phy[15]; | 981 | u16 backup_phy[15] = {0}; |
982 | u16 backup_radio[3]; | 982 | u16 backup_radio[3]; |
983 | u16 backup_bband; | 983 | u16 backup_bband; |
984 | u16 i; | 984 | u16 i; |
@@ -989,8 +989,10 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm) | |||
989 | backup_phy[1] = bcm43xx_phy_read(bcm, 0x0001); | 989 | backup_phy[1] = bcm43xx_phy_read(bcm, 0x0001); |
990 | backup_phy[2] = bcm43xx_phy_read(bcm, 0x0811); | 990 | backup_phy[2] = bcm43xx_phy_read(bcm, 0x0811); |
991 | backup_phy[3] = bcm43xx_phy_read(bcm, 0x0812); | 991 | backup_phy[3] = bcm43xx_phy_read(bcm, 0x0812); |
992 | backup_phy[4] = bcm43xx_phy_read(bcm, 0x0814); | 992 | if (phy->rev != 1) { |
993 | backup_phy[5] = bcm43xx_phy_read(bcm, 0x0815); | 993 | backup_phy[4] = bcm43xx_phy_read(bcm, 0x0814); |
994 | backup_phy[5] = bcm43xx_phy_read(bcm, 0x0815); | ||
995 | } | ||
994 | backup_phy[6] = bcm43xx_phy_read(bcm, 0x005A); | 996 | backup_phy[6] = bcm43xx_phy_read(bcm, 0x005A); |
995 | backup_phy[7] = bcm43xx_phy_read(bcm, 0x0059); | 997 | backup_phy[7] = bcm43xx_phy_read(bcm, 0x0059); |
996 | backup_phy[8] = bcm43xx_phy_read(bcm, 0x0058); | 998 | backup_phy[8] = bcm43xx_phy_read(bcm, 0x0058); |
@@ -1018,14 +1020,16 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm) | |||
1018 | bcm43xx_phy_read(bcm, 0x0811) | 0x0001); | 1020 | bcm43xx_phy_read(bcm, 0x0811) | 0x0001); |
1019 | bcm43xx_phy_write(bcm, 0x0812, | 1021 | bcm43xx_phy_write(bcm, 0x0812, |
1020 | bcm43xx_phy_read(bcm, 0x0812) & 0xFFFE); | 1022 | bcm43xx_phy_read(bcm, 0x0812) & 0xFFFE); |
1021 | bcm43xx_phy_write(bcm, 0x0814, | 1023 | if (phy->rev != 1) { |
1022 | bcm43xx_phy_read(bcm, 0x0814) | 0x0001); | 1024 | bcm43xx_phy_write(bcm, 0x0814, |
1023 | bcm43xx_phy_write(bcm, 0x0815, | 1025 | bcm43xx_phy_read(bcm, 0x0814) | 0x0001); |
1024 | bcm43xx_phy_read(bcm, 0x0815) & 0xFFFE); | 1026 | bcm43xx_phy_write(bcm, 0x0815, |
1025 | bcm43xx_phy_write(bcm, 0x0814, | 1027 | bcm43xx_phy_read(bcm, 0x0815) & 0xFFFE); |
1026 | bcm43xx_phy_read(bcm, 0x0814) | 0x0002); | 1028 | bcm43xx_phy_write(bcm, 0x0814, |
1027 | bcm43xx_phy_write(bcm, 0x0815, | 1029 | bcm43xx_phy_read(bcm, 0x0814) | 0x0002); |
1028 | bcm43xx_phy_read(bcm, 0x0815) & 0xFFFD); | 1030 | bcm43xx_phy_write(bcm, 0x0815, |
1031 | bcm43xx_phy_read(bcm, 0x0815) & 0xFFFD); | ||
1032 | } | ||
1029 | bcm43xx_phy_write(bcm, 0x0811, | 1033 | bcm43xx_phy_write(bcm, 0x0811, |
1030 | bcm43xx_phy_read(bcm, 0x0811) | 0x000C); | 1034 | bcm43xx_phy_read(bcm, 0x0811) | 0x000C); |
1031 | bcm43xx_phy_write(bcm, 0x0812, | 1035 | bcm43xx_phy_write(bcm, 0x0812, |
@@ -1048,10 +1052,12 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm) | |||
1048 | bcm43xx_phy_read(bcm, 0x000A) | 1052 | bcm43xx_phy_read(bcm, 0x000A) |
1049 | | 0x2000); | 1053 | | 0x2000); |
1050 | } | 1054 | } |
1051 | bcm43xx_phy_write(bcm, 0x0814, | 1055 | if (phy->rev != 1) { |
1052 | bcm43xx_phy_read(bcm, 0x0814) | 0x0004); | 1056 | bcm43xx_phy_write(bcm, 0x0814, |
1053 | bcm43xx_phy_write(bcm, 0x0815, | 1057 | bcm43xx_phy_read(bcm, 0x0814) | 0x0004); |
1054 | bcm43xx_phy_read(bcm, 0x0815) & 0xFFFB); | 1058 | bcm43xx_phy_write(bcm, 0x0815, |
1059 | bcm43xx_phy_read(bcm, 0x0815) & 0xFFFB); | ||
1060 | } | ||
1055 | bcm43xx_phy_write(bcm, 0x0003, | 1061 | bcm43xx_phy_write(bcm, 0x0003, |
1056 | (bcm43xx_phy_read(bcm, 0x0003) | 1062 | (bcm43xx_phy_read(bcm, 0x0003) |
1057 | & 0xFF9F) | 0x0040); | 1063 | & 0xFF9F) | 0x0040); |
@@ -1138,8 +1144,10 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm) | |||
1138 | } | 1144 | } |
1139 | } | 1145 | } |
1140 | 1146 | ||
1141 | bcm43xx_phy_write(bcm, 0x0814, backup_phy[4]); | 1147 | if (phy->rev != 1) { |
1142 | bcm43xx_phy_write(bcm, 0x0815, backup_phy[5]); | 1148 | bcm43xx_phy_write(bcm, 0x0814, backup_phy[4]); |
1149 | bcm43xx_phy_write(bcm, 0x0815, backup_phy[5]); | ||
1150 | } | ||
1143 | bcm43xx_phy_write(bcm, 0x005A, backup_phy[6]); | 1151 | bcm43xx_phy_write(bcm, 0x005A, backup_phy[6]); |
1144 | bcm43xx_phy_write(bcm, 0x0059, backup_phy[7]); | 1152 | bcm43xx_phy_write(bcm, 0x0059, backup_phy[7]); |
1145 | bcm43xx_phy_write(bcm, 0x0058, backup_phy[8]); | 1153 | bcm43xx_phy_write(bcm, 0x0058, backup_phy[8]); |
@@ -1188,24 +1196,23 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) | |||
1188 | bcm43xx_phy_write(bcm, 0x0811, 0x0000); | 1196 | bcm43xx_phy_write(bcm, 0x0811, 0x0000); |
1189 | bcm43xx_phy_write(bcm, 0x0015, 0x00C0); | 1197 | bcm43xx_phy_write(bcm, 0x0015, 0x00C0); |
1190 | } | 1198 | } |
1191 | if (phy->rev >= 3) { | 1199 | if (phy->rev > 5) { |
1192 | bcm43xx_phy_write(bcm, 0x0811, 0x0400); | 1200 | bcm43xx_phy_write(bcm, 0x0811, 0x0400); |
1193 | bcm43xx_phy_write(bcm, 0x0015, 0x00C0); | 1201 | bcm43xx_phy_write(bcm, 0x0015, 0x00C0); |
1194 | } | 1202 | } |
1195 | if (phy->rev >= 2 && phy->connected) { | 1203 | if (phy->rev >= 2 && phy->connected) { |
1196 | tmp = bcm43xx_phy_read(bcm, 0x0400) & 0xFF; | 1204 | tmp = bcm43xx_phy_read(bcm, 0x0400) & 0xFF; |
1197 | if (tmp < 6) { | 1205 | if (tmp ==3 || tmp == 5) { |
1198 | bcm43xx_phy_write(bcm, 0x04C2, 0x1816); | 1206 | bcm43xx_phy_write(bcm, 0x04C2, 0x1816); |
1199 | bcm43xx_phy_write(bcm, 0x04C3, 0x8006); | 1207 | bcm43xx_phy_write(bcm, 0x04C3, 0x8006); |
1200 | if (tmp != 3) { | 1208 | if (tmp == 5) { |
1201 | bcm43xx_phy_write(bcm, 0x04CC, | 1209 | bcm43xx_phy_write(bcm, 0x04CC, |
1202 | (bcm43xx_phy_read(bcm, 0x04CC) | 1210 | (bcm43xx_phy_read(bcm, 0x04CC) |
1203 | & 0x00FF) | 0x1F00); | 1211 | & 0x00FF) | 0x1F00); |
1204 | } | 1212 | } |
1205 | } | 1213 | } |
1206 | } | ||
1207 | if (phy->rev < 3 && phy->connected) | ||
1208 | bcm43xx_phy_write(bcm, 0x047E, 0x0078); | 1214 | bcm43xx_phy_write(bcm, 0x047E, 0x0078); |
1215 | } | ||
1209 | if (radio->revision == 8) { | 1216 | if (radio->revision == 8) { |
1210 | bcm43xx_phy_write(bcm, 0x0801, bcm43xx_phy_read(bcm, 0x0801) | 0x0080); | 1217 | bcm43xx_phy_write(bcm, 0x0801, bcm43xx_phy_read(bcm, 0x0801) | 0x0080); |
1211 | bcm43xx_phy_write(bcm, 0x043E, bcm43xx_phy_read(bcm, 0x043E) | 0x0004); | 1218 | bcm43xx_phy_write(bcm, 0x043E, bcm43xx_phy_read(bcm, 0x043E) | 0x0004); |
@@ -1232,7 +1239,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) | |||
1232 | if (phy->rev >= 6) { | 1239 | if (phy->rev >= 6) { |
1233 | bcm43xx_phy_write(bcm, 0x0036, | 1240 | bcm43xx_phy_write(bcm, 0x0036, |
1234 | (bcm43xx_phy_read(bcm, 0x0036) | 1241 | (bcm43xx_phy_read(bcm, 0x0036) |
1235 | & 0xF000) | (radio->txctl2 << 12)); | 1242 | & 0x0FFF) | (radio->txctl2 << 12)); |
1236 | } | 1243 | } |
1237 | if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL) | 1244 | if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL) |
1238 | bcm43xx_phy_write(bcm, 0x002E, 0x8075); | 1245 | bcm43xx_phy_write(bcm, 0x002E, 0x8075); |
@@ -1243,7 +1250,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) | |||
1243 | else | 1250 | else |
1244 | bcm43xx_phy_write(bcm, 0x002F, 0x0202); | 1251 | bcm43xx_phy_write(bcm, 0x002F, 0x0202); |
1245 | } | 1252 | } |
1246 | if (phy->connected) { | 1253 | if (phy->connected || phy->rev >= 2) { |
1247 | bcm43xx_phy_lo_adjust(bcm, 0); | 1254 | bcm43xx_phy_lo_adjust(bcm, 0); |
1248 | bcm43xx_phy_write(bcm, 0x080F, 0x8078); | 1255 | bcm43xx_phy_write(bcm, 0x080F, 0x8078); |
1249 | } | 1256 | } |
@@ -1257,7 +1264,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) | |||
1257 | */ | 1264 | */ |
1258 | bcm43xx_nrssi_hw_update(bcm, 0xFFFF); | 1265 | bcm43xx_nrssi_hw_update(bcm, 0xFFFF); |
1259 | bcm43xx_calc_nrssi_threshold(bcm); | 1266 | bcm43xx_calc_nrssi_threshold(bcm); |
1260 | } else if (phy->connected) { | 1267 | } else if (phy->connected || phy->rev >= 2) { |
1261 | if (radio->nrssi[0] == -1000) { | 1268 | if (radio->nrssi[0] == -1000) { |
1262 | assert(radio->nrssi[1] == -1000); | 1269 | assert(radio->nrssi[1] == -1000); |
1263 | bcm43xx_calc_nrssi_slope(bcm); | 1270 | bcm43xx_calc_nrssi_slope(bcm); |