netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Raju Lakkaraju <Raju.Lakkaraju@microsemi.com>
Cc: netdev@vger.kernel.org, f.fainelli@gmail.com,
	Allan.Nielsen@microsemi.com
Subject: Re: [PATCH net-next 2/2] net: phy: Add PHY Auto/Mdi/Mdix set driver for Microsemi PHYs.
Date: Wed, 28 Sep 2016 22:24:51 +0200	[thread overview]
Message-ID: <20160928202451.GC30728@lunn.ch> (raw)
In-Reply-To: <1475064078-22310-3-git-send-email-Raju.Lakkaraju@microsemi.com>

> +	reg_val = phy_read(phydev, MSCC_PHY_BYPASS_CONTROL);
> +	if ((mdix == ETH_TP_MDI) || (mdix == ETH_TP_MDI_X)) {
> +		reg_val |= (DISABLE_PAIR_SWAP_CORR_MASK |
> +			    DISABLE_POLARITY_CORR_MASK  |
> +			    DISABLE_HP_AUTO_MDIX_MASK);
> +	} else {
> +		reg_val &= ~(DISABLE_PAIR_SWAP_CORR_MASK |
> +			     DISABLE_POLARITY_CORR_MASK  |
> +			     DISABLE_HP_AUTO_MDIX_MASK);
> +	}
> +	rc = phy_write(phydev, MSCC_PHY_BYPASS_CONTROL, reg_val);
> +	if (rc != 0)
> +		goto out_unlock;
> +
> +	rc = vsc85xx_phy_page_set(phydev, MSCC_PHY_PAGE_EXTENDED);
> +	if (rc != 0)
> +		goto out_unlock;
> +
> +	reg_val = phy_read(phydev, MSCC_PHY_EXT_MODE_CNTL);
> +	reg_val &= ~(FORCE_MDI_CROSSOVER_MASK);
> +	if (mdix == ETH_TP_MDI)
> +		reg_val |= FORCE_MDI_CROSSOVER_MDI;
> +	else if (mdix == ETH_TP_MDI_X)
> +		reg_val |= FORCE_MDI_CROSSOVER_MDIX;
> +	rc = phy_write(phydev, MSCC_PHY_EXT_MODE_CNTL, reg_val);
> +	if (rc != 0)
> +		goto out_unlock;
> +
> +	rc = vsc85xx_phy_page_set(phydev, MSCC_PHY_PAGE_STANDARD);
> +
> +out_unlock:

out_unlock seems a bit of an odd name, since you are not unlocking
anything.

I also wonder if you should try to reset to MSCC_PHY_PAGE_STANDARD in
the error condition?

> +
> +	return rc;
> +}
> +
>  static int vsc85xx_wol_set(struct phy_device *phydev,
>  			   struct ethtool_wolinfo *wol)
>  {
> @@ -227,6 +281,7 @@ static int vsc85xx_default_config(struct phy_device *phydev)
>  	int rc;
>  	u16 reg_val;
>  
> +	phydev->mdix = ETH_TP_MDI_AUTO;

Humm, interesting. The only other driver supporting mdix is the
Marvell one. It does not do this, it leaves it to its default value of
ETH_TP_MDI_INVALID. It does however interpret ETH_TP_MDI_INVALID as
meaning as ETH_TP_MDI_AUTO.

There needs to be consistency here. You either need to do the same as
the Marvell driver, or you need to modify the Marvell driver to also
set phydev->mdix to ETH_TP_MDI_AUTO.

I don't yet know which of these two is the right thing to do.

Florian?

	Andrew

  reply	other threads:[~2016-09-28 20:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-28 12:01 [PATCH net-next 0/2] net: phy: Add WoL and Auto Mdix drivers for Microsemi PHYs Raju Lakkaraju
2016-09-28 12:01 ` [PATCH net-next 1/2] net: phy: Add Wake-on-LAN driver " Raju Lakkaraju
2016-09-28 16:27   ` Andrew Lunn
2016-10-04 14:12     ` Raju Lakkaraju
2016-09-28 17:37   ` Florian Fainelli
2016-10-04 14:18     ` Raju Lakkaraju
2016-09-28 12:01 ` [PATCH net-next 2/2] net: phy: Add PHY Auto/Mdi/Mdix set " Raju Lakkaraju
2016-09-28 20:24   ` Andrew Lunn [this message]
2016-10-04 14:31     ` Raju Lakkaraju
2016-10-05  7:18       ` Andrew Lunn
2016-10-06 11:09         ` Florian Fainelli
2016-10-17 12:06           ` Raju Lakkaraju
2016-10-06 10:57     ` Florian Fainelli
2016-10-17 11:46       ` Raju Lakkaraju
2016-10-17 12:10     ` Raju Lakkaraju

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=20160928202451.GC30728@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Allan.Nielsen@microsemi.com \
    --cc=Raju.Lakkaraju@microsemi.com \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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).