950-0105-lan78xx-Move-enabling-of-EEE-into-PHY-init-code.patch 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. From 76dd9d2f2f32dd5bb720ba6a2a9904ce361d059f Mon Sep 17 00:00:00 2001
  2. From: Phil Elwell <[email protected]>
  3. Date: Thu, 5 Apr 2018 14:46:11 +0100
  4. Subject: [PATCH] lan78xx: Move enabling of EEE into PHY init code
  5. Enable EEE mode as soon as possible after connecting to the PHY, and
  6. before phy_start. This avoids a second link negotiation, which speeds
  7. up booting and stops the interface failing to become ready.
  8. See: https://github.com/raspberrypi/linux/issues/2437
  9. Signed-off-by: Phil Elwell <[email protected]>
  10. ---
  11. drivers/net/usb/lan78xx.c | 32 ++++++++++++++++----------------
  12. 1 file changed, 16 insertions(+), 16 deletions(-)
  13. --- a/drivers/net/usb/lan78xx.c
  14. +++ b/drivers/net/usb/lan78xx.c
  15. @@ -2252,6 +2252,22 @@ static int lan78xx_phy_init(struct lan78
  16. mii_adv_to_linkmode_adv_t(fc, mii_adv);
  17. linkmode_or(phydev->advertising, fc, phydev->advertising);
  18. + if (of_property_read_bool(dev->udev->dev.of_node,
  19. + "microchip,eee-enabled")) {
  20. + struct ethtool_eee edata;
  21. + memset(&edata, 0, sizeof(edata));
  22. + edata.cmd = ETHTOOL_SEEE;
  23. + edata.advertised = ADVERTISED_1000baseT_Full |
  24. + ADVERTISED_100baseT_Full;
  25. + edata.eee_enabled = true;
  26. + edata.tx_lpi_enabled = true;
  27. + if (of_property_read_u32(dev->udev->dev.of_node,
  28. + "microchip,tx-lpi-timer",
  29. + &edata.tx_lpi_timer))
  30. + edata.tx_lpi_timer = 600; /* non-aggressive */
  31. + (void)lan78xx_set_eee(dev->net, &edata);
  32. + }
  33. +
  34. if (phydev->mdio.dev.of_node) {
  35. u32 reg;
  36. int len;
  37. @@ -2944,22 +2960,6 @@ static int lan78xx_open(struct net_devic
  38. netif_dbg(dev, ifup, dev->net, "phy initialised successfully");
  39. - if (of_property_read_bool(dev->udev->dev.of_node,
  40. - "microchip,eee-enabled")) {
  41. - struct ethtool_eee edata;
  42. - memset(&edata, 0, sizeof(edata));
  43. - edata.cmd = ETHTOOL_SEEE;
  44. - edata.advertised = ADVERTISED_1000baseT_Full |
  45. - ADVERTISED_100baseT_Full;
  46. - edata.eee_enabled = true;
  47. - edata.tx_lpi_enabled = true;
  48. - if (of_property_read_u32(dev->udev->dev.of_node,
  49. - "microchip,tx-lpi-timer",
  50. - &edata.tx_lpi_timer))
  51. - edata.tx_lpi_timer = 600; /* non-aggressive */
  52. - (void)lan78xx_set_eee(net, &edata);
  53. - }
  54. -
  55. /* for Link Check */
  56. if (dev->urb_intr) {
  57. ret = usb_submit_urb(dev->urb_intr, GFP_KERNEL);