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