diff mbox series

[net-next,RFC,02/14] dt-bindings: net: move PHY modes to common PHY mode types definition

Message ID 20231120135041.15259-3-ansuelsmth@gmail.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: phy: Support DT PHY package | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/codegen success Generated files up to date
netdev/tree_selection success Clearly marked for net-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers success CCed 12 of 12 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch warning WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Christian Marangi Nov. 20, 2023, 1:50 p.m. UTC
Move PHY modes from ethernet-controller schema to dedicated common PHY
mode types definition. This is needed to have a centralized place to
define PHY interface mode and permit usage and reference of these modes
in other schemas.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 .../bindings/net/ethernet-controller.yaml     |  47 +------
 .../bindings/net/ethernet-phy-mode-types.yaml | 132 ++++++++++++++++++
 2 files changed, 133 insertions(+), 46 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/ethernet-phy-mode-types.yaml

Comments

Rob Herring Nov. 20, 2023, 3:14 p.m. UTC | #1
On Mon, 20 Nov 2023 14:50:29 +0100, Christian Marangi wrote:
> Move PHY modes from ethernet-controller schema to dedicated common PHY
> mode types definition. This is needed to have a centralized place to
> define PHY interface mode and permit usage and reference of these modes
> in other schemas.
> 
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
>  .../bindings/net/ethernet-controller.yaml     |  47 +------
>  .../bindings/net/ethernet-phy-mode-types.yaml | 132 ++++++++++++++++++
>  2 files changed, 133 insertions(+), 46 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/net/ethernet-phy-mode-types.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:
./Documentation/devicetree/bindings/net/ethernet-phy-mode-types.yaml:21:9: [warning] wrong indentation: expected 10 but found 8 (indentation)

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/ethernet-phy-mode-types.yaml: 'oneOf' conditional failed, one must be fixed:
	'unevaluatedProperties' is a required property
	'additionalProperties' is a required property
	hint: Either unevaluatedProperties or additionalProperties must be present
	from schema $id: http://devicetree.org/meta-schemas/core.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/ethernet-phy-mode-types.yaml: 'anyOf' conditional failed, one must be fixed:
	'properties' is a required property
	'patternProperties' is a required property
	hint: Metaschema for devicetree binding documentation
	from schema $id: http://devicetree.org/meta-schemas/core.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20231120135041.15259-3-ansuelsmth@gmail.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
Rob Herring Nov. 20, 2023, 5:30 p.m. UTC | #2
On Mon, Nov 20, 2023 at 02:50:29PM +0100, Christian Marangi wrote:
> Move PHY modes from ethernet-controller schema to dedicated common PHY
> mode types definition. This is needed to have a centralized place to
> define PHY interface mode and permit usage and reference of these modes
> in other schemas.
> 
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
>  .../bindings/net/ethernet-controller.yaml     |  47 +------
>  .../bindings/net/ethernet-phy-mode-types.yaml | 132 ++++++++++++++++++
>  2 files changed, 133 insertions(+), 46 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/net/ethernet-phy-mode-types.yaml
> 
> diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
> index 9f6a5ccbcefe..40c1daff2a48 100644
> --- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml
> +++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
> @@ -55,55 +55,10 @@ properties:
>      const: mac-address
>  
>    phy-connection-type:
> +    $ref: /schemas/net/ethernet-phy-mode-types.yaml#definitions/phy-connection-type

You need a '/' after '#' or it is not a JSON pointer.

>      description:
>        Specifies interface type between the Ethernet device and a physical
>        layer (PHY) device.
> -    enum:
> -      # There is not a standard bus between the MAC and the PHY,
> -      # something proprietary is being used to embed the PHY in the
> -      # MAC.
> -      - internal
> -      - mii
> -      - gmii
> -      - sgmii
> -      - psgmii
> -      - qsgmii
> -      - qusgmii
> -      - tbi
> -      - rev-mii
> -      - rmii
> -      - rev-rmii
> -      - moca
> -
> -      # RX and TX delays are added by the MAC when required
> -      - rgmii
> -
> -      # RGMII with internal RX and TX delays provided by the PHY,
> -      # the MAC should not add the RX or TX delays in this case
> -      - rgmii-id
> -
> -      # RGMII with internal RX delay provided by the PHY, the MAC
> -      # should not add an RX delay in this case
> -      - rgmii-rxid
> -
> -      # RGMII with internal TX delay provided by the PHY, the MAC
> -      # should not add an TX delay in this case
> -      - rgmii-txid
> -      - rtbi
> -      - smii
> -      - xgmii
> -      - trgmii
> -      - 1000base-x
> -      - 2500base-x
> -      - 5gbase-r
> -      - rxaui
> -      - xaui
> -
> -      # 10GBASE-KR, XFI, SFI
> -      - 10gbase-kr
> -      - usxgmii
> -      - 10gbase-r
> -      - 25gbase-r
>  
>    phy-mode:
>      $ref: "#/properties/phy-connection-type"
> diff --git a/Documentation/devicetree/bindings/net/ethernet-phy-mode-types.yaml b/Documentation/devicetree/bindings/net/ethernet-phy-mode-types.yaml
> new file mode 100644
> index 000000000000..6d15743b4ffa
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/ethernet-phy-mode-types.yaml
> @@ -0,0 +1,132 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/ethernet-phy-mode-types.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Ethernet PHY Common Mode Types
> +
> +maintainers:
> +  - David S. Miller <davem@davemloft.net>
> +
> +definitions:

Use '$defs'

'definitions' is special in that we don't process it at all. That's 
probably why you ended up with this overly complicated schema below.

But really, there's no need to use $defs or definitions at all here. 
Just put it under 'properties' And move the references up a level (i.e. 
to the node, not a property).

> +  phy-connection-type:
> +    # const: "internal"
> +    allOf:
> +      - $ref: /schemas/types.yaml#/definitions/string
> +      - oneOf:
> +        # There is not a standard bus between the MAC and the PHY,
> +        # something proprietary is being used to embed the PHY in the
> +        # MAC.
> +        - items:

'items' is for arrays, but you just said this is a 'string', not 
'string-array'. 

> +            - type: string

Already covered by the type $ref.

This can all be expressed with just 1 'enum' as it was before.

> +              const: internal
> +        - items:
> +            - type: string
> +              const: mii
> +        - items:
> +            - type: string
> +              const: gmii
> +        - items:
> +            - type: string
> +              const: sgmii
> +        - items:
> +            - type: string
> +              const: psgmii
> +        - items:
> +            - type: string
> +              const: qsgmii
> +        - items:
> +            - type: string
> +              const: qusgmii
> +        - items:
> +            - type: string
> +              const: tbi
> +        - items:
> +            - type: string
> +              const: rev-mii
> +        - items:
> +            - type: string
> +              const: rmii
> +        - items:
> +            - type: string
> +              const: rev-rmii
> +        - items:
> +            - type: string
> +              const: moca
> +
> +        # RX and TX delays are added by the MAC when required
> +        - items:
> +            - type: string
> +              const: rgmii
> +
> +        # RGMII with internal RX and TX delays provided by the PHY,
> +        # the MAC should not add the RX or TX delays in this case
> +        - items:
> +            - type: string
> +              const: rgmii-id
> +
> +        # RGMII with internal RX delay provided by the PHY, the MAC
> +        # should not add an RX delay in this case
> +        - items:
> +            - type: string
> +              const: rgmii-rxid
> +
> +        # RGMII with internal TX delay provided by the PHY, the MAC
> +        # should not add an TX delay in this case
> +        - items:
> +            - type: string
> +              const: rgmii-txid
> +
> +        - items:
> +            - type: string
> +              const: rtbi
> +
> +        - items:
> +            - type: string
> +              const: smii
> +
> +        - items:
> +            - type: string
> +              const: xgmii
> +
> +        - items:
> +            - type: string
> +              const: trgmii
> +
> +        - items:
> +            - type: string
> +              const: 1000base-x
> +
> +        - items:
> +            - type: string
> +              const: 2500base-x
> +
> +        - items:
> +            - type: string
> +              const: 5gbase-r
> +
> +        - items:
> +            - type: string
> +              const: rxaui
> +
> +        - items:
> +            - type: string
> +              const: xaui
> +
> +        # 10GBASE-KR, XFI, SFI
> +        - items:
> +            - type: string
> +              const: 10gbase-kr
> +
> +        - items:
> +            - type: string
> +              const: usxgmii
> +
> +        - items:
> +            - type: string
> +              const: 10gbase-r
> +
> +        - items:
> +            - type: string
> +              const: 25gbase-r
> -- 
> 2.40.1
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
index 9f6a5ccbcefe..40c1daff2a48 100644
--- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml
+++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
@@ -55,55 +55,10 @@  properties:
     const: mac-address
 
   phy-connection-type:
+    $ref: /schemas/net/ethernet-phy-mode-types.yaml#definitions/phy-connection-type
     description:
       Specifies interface type between the Ethernet device and a physical
       layer (PHY) device.
-    enum:
-      # There is not a standard bus between the MAC and the PHY,
-      # something proprietary is being used to embed the PHY in the
-      # MAC.
-      - internal
-      - mii
-      - gmii
-      - sgmii
-      - psgmii
-      - qsgmii
-      - qusgmii
-      - tbi
-      - rev-mii
-      - rmii
-      - rev-rmii
-      - moca
-
-      # RX and TX delays are added by the MAC when required
-      - rgmii
-
-      # RGMII with internal RX and TX delays provided by the PHY,
-      # the MAC should not add the RX or TX delays in this case
-      - rgmii-id
-
-      # RGMII with internal RX delay provided by the PHY, the MAC
-      # should not add an RX delay in this case
-      - rgmii-rxid
-
-      # RGMII with internal TX delay provided by the PHY, the MAC
-      # should not add an TX delay in this case
-      - rgmii-txid
-      - rtbi
-      - smii
-      - xgmii
-      - trgmii
-      - 1000base-x
-      - 2500base-x
-      - 5gbase-r
-      - rxaui
-      - xaui
-
-      # 10GBASE-KR, XFI, SFI
-      - 10gbase-kr
-      - usxgmii
-      - 10gbase-r
-      - 25gbase-r
 
   phy-mode:
     $ref: "#/properties/phy-connection-type"
diff --git a/Documentation/devicetree/bindings/net/ethernet-phy-mode-types.yaml b/Documentation/devicetree/bindings/net/ethernet-phy-mode-types.yaml
new file mode 100644
index 000000000000..6d15743b4ffa
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/ethernet-phy-mode-types.yaml
@@ -0,0 +1,132 @@ 
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/ethernet-phy-mode-types.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Ethernet PHY Common Mode Types
+
+maintainers:
+  - David S. Miller <davem@davemloft.net>
+
+definitions:
+  phy-connection-type:
+    # const: "internal"
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/string
+      - oneOf:
+        # There is not a standard bus between the MAC and the PHY,
+        # something proprietary is being used to embed the PHY in the
+        # MAC.
+        - items:
+            - type: string
+              const: internal
+        - items:
+            - type: string
+              const: mii
+        - items:
+            - type: string
+              const: gmii
+        - items:
+            - type: string
+              const: sgmii
+        - items:
+            - type: string
+              const: psgmii
+        - items:
+            - type: string
+              const: qsgmii
+        - items:
+            - type: string
+              const: qusgmii
+        - items:
+            - type: string
+              const: tbi
+        - items:
+            - type: string
+              const: rev-mii
+        - items:
+            - type: string
+              const: rmii
+        - items:
+            - type: string
+              const: rev-rmii
+        - items:
+            - type: string
+              const: moca
+
+        # RX and TX delays are added by the MAC when required
+        - items:
+            - type: string
+              const: rgmii
+
+        # RGMII with internal RX and TX delays provided by the PHY,
+        # the MAC should not add the RX or TX delays in this case
+        - items:
+            - type: string
+              const: rgmii-id
+
+        # RGMII with internal RX delay provided by the PHY, the MAC
+        # should not add an RX delay in this case
+        - items:
+            - type: string
+              const: rgmii-rxid
+
+        # RGMII with internal TX delay provided by the PHY, the MAC
+        # should not add an TX delay in this case
+        - items:
+            - type: string
+              const: rgmii-txid
+
+        - items:
+            - type: string
+              const: rtbi
+
+        - items:
+            - type: string
+              const: smii
+
+        - items:
+            - type: string
+              const: xgmii
+
+        - items:
+            - type: string
+              const: trgmii
+
+        - items:
+            - type: string
+              const: 1000base-x
+
+        - items:
+            - type: string
+              const: 2500base-x
+
+        - items:
+            - type: string
+              const: 5gbase-r
+
+        - items:
+            - type: string
+              const: rxaui
+
+        - items:
+            - type: string
+              const: xaui
+
+        # 10GBASE-KR, XFI, SFI
+        - items:
+            - type: string
+              const: 10gbase-kr
+
+        - items:
+            - type: string
+              const: usxgmii
+
+        - items:
+            - type: string
+              const: 10gbase-r
+
+        - items:
+            - type: string
+              const: 25gbase-r