Skip to content

Commit 8efb36d

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 6c9a0f9 commit 8efb36d

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
@@ -2160,6 +2160,22 @@ static int lan78xx_phy_init(struct lan78xx_net *dev)
21602160
mii_adv_to_linkmode_adv_t(fc, mii_adv);
21612161
linkmode_or(phydev->advertising, fc, phydev->advertising);
21622162

2163+
if (of_property_read_bool(dev->udev->dev.of_node,
2164+
"microchip,eee-enabled")) {
2165+
struct ethtool_eee edata;
2166+
memset(&edata, 0, sizeof(edata));
2167+
edata.cmd = ETHTOOL_SEEE;
2168+
edata.advertised = ADVERTISED_1000baseT_Full |
2169+
ADVERTISED_100baseT_Full;
2170+
edata.eee_enabled = true;
2171+
edata.tx_lpi_enabled = true;
2172+
if (of_property_read_u32(dev->udev->dev.of_node,
2173+
"microchip,tx-lpi-timer",
2174+
&edata.tx_lpi_timer))
2175+
edata.tx_lpi_timer = 600; /* non-aggressive */
2176+
(void)lan78xx_set_eee(dev->net, &edata);
2177+
}
2178+
21632179
if (phydev->mdio.dev.of_node) {
21642180
u32 reg;
21652181
int len;
@@ -2633,22 +2649,6 @@ static int lan78xx_open(struct net_device *net)
26332649

26342650
netif_dbg(dev, ifup, dev->net, "phy initialised successfully");
26352651

2636-
if (of_property_read_bool(dev->udev->dev.of_node,
2637-
"microchip,eee-enabled")) {
2638-
struct ethtool_eee edata;
2639-
memset(&edata, 0, sizeof(edata));
2640-
edata.cmd = ETHTOOL_SEEE;
2641-
edata.advertised = ADVERTISED_1000baseT_Full |
2642-
ADVERTISED_100baseT_Full;
2643-
edata.eee_enabled = true;
2644-
edata.tx_lpi_enabled = true;
2645-
if (of_property_read_u32(dev->udev->dev.of_node,
2646-
"microchip,tx-lpi-timer",
2647-
&edata.tx_lpi_timer))
2648-
edata.tx_lpi_timer = 600; /* non-aggressive */
2649-
(void)lan78xx_set_eee(net, &edata);
2650-
}
2651-
26522652
/* for Link Check */
26532653
if (dev->urb_intr) {
26542654
ret = usb_submit_urb(dev->urb_intr, GFP_KERNEL);

0 commit comments

Comments
 (0)