rockchip: sync rtl8211f patch from lede

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen
2024-04-12 15:32:25 +08:00
parent fb89199ac2
commit 80c7834062

View File

@@ -9,7 +9,16 @@ Subject: [PATCH] net: phy: realtek: add LED configuration from OF for 8211f
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -357,6 +357,7 @@ static int rtl8211f_config_init(struct p
@@ -28,6 +28,8 @@
#define RTL821x_EXT_PAGE_SELECT 0x1e
#define RTL821x_PAGE_SELECT 0x1f
+#define RTL8211F_LCR 0x10
+#define RTL8211F_EEELCR 0x11
#define RTL8211F_PHYCR1 0x18
#define RTL8211F_PHYCR2 0x19
#define RTL8211F_INSR 0x1d
@@ -357,6 +359,7 @@ static int rtl8211f_config_init(struct p
struct rtl821x_priv *priv = phydev->priv;
struct device *dev = &phydev->mdio.dev;
u16 val_txdly, val_rxdly;
@@ -17,18 +26,19 @@ Subject: [PATCH] net: phy: realtek: add LED configuration from OF for 8211f
int ret;
ret = phy_modify_paged_changed(phydev, 0xa43, RTL8211F_PHYCR1,
@@ -368,6 +369,14 @@ static int rtl8211f_config_init(struct p
return ret;
@@ -423,6 +426,15 @@ static int rtl8211f_config_init(struct p
val_rxdly ? "enabled" : "disabled");
}
+ ret = of_property_read_u32(dev->of_node,
+ "realtek,led-data", &led_data);
+ if (ret == 0) {
+ if (!ret) {
+ phy_write(phydev, RTL821x_PAGE_SELECT, 0xd04);
+ phy_write(phydev, 0x10, led_data);
+ phy_write(phydev, RTL8211F_LCR, led_data);
+ phy_write(phydev, RTL8211F_EEELCR, 0x0);
+ phy_write(phydev, RTL821x_PAGE_SELECT, 0x0);
+ }
+
switch (phydev->interface) {
case PHY_INTERFACE_MODE_RGMII:
val_txdly = 0;
if (priv->has_phycr2) {
ret = phy_modify_paged(phydev, 0xa43, RTL8211F_PHYCR2,
RTL8211F_CLKOUT_EN, priv->phycr2);