mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 17:45:09 +07:00
r8169: add helper rtl_pci_commit
In few places we do a PCI commit by reading an arbitrary chip register. It's not always obvious that the read is meant to be a PCI commit, therefore add a helper for it. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9aab78290a
commit
711463f834
@ -689,6 +689,12 @@ static void rtl_unlock_config_regs(struct rtl8169_private *tp)
|
||||
RTL_W8(tp, Cfg9346, Cfg9346_Unlock);
|
||||
}
|
||||
|
||||
static void rtl_pci_commit(struct rtl8169_private *tp)
|
||||
{
|
||||
/* Read an arbitrary register to commit a preceding PCI write */
|
||||
RTL_R8(tp, ChipCmd);
|
||||
}
|
||||
|
||||
static bool rtl_is_8125(struct rtl8169_private *tp)
|
||||
{
|
||||
return tp->mac_version >= RTL_GIGA_MAC_VER_60;
|
||||
@ -1319,8 +1325,7 @@ static void rtl8169_irq_mask_and_ack(struct rtl8169_private *tp)
|
||||
{
|
||||
rtl_irq_disable(tp);
|
||||
rtl_ack_events(tp, 0xffffffff);
|
||||
/* PCI commit */
|
||||
RTL_R8(tp, ChipCmd);
|
||||
rtl_pci_commit(tp);
|
||||
}
|
||||
|
||||
static void rtl_link_chg_patch(struct rtl8169_private *tp)
|
||||
@ -1532,7 +1537,7 @@ static int rtl8169_set_features(struct net_device *dev,
|
||||
}
|
||||
|
||||
RTL_W16(tp, CPlusCmd, tp->cp_cmd);
|
||||
RTL_R16(tp, CPlusCmd);
|
||||
rtl_pci_commit(tp);
|
||||
|
||||
rtl_unlock_work(tp);
|
||||
|
||||
@ -1618,7 +1623,7 @@ static bool rtl8169_do_counters(struct rtl8169_private *tp, u32 counter_cmd)
|
||||
u32 cmd;
|
||||
|
||||
RTL_W32(tp, CounterAddrHigh, (u64)paddr >> 32);
|
||||
RTL_R32(tp, CounterAddrHigh);
|
||||
rtl_pci_commit(tp);
|
||||
cmd = (u64)paddr & DMA_BIT_MASK(32);
|
||||
RTL_W32(tp, CounterAddrLow, cmd);
|
||||
RTL_W32(tp, CounterAddrLow, cmd | counter_cmd);
|
||||
@ -1942,7 +1947,7 @@ static int rtl_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec)
|
||||
|
||||
tp->cp_cmd = (tp->cp_cmd & ~INTT_MASK) | cp01;
|
||||
RTL_W16(tp, CPlusCmd, tp->cp_cmd);
|
||||
RTL_R16(tp, CPlusCmd);
|
||||
rtl_pci_commit(tp);
|
||||
|
||||
rtl_unlock_work(tp);
|
||||
|
||||
@ -2260,10 +2265,10 @@ static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr)
|
||||
rtl_unlock_config_regs(tp);
|
||||
|
||||
RTL_W32(tp, MAC4, addr[4] | addr[5] << 8);
|
||||
RTL_R32(tp, MAC4);
|
||||
rtl_pci_commit(tp);
|
||||
|
||||
RTL_W32(tp, MAC0, addr[0] | addr[1] << 8 | addr[2] << 16 | addr[3] << 24);
|
||||
RTL_R32(tp, MAC0);
|
||||
rtl_pci_commit(tp);
|
||||
|
||||
if (tp->mac_version == RTL_GIGA_MAC_VER_34)
|
||||
rtl_rar_exgmac_set(tp, addr);
|
||||
@ -3873,7 +3878,8 @@ static void rtl_hw_start(struct rtl8169_private *tp)
|
||||
rtl_jumbo_config(tp, tp->dev->mtu);
|
||||
|
||||
/* Initially a 10 us delay. Turned it into a PCI commit. - FR */
|
||||
RTL_R16(tp, CPlusCmd);
|
||||
rtl_pci_commit(tp);
|
||||
|
||||
RTL_W8(tp, ChipCmd, CmdTxEnb | CmdRxEnb);
|
||||
rtl_init_rxcfg(tp);
|
||||
rtl_set_tx_config_registers(tp);
|
||||
@ -5091,8 +5097,7 @@ static void rtl_wol_shutdown_quirk(struct rtl8169_private *tp)
|
||||
pci_clear_master(tp->pci_dev);
|
||||
|
||||
RTL_W8(tp, ChipCmd, CmdRxEnb);
|
||||
/* PCI commit */
|
||||
RTL_R8(tp, ChipCmd);
|
||||
rtl_pci_commit(tp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user