r8169: fix OCP access on RTL8117
Heiner Kallweit
maintainerPATCH 1/1 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 1287723aa139 ("r8169: add support for RTL8117")
Signed-off-by Heiner Kallweit <[email protected]>
---
- applies on net-next with a bit of fuzz
--- drivers/net/ethernet/realtek/r8169_main.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/net/ethernet/realtek/r8169_main.c +15 -2
@@ -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 ;
Signature · 1 line
2.26.2
David Miller
maintainerFrom: Heiner Kallweit <[email protected]>
Date: Thu, 21 May 2020 22:03:08 +0200
Quoted 6 lines
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 1287723aa139 ("r8169: add support for RTL8117")Signed-off-by Heiner Kallweit <[email protected]>
Applied and queued up for -stable, thanks.