Subject: Re: [PATCH v2 1/3] dt-bindings: net: ti: k3-am654-cpsw-nuss: Update bindings for J7200 CPSW5G

From: Rob Herring <[email-masked]>
Date: Sun, 5 Jun 2022 17:43:43 -0500

On Thu, Jun 02, 2022 at 05:15:56PM +0530, Siddharth Vadapalli wrote:
> Update bindings for TI K3 J7200 SoC which contains 5 ports (4 external
> ports) CPSW5G module and add compatible for it.
> 
> Changes made:
>     - Add new compatible ti,j7200-cpswxg-nuss for CPSW5G.
>     - Extend pattern properties for new compatible.
>     - Change maximum number of CPSW ports to 4 for new compatible.
> 
> Signed-off-by: Siddharth Vadapalli <[email-masked]>
> ---
>  .../bindings/net/ti,k3-am654-cpsw-nuss.yaml   | 140 ++++++++++++------
>  1 file changed, 98 insertions(+), 42 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/ti,k3-am654-cpsw-nuss.yaml b/Documentation/devicetree/bindings/net/ti,k3-am654-cpsw-nuss.yaml
> index b8281d8be940..ec57bde7ac26 100644
> --- a/Documentation/devicetree/bindings/net/ti,k3-am654-cpsw-nuss.yaml
> +++ b/Documentation/devicetree/bindings/net/ti,k3-am654-cpsw-nuss.yaml
> @@ -57,6 +57,7 @@ properties:
>        - ti,am654-cpsw-nuss
>        - ti,j721e-cpsw-nuss
>        - ti,am642-cpsw-nuss
> +      - ti,j7200-cpswxg-nuss
>  
>    reg:
>      maxItems: 1
> @@ -108,48 +109,103 @@ properties:
>          const: 1
>        '#size-cells':
>          const: 0
> -
> -    patternProperties:
> -      port@[1-2]:
> -        type: object
> -        description: CPSWxG NUSS external ports
> -
> -        $ref: ethernet-controller.yaml#
> -
> -        properties:
> -          reg:
> -            minimum: 1
> -            maximum: 2
> -            description: CPSW port number
> -
> -          phys:
> -            maxItems: 1
> -            description: phandle on phy-gmii-sel PHY
> -
> -          label:
> -            description: label associated with this port
> -
> -          ti,mac-only:
> -            $ref: /schemas/types.yaml#/definitions/flag
> -            description:
> -              Specifies the port works in mac-only mode.
> -
> -          ti,syscon-efuse:
> -            $ref: /schemas/types.yaml#/definitions/phandle-array
> -            items:
> -              - items:
> -                  - description: Phandle to the system control device node which
> -                      provides access to efuse
> -                  - description: offset to efuse registers???
> -            description:
> -              Phandle to the system control device node which provides access
> -              to efuse IO range with MAC addresses
> -
> -        required:
> -          - reg
> -          - phys
> -
> -    additionalProperties: false
> +    allOf:
> +      - if:
> +          properties:
> +            compatible:
> +              contains:
> +                enum:
> +                  - ti,am654-cpsw-nuss
> +                  - ti,j721e-cpsw-nuss
> +                  - ti,am642-cpsw-nuss
> +        then:
> +          patternProperties:
> +            port@[1-2]:
> +              type: object
> +              description: CPSWxG NUSS external ports
> +
> +              $ref: ethernet-controller.yaml#
> +
> +              properties:
> +                reg:
> +                  minimum: 1
> +                  maximum: 2
> +                  description: CPSW port number
> +
> +                phys:
> +                  maxItems: 1
> +                  description: phandle on phy-gmii-sel PHY
> +
> +                label:
> +                  description: label associated with this port
> +
> +                ti,mac-only:
> +                  $ref: /schemas/types.yaml#/definitions/flag
> +                  description:
> +                    Specifies the port works in mac-only mode.
> +
> +                ti,syscon-efuse:
> +                  $ref: /schemas/types.yaml#/definitions/phandle-array
> +                  items:
> +                    - items:
> +                        - description: Phandle to the system control device node which
> +                            provides access to efuse
> +                        - description: offset to efuse registers???
> +                  description:
> +                    Phandle to the system control device node which provides access
> +                    to efuse IO range with MAC addresses
> +
> +              required:
> +                - reg
> +                - phys
> +      - if:
> +          properties:
> +            compatible:
> +              contains:
> +                enum:
> +                  - ti,j7200-cpswxg-nuss
> +        then:
> +          patternProperties:
> +            port@[1-4]:
> +              type: object
> +              description: CPSWxG NUSS external ports
> +
> +              $ref: ethernet-controller.yaml#
> +
> +              properties:
> +                reg:
> +                  minimum: 1
> +                  maximum: 4
> +                  description: CPSW port number
> +
> +                phys:
> +                  maxItems: 1
> +                  description: phandle on phy-gmii-sel PHY
> +
> +                label:
> +                  description: label associated with this port
> +
> +                ti,mac-only:
> +                  $ref: /schemas/types.yaml#/definitions/flag
> +                  description:
> +                    Specifies the port works in mac-only mode.
> +
> +                ti,syscon-efuse:
> +                  $ref: /schemas/types.yaml#/definitions/phandle-array
> +                  items:
> +                    - items:
> +                        - description: Phandle to the system control device node which
> +                            provides access to efuse
> +                        - description: offset to efuse registers???
> +                  description:
> +                    Phandle to the system control device node which provides access
> +                    to efuse IO range with MAC addresses
> +
> +              required:
> +                - reg
> +                - phys

You are now defining the same properties twice. Don't do that. Just add 
an if/then schema restrict port nodes.

Rob