Netdev List
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
Cc: <netdev@vger.kernel.org>, <eric.dumazet@gmail.com>,
	<rayagond@vayavyalabs.com>, <davem@davemloft.net>,
	<yuvalmin@broadcom.com>
Subject: Re: [net-next.git 4/4 (v7)] phy: add the EEE support and the way to access to the MMD registers.
Date: Wed, 20 Jun 2012 18:22:20 +0100	[thread overview]
Message-ID: <1340212940.2576.2.camel@bwh-desktop.uk.solarflarecom.com> (raw)
In-Reply-To: <1340172774-27443-5-git-send-email-peppe.cavallaro@st.com>

On Wed, 2012-06-20 at 08:12 +0200, Giuseppe CAVALLARO wrote:
[...]
> +int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
> +{
> +	int ret = -EPROTONOSUPPORT;
> +
> +	/* According to 802.3az,the EEE is supported only in full duplex-mode.
> +	 * Also EEE feature is active when core is operating with MII, GMII
> +	 * or RGMII.
> +	 */
> +	if ((phydev->duplex == DUPLEX_FULL) &&
> +	    ((phydev->interface == PHY_INTERFACE_MODE_MII) ||
> +	    (phydev->interface == PHY_INTERFACE_MODE_GMII) ||
> +	    (phydev->interface == PHY_INTERFACE_MODE_RGMII))) {
> +		u16 eee_lp, eee_cap, eee_adv;
> +		u32 lp, cap, adv;
> +		int idx;
> +
> +		/* Read phy status to properly get the right settings */
> +		ret = phy_read_status(phydev);
> +		if (ret)
> +			return ret;
> +
> +		/* First check if the EEE ability is supported */
> +		eee_cap = phy_read_mmd_indirect(phydev->bus, MDIO_PCS_EEE_ABLE,
> +						MDIO_MMD_PCS, phydev->addr);
> +		if (eee_cap < 0)
> +			return eee_cap;
> +
> +		cap = phy_eee_to_supported(eee_cap);
> +		if (!cap)
> +			goto eee_exit;

But this now means returning 0 since you added the call to
phy_read_status() above.  Maybe you should just return -EPROTONOSUPPORT
directly instead of relying on the assumed value of ret?

> +		/* Check which link settings negotiated and verify it in
> +		 * the EEE advertising registers.
> +		 */
> +		eee_lp = phy_read_mmd_indirect(phydev->bus, MDIO_AN_EEE_LPABLE,
> +					       MDIO_MMD_AN, phydev->addr);
> +		if (eee_lp < 0)
> +			return eee_lp;
> +
> +		eee_adv = phy_read_mmd_indirect(phydev->bus, MDIO_AN_EEE_ADV,
> +						MDIO_MMD_AN, phydev->addr);
> +		if (eee_adv < 0)
> +			return eee_adv;
> +
> +		adv = phy_eee_to_adv(eee_adv);
> +		lp = phy_eee_to_adv(eee_lp);
> +		idx = phy_find_setting(phydev->speed, phydev->duplex);
> +		if ((lp & adv & settings[idx].setting))
> +			goto eee_exit;
[...]

Same problem here.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

      reply	other threads:[~2012-06-20 17:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-20  6:12 [net-next.git 0/4] EEE for PAL and stmmac (V5) Giuseppe CAVALLARO
2012-06-20  6:12 ` [net-next.git 1/4 (v3)] stmmac: do not use strict_strtoul but kstrtoint Giuseppe CAVALLARO
2012-06-20  6:12 ` [net-next.git 2/4] stmmac: update the driver Documentation and add EEE Giuseppe CAVALLARO
2012-06-20  6:12 ` [net-next.git 3/4 (v5)] stmmac: add the Energy Efficient Ethernet support Giuseppe CAVALLARO
2012-06-20  6:12 ` [net-next.git 4/4 (v7)] phy: add the EEE support and the way to access to the MMD registers Giuseppe CAVALLARO
2012-06-20 17:22   ` Ben Hutchings [this message]

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=1340212940.2576.2.camel@bwh-desktop.uk.solarflarecom.com \
    --to=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    --cc=rayagond@vayavyalabs.com \
    --cc=yuvalmin@broadcom.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