Skip to contentSkip to conversation

dt-bindings: net: mdio: change nodename match pattern

PATCH Superseded Frank Li 2 participants 2 messages Aug 14, 2024 – Aug 15, 2024

Subsystems (5)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Frank Li

author maintainer
#0 lore raw

PATCH v3 1/1 dt-bindings: net: mdio: change nodename match pattern

Change mdio.yaml nodename match pattern to

	'^mdio(-(bus|external))?(@.+|-([0-9]+))$'

Fix mdio.yaml wrong parser mdio controller's address instead phy's address when mdio-mux exist.

For example:

mdio-mux-emi1@54 {
	compatible = "mdio-mux-mmioreg", "mdio-mux";

        mdio@20 {
		reg = <0x20>;
		       ^^^ This is mdio controller register

		ethernet-phy@2 {
			reg = <0x2>;
                              ^^^ This phy's address
		};
	};
};

Only phy's address is limited to 31 because MDIO bus definition.

But CHECK_DTBS report below warning:

arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dtb: mdio-mux-emi1@54:
mdio@20:reg:0:0: 32 is greater than the maximum of 31

The reason is that "mdio-mux-emi1@54" match "nodename: '^mdio(@.*)?'" in mdio.yaml.

Change to '^mdio(-(bus|external))?(@.+|-([0-9]+))$' to avoid wrong match mdio mux controller's node.

Also change node name mdio to mdio-0 in example of mdio-gpio.yaml to avoid warning.

---
Change from v2 to v3
- update mdio-gpio.yaml node name mdio to mdio-0 to fix dt_binding_check error foud by rob's bot.

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mdio-gpio.example.dtb: mdio: $nodename:0: 'mdio' does not match '^mdio(-(bus|external))?(@.+|-([0-9]+))$'
from schema $id: http://devicetree.org/schemas/net/mdio-gpio.yaml#

Change from v1 to v2
- use rob's suggest to fix node name pattern.

---
 Documentation/devicetree/bindings/net/mdio-gpio.yaml | 2 +-
 Documentation/devicetree/bindings/net/mdio.yaml      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/net/mdio-gpio.yaml +1 -1
index eb4171a1940e4..3be4f94638e61 100644
@@ -44,7 +44,7 @@ examples:
         mdio-gpio0 = &mdio0;
     };
 
-    mdio0: mdio {
+    mdio0: mdio-0 {
       compatible = "virtual,mdio-gpio";
       #address-cells = <1>;
       #size-cells = <0>;
Documentation/devicetree/bindings/net/mdio.yaml +1 -1
index a266ade918ca7..2ed787e4fbbf2 100644
@@ -19,7 +19,7 @@ description:
 
 properties:
   $nodename:
-    pattern: "^mdio(@.*)?"
+    pattern: '^mdio(-(bus|external))?(@.+|-([0-9]+))$'
 
   "#address-cells":
     const: 1
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 59 lines · Frank Li

Change mdio.yaml nodename match pattern to

	'^mdio(-(bus|external))?(@.+|-([0-9]+))$'

Fix mdio.yaml wrong parser mdio controller's address instead phy's address when mdio-mux exist.

For example:

mdio-mux-emi1@54 {
	compatible = "mdio-mux-mmioreg", "mdio-mux";

        mdio@20 {
		reg = <0x20>;
		       ^^^ This is mdio controller register

		ethernet-phy@2 {
			reg = <0x2>;
                              ^^^ This phy's address
		};
	};
};

Only phy's address is limited to 31 because MDIO bus definition.

But CHECK_DTBS report below warning:

arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dtb: mdio-mux-emi1@54:
mdio@20:reg:0:0: 32 is greater than the maximum of 31

The reason is that "mdio-mux-emi1@54" match "nodename: '^mdio(@.*)?'" in mdio.yaml.

Change to '^mdio(-(bus|external))?(@.+|-([0-9]+))$' to avoid wrong match mdio mux controller's node.

Also change node name mdio to mdio-0 in example of mdio-gpio.yaml to avoid warning.

---
Change from v2 to v3
- update mdio-gpio.yaml node name mdio to mdio-0 to fix dt_binding_check error foud by rob's bot.

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mdio-gpio.example.dtb: mdio: $nodename:0: 'mdio' does not match '^mdio(-(bus|external))?(@.+|-([0-9]+))$'
from schema $id: http://devicetree.org/schemas/net/mdio-gpio.yaml#

Change from v1 to v2
- use rob's suggest to fix node name pattern.

---
 Documentation/devicetree/bindings/net/mdio-gpio.yaml | 2 +-
 Documentation/devicetree/bindings/net/mdio.yaml      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/net/mdio-gpio.yaml +0 -0
index eb4171a1940e4..3be4f94638e61 100644

Documentation/devicetree/bindings/net/mdio-gpio.yaml examples: · line 47

Quoted 4 lines
Documentation/devicetree/bindings/net/mdio-gpio.yaml +0 -1
@@ -44,7 +44,7 @@ examples:
         mdio-gpio0 = &mdio0;
     };
 
-    mdio0: mdio {

Just 'mdio' should be accepted. There's a lot of those.

Quoted 9 lines
Documentation/devicetree/bindings/net/mdio-gpio.yaml +1 -0
+    mdio0: mdio-0 {
       compatible = "virtual,mdio-gpio";
       #address-cells = <1>;
       #size-cells = <0>;
Documentation/devicetree/bindings/net/mdio.yaml +0 -0
index a266ade918ca7..2ed787e4fbbf2 100644

Documentation/devicetree/bindings/net/mdio.yaml description: · line 22

Quoted 5 lines
Documentation/devicetree/bindings/net/mdio.yaml +1 -1
@@ -19,7 +19,7 @@ description:
 
 properties:
   $nodename:
-    pattern: "^mdio(@.*)?"
+    pattern: '^mdio(-(bus|external))?(@.+|-([0-9]+))$'

Needs a '?' on the end:

'^mdio(-(bus|external))?(@.+|-([0-9]+))?$'

Quoted 6 lines
Documentation/devicetree/bindings/net/mdio.yaml +0 -0
   "#address-cells":
     const: 1
Signature · 1 line
2.34.1