r8169: move some calls to rtl8169_hw_reset
Move calls that are needed before and after calling rtl8169_hw_reset() into this function. This requires to move the function in the code. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9fdd50c579
commit
bac75d8565
|
@ -2530,36 +2530,6 @@ static void rtl_enable_rxdvgate(struct rtl8169_private *tp)
|
||||||
rtl_wait_txrx_fifo_empty(tp);
|
rtl_wait_txrx_fifo_empty(tp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rtl8169_hw_reset(struct rtl8169_private *tp)
|
|
||||||
{
|
|
||||||
/* Disable interrupts */
|
|
||||||
rtl8169_irq_mask_and_ack(tp);
|
|
||||||
|
|
||||||
rtl_rx_close(tp);
|
|
||||||
|
|
||||||
switch (tp->mac_version) {
|
|
||||||
case RTL_GIGA_MAC_VER_27:
|
|
||||||
case RTL_GIGA_MAC_VER_28:
|
|
||||||
case RTL_GIGA_MAC_VER_31:
|
|
||||||
rtl_loop_wait_low(tp, &rtl_npq_cond, 20, 2000);
|
|
||||||
break;
|
|
||||||
case RTL_GIGA_MAC_VER_34 ... RTL_GIGA_MAC_VER_38:
|
|
||||||
RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) | StopReq);
|
|
||||||
rtl_loop_wait_high(tp, &rtl_txcfg_empty_cond, 100, 666);
|
|
||||||
break;
|
|
||||||
case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_61:
|
|
||||||
rtl_enable_rxdvgate(tp);
|
|
||||||
fsleep(2000);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) | StopReq);
|
|
||||||
udelay(100);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
rtl_hw_reset(tp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void rtl_set_tx_config_registers(struct rtl8169_private *tp)
|
static void rtl_set_tx_config_registers(struct rtl8169_private *tp)
|
||||||
{
|
{
|
||||||
u32 val = TX_DMA_BURST << TxDMAShift |
|
u32 val = TX_DMA_BURST << TxDMAShift |
|
||||||
|
@ -3958,6 +3928,42 @@ static void rtl8169_tx_clear(struct rtl8169_private *tp)
|
||||||
netdev_reset_queue(tp->dev);
|
netdev_reset_queue(tp->dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rtl8169_hw_reset(struct rtl8169_private *tp)
|
||||||
|
{
|
||||||
|
/* Give a racing hard_start_xmit a few cycles to complete. */
|
||||||
|
synchronize_rcu();
|
||||||
|
|
||||||
|
/* Disable interrupts */
|
||||||
|
rtl8169_irq_mask_and_ack(tp);
|
||||||
|
|
||||||
|
rtl_rx_close(tp);
|
||||||
|
|
||||||
|
switch (tp->mac_version) {
|
||||||
|
case RTL_GIGA_MAC_VER_27:
|
||||||
|
case RTL_GIGA_MAC_VER_28:
|
||||||
|
case RTL_GIGA_MAC_VER_31:
|
||||||
|
rtl_loop_wait_low(tp, &rtl_npq_cond, 20, 2000);
|
||||||
|
break;
|
||||||
|
case RTL_GIGA_MAC_VER_34 ... RTL_GIGA_MAC_VER_38:
|
||||||
|
RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) | StopReq);
|
||||||
|
rtl_loop_wait_high(tp, &rtl_txcfg_empty_cond, 100, 666);
|
||||||
|
break;
|
||||||
|
case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_61:
|
||||||
|
rtl_enable_rxdvgate(tp);
|
||||||
|
fsleep(2000);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) | StopReq);
|
||||||
|
fsleep(100);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
rtl_hw_reset(tp);
|
||||||
|
|
||||||
|
rtl8169_tx_clear(tp);
|
||||||
|
rtl8169_init_ring_indexes(tp);
|
||||||
|
}
|
||||||
|
|
||||||
static void rtl_reset_work(struct rtl8169_private *tp)
|
static void rtl_reset_work(struct rtl8169_private *tp)
|
||||||
{
|
{
|
||||||
struct net_device *dev = tp->dev;
|
struct net_device *dev = tp->dev;
|
||||||
|
@ -3965,16 +3971,12 @@ static void rtl_reset_work(struct rtl8169_private *tp)
|
||||||
|
|
||||||
napi_disable(&tp->napi);
|
napi_disable(&tp->napi);
|
||||||
netif_stop_queue(dev);
|
netif_stop_queue(dev);
|
||||||
synchronize_rcu();
|
|
||||||
|
|
||||||
rtl8169_hw_reset(tp);
|
rtl8169_hw_reset(tp);
|
||||||
|
|
||||||
for (i = 0; i < NUM_RX_DESC; i++)
|
for (i = 0; i < NUM_RX_DESC; i++)
|
||||||
rtl8169_mark_to_asic(tp->RxDescArray + i);
|
rtl8169_mark_to_asic(tp->RxDescArray + i);
|
||||||
|
|
||||||
rtl8169_tx_clear(tp);
|
|
||||||
rtl8169_init_ring_indexes(tp);
|
|
||||||
|
|
||||||
napi_enable(&tp->napi);
|
napi_enable(&tp->napi);
|
||||||
rtl_hw_start(tp);
|
rtl_hw_start(tp);
|
||||||
netif_wake_queue(dev);
|
netif_wake_queue(dev);
|
||||||
|
@ -4636,11 +4638,6 @@ static void rtl8169_down(struct net_device *dev)
|
||||||
|
|
||||||
rtl8169_hw_reset(tp);
|
rtl8169_hw_reset(tp);
|
||||||
|
|
||||||
/* Give a racing hard_start_xmit a few cycles to complete. */
|
|
||||||
synchronize_rcu();
|
|
||||||
|
|
||||||
rtl8169_tx_clear(tp);
|
|
||||||
|
|
||||||
rtl8169_rx_clear(tp);
|
rtl8169_rx_clear(tp);
|
||||||
|
|
||||||
rtl_pll_power_down(tp);
|
rtl_pll_power_down(tp);
|
||||||
|
|
Loading…
Reference in New Issue