From 9617886fa65d3264c5aac5f1305e8e5a6ca865f4 Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Fri, 8 May 2020 23:30:43 +0200 Subject: r8169: add helper rtl_enable_rxdvgate Add a helper for setting RXDV_GATED_EN, the 2ms delay is copied from the vendor driver. Signed-off-by: Heiner Kallweit Signed-off-by: Jakub Kicinski --- drivers/net/ethernet/realtek/r8169_main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'drivers/net') diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index ba67864c04c1..5b389d3e7c9a 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -2494,6 +2494,12 @@ DECLARE_RTL_COND(rtl_txcfg_empty_cond) return RTL_R32(tp, TxConfig) & TXCFG_EMPTY; } +static void rtl_enable_rxdvgate(struct rtl8169_private *tp) +{ + RTL_W32(tp, MISC, RTL_R32(tp, MISC) | RXDV_GATED_EN); + fsleep(2000); +} + static void rtl8169_hw_reset(struct rtl8169_private *tp) { /* Disable interrupts */ @@ -5131,7 +5137,7 @@ static int r8169_mdio_register(struct rtl8169_private *tp) static void rtl_hw_init_8168g(struct rtl8169_private *tp) { - RTL_W32(tp, MISC, RTL_R32(tp, MISC) | RXDV_GATED_EN); + rtl_enable_rxdvgate(tp); if (!rtl_loop_wait_high(tp, &rtl_txcfg_empty_cond, 100, 42)) return; @@ -5152,7 +5158,7 @@ static void rtl_hw_init_8168g(struct rtl8169_private *tp) static void rtl_hw_init_8125(struct rtl8169_private *tp) { - RTL_W32(tp, MISC, RTL_R32(tp, MISC) | RXDV_GATED_EN); + rtl_enable_rxdvgate(tp); if (!rtl_loop_wait_high(tp, &rtl_rxtx_empty_cond, 100, 42)) return; -- cgit v1.2.3