Skip to content

Commit 3e88d27

Browse files
Phil Elwellpopcornmix
Phil Elwell
authored andcommitted
lan78xx: Move enabling of EEE into PHY init code
Enable EEE mode as soon as possible after connecting to the PHY, and before phy_start. This avoids a second link negotiation, which speeds up booting and stops the interface failing to become ready. See: #2437 Signed-off-by: Phil Elwell <[email protected]>
1 parent 9cc5c54 commit 3e88d27

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

drivers/net/usb/lan78xx.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2168,6 +2168,22 @@ static int lan78xx_phy_init(struct lan78xx_net *dev)
21682168
mii_adv_to_linkmode_adv_t(fc, mii_adv);
21692169
linkmode_or(phydev->advertising, fc, phydev->advertising);
21702170

2171+
if (of_property_read_bool(dev->udev->dev.of_node,
2172+
"microchip,eee-enabled")) {
2173+
struct ethtool_eee edata;
2174+
memset(&edata, 0, sizeof(edata));
2175+
edata.cmd = ETHTOOL_SEEE;
2176+
edata.advertised = ADVERTISED_1000baseT_Full |
2177+
ADVERTISED_100baseT_Full;
2178+
edata.eee_enabled = true;
2179+
edata.tx_lpi_enabled = true;
2180+
if (of_property_read_u32(dev->udev->dev.of_node,
2181+
"microchip,tx-lpi-timer",
2182+
&edata.tx_lpi_timer))
2183+
edata.tx_lpi_timer = 600; /* non-aggressive */
2184+
(void)lan78xx_set_eee(dev->net, &edata);
2185+
}
2186+
21712187
if (phydev->mdio.dev.of_node) {
21722188
u32 reg;
21732189
int len;
@@ -2641,22 +2657,6 @@ static int lan78xx_open(struct net_device *net)
26412657

26422658
netif_dbg(dev, ifup, dev->net, "phy initialised successfully");
26432659

2644-
if (of_property_read_bool(dev->udev->dev.of_node,
2645-
"microchip,eee-enabled")) {
2646-
struct ethtool_eee edata;
2647-
memset(&edata, 0, sizeof(edata));
2648-
edata.cmd = ETHTOOL_SEEE;
2649-
edata.advertised = ADVERTISED_1000baseT_Full |
2650-
ADVERTISED_100baseT_Full;
2651-
edata.eee_enabled = true;
2652-
edata.tx_lpi_enabled = true;
2653-
if (of_property_read_u32(dev->udev->dev.of_node,
2654-
"microchip,tx-lpi-timer",
2655-
&edata.tx_lpi_timer))
2656-
edata.tx_lpi_timer = 600; /* non-aggressive */
2657-
(void)lan78xx_set_eee(net, &edata);
2658-
}
2659-
26602660
/* for Link Check */
26612661
if (dev->urb_intr) {
26622662
ret = usb_submit_urb(dev->urb_intr, GFP_KERNEL);

0 commit comments

Comments
 (0)