Skip to content

Commit 5fc3f6c

Browse files
hkallweitdavem330
authored andcommitted
r8169: consolidate disabling ASPM before EPHY access
Now that rtl_hw_aspm_clkreq_enable() is a no-op for chip versions < 32, we can consolidate disabling ASPM before EPHY access in rtl_hw_start(). Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c3892e8 commit 5fc3f6c

File tree

1 file changed

+3
-39
lines changed

1 file changed

+3
-39
lines changed

drivers/net/ethernet/realtek/r8169_main.c

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2962,8 +2962,6 @@ static void rtl_hw_start_8168e_2(struct rtl8169_private *tp)
29622962
RTL_W8(tp, DLLPR, RTL_R8(tp, DLLPR) | PFM_EN);
29632963
RTL_W32(tp, MISC, RTL_R32(tp, MISC) | PWM_EN);
29642964
rtl_mod_config5(tp, Spi_en, 0);
2965-
2966-
rtl_hw_aspm_clkreq_enable(tp, true);
29672965
}
29682966

29692967
static void rtl_hw_start_8168f(struct rtl8169_private *tp)
@@ -3054,11 +3052,7 @@ static void rtl_hw_start_8168g_1(struct rtl8169_private *tp)
30543052
};
30553053

30563054
rtl_hw_start_8168g(tp);
3057-
3058-
/* disable aspm and clock request before access ephy */
3059-
rtl_hw_aspm_clkreq_enable(tp, false);
30603055
rtl_ephy_init(tp, e_info_8168g_1);
3061-
rtl_hw_aspm_clkreq_enable(tp, true);
30623056
}
30633057

30643058
static void rtl_hw_start_8168g_2(struct rtl8169_private *tp)
@@ -3076,9 +3070,6 @@ static void rtl_hw_start_8168g_2(struct rtl8169_private *tp)
30763070
};
30773071

30783072
rtl_hw_start_8168g(tp);
3079-
3080-
/* disable aspm and clock request before access ephy */
3081-
rtl_hw_aspm_clkreq_enable(tp, false);
30823073
rtl_ephy_init(tp, e_info_8168g_2);
30833074
}
30843075

@@ -3099,8 +3090,6 @@ static void rtl_hw_start_8411_2(struct rtl8169_private *tp)
30993090

31003091
rtl_hw_start_8168g(tp);
31013092

3102-
/* disable aspm and clock request before access ephy */
3103-
rtl_hw_aspm_clkreq_enable(tp, false);
31043093
rtl_ephy_init(tp, e_info_8411_2);
31053094

31063095
/* The following Realtek-provided magic fixes an issue with the RX unit
@@ -3238,8 +3227,6 @@ static void rtl_hw_start_8411_2(struct rtl8169_private *tp)
32383227
r8168_mac_ocp_write(tp, 0xFC32, 0x0C25);
32393228
r8168_mac_ocp_write(tp, 0xFC34, 0x00A9);
32403229
r8168_mac_ocp_write(tp, 0xFC36, 0x012D);
3241-
3242-
rtl_hw_aspm_clkreq_enable(tp, true);
32433230
}
32443231

32453232
static void rtl_hw_start_8168h_1(struct rtl8169_private *tp)
@@ -3254,8 +3241,6 @@ static void rtl_hw_start_8168h_1(struct rtl8169_private *tp)
32543241
};
32553242
int rg_saw_cnt;
32563243

3257-
/* disable aspm and clock request before access ephy */
3258-
rtl_hw_aspm_clkreq_enable(tp, false);
32593244
rtl_ephy_init(tp, e_info_8168h_1);
32603245

32613246
rtl_set_fifo_size(tp, 0x08, 0x10, 0x02, 0x06);
@@ -3303,8 +3288,6 @@ static void rtl_hw_start_8168h_1(struct rtl8169_private *tp)
33033288
r8168_mac_ocp_write(tp, 0xe63e, 0x0000);
33043289
r8168_mac_ocp_write(tp, 0xc094, 0x0000);
33053290
r8168_mac_ocp_write(tp, 0xc09e, 0x0000);
3306-
3307-
rtl_hw_aspm_clkreq_enable(tp, true);
33083291
}
33093292

33103293
static void rtl_hw_start_8168ep(struct rtl8169_private *tp)
@@ -3343,8 +3326,6 @@ static void rtl_hw_start_8168ep_3(struct rtl8169_private *tp)
33433326
{ 0x1e, 0x0000, 0x2000 },
33443327
};
33453328

3346-
/* disable aspm and clock request before access ephy */
3347-
rtl_hw_aspm_clkreq_enable(tp, false);
33483329
rtl_ephy_init(tp, e_info_8168ep_3);
33493330

33503331
rtl_hw_start_8168ep(tp);
@@ -3355,8 +3336,6 @@ static void rtl_hw_start_8168ep_3(struct rtl8169_private *tp)
33553336
r8168_mac_ocp_modify(tp, 0xd3e2, 0x0fff, 0x0271);
33563337
r8168_mac_ocp_modify(tp, 0xd3e4, 0x00ff, 0x0000);
33573338
r8168_mac_ocp_modify(tp, 0xe860, 0x0000, 0x0080);
3358-
3359-
rtl_hw_aspm_clkreq_enable(tp, true);
33603339
}
33613340

33623341
static void rtl_hw_start_8117(struct rtl8169_private *tp)
@@ -3368,9 +3347,6 @@ static void rtl_hw_start_8117(struct rtl8169_private *tp)
33683347
int rg_saw_cnt;
33693348

33703349
rtl8168ep_stop_cmac(tp);
3371-
3372-
/* disable aspm and clock request before access ephy */
3373-
rtl_hw_aspm_clkreq_enable(tp, false);
33743350
rtl_ephy_init(tp, e_info_8117);
33753351

33763352
rtl_set_fifo_size(tp, 0x08, 0x10, 0x02, 0x06);
@@ -3420,8 +3396,6 @@ static void rtl_hw_start_8117(struct rtl8169_private *tp)
34203396

34213397
/* firmware is for MAC only */
34223398
r8169_apply_firmware(tp);
3423-
3424-
rtl_hw_aspm_clkreq_enable(tp, true);
34253399
}
34263400

34273401
static void rtl_hw_start_8102e_1(struct rtl8169_private *tp)
@@ -3544,8 +3518,6 @@ static void rtl_hw_start_8402(struct rtl8169_private *tp)
35443518

35453519
static void rtl_hw_start_8106(struct rtl8169_private *tp)
35463520
{
3547-
rtl_hw_aspm_clkreq_enable(tp, false);
3548-
35493521
/* Force LAN exit from ASPM if Rx/Tx are not idle */
35503522
RTL_W32(tp, FuncEvent, RTL_R32(tp, FuncEvent) | 0x002800);
35513523

@@ -3562,7 +3534,6 @@ static void rtl_hw_start_8106(struct rtl8169_private *tp)
35623534
rtl_eri_write(tp, 0x1b0, ERIAR_MASK_0011, 0x0000);
35633535

35643536
rtl_pcie_state_l2l3_disable(tp);
3565-
rtl_hw_aspm_clkreq_enable(tp, true);
35663537
}
35673538

35683539
DECLARE_RTL_COND(rtl_mac_ocp_e00e_cond)
@@ -3650,13 +3621,8 @@ static void rtl_hw_start_8125a_2(struct rtl8169_private *tp)
36503621
};
36513622

36523623
rtl_set_def_aspm_entry_latency(tp);
3653-
3654-
/* disable aspm and clock request before access ephy */
3655-
rtl_hw_aspm_clkreq_enable(tp, false);
36563624
rtl_ephy_init(tp, e_info_8125a_2);
3657-
36583625
rtl_hw_start_8125_common(tp);
3659-
rtl_hw_aspm_clkreq_enable(tp, true);
36603626
}
36613627

36623628
static void rtl_hw_start_8125b(struct rtl8169_private *tp)
@@ -3671,12 +3637,8 @@ static void rtl_hw_start_8125b(struct rtl8169_private *tp)
36713637
};
36723638

36733639
rtl_set_def_aspm_entry_latency(tp);
3674-
rtl_hw_aspm_clkreq_enable(tp, false);
3675-
36763640
rtl_ephy_init(tp, e_info_8125b);
36773641
rtl_hw_start_8125_common(tp);
3678-
3679-
rtl_hw_aspm_clkreq_enable(tp, true);
36803642
}
36813643

36823644
static void rtl_hw_config(struct rtl8169_private *tp)
@@ -3772,7 +3734,8 @@ static void rtl_hw_start_8169(struct rtl8169_private *tp)
37723734
static void rtl_hw_start(struct rtl8169_private *tp)
37733735
{
37743736
rtl_unlock_config_regs(tp);
3775-
3737+
/* disable aspm and clock request before ephy access */
3738+
rtl_hw_aspm_clkreq_enable(tp, false);
37763739
RTL_W16(tp, CPlusCmd, tp->cp_cmd);
37773740

37783741
if (tp->mac_version <= RTL_GIGA_MAC_VER_06)
@@ -3783,6 +3746,7 @@ static void rtl_hw_start(struct rtl8169_private *tp)
37833746
rtl_hw_start_8168(tp);
37843747

37853748
rtl_enable_exit_l1(tp);
3749+
rtl_hw_aspm_clkreq_enable(tp, true);
37863750
rtl_set_rx_max_size(tp);
37873751
rtl_set_rx_tx_desc_registers(tp);
37883752
rtl_lock_config_regs(tp);

0 commit comments

Comments
 (0)