Commit e031ce80 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Jakub Kicinski

r8169: add helper r8168g_wait_ll_share_fifo_ready

Create a helper for this waiting function, name of the helper is
borrowed from the vendor driver. In addition don't return in the two
hw_init functions if the first wait runs into a timeout, there's no
benefit in doing so.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent b5c3babb
...@@ -5055,6 +5055,11 @@ DECLARE_RTL_COND(rtl_link_list_ready_cond) ...@@ -5055,6 +5055,11 @@ DECLARE_RTL_COND(rtl_link_list_ready_cond)
return RTL_R8(tp, MCU) & LINK_LIST_RDY; return RTL_R8(tp, MCU) & LINK_LIST_RDY;
} }
static void r8168g_wait_ll_share_fifo_ready(struct rtl8169_private *tp)
{
rtl_loop_wait_high(tp, &rtl_link_list_ready_cond, 100, 42);
}
DECLARE_RTL_COND(rtl_rxtx_empty_cond) DECLARE_RTL_COND(rtl_rxtx_empty_cond)
{ {
return (RTL_R8(tp, MCU) & RXTX_EMPTY) == RXTX_EMPTY; return (RTL_R8(tp, MCU) & RXTX_EMPTY) == RXTX_EMPTY;
...@@ -5139,13 +5144,10 @@ static void rtl_hw_init_8168g(struct rtl8169_private *tp) ...@@ -5139,13 +5144,10 @@ static void rtl_hw_init_8168g(struct rtl8169_private *tp)
RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB); RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB);
r8168_mac_ocp_modify(tp, 0xe8de, BIT(14), 0); r8168_mac_ocp_modify(tp, 0xe8de, BIT(14), 0);
r8168g_wait_ll_share_fifo_ready(tp);
if (!rtl_loop_wait_high(tp, &rtl_link_list_ready_cond, 100, 42))
return;
r8168_mac_ocp_modify(tp, 0xe8de, 0, BIT(15)); r8168_mac_ocp_modify(tp, 0xe8de, 0, BIT(15));
r8168g_wait_ll_share_fifo_ready(tp);
rtl_loop_wait_high(tp, &rtl_link_list_ready_cond, 100, 42);
} }
static void rtl_hw_init_8125(struct rtl8169_private *tp) static void rtl_hw_init_8125(struct rtl8169_private *tp)
...@@ -5160,15 +5162,12 @@ static void rtl_hw_init_8125(struct rtl8169_private *tp) ...@@ -5160,15 +5162,12 @@ static void rtl_hw_init_8125(struct rtl8169_private *tp)
RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB); RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB);
r8168_mac_ocp_modify(tp, 0xe8de, BIT(14), 0); r8168_mac_ocp_modify(tp, 0xe8de, BIT(14), 0);
r8168g_wait_ll_share_fifo_ready(tp);
if (!rtl_loop_wait_high(tp, &rtl_link_list_ready_cond, 100, 42))
return;
r8168_mac_ocp_write(tp, 0xc0aa, 0x07d0); r8168_mac_ocp_write(tp, 0xc0aa, 0x07d0);
r8168_mac_ocp_write(tp, 0xc0a6, 0x0150); r8168_mac_ocp_write(tp, 0xc0a6, 0x0150);
r8168_mac_ocp_write(tp, 0xc01e, 0x5555); r8168_mac_ocp_write(tp, 0xc01e, 0x5555);
r8168g_wait_ll_share_fifo_ready(tp);
rtl_loop_wait_high(tp, &rtl_link_list_ready_cond, 100, 42);
} }
static void rtl_hw_initialize(struct rtl8169_private *tp) static void rtl_hw_initialize(struct rtl8169_private *tp)
......
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