|
Oliver Neukum |
541bc3 |
From 4b5dc1a94d4f92b5845e98bd9ae344b26d933aad Mon Sep 17 00:00:00 2001
|
|
Oliver Neukum |
541bc3 |
From: Hayes Wang <hayeswang@realtek.com>
|
|
Oliver Neukum |
541bc3 |
Date: Wed, 3 Mar 2021 16:39:47 +0800
|
|
Oliver Neukum |
541bc3 |
Subject: [PATCH] Revert "r8152: adjust the settings about MAC clock speed down
|
|
Oliver Neukum |
541bc3 |
for RTL8153"
|
|
Oliver Neukum |
541bc3 |
Git-commit: 4b5dc1a94d4f92b5845e98bd9ae344b26d933aad
|
|
Oliver Neukum |
541bc3 |
References: git-fixes
|
|
Oliver Neukum |
541bc3 |
Patch-mainline: v5.12-rc3
|
|
Oliver Neukum |
541bc3 |
|
|
Oliver Neukum |
541bc3 |
This reverts commit 134f98bcf1b898fb9d6f2b91bc85dd2e5478b4b8.
|
|
Oliver Neukum |
541bc3 |
|
|
Oliver Neukum |
541bc3 |
The r8153_mac_clk_spd() is used for RTL8153A only, because the register
|
|
Oliver Neukum |
541bc3 |
table of RTL8153B is different from RTL8153A. However, this function would
|
|
Oliver Neukum |
541bc3 |
be called when RTL8153B calls r8153_first_init() and r8153_enter_oob().
|
|
Oliver Neukum |
541bc3 |
That causes RTL8153B becomes unstable when suspending and resuming. The
|
|
Oliver Neukum |
541bc3 |
worst case may let the device stop working.
|
|
Oliver Neukum |
541bc3 |
|
|
Oliver Neukum |
541bc3 |
Besides, revert this commit to disable MAC clock speed down for RTL8153A.
|
|
Oliver Neukum |
541bc3 |
It would avoid the known issue when enabling U1. The data of the first
|
|
Oliver Neukum |
541bc3 |
control transfer may be wrong when exiting U1.
|
|
Oliver Neukum |
541bc3 |
|
|
Oliver Neukum |
541bc3 |
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
|
|
Oliver Neukum |
541bc3 |
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
Oliver Neukum |
541bc3 |
Signed-off-by: Oliver Neukum <oneukum@suse.com>
|
|
Oliver Neukum |
541bc3 |
---
|
|
Oliver Neukum |
541bc3 |
drivers/net/usb/r8152.c | 35 ++++++-----------------------------
|
|
Oliver Neukum |
541bc3 |
1 file changed, 6 insertions(+), 29 deletions(-)
|
|
Oliver Neukum |
541bc3 |
|
|
Oliver Neukum |
541bc3 |
--- a/drivers/net/usb/r8152.c
|
|
Oliver Neukum |
541bc3 |
+++ b/drivers/net/usb/r8152.c
|
|
Oliver Neukum |
541bc3 |
@@ -2746,29 +2746,6 @@ static void __rtl_set_wol(struct r8152 *
|
|
Oliver Neukum |
541bc3 |
device_set_wakeup_enable(&tp->udev->dev, false);
|
|
Oliver Neukum |
541bc3 |
}
|
|
Oliver Neukum |
541bc3 |
|
|
Oliver Neukum |
541bc3 |
-static void r8153_mac_clk_spd(struct r8152 *tp, bool enable)
|
|
Oliver Neukum |
541bc3 |
-{
|
|
Oliver Neukum |
541bc3 |
- /* MAC clock speed down */
|
|
Oliver Neukum |
541bc3 |
- if (enable) {
|
|
Oliver Neukum |
541bc3 |
- ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL,
|
|
Oliver Neukum |
541bc3 |
- ALDPS_SPDWN_RATIO);
|
|
Oliver Neukum |
541bc3 |
- ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL2,
|
|
Oliver Neukum |
541bc3 |
- EEE_SPDWN_RATIO);
|
|
Oliver Neukum |
541bc3 |
- ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3,
|
|
Oliver Neukum |
541bc3 |
- PKT_AVAIL_SPDWN_EN | SUSPEND_SPDWN_EN |
|
|
Oliver Neukum |
541bc3 |
- U1U2_SPDWN_EN | L1_SPDWN_EN);
|
|
Oliver Neukum |
541bc3 |
- ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL4,
|
|
Oliver Neukum |
541bc3 |
- PWRSAVE_SPDWN_EN | RXDV_SPDWN_EN | TX10MIDLE_EN |
|
|
Oliver Neukum |
541bc3 |
- TP100_SPDWN_EN | TP500_SPDWN_EN | EEE_SPDWN_EN |
|
|
Oliver Neukum |
541bc3 |
- TP1000_SPDWN_EN);
|
|
Oliver Neukum |
541bc3 |
- } else {
|
|
Oliver Neukum |
541bc3 |
- ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL, 0);
|
|
Oliver Neukum |
541bc3 |
- ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL2, 0);
|
|
Oliver Neukum |
541bc3 |
- ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, 0);
|
|
Oliver Neukum |
541bc3 |
- ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL4, 0);
|
|
Oliver Neukum |
541bc3 |
- }
|
|
Oliver Neukum |
541bc3 |
-}
|
|
Oliver Neukum |
541bc3 |
-
|
|
Oliver Neukum |
541bc3 |
static void r8153_u1u2en(struct r8152 *tp, bool enable)
|
|
Oliver Neukum |
541bc3 |
{
|
|
Oliver Neukum |
541bc3 |
u8 u1u2[8];
|
|
Oliver Neukum |
541bc3 |
@@ -3004,11 +2981,9 @@ static void rtl8153_runtime_enable(struc
|
|
Oliver Neukum |
541bc3 |
if (enable) {
|
|
Oliver Neukum |
541bc3 |
r8153_u1u2en(tp, false);
|
|
Oliver Neukum |
541bc3 |
r8153_u2p3en(tp, false);
|
|
Oliver Neukum |
541bc3 |
- r8153_mac_clk_spd(tp, true);
|
|
Oliver Neukum |
541bc3 |
rtl_runtime_suspend_enable(tp, true);
|
|
Oliver Neukum |
541bc3 |
} else {
|
|
Oliver Neukum |
541bc3 |
rtl_runtime_suspend_enable(tp, false);
|
|
Oliver Neukum |
541bc3 |
- r8153_mac_clk_spd(tp, false);
|
|
Oliver Neukum |
541bc3 |
|
|
Oliver Neukum |
541bc3 |
switch (tp->version) {
|
|
Oliver Neukum |
541bc3 |
case RTL_VER_03:
|
|
Oliver Neukum |
541bc3 |
@@ -3603,7 +3578,6 @@ static void r8153_first_init(struct r815
|
|
Oliver Neukum |
541bc3 |
u32 ocp_data;
|
|
Oliver Neukum |
541bc3 |
int i;
|
|
Oliver Neukum |
541bc3 |
|
|
Oliver Neukum |
541bc3 |
- r8153_mac_clk_spd(tp, false);
|
|
Oliver Neukum |
541bc3 |
rxdy_gated_en(tp, true);
|
|
Oliver Neukum |
541bc3 |
r8153_teredo_off(tp);
|
|
Oliver Neukum |
541bc3 |
|
|
Oliver Neukum |
541bc3 |
@@ -3665,8 +3639,6 @@ static void r8153_enter_oob(struct r8152
|
|
Oliver Neukum |
541bc3 |
u32 ocp_data;
|
|
Oliver Neukum |
541bc3 |
int i;
|
|
Oliver Neukum |
541bc3 |
|
|
Oliver Neukum |
541bc3 |
- r8153_mac_clk_spd(tp, true);
|
|
Oliver Neukum |
541bc3 |
-
|
|
Oliver Neukum |
541bc3 |
ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
|
|
Oliver Neukum |
541bc3 |
ocp_data &= ~NOW_IS_OOB;
|
|
Oliver Neukum |
541bc3 |
ocp_write_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL, ocp_data);
|
|
Oliver Neukum |
541bc3 |
@@ -4378,10 +4350,15 @@ static void r8153_init(struct r8152 *tp)
|
|
Oliver Neukum |
541bc3 |
|
|
Oliver Neukum |
541bc3 |
ocp_write_word(tp, MCU_TYPE_USB, USB_CONNECT_TIMER, 0x0001);
|
|
Oliver Neukum |
541bc3 |
|
|
Oliver Neukum |
541bc3 |
+ /* MAC clock speed down */
|
|
Oliver Neukum |
541bc3 |
+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL, 0);
|
|
Oliver Neukum |
541bc3 |
+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL2, 0);
|
|
Oliver Neukum |
541bc3 |
+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, 0);
|
|
Oliver Neukum |
541bc3 |
+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL4, 0);
|
|
Oliver Neukum |
541bc3 |
+
|
|
Oliver Neukum |
541bc3 |
r8153_power_cut_en(tp, false);
|
|
Oliver Neukum |
541bc3 |
rtl_runtime_suspend_enable(tp, false);
|
|
Oliver Neukum |
541bc3 |
r8153_u1u2en(tp, true);
|
|
Oliver Neukum |
541bc3 |
- r8153_mac_clk_spd(tp, false);
|
|
Oliver Neukum |
541bc3 |
usb_enable_lpm(tp->udev);
|
|
Oliver Neukum |
541bc3 |
|
|
Oliver Neukum |
541bc3 |
ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CONFIG6);
|