Re: [PATCH 07/25] dt-bindings: net: dwmac: Detach Generic DW MAC bindings

2020-12-16 Thread Serge Semin
On Tue, Dec 15, 2020 at 11:50:02AM -0600, Rob Herring wrote:
> On Mon, Dec 14, 2020 at 12:15:57PM +0300, Serge Semin wrote:
> > Currently the snps,dwmac.yaml DT bindings file is used for both DT nodes
> > describing generic DW MAC devices and as DT schema with common properties
> > to be evaluated against a vendor-specific DW MAC IP-cores. Due to such
> > dual-purpose design the "compatible" property of the common DW MAC schema
> > needs to contain the vendor-specific strings to successfully pass the
> > schema evaluation in case if it's referenced from the vendor-specific DT
> > bindings. That's a bad design from maintainability point of view, since
> > adding/removing any DW MAC-based device bindings requires the common
> > schema modification. In order to fix that let's detach the schema which
> > provides the generic DW MAC DT nodes evaluation into a dedicated DT
> > bindings file preserving the common DW MAC properties declaration in the
> > snps,dwmac.yaml file. By doing so we'll still provide a common properties
> > evaluation for each vendor-specific MAC bindings which refer to the
> > common bindings file, while the generic DW MAC DT nodes will be checked
> > against the new snps,dwmac-generic.yaml DT schema.
> 

> I'm okay with the change, but it needs a big fat note that 
> snps,dwmac-generic.yaml should not have new users. New users should have 
> an SoC specific compatible. History has shown that even IP versions are 
> not enough to handle all the integration crap vendors do.

Agreed. I'll add such note to the "description" text of the
snps,dwmac-generic.yaml schema. Is that ok?

-Sergey

> 
> > 
> > Signed-off-by: Serge Semin 
> > ---
> >  .../bindings/net/snps,dwmac-generic.yaml  | 148 ++
> >  .../devicetree/bindings/net/snps,dwmac.yaml   | 139 +---
> >  2 files changed, 149 insertions(+), 138 deletions(-)
> >  create mode 100644 
> > Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml 
> > b/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml
> > new file mode 100644
> > index ..f1b387911390
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml
> > @@ -0,0 +1,148 @@
> > +# SPDX-License-Identifier: GPL-2.0
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/net/snps,dwmac-generic.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Synopsys DesignWare Generic MAC Device Tree Bindings
> > +
> > +maintainers:
> > +  - Alexandre Torgue 
> > +  - Giuseppe Cavallaro 
> > +  - Jose Abreu 
> > +
> > +# Select the DT nodes, which have got compatible strings either as just a
> > +# single string with IP-core name optionally followed by the IP version or
> > +# two strings: one with IP-core name plus the IP version, another as just
> > +# the IP-core name.
> > +select:
> > +  properties:
> > +compatible:
> > +  oneOf:
> > +- items:
> > +- pattern: "^snps,dw(xg)+mac(-[0-9]+\\.[0-9]+a?)?$"
> > +- items:
> > +- pattern: "^snps,dwmac-[0-9]+\\.[0-9]+a?$"
> > +- const: snps,dwmac
> > +- items:
> > +- pattern: "^snps,dwxgmac-[0-9]+\\.[0-9]+a?$"
> > +- const: snps,dwxgmac
> > +
> > +  required:
> > +- compatible
> > +
> > +allOf:
> > +  - $ref: snps,dwmac.yaml#
> > +
> > +properties:
> > +  compatible:
> > +oneOf:
> > +  - description: Generic Synopsys DW MAC
> > +oneOf:
> > +  - items:
> > +  - enum:
> > +  - snps,dwmac-3.50a
> > +  - snps,dwmac-3.610
> > +  - snps,dwmac-3.70a
> > +  - snps,dwmac-3.710
> > +  - snps,dwmac-4.00
> > +  - snps,dwmac-4.10a
> > +  - snps,dwmac-4.20a
> > +  - const: snps,dwmac
> > +  - const: snps,dwmac
> > +  - description: Generic Synopsys DW xGMAC
> > +oneOf:
> > +  - items:
> > +  - enum:
> > +  - snps,dwxgmac-2.10
> > +  - const: snps,dwxgmac
> > +  - const: snps,dwxgmac
> > +  - description: ST SPEAr SoC Family GMAC
> > +deprecated: true
> > +const: st,spear600-gmac
> > +
> > +  reg:
> > +maxItems: 1
> > +
> > +unevaluatedProperties: false
> > +
> > +examples:
> > +  - |
> > +gmac0: ethernet@e080 {
> > +  compatible = "snps,dwxgmac-2.10", "snps,dwxgmac";
> > +  reg = <0xe080 0x8000>;
> > +  interrupt-parent = <>;
> > +  interrupts = <24 23 22>;
> > +  interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";
> > +  mac-address = []; /* Filled in by U-Boot */
> > +  max-frame-size = <3800>;
> > +  phy-mode = "gmii";
> > +  snps,multicast-filter-bins = <256>;
> > +  snps,perfect-filter-entries = <128>;
> > +  rx-fifo-depth = <16384>;
> > + 

Re: [PATCH 07/25] dt-bindings: net: dwmac: Detach Generic DW MAC bindings

2020-12-15 Thread Rob Herring
On Mon, Dec 14, 2020 at 12:15:57PM +0300, Serge Semin wrote:
> Currently the snps,dwmac.yaml DT bindings file is used for both DT nodes
> describing generic DW MAC devices and as DT schema with common properties
> to be evaluated against a vendor-specific DW MAC IP-cores. Due to such
> dual-purpose design the "compatible" property of the common DW MAC schema
> needs to contain the vendor-specific strings to successfully pass the
> schema evaluation in case if it's referenced from the vendor-specific DT
> bindings. That's a bad design from maintainability point of view, since
> adding/removing any DW MAC-based device bindings requires the common
> schema modification. In order to fix that let's detach the schema which
> provides the generic DW MAC DT nodes evaluation into a dedicated DT
> bindings file preserving the common DW MAC properties declaration in the
> snps,dwmac.yaml file. By doing so we'll still provide a common properties
> evaluation for each vendor-specific MAC bindings which refer to the
> common bindings file, while the generic DW MAC DT nodes will be checked
> against the new snps,dwmac-generic.yaml DT schema.

I'm okay with the change, but it needs a big fat note that 
snps,dwmac-generic.yaml should not have new users. New users should have 
an SoC specific compatible. History has shown that even IP versions are 
not enough to handle all the integration crap vendors do.

> 
> Signed-off-by: Serge Semin 
> ---
>  .../bindings/net/snps,dwmac-generic.yaml  | 148 ++
>  .../devicetree/bindings/net/snps,dwmac.yaml   | 139 +---
>  2 files changed, 149 insertions(+), 138 deletions(-)
>  create mode 100644 
> Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml
> 
> diff --git a/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml 
> b/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml
> new file mode 100644
> index ..f1b387911390
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml
> @@ -0,0 +1,148 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/snps,dwmac-generic.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Synopsys DesignWare Generic MAC Device Tree Bindings
> +
> +maintainers:
> +  - Alexandre Torgue 
> +  - Giuseppe Cavallaro 
> +  - Jose Abreu 
> +
> +# Select the DT nodes, which have got compatible strings either as just a
> +# single string with IP-core name optionally followed by the IP version or
> +# two strings: one with IP-core name plus the IP version, another as just
> +# the IP-core name.
> +select:
> +  properties:
> +compatible:
> +  oneOf:
> +- items:
> +- pattern: "^snps,dw(xg)+mac(-[0-9]+\\.[0-9]+a?)?$"
> +- items:
> +- pattern: "^snps,dwmac-[0-9]+\\.[0-9]+a?$"
> +- const: snps,dwmac
> +- items:
> +- pattern: "^snps,dwxgmac-[0-9]+\\.[0-9]+a?$"
> +- const: snps,dwxgmac
> +
> +  required:
> +- compatible
> +
> +allOf:
> +  - $ref: snps,dwmac.yaml#
> +
> +properties:
> +  compatible:
> +oneOf:
> +  - description: Generic Synopsys DW MAC
> +oneOf:
> +  - items:
> +  - enum:
> +  - snps,dwmac-3.50a
> +  - snps,dwmac-3.610
> +  - snps,dwmac-3.70a
> +  - snps,dwmac-3.710
> +  - snps,dwmac-4.00
> +  - snps,dwmac-4.10a
> +  - snps,dwmac-4.20a
> +  - const: snps,dwmac
> +  - const: snps,dwmac
> +  - description: Generic Synopsys DW xGMAC
> +oneOf:
> +  - items:
> +  - enum:
> +  - snps,dwxgmac-2.10
> +  - const: snps,dwxgmac
> +  - const: snps,dwxgmac
> +  - description: ST SPEAr SoC Family GMAC
> +deprecated: true
> +const: st,spear600-gmac
> +
> +  reg:
> +maxItems: 1
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +gmac0: ethernet@e080 {
> +  compatible = "snps,dwxgmac-2.10", "snps,dwxgmac";
> +  reg = <0xe080 0x8000>;
> +  interrupt-parent = <>;
> +  interrupts = <24 23 22>;
> +  interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";
> +  mac-address = []; /* Filled in by U-Boot */
> +  max-frame-size = <3800>;
> +  phy-mode = "gmii";
> +  snps,multicast-filter-bins = <256>;
> +  snps,perfect-filter-entries = <128>;
> +  rx-fifo-depth = <16384>;
> +  tx-fifo-depth = <16384>;
> +  clocks = <>;
> +  clock-names = "stmmaceth";
> +  snps,axi-config = <_axi_setup>;
> +  snps,mtl-rx-config = <_rx_setup>;
> +  snps,mtl-tx-config = <_tx_setup>;
> +  mdio0 {
> +#address-cells = <1>;
> +#size-cells = <0>;
> +compatible = "snps,dwmac-mdio";
> +phy1: ethernet-phy@0 {
> +  reg = <0>;
> +};
> +  

[PATCH 07/25] dt-bindings: net: dwmac: Detach Generic DW MAC bindings

2020-12-14 Thread Serge Semin
Currently the snps,dwmac.yaml DT bindings file is used for both DT nodes
describing generic DW MAC devices and as DT schema with common properties
to be evaluated against a vendor-specific DW MAC IP-cores. Due to such
dual-purpose design the "compatible" property of the common DW MAC schema
needs to contain the vendor-specific strings to successfully pass the
schema evaluation in case if it's referenced from the vendor-specific DT
bindings. That's a bad design from maintainability point of view, since
adding/removing any DW MAC-based device bindings requires the common
schema modification. In order to fix that let's detach the schema which
provides the generic DW MAC DT nodes evaluation into a dedicated DT
bindings file preserving the common DW MAC properties declaration in the
snps,dwmac.yaml file. By doing so we'll still provide a common properties
evaluation for each vendor-specific MAC bindings which refer to the
common bindings file, while the generic DW MAC DT nodes will be checked
against the new snps,dwmac-generic.yaml DT schema.

Signed-off-by: Serge Semin 
---
 .../bindings/net/snps,dwmac-generic.yaml  | 148 ++
 .../devicetree/bindings/net/snps,dwmac.yaml   | 139 +---
 2 files changed, 149 insertions(+), 138 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml 
b/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml
new file mode 100644
index ..f1b387911390
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/snps,dwmac-generic.yaml
@@ -0,0 +1,148 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/snps,dwmac-generic.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Synopsys DesignWare Generic MAC Device Tree Bindings
+
+maintainers:
+  - Alexandre Torgue 
+  - Giuseppe Cavallaro 
+  - Jose Abreu 
+
+# Select the DT nodes, which have got compatible strings either as just a
+# single string with IP-core name optionally followed by the IP version or
+# two strings: one with IP-core name plus the IP version, another as just
+# the IP-core name.
+select:
+  properties:
+compatible:
+  oneOf:
+- items:
+- pattern: "^snps,dw(xg)+mac(-[0-9]+\\.[0-9]+a?)?$"
+- items:
+- pattern: "^snps,dwmac-[0-9]+\\.[0-9]+a?$"
+- const: snps,dwmac
+- items:
+- pattern: "^snps,dwxgmac-[0-9]+\\.[0-9]+a?$"
+- const: snps,dwxgmac
+
+  required:
+- compatible
+
+allOf:
+  - $ref: snps,dwmac.yaml#
+
+properties:
+  compatible:
+oneOf:
+  - description: Generic Synopsys DW MAC
+oneOf:
+  - items:
+  - enum:
+  - snps,dwmac-3.50a
+  - snps,dwmac-3.610
+  - snps,dwmac-3.70a
+  - snps,dwmac-3.710
+  - snps,dwmac-4.00
+  - snps,dwmac-4.10a
+  - snps,dwmac-4.20a
+  - const: snps,dwmac
+  - const: snps,dwmac
+  - description: Generic Synopsys DW xGMAC
+oneOf:
+  - items:
+  - enum:
+  - snps,dwxgmac-2.10
+  - const: snps,dwxgmac
+  - const: snps,dwxgmac
+  - description: ST SPEAr SoC Family GMAC
+deprecated: true
+const: st,spear600-gmac
+
+  reg:
+maxItems: 1
+
+unevaluatedProperties: false
+
+examples:
+  - |
+gmac0: ethernet@e080 {
+  compatible = "snps,dwxgmac-2.10", "snps,dwxgmac";
+  reg = <0xe080 0x8000>;
+  interrupt-parent = <>;
+  interrupts = <24 23 22>;
+  interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";
+  mac-address = []; /* Filled in by U-Boot */
+  max-frame-size = <3800>;
+  phy-mode = "gmii";
+  snps,multicast-filter-bins = <256>;
+  snps,perfect-filter-entries = <128>;
+  rx-fifo-depth = <16384>;
+  tx-fifo-depth = <16384>;
+  clocks = <>;
+  clock-names = "stmmaceth";
+  snps,axi-config = <_axi_setup>;
+  snps,mtl-rx-config = <_rx_setup>;
+  snps,mtl-tx-config = <_tx_setup>;
+  mdio0 {
+#address-cells = <1>;
+#size-cells = <0>;
+compatible = "snps,dwmac-mdio";
+phy1: ethernet-phy@0 {
+  reg = <0>;
+};
+  };
+};
+  - |
+gmac1: ethernet@f801 {
+  compatible = "snps,dwmac-4.10a", "snps,dwmac";
+  reg = <0xf801 0x4000>;
+  interrupts = <0 98 4>;
+  interrupt-names = "macirq";
+  clock-names = "stmmaceth", "ptp_ref";
+  clocks = < 4>, < 5>;
+  phy-mode = "rgmii";
+  snps,txpbl = <8>;
+  snps,rxpbl = <2>;
+  snps,aal;
+  snps,tso;
+
+  snps,axi-config {
+snps,wr_osr_lmt = <0xf>;
+snps,rd_osr_lmt = <0xf>;
+snps,blen = <256 128 64 32 0 0 0>;
+  };
+
+  snps,mtl-rx-config {
+