mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next v3 0/5] net: dp83867: add new output-impedance DT binding
@ 2026-11-06  7:47 Steffen Trumtrar
  2026-11-06  7:47 ` [PATCH net-next v3 1/5] arm64: dts: xilinx: drop unused #phy-cells from the DP83867 nodes Steffen Trumtrar
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Steffen Trumtrar @ 2026-11-06  7:47 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andrew Davis,
	Andrew Lunn, Heiner Kallweit, Russell King, Michal Simek,
	Eric Dumazet
  Cc: netdev, devicetree, linux-kernel, linux-arm-kernel, Steffen Trumtrar

Currently the dp83867 supports setting the io impedance to minimum,
maximum, default or a value from a nvmem cell. In situations where there
is no backend for a nvmem cell, the value can not be set to anything but
minimum, maximum or default.

Add support for a ti,output-impedance-ohms binding, allowing to specify
the impedance in ohms via the devicetree. It is mutually exclusive with
the nvmem cell and the boolean bindings for minimum and maximum; the
binding schema now enforces this for all of them.

Until now, dtschema never applied the binding: it had neither a
compatible nor a select. The binding gets the compatible of the PHY ID,
which several devicetrees already use. The Xilinx ZynqMP devicetrees
then fail validation on an unused #phy-cells in their DP83867 nodes;
patch 1 drops it. It does not depend on the rest of the series and can
go through the Xilinx tree.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
Changes in v3:
- new patch: drop the unused #phy-cells from the Xilinx DP83867 nodes,
  which fail validation once the binding applies to them
- new patch: give the binding a compatible and reference
  ethernet-phy.yaml; without a compatible or select, dtschema never
  applied the binding, so the new constraints would not have been checked
- ti,output-impedance-ohms takes ohms (35..70) instead of the register
  value, the driver maps it linearly to the nearest of the 32 settings
  (the datasheet does not specify the impedance of each setting)
- fix the range check, out of range values were silently masked
- describe the mutual exclusivity instead of a wrong precedence in the
  commit messages
- fix typo in commit message
- also forbid ti,min-output-impedance together with
  ti,max-output-impedance and drop the precedence note from the binding
- rename the binding patch to "Add ti,output-impedance-ohms"
- Link to v2: https://patch.msgid.link/20260826-v7-2-topic-dp83867-v2-0-a97b4cec6e93@pengutronix.de

Changes in v2:
- change 'u8 *val' to 'u32 *val'
- fix logic in driver
- update description of new binding
- rename ti,output-impedance -> ti,output-impedance-ohms
- make mutual exclusivity explicit in binding
- Link to v1: https://patch.msgid.link/20260804-v7-2-topic-dp83867-v1-0-1ca79eb54eef@pengutronix.de

---
Steffen Trumtrar (5):
      arm64: dts: xilinx: drop unused #phy-cells from the DP83867 nodes
      dt-bindings: net: dp83867: add compatible and reference ethernet-phy.yaml
      dt-bindings: net: dp83867: make exclusivity explicit
      dt-bindings: net: dp83867: Add ti,output-impedance-ohms
      net: phy: dp83867: support setting output-impedance

 .../devicetree/bindings/net/ti,dp83867.yaml        | 47 ++++++++++++++++++----
 .../boot/dts/xilinx/zynqmp-sck-kr-g-revA.dtso      |  2 -
 .../boot/dts/xilinx/zynqmp-sck-kr-g-revB.dtso      |  2 -
 .../boot/dts/xilinx/zynqmp-sck-kv-g-revA.dtso      |  1 -
 .../boot/dts/xilinx/zynqmp-sck-kv-g-revB.dtso      |  1 -
 arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revA.dts  |  1 -
 arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revB.dts  |  1 -
 arch/arm64/boot/dts/xilinx/zynqmp-zcu104-revA.dts  |  1 -
 arch/arm64/boot/dts/xilinx/zynqmp-zcu104-revC.dts  |  1 -
 arch/arm64/boot/dts/xilinx/zynqmp-zcu106-revA.dts  |  1 -
 arch/arm64/boot/dts/xilinx/zynqmp-zcu111-revA.dts  |  1 -
 drivers/net/phy/dp83867.c                          | 29 +++++++++++--
 12 files changed, 65 insertions(+), 23 deletions(-)
---
base-commit: 6584acd42820478910a771efb28a355a707e9cb0
change-id: 20260804-v7-2-topic-dp83867-e73a84c37016

Best regards,
--  
Steffen Trumtrar <s.trumtrar@pengutronix.de>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH net-next v3 1/5] arm64: dts: xilinx: drop unused #phy-cells from the DP83867 nodes
  2026-11-06  7:47 [PATCH net-next v3 0/5] net: dp83867: add new output-impedance DT binding Steffen Trumtrar
@ 2026-11-06  7:47 ` Steffen Trumtrar
  2026-11-06  9:09   ` Michal Simek
  2026-11-06  7:47 ` [PATCH net-next v3 2/5] dt-bindings: net: dp83867: add compatible and reference ethernet-phy.yaml Steffen Trumtrar
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Steffen Trumtrar @ 2026-11-06  7:47 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andrew Davis,
	Andrew Lunn, Heiner Kallweit, Russell King, Michal Simek,
	Eric Dumazet
  Cc: netdev, devicetree, linux-kernel, linux-arm-kernel, Steffen Trumtrar

The DP83867 ethernet PHY nodes have a #phy-cells property, but no node
refers to them with a phys property; the MACs use phy-handle, which
takes no arguments. #phy-cells belongs to generic PHY providers.

Drop it, so the nodes validate against the ti,dp83867 binding once it
is applied to them.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 arch/arm64/boot/dts/xilinx/zynqmp-sck-kr-g-revA.dtso | 2 --
 arch/arm64/boot/dts/xilinx/zynqmp-sck-kr-g-revB.dtso | 2 --
 arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revA.dtso | 1 -
 arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revB.dtso | 1 -
 arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revA.dts    | 1 -
 arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revB.dts    | 1 -
 arch/arm64/boot/dts/xilinx/zynqmp-zcu104-revA.dts    | 1 -
 arch/arm64/boot/dts/xilinx/zynqmp-zcu104-revC.dts    | 1 -
 arch/arm64/boot/dts/xilinx/zynqmp-zcu106-revA.dts    | 1 -
 arch/arm64/boot/dts/xilinx/zynqmp-zcu111-revA.dts    | 1 -
 10 files changed, 12 deletions(-)

diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-sck-kr-g-revA.dtso b/arch/arm64/boot/dts/xilinx/zynqmp-sck-kr-g-revA.dtso
index b82a056be2f9..930f0e54fdac 100644
--- a/arch/arm64/boot/dts/xilinx/zynqmp-sck-kr-g-revA.dtso
+++ b/arch/arm64/boot/dts/xilinx/zynqmp-sck-kr-g-revA.dtso
@@ -254,7 +254,6 @@ mdio: mdio {
 		#address-cells = <1>;
 		#size-cells = <0>;
 		phy0: ethernet-phy@4 { /* u81 */
-			#phy-cells = <1>;
 			compatible = "ethernet-phy-id2000.a231";
 			reg = <4>;
 			ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_25_NS>;
@@ -266,7 +265,6 @@ phy0: ethernet-phy@4 { /* u81 */
 			reset-gpios = <&slg7xl45106 5 GPIO_ACTIVE_LOW>;
 		};
 		phy1: ethernet-phy@8 { /* u36 */
-			#phy-cells = <1>;
 			compatible = "ethernet-phy-id2000.a231";
 			reg = <8>;
 			ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_25_NS>;
diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-sck-kr-g-revB.dtso b/arch/arm64/boot/dts/xilinx/zynqmp-sck-kr-g-revB.dtso
index 4dcf92a2158f..e05667f6e946 100644
--- a/arch/arm64/boot/dts/xilinx/zynqmp-sck-kr-g-revB.dtso
+++ b/arch/arm64/boot/dts/xilinx/zynqmp-sck-kr-g-revB.dtso
@@ -255,7 +255,6 @@ mdio: mdio {
 		#address-cells = <1>;
 		#size-cells = <0>;
 		phy0: ethernet-phy@4 { /* u81 */
-			#phy-cells = <1>;
 			compatible = "ethernet-phy-id2000.a231";
 			reg = <4>;
 			ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_25_NS>;
@@ -267,7 +266,6 @@ phy0: ethernet-phy@4 { /* u81 */
 			reset-gpios = <&slg7xl45106 5 GPIO_ACTIVE_LOW>;
 		};
 		phy1: ethernet-phy@8 { /* u36 */
-			#phy-cells = <1>;
 			compatible = "ethernet-phy-id2000.a231";
 			reg = <8>;
 			ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_25_NS>;
diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revA.dtso b/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revA.dtso
index 52954761c9f3..af897c3cd168 100644
--- a/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revA.dtso
+++ b/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revA.dtso
@@ -200,7 +200,6 @@ mdio: mdio {
 		#size-cells = <0>;
 
 		phy0: ethernet-phy@1 {
-			#phy-cells = <1>;
 			reg = <1>;
 			compatible = "ethernet-phy-id2000.a231";
 			ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_25_NS>;
diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revB.dtso b/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revB.dtso
index 49732de5fa4b..a1f0592e7958 100644
--- a/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revB.dtso
+++ b/arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revB.dtso
@@ -191,7 +191,6 @@ mdio: mdio {
 		#size-cells = <0>;
 
 		phy0: ethernet-phy@1 {
-			#phy-cells = <1>;
 			reg = <1>;
 			compatible = "ethernet-phy-id2000.a231";
 			ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_25_NS>;
diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revA.dts b/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revA.dts
index a5bc521ab679..42030547a32d 100644
--- a/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revA.dts
+++ b/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revA.dts
@@ -217,7 +217,6 @@ mdio: mdio {
 		#address-cells = <1>;
 		#size-cells = <0>;
 		phy0: ethernet-phy@21 {
-			#phy-cells = <1>;
 			compatible = "ethernet-phy-id2000.a231";
 			reg = <21>;
 			ti,rx-internal-delay = <0x8>;
diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revB.dts b/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revB.dts
index 3c28130909bc..bad59d7b1d26 100644
--- a/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revB.dts
+++ b/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revB.dts
@@ -19,7 +19,6 @@ &gem3 {
 	phy-handle = <&phyc>;
 	mdio: mdio {
 		phyc: ethernet-phy@c {
-			#phy-cells = <0x1>;
 			compatible = "ethernet-phy-id2000.a231";
 			reg = <0xc>;
 			ti,rx-internal-delay = <0x8>;
diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-zcu104-revA.dts b/arch/arm64/boot/dts/xilinx/zynqmp-zcu104-revA.dts
index 32509083e54f..898a9000daea 100644
--- a/arch/arm64/boot/dts/xilinx/zynqmp-zcu104-revA.dts
+++ b/arch/arm64/boot/dts/xilinx/zynqmp-zcu104-revA.dts
@@ -126,7 +126,6 @@ mdio: mdio {
 		#address-cells = <1>;
 		#size-cells = <0>;
 		phy0: ethernet-phy@c {
-			#phy-cells = <1>;
 			compatible = "ethernet-phy-id2000.a231";
 			reg = <0xc>;
 			ti,rx-internal-delay = <0x8>;
diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-zcu104-revC.dts b/arch/arm64/boot/dts/xilinx/zynqmp-zcu104-revC.dts
index 96699be8430f..b0a08cf1d03b 100644
--- a/arch/arm64/boot/dts/xilinx/zynqmp-zcu104-revC.dts
+++ b/arch/arm64/boot/dts/xilinx/zynqmp-zcu104-revC.dts
@@ -131,7 +131,6 @@ mdio: mdio {
 		#address-cells = <1>;
 		#size-cells = <0>;
 		phy0: ethernet-phy@c {
-			#phy-cells = <1>;
 			compatible = "ethernet-phy-id2000.a231";
 			reg = <0xc>;
 			ti,rx-internal-delay = <0x8>;
diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-zcu106-revA.dts b/arch/arm64/boot/dts/xilinx/zynqmp-zcu106-revA.dts
index 52441e5c8739..58684af4b98c 100644
--- a/arch/arm64/boot/dts/xilinx/zynqmp-zcu106-revA.dts
+++ b/arch/arm64/boot/dts/xilinx/zynqmp-zcu106-revA.dts
@@ -217,7 +217,6 @@ mdio: mdio {
 		#address-cells = <1>;
 		#size-cells = <0>;
 		phy0: ethernet-phy@c {
-			#phy-cells = <1>;
 			reg = <0xc>;
 			compatible = "ethernet-phy-id2000.a231";
 			ti,rx-internal-delay = <0x8>;
diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-zcu111-revA.dts b/arch/arm64/boot/dts/xilinx/zynqmp-zcu111-revA.dts
index b34e4c93d249..30f97f67e8c8 100644
--- a/arch/arm64/boot/dts/xilinx/zynqmp-zcu111-revA.dts
+++ b/arch/arm64/boot/dts/xilinx/zynqmp-zcu111-revA.dts
@@ -189,7 +189,6 @@ mdio: mdio {
 		#address-cells = <1>;
 		#size-cells = <0>;
 		phy0: ethernet-phy@c {
-			#phy-cells = <1>;
 			compatible = "ethernet-phy-id2000.a231";
 			reg = <0xc>;
 			ti,rx-internal-delay = <0x8>;

-- 
2.56.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH net-next v3 2/5] dt-bindings: net: dp83867: add compatible and reference ethernet-phy.yaml
  2026-11-06  7:47 [PATCH net-next v3 0/5] net: dp83867: add new output-impedance DT binding Steffen Trumtrar
  2026-11-06  7:47 ` [PATCH net-next v3 1/5] arm64: dts: xilinx: drop unused #phy-cells from the DP83867 nodes Steffen Trumtrar
@ 2026-11-06  7:47 ` Steffen Trumtrar
  2026-11-06  7:47 ` [PATCH net-next v3 3/5] dt-bindings: net: dp83867: make exclusivity explicit Steffen Trumtrar
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Steffen Trumtrar @ 2026-11-06  7:47 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andrew Davis,
	Andrew Lunn, Heiner Kallweit, Russell King, Michal Simek,
	Eric Dumazet
  Cc: netdev, devicetree, linux-kernel, linux-arm-kernel, Steffen Trumtrar

The binding has neither a compatible nor a select, so dtschema never
applies it to a node: neither the example nor any devicetree is checked
against it.

Add the compatible of the PHY ID, optionally followed by the generic
ethernet-phy-ieee802.3-c22, which several devicetrees use. Select on the
PHY ID only, as the fallback alone would select every clause 22 PHY.
Nodes without a compatible stay valid, but are not checked.

The binding also references ethernet-controller.yaml, which describes
MACs; its node name pattern does not match a PHY node. Reference
ethernet-phy.yaml instead, which also describes reset-gpios and the
other generic PHY properties existing devicetrees use.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 Documentation/devicetree/bindings/net/ti,dp83867.yaml | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/ti,dp83867.yaml b/Documentation/devicetree/bindings/net/ti,dp83867.yaml
index 4bc1f98fd9fe..2cd8311ece5e 100644
--- a/Documentation/devicetree/bindings/net/ti,dp83867.yaml
+++ b/Documentation/devicetree/bindings/net/ti,dp83867.yaml
@@ -8,7 +8,16 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: TI DP83867 ethernet PHY
 
 allOf:
-  - $ref: ethernet-controller.yaml#
+  - $ref: ethernet-phy.yaml#
+
+# only the PHY ID, not every PHY with the c22 fallback
+select:
+  properties:
+    compatible:
+      contains:
+        const: ethernet-phy-id2000.a231
+  required:
+    - compatible
 
 maintainers:
   - Andrew Davis <afd@ti.com>
@@ -28,6 +37,12 @@ description: |
     https://www.ti.com/lit/gpn/dp83867ir
 
 properties:
+  compatible:
+    minItems: 1
+    items:
+      - const: ethernet-phy-id2000.a231
+      - const: ethernet-phy-ieee802.3-c22
+
   reg:
     maxItems: 1
 
@@ -130,6 +145,7 @@ examples:
       #address-cells = <1>;
       #size-cells = <0>;
       ethphy0: ethernet-phy@0 {
+        compatible = "ethernet-phy-id2000.a231";
         reg = <0>;
         tx-fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
         rx-fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;

-- 
2.56.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH net-next v3 3/5] dt-bindings: net: dp83867: make exclusivity explicit
  2026-11-06  7:47 [PATCH net-next v3 0/5] net: dp83867: add new output-impedance DT binding Steffen Trumtrar
  2026-11-06  7:47 ` [PATCH net-next v3 1/5] arm64: dts: xilinx: drop unused #phy-cells from the DP83867 nodes Steffen Trumtrar
  2026-11-06  7:47 ` [PATCH net-next v3 2/5] dt-bindings: net: dp83867: add compatible and reference ethernet-phy.yaml Steffen Trumtrar
@ 2026-11-06  7:47 ` Steffen Trumtrar
  2026-11-06  7:47 ` [PATCH net-next v3 4/5] dt-bindings: net: dp83867: Add ti,output-impedance-ohms Steffen Trumtrar
  2026-11-06  7:47 ` [PATCH net-next v3 5/5] net: phy: dp83867: support setting output-impedance Steffen Trumtrar
  4 siblings, 0 replies; 7+ messages in thread
From: Steffen Trumtrar @ 2026-11-06  7:47 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andrew Davis,
	Andrew Lunn, Heiner Kallweit, Russell King, Michal Simek,
	Eric Dumazet
  Cc: netdev, devicetree, linux-kernel, linux-arm-kernel, Steffen Trumtrar

The io_impedance_ctrl nvmem cell and the properties
ti,{min,max}-output-impedance are mutually exclusive, as noted in the
ti,max-output-impedance description.

As this is only stated in the description and not made explicit in the
schema, the binding checker will not catch if this condition is ignored.

Make it explicit in the schema that only one of them can be used. With
that, drop the note, which also described a precedence for device trees
that the schema now rejects.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 Documentation/devicetree/bindings/net/ti,dp83867.yaml | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/ti,dp83867.yaml b/Documentation/devicetree/bindings/net/ti,dp83867.yaml
index 2cd8311ece5e..833540743bdf 100644
--- a/Documentation/devicetree/bindings/net/ti,dp83867.yaml
+++ b/Documentation/devicetree/bindings/net/ti,dp83867.yaml
@@ -7,9 +7,6 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 
 title: TI DP83867 ethernet PHY
 
-allOf:
-  - $ref: ethernet-phy.yaml#
-
 # only the PHY ID, not every PHY with the c22 fallback
 select:
   properties:
@@ -67,11 +64,6 @@ properties:
     description: |
       MAC Interface Impedance control to set the programmable output impedance
       to a maximum value (70 ohms).
-      Note: Specifying an io_impedance_ctrl nvmem cell or one of the
-        ti,min-output-impedance, ti,max-output-impedance properties
-        are mutually exclusive. If more than one is present, an nvmem
-        cell takes precedence over ti,max-output-impedance, which in
-        turn takes precedence over ti,min-output-impedance.
 
   tx-fifo-depth:
     $ref: /schemas/types.yaml#/definitions/uint32
@@ -133,6 +125,15 @@ properties:
       Transmitt FIFO depth- see dt-bindings/net/ti-dp83867.h for applicable
       values.
 
+allOf:
+  - $ref: ethernet-phy.yaml#
+  - not:
+      required: [nvmem-cells, "ti,min-output-impedance"]
+  - not:
+      required: [nvmem-cells, "ti,max-output-impedance"]
+  - not:
+      required: ["ti,min-output-impedance", "ti,max-output-impedance"]
+
 required:
   - reg
 

-- 
2.56.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH net-next v3 4/5] dt-bindings: net: dp83867: Add ti,output-impedance-ohms
  2026-11-06  7:47 [PATCH net-next v3 0/5] net: dp83867: add new output-impedance DT binding Steffen Trumtrar
                   ` (2 preceding siblings ...)
  2026-11-06  7:47 ` [PATCH net-next v3 3/5] dt-bindings: net: dp83867: make exclusivity explicit Steffen Trumtrar
@ 2026-11-06  7:47 ` Steffen Trumtrar
  2026-11-06  7:47 ` [PATCH net-next v3 5/5] net: phy: dp83867: support setting output-impedance Steffen Trumtrar
  4 siblings, 0 replies; 7+ messages in thread
From: Steffen Trumtrar @ 2026-11-06  7:47 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andrew Davis,
	Andrew Lunn, Heiner Kallweit, Russell King, Michal Simek,
	Eric Dumazet
  Cc: netdev, devicetree, linux-kernel, linux-arm-kernel, Steffen Trumtrar

Currently, the output-impedance can only be set to default, minimum or
maximum or via a nvmem cell.
In cases where there is no backend for a nvmem cell, a value can not be
set.

Add a DT binding, 'ti,output-impedance-ohms', for specifying the
output-impedance in ohms, between 35 and 70. Like the existing
properties, it is mutually exclusive with the nvmem cell and with
ti,{min,max}-output-impedance.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 Documentation/devicetree/bindings/net/ti,dp83867.yaml | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/ti,dp83867.yaml b/Documentation/devicetree/bindings/net/ti,dp83867.yaml
index 833540743bdf..557d2517a72e 100644
--- a/Documentation/devicetree/bindings/net/ti,dp83867.yaml
+++ b/Documentation/devicetree/bindings/net/ti,dp83867.yaml
@@ -53,6 +53,16 @@ properties:
     items:
       - const: io_impedance_ctrl
 
+  ti,output-impedance-ohms:
+    description: |
+      MAC Interface Impedance control to set the programmable output impedance
+      to a value between minimum (35 ohms) and maximum (70 ohms). The PHY
+      has 32 settings in this range; the datasheet does not specify the
+      impedance of each setting, so the value is mapped linearly to the
+      nearest one.
+    minimum: 35
+    maximum: 70
+
   ti,min-output-impedance:
     type: boolean
     description: |
@@ -133,6 +143,12 @@ allOf:
       required: [nvmem-cells, "ti,max-output-impedance"]
   - not:
       required: ["ti,min-output-impedance", "ti,max-output-impedance"]
+  - not:
+      required: [nvmem-cells, "ti,output-impedance-ohms"]
+  - not:
+      required: ["ti,output-impedance-ohms", "ti,min-output-impedance"]
+  - not:
+      required: ["ti,output-impedance-ohms", "ti,max-output-impedance"]
 
 required:
   - reg

-- 
2.56.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH net-next v3 5/5] net: phy: dp83867: support setting output-impedance
  2026-11-06  7:47 [PATCH net-next v3 0/5] net: dp83867: add new output-impedance DT binding Steffen Trumtrar
                   ` (3 preceding siblings ...)
  2026-11-06  7:47 ` [PATCH net-next v3 4/5] dt-bindings: net: dp83867: Add ti,output-impedance-ohms Steffen Trumtrar
@ 2026-11-06  7:47 ` Steffen Trumtrar
  4 siblings, 0 replies; 7+ messages in thread
From: Steffen Trumtrar @ 2026-11-06  7:47 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andrew Davis,
	Andrew Lunn, Heiner Kallweit, Russell King, Michal Simek,
	Eric Dumazet
  Cc: netdev, devicetree, linux-kernel, linux-arm-kernel, Steffen Trumtrar

Currently the dp83867 supports setting the io impedance to minimum,
maximum, default or a value from a nvmem cell. In situations where there
is no backend for a nvmem cell, the value can not be set to anything but
minimum, maximum or default.

Add support for the ti,output-impedance-ohms binding, allowing to
specify the impedance in ohms via the devicetree. The PHY has 32
settings between 35 and 70 ohms. The datasheet does not specify the
impedance of each setting, so the value is mapped linearly to the
nearest one.

With this mapping, 50 ohms results in 0x12. For non-OF devices, the
driver sets 0x0f (IO_IMPEDANCE_MIN / 2) as the 50 ohm default "per
datasheet", which would be 53 ohms with the linear mapping. As the
datasheet only gives the range, neither value can be checked against it.

The binding does not allow combining the new property with the nvmem
cell or the boolean properties. The driver still reads the nvmem cell
first, then ti,max-output-impedance, ti,min-output-impedance and
ti,output-impedance-ohms.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 drivers/net/phy/dp83867.c | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index a3cd5cb11ea0..ca668e75f0c9 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -119,6 +119,9 @@
 #define DP83867_IO_MUX_CFG_IO_IMPEDANCE_MASK	0x1f
 #define DP83867_IO_MUX_CFG_IO_IMPEDANCE_MAX	0x0
 #define DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN	0x1f
+/* Output impedance at IO_IMPEDANCE_MIN and IO_IMPEDANCE_MAX (datasheet) */
+#define DP83867_IO_IMPEDANCE_MIN_OHMS		35
+#define DP83867_IO_IMPEDANCE_MAX_OHMS		70
 #define DP83867_IO_MUX_CFG_CLK_O_DISABLE	BIT(6)
 #define DP83867_IO_MUX_CFG_CLK_O_SEL_MASK	(0x1f << 8)
 #define DP83867_IO_MUX_CFG_CLK_O_SEL_SHIFT	8
@@ -542,7 +545,8 @@ static int dp83867_of_init_io_impedance(struct phy_device *phydev)
 	struct device *dev = &phydev->mdio.dev;
 	struct device_node *of_node = dev->of_node;
 	struct nvmem_cell *cell;
-	u8 *buf, val;
+	u8 *buf;
+	u32 val;
 	int ret;
 
 	cell = of_nvmem_cell_get(of_node, "io_impedance_ctrl");
@@ -553,12 +557,29 @@ static int dp83867_of_init_io_impedance(struct phy_device *phydev)
 						"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 (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 if (of_property_read_u32(of_node, "ti,output-impedance-ohms", &val) == 0) {
+			if (val < DP83867_IO_IMPEDANCE_MIN_OHMS ||
+			    val > DP83867_IO_IMPEDANCE_MAX_OHMS) {
+				phydev_err(phydev, "'ti,output-impedance-ohms' contents out of range\n");
+				return -ERANGE;
+			}
+			/*
+			 * 0x00 = 70 ohms ... 0x1f = 35 ohms. The datasheet
+			 * does not specify the settings in between, map the
+			 * range linearly to the nearest one.
+			 */
+			dp83867->io_impedance =
+				DIV_ROUND_CLOSEST((DP83867_IO_IMPEDANCE_MAX_OHMS - val) *
+						  DP83867_IO_MUX_CFG_IO_IMPEDANCE_MASK,
+						  DP83867_IO_IMPEDANCE_MAX_OHMS -
+						  DP83867_IO_IMPEDANCE_MIN_OHMS);
+		} else {
 			dp83867->io_impedance = -1; /* leave at default */
+		}
 
 		return 0;
 	}

-- 
2.56.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next v3 1/5] arm64: dts: xilinx: drop unused #phy-cells from the DP83867 nodes
  2026-11-06  7:47 ` [PATCH net-next v3 1/5] arm64: dts: xilinx: drop unused #phy-cells from the DP83867 nodes Steffen Trumtrar
@ 2026-11-06  9:09   ` Michal Simek
  0 siblings, 0 replies; 7+ messages in thread
From: Michal Simek @ 2026-11-06  9:09 UTC (permalink / raw)
  To: Steffen Trumtrar, Andrew Lunn, David S. Miller, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Andrew Davis, Andrew Lunn, Heiner Kallweit, Russell King,
	Eric Dumazet
  Cc: netdev, devicetree, linux-kernel, linux-arm-kernel



On 11/6/26 08:47, Steffen Trumtrar wrote:
> The DP83867 ethernet PHY nodes have a #phy-cells property, but no node
> refers to them with a phys property; the MACs use phy-handle, which
> takes no arguments. #phy-cells belongs to generic PHY providers.
> 
> Drop it, so the nodes validate against the ti,dp83867 binding once it
> is applied to them.
> 
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> ---
>   arch/arm64/boot/dts/xilinx/zynqmp-sck-kr-g-revA.dtso | 2 --
>   arch/arm64/boot/dts/xilinx/zynqmp-sck-kr-g-revB.dtso | 2 --
>   arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revA.dtso | 1 -
>   arch/arm64/boot/dts/xilinx/zynqmp-sck-kv-g-revB.dtso | 1 -
>   arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revA.dts    | 1 -
>   arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revB.dts    | 1 -
>   arch/arm64/boot/dts/xilinx/zynqmp-zcu104-revA.dts    | 1 -
>   arch/arm64/boot/dts/xilinx/zynqmp-zcu104-revC.dts    | 1 -
>   arch/arm64/boot/dts/xilinx/zynqmp-zcu106-revA.dts    | 1 -
>   arch/arm64/boot/dts/xilinx/zynqmp-zcu111-revA.dts    | 1 -
>   10 files changed, 12 deletions(-)
Reviewed-by: Michal Simek <michal.simek@amd.com>

If you want me to take it via my tree please send it separately.

Thanks,
Michal

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-11-06  9:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-06  7:47 [PATCH net-next v3 0/5] net: dp83867: add new output-impedance DT binding Steffen Trumtrar
2026-11-06  7:47 ` [PATCH net-next v3 1/5] arm64: dts: xilinx: drop unused #phy-cells from the DP83867 nodes Steffen Trumtrar
2026-11-06  9:09   ` Michal Simek
2026-11-06  7:47 ` [PATCH net-next v3 2/5] dt-bindings: net: dp83867: add compatible and reference ethernet-phy.yaml Steffen Trumtrar
2026-11-06  7:47 ` [PATCH net-next v3 3/5] dt-bindings: net: dp83867: make exclusivity explicit Steffen Trumtrar
2026-11-06  7:47 ` [PATCH net-next v3 4/5] dt-bindings: net: dp83867: Add ti,output-impedance-ohms Steffen Trumtrar
2026-11-06  7:47 ` [PATCH net-next v3 5/5] net: phy: dp83867: support setting output-impedance Steffen Trumtrar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®