Skip to content

Commit b037832

Browse files
committed
Merge branch 'r8169-enable-more-devices-aspm-support'
ChunHao Lin says: ==================== r8169: enable more devices ASPM support This series of patches will enable more devices ASPM support. It also fix a RTL8126 cannot enter L1 substate issue when ASPM is enabled. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 6d19294 + b48688e commit b037832

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

drivers/net/ethernet/realtek/r8169_main.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2852,6 +2852,32 @@ static u32 rtl_csi_read(struct rtl8169_private *tp, int addr)
28522852
RTL_R32(tp, CSIDR) : ~0;
28532853
}
28542854

2855+
static void rtl_disable_zrxdc_timeout(struct rtl8169_private *tp)
2856+
{
2857+
struct pci_dev *pdev = tp->pci_dev;
2858+
u32 csi;
2859+
int rc;
2860+
u8 val;
2861+
2862+
#define RTL_GEN3_RELATED_OFF 0x0890
2863+
#define RTL_GEN3_ZRXDC_NONCOMPL 0x1
2864+
if (pdev->cfg_size > RTL_GEN3_RELATED_OFF) {
2865+
rc = pci_read_config_byte(pdev, RTL_GEN3_RELATED_OFF, &val);
2866+
if (rc == PCIBIOS_SUCCESSFUL) {
2867+
val &= ~RTL_GEN3_ZRXDC_NONCOMPL;
2868+
rc = pci_write_config_byte(pdev, RTL_GEN3_RELATED_OFF,
2869+
val);
2870+
if (rc == PCIBIOS_SUCCESSFUL)
2871+
return;
2872+
}
2873+
}
2874+
2875+
netdev_notice_once(tp->dev,
2876+
"No native access to PCI extended config space, falling back to CSI\n");
2877+
csi = rtl_csi_read(tp, RTL_GEN3_RELATED_OFF);
2878+
rtl_csi_write(tp, RTL_GEN3_RELATED_OFF, csi & ~RTL_GEN3_ZRXDC_NONCOMPL);
2879+
}
2880+
28552881
static void rtl_set_aspm_entry_latency(struct rtl8169_private *tp, u8 val)
28562882
{
28572883
struct pci_dev *pdev = tp->pci_dev;
@@ -3824,6 +3850,7 @@ static void rtl_hw_start_8125d(struct rtl8169_private *tp)
38243850

38253851
static void rtl_hw_start_8126a(struct rtl8169_private *tp)
38263852
{
3853+
rtl_disable_zrxdc_timeout(tp);
38273854
rtl_set_def_aspm_entry_latency(tp);
38283855
rtl_hw_start_8125_common(tp);
38293856
}
@@ -5398,7 +5425,7 @@ static void rtl_init_mac_address(struct rtl8169_private *tp)
53985425
/* register is set if system vendor successfully tested ASPM 1.2 */
53995426
static bool rtl_aspm_is_safe(struct rtl8169_private *tp)
54005427
{
5401-
if (tp->mac_version >= RTL_GIGA_MAC_VER_61 &&
5428+
if (tp->mac_version >= RTL_GIGA_MAC_VER_46 &&
54025429
r8168_mac_ocp_read(tp, 0xc0b2) & 0xf)
54035430
return true;
54045431

0 commit comments

Comments
 (0)