Skip to content

Commit 561535b

Browse files
hkallweitdavem330
authored andcommitted
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: 1287723 ("r8169: add support for RTL8117") Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 156ee62 commit 561535b

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

drivers/net/ethernet/realtek/r8169_main.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,13 @@ static u16 rtl_ephy_read(struct rtl8169_private *tp, int reg_addr)
10501050
RTL_R32(tp, EPHYAR) & EPHYAR_DATA_MASK : ~0;
10511051
}
10521052

1053+
static void r8168fp_adjust_ocp_cmd(struct rtl8169_private *tp, u32 *cmd, int type)
1054+
{
1055+
/* based on RTL8168FP_OOBMAC_BASE in vendor driver */
1056+
if (tp->mac_version == RTL_GIGA_MAC_VER_52 && type == ERIAR_OOB)
1057+
*cmd |= 0x7f0 << 18;
1058+
}
1059+
10531060
DECLARE_RTL_COND(rtl_eriar_cond)
10541061
{
10551062
return RTL_R32(tp, ERIAR) & ERIAR_FLAG;
@@ -1058,9 +1065,12 @@ DECLARE_RTL_COND(rtl_eriar_cond)
10581065
static void _rtl_eri_write(struct rtl8169_private *tp, int addr, u32 mask,
10591066
u32 val, int type)
10601067
{
1068+
u32 cmd = ERIAR_WRITE_CMD | type | mask | addr;
1069+
10611070
BUG_ON((addr & 3) || (mask == 0));
10621071
RTL_W32(tp, ERIDR, val);
1063-
RTL_W32(tp, ERIAR, ERIAR_WRITE_CMD | type | mask | addr);
1072+
r8168fp_adjust_ocp_cmd(tp, &cmd, type);
1073+
RTL_W32(tp, ERIAR, cmd);
10641074

10651075
rtl_udelay_loop_wait_low(tp, &rtl_eriar_cond, 100, 100);
10661076
}
@@ -1073,7 +1083,10 @@ static void rtl_eri_write(struct rtl8169_private *tp, int addr, u32 mask,
10731083

10741084
static u32 _rtl_eri_read(struct rtl8169_private *tp, int addr, int type)
10751085
{
1076-
RTL_W32(tp, ERIAR, ERIAR_READ_CMD | type | ERIAR_MASK_1111 | addr);
1086+
u32 cmd = ERIAR_READ_CMD | type | ERIAR_MASK_1111 | addr;
1087+
1088+
r8168fp_adjust_ocp_cmd(tp, &cmd, type);
1089+
RTL_W32(tp, ERIAR, cmd);
10771090

10781091
return rtl_udelay_loop_wait_high(tp, &rtl_eriar_cond, 100, 100) ?
10791092
RTL_R32(tp, ERIDR) : ~0;

0 commit comments

Comments
 (0)