Skip to contentSkip to conversation

dt-bindings: net: mdio: Add a nodename pattern

PATCH In review Maxime Ripard 2 participants 13 messages Jul 3, 2019

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

PATCH 1/7 dt-bindings: net: mdio: Add a nodename pattern

The node name of an MDIO controller should be MDIO. Let's add a rule for this.

---
 Documentation/devicetree/bindings/net/mdio.yaml | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/net/mdio.yaml +3 -0
index b8fa8251c4bc..12069d0b25c6 100644
@@ -18,6 +18,9 @@ description:
   a device specific binding document.
 
 properties:
+  $nodename:
+    pattern: "^mdio(@.*)?"
+
   reset-gpios:
     maxItems: 1
     description:
Signature · 1 line
2.21.0
#1 lore raw

PATCH 2/7 dt-bindings: net: mdio: Add address and size cells

MDIO controllers should have child nodes with a singe value in their reg properties being the ID of the PHY in the bus.

Let's add the proper constraints on #address-cells and #size-cells.

---
 Documentation/devicetree/bindings/net/mdio.yaml | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/net/mdio.yaml +6 -0
index 12069d0b25c6..24d67074d494 100644
@@ -21,6 +21,12 @@ properties:
   $nodename:
     pattern: "^mdio(@.*)?"
 
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
   reset-gpios:
     maxItems: 1
     description:
Signature · 1 line
2.21.0
#2 lore raw

PATCH 3/7 dt-bindings: net: mdio: Add child nodes

In reply to Maxime Ripard

The child nodes of a mdio bus are supposed to be ethernet PHYs, with a reg property. Make sure that's validated as well.

---
 Documentation/devicetree/bindings/net/mdio.yaml | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
Documentation/devicetree/bindings/net/mdio.yaml +14 -0
index 24d67074d494..5d08d2ffd4eb 100644
@@ -39,6 +39,20 @@ properties:
       and must therefore be appropriately determined based on all PHY
       requirements (maximum value of all per-PHY RESET pulse widths).
 
+patternProperties:
+  "^ethernet-phy@[0-9a-f]+$":
+    type: object
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 31
+        description:
+          The ID number for the PHY.
+
+    required:
+      - reg
+
 examples:
   - |
     davinci_mdio: mdio@5c030000 {
Signature · 1 line
2.21.0
#3 lore raw

Re: [PATCH 3/7] dt-bindings: net: mdio: Add child nodes

Quoted 3 lines · Maxime Ripard

The child nodes of a mdio bus are supposed to be ethernet PHYs, with a reg property. Make sure that's validated as well.

I don't think this is always true. I seem to recall there's some timestamping devices connected via mdio.

In any case, it's not a long list of names, so we can probably just enumerate them as needed. Does this generate any warnings?

Quoted 34 lines
---
 Documentation/devicetree/bindings/net/mdio.yaml | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
Documentation/devicetree/bindings/net/mdio.yaml +14 -1
index 24d67074d494..5d08d2ffd4eb 100644
@@ -39,6 +39,20 @@ properties:
       and must therefore be appropriately determined based on all PHY
       requirements (maximum value of all per-PHY RESET pulse widths).
 
+patternProperties:
+  "^ethernet-phy@[0-9a-f]+$":
+    type: object
+
+    properties:
+      reg:
+        minimum: 0
+        maximum: 31
+        description:
+          The ID number for the PHY.
+
+    required:
+      - reg
+
 examples:
   - |
     davinci_mdio: mdio@5c030000 {
--

2.21.0

#4 lore raw

Re: [PATCH 3/7] dt-bindings: net: mdio: Add child nodes

Quoted 10 lines · Rob Herring
Quoted 3 lines · Maxime Ripard

The child nodes of a mdio bus are supposed to be ethernet PHYs, with a reg property. Make sure that's validated as well.

I don't think this is always true. I seem to recall there's some timestamping devices connected via mdio.

In any case, it's not a long list of names, so we can probably just enumerate them as needed. Does this generate any warnings?

I did a run on both arm and arm64 Allwinner DTS, and it doesn't.

I can do one on multi_v7 / arm64's defconfig, but that's probably going to be a bit hard to tell from the noise of warnings.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#5 lore raw

Re: [PATCH 3/7] dt-bindings: net: mdio: Add child nodes

Quoted 10 lines · Maxime Ripard
Quoted 8 lines · Rob Herring
Quoted 3 lines · Maxime Ripard

The child nodes of a mdio bus are supposed to be ethernet PHYs, with a reg property. Make sure that's validated as well.

I don't think this is always true. I seem to recall there's some timestamping devices connected via mdio.

Quoted 7 lines
Quoted 2 lines

In any case, it's not a long list of names, so we can probably just enumerate them as needed. Does this generate any warnings?

I did a run on both arm and arm64 Allwinner DTS, and it doesn't.

I can do one on multi_v7 / arm64's defconfig, but that's probably going to be a bit hard to tell from the noise of warnings.

I do allmodconfig because that will build all dtbs. You can run checks with a single schema like this:

make dtbs_check DT_SCHEMA_FILES=a-single-schema.yaml

Rob

#6 lore raw

Re: [PATCH 3/7] dt-bindings: net: mdio: Add child nodes

Hi Rob,

Quoted 16 lines · Rob Herring
Quoted 15 lines · Maxime Ripard
Quoted 10 lines · Rob Herring
Quoted 3 lines · Maxime Ripard

The child nodes of a mdio bus are supposed to be ethernet PHYs, with a reg property. Make sure that's validated as well.

I don't think this is always true. I seem to recall there's some timestamping devices connected via mdio.

In any case, it's not a long list of names, so we can probably just enumerate them as needed. Does this generate any warnings?

I did a run on both arm and arm64 Allwinner DTS, and it doesn't.

Quoted 7 lines
Quoted 2 lines

I can do one on multi_v7 / arm64's defconfig, but that's probably going to be a bit hard to tell from the noise of warnings.

I do allmodconfig because that will build all dtbs. You can run checks with a single schema like this:

make dtbs_check DT_SCHEMA_FILES=a-single-schema.yaml

Right, of course :)

I just did it, and apart from a few arm32 broadcom boards that don't have the right address-cells / size-cells (probably false positive due to the fact they use mdio@something as node name), there's no other warnings.

I'm not sure what you were on about though. If there's another node than an ethernet phy, we won' have any warning since we don't have additionalProperties to false.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#7 lore raw

Re: [PATCH 3/7] dt-bindings: net: mdio: Add child nodes

Quoted 26 lines · Maxime Ripard

Hi Rob,

Quoted 22 lines · Rob Herring
Quoted 10 lines · Maxime Ripard
Quoted 8 lines · Rob Herring
Quoted 3 lines · Maxime Ripard

The child nodes of a mdio bus are supposed to be ethernet PHYs, with a reg property. Make sure that's validated as well.

I don't think this is always true. I seem to recall there's some timestamping devices connected via mdio.

Quoted 7 lines
Quoted 2 lines

In any case, it's not a long list of names, so we can probably just enumerate them as needed. Does this generate any warnings?

I did a run on both arm and arm64 Allwinner DTS, and it doesn't.

I can do one on multi_v7 / arm64's defconfig, but that's probably going to be a bit hard to tell from the noise of warnings.

I do allmodconfig because that will build all dtbs. You can run checks with a single schema like this:

Quoted 8 lines
Quoted 1 line

make dtbs_check DT_SCHEMA_FILES=a-single-schema.yaml

Right, of course :)

I just did it, and apart from a few arm32 broadcom boards that don't have the right address-cells / size-cells (probably false positive due to the fact they use mdio@something as node name), there's no other warnings.

Actually, they look like real errors in the DT with the values of address-cells / size-cells swapped. But the node is disabled in the ones I looked at.

Quoted 3 lines

I'm not sure what you were on about though. If there's another node than an ethernet phy, we won' have any warning since we don't have additionalProperties to false.

True. I guess I wasn't thinking through it... Anyways, I applied it.

Rob

#8 lore raw

PATCH 4/7 dt-bindings: display: Fix simple-framebuffer example

In reply to Maxime Ripard

The simple-framebuffer binding has a compatible that isn't one of the valid options. Since an Allwinner pipeline is being described, let's add the matching compatible.

---
 .../devicetree/bindings/display/simple-framebuffer.yaml         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/display/simple-framebuffer.yaml +1 -1
index b052d76cf8b6..c8d73ef010b5 100644
@@ -139,7 +139,7 @@ examples:
       #size-cells = <1>;
       stdout-path = "display0";
       framebuffer0: framebuffer@1d385000 {
-        compatible = "simple-framebuffer";
+        compatible = "allwinner,simple-framebuffer", "simple-framebuffer";
         reg = <0x1d385000 3840000>;
         width = <1600>;
         height = <1200>;
Signature · 1 line
2.21.0
#9 lore raw

PATCH 5/7 dt-bindings: simple-framebuffer: Add requirement for pipelines

In reply to Maxime Ripard

Both the allwinner and amlogic compatibles require that either the allwinner,pipeline or the amlogic,pipeline property is set. This was dropped during the conversion since we didn't have conditionals back then, but we can express this properly now.

---
 .../bindings/display/simple-framebuffer.yaml  | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)
Documentation/devicetree/bindings/display/simple-framebuffer.yaml +23 -0
index c8d73ef010b5..678776b6012a 100644
@@ -126,6 +126,28 @@ required:
   # but usually they will be filled by the bootloader.
   - compatible
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: allwinner,simple-framebuffer
+
+    then:
+      required:
+        - allwinner,pipeline
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: amlogic,simple-framebuffer
+
+    then:
+      required:
+        - amlogic,pipeline
+
+
 additionalProperties: false
 
 examples:
@@ -140,6 +162,7 @@ examples:
       stdout-path = "display0";
       framebuffer0: framebuffer@1d385000 {
         compatible = "allwinner,simple-framebuffer", "simple-framebuffer";
+        allwinner,pipeline = "de_be0-lcd0";
         reg = <0x1d385000 3840000>;
         width = <1600>;
         height = <1200>;
Signature · 1 line
2.21.0
#10 lore raw

PATCH 6/7 dt-bindings: net: Use phy-mode instead of phy-connection-type

In reply to Maxime Ripard

When adding support for the DWMAC (and derivatives) bindings, phy-connection-type was required, even though the previous binding required the equivalent phy-mode.

Let's fix this by using phy-mode as we should have.

---
 .../devicetree/bindings/net/allwinner,sun7i-a20-gmac.yaml | 4 ++--
 .../bindings/net/allwinner,sun8i-a83t-emac.yaml           | 8 ++++----
 Documentation/devicetree/bindings/net/snps,dwmac.yaml     | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/net/allwinner,sun7i-a20-gmac.yaml +2 -2
index 4b45798f0e68..06b1cc8bea14 100644
@@ -44,7 +44,7 @@ required:
   - interrupt-names
   - clocks
   - clock-names
-  - phy-connection-type
+  - phy-mode
 
 examples:
   - |
@@ -55,7 +55,7 @@ examples:
         interrupt-names = "macirq";
         clocks = <&ahb_gates 49>, <&gmac_tx>;
         clock-names = "stmmaceth", "allwinner_gmac_tx";
-        phy-connection-type = "mii";
+        phy-mode = "mii";
     };
 
 # FIXME: We should set it, but it would report all the generic
Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml +4 -4
index 6f68c7f5fc34..d4084c149768 100644
@@ -52,8 +52,8 @@ required:
   - clock-names
   - resets
   - reset-names
-  - phy-connection-type
   - phy-handle
+  - phy-mode
   - syscon
 
 allOf:
@@ -198,7 +198,7 @@ examples:
         clock-names = "stmmaceth";
 
         phy-handle = <&int_mii_phy>;
-        phy-connection-type = "mii";
+        phy-mode = "mii";
         allwinner,leds-active-low;
 
         mdio1: mdio {
@@ -249,7 +249,7 @@ examples:
         clock-names = "stmmaceth";
 
         phy-handle = <&ext_rgmii_phy>;
-        phy-connection-type = "rgmii";
+        phy-mode = "rgmii";
         allwinner,leds-active-low;
 
         mdio2: mdio {
@@ -301,7 +301,7 @@ examples:
         clocks = <&ccu 27>;
         clock-names = "stmmaceth";
         phy-handle = <&ext_rgmii_phy1>;
-        phy-connection-type = "rgmii";
+        phy-mode = "rgmii";
 
         mdio {
             compatible = "snps,dwmac-mdio";
Documentation/devicetree/bindings/net/snps,dwmac.yaml +2 -2
index 658726c620be..76fea2be66ac 100644
@@ -261,7 +261,7 @@ required:
   - reg
   - interrupts
   - interrupt-names
-  - phy-connection-type
+  - phy-mode
 
 dependencies:
   snps,reset-active-low: ["snps,reset-gpio"]
@@ -384,7 +384,7 @@ examples:
         interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";
         mac-address = [000000000000]; /* Filled in by U-Boot */
         max-frame-size = <3800>;
-        phy-connection-type = "gmii";
+        phy-mode = "gmii";
         snps,multicast-filter-bins = <256>;
         snps,perfect-filter-entries = <128>;
         rx-fifo-depth = <16384>;
Signature · 1 line
2.21.0
#11 lore raw

PATCH 7/7 dt-bindings: usb: ehci: Fix example warnings

In reply to Maxime Ripard

The example of the EHCI binding generates a bunch of warnings now that the examples are validated too.

Most notably, phy-names isn't used at all, and the node name should be USB.

---
 Documentation/devicetree/bindings/usb/generic-ehci.yaml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Documentation/devicetree/bindings/usb/generic-ehci.yaml +1 -2
index d3b4f6415920..059f6ef1ad4a 100644
@@ -74,7 +74,7 @@ additionalProperties: false
 
 examples:
   - |
-    ehci@e0000300 {
+    usb@e0000300 {
         compatible = "ibm,usb-ehci-440epx", "generic-ehci";
         interrupt-parent = <&UIC0>;
         interrupts = <0x1a 4>;
@@ -89,7 +89,6 @@ examples:
         interrupts = <39>;
         clocks = <&ahb_gates 1>;
         phys = <&usbphy 1>;
-        phy-names = "usb";
     };
 
 ...
Signature · 1 line
2.21.0
#12 lore raw
In reply to Maxime Ripard
Quoted 8 lines · Maxime Ripard

The node name of an MDIO controller should be MDIO. Let's add a rule for this.

---
 Documentation/devicetree/bindings/net/mdio.yaml | 3 +++
 1 file changed, 3 insertions(+)

Series applied. Thanks.

BTW, just some errors with Broadcom boards with the mdio schema.

Rob