lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260129-wip-t-remmet-phytec-de-bspimx95-132_upstream-v1-2-8deccd658d16@phytec.de>
Date: Thu, 29 Jan 2026 15:13:34 +0100
From: Teresa Remmet <t.remmet@...tec.de>
To: Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
	<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
	<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Rob Herring
	<robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
	<conor+dt@...nel.org>, Andrew Davis <afd@...com>, Andrew Lunn
	<andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>, Russell King
	<linux@...linux.org.uk>
CC: <netdev@...r.kernel.org>, <devicetree@...r.kernel.org>,
	<upstream@...ts.phytec.de>, Yannic Moog <y.moog@...tec.de>, Benjamin Hahn
	<b.hahn@...tec.de>, Yashwanth Varakala <y.varakala@...tec.de>, Jan Remmet
	<j.remmet@...tec.de>
Subject: [PATCH 2/2] net: phy: dp83867: add numeric io impedance DT
 property

The DP83867 MAC-side IO impedance is currently configured in the driver
either via an NVMEM cell or via the two boolean device tree properties
ti,min-output-impedance and ti,max-output-impedance.

Some boards require an impedance setting different from the default,
minimum, or maximum values, and may not have NVMEM storage available.
For such cases, a device tree configuration option is needed.

Add a optional device-tree property "ti,output-impedance", that passes
the raw register field value (0x0 - 0x1f) representing the range
between approximately 70 ohms and 35 ohms. Because the actual impedance
range and step size varies depending on the production process, no exact
mapping between register value and impedance can be made. The values
are determined empirically.

If the property is not set the existing behavior is maintained. NVMEM cell
has still priority but ti,output-impedance is checked before the
boolean min and max values.

Signed-off-by: Teresa Remmet <t.remmet@...tec.de>
---
 drivers/net/phy/dp83867.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index 5f5de01c41e1..b06d851c3487 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -516,13 +516,22 @@ static int dp83867_of_init_io_impedance(struct phy_device *phydev)
 			return phydev_err_probe(phydev, ret,
 						"failed to get nvmem cell io_impedance_ctrl\n");
 
-		/* If no nvmem cell, check for the boolean properties. */
-		if (of_property_read_bool(of_node, "ti,max-output-impedance"))
+		/* If no nvmem cell, check for the device tree entries */
+		ret = of_property_read_u32(of_node, "ti,output-impedance",
+					   (u32 *)&dp83867->io_impedance);
+		if (!ret) {
+			if (dp83867->io_impedance > DP83867_IO_MUX_CFG_IO_IMPEDANCE_MASK) {
+				phydev_err(phydev, "'ti,output-impedance' value %u out of range\n",
+					   dp83867->io_impedance);
+				return -EINVAL;
+			}
+		} else if (of_property_read_bool(of_node, "ti,max-output-impedance")) {
 			dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MAX;
-		else if (of_property_read_bool(of_node, "ti,min-output-impedance"))
+		} else if (of_property_read_bool(of_node, "ti,min-output-impedance")) {
 			dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN;
-		else
+		} else {
 			dp83867->io_impedance = -1; /* leave at default */
+		};
 
 		return 0;
 	}

-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ