[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200325134703.GE3819@lunn.ch>
Date: Wed, 25 Mar 2020 14:47:03 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Marek Vasut <marex@...x.de>
Cc: netdev@...r.kernel.org, o.rempel@...gutronix.de,
Florian Fainelli <f.fainelli@...il.com>,
Guenter Roeck <linux@...ck-us.net>,
Heiner Kallweit <hkallweit1@...il.com>,
Jean Delvare <jdelvare@...e.com>, linux-hwmon@...r.kernel.org
Subject: Re: [RFC][PATCH 2/2] net: phy: tja11xx: Add BroadRReach Master/Slave
support into TJA11xx PHY driver
> +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
Powered by blists - more mailing lists