[PATCH net-next v2 04/10] dt-bindings: net: dsa: nxp,sja1105: improve MDIO bus bindings

From: Arınç ÜNAL
Date: Sat Sep 16 2023 - 07:12:00 EST


The SJA1110 switch uses the mdios property for its two MDIO buses. Instead
of a pattern, define two mdio nodes. This ensures the same compatible
string won't be used twice. The address and size cell definitions can also
be removed now that the reg property has become unnecessary.

Move the comment to the description of mdios, mdio0, and mdio1 properties.
Disallow the mdios property for SJA1105. Require at least one of the MDIO
buses to be defined to prevent empty mdios child node.

Signed-off-by: Arınç ÜNAL <arinc.unal@xxxxxxxxxx>
---
.../bindings/net/dsa/nxp,sja1105.yaml | 49 ++++++++++---------
1 file changed, 26 insertions(+), 23 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
index 4d5f5cc6d031..3f3c4ecc6442 100644
--- a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
@@ -35,42 +35,44 @@ properties:
spi-cpha: true
spi-cpol: true

- # Optional container node for the 2 internal MDIO buses of the SJA1110
- # (one for the internal 100base-T1 PHYs and the other for the single
- # 100base-TX PHY). The "reg" property does not have physical significance.
- # The PHY addresses to port correspondence is as follows: for 100base-T1,
- # port 5 has PHY 1, port 6 has PHY 2 etc, while for 100base-TX, port 1 has
- # PHY 1.
mdios:
+ description:
+ The optional container node for the two MDIO buses of the SJA1110.
type: object

properties:
- '#address-cells':
- const: 1
- '#size-cells':
- const: 0
-
- patternProperties:
- "^mdio@[0-1]$":
+ mdio0:
+ description:
+ The node for the bus controlling the 100base-T1 PHYs of the SJA1110
+ switch. PHY address to port correspondence is port 5 has PHY 1, port 6
+ has PHY 2, etc.
$ref: /schemas/net/mdio.yaml#
unevaluatedProperties: false

properties:
compatible:
- oneOf:
- - enum:
- - nxp,sja1110-base-t1-mdio
- - nxp,sja1110-base-tx-mdio
+ const: nxp,sja1110-base-t1-mdio
+
+ required:
+ - compatible

- reg:
- oneOf:
- - enum:
- - 0
- - 1
+ mdio1:
+ description:
+ The node for the bus controlling the 100base-TX PHY of the SJA1110
+ switch. PHY address to port correspondence is port 1 has PHY 1.
+ $ref: /schemas/net/mdio.yaml#
+ unevaluatedProperties: false
+
+ properties:
+ compatible:
+ const: nxp,sja1110-base-tx-mdio

required:
- compatible
- - reg
+
+ anyOf:
+ - required: [ mdio0 ]
+ - required: [ mdio1 ]

patternProperties:
"^(ethernet-)?ports$":
@@ -124,6 +126,7 @@ allOf:
then:
properties:
spi-cpol: false
+ mdios: false
required:
- spi-cpha
else:
--
2.39.2