[PATCH 2/4] dt-bindings: net: dsa: mediatek,mt7530: update examples

Krzysztof Kozlowski krzysztof.kozlowski at linaro.org
Tue Aug 2 01:43:08 PDT 2022


On 30/07/2022 16:26, Arınç ÜNAL wrote:
> Update the examples on the binding.
> 
> - Add examples which include a wide variation of configurations.
> - Make example comments YAML comment instead of DT binding comment.
> - Define examples from platform to make the bindings clearer.
> - Add interrupt controller to the examples. Include header file for
> interrupt.
> - Change reset line for MT7621 examples.
> - Pretty formatting for the examples.
> - Change switch reg to 0.
> - Change port labels to fit the example, change port 4 label to wan.
> - Change ethernet-ports to ports.
> 
> Signed-off-by: Arınç ÜNAL <arinc.unal at arinc9.com>
> ---
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 661 +++++++++++++-----
>  1 file changed, 500 insertions(+), 161 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index 541984a7d2d4..479e292cb2af 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -186,144 +186,374 @@ allOf:
>  unevaluatedProperties: false
>  
>  examples:
> +  # Example 1: Standalone MT7530
>    - |
>      #include <dt-bindings/gpio/gpio.h>
> -    mdio {
> -        #address-cells = <1>;
> -        #size-cells = <0>;
> -        switch at 0 {
> -            compatible = "mediatek,mt7530";
> -            reg = <0>;
> -
> -            core-supply = <&mt6323_vpa_reg>;
> -            io-supply = <&mt6323_vemc3v3_reg>;
> -            reset-gpios = <&pio 33 GPIO_ACTIVE_HIGH>;
> -
> -            ethernet-ports {
> +
> +    platform {
> +        ethernet {
> +            mdio {
>                  #address-cells = <1>;
>                  #size-cells = <0>;
> -                port at 0 {
> +
> +                switch at 0 {
> +                    compatible = "mediatek,mt7530";
>                      reg = <0>;
> -                    label = "lan0";
> -                };
>  
> -                port at 1 {
> -                    reg = <1>;
> -                    label = "lan1";
> -                };
> +                    reset-gpios = <&pio 33 0>;
>  
> -                port at 2 {
> -                    reg = <2>;
> -                    label = "lan2";
> -                };
> +                    core-supply = <&mt6323_vpa_reg>;
> +                    io-supply = <&mt6323_vemc3v3_reg>;
> +
> +                    ports {
> +                        #address-cells = <1>;
> +                        #size-cells = <0>;
>  
> -                port at 3 {
> -                    reg = <3>;
> -                    label = "lan3";
> +                        port at 0 {
> +                            reg = <0>;
> +                            label = "lan1";
> +                        };
> +
> +                        port at 1 {
> +                            reg = <1>;
> +                            label = "lan2";
> +                        };
> +
> +                        port at 2 {
> +                            reg = <2>;
> +                            label = "lan3";
> +                        };
> +
> +                        port at 3 {
> +                            reg = <3>;
> +                            label = "lan4";
> +                        };
> +
> +                        port at 4 {
> +                            reg = <4>;
> +                            label = "wan";
> +                        };
> +
> +                        port at 6 {
> +                            reg = <6>;
> +                            label = "cpu";
> +                            ethernet = <&gmac0>;
> +                            phy-mode = "rgmii";
> +
> +                            fixed-link {
> +                                speed = <1000>;
> +                                full-duplex;
> +                                pause;
> +                            };
> +                        };
> +                    };
>                  };
> +            };
> +        };
> +    };
>  
> -                port at 4 {
> -                    reg = <4>;
> -                    label = "wan";
> +  # Example 2: MT7530 in MT7623AI SoC
> +  - |
> +    #include <dt-bindings/reset/mt2701-resets.h>
> +
> +    platform {
> +        ethernet {
> +            mdio {
> +                #address-cells = <1>;
> +                #size-cells = <0>;
> +
> +                switch at 0 {
> +                    compatible = "mediatek,mt7530";
> +                    reg = <0>;
> +
> +                    mediatek,mcm;
> +                    resets = <&ethsys MT2701_ETHSYS_MCM_RST>;
> +                    reset-names = "mcm";
> +
> +                    core-supply = <&mt6323_vpa_reg>;
> +                    io-supply = <&mt6323_vemc3v3_reg>;
> +
> +                    ports {
> +                        #address-cells = <1>;
> +                        #size-cells = <0>;
> +
> +                        port at 0 {
> +                            reg = <0>;
> +                            label = "lan1";
> +                        };
> +
> +                        port at 1 {
> +                            reg = <1>;
> +                            label = "lan2";
> +                        };
> +
> +                        port at 2 {
> +                            reg = <2>;
> +                            label = "lan3";
> +                        };
> +
> +                        port at 3 {
> +                            reg = <3>;
> +                            label = "lan4";
> +                        };
> +
> +                        port at 4 {
> +                            reg = <4>;
> +                            label = "wan";
> +                        };
> +
> +                        port at 6 {
> +                            reg = <6>;
> +                            label = "cpu";
> +                            ethernet = <&gmac0>;
> +                            phy-mode = "trgmii";
> +
> +                            fixed-link {
> +                                speed = <1000>;
> +                                full-duplex;
> +                                pause;
> +                            };
> +                        };
> +                    };
>                  };
> +            };
> +        };
> +    };
> +
> +  # Example 3: Standalone MT7531
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    platform {
> +        ethernet {
> +            mdio {
> +                #address-cells = <1>;
> +                #size-cells = <0>;
> +
> +                switch at 0 {
> +                    compatible = "mediatek,mt7531";
> +                    reg = <0>;
> +
> +                    reset-gpios = <&pio 54 0>;
> +
> +                    interrupt-controller;
> +                    #interrupt-cells = <1>;
> +                    interrupt-parent = <&pio>;
> +                    interrupts = <53 IRQ_TYPE_LEVEL_HIGH>;
> +
> +                    ports {
> +                        #address-cells = <1>;
> +                        #size-cells = <0>;
> +
> +                        port at 0 {
> +                            reg = <0>;
> +                            label = "lan1";
> +                        };
> +
> +                        port at 1 {
> +                            reg = <1>;
> +                            label = "lan2";
> +                        };
> +
> +                        port at 2 {
> +                            reg = <2>;
> +                            label = "lan3";
> +                        };
> +
> +                        port at 3 {
> +                            reg = <3>;
> +                            label = "lan4";
> +                        };
>  
> -                port at 6 {
> -                    reg = <6>;
> -                    label = "cpu";
> -                    ethernet = <&gmac0>;
> -                    phy-mode = "trgmii";
> -                    fixed-link {
> -                        speed = <1000>;
> -                        full-duplex;
> +                        port at 4 {
> +                            reg = <4>;
> +                            label = "wan";
> +                        };
> +
> +                        port at 6 {
> +                            reg = <6>;
> +                            label = "cpu";
> +                            ethernet = <&gmac0>;
> +                            phy-mode = "2500base-x";
> +
> +                            fixed-link {
> +                                speed = <2500>;
> +                                full-duplex;
> +                                pause;
> +                            };
> +                        };
>                      };
>                  };
>              };
>          };
>      };
>  
> +  # Example 4: MT7530 in MT7621AT, MT7621DAT and MT7621ST SoCs

This is the same as previous... actually several examples are similar.
Do not add examples for each compatible - this is not DTS. Add only one
example for significant differences.

Best regards,
Krzysztof



More information about the Linux-mediatek mailing list