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 <hkallweit1@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Heiner Kallweit 2020-05-08 23:30:43 +02:00 committed by Jakub Kicinski
parent e031ce80d9
commit 9617886fa6

View File

@ -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;