The aspeed,ast2400-mac, aspeed,ast2500-mac, and aspeed,ast2600-mac compatibles are currently only valid when paired with the generic "faraday,ftgmac100" fallback: if a node ever bound through the generic entry alone, ftgmac100_probe() would set rxdes0_edorr_mask/txdes0_edotr_mask to BIT(15) instead of the Aspeed BIT(30), skip Aspeed clock setup, and leave the DMA mask too narrow. Make each of them a standalone compatible instead, so none of the Aspeed compatibles require the generic fallback alongside them. Now that the Aspeed compatibles no longer need the generic fallback, also constrain the clocks and clock-names properties per compatible instead of leaving them generically optional: aspeed,ast2400-mac takes exactly one clock, aspeed,ast2500-mac and aspeed,ast2600-mac take one or two, and the plain faraday,ftgmac100 compatible takes none. Require clock-names whenever two clocks are listed. Acked-by: Conor Dooley Signed-off-by: Jacky Chou --- ftgmac100_of_match[] has had dedicated entries for AST2400, AST2500, and AST2600 since commit 03a2aba50b2c ("net: ftgmac100: List all compatibles"), so there is no known kernel + devicetree combination where a node has actually bound through the generic entry and gotten the wrong EDORR bit. This part is a binding correctness fix, not a fix for an observed failure. Note that arch/arm/boot/dts/aspeed/aspeed-g4.dtsi, aspeed-g5.dtsi, and aspeed-g6.dtsi still declare their MAC nodes with the two-string "aspeed,astXXXX-mac", "faraday,ftgmac100" compatible, so this will make dtbs_check warn against those files until the redundant fallback compatible is dropped there as well. That .dtsi change will be sent as a separate series through the Aspeed/arm-soc tree, since dt-bindings changes don't go through that tree. --- .../devicetree/bindings/net/faraday,ftgmac100.yaml | 71 +++++++++++++++++++--- 1 file changed, 61 insertions(+), 10 deletions(-) diff --git a/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml b/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml index d14410018bcf..9d352e3686aa 100644 --- a/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml +++ b/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml @@ -11,14 +11,11 @@ maintainers: properties: compatible: - oneOf: - - const: faraday,ftgmac100 - - items: - - enum: - - aspeed,ast2400-mac - - aspeed,ast2500-mac - - aspeed,ast2600-mac - - const: faraday,ftgmac100 + enum: + - faraday,ftgmac100 + - aspeed,ast2400-mac + - aspeed,ast2500-mac + - aspeed,ast2600-mac reg: maxItems: 1 @@ -88,22 +85,76 @@ allOf: else: properties: resets: false + - if: + properties: + compatible: + contains: + const: aspeed,ast2400-mac + then: + properties: + clocks: + maxItems: 1 + clock-names: + maxItems: 1 + required: + - clocks + - if: + properties: + compatible: + contains: + enum: + - aspeed,ast2500-mac + - aspeed,ast2600-mac + then: + properties: + clocks: + minItems: 1 + maxItems: 2 + clock-names: + minItems: 1 + maxItems: 2 + required: + - clocks + - if: + not: + properties: + compatible: + contains: + enum: + - aspeed,ast2400-mac + - aspeed,ast2500-mac + - aspeed,ast2600-mac + then: + properties: + clocks: false + clock-names: false + - if: + properties: + clocks: + minItems: 2 + then: + required: + - clock-names unevaluatedProperties: false examples: - | + #include + ethernet@1e660000 { - compatible = "aspeed,ast2500-mac", "faraday,ftgmac100"; + compatible = "aspeed,ast2500-mac"; reg = <0x1e660000 0x180>; interrupts = <2>; + clocks = <&syscon ASPEED_CLK_GATE_MAC1CLK>; use-ncsi; }; ethernet@1e680000 { - compatible = "aspeed,ast2500-mac", "faraday,ftgmac100"; + compatible = "aspeed,ast2500-mac"; reg = <0x1e680000 0x180>; interrupts = <2>; + clocks = <&syscon ASPEED_CLK_GATE_MAC2CLK>; phy-handle = <&phy>; phy-mode = "rgmii"; -- 2.34.1