devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 1/2] dt-bindings: net: mediatek,net: remove reference on top level schema
@ 2023-09-17 12:47 Arınç ÜNAL
  2023-09-17 12:47 ` [PATCH net-next 2/2] dt-bindings: net: mediatek,net: move mediatek,mt7621-eth to another schema Arınç ÜNAL
  2023-09-18 20:30 ` [PATCH net-next 1/2] dt-bindings: net: mediatek,net: remove reference on top level schema Rob Herring
  0 siblings, 2 replies; 4+ messages in thread
From: Arınç ÜNAL @ 2023-09-17 12:47 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
	AngeloGioacchino Del Regno, �nç ÜNAL,
	Lorenzo Bianconi, Felix Fietkau, Daniel Golle
  Cc: Krzysztof Kozlowski, mithat.guner, erkin.bozoglu, netdev,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek

The top level schema does not represent an ethernet controller, the
subschema defining the MAC nodes does. Remove the reference to
ethernet-controller.yaml on the top level schema.

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 Documentation/devicetree/bindings/net/mediatek,net.yaml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/mediatek,net.yaml b/Documentation/devicetree/bindings/net/mediatek,net.yaml
index e74502a0afe8..0b2cb1897310 100644
--- a/Documentation/devicetree/bindings/net/mediatek,net.yaml
+++ b/Documentation/devicetree/bindings/net/mediatek,net.yaml
@@ -105,7 +105,6 @@ properties:
     const: 0
 
 allOf:
-  - $ref: ethernet-controller.yaml#
   - if:
       properties:
         compatible:
-- 
2.39.2


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

* [PATCH net-next 2/2] dt-bindings: net: mediatek,net: move mediatek,mt7621-eth to another schema
  2023-09-17 12:47 [PATCH net-next 1/2] dt-bindings: net: mediatek,net: remove reference on top level schema Arınç ÜNAL
@ 2023-09-17 12:47 ` Arınç ÜNAL
  2023-09-18 20:29   ` Rob Herring
  2023-09-18 20:30 ` [PATCH net-next 1/2] dt-bindings: net: mediatek,net: remove reference on top level schema Rob Herring
  1 sibling, 1 reply; 4+ messages in thread
From: Arınç ÜNAL @ 2023-09-17 12:47 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
	AngeloGioacchino Del Regno, �nç ÜNAL,
	Lorenzo Bianconi, Felix Fietkau, Daniel Golle
  Cc: Krzysztof Kozlowski, mithat.guner, erkin.bozoglu, netdev,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek

The bindings for mediatek,mt7621-eth contradict with some of the rules on
the top level schema of mediatek,net.yaml:
- resets must be two items. resets with "maxItems: 3" at the top level
  implies "minItems: 3" and cannot be overriden under a subschema.
- reset-names items must be "fe" and "eth". reset-names items defined on
  the top level schema cannot be overridden under a subschema.

Therefore, move mediatek,mt7621-eth to another schema. Fix the order of
clock-names items. Do not define the properties that don't apply to this
hardware. Require more properties. Add an example.

Fixes: 1cbf487d7d3a ("dt-bindings: net: mediatek,net: add missing mediatek,mt7621-eth")
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 .../bindings/net/mediatek,mt7621-eth.yaml     | 143 ++++++++++++++++++
 .../devicetree/bindings/net/mediatek,net.yaml |  27 ----
 2 files changed, 143 insertions(+), 27 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/mediatek,mt7621-eth.yaml

diff --git a/Documentation/devicetree/bindings/net/mediatek,mt7621-eth.yaml b/Documentation/devicetree/bindings/net/mediatek,mt7621-eth.yaml
new file mode 100644
index 000000000000..4f39d7124693
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/mediatek,mt7621-eth.yaml
@@ -0,0 +1,143 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/mediatek,mt7621-eth.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek MT7621 Frame Engine Ethernet controller
+
+maintainers:
+  - Arınç ÜNAL <arinc.unal@arinc9.com>
+
+description:
+  The frame engine ethernet controller can be found on MediaTek MT7621 SoC. This
+  SoC has got dual GMAC ports.
+
+properties:
+  compatible:
+    const: mediatek,mt7621-eth
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 2
+
+  clock-names:
+    items:
+      - const: fe
+      - const: ethif
+
+  interrupts:
+    maxItems: 1
+
+  resets:
+    maxItems: 2
+
+  reset-names:
+    items:
+      - const: fe
+      - const: eth
+
+  mediatek,ethsys:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      Phandle to the syscon node that handles the port setup.
+
+  mdio-bus:
+    $ref: mdio.yaml#
+    unevaluatedProperties: false
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+patternProperties:
+  "^mac@[0-1]$":
+    type: object
+    unevaluatedProperties: false
+    allOf:
+      - $ref: ethernet-controller.yaml#
+    description:
+      Ethernet MAC node
+    properties:
+      compatible:
+        const: mediatek,eth-mac
+
+      reg:
+        maxItems: 1
+
+    required:
+      - reg
+      - compatible
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - resets
+  - reset-names
+  - mediatek,ethsys
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/mips-gic.h>
+    #include <dt-bindings/clock/mt7621-clk.h>
+    #include <dt-bindings/reset/mt7621-reset.h>
+
+    soc {
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        ethernet: ethernet@1e100000 {
+            compatible = "mediatek,mt7621-eth";
+            reg = <0x1e100000 0x10000>;
+
+            clocks = <&sysc MT7621_CLK_FE>, <&sysc MT7621_CLK_ETH>;
+            clock-names = "fe", "ethif";
+
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            resets = <&sysc MT7621_RST_FE>, <&sysc MT7621_RST_ETH>;
+            reset-names = "fe", "eth";
+
+            interrupt-parent = <&gic>;
+            interrupts = <GIC_SHARED 3 IRQ_TYPE_LEVEL_HIGH>;
+
+            mediatek,ethsys = <&sysc>;
+
+            pinctrl-names = "default";
+            pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>, <&rgmii2_pins>;
+
+            gmac0: mac@0 {
+                compatible = "mediatek,eth-mac";
+                reg = <0>;
+                phy-mode = "rgmii";
+
+                fixed-link {
+                    speed = <1000>;
+                    full-duplex;
+                    pause;
+                };
+            };
+
+            gmac1: mac@1 {
+                compatible = "mediatek,eth-mac";
+                reg = <1>;
+                phy-mode = "rgmii";
+
+                fixed-link {
+                    speed = <1000>;
+                    full-duplex;
+                    pause;
+                };
+            };
+        };
+    };
diff --git a/Documentation/devicetree/bindings/net/mediatek,net.yaml b/Documentation/devicetree/bindings/net/mediatek,net.yaml
index 0b2cb1897310..dc6f2424002e 100644
--- a/Documentation/devicetree/bindings/net/mediatek,net.yaml
+++ b/Documentation/devicetree/bindings/net/mediatek,net.yaml
@@ -19,7 +19,6 @@ properties:
     enum:
       - mediatek,mt2701-eth
       - mediatek,mt7623-eth
-      - mediatek,mt7621-eth
       - mediatek,mt7622-eth
       - mediatek,mt7629-eth
       - mediatek,mt7981-eth
@@ -140,32 +139,6 @@ allOf:
 
         mediatek,wed-pcie: false
 
-  - if:
-      properties:
-        compatible:
-          contains:
-            enum:
-              - mediatek,mt7621-eth
-    then:
-      properties:
-        interrupts:
-          maxItems: 1
-
-        clocks:
-          minItems: 2
-          maxItems: 2
-
-        clock-names:
-          items:
-            - const: ethif
-            - const: fe
-
-        mediatek,infracfg: false
-
-        mediatek,wed: false
-
-        mediatek,wed-pcie: false
-
   - if:
       properties:
         compatible:
-- 
2.39.2


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

* Re: [PATCH net-next 2/2] dt-bindings: net: mediatek,net: move mediatek,mt7621-eth to another schema
  2023-09-17 12:47 ` [PATCH net-next 2/2] dt-bindings: net: mediatek,net: move mediatek,mt7621-eth to another schema Arınç ÜNAL
@ 2023-09-18 20:29   ` Rob Herring
  0 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2023-09-18 20:29 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
	AngeloGioacchino Del Regno, Lorenzo Bianconi, Felix Fietkau,
	Daniel Golle, Krzysztof Kozlowski, mithat.guner, erkin.bozoglu,
	netdev, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek

On Sun, Sep 17, 2023 at 03:47:23PM +0300, Arınç ÜNAL wrote:
> The bindings for mediatek,mt7621-eth contradict with some of the rules on
> the top level schema of mediatek,net.yaml:
> - resets must be two items. resets with "maxItems: 3" at the top level
>   implies "minItems: 3" and cannot be overriden under a subschema.
> - reset-names items must be "fe" and "eth". reset-names items defined on
>   the top level schema cannot be overridden under a subschema.

Why not? You can shuffle things around. Though at some point it is worth 
splitting the schemas.

> 
> Therefore, move mediatek,mt7621-eth to another schema. Fix the order of
> clock-names items. Do not define the properties that don't apply to this
> hardware. Require more properties. Add an example.
> 
> Fixes: 1cbf487d7d3a ("dt-bindings: net: mediatek,net: add missing mediatek,mt7621-eth")
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  .../bindings/net/mediatek,mt7621-eth.yaml     | 143 ++++++++++++++++++
>  .../devicetree/bindings/net/mediatek,net.yaml |  27 ----
>  2 files changed, 143 insertions(+), 27 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/net/mediatek,mt7621-eth.yaml
> 
> diff --git a/Documentation/devicetree/bindings/net/mediatek,mt7621-eth.yaml b/Documentation/devicetree/bindings/net/mediatek,mt7621-eth.yaml
> new file mode 100644
> index 000000000000..4f39d7124693
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/mediatek,mt7621-eth.yaml
> @@ -0,0 +1,143 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/mediatek,mt7621-eth.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: MediaTek MT7621 Frame Engine Ethernet controller
> +
> +maintainers:
> +  - Arınç ÜNAL <arinc.unal@arinc9.com>
> +
> +description:
> +  The frame engine ethernet controller can be found on MediaTek MT7621 SoC. This
> +  SoC has got dual GMAC ports.
> +
> +properties:
> +  compatible:
> +    const: mediatek,mt7621-eth
> +
> +  reg:
> +    maxItems: 1
> +
> +  clocks:
> +    maxItems: 2
> +
> +  clock-names:
> +    items:
> +      - const: fe
> +      - const: ethif
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  resets:
> +    maxItems: 2
> +
> +  reset-names:
> +    items:
> +      - const: fe
> +      - const: eth
> +
> +  mediatek,ethsys:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description:
> +      Phandle to the syscon node that handles the port setup.
> +
> +  mdio-bus:
> +    $ref: mdio.yaml#
> +    unevaluatedProperties: false
> +
> +  "#address-cells":
> +    const: 1
> +
> +  "#size-cells":
> +    const: 0
> +
> +patternProperties:
> +  "^mac@[0-1]$":
> +    type: object
> +    unevaluatedProperties: false
> +    allOf:

Don't need allOf.

> +      - $ref: ethernet-controller.yaml#
> +    description:
> +      Ethernet MAC node
> +    properties:
> +      compatible:
> +        const: mediatek,eth-mac
> +
> +      reg:
> +        maxItems: 1
> +
> +    required:
> +      - reg
> +      - compatible

Now all the child nodes (at least) are duplicated. If you don't want to 
further extend the if/then schemas (it's a judgement call when splitting 
makes sense), then I'd suggest you move what is common to a separate 
schema file and then $ref it in this file and the original schema.

Rob

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

* Re: [PATCH net-next 1/2] dt-bindings: net: mediatek,net: remove reference on top level schema
  2023-09-17 12:47 [PATCH net-next 1/2] dt-bindings: net: mediatek,net: remove reference on top level schema Arınç ÜNAL
  2023-09-17 12:47 ` [PATCH net-next 2/2] dt-bindings: net: mediatek,net: move mediatek,mt7621-eth to another schema Arınç ÜNAL
@ 2023-09-18 20:30 ` Rob Herring
  1 sibling, 0 replies; 4+ messages in thread
From: Rob Herring @ 2023-09-18 20:30 UTC (permalink / raw)
  To: Arınç ÜNAL
  Cc: netdev, erkin.bozoglu, devicetree, linux-mediatek, linux-kernel,
	Krzysztof Kozlowski, mithat.guner, Daniel Golle, Eric Dumazet,
	Matthias Brugger, David S. Miller, Jakub Kicinski,
	linux-arm-kernel, Rob Herring, Lorenzo Bianconi,
	AngeloGioacchino Del Regno, Conor Dooley, Paolo Abeni,
	Felix Fietkau, Krzysztof Kozlowski


On Sun, 17 Sep 2023 15:47:22 +0300, Arınç ÜNAL wrote:
> The top level schema does not represent an ethernet controller, the
> subschema defining the MAC nodes does. Remove the reference to
> ethernet-controller.yaml on the top level schema.
> 
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  Documentation/devicetree/bindings/net/mediatek,net.yaml | 1 -
>  1 file changed, 1 deletion(-)
> 

Acked-by: Rob Herring <robh@kernel.org>


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

end of thread, other threads:[~2023-09-18 20:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-17 12:47 [PATCH net-next 1/2] dt-bindings: net: mediatek,net: remove reference on top level schema Arınç ÜNAL
2023-09-17 12:47 ` [PATCH net-next 2/2] dt-bindings: net: mediatek,net: move mediatek,mt7621-eth to another schema Arınç ÜNAL
2023-09-18 20:29   ` Rob Herring
2023-09-18 20:30 ` [PATCH net-next 1/2] dt-bindings: net: mediatek,net: remove reference on top level schema Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).