netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Marek Vasut <marex@denx.de>
Cc: netdev@vger.kernel.org, o.rempel@pengutronix.de,
	Florian Fainelli <f.fainelli@gmail.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Jean Delvare <jdelvare@suse.com>,
	linux-hwmon@vger.kernel.org
Subject: Re: [RFC][PATCH 2/2] net: phy: tja11xx: Add BroadRReach Master/Slave support into TJA11xx PHY driver
Date: Wed, 25 Mar 2020 14:47:03 +0100	[thread overview]
Message-ID: <20200325134703.GE3819@lunn.ch> (raw)
In-Reply-To: <20200325101736.2100-2-marex@denx.de>

> +static int tja11xx_get_tunable(struct phy_device *phydev,
> +			       struct ethtool_tunable *tuna, void *data)
> +{
> +	u8 *mode = (u8 *)data;
> +	int ret;
> +
> +	switch (tuna->id) {
> +	case ETHTOOL_PHY_BRR_MODE:
> +		ret = phy_read(phydev, MII_CFG1);
> +		if (ret < 0)
> +			return ret;
> +		*mode = !!(ret & MII_CFG1_MASTER_SLAVE);

It is not so easy to see if master is 1 or 0?


> +		return 0;
> +	default:
> +		return -EOPNOTSUPP;
> +	}
> +}
> +
> +static int tja11xx_set_tunable(struct phy_device *phydev,
> +			       struct ethtool_tunable *tuna, const void *data)
> +{
> +	u8 mode = *(u8 *)data;
> +	int ret;
> +
> +	switch (tuna->id) {
> +	case ETHTOOL_PHY_BRR_MODE:
> +		ret = tja11xx_disable_link_control(phydev);
> +		if (ret)
> +			return ret;
> +
> +		ret = phy_modify(phydev, MII_CFG1, MII_CFG1_MASTER_SLAVE,
> +				 mode ? MII_CFG1_MASTER_SLAVE : 0);

And if the user passes 42?

    Andrew

  reply	other threads:[~2020-03-25 13:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-25 10:17 [RFC][PATCH 1/2] ethtool: Add BroadRReach Master/Slave PHY tunable Marek Vasut
2020-03-25 10:17 ` [RFC][PATCH 2/2] net: phy: tja11xx: Add BroadRReach Master/Slave support into TJA11xx PHY driver Marek Vasut
2020-03-25 13:47   ` Andrew Lunn [this message]
2020-03-25 13:43 ` [RFC][PATCH 1/2] ethtool: Add BroadRReach Master/Slave PHY tunable Andrew Lunn
2020-03-25 13:51   ` Marek Vasut
2020-03-25 16:49 ` RFC: future of ethtool tunables (Re: [RFC][PATCH 1/2] ethtool: Add BroadRReach Master/Slave PHY tunable) Michal Kubecek
2020-03-25 21:55   ` Andrew Lunn
2020-03-25 22:04     ` Florian Fainelli
2020-03-25 23:42       ` Michal Kubecek
2020-03-26  9:05     ` Oleksij Rempel

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=20200325134703.GE3819@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=marex@denx.de \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    /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).