950-0098-lan78xx-Read-initial-EEE-status-from-DT.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. From b9c6cbcc647c0a228dee8c7919aefc22883751a3 Mon Sep 17 00:00:00 2001
  2. From: Phil Elwell <[email protected]>
  3. Date: Fri, 9 Mar 2018 12:01:00 +0000
  4. Subject: [PATCH] lan78xx: Read initial EEE status from DT
  5. Add two new DT properties:
  6. * microchip,eee-enabled - a boolean to enable EEE
  7. * microchip,tx-lpi-timer - time in microseconds to wait before entering
  8. low power state
  9. Signed-off-by: Phil Elwell <[email protected]>
  10. ---
  11. drivers/net/usb/lan78xx.c | 16 ++++++++++++++++
  12. 1 file changed, 16 insertions(+)
  13. --- a/drivers/net/usb/lan78xx.c
  14. +++ b/drivers/net/usb/lan78xx.c
  15. @@ -2935,6 +2935,22 @@ static int lan78xx_open(struct net_devic
  16. netif_dbg(dev, ifup, dev->net, "phy initialised successfully");
  17. + if (of_property_read_bool(dev->udev->dev.of_node,
  18. + "microchip,eee-enabled")) {
  19. + struct ethtool_eee edata;
  20. + memset(&edata, 0, sizeof(edata));
  21. + edata.cmd = ETHTOOL_SEEE;
  22. + edata.advertised = ADVERTISED_1000baseT_Full |
  23. + ADVERTISED_100baseT_Full;
  24. + edata.eee_enabled = true;
  25. + edata.tx_lpi_enabled = true;
  26. + if (of_property_read_u32(dev->udev->dev.of_node,
  27. + "microchip,tx-lpi-timer",
  28. + &edata.tx_lpi_timer))
  29. + edata.tx_lpi_timer = 600; /* non-aggressive */
  30. + (void)lan78xx_set_eee(net, &edata);
  31. + }
  32. +
  33. /* for Link Check */
  34. if (dev->urb_intr) {
  35. ret = usb_submit_urb(dev->urb_intr, GFP_KERNEL);