kernel: refresh realtek phyled hacks

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2024-08-03 12:49:32 +08:00
parent 80c7e3c141
commit 7e94fcb899
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
2 changed files with 13 additions and 13 deletions

View File

@ -18,7 +18,7 @@ Signed-off-by: Yangyu Chen <cyy@cyyself.name>
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -66,6 +66,11 @@
@@ -77,6 +77,11 @@
#define RTL8221B_PHYCR1_ALDPS_EN BIT(2)
#define RTL8221B_PHYCR1_ALDPS_XTAL_OFF_EN BIT(12)
@ -30,8 +30,8 @@ Signed-off-by: Yangyu Chen <cyy@cyyself.name>
#define RTL8366RB_POWER_SAVE 0x15
#define RTL8366RB_POWER_SAVE_ON BIT(12)
@@ -921,6 +926,39 @@ static irqreturn_t rtl9000a_handle_inter
return IRQ_HANDLED;
@@ -683,6 +688,39 @@ static int rtl822x_write_mmd(struct phy_
return ret;
}
+static int rtl8221b_config_led(struct phy_device *phydev) {
@ -47,7 +47,7 @@ Signed-off-by: Yangyu Chen <cyy@cyyself.name>
+ return 0;
+
+ for (i = 0; i < RTL8221B_NR_LEDS; i++) {
+ val = phy_write_mmd(phydev, RTL8221B_MMD_PHY_CTRL,
+ val = phy_write_mmd(phydev, MDIO_MMD_VEND2,
+ RTL8221B_LED_LINK_SELECT + i * RTL8221B_LED_LINK_SELECT_OFFSET,
+ link_select[i]);
+ if (val < 0)
@ -59,7 +59,7 @@ Signed-off-by: Yangyu Chen <cyy@cyyself.name>
+ if (val)
+ return 0;
+
+ val = phy_write_mmd(phydev, RTL8221B_MMD_PHY_CTRL,
+ val = phy_write_mmd(phydev, MDIO_MMD_VEND2,
+ RTL8221B_LED_ACT_SELECT, act_select);
+ if (val < 0)
+ return val;
@ -67,15 +67,15 @@ Signed-off-by: Yangyu Chen <cyy@cyyself.name>
+ return 0;
+}
+
static int rtl8221b_config_init(struct phy_device *phydev)
static int rtl822xb_config_init(struct phy_device *phydev)
{
u16 option_mode;
@@ -968,7 +1006,7 @@ static int rtl8221b_config_init(struct p
phy_read_mmd_poll_timeout(phydev, RTL8221B_MMD_SERDES_CTRL, 0x7587,
val, !(val & BIT(0)), 500, 100000, false);
bool has_2500, has_sgmii;
@@ -759,7 +797,7 @@ static int rtl822xb_config_init(struct p
if (ret < 0)
return ret;
- return 0;
+ return rtl8221b_config_led(phydev);
}
static int rtl8221b_ack_interrupt(struct phy_device *phydev)
static int rtl822xb_get_rate_matching(struct phy_device *phydev,

View File

@ -18,7 +18,7 @@ Subject: [PATCH] net: phy: realtek: add LED configuration from OF for 8211f
#define RTL8211F_PHYCR1 0x18
#define RTL8211F_PHYCR2 0x19
#define RTL8211F_INSR 0x1d
@@ -357,6 +359,7 @@ static int rtl8211f_config_init(struct p
@@ -365,6 +367,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;
@ -26,7 +26,7 @@ Subject: [PATCH] net: phy: realtek: add LED configuration from OF for 8211f
int ret;
ret = phy_modify_paged_changed(phydev, 0xa43, RTL8211F_PHYCR1,
@@ -423,6 +426,15 @@ static int rtl8211f_config_init(struct p
@@ -431,6 +434,15 @@ static int rtl8211f_config_init(struct p
val_rxdly ? "enabled" : "disabled");
}