Thread (10 messages) 10 messages, 5 authors, 2020-03-26

Re: [RFC][PATCH 2/2] net: phy: tja11xx: Add BroadRReach Master/Slave support into TJA11xx PHY driver

From: Andrew Lunn <andrew@lunn.ch>
Date: 2020-03-25 13:47:13
Also in: linux-hwmon

+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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help