diff mbox series

[5/5] r8169: fix firmware not resetting tp->ocp_base

Message ID 20200628075842.771536-6-aaron.ma@canonical.com
State New
Headers show
Series Add r8117 support and fix firmware base issue | expand

Commit Message

Aaron Ma June 28, 2020, 7:58 a.m. UTC
From: Heiner Kallweit <hkallweit1@gmail.com>

BugLink: https://bugs.launchpad.net/bugs/1885072

Typically the firmware takes care that tp->ocp_base is reset to its
default value. That's not the case (at least) for RTL8117.
As a result subsequent PHY access reads/writes the wrong page and
the link is broken. Fix this be resetting tp->ocp_base explicitly.

Fixes: 229c1e0dfd3d ("r8169: load firmware for RTL8168fp/RTL8117")
Reported-by: Aaron Ma <mapengyu@gmail.com>
Tested-by: Aaron Ma <mapengyu@gmail.com>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 89fbd26cca7ec9e82ec4787a4b6e95939b57d073)
Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
 drivers/net/ethernet/realtek/r8169_main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series


diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 637d85741f25..05b5fe140b1d 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -2293,8 +2293,11 @@  static void rtl_release_firmware(struct rtl8169_private *tp)
 static void rtl_apply_firmware(struct rtl8169_private *tp)
 	/* TODO: release firmware if rtl_fw_write_firmware signals failure. */
-	if (tp->rtl_fw)
+	if (tp->rtl_fw) {
 		rtl_fw_write_firmware(tp, tp->rtl_fw);
+		/* At least one firmware doesn't reset tp->ocp_base. */
+		tp->ocp_base = OCP_STD_PHY_BASE;
+	}
 static void rtl_apply_firmware_cond(struct rtl8169_private *tp, u8 reg, u16 val)