Skip to content

Commit 4b5dc1a

Browse files
hayesorzdavem330
authored andcommitted
Revert "r8152: adjust the settings about MAC clock speed down for RTL8153"
This reverts commit 134f98b. The r8153_mac_clk_spd() is used for RTL8153A only, because the register table of RTL8153B is different from RTL8153A. However, this function would be called when RTL8153B calls r8153_first_init() and r8153_enter_oob(). That causes RTL8153B becomes unstable when suspending and resuming. The worst case may let the device stop working. Besides, revert this commit to disable MAC clock speed down for RTL8153A. It would avoid the known issue when enabling U1. The data of the first control transfer may be wrong when exiting U1. Signed-off-by: Hayes Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3e59e88 commit 4b5dc1a

File tree

1 file changed

+6
-29
lines changed

1 file changed

+6
-29
lines changed

drivers/net/usb/r8152.c

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3021,29 +3021,6 @@ static void __rtl_set_wol(struct r8152 *tp, u32 wolopts)
30213021
device_set_wakeup_enable(&tp->udev->dev, false);
30223022
}
30233023

3024-
static void r8153_mac_clk_spd(struct r8152 *tp, bool enable)
3025-
{
3026-
/* MAC clock speed down */
3027-
if (enable) {
3028-
ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL,
3029-
ALDPS_SPDWN_RATIO);
3030-
ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL2,
3031-
EEE_SPDWN_RATIO);
3032-
ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3,
3033-
PKT_AVAIL_SPDWN_EN | SUSPEND_SPDWN_EN |
3034-
U1U2_SPDWN_EN | L1_SPDWN_EN);
3035-
ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL4,
3036-
PWRSAVE_SPDWN_EN | RXDV_SPDWN_EN | TX10MIDLE_EN |
3037-
TP100_SPDWN_EN | TP500_SPDWN_EN | EEE_SPDWN_EN |
3038-
TP1000_SPDWN_EN);
3039-
} else {
3040-
ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL, 0);
3041-
ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL2, 0);
3042-
ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, 0);
3043-
ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL4, 0);
3044-
}
3045-
}
3046-
30473024
static void r8153_u1u2en(struct r8152 *tp, bool enable)
30483025
{
30493026
u8 u1u2[8];
@@ -3338,11 +3315,9 @@ static void rtl8153_runtime_enable(struct r8152 *tp, bool enable)
33383315
if (enable) {
33393316
r8153_u1u2en(tp, false);
33403317
r8153_u2p3en(tp, false);
3341-
r8153_mac_clk_spd(tp, true);
33423318
rtl_runtime_suspend_enable(tp, true);
33433319
} else {
33443320
rtl_runtime_suspend_enable(tp, false);
3345-
r8153_mac_clk_spd(tp, false);
33463321

33473322
switch (tp->version) {
33483323
case RTL_VER_03:
@@ -4718,7 +4693,6 @@ static void r8153_first_init(struct r8152 *tp)
47184693
{
47194694
u32 ocp_data;
47204695

4721-
r8153_mac_clk_spd(tp, false);
47224696
rxdy_gated_en(tp, true);
47234697
r8153_teredo_off(tp);
47244698

@@ -4769,8 +4743,6 @@ static void r8153_enter_oob(struct r8152 *tp)
47694743
{
47704744
u32 ocp_data;
47714745

4772-
r8153_mac_clk_spd(tp, true);
4773-
47744746
ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
47754747
ocp_data &= ~NOW_IS_OOB;
47764748
ocp_write_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL, ocp_data);
@@ -5496,10 +5468,15 @@ static void r8153_init(struct r8152 *tp)
54965468

54975469
ocp_write_word(tp, MCU_TYPE_USB, USB_CONNECT_TIMER, 0x0001);
54985470

5471+
/* MAC clock speed down */
5472+
ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL, 0);
5473+
ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL2, 0);
5474+
ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, 0);
5475+
ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL4, 0);
5476+
54995477
r8153_power_cut_en(tp, false);
55005478
rtl_runtime_suspend_enable(tp, false);
55015479
r8153_u1u2en(tp, true);
5502-
r8153_mac_clk_spd(tp, false);
55035480
usb_enable_lpm(tp->udev);
55045481

55055482
ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6);

0 commit comments

Comments
 (0)