Skip to content

Commit 88eb18c

Browse files
pelwellpopcornmix
authored andcommitted
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> lan78xx: Fix boot-time RTNL warning lan78xx_set_eee calls phylink_ethtool_set_eee, which WARNs if rtnl_lock has not been called. This is fine when called via the ethtool_ops .set_eee entry point, presumably because the lock is already held, but lan78xx_probe also calls lan78xx_set_eee via lan78xx_phy_init, which requires an explicit rtnl_lock/unlock pair to avoid the warning. Signed-off-by: Phil Elwell <phil@raspberrypi.com>
1 parent d7a1a14 commit 88eb18c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/net/usb/lan78xx.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2900,6 +2900,29 @@ static int lan78xx_phy_init(struct lan78xx_net *dev)
29002900
goto phylink_uninit;
29012901
}
29022902

2903+
if (of_property_read_bool(phydev->mdio.dev.of_node,
2904+
"microchip,eee-enabled")) {
2905+
struct ethtool_keee edata;
2906+
memset(&edata, 0, sizeof(edata));
2907+
2908+
linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
2909+
edata.advertised);
2910+
linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT,
2911+
edata.advertised);
2912+
2913+
edata.eee_enabled = true;
2914+
edata.tx_lpi_enabled = true;
2915+
if (of_property_read_u32(phydev->mdio.dev.of_node,
2916+
"microchip,tx-lpi-timer",
2917+
&edata.tx_lpi_timer))
2918+
edata.tx_lpi_timer = 600; /* non-aggressive */
2919+
rtnl_lock();
2920+
(void)lan78xx_set_eee(dev->net, &edata);
2921+
rtnl_unlock();
2922+
2923+
phy_support_eee(phydev);
2924+
}
2925+
29032926
ret = lan78xx_configure_leds_from_dt(dev, phydev);
29042927
if (ret < 0)
29052928
goto phylink_uninit;

0 commit comments

Comments
 (0)