lan78xx: Read initial EEE status from DT

Add two new DT properties:
* microchip,eee-enabled  - a boolean to enable EEE
* microchip,tx-lpi-timer - time in microseconds to wait before entering
                           low power state

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
This commit is contained in:
Phil Elwell
2024-06-11 16:44:07 +01:00
committed by Dom Cobley
parent 3efecfb9e2
commit 9fcadf1424

View File

@@ -2900,6 +2900,27 @@ static int lan78xx_phy_init(struct lan78xx_net *dev)
goto phylink_uninit;
}
if (of_property_read_bool(phydev->mdio.dev.of_node,
"microchip,eee-enabled")) {
struct ethtool_keee edata;
memset(&edata, 0, sizeof(edata));
linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
edata.advertised);
linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT,
edata.advertised);
edata.eee_enabled = true;
edata.tx_lpi_enabled = true;
if (of_property_read_u32(phydev->mdio.dev.of_node,
"microchip,tx-lpi-timer",
&edata.tx_lpi_timer))
edata.tx_lpi_timer = 600; /* non-aggressive */
(void)lan78xx_set_eee(dev->net, &edata);
phy_support_eee(phydev);
}
ret = lan78xx_configure_leds_from_dt(dev, phydev);
if (ret < 0)
goto phylink_uninit;