Commit ec759a2b authored by Larry Finger's avatar Larry Finger Committed by John W. Linville

[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: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 81e88006
...@@ -978,7 +978,7 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm) ...@@ -978,7 +978,7 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
{ {
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
u16 backup_phy[15]; u16 backup_phy[15] = {0};
u16 backup_radio[3]; u16 backup_radio[3];
u16 backup_bband; u16 backup_bband;
u16 i; u16 i;
...@@ -989,8 +989,10 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm) ...@@ -989,8 +989,10 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
backup_phy[1] = bcm43xx_phy_read(bcm, 0x0001); backup_phy[1] = bcm43xx_phy_read(bcm, 0x0001);
backup_phy[2] = bcm43xx_phy_read(bcm, 0x0811); backup_phy[2] = bcm43xx_phy_read(bcm, 0x0811);
backup_phy[3] = bcm43xx_phy_read(bcm, 0x0812); backup_phy[3] = bcm43xx_phy_read(bcm, 0x0812);
if (phy->rev != 1) {
backup_phy[4] = bcm43xx_phy_read(bcm, 0x0814); backup_phy[4] = bcm43xx_phy_read(bcm, 0x0814);
backup_phy[5] = bcm43xx_phy_read(bcm, 0x0815); backup_phy[5] = bcm43xx_phy_read(bcm, 0x0815);
}
backup_phy[6] = bcm43xx_phy_read(bcm, 0x005A); backup_phy[6] = bcm43xx_phy_read(bcm, 0x005A);
backup_phy[7] = bcm43xx_phy_read(bcm, 0x0059); backup_phy[7] = bcm43xx_phy_read(bcm, 0x0059);
backup_phy[8] = bcm43xx_phy_read(bcm, 0x0058); backup_phy[8] = bcm43xx_phy_read(bcm, 0x0058);
...@@ -1018,6 +1020,7 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm) ...@@ -1018,6 +1020,7 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
bcm43xx_phy_read(bcm, 0x0811) | 0x0001); bcm43xx_phy_read(bcm, 0x0811) | 0x0001);
bcm43xx_phy_write(bcm, 0x0812, bcm43xx_phy_write(bcm, 0x0812,
bcm43xx_phy_read(bcm, 0x0812) & 0xFFFE); bcm43xx_phy_read(bcm, 0x0812) & 0xFFFE);
if (phy->rev != 1) {
bcm43xx_phy_write(bcm, 0x0814, bcm43xx_phy_write(bcm, 0x0814,
bcm43xx_phy_read(bcm, 0x0814) | 0x0001); bcm43xx_phy_read(bcm, 0x0814) | 0x0001);
bcm43xx_phy_write(bcm, 0x0815, bcm43xx_phy_write(bcm, 0x0815,
...@@ -1026,6 +1029,7 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm) ...@@ -1026,6 +1029,7 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
bcm43xx_phy_read(bcm, 0x0814) | 0x0002); bcm43xx_phy_read(bcm, 0x0814) | 0x0002);
bcm43xx_phy_write(bcm, 0x0815, bcm43xx_phy_write(bcm, 0x0815,
bcm43xx_phy_read(bcm, 0x0815) & 0xFFFD); bcm43xx_phy_read(bcm, 0x0815) & 0xFFFD);
}
bcm43xx_phy_write(bcm, 0x0811, bcm43xx_phy_write(bcm, 0x0811,
bcm43xx_phy_read(bcm, 0x0811) | 0x000C); bcm43xx_phy_read(bcm, 0x0811) | 0x000C);
bcm43xx_phy_write(bcm, 0x0812, bcm43xx_phy_write(bcm, 0x0812,
...@@ -1048,10 +1052,12 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm) ...@@ -1048,10 +1052,12 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
bcm43xx_phy_read(bcm, 0x000A) bcm43xx_phy_read(bcm, 0x000A)
| 0x2000); | 0x2000);
} }
if (phy->rev != 1) {
bcm43xx_phy_write(bcm, 0x0814, bcm43xx_phy_write(bcm, 0x0814,
bcm43xx_phy_read(bcm, 0x0814) | 0x0004); bcm43xx_phy_read(bcm, 0x0814) | 0x0004);
bcm43xx_phy_write(bcm, 0x0815, bcm43xx_phy_write(bcm, 0x0815,
bcm43xx_phy_read(bcm, 0x0815) & 0xFFFB); bcm43xx_phy_read(bcm, 0x0815) & 0xFFFB);
}
bcm43xx_phy_write(bcm, 0x0003, bcm43xx_phy_write(bcm, 0x0003,
(bcm43xx_phy_read(bcm, 0x0003) (bcm43xx_phy_read(bcm, 0x0003)
& 0xFF9F) | 0x0040); & 0xFF9F) | 0x0040);
...@@ -1138,8 +1144,10 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm) ...@@ -1138,8 +1144,10 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm)
} }
} }
if (phy->rev != 1) {
bcm43xx_phy_write(bcm, 0x0814, backup_phy[4]); bcm43xx_phy_write(bcm, 0x0814, backup_phy[4]);
bcm43xx_phy_write(bcm, 0x0815, backup_phy[5]); bcm43xx_phy_write(bcm, 0x0815, backup_phy[5]);
}
bcm43xx_phy_write(bcm, 0x005A, backup_phy[6]); bcm43xx_phy_write(bcm, 0x005A, backup_phy[6]);
bcm43xx_phy_write(bcm, 0x0059, backup_phy[7]); bcm43xx_phy_write(bcm, 0x0059, backup_phy[7]);
bcm43xx_phy_write(bcm, 0x0058, backup_phy[8]); bcm43xx_phy_write(bcm, 0x0058, backup_phy[8]);
...@@ -1188,24 +1196,23 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) ...@@ -1188,24 +1196,23 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
bcm43xx_phy_write(bcm, 0x0811, 0x0000); bcm43xx_phy_write(bcm, 0x0811, 0x0000);
bcm43xx_phy_write(bcm, 0x0015, 0x00C0); bcm43xx_phy_write(bcm, 0x0015, 0x00C0);
} }
if (phy->rev >= 3) { if (phy->rev > 5) {
bcm43xx_phy_write(bcm, 0x0811, 0x0400); bcm43xx_phy_write(bcm, 0x0811, 0x0400);
bcm43xx_phy_write(bcm, 0x0015, 0x00C0); bcm43xx_phy_write(bcm, 0x0015, 0x00C0);
} }
if (phy->rev >= 2 && phy->connected) { if (phy->rev >= 2 && phy->connected) {
tmp = bcm43xx_phy_read(bcm, 0x0400) & 0xFF; tmp = bcm43xx_phy_read(bcm, 0x0400) & 0xFF;
if (tmp < 6) { if (tmp ==3 || tmp == 5) {
bcm43xx_phy_write(bcm, 0x04C2, 0x1816); bcm43xx_phy_write(bcm, 0x04C2, 0x1816);
bcm43xx_phy_write(bcm, 0x04C3, 0x8006); bcm43xx_phy_write(bcm, 0x04C3, 0x8006);
if (tmp != 3) { if (tmp == 5) {
bcm43xx_phy_write(bcm, 0x04CC, bcm43xx_phy_write(bcm, 0x04CC,
(bcm43xx_phy_read(bcm, 0x04CC) (bcm43xx_phy_read(bcm, 0x04CC)
& 0x00FF) | 0x1F00); & 0x00FF) | 0x1F00);
} }
} }
}
if (phy->rev < 3 && phy->connected)
bcm43xx_phy_write(bcm, 0x047E, 0x0078); bcm43xx_phy_write(bcm, 0x047E, 0x0078);
}
if (radio->revision == 8) { if (radio->revision == 8) {
bcm43xx_phy_write(bcm, 0x0801, bcm43xx_phy_read(bcm, 0x0801) | 0x0080); bcm43xx_phy_write(bcm, 0x0801, bcm43xx_phy_read(bcm, 0x0801) | 0x0080);
bcm43xx_phy_write(bcm, 0x043E, bcm43xx_phy_read(bcm, 0x043E) | 0x0004); 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,7 +1239,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
if (phy->rev >= 6) { if (phy->rev >= 6) {
bcm43xx_phy_write(bcm, 0x0036, bcm43xx_phy_write(bcm, 0x0036,
(bcm43xx_phy_read(bcm, 0x0036) (bcm43xx_phy_read(bcm, 0x0036)
& 0xF000) | (radio->txctl2 << 12)); & 0x0FFF) | (radio->txctl2 << 12));
} }
if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL) if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL)
bcm43xx_phy_write(bcm, 0x002E, 0x8075); bcm43xx_phy_write(bcm, 0x002E, 0x8075);
...@@ -1243,7 +1250,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) ...@@ -1243,7 +1250,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
else else
bcm43xx_phy_write(bcm, 0x002F, 0x0202); bcm43xx_phy_write(bcm, 0x002F, 0x0202);
} }
if (phy->connected) { if (phy->connected || phy->rev >= 2) {
bcm43xx_phy_lo_adjust(bcm, 0); bcm43xx_phy_lo_adjust(bcm, 0);
bcm43xx_phy_write(bcm, 0x080F, 0x8078); bcm43xx_phy_write(bcm, 0x080F, 0x8078);
} }
...@@ -1257,7 +1264,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) ...@@ -1257,7 +1264,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
*/ */
bcm43xx_nrssi_hw_update(bcm, 0xFFFF); bcm43xx_nrssi_hw_update(bcm, 0xFFFF);
bcm43xx_calc_nrssi_threshold(bcm); bcm43xx_calc_nrssi_threshold(bcm);
} else if (phy->connected) { } else if (phy->connected || phy->rev >= 2) {
if (radio->nrssi[0] == -1000) { if (radio->nrssi[0] == -1000) {
assert(radio->nrssi[1] == -1000); assert(radio->nrssi[1] == -1000);
bcm43xx_calc_nrssi_slope(bcm); bcm43xx_calc_nrssi_slope(bcm);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment