Skip to content

Commit 47dda78

Browse files
hkallweitkuba-moo
authored andcommitted
r8169: consider that PHY reset may still be in progress after applying firmware
Some firmware files trigger a PHY soft reset and don't wait for it to be finished. PHY register writes directly after applying the firmware may fail or provide unexpected results therefore. Fix this by waiting for bit BMCR_RESET to be cleared after applying firmware. There's nothing wrong with the referenced change, it's just that the fix will apply cleanly only after this change. Fixes: 89fbd26 ("r8169: fix firmware not resetting tp->ocp_base") Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 8aa7b52 commit 47dda78

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

drivers/net/ethernet/realtek/r8169_main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2058,11 +2058,18 @@ static void rtl_release_firmware(struct rtl8169_private *tp)
20582058

20592059
void r8169_apply_firmware(struct rtl8169_private *tp)
20602060
{
2061+
int val;
2062+
20612063
/* TODO: release firmware if rtl_fw_write_firmware signals failure. */
20622064
if (tp->rtl_fw) {
20632065
rtl_fw_write_firmware(tp, tp->rtl_fw);
20642066
/* At least one firmware doesn't reset tp->ocp_base. */
20652067
tp->ocp_base = OCP_STD_PHY_BASE;
2068+
2069+
/* PHY soft reset may still be in progress */
2070+
phy_read_poll_timeout(tp->phydev, MII_BMCR, val,
2071+
!(val & BMCR_RESET),
2072+
50000, 600000, true);
20662073
}
20672074
}
20682075

0 commit comments

Comments
 (0)