Skip to content

Commit fe4e8db

Browse files
hkallweitdavem330
authored andcommitted
r8169: fix issue with confused RX unit after PHY power-down on RTL8411b
On RTL8411b the RX unit gets confused if the PHY is powered-down. This was reported in [0] and confirmed by Realtek. Realtek provided a sequence to fix the RX unit after PHY wakeup. The issue itself seems to have been there longer, the Fixes tag refers to where the fix applies properly. [0] https://bugzilla.redhat.com/show_bug.cgi?id=1692075 Fixes: a99790b ("r8169: Reinstate ASPM Support") Tested-by: Ionut Radu <ionut.radu@gmail.com> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 192f0f8 commit fe4e8db

File tree

1 file changed

+137
-0
lines changed

1 file changed

+137
-0
lines changed

drivers/net/ethernet/realtek/r8169_main.c

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4667,6 +4667,143 @@ static void rtl_hw_start_8411_2(struct rtl8169_private *tp)
46674667
/* disable aspm and clock request before access ephy */
46684668
rtl_hw_aspm_clkreq_enable(tp, false);
46694669
rtl_ephy_init(tp, e_info_8411_2);
4670+
4671+
/* The following Realtek-provided magic fixes an issue with the RX unit
4672+
* getting confused after the PHY having been powered-down.
4673+
*/
4674+
r8168_mac_ocp_write(tp, 0xFC28, 0x0000);
4675+
r8168_mac_ocp_write(tp, 0xFC2A, 0x0000);
4676+
r8168_mac_ocp_write(tp, 0xFC2C, 0x0000);
4677+
r8168_mac_ocp_write(tp, 0xFC2E, 0x0000);
4678+
r8168_mac_ocp_write(tp, 0xFC30, 0x0000);
4679+
r8168_mac_ocp_write(tp, 0xFC32, 0x0000);
4680+
r8168_mac_ocp_write(tp, 0xFC34, 0x0000);
4681+
r8168_mac_ocp_write(tp, 0xFC36, 0x0000);
4682+
mdelay(3);
4683+
r8168_mac_ocp_write(tp, 0xFC26, 0x0000);
4684+
4685+
r8168_mac_ocp_write(tp, 0xF800, 0xE008);
4686+
r8168_mac_ocp_write(tp, 0xF802, 0xE00A);
4687+
r8168_mac_ocp_write(tp, 0xF804, 0xE00C);
4688+
r8168_mac_ocp_write(tp, 0xF806, 0xE00E);
4689+
r8168_mac_ocp_write(tp, 0xF808, 0xE027);
4690+
r8168_mac_ocp_write(tp, 0xF80A, 0xE04F);
4691+
r8168_mac_ocp_write(tp, 0xF80C, 0xE05E);
4692+
r8168_mac_ocp_write(tp, 0xF80E, 0xE065);
4693+
r8168_mac_ocp_write(tp, 0xF810, 0xC602);
4694+
r8168_mac_ocp_write(tp, 0xF812, 0xBE00);
4695+
r8168_mac_ocp_write(tp, 0xF814, 0x0000);
4696+
r8168_mac_ocp_write(tp, 0xF816, 0xC502);
4697+
r8168_mac_ocp_write(tp, 0xF818, 0xBD00);
4698+
r8168_mac_ocp_write(tp, 0xF81A, 0x074C);
4699+
r8168_mac_ocp_write(tp, 0xF81C, 0xC302);
4700+
r8168_mac_ocp_write(tp, 0xF81E, 0xBB00);
4701+
r8168_mac_ocp_write(tp, 0xF820, 0x080A);
4702+
r8168_mac_ocp_write(tp, 0xF822, 0x6420);
4703+
r8168_mac_ocp_write(tp, 0xF824, 0x48C2);
4704+
r8168_mac_ocp_write(tp, 0xF826, 0x8C20);
4705+
r8168_mac_ocp_write(tp, 0xF828, 0xC516);
4706+
r8168_mac_ocp_write(tp, 0xF82A, 0x64A4);
4707+
r8168_mac_ocp_write(tp, 0xF82C, 0x49C0);
4708+
r8168_mac_ocp_write(tp, 0xF82E, 0xF009);
4709+
r8168_mac_ocp_write(tp, 0xF830, 0x74A2);
4710+
r8168_mac_ocp_write(tp, 0xF832, 0x8CA5);
4711+
r8168_mac_ocp_write(tp, 0xF834, 0x74A0);
4712+
r8168_mac_ocp_write(tp, 0xF836, 0xC50E);
4713+
r8168_mac_ocp_write(tp, 0xF838, 0x9CA2);
4714+
r8168_mac_ocp_write(tp, 0xF83A, 0x1C11);
4715+
r8168_mac_ocp_write(tp, 0xF83C, 0x9CA0);
4716+
r8168_mac_ocp_write(tp, 0xF83E, 0xE006);
4717+
r8168_mac_ocp_write(tp, 0xF840, 0x74F8);
4718+
r8168_mac_ocp_write(tp, 0xF842, 0x48C4);
4719+
r8168_mac_ocp_write(tp, 0xF844, 0x8CF8);
4720+
r8168_mac_ocp_write(tp, 0xF846, 0xC404);
4721+
r8168_mac_ocp_write(tp, 0xF848, 0xBC00);
4722+
r8168_mac_ocp_write(tp, 0xF84A, 0xC403);
4723+
r8168_mac_ocp_write(tp, 0xF84C, 0xBC00);
4724+
r8168_mac_ocp_write(tp, 0xF84E, 0x0BF2);
4725+
r8168_mac_ocp_write(tp, 0xF850, 0x0C0A);
4726+
r8168_mac_ocp_write(tp, 0xF852, 0xE434);
4727+
r8168_mac_ocp_write(tp, 0xF854, 0xD3C0);
4728+
r8168_mac_ocp_write(tp, 0xF856, 0x49D9);
4729+
r8168_mac_ocp_write(tp, 0xF858, 0xF01F);
4730+
r8168_mac_ocp_write(tp, 0xF85A, 0xC526);
4731+
r8168_mac_ocp_write(tp, 0xF85C, 0x64A5);
4732+
r8168_mac_ocp_write(tp, 0xF85E, 0x1400);
4733+
r8168_mac_ocp_write(tp, 0xF860, 0xF007);
4734+
r8168_mac_ocp_write(tp, 0xF862, 0x0C01);
4735+
r8168_mac_ocp_write(tp, 0xF864, 0x8CA5);
4736+
r8168_mac_ocp_write(tp, 0xF866, 0x1C15);
4737+
r8168_mac_ocp_write(tp, 0xF868, 0xC51B);
4738+
r8168_mac_ocp_write(tp, 0xF86A, 0x9CA0);
4739+
r8168_mac_ocp_write(tp, 0xF86C, 0xE013);
4740+
r8168_mac_ocp_write(tp, 0xF86E, 0xC519);
4741+
r8168_mac_ocp_write(tp, 0xF870, 0x74A0);
4742+
r8168_mac_ocp_write(tp, 0xF872, 0x48C4);
4743+
r8168_mac_ocp_write(tp, 0xF874, 0x8CA0);
4744+
r8168_mac_ocp_write(tp, 0xF876, 0xC516);
4745+
r8168_mac_ocp_write(tp, 0xF878, 0x74A4);
4746+
r8168_mac_ocp_write(tp, 0xF87A, 0x48C8);
4747+
r8168_mac_ocp_write(tp, 0xF87C, 0x48CA);
4748+
r8168_mac_ocp_write(tp, 0xF87E, 0x9CA4);
4749+
r8168_mac_ocp_write(tp, 0xF880, 0xC512);
4750+
r8168_mac_ocp_write(tp, 0xF882, 0x1B00);
4751+
r8168_mac_ocp_write(tp, 0xF884, 0x9BA0);
4752+
r8168_mac_ocp_write(tp, 0xF886, 0x1B1C);
4753+
r8168_mac_ocp_write(tp, 0xF888, 0x483F);
4754+
r8168_mac_ocp_write(tp, 0xF88A, 0x9BA2);
4755+
r8168_mac_ocp_write(tp, 0xF88C, 0x1B04);
4756+
r8168_mac_ocp_write(tp, 0xF88E, 0xC508);
4757+
r8168_mac_ocp_write(tp, 0xF890, 0x9BA0);
4758+
r8168_mac_ocp_write(tp, 0xF892, 0xC505);
4759+
r8168_mac_ocp_write(tp, 0xF894, 0xBD00);
4760+
r8168_mac_ocp_write(tp, 0xF896, 0xC502);
4761+
r8168_mac_ocp_write(tp, 0xF898, 0xBD00);
4762+
r8168_mac_ocp_write(tp, 0xF89A, 0x0300);
4763+
r8168_mac_ocp_write(tp, 0xF89C, 0x051E);
4764+
r8168_mac_ocp_write(tp, 0xF89E, 0xE434);
4765+
r8168_mac_ocp_write(tp, 0xF8A0, 0xE018);
4766+
r8168_mac_ocp_write(tp, 0xF8A2, 0xE092);
4767+
r8168_mac_ocp_write(tp, 0xF8A4, 0xDE20);
4768+
r8168_mac_ocp_write(tp, 0xF8A6, 0xD3C0);
4769+
r8168_mac_ocp_write(tp, 0xF8A8, 0xC50F);
4770+
r8168_mac_ocp_write(tp, 0xF8AA, 0x76A4);
4771+
r8168_mac_ocp_write(tp, 0xF8AC, 0x49E3);
4772+
r8168_mac_ocp_write(tp, 0xF8AE, 0xF007);
4773+
r8168_mac_ocp_write(tp, 0xF8B0, 0x49C0);
4774+
r8168_mac_ocp_write(tp, 0xF8B2, 0xF103);
4775+
r8168_mac_ocp_write(tp, 0xF8B4, 0xC607);
4776+
r8168_mac_ocp_write(tp, 0xF8B6, 0xBE00);
4777+
r8168_mac_ocp_write(tp, 0xF8B8, 0xC606);
4778+
r8168_mac_ocp_write(tp, 0xF8BA, 0xBE00);
4779+
r8168_mac_ocp_write(tp, 0xF8BC, 0xC602);
4780+
r8168_mac_ocp_write(tp, 0xF8BE, 0xBE00);
4781+
r8168_mac_ocp_write(tp, 0xF8C0, 0x0C4C);
4782+
r8168_mac_ocp_write(tp, 0xF8C2, 0x0C28);
4783+
r8168_mac_ocp_write(tp, 0xF8C4, 0x0C2C);
4784+
r8168_mac_ocp_write(tp, 0xF8C6, 0xDC00);
4785+
r8168_mac_ocp_write(tp, 0xF8C8, 0xC707);
4786+
r8168_mac_ocp_write(tp, 0xF8CA, 0x1D00);
4787+
r8168_mac_ocp_write(tp, 0xF8CC, 0x8DE2);
4788+
r8168_mac_ocp_write(tp, 0xF8CE, 0x48C1);
4789+
r8168_mac_ocp_write(tp, 0xF8D0, 0xC502);
4790+
r8168_mac_ocp_write(tp, 0xF8D2, 0xBD00);
4791+
r8168_mac_ocp_write(tp, 0xF8D4, 0x00AA);
4792+
r8168_mac_ocp_write(tp, 0xF8D6, 0xE0C0);
4793+
r8168_mac_ocp_write(tp, 0xF8D8, 0xC502);
4794+
r8168_mac_ocp_write(tp, 0xF8DA, 0xBD00);
4795+
r8168_mac_ocp_write(tp, 0xF8DC, 0x0132);
4796+
4797+
r8168_mac_ocp_write(tp, 0xFC26, 0x8000);
4798+
4799+
r8168_mac_ocp_write(tp, 0xFC2A, 0x0743);
4800+
r8168_mac_ocp_write(tp, 0xFC2C, 0x0801);
4801+
r8168_mac_ocp_write(tp, 0xFC2E, 0x0BE9);
4802+
r8168_mac_ocp_write(tp, 0xFC30, 0x02FD);
4803+
r8168_mac_ocp_write(tp, 0xFC32, 0x0C25);
4804+
r8168_mac_ocp_write(tp, 0xFC34, 0x00A9);
4805+
r8168_mac_ocp_write(tp, 0xFC36, 0x012D);
4806+
46704807
rtl_hw_aspm_clkreq_enable(tp, true);
46714808
}
46724809

0 commit comments

Comments
 (0)