netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Dan Murphy <dmurphy@ti.com>
Cc: f.fainelli@gmail.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: phy: DP83TC811: Introduce support for the DP83TC811 phy
Date: Wed, 9 May 2018 15:43:15 +0200	[thread overview]
Message-ID: <20180509134315.GE14276@lunn.ch> (raw)
In-Reply-To: <20180509120559.12725-1-dmurphy@ti.com>

> +static int dp83811_config_aneg(struct phy_device *phydev)
> +{
> +	int err;
> +	int value;
> +
> +	value = phy_read(phydev, MII_DP83811_SGMII_CTRL);
> +	if (phydev->autoneg == AUTONEG_ENABLE) {
> +		err = phy_write(phydev, MII_DP83811_SGMII_CTRL,
> +				(DP83811_SGMII_AUTO_NEG_EN | value));
> +		if (err < 0)
> +			return err;
> +	} else {
> +		err = phy_write(phydev, MII_DP83811_SGMII_CTRL,
> +				(~DP83811_SGMII_AUTO_NEG_EN & value));
> +		if (err < 0)
> +			return err;
> +	}
> +

Hi Dan

You say SGMII is unreliable on one of these devices. Should you check
phydev->interface before enabling SGMII autoneg?

> +	return genphy_config_aneg(phydev);
> +}
> +
> +static int dp83811_config_init(struct phy_device *phydev)
> +{
> +	int err;
> +	int value;
> +
> +	err = genphy_config_init(phydev);
> +	if (err < 0)
> +		return err;
> +
> +	if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
> +		value = phy_read(phydev, MII_DP83811_SGMII_CTRL);
> +		if (!(value & DP83811_SGMII_EN)) {
> +			err = phy_write(phydev, MII_DP83811_SGMII_CTRL,
> +					(DP83811_SGMII_EN | value));
> +			if (err < 0)
> +				return err;
> +		} else {
> +			err = phy_write(phydev, MII_DP83811_SGMII_CTRL,
> +				(~DP83811_SGMII_EN & value));
> +			if (err < 0)
> +				return err;
> +		}

This looks to be a duplicate of dp83811_config_aneg()?

> +	}
> +
> +	value = DP83811_WOL_MAGIC_EN | DP83811_WOL_SECURE_ON | DP83811_WOL_EN;
> +
> +	return phy_write_mmd(phydev, DP83811_DEVADDR, MII_DP83811_WOL_CFG,
> +	      value);
> +}
> +
> +static int dp83811_phy_reset(struct phy_device *phydev)
> +{
> +	int err;
> +
> +	err = phy_write(phydev, MII_DP83811_RESET_CTRL, DP83811_HW_RESET);
> +	if (err < 0)
> +		return err;
> +
> +	dp83811_config_init(phydev);

I don't think you need to initialize it here. phylib should call that
soon after the reset.

> +
> +	return 0;
> +}
> +

> +static struct phy_driver dp83811_driver[] = {
> +	{
> +		.phy_id = DP83TC811_PHY_ID,
> +		.phy_id_mask = 0xfffffff0,
> +		.name = "TI DP83TC811",
> +		.features = PHY_BASIC_FEATURES,
> +		.flags = PHY_HAS_INTERRUPT,
> +		.config_init = genphy_config_init,

????

	Andrew

  reply	other threads:[~2018-05-09 13:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-09 12:05 [PATCH] net: phy: DP83TC811: Introduce support for the DP83TC811 phy Dan Murphy
2018-05-09 13:43 ` Andrew Lunn [this message]
2018-05-09 13:50   ` Dan Murphy
2018-05-09 13:58     ` Andrew Lunn
2018-05-09 14:00       ` Dan Murphy

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=20180509134315.GE14276@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=dmurphy@ti.com \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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).