public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, rmk+kernel@armlinux.org.uk
Subject: Re: [PATCH RFC net-next 2/3] net: phy: read whether PHY supports stopping clock during LPI
Date: Mon, 27 Mar 2017 22:31:40 +0200	[thread overview]
Message-ID: <20170327203140.GG17041@lunn.ch> (raw)
In-Reply-To: <20170327184721.30275-3-f.fainelli@gmail.com>

On Mon, Mar 27, 2017 at 11:47:20AM -0700, Florian Fainelli wrote:
> In order to use phy_init_eee() correctly, in particular the clk_stop
> argument, we need to know whether the Ethernet PHY supports stopping its
> clock.
> 
> Right now, we would have to call phy_init_eee(phydev, 1), see if that
> tails, and call again with phy_init_eee(phydev, 0) to enable EEE this is
> not an acceptable API use.

Hi Florain

I'm having trouble parsing this paragraph. Should tails be fails?  I
think "This is not an acceptable API use." should be a sentence?

> 
> Update phy_init_hw() to read whether the PHY supports this, and retain
> that information in the phydev structure so we can re-use it later.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  drivers/net/phy/phy_device.c | 23 ++++++++++++++++++++++-
>  include/linux/phy.h          |  2 ++
>  2 files changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 1219eeab69d1..2755d77626f7 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -837,6 +837,21 @@ static int phy_poll_reset(struct phy_device *phydev)
>  	return 0;
>  }
>  
> +static void phy_read_clock_stop_capable(struct phy_device *phydev)
> +{
> +	int ret;
> +
> +	/* Read if the PHY supports stopping its clocks (reg 3.1) */
> +	ret = phy_read_mmd_indirect(phydev, MDIO_MMD_PCS, MDIO_STAT1,
> +			            phydev->addr);
> +	if (ret < 0)
> +		return;

It is pretty unusual to ignore a real error. It might be better to
make this an int function, and return the error.

     Andrew

  reply	other threads:[~2017-03-27 20:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27 18:47 [PATCH RFC net-next 0/3] net: phy: Read if PHY can stop its clock Florian Fainelli
2017-03-27 18:47 ` [PATCH RFC net-next 1/3] net: mdio: add definition for MDIO_STAT1_CLOCK_STOP_CAPABLE Florian Fainelli
2017-03-27 18:47 ` [PATCH RFC net-next 2/3] net: phy: read whether PHY supports stopping clock during LPI Florian Fainelli
2017-03-27 20:31   ` Andrew Lunn [this message]
2017-03-27 18:47 ` [PATCH RFC net-next 3/3] net: phy: stop the PHY clock during LPI only if supported Florian Fainelli
2017-03-27 20:38   ` Andrew Lunn

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=20170327203140.GG17041@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    /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