@@ -26,6 +26,8 @@
#define MII_DP83867_MICR 0x12
#define MII_DP83867_ISR 0x13
#define DP83867_CFG2 0x14
+#define DP83867_LEDCR1 0x18
+#define DP83867_LEDCR2 0x19
#define DP83867_CFG3 0x1e
#define DP83867_CTRL 0x1f
@@ -163,6 +165,8 @@ struct dp83867_private {
u32 rx_fifo_depth;
int io_impedance;
int port_mirroring;
+ u32 led_function;
+ u32 led_ctrl;
bool rxctrl_strap_quirk;
bool set_clk_output;
u32 clk_output_sel;
@@ -583,6 +587,27 @@ static int dp83867_of_init(struct phy_device *phydev)
return -EINVAL;
}
+ ret = of_property_read_u32(of_node, "ti,led-function",
+ &dp83867->led_function);
+ if (ret) {
+ dp83867->led_function = U32_MAX;
+ } else if (dp83867->led_function > U16_MAX) {
+ phydev_err(phydev,
+ "ti,led-function value %x out of range\n",
+ dp83867->led_function);
+ return -EINVAL;
+ }
+
+ ret = of_property_read_u32(of_node, "ti,led-ctrl", &dp83867->led_ctrl);
+ if (ret) {
+ dp83867->led_ctrl = U32_MAX;
+ } else if (dp83867->led_ctrl > U16_MAX) {
+ phydev_err(phydev,
+ "ti,led-ctrl value %x out of range\n",
+ dp83867->led_ctrl);
+ return -EINVAL;
+ }
+
return 0;
}
#else
@@ -788,6 +813,11 @@ static int dp83867_config_init(struct phy_device *phydev)
mask, val);
}
+ if (dp83867->led_function != U32_MAX)
+ phy_write(phydev, DP83867_LEDCR1, dp83867->led_function);
+ if (dp83867->led_ctrl != U32_MAX)
+ phy_write(phydev, DP83867_LEDCR2, dp83867->led_ctrl);
+
return 0;
}
These DT bindings are already in use by the imx7-mba7 DTS, but they were not supported by the PHY driver so far. Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com> --- drivers/net/phy/dp83867.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)