dt-bindings: net: sun7i-gmac: Convert the binding to a schemas

Switch our Allwinner A20 GMAC 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.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Rob Herring <robh@kernel.org>
This commit is contained in:
Maxime Ripard 2019-06-27 17:31:51 +02:00 committed by Rob Herring
parent 7db3545aef
commit 4b859450fa
3 changed files with 68 additions and 27 deletions

View File

@ -1,27 +0,0 @@
* Allwinner GMAC ethernet controller
This device is a platform glue layer for stmmac.
Please see stmmac.txt for the other unchanged properties.
Required properties:
- compatible: Should be "allwinner,sun7i-a20-gmac"
- clocks: Should contain the GMAC main clock, and tx clock
The tx clock type should be "allwinner,sun7i-a20-gmac-clk"
- clock-names: Should contain the clock names "stmmaceth",
and "allwinner_gmac_tx"
Optional properties:
- phy-supply: phandle to a regulator if the PHY needs one
Examples:
gmac: ethernet@1c50000 {
compatible = "allwinner,sun7i-a20-gmac";
reg = <0x01c50000 0x10000>,
<0x01c20164 0x4>;
interrupts = <0 85 1>;
interrupt-names = "macirq";
clocks = <&ahb_gates 49>, <&gmac_tx>;
clock-names = "stmmaceth", "allwinner_gmac_tx";
phy-mode = "mii";
};

View File

@ -0,0 +1,65 @@
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/net/allwinner,sun7i-a20-gmac.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Allwinner A20 GMAC Device Tree Bindings
allOf:
- $ref: "snps,dwmac.yaml#"
maintainers:
- Chen-Yu Tsai <wens@csie.org>
- Maxime Ripard <maxime.ripard@bootlin.com>
properties:
compatible:
const: allwinner,sun7i-a20-gmac
interrupts:
maxItems: 1
interrupt-names:
const: macirq
clocks:
items:
- description: GMAC main clock
- description: TX clock
clock-names:
items:
- const: stmmaceth
- const: allwinner_gmac_tx
phy-supply:
description:
PHY regulator
required:
- compatible
- reg
- interrupts
- interrupt-names
- clocks
- clock-names
- phy-connection-type
examples:
- |
gmac: ethernet@1c50000 {
compatible = "allwinner,sun7i-a20-gmac";
reg = <0x01c50000 0x10000>;
interrupts = <0 85 1>;
interrupt-names = "macirq";
clocks = <&ahb_gates 49>, <&gmac_tx>;
clock-names = "stmmaceth", "allwinner_gmac_tx";
phy-connection-type = "mii";
};
# FIXME: We should set it, but it would report all the generic
# properties as additional properties.
# additionalProperties: false
...

View File

@ -44,6 +44,7 @@ properties:
compatible:
contains:
enum:
- allwinner,sun7i-a20-gmac
- snps,dwmac
- snps,dwmac-3.50a
- snps,dwmac-3.610
@ -265,6 +266,7 @@ allOf:
compatible:
contains:
enum:
- allwinner,sun7i-a20-gmac
- snps,dwxgmac
- snps,dwxgmac-2.10
- st,spear600-gmac
@ -305,6 +307,7 @@ allOf:
compatible:
contains:
enum:
- allwinner,sun7i-a20-gmac
- snps,dwmac-4.00
- snps,dwmac-4.10a
- snps,dwxgmac