dt-bindings: net: dsa: sja1105: convert to YAML schema
Subsystems (4)
Vladimir Oltean
maintainerPATCH 1/1 dt-bindings: net: dsa: sja1105: convert to YAML schema
From: Vladimir Oltean <[email protected]>
The following issues exist with the device-specific sja1105,role-mac and sja1105,role-phy:
(a) the "sja1105" is not a valid vendor prefix and should probably have been "nxp", but
(b) as per the discussion with Florian here:
https://lore.kernel.org/netdev/20210201214515.cx6ivvme2tlquge2@skbuf/
more phy-mode values similar to "revmii" can be added which denote that the port is in the role of a PHY (such as "revrmii"), making the sja1105,role-phy redundant. Because there are no upstream users (or any users at all, to my knowledge) of these properties, they could even be removed in a future commit as far as I am concerned.
(c) when I force-add sja1105,role-phy to a device tree for testing, the patternProperties matching does not work, it results in the following error:
ethernet-switch@2: ethernet-ports:port@1: 'sja1105,role-phy' does not match any of the regexes: 'pinctrl-[0-9]+'
From schema: Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
But what's even more interesting is that if I remove the "additionalProperties: true" that dsa.yaml has, I get even more validation errors coming from patternProperties not matching either, from spi-controller.yaml:
ethernet-switch@2: 'compatible', 'mdio', 'reg', 'spi-cpol', 'spi-max-frequency' do not match any of the regexes: '^(ethernet-)?ports$', 'pinctrl-[0-9]+'
So... it is probably broken. Rob Herring says here:
https://lore.kernel.org/linux-spi/[email protected]/
I'm aware of the issue, but I don't have a solution for this situation. It's a problem anywhere we have a parent or bus binding defining properties for child nodes. For now, I'd just avoid it in the examples and we'll figure out how to deal with actual dts files later.
So that's what I did.
--- .../bindings/net/dsa/nxp,sja1105.yaml | 128 ++++++++++++++ .../devicetree/bindings/net/dsa/sja1105.txt | 156 ------------------ 2 files changed, 128 insertions(+), 156 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml delete mode 100644 Documentation/devicetree/bindings/net/dsa/sja1105.txt
Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml new file +128 -0
@@ -0,0 +1,128 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/dsa/nxp,sja1105.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP SJA1105 Automotive Ethernet Switch Family Device Tree Bindings + +description: + The SJA1105 SPI interface requires a CS-to-CLK time (t2 in UM10944.pdf) of at + least one half of t_CLK. At an SPI frequency of 1MHz, this means a minimum + cs_sck_delay of 500ns. Ensuring that this SPI timing requirement is observed + depends on the SPI bus master driver. + +allOf: + - $ref: "dsa.yaml#" + +maintainers: + - Vladimir Oltean <[email protected]> + +properties: + compatible: + enum: + - nxp,sja1105e + - nxp,sja1105t + - nxp,sja1105p + - nxp,sja1105q + - nxp,sja1105r + - nxp,sja1105s + + reg: + maxItems: 1 + +patternProperties: + "^(ethernet-)?ports$": + type: object + + patternProperties: + "^(ethernet-)?port@[0-9]+$": + type: object + properties: + + # By default (unless otherwise specified) a port is configured as MAC + # if it is driving a PHY (phy-handle is present) or as PHY if it is + # PHY-less (fixed-link specified, presumably because it is connected + # to a MAC). It is suggested to not use these bindings unless an + # explicit override is necessary (for example, if SJA1105 ports are at + # both ends of a MII/RMII PHY-less setup. In that case, one end would + # need to have sja1105,role-mac, and the other sja1105,role-phy). + sja1105,role-mac: + $ref: /schemas/types.yaml#/definitions/flag + description: | + Specifies whether the SJA1105 port is a clock source or sink + for this interface, according to the applicable standard + (applicable for MII and RMII, but not applicable for RGMII + where there are separate TX and RX clocks). In the case of + RGMII it affects the behavior regarding internal delays. + If the port is configured in the role of an RGMII MAC, it will + let the PHY apply internal RGMII delays according to the + phy-mode property, otherwise it will apply the delays itself. + + sja1105,role-phy: + $ref: /schemas/types.yaml#/definitions/flag + description: + See sja1105,role-mac. + +required: + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + spi { + #address-cells = <1>; + #size-cells = <0>; + + ethernet-switch@1 { + reg = <0x1>; + #address-cells = <1>; + #size-cells = <0>; + compatible = "nxp,sja1105t"; + + ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + phy-handle = <&rgmii_phy6>; + phy-mode = "rgmii-id"; + reg = <0>; + /* Implicit "sja1105,role-mac;" */ + }; + + port@1 { + phy-handle = <&rgmii_phy3>; + phy-mode = "rgmii-id"; + reg = <1>; + /* Implicit "sja1105,role-mac;" */ + }; + + port@2 { + phy-handle = <&rgmii_phy4>; + phy-mode = "rgmii-id"; + reg = <2>; + /* Implicit "sja1105,role-mac;" */ + }; + + port@3 { + phy-mode = "rgmii-id"; + reg = <3>; + }; + + port@4 { + ethernet = <&enet2>; + phy-mode = "rgmii"; + reg = <4>; + /* Implicit "sja1105,role-phy;" */ + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; + }; + };
Documentation/devicetree/bindings/net/dsa/sja1105.txt deleted +0 -156
156 lines not on this page · raw message
Signature · 1 line
2.25.1
Rob Herring
maintainerQuoted 38 lines · Vladimir Oltean
From: Vladimir Oltean <[email protected]>
The following issues exist with the device-specific sja1105,role-mac and sja1105,role-phy:
(a) the "sja1105" is not a valid vendor prefix and should probably have been "nxp", but
(b) as per the discussion with Florian here:
https://lore.kernel.org/netdev/20210201214515.cx6ivvme2tlquge2@skbuf/
more phy-mode values similar to "revmii" can be added which denote that the port is in the role of a PHY (such as "revrmii"), making the sja1105,role-phy redundant. Because there are no upstream users (or any users at all, to my knowledge) of these properties, they could even be removed in a future commit as far as I am concerned.
(c) when I force-add sja1105,role-phy to a device tree for testing, the patternProperties matching does not work, it results in the following error:ethernet-switch@2: ethernet-ports:port@1: 'sja1105,role-phy' does not match any of the regexes: 'pinctrl-[0-9]+'
From schema:Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yamlBut what's even more interesting is that if I remove the "additionalProperties: true" that
dsa.yamlhas, I get even more validation errors coming from patternProperties not matching either, fromspi-controller.yaml:ethernet-switch@2: 'compatible', 'mdio', 'reg', 'spi-cpol', 'spi-max-frequency' do not match any of the regexes: '^(ethernet-)?ports$', 'pinctrl-[0-9]+'
So... it is probably broken. Rob Herring says here:
https://lore.kernel.org/linux-spi/[email protected]/I'm aware of the issue, but I don't have a solution for this situation. It's a problem anywhere we have a parent or bus binding defining properties for child nodes. For now, I'd just avoid it in the examples and we'll figure out how to deal with actual dts files later.
So that's what I did.
Quoted 8 lines
Signed-off-by Vladimir Oltean <[email protected]>--- .../bindings/net/dsa/nxp,sja1105.yaml | 128 ++++++++++++++ .../devicetree/bindings/net/dsa/sja1105.txt | 156 ------------------ 2 files changed, 128 insertions(+), 156 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml delete mode 100644 Documentation/devicetree/bindings/net/dsa/sja1105.txt
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/dsa/nxp,sja1105.yaml:65:17: [warning] wrong indentation: expected 14 but found 16 (indentation)
dtschema/dtc warnings/errors:
See https://patchwork.ozlabs.org/patch/1485820
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
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.
Rob Herring
maintainerQuoted 18 lines · Vladimir Oltean
From: Vladimir Oltean <[email protected]>
The following issues exist with the device-specific sja1105,role-mac and sja1105,role-phy:
(a) the "sja1105" is not a valid vendor prefix and should probably have been "nxp", but
(b) as per the discussion with Florian here:
https://lore.kernel.org/netdev/20210201214515.cx6ivvme2tlquge2@skbuf/
more phy-mode values similar to "revmii" can be added which denote that the port is in the role of a PHY (such as "revrmii"), making the sja1105,role-phy redundant. Because there are no upstream users (or any users at all, to my knowledge) of these properties, they could even be removed in a future commit as far as I am concerned.
(c) when I force-add sja1105,role-phy to a device tree for testing, the patternProperties matching does not work, it results in the following error:
Quoted 2 lines
ethernet-switch@2: ethernet-ports:port@1: 'sja1105,role-phy' does not match any of the regexes: 'pinctrl-[0-9]+'
From schema:Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
I believe that would be from 'additionalProperties: false' under "^(ethernet-)?port@[0-9]+$" in dsa.yaml. If additional properties need to be allowed, then it needs to be changed to 'true'. But if the properties aren't really used, just removing them would be better. But maybe there's other DSA users with custom properties.
Quoted 5 lines
But what's even more interesting is that if I remove the "additionalProperties: true" that
dsa.yamlhas, I get even more validation errors coming from patternProperties not matching either, fromspi-controller.yaml:
Why would you do that?
Quoted 10 lines
ethernet-switch@2: 'compatible', 'mdio', 'reg', 'spi-cpol', 'spi-max-frequency' do not match any of the regexes: '^(ethernet-)?ports$', 'pinctrl-[0-9]+'
So... it is probably broken. Rob Herring says here:
https://lore.kernel.org/linux-spi/[email protected]/I'm aware of the issue, but I don't have a solution for this situation. It's a problem anywhere we have a parent or bus binding defining properties for child nodes. For now, I'd just avoid it in the examples and we'll figure out how to deal with actual dts files later.
That was mainly in reference to vendor specific SPI master properties.
For 'spi-cpol', that generally shouldn't be needed. A given device generally only supports 1 mode and the driver should know that. IOW, it can be implied from the compatible. There's of course some exceptions.
For 'spi-max-frequency', just add 'spi-max-frequency: true' (or provide some constraints as to what the max is.
Rob