kernel: drop motorcomm phy LED hack

Now we have switched to upstream implementation, this hack can go.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen
2025-10-29 20:11:36 +08:00
parent d8d91416fc
commit fa7ec775c1
2 changed files with 0 additions and 126 deletions
@@ -1,63 +0,0 @@
--- a/drivers/net/phy/motorcomm.c
+++ b/drivers/net/phy/motorcomm.c
@@ -242,6 +242,12 @@
#define YTPHY_WCR_INTR_SEL BIT(6)
#define YTPHY_WCR_ENABLE BIT(3)
+#define YTPHY_LED_NUM_CONFIG 5
+/* LED_GENERAL_CFG: 0xA00B, LED0_CFG: 0xA00C, LED1_CFG: 0xA00D
+ * LED2_CFG: 0xA00E, LED_BLINK_CFG: 0xA00F
+ */
+#define YTPHY_LED_CONFIG_REG(x) (0xA00B + x)
+
/* 2b00 84ms
* 2b01 168ms *default*
* 2b10 336ms
@@ -1654,6 +1660,27 @@ static int yt8521_resume(struct phy_devi
return yt8521_modify_utp_fiber_bmcr(phydev, BMCR_PDOWN, 0);
}
+static int ytphy_config_led(struct phy_device *phydev)
+{
+ struct device_node *node = phydev->mdio.dev.of_node;
+ u32 led_data[YTPHY_LED_NUM_CONFIG];
+ int ret;
+
+ ret = of_property_read_u32_array(node, "motorcomm,led-data",
+ led_data, YTPHY_LED_NUM_CONFIG);
+ if (ret)
+ return 0;
+
+ for (int i = 0; i < YTPHY_LED_NUM_CONFIG; i++) {
+ ret = ytphy_write_ext(phydev, YTPHY_LED_CONFIG_REG(i),
+ led_data[i]);
+ if (ret < 0)
+ return ret;
+ }
+
+ return 0;
+}
+
/**
* yt8521_config_init() - called to initialize the PHY
* @phydev: a pointer to a &struct phy_device
@@ -1692,6 +1719,10 @@ static int yt8521_config_init(struct phy
if (ret < 0)
goto err_restore_page;
}
+
+ ret = ytphy_config_led(phydev);
+ if (ret < 0)
+ goto err_restore_page;
err_restore_page:
return phy_restore_page(phydev, old_page, ret);
}
@@ -1827,7 +1858,7 @@ static int yt8531_config_init(struct phy
if (ret < 0)
return ret;
- return 0;
+ return ytphy_config_led(phydev);
}
/**
@@ -1,63 +0,0 @@
--- a/drivers/net/phy/motorcomm.c
+++ b/drivers/net/phy/motorcomm.c
@@ -242,6 +242,12 @@
#define YTPHY_WCR_INTR_SEL BIT(6)
#define YTPHY_WCR_ENABLE BIT(3)
+#define YTPHY_LED_NUM_CONFIG 5
+/* LED_GENERAL_CFG: 0xA00B, LED0_CFG: 0xA00C, LED1_CFG: 0xA00D
+ * LED2_CFG: 0xA00E, LED_BLINK_CFG: 0xA00F
+ */
+#define YTPHY_LED_CONFIG_REG(x) (0xA00B + x)
+
/* 2b00 84ms
* 2b01 168ms *default*
* 2b10 336ms
@@ -1578,6 +1584,27 @@ static int yt8521_resume(struct phy_devi
return yt8521_modify_utp_fiber_bmcr(phydev, BMCR_PDOWN, 0);
}
+static int ytphy_config_led(struct phy_device *phydev)
+{
+ struct device_node *node = phydev->mdio.dev.of_node;
+ u32 led_data[YTPHY_LED_NUM_CONFIG];
+ int ret;
+
+ ret = of_property_read_u32_array(node, "motorcomm,led-data",
+ led_data, YTPHY_LED_NUM_CONFIG);
+ if (ret)
+ return 0;
+
+ for (int i = 0; i < YTPHY_LED_NUM_CONFIG; i++) {
+ ret = ytphy_write_ext(phydev, YTPHY_LED_CONFIG_REG(i),
+ led_data[i]);
+ if (ret < 0)
+ return ret;
+ }
+
+ return 0;
+}
+
/**
* yt8521_config_init() - called to initialize the PHY
* @phydev: a pointer to a &struct phy_device
@@ -1616,6 +1643,10 @@ static int yt8521_config_init(struct phy
if (ret < 0)
goto err_restore_page;
}
+
+ ret = ytphy_config_led(phydev);
+ if (ret < 0)
+ goto err_restore_page;
err_restore_page:
return phy_restore_page(phydev, old_page, ret);
}
@@ -1751,7 +1782,7 @@ static int yt8531_config_init(struct phy
if (ret < 0)
return ret;
- return 0;
+ return ytphy_config_led(phydev);
}
/**