netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Bryan Whitehead <Bryan.Whitehead@microchip.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	UNGLinuxDriver@microchip.com, richardcochran@gmail.com
Subject: Re: [PATCH v2 net-next 7/9] lan743x: Add EEE support
Date: Fri, 13 Jul 2018 00:49:05 +0200	[thread overview]
Message-ID: <20180712224905.GJ18328@lunn.ch> (raw)
In-Reply-To: <1531422306-6547-8-git-send-email-Bryan.Whitehead@microchip.com>

> +static int lan743x_ethtool_set_eee(struct net_device *netdev,
> +				   struct ethtool_eee *eee)
> +{
> +	struct lan743x_adapter *adapter = netdev_priv(netdev);
> +	struct phy_device *phydev = NULL;
> +	u32 buf = 0;
> +	int ret = 0;
> +
> +	if (!netdev)
> +		return -EINVAL;
> +	adapter = netdev_priv(netdev);
> +	if (!adapter)
> +		return -EINVAL;
> +	phydev = netdev->phydev;
> +	if (!phydev)
> +		return -EIO;
> +	if (!phydev->drv) {
> +		netif_err(adapter, drv, adapter->netdev,
> +			  "Missing PHY Driver\n");
> +		return -EIO;
> +	}
> +
> +	if (eee->eee_enabled) {
> +		ret = phy_init_eee(phydev, 0);
> +		if (ret) {
> +			netif_err(adapter, drv, adapter->netdev,
> +				  "EEE initialization failed\n");
> +			return ret;
> +		}
> +
> +		buf = lan743x_csr_read(adapter, MAC_CR);
> +		buf |= MAC_CR_EEE_EN_;
> +		lan743x_csr_write(adapter, MAC_CR, buf);
> +
> +		phy_ethtool_set_eee(phydev, eee);
> +
> +		buf = (u32)eee->tx_lpi_timer;
> +		lan743x_csr_write(adapter, MAC_EEE_TX_LPI_REQ_DLY_CNT, buf);
> +		netif_info(adapter, drv, adapter->netdev, "Enabled EEE\n");
> +	} else {
> +		buf = lan743x_csr_read(adapter, MAC_CR);
> +		buf &= ~MAC_CR_EEE_EN_;
> +		lan743x_csr_write(adapter, MAC_CR, buf);
> +		netif_info(adapter, drv, adapter->netdev, "Disabled EEE\n");
> +	}
> +

Hi Bryan

You should call phy_ethtool_set_eee() in both cases, so that it gets
disabled in the PHY as well. It needs to stop advertising it.

       Andrew

  reply	other threads:[~2018-07-12 23:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-12 19:04 [PATCH v2 net-next 0/9] lan743x: Add features to lan743x driver Bryan Whitehead
2018-07-12 19:04 ` [PATCH v2 net-next 1/9] lan743x: Add support for ethtool get_drvinfo Bryan Whitehead
2018-07-12 22:28   ` Andrew Lunn
2018-07-12 19:04 ` [PATCH v2 net-next 2/9] lan743x: Add support for ethtool link settings Bryan Whitehead
2018-07-12 22:29   ` Andrew Lunn
2018-07-12 19:05 ` [PATCH v2 net-next 3/9] lan743x: Add support for ethtool statistics Bryan Whitehead
2018-07-12 22:31   ` Andrew Lunn
2018-07-12 19:05 ` [PATCH v2 net-next 4/9] lan743x: Add support for ethtool message level Bryan Whitehead
2018-07-12 22:31   ` Andrew Lunn
2018-07-12 19:05 ` [PATCH v2 net-next 5/9] lan743x: Add support for ethtool eeprom access Bryan Whitehead
2018-07-12 22:35   ` Andrew Lunn
2018-07-12 19:05 ` [PATCH v2 net-next 6/9] lan743x: Add power management support Bryan Whitehead
2018-07-12 22:42   ` Andrew Lunn
2018-07-18 20:05     ` Bryan.Whitehead
2018-07-12 19:05 ` [PATCH v2 net-next 7/9] lan743x: Add EEE support Bryan Whitehead
2018-07-12 22:49   ` Andrew Lunn [this message]
2018-07-13 16:35     ` Bryan.Whitehead
2018-07-12 19:05 ` [PATCH v2 net-next 8/9] lan743x: Add RSS support Bryan Whitehead
2018-07-12 19:05 ` [PATCH v2 net-next 9/9] lan743x: Add PTP support Bryan Whitehead
2018-07-13  3:31   ` Richard Cochran
2018-07-18 20:04     ` Bryan.Whitehead
2018-07-18 20:55       ` Richard Cochran
2018-07-18 21:05         ` Bryan.Whitehead

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180712224905.GJ18328@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Bryan.Whitehead@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).