2023-02-21 15:47:40 +08:00
|
|
|
--- a/drivers/net/phy/motorcomm.c
|
|
|
|
|
+++ b/drivers/net/phy/motorcomm.c
|
2023-11-15 20:24:16 +08:00
|
|
|
@@ -224,6 +224,12 @@
|
2023-08-23 17:24:07 +08:00
|
|
|
#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
|
2023-11-15 20:24:16 +08:00
|
|
|
@@ -1459,6 +1465,7 @@ static int yt8521_resume(struct phy_devi
|
2023-08-23 17:24:07 +08:00
|
|
|
static int yt8521_config_init(struct phy_device *phydev)
|
|
|
|
|
{
|
|
|
|
|
struct device_node *node = phydev->mdio.dev.of_node;
|
|
|
|
|
+ u32 led_data[YTPHY_LED_NUM_CONFIG];
|
|
|
|
|
int old_page;
|
|
|
|
|
int ret = 0;
|
|
|
|
|
|
2023-11-15 20:24:16 +08:00
|
|
|
@@ -1488,6 +1495,16 @@ static int yt8521_config_init(struct phy
|
2023-02-21 15:47:40 +08:00
|
|
|
if (ret < 0)
|
|
|
|
|
goto err_restore_page;
|
|
|
|
|
}
|
|
|
|
|
+
|
2023-08-23 17:24:07 +08:00
|
|
|
+ if (!of_property_read_u32_array(node, "motorcomm,led-data",
|
|
|
|
|
+ led_data, YTPHY_LED_NUM_CONFIG)) {
|
|
|
|
|
+ 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)
|
|
|
|
|
+ goto err_restore_page;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
2023-02-21 15:47:40 +08:00
|
|
|
err_restore_page:
|
|
|
|
|
return phy_restore_page(phydev, old_page, ret);
|
|
|
|
|
}
|
2023-11-15 20:24:16 +08:00
|
|
|
@@ -1495,6 +1512,7 @@ err_restore_page:
|
|
|
|
|
static int yt8531_config_init(struct phy_device *phydev)
|
|
|
|
|
{
|
|
|
|
|
struct device_node *node = phydev->mdio.dev.of_node;
|
|
|
|
|
+ u32 led_data[YTPHY_LED_NUM_CONFIG];
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
ret = ytphy_rgmii_clk_delay_config_with_lock(phydev);
|
|
|
|
|
@@ -1519,6 +1537,16 @@ static int yt8531_config_init(struct phy
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (!of_property_read_u32_array(node, "motorcomm,led-data",
|
|
|
|
|
+ led_data, YTPHY_LED_NUM_CONFIG)) {
|
|
|
|
|
+ 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;
|
|
|
|
|
}
|
|
|
|
|
|