mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-02 08:34:20 +08:00
r8169: fix OCP access on RTL8117
According to r8168 vendor driver DASHv3 chips like RTL8168fp/RTL8117
need a special addressing for OCP access.
Fix is compile-tested only due to missing test hardware.
Fixes: 1287723aa1
("r8169: add support for RTL8117")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
156ee62bbd
commit
561535b0f2
@ -1050,6 +1050,13 @@ static u16 rtl_ephy_read(struct rtl8169_private *tp, int reg_addr)
|
||||
RTL_R32(tp, EPHYAR) & EPHYAR_DATA_MASK : ~0;
|
||||
}
|
||||
|
||||
static void r8168fp_adjust_ocp_cmd(struct rtl8169_private *tp, u32 *cmd, int type)
|
||||
{
|
||||
/* based on RTL8168FP_OOBMAC_BASE in vendor driver */
|
||||
if (tp->mac_version == RTL_GIGA_MAC_VER_52 && type == ERIAR_OOB)
|
||||
*cmd |= 0x7f0 << 18;
|
||||
}
|
||||
|
||||
DECLARE_RTL_COND(rtl_eriar_cond)
|
||||
{
|
||||
return RTL_R32(tp, ERIAR) & ERIAR_FLAG;
|
||||
@ -1058,9 +1065,12 @@ DECLARE_RTL_COND(rtl_eriar_cond)
|
||||
static void _rtl_eri_write(struct rtl8169_private *tp, int addr, u32 mask,
|
||||
u32 val, int type)
|
||||
{
|
||||
u32 cmd = ERIAR_WRITE_CMD | type | mask | addr;
|
||||
|
||||
BUG_ON((addr & 3) || (mask == 0));
|
||||
RTL_W32(tp, ERIDR, val);
|
||||
RTL_W32(tp, ERIAR, ERIAR_WRITE_CMD | type | mask | addr);
|
||||
r8168fp_adjust_ocp_cmd(tp, &cmd, type);
|
||||
RTL_W32(tp, ERIAR, cmd);
|
||||
|
||||
rtl_udelay_loop_wait_low(tp, &rtl_eriar_cond, 100, 100);
|
||||
}
|
||||
@ -1073,7 +1083,10 @@ static void rtl_eri_write(struct rtl8169_private *tp, int addr, u32 mask,
|
||||
|
||||
static u32 _rtl_eri_read(struct rtl8169_private *tp, int addr, int type)
|
||||
{
|
||||
RTL_W32(tp, ERIAR, ERIAR_READ_CMD | type | ERIAR_MASK_1111 | addr);
|
||||
u32 cmd = ERIAR_READ_CMD | type | ERIAR_MASK_1111 | addr;
|
||||
|
||||
r8168fp_adjust_ocp_cmd(tp, &cmd, type);
|
||||
RTL_W32(tp, ERIAR, cmd);
|
||||
|
||||
return rtl_udelay_loop_wait_high(tp, &rtl_eriar_cond, 100, 100) ?
|
||||
RTL_R32(tp, ERIDR) : ~0;
|
||||
|
Loading…
Reference in New Issue
Block a user