mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
Split the NanoPi R3S LED patch to make it applicable to more devices
This commit is contained in:
committed by
Rolf Leggewie
parent
76e35eb134
commit
fce02fad25
@@ -1,100 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: John Doe <john.doe@somewhere.on.planet>
|
||||
Date: Tue, 28 Jan 2025 12:13:35 +0800
|
||||
Subject: Patching NanoPi-R3S LEDs
|
||||
|
||||
Signed-off-by: John Doe <john.doe@somewhere.on.planet>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3566-nanopi-r3s.dts | 41 +++++++---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 11 +++
|
||||
drivers/net/phy/realtek.c | 11 +++
|
||||
3 files changed, 53 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
index 8a3959bb2..f8c046a69 100644
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -19,10 +19,11 @@
|
||||
#include <linux/phy.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/ip.h>
|
||||
+#include <linux/of.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/bitfield.h>
|
||||
@@ -2404,10 +2405,19 @@ void r8169_apply_firmware(struct rtl8169_private *tp)
|
||||
!(val & BMCR_RESET),
|
||||
50000, 600000, true);
|
||||
}
|
||||
}
|
||||
|
||||
+static void rtl8168_led_of_init(struct rtl8169_private *tp)
|
||||
+{
|
||||
+ struct device *d = tp_to_dev(tp);
|
||||
+ u32 val;
|
||||
+
|
||||
+ if (!of_property_read_u32(d->of_node, "realtek,ledsel", &val))
|
||||
+ RTL_W16(tp, LED_CTRL, val);
|
||||
+}
|
||||
+
|
||||
static void rtl8168_config_eee_mac(struct rtl8169_private *tp)
|
||||
{
|
||||
/* Adjust EEE LED frequency */
|
||||
if (tp->mac_version != RTL_GIGA_MAC_VER_38)
|
||||
RTL_W8(tp, EEE_LED, RTL_R8(tp, EEE_LED) & ~0x07);
|
||||
@@ -3389,10 +3399,11 @@ static void rtl_hw_start_8168h_1(struct rtl8169_private *tp)
|
||||
|
||||
rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000);
|
||||
rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000);
|
||||
|
||||
rtl8168_config_eee_mac(tp);
|
||||
+ rtl8168_led_of_init(tp);
|
||||
|
||||
RTL_W8(tp, DLLPR, RTL_R8(tp, DLLPR) & ~PFM_EN);
|
||||
RTL_W8(tp, MISC_1, RTL_R8(tp, MISC_1) & ~PFM_D3COLD_EN);
|
||||
|
||||
RTL_W8(tp, DLLPR, RTL_R8(tp, DLLPR) & ~TX_10M_PS_EN);
|
||||
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
|
||||
index f65d7f1f3..f5d831924 100644
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -121,10 +121,19 @@ static int rtl821x_read_page(struct phy_device *phydev)
|
||||
static int rtl821x_write_page(struct phy_device *phydev, int page)
|
||||
{
|
||||
return __phy_write(phydev, RTL821x_PAGE_SELECT, page);
|
||||
}
|
||||
|
||||
+static void rtl821x_led_of_init(struct phy_device *phydev)
|
||||
+{
|
||||
+ struct device *dev = &phydev->mdio.dev;
|
||||
+ u32 val;
|
||||
+
|
||||
+ if (!of_property_read_u32(dev->of_node, "realtek,ledsel", &val))
|
||||
+ phy_write_paged(phydev, 0xd04, 0x10, val);
|
||||
+}
|
||||
+
|
||||
static int rtl821x_probe(struct phy_device *phydev)
|
||||
{
|
||||
struct device *dev = &phydev->mdio.dev;
|
||||
struct rtl821x_priv *priv;
|
||||
u32 phy_id = phydev->drv->phy_id;
|
||||
@@ -440,10 +449,12 @@ static int rtl8211f_config_init(struct phy_device *phydev)
|
||||
dev_dbg(dev,
|
||||
"2ns RX delay was already %s (by pin-strapping RXD0 or bootloader configuration)\n",
|
||||
val_rxdly ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
+ rtl821x_led_of_init(phydev);
|
||||
+
|
||||
if (priv->has_phycr2) {
|
||||
ret = phy_modify_paged(phydev, 0xa43, RTL8211F_PHYCR2,
|
||||
RTL8211F_CLKOUT_EN, priv->phycr2);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "clkout configuration failed: %pe\n",
|
||||
--
|
||||
Created with Armbian build tools https://github.com/armbian/build
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
From 008e546370b9fcb25e44e33ed57d1f7ce25d4cc9 Mon Sep 17 00:00:00 2001
|
||||
From: John Doe <john.doe@somewhere.on.planet>
|
||||
Date: Sat, 30 Aug 2025 14:09:23 +0800
|
||||
Subject: [PATCH 2/2] net: ethernet: realtek: add r8169 LED configuration from
|
||||
OF
|
||||
|
||||
Signed-off-by: retro98boy <retro98boy@qq.com>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
index 5ed2818ba..7d2fba956 100644
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <linux/in.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/ip.h>
|
||||
+#include <linux/of.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
@@ -2377,6 +2378,15 @@ void r8169_apply_firmware(struct rtl8169_private *tp)
|
||||
}
|
||||
}
|
||||
|
||||
+static void rtl8168_led_of_init(struct rtl8169_private *tp)
|
||||
+{
|
||||
+ struct device *d = tp_to_dev(tp);
|
||||
+ u32 val;
|
||||
+
|
||||
+ if (!of_property_read_u32(d->of_node, "realtek,ledsel", &val))
|
||||
+ RTL_W16(tp, LED_CTRL, val);
|
||||
+}
|
||||
+
|
||||
static void rtl8168_config_eee_mac(struct rtl8169_private *tp)
|
||||
{
|
||||
/* Adjust EEE LED frequency */
|
||||
@@ -3421,6 +3431,7 @@ static void rtl_hw_start_8168h_1(struct rtl8169_private *tp)
|
||||
rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000);
|
||||
|
||||
rtl8168_config_eee_mac(tp);
|
||||
+ rtl8168_led_of_init(tp);
|
||||
|
||||
RTL_W8(tp, DLLPR, RTL_R8(tp, DLLPR) & ~PFM_EN);
|
||||
RTL_W8(tp, MISC_1, RTL_R8(tp, MISC_1) & ~PFM_D3COLD_EN);
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
From d743827264d875135da5da331fe2156d48c8ee7c Mon Sep 17 00:00:00 2001
|
||||
From: John Doe <john.doe@somewhere.on.planet>
|
||||
Date: Sat, 30 Aug 2025 14:07:36 +0800
|
||||
Subject: [PATCH 1/2] net: phy: realtek: add rtl8211x LED configuration from OF
|
||||
|
||||
Signed-off-by: retro98boy <retro98boy@qq.com>
|
||||
---
|
||||
drivers/net/phy/realtek.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
|
||||
index 166f6a728..f2a2a907a 100644
|
||||
--- a/drivers/net/phy/realtek.c
|
||||
+++ b/drivers/net/phy/realtek.c
|
||||
@@ -119,6 +119,15 @@ static int rtl821x_write_page(struct phy_device *phydev, int page)
|
||||
return __phy_write(phydev, RTL821x_PAGE_SELECT, page);
|
||||
}
|
||||
|
||||
+static void rtl821x_led_of_init(struct phy_device *phydev)
|
||||
+{
|
||||
+ struct device *dev = &phydev->mdio.dev;
|
||||
+ u32 val;
|
||||
+
|
||||
+ if (!of_property_read_u32(dev->of_node, "realtek,ledsel", &val))
|
||||
+ phy_write_paged(phydev, 0xd04, 0x10, val);
|
||||
+}
|
||||
+
|
||||
static int rtl821x_probe(struct phy_device *phydev)
|
||||
{
|
||||
struct device *dev = &phydev->mdio.dev;
|
||||
@@ -438,6 +447,8 @@ static int rtl8211f_config_init(struct phy_device *phydev)
|
||||
val_rxdly ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
+ rtl821x_led_of_init(phydev);
|
||||
+
|
||||
if (priv->has_phycr2) {
|
||||
ret = phy_modify_paged(phydev, 0xa43, RTL8211F_PHYCR2,
|
||||
RTL8211F_CLKOUT_EN, priv->phycr2);
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From c80bdda0d87a7119152d95f7943212fc8265e104 Mon Sep 17 00:00:00 2001
|
||||
From: John Doe <john.doe@somewhere.on.planet>
|
||||
Date: Tue, 28 Jan 2025 12:13:35 +0800
|
||||
Subject: Patching NanoPi-R3S LEDs
|
||||
Date: Sat, 30 Aug 2025 14:20:24 +0800
|
||||
Subject: [PATCH 1/3] Patching NanoPi-R3S LEDs
|
||||
|
||||
Signed-off-by: John Doe <john.doe@somewhere.on.planet>
|
||||
Signed-off-by: retro98boy <retro98boy@qq.com>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3566-nanopi-r3s.dts | 41 +++++++---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 11 +++
|
||||
drivers/net/phy/realtek/realtek_main.c | 11 +++
|
||||
3 files changed, 53 insertions(+), 10 deletions(-)
|
||||
.../boot/dts/rockchip/rk3566-nanopi-r3s.dts | 41 ++++++++++++++-----
|
||||
1 file changed, 31 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3566-nanopi-r3s.dts b/arch/arm64/boot/dts/rockchip/rk3566-nanopi-r3s.dts
|
||||
index 111111111111..222222222222 100644
|
||||
index fb1f65c86..553a9e599 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3566-nanopi-r3s.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3566-nanopi-r3s.dts
|
||||
@@ -52,19 +52,21 @@ power_led: led-0 {
|
||||
@@ -111,71 +109,6 @@ index 111111111111..222222222222 100644
|
||||
};
|
||||
};
|
||||
|
||||
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
index 111111111111..222222222222 100644
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <linux/in.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/ip.h>
|
||||
+#include <linux/of.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
@@ -2375,6 +2376,15 @@ void r8169_apply_firmware(struct rtl8169_private *tp)
|
||||
}
|
||||
}
|
||||
|
||||
+static void rtl8168_led_of_init(struct rtl8169_private *tp)
|
||||
+{
|
||||
+ struct device *d = tp_to_dev(tp);
|
||||
+ u32 val;
|
||||
+
|
||||
+ if (!of_property_read_u32(d->of_node, "realtek,ledsel", &val))
|
||||
+ RTL_W16(tp, LED_CTRL, val);
|
||||
+}
|
||||
+
|
||||
static void rtl8168_config_eee_mac(struct rtl8169_private *tp)
|
||||
{
|
||||
/* Adjust EEE LED frequency */
|
||||
@@ -3392,6 +3402,7 @@ static void rtl_hw_start_8168h_1(struct rtl8169_private *tp)
|
||||
rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000);
|
||||
|
||||
rtl8168_config_eee_mac(tp);
|
||||
+ rtl8168_led_of_init(tp);
|
||||
|
||||
RTL_W8(tp, DLLPR, RTL_R8(tp, DLLPR) & ~PFM_EN);
|
||||
RTL_W8(tp, MISC_1, RTL_R8(tp, MISC_1) & ~PFM_D3COLD_EN);
|
||||
diff --git a/drivers/net/phy/realtek/realtek_main.c b/drivers/net/phy/realtek/realtek_main.c
|
||||
index 111111111111..222222222222 100644
|
||||
--- a/drivers/net/phy/realtek/realtek_main.c
|
||||
+++ b/drivers/net/phy/realtek/realtek_main.c
|
||||
@@ -215,6 +215,15 @@ static int rtl821x_modify_ext_page(struct phy_device *phydev, u16 ext_page,
|
||||
return phy_restore_page(phydev, oldpage, ret);
|
||||
}
|
||||
|
||||
+static void rtl821x_led_of_init(struct phy_device *phydev)
|
||||
+{
|
||||
+ struct device *dev = &phydev->mdio.dev;
|
||||
+ u32 val;
|
||||
+
|
||||
+ if (!of_property_read_u32(dev->of_node, "realtek,ledsel", &val))
|
||||
+ phy_write_paged(phydev, 0xd04, 0x10, val);
|
||||
+}
|
||||
+
|
||||
static int rtl821x_probe(struct phy_device *phydev)
|
||||
{
|
||||
struct device *dev = &phydev->mdio.dev;
|
||||
@@ -589,6 +598,8 @@ static int rtl8211f_config_init(struct phy_device *phydev)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
+ rtl821x_led_of_init(phydev);
|
||||
+
|
||||
if (priv->has_phycr2) {
|
||||
ret = phy_modify_paged(phydev, RTL8211F_PHYCR_PAGE,
|
||||
RTL8211F_PHYCR2, RTL8211F_CLKOUT_EN,
|
||||
--
|
||||
Armbian
|
||||
2.51.0
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
From cde62ca7cdeeba96ca67bb02f40cbfce61515cd8 Mon Sep 17 00:00:00 2001
|
||||
From: John Doe <john.doe@somewhere.on.planet>
|
||||
Date: Sat, 30 Aug 2025 14:20:46 +0800
|
||||
Subject: [PATCH 2/3] net: ethernet: realtek: add r8169 LED configuration from
|
||||
OF
|
||||
|
||||
Signed-off-by: retro98boy <retro98boy@qq.com>
|
||||
---
|
||||
drivers/net/ethernet/realtek/r8169_main.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
index 43170500d..973934934 100644
|
||||
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <linux/in.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/ip.h>
|
||||
+#include <linux/of.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
@@ -2375,6 +2376,15 @@ void r8169_apply_firmware(struct rtl8169_private *tp)
|
||||
}
|
||||
}
|
||||
|
||||
+static void rtl8168_led_of_init(struct rtl8169_private *tp)
|
||||
+{
|
||||
+ struct device *d = tp_to_dev(tp);
|
||||
+ u32 val;
|
||||
+
|
||||
+ if (!of_property_read_u32(d->of_node, "realtek,ledsel", &val))
|
||||
+ RTL_W16(tp, LED_CTRL, val);
|
||||
+}
|
||||
+
|
||||
static void rtl8168_config_eee_mac(struct rtl8169_private *tp)
|
||||
{
|
||||
/* Adjust EEE LED frequency */
|
||||
@@ -3392,6 +3402,7 @@ static void rtl_hw_start_8168h_1(struct rtl8169_private *tp)
|
||||
rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000);
|
||||
|
||||
rtl8168_config_eee_mac(tp);
|
||||
+ rtl8168_led_of_init(tp);
|
||||
|
||||
RTL_W8(tp, DLLPR, RTL_R8(tp, DLLPR) & ~PFM_EN);
|
||||
RTL_W8(tp, MISC_1, RTL_R8(tp, MISC_1) & ~PFM_D3COLD_EN);
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
From cf497ba4b9e7986f5f7ce6466dc960f964a0719b Mon Sep 17 00:00:00 2001
|
||||
From: John Doe <john.doe@somewhere.on.planet>
|
||||
Date: Sat, 30 Aug 2025 14:20:58 +0800
|
||||
Subject: [PATCH 3/3] net: phy: realtek: add rtl8211x LED configuration from OF
|
||||
|
||||
Signed-off-by: retro98boy <retro98boy@qq.com>
|
||||
---
|
||||
drivers/net/phy/realtek/realtek_main.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/phy/realtek/realtek_main.c b/drivers/net/phy/realtek/realtek_main.c
|
||||
index dd0d67514..4743f99b3 100644
|
||||
--- a/drivers/net/phy/realtek/realtek_main.c
|
||||
+++ b/drivers/net/phy/realtek/realtek_main.c
|
||||
@@ -215,6 +215,15 @@ static int rtl821x_modify_ext_page(struct phy_device *phydev, u16 ext_page,
|
||||
return phy_restore_page(phydev, oldpage, ret);
|
||||
}
|
||||
|
||||
+static void rtl821x_led_of_init(struct phy_device *phydev)
|
||||
+{
|
||||
+ struct device *dev = &phydev->mdio.dev;
|
||||
+ u32 val;
|
||||
+
|
||||
+ if (!of_property_read_u32(dev->of_node, "realtek,ledsel", &val))
|
||||
+ phy_write_paged(phydev, 0xd04, 0x10, val);
|
||||
+}
|
||||
+
|
||||
static int rtl821x_probe(struct phy_device *phydev)
|
||||
{
|
||||
struct device *dev = &phydev->mdio.dev;
|
||||
@@ -595,6 +604,8 @@ static int rtl8211f_config_init(struct phy_device *phydev)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
+ rtl821x_led_of_init(phydev);
|
||||
+
|
||||
if (priv->has_phycr2) {
|
||||
ret = phy_modify_paged(phydev, RTL8211F_PHYCR_PAGE,
|
||||
RTL8211F_PHYCR2, RTL8211F_CLKOUT_EN,
|
||||
--
|
||||
2.51.0
|
||||
|
||||
Reference in New Issue
Block a user