[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL_JsqL8ARs3jQECS+E-BtZGouLYJhofM+oPpS1a3SxPORwMZA@mail.gmail.com>
Date: Mon, 10 Jun 2019 13:22:00 -0600
From: Rob Herring <robh+dt@...nel.org>
To: Maxime Ripard <maxime.ripard@...tlin.com>
Cc: Mark Rutland <mark.rutland@....com>,
Frank Rowand <frowand.list@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Chen-Yu Tsai <wens@...e.org>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...com>,
netdev <netdev@...r.kernel.org>,
"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE"
<linux-arm-kernel@...ts.infradead.org>, devicetree@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
Maxime Chevallier <maxime.chevallier@...tlin.com>,
Antoine Ténart <antoine.tenart@...tlin.com>,
Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Heiner Kallweit <hkallweit1@...il.com>
Subject: Re: [PATCH v2 09/11] dt-bindings: net: sun8i-emac: Convert the
binding to a schemas
On Mon, Jun 10, 2019 at 3:26 AM Maxime Ripard <maxime.ripard@...tlin.com> wrote:
>
> Switch our Allwinner H3 EMAC controller binding to a YAML schema to enable
> the DT validation. Since that controller is based on a Synopsys IP, let's
> add the validation to that schemas with a bunch of conditionals.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@...tlin.com>
>
> ---
>
> Changes from v1:
> - Add specific binding document
> ---
> Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml | 353 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
> Documentation/devicetree/bindings/net/dwmac-sun8i.txt | 201 +-----------------------------------------
> Documentation/devicetree/bindings/net/snps,dwmac.yaml | 15 +++-
> 3 files changed, 368 insertions(+), 201 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml
> delete mode 100644 Documentation/devicetree/bindings/net/dwmac-sun8i.txt
>
> diff --git a/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml b/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml
> new file mode 100644
> index 000000000000..814cfb862e4f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml
> @@ -0,0 +1,353 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/allwinner,sun8i-a83t-gmac.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Allwinner A83t EMAC Device Tree Bindings
> +
> +maintainers:
> + - Chen-Yu Tsai <wens@...e.org>
> + - Maxime Ripard <maxime.ripard@...tlin.com>
> +
> +properties:
> + compatible:
> + oneOf:
> + - const: allwinner,sun8i-a83t-emac
> + - const: allwinner,sun8i-h3-emac
> + - const: allwinner,sun8i-r40-emac
> + - const: allwinner,sun8i-v3s-emac
> + - const: allwinner,sun50i-a64-emac
> + - items:
> + - const: allwinner,sun50i-h6-emac
> + - const: allwinner,sun50i-a64-emac
> +
> + reg:
> + maxItems: 1
> +
> + interrupts:
> + maxItems: 1
> +
> + interrupt-names:
> + const: macirq
> +
> + clocks:
> + maxItems: 1
> +
> + clock-names:
> + const: stmmaceth
> +
> + syscon:
> + $ref: /schemas/types.yaml#definitions/phandle
> + description:
> + Phandle to the device containing the EMAC or GMAC clock
> + register
> +
> +required:
> + - compatible
> + - reg
> + - interrupts
> + - interrupt-names
> + - clocks
> + - clock-names
> + - resets
> + - reset-names
> + - phy-mode
> + - phy-handle
> + - syscon
> +
> +allOf:
> + - $ref: "snps,dwmac.yaml#"
> + - if:
> + properties:
> + compatible:
> + contains:
> + enum:
> + - allwinner,sun8i-a83t-emac
> + - allwinner,sun8i-h3-emac
> + - allwinner,sun8i-v3s-emac
> + - allwinner,sun50i-a64-emac
> +
> + then:
> + properties:
> + allwinner,tx-delay-ps:
> + allOf:
> + - $ref: /schemas/types.yaml#definitions/uint32
Can drop this as anything with unit prefix has its type defined already.
> + - enum: [0, 100, 200, 300, 400, 500, 600, 700]
> + default: 0
> + description:
> + External RGMII PHY TX clock delay chain value in ps.
> +
> + allwinner,rx-delay-ps:
> + allOf:
> + - $ref: /schemas/types.yaml#definitions/uint32
> + - enum:
> + - 0
> + - 100
> + - 200
> + - 300
> + - 400
> + - 500
> + - 600
> + - 700
> + - 800
> + - 900
> + - 1000
> + - 1100
> + - 1200
> + - 1300
> + - 1400
> + - 1500
> + - 1600
> + - 1700
> + - 1800
> + - 1900
> + - 2000
> + - 2100
> + - 2200
> + - 2300
> + - 2400
> + - 2500
> + - 2600
> + - 2700
> + - 2800
> + - 2900
> + - 3000
> + - 3100
I think you can do
enum: [1, 2, 3,
4, 5, 6]
Or you can do:
minimum: 0
maximum: 3100
multipleOf: 100
IIRC that multipleOf is a json-schema key.
> + default: 0
> + description:
> + External RGMII PHY TX clock delay chain value in ps.
> +
> + - if:
> + properties:
> + compatible:
> + contains:
> + enum:
> + - allwinner,sun8i-r40-emac
> +
> + then:
> + properties:
> + allwinner,rx-delay-ps:
> + allOf:
> + - $ref: /schemas/types.yaml#definitions/uint32
> + - enum: [0, 100, 200, 300, 400, 500, 600, 700]
> + default: 0
> + description:
> + External RGMII PHY TX clock delay chain value in ps.
> +
> + - if:
> + properties:
> + compatible:
> + contains:
> + enum:
> + - allwinner,sun8i-h3-emac
> + - allwinner,sun8i-v3s-emac
> +
> + then:
> + properties:
> + allwinner,leds-active-low:
> + $ref: /schemas/types.yaml#definitions/flag
> + description:
> + EPHY LEDs are active low.
> +
> + mdio-mux:
> + type: object
> +
> + properties:
> + compatible:
> + const: allwinner,sun8i-h3-mdio-mux
> +
> + mdio-parent-bus:
> + $ref: /schemas/types.yaml#definitions/phandle
> + description:
> + Phandle to EMAC MDIO.
> +
> + mdio@1:
> + type: object
> + description: Internal MDIO Bus
> +
> + properties:
> + "#address-cells":
> + const: 1
> +
> + "#size-cells":
> + const: 0
> +
> + compatible:
> + const: allwinner,sun8i-h3-mdio-internal
> +
> + reg:
> + const: 1
> +
> + patternProperties:
> + "^ethernet-phy@[0-9a-f]$":
> + type: object
> + description:
> + Integrated PHY node
> +
> + properties:
> + clocks:
> + maxItems: 1
> +
> + resets:
> + maxItems: 1
> +
> + required:
> + - clocks
> + - resets
> +
> +
> + mdio@2:
> + type: object
> + description: External MDIO Bus (H3 only)
> +
> + properties:
> + "#address-cells":
> + const: 1
> +
> + "#size-cells":
> + const: 0
> +
> + reg:
> + const: 2
> +
> + required:
> + - compatible
> + - mdio-parent-bus
> + - mdio@1
> +
Powered by blists - more mailing lists