aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.10/950-0551-r8152-spilt-rtl_set_eee_plus-and-r8153b_green_en.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/bcm27xx/patches-5.10/950-0551-r8152-spilt-rtl_set_eee_plus-and-r8153b_green_en.patch')
-rw-r--r--target/linux/bcm27xx/patches-5.10/950-0551-r8152-spilt-rtl_set_eee_plus-and-r8153b_green_en.patch89
1 files changed, 89 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-5.10/950-0551-r8152-spilt-rtl_set_eee_plus-and-r8153b_green_en.patch b/target/linux/bcm27xx/patches-5.10/950-0551-r8152-spilt-rtl_set_eee_plus-and-r8153b_green_en.patch
new file mode 100644
index 0000000000..0467e06a3c
--- /dev/null
+++ b/target/linux/bcm27xx/patches-5.10/950-0551-r8152-spilt-rtl_set_eee_plus-and-r8153b_green_en.patch
@@ -0,0 +1,89 @@
+From 260814de2d6cb958767785ffcb2e76915d1be32b Mon Sep 17 00:00:00 2001
+From: Hayes Wang <hayeswang@realtek.com>
+Date: Fri, 19 Feb 2021 17:04:43 +0800
+Subject: [PATCH] r8152: spilt rtl_set_eee_plus and r8153b_green_en
+
+commit 40fa7568ac230446d888b7ad402cff9e20fe3ad5 upstream.
+
+Add rtl_eee_plus_en() and rtl_green_en().
+
+Signed-off-by: Hayes Wang <hayeswang@realtek.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+---
+ drivers/net/usb/r8152.c | 43 ++++++++++++++++++++++++++---------------
+ 1 file changed, 27 insertions(+), 16 deletions(-)
+
+--- a/drivers/net/usb/r8152.c
++++ b/drivers/net/usb/r8152.c
+@@ -2632,21 +2632,24 @@ static inline u8 rtl8152_get_speed(struc
+ return ocp_read_byte(tp, MCU_TYPE_PLA, PLA_PHYSTATUS);
+ }
+
+-static void rtl_set_eee_plus(struct r8152 *tp)
++static void rtl_eee_plus_en(struct r8152 *tp, bool enable)
+ {
+ u32 ocp_data;
+- u8 speed;
+
+- speed = rtl8152_get_speed(tp);
+- if (speed & _10bps) {
+- ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_EEEP_CR);
++ ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_EEEP_CR);
++ if (enable)
+ ocp_data |= EEEP_CR_EEEP_TX;
+- ocp_write_word(tp, MCU_TYPE_PLA, PLA_EEEP_CR, ocp_data);
+- } else {
+- ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_EEEP_CR);
++ else
+ ocp_data &= ~EEEP_CR_EEEP_TX;
+- ocp_write_word(tp, MCU_TYPE_PLA, PLA_EEEP_CR, ocp_data);
+- }
++ ocp_write_word(tp, MCU_TYPE_PLA, PLA_EEEP_CR, ocp_data);
++}
++
++static void rtl_set_eee_plus(struct r8152 *tp)
++{
++ if (rtl8152_get_speed(tp) & _10bps)
++ rtl_eee_plus_en(tp, true);
++ else
++ rtl_eee_plus_en(tp, false);
+ }
+
+ static void rxdy_gated_en(struct r8152 *tp, bool enable)
+@@ -3127,10 +3130,22 @@ static void r8153b_ups_flags(struct r815
+ ocp_write_dword(tp, MCU_TYPE_USB, USB_UPS_FLAGS, ups_flags);
+ }
+
+-static void r8153b_green_en(struct r8152 *tp, bool enable)
++static void rtl_green_en(struct r8152 *tp, bool enable)
+ {
+ u16 data;
+
++ data = sram_read(tp, SRAM_GREEN_CFG);
++ if (enable)
++ data |= GREEN_ETH_EN;
++ else
++ data &= ~GREEN_ETH_EN;
++ sram_write(tp, SRAM_GREEN_CFG, data);
++
++ tp->ups_info.green = enable;
++}
++
++static void r8153b_green_en(struct r8152 *tp, bool enable)
++{
+ if (enable) {
+ sram_write(tp, 0x8045, 0); /* 10M abiq&ldvbias */
+ sram_write(tp, 0x804d, 0x1222); /* 100M short abiq&ldvbias */
+@@ -3141,11 +3156,7 @@ static void r8153b_green_en(struct r8152
+ sram_write(tp, 0x805d, 0x2444); /* 1000M short abiq&ldvbias */
+ }
+
+- data = sram_read(tp, SRAM_GREEN_CFG);
+- data |= GREEN_ETH_EN;
+- sram_write(tp, SRAM_GREEN_CFG, data);
+-
+- tp->ups_info.green = enable;
++ rtl_green_en(tp, true);
+ }
+
+ static u16 r8153_phy_status(struct r8152 *tp, u16 desired)