Re: [PATCH net-next v2 07/10] dt-bindings: net: enforce phylink bindings on certain ethernet controllers

From: Rob Herring
Date: Sat Sep 16 2023 - 11:11:19 EST



On Sat, 16 Sep 2023 14:08:59 +0300, Arınç ÜNAL wrote:
> Phylink bindings are required for ethernet controllers that utilise
> phylink_fwnode_phy_connect() directly or through phylink_of_phy_connect(),
> and register OF-based only MDIO buses, if they register any.
>
> All the drivers that utilise phylink_fwnode_phy_connect() directly or
> through phylink_of_phy_connect():
>
> - DSA
> - drivers/net/ethernet/mscc/ocelot_net.c
> - mscc,vsc7514-switch.yaml
> - drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c
> - microchip,sparx5-switch.yaml
> - drivers/net/ethernet/altera/altera_tse_main.c
> - altr,tse.yaml
> - drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> - xlnx,axi-ethernet.yaml
> - drivers/net/ethernet/mediatek/mtk_eth_soc.c
> - mediatek,net.yaml
> - drivers/net/ethernet/ti/am65-cpsw-nuss.c
> - ti,k3-am654-cpsw-nuss.yaml
> - drivers/net/ethernet/atheros/ag71xx.c
> - qca,ar71xx.yaml
> - drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> - fsl,fman-dtsec.yaml
> - drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> - microchip,lan966x-switch.yaml
> - drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> - marvell,pp2.yaml
> - drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
> - fsl,qoriq-mc-dpmac.yaml
> - drivers/net/ethernet/cadence/macb_main.c
> - cdns,macb.yaml
> - Can register non-OF-based bus.
> - drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> - snps,dwmac.yaml
> - Can register non-OF-based bus.
> - drivers/net/ethernet/marvell/mvneta.c
> - marvell-armada-370-neta.txt
> - drivers/net/ethernet/freescale/enetc/enetc.c
> - fsl-enetc.txt
>
> RFC: The drivers marked with "can register non-OF-based bus" seem to search
> the MDIO bus to connect the PHY to the MAC using phylink_connect_phy()
> and/or phy_find_first() if phylink bindings don't exist. Should we enforce
> phylink bindings on their schemas regardless?
>
> DSA, like any other driver utilising the Linux MDIO infrastructure,
> can register a bus. On certain conditions, it registers the MDIO
> bus of the switch it controls non-OF-based.
>
> We can know when DSA won't create any non-OF-based buses. That leaves us
> with only OF-based buses in which case we can enforce phylink bindings for
> user ports. The bindings are already enforced for shared ports so we can
> enforce the bindings for all ports on the switch schemas which will achieve
> the same result with fewer lines.
>
> By looking at whether the mdio child node exists and what is explained on
> it, we can enforce phylink bindings.
>
> - mscc,vsc7514-switch.yaml
> - Enforce phylink bindings for all ports.
>
> - arrow,xrs700x.yaml
> - Enforce phylink bindings for all ports.
>
> - brcm,b53.yaml
> - Enforce phylink bindings for all ports if "mdio" is defined.
>
> - brcm,sf2.yaml
> - Enforce phylink bindings for all ports.
>
> - hirschmann,hellcreek.yaml
> - Enforce phylink bindings for all ports.
>
> - mediatek,mt7530.yaml
> - Enforce phylink bindings for all ports if "mdio" is defined.
>
> - microchip,ksz.yaml
> - Enforce phylink bindings for all ports if "mdio" is defined.
>
> - microchip,lan937x.yaml
> - Enforce phylink bindings for all ports if "mdio" is defined.
>
> - mscc,ocelot.yaml
> - Enforce phylink bindings for all ports.
>
> - nxp,sja1105.yaml
> - Enforce phylink bindings for all ports.
>
> - qca8k.yaml
> - Enforce phylink bindings for all ports if "mdio" is defined.
>
> - realtek.yaml
> - Enforce phylink bindings for all ports if "mdio" is defined.
>
> - renesas,rzn1-a5psw.yaml
> - Enforce phylink bindings for all ports.
>
> - ar9331.txt
> - Enforce phylink bindings for all ports.
>
> - lan9303.txt
> - Enforce phylink bindings for all ports if "mdio" is defined.
>
> - lantiq-gswip.txt
> - Enforce phylink bindings for all ports.
>
> - marvell.txt
> - Enforce phylink bindings for all ports if "mdio" is defined.
>
> - vitesse,vsc73xx.txt
> - Enforce phylink bindings for all ports if "mdio" is defined.
>
> I will convert the non json-schema documents accordingly.
>
> Signed-off-by: Arınç ÜNAL <arinc.unal@xxxxxxxxxx>
> ---
> .../devicetree/bindings/net/altr,tse.yaml | 1 +
> .../devicetree/bindings/net/cdns,macb.yaml | 1 +
> .../bindings/net/dsa/arrow,xrs700x.yaml | 6 ++
> .../devicetree/bindings/net/dsa/brcm,b53.yaml | 9 +++
> .../devicetree/bindings/net/dsa/brcm,sf2.yaml | 6 +-
> .../net/dsa/hirschmann,hellcreek.yaml | 6 ++
> .../bindings/net/dsa/mediatek,mt7530.yaml | 9 +++
> .../bindings/net/dsa/microchip,ksz.yaml | 9 +++
> .../bindings/net/dsa/microchip,lan937x.yaml | 9 +++
> .../bindings/net/dsa/mscc,ocelot.yaml | 6 ++
> .../bindings/net/dsa/nxp,sja1105.yaml | 1 +
> .../devicetree/bindings/net/dsa/qca8k.yaml | 9 +++
> .../devicetree/bindings/net/dsa/realtek.yaml | 57 +++++++++++--------
> .../bindings/net/dsa/renesas,rzn1-a5psw.yaml | 2 +-
> .../bindings/net/fsl,fman-dtsec.yaml | 1 +
> .../bindings/net/fsl,qoriq-mc-dpmac.yaml | 1 +
> .../devicetree/bindings/net/marvell,pp2.yaml | 4 +-
> .../devicetree/bindings/net/mediatek,net.yaml | 1 +
> .../net/microchip,lan966x-switch.yaml | 4 +-
> .../bindings/net/microchip,sparx5-switch.yaml | 5 +-
> .../bindings/net/mscc,vsc7514-switch.yaml | 5 ++
> .../devicetree/bindings/net/qca,ar71xx.yaml | 1 +
> .../devicetree/bindings/net/snps,dwmac.yaml | 1 +
> .../bindings/net/ti,k3-am654-cpsw-nuss.yaml | 4 +-
> .../bindings/net/xlnx,axi-ethernet.yaml | 3 +-
> 25 files changed, 130 insertions(+), 31 deletions(-)
>

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:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/stm32-dwmac.example.dtb: ethernet@5800a000: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/stm32-dwmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/stm32-dwmac.example.dtb: ethernet@5800a000: Unevaluated properties are not allowed ('interrupt-names', 'interrupts', 'phy-mode', 'snps,axi-config', 'snps,pbl', 'snps,tso' were unexpected)
from schema $id: http://devicetree.org/schemas/net/stm32-dwmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/stm32-dwmac.example.dtb: ethernet@5800a000: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/snps,dwmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/stm32-dwmac.example.dtb: ethernet@40028000: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/stm32-dwmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/stm32-dwmac.example.dtb: ethernet@40028000: Unevaluated properties are not allowed ('interrupt-names', 'interrupts', 'phy-mode', 'snps,mixed-burst', 'snps,pbl' were unexpected)
from schema $id: http://devicetree.org/schemas/net/stm32-dwmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/stm32-dwmac.example.dtb: ethernet@40028000: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/snps,dwmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/stm32-dwmac.example.dtb: ethernet@40027000: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/stm32-dwmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/stm32-dwmac.example.dtb: ethernet@40027000: Unevaluated properties are not allowed ('interrupt-names', 'interrupts', 'phy-mode', 'snps,pbl' were unexpected)
from schema $id: http://devicetree.org/schemas/net/stm32-dwmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/stm32-dwmac.example.dtb: ethernet@40027000: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/snps,dwmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/cdns,macb.example.dtb: ethernet@fffc4000: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/cdns,macb.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/marvell,pp2.example.dtb: ethernet@f0000: ethernet-port@0: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/marvell,pp2.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/marvell,pp2.example.dtb: ethernet@f0000: ethernet-port@1: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/marvell,pp2.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/marvell,pp2.example.dtb: ethernet@0: ethernet-port@0: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/marvell,pp2.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/marvell,pp2.example.dtb: ethernet@0: ethernet-port@1: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/marvell,pp2.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/nxp,dwmac-imx.example.dtb: ethernet@30bf0000: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/nxp,dwmac-imx.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/nxp,dwmac-imx.example.dtb: ethernet@30bf0000: Unevaluated properties are not allowed ('interrupt-names', 'interrupts', 'phy-mode', 'reg' were unexpected)
from schema $id: http://devicetree.org/schemas/net/nxp,dwmac-imx.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/nxp,dwmac-imx.example.dtb: ethernet@30bf0000: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/snps,dwmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/rockchip-dwmac.example.dtb: ethernet@ff290000: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/rockchip-dwmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/rockchip-dwmac.example.dtb: ethernet@ff290000: Unevaluated properties are not allowed ('interrupt-names', 'interrupts', 'phy-mode', 'reg' were unexpected)
from schema $id: http://devicetree.org/schemas/net/rockchip-dwmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.example.dtb: ethernet@c9410000: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/amlogic,meson-dwmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.example.dtb: ethernet@c9410000: Unevaluated properties are not allowed ('interrupt-names', 'interrupts', 'phy-mode' were unexpected)
from schema $id: http://devicetree.org/schemas/net/amlogic,meson-dwmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.example.dtb: ethernet@c9410000: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/snps,dwmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/snps,dwmac.example.dtb: ethernet@e0800000: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/snps,dwmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/allwinner,sun7i-a20-gmac.example.dtb: ethernet@1c50000: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/allwinner,sun7i-a20-gmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/allwinner,sun7i-a20-gmac.example.dtb: ethernet@1c50000: Unevaluated properties are not allowed ('phy-mode' was unexpected)
from schema $id: http://devicetree.org/schemas/net/allwinner,sun7i-a20-gmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/snps,dwmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: 'anyOf' conditional failed, one must be fixed:
'fixed-link' is a required property
'pcs-handle' is a required property
'tbi-handle' is a required property
'phy-handle' is a required property
'sfp' is a required property
'managed' is a required property
from schema $id: http://devicetree.org/schemas/net/mediatek-dwmac.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mediatek-dwmac.example.dtb: ethernet@1101c000: Unevaluated properties are not allowed ('interrupt-names', 'interrupts', 'mac-address', 'phy-mode', 'reg', 'snps,reset-delays-us', 'snps,reset-gpio', 'snps,rxpbl', 'snps,txpbl' were unexpected)
from schema $id: http://devicetree.org/schemas/net/mediatek-dwmac.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230916110902.234273-8-arinc.unal@xxxxxxxxxx

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.