All of lore.kernel.org
 help / color / mirror / Atom feed
From: Serge Semin <Sergey.Semin@baikalelectronics.ru>
To: Rob Herring <robh+dt@kernel.org>,
	Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Serge Semin <fancer.lancer@gmail.com>
Cc: Serge Semin <Sergey.Semin@baikalelectronics.ru>,
	Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>,
	Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>,
	Vyacheslav Mitrofanov 
	<Vyacheslav.Mitrofanov@baikalelectronics.ru>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	<netdev@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH 02/16] dt-bindings: net: Add Baikal-T1 GMAC bindings
Date: Mon, 8 Feb 2021 17:08:06 +0300	[thread overview]
Message-ID: <20210208140820.10410-3-Sergey.Semin@baikalelectronics.ru> (raw)
In-Reply-To: <20210208140820.10410-1-Sergey.Semin@baikalelectronics.ru>

Baikal-T1 SoC is equipped with two DW GMAC v3.73a-based 1GBE ethernet
interfaces synthesized with: RGMII PHY interface, AXI-DMA and APB3 CSR,
16KB Tx/Rx FIFOs and PBL up to half of that, PTP, PMT, TCP/IP CoE, up to 4
outstanding AXI read/write requests, maximum AXI burst length of 16 beats,
up to eight MAC address slots, one GPI and one GPO ports. Generic DW
MAC/STMMAC driver will easily handle the DT-node describing the Baikal-T1
GMAC network devices, but the bindings still needs to be created to have a
better understanding of what the interface looks like.

Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>

---

Rob, please note I couldn't declare the axi-config object properties constraints
without specifying the properties type and description. If I remove them the
dt_binding_check will curse with the error:

>> .../baikal,bt1-gmac.yaml: properties:axi-config:properties:snps,blen: 'description' is a required property
>> .../baikal,bt1-gmac.yaml: properties:axi-config:properties:snps,wr_osr_lmt: 'oneOf' conditional failed, one must be fixed:
        'type' is a required property
        Additional properties are not allowed ('maximum' was unexpected)
>> ...

I did't know what to do with these errors, so I just created normal sub-node
properties with stricter constraints than they are specified in the main
snps,dwmac.yaml schema. Any suggestion what is a better way to apply
additional constraints on sub-node properties?
---
 .../bindings/net/baikal,bt1-gmac.yaml         | 150 ++++++++++++++++++
 1 file changed, 150 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/baikal,bt1-gmac.yaml

diff --git a/Documentation/devicetree/bindings/net/baikal,bt1-gmac.yaml b/Documentation/devicetree/bindings/net/baikal,bt1-gmac.yaml
new file mode 100644
index 000000000000..30ab74a9023d
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/baikal,bt1-gmac.yaml
@@ -0,0 +1,150 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2020 BAIKAL ELECTRONICS, JSC
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/baikal,bt1-gmac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Baikal-T1 DW GMAC Network Interface
+
+maintainers:
+  - Serge Semin <fancer.lancer@gmail.com>
+
+description:
+  Baikal-T1 is equipped with two DW GMAC v3.73a network interfaces. Each of
+  them doesn't have any on-SoC PHY attached, but instead exports RGMII
+  interface to connect any compatible physical layer transceiver.
+
+select:
+  properties:
+    compatible:
+      contains:
+        const: baikal,bt1-gmac
+
+  required:
+    - compatible
+
+allOf:
+  - $ref: "snps,dwmac.yaml#"
+
+properties:
+  compatible:
+    items:
+      - const: baikal,bt1-gmac
+      - const: snps,dwmac-3.73a
+      - const: snps,dwmac
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  interrupt-names:
+    const: macirq
+
+  clocks:
+    minItems: 4
+    maxItems: 4
+
+  clock-names:
+    minItems: 4
+    maxItems: 4
+    contains:
+      enum:
+        - stmmaceth
+        - pclk
+        - tx
+        - ptp_ref
+
+  ngpios:
+    description:
+      Baikal-T1 GMAC have been created with one GPI and one GPO ports
+      enabled. So there are total two GPIOs available.
+    const: 2
+
+  gpio-controller: true
+
+  "#gpio-cells":
+    const: 2
+
+  tx-internal-delay-ps:
+    description:
+      DW MAC Tx clocks generator has been designed to always add 2ns delay
+      of TXC with respect to TXD.
+    const: 2000
+
+  rx-fifo-depth:
+    const: 16384
+
+  tx-fifo-depth:
+    const: 16384
+
+  axi-config:
+    type: object
+
+    properties:
+      snps,wr_osr_lmt:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: Maximum write outstanding requests is limited with 4
+        maximum: 3
+
+      snps,rd_osr_lmt:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: Maximum read outstanding requests is limited with 4
+        maximum: 3
+
+      snps,blen:
+        $ref: /schemas/types.yaml#/definitions/uint32-array
+        description: AXI-bus burst length width is limited with just 4 bits
+        items:
+          enum: [16, 8, 4, 0]
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - interrupt-names
+  - clocks
+  - clock-names
+  - resets
+  - reset-names
+  - phy-mode
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    ethernet@1f05e000 {
+      compatible = "baikal,bt1-dwmac", "snps,dwmac-3.73a", "snps,dwmac";
+      reg = <0x1f05e000 0x2000>;
+      #address-cells = <1>;
+      #size-cells = <2>;
+
+      interrupts = <72>;
+      interrupt-names = "macirq";
+
+      clocks = <&ccu_sys 1>, <&ccu_axi 3>, <&ccu_sys 2>, <&ccu_sys 3>;
+      clock-names = "pclk", "stmmaceth", "tx", "ptp_ref";
+
+      resets = <&ccu_axi 3>;
+      reset-names = "stmmaceth";
+
+      ngpios = <2>;
+
+      gpio-controller;
+      #gpio-cells = <2>;
+
+      phy-mode = "rgmii-rxid";
+      tx-internal-delay-ps = <2000>;
+
+      rx-fifo-depth = <16384>;
+      tx-fifo-depth = <16384>;
+
+      axi-config {
+        snps,wr_osr_lmt = <0x3>;
+        snps,rd_osr_lmt = <0x3>;
+        snps,blen = <0 0 0 0 16 8 4>;
+      };
+    };
+...
-- 
2.29.2


WARNING: multiple messages have this Message-ID (diff)
From: Serge Semin <Sergey.Semin@baikalelectronics.ru>
To: Rob Herring <robh+dt@kernel.org>,
	Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Serge Semin <fancer.lancer@gmail.com>
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>,
	Serge Semin <Sergey.Semin@baikalelectronics.ru>,
	Vyacheslav Mitrofanov
	<Vyacheslav.Mitrofanov@baikalelectronics.ru>,
	Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 02/16] dt-bindings: net: Add Baikal-T1 GMAC bindings
Date: Mon, 8 Feb 2021 17:08:06 +0300	[thread overview]
Message-ID: <20210208140820.10410-3-Sergey.Semin@baikalelectronics.ru> (raw)
In-Reply-To: <20210208140820.10410-1-Sergey.Semin@baikalelectronics.ru>

Baikal-T1 SoC is equipped with two DW GMAC v3.73a-based 1GBE ethernet
interfaces synthesized with: RGMII PHY interface, AXI-DMA and APB3 CSR,
16KB Tx/Rx FIFOs and PBL up to half of that, PTP, PMT, TCP/IP CoE, up to 4
outstanding AXI read/write requests, maximum AXI burst length of 16 beats,
up to eight MAC address slots, one GPI and one GPO ports. Generic DW
MAC/STMMAC driver will easily handle the DT-node describing the Baikal-T1
GMAC network devices, but the bindings still needs to be created to have a
better understanding of what the interface looks like.

Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>

---

Rob, please note I couldn't declare the axi-config object properties constraints
without specifying the properties type and description. If I remove them the
dt_binding_check will curse with the error:

>> .../baikal,bt1-gmac.yaml: properties:axi-config:properties:snps,blen: 'description' is a required property
>> .../baikal,bt1-gmac.yaml: properties:axi-config:properties:snps,wr_osr_lmt: 'oneOf' conditional failed, one must be fixed:
        'type' is a required property
        Additional properties are not allowed ('maximum' was unexpected)
>> ...

I did't know what to do with these errors, so I just created normal sub-node
properties with stricter constraints than they are specified in the main
snps,dwmac.yaml schema. Any suggestion what is a better way to apply
additional constraints on sub-node properties?
---
 .../bindings/net/baikal,bt1-gmac.yaml         | 150 ++++++++++++++++++
 1 file changed, 150 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/baikal,bt1-gmac.yaml

diff --git a/Documentation/devicetree/bindings/net/baikal,bt1-gmac.yaml b/Documentation/devicetree/bindings/net/baikal,bt1-gmac.yaml
new file mode 100644
index 000000000000..30ab74a9023d
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/baikal,bt1-gmac.yaml
@@ -0,0 +1,150 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2020 BAIKAL ELECTRONICS, JSC
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/baikal,bt1-gmac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Baikal-T1 DW GMAC Network Interface
+
+maintainers:
+  - Serge Semin <fancer.lancer@gmail.com>
+
+description:
+  Baikal-T1 is equipped with two DW GMAC v3.73a network interfaces. Each of
+  them doesn't have any on-SoC PHY attached, but instead exports RGMII
+  interface to connect any compatible physical layer transceiver.
+
+select:
+  properties:
+    compatible:
+      contains:
+        const: baikal,bt1-gmac
+
+  required:
+    - compatible
+
+allOf:
+  - $ref: "snps,dwmac.yaml#"
+
+properties:
+  compatible:
+    items:
+      - const: baikal,bt1-gmac
+      - const: snps,dwmac-3.73a
+      - const: snps,dwmac
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  interrupt-names:
+    const: macirq
+
+  clocks:
+    minItems: 4
+    maxItems: 4
+
+  clock-names:
+    minItems: 4
+    maxItems: 4
+    contains:
+      enum:
+        - stmmaceth
+        - pclk
+        - tx
+        - ptp_ref
+
+  ngpios:
+    description:
+      Baikal-T1 GMAC have been created with one GPI and one GPO ports
+      enabled. So there are total two GPIOs available.
+    const: 2
+
+  gpio-controller: true
+
+  "#gpio-cells":
+    const: 2
+
+  tx-internal-delay-ps:
+    description:
+      DW MAC Tx clocks generator has been designed to always add 2ns delay
+      of TXC with respect to TXD.
+    const: 2000
+
+  rx-fifo-depth:
+    const: 16384
+
+  tx-fifo-depth:
+    const: 16384
+
+  axi-config:
+    type: object
+
+    properties:
+      snps,wr_osr_lmt:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: Maximum write outstanding requests is limited with 4
+        maximum: 3
+
+      snps,rd_osr_lmt:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: Maximum read outstanding requests is limited with 4
+        maximum: 3
+
+      snps,blen:
+        $ref: /schemas/types.yaml#/definitions/uint32-array
+        description: AXI-bus burst length width is limited with just 4 bits
+        items:
+          enum: [16, 8, 4, 0]
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - interrupt-names
+  - clocks
+  - clock-names
+  - resets
+  - reset-names
+  - phy-mode
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    ethernet@1f05e000 {
+      compatible = "baikal,bt1-dwmac", "snps,dwmac-3.73a", "snps,dwmac";
+      reg = <0x1f05e000 0x2000>;
+      #address-cells = <1>;
+      #size-cells = <2>;
+
+      interrupts = <72>;
+      interrupt-names = "macirq";
+
+      clocks = <&ccu_sys 1>, <&ccu_axi 3>, <&ccu_sys 2>, <&ccu_sys 3>;
+      clock-names = "pclk", "stmmaceth", "tx", "ptp_ref";
+
+      resets = <&ccu_axi 3>;
+      reset-names = "stmmaceth";
+
+      ngpios = <2>;
+
+      gpio-controller;
+      #gpio-cells = <2>;
+
+      phy-mode = "rgmii-rxid";
+      tx-internal-delay-ps = <2000>;
+
+      rx-fifo-depth = <16384>;
+      tx-fifo-depth = <16384>;
+
+      axi-config {
+        snps,wr_osr_lmt = <0x3>;
+        snps,rd_osr_lmt = <0x3>;
+        snps,blen = <0 0 0 0 16 8 4>;
+      };
+    };
+...
-- 
2.29.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-02-08 14:33 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08 14:08 [PATCH 00/16] net: stmmac: Add DW MAC GPIOs and Baikal-T1 GMAC support Serge Semin
2021-02-08 14:08 ` Serge Semin
2021-02-08 14:08 ` [PATCH 01/16] dt-bindings: net: dwmac: Add DW GMAC GPIOs properties Serge Semin
2021-02-08 14:08   ` Serge Semin
2021-02-09 23:13   ` Rob Herring
2021-02-09 23:13     ` Rob Herring
2021-02-10 22:28     ` Serge Semin
2021-02-10 22:28       ` Serge Semin
2021-02-18 15:52       ` Serge Semin
2021-02-18 15:52         ` Serge Semin
2021-02-08 14:08 ` Serge Semin [this message]
2021-02-08 14:08   ` [PATCH 02/16] dt-bindings: net: Add Baikal-T1 GMAC bindings Serge Semin
2021-02-09 23:24   ` Rob Herring
2021-02-09 23:24     ` Rob Herring
2021-02-08 14:08 ` [PATCH 03/16] net: stmmac: Introduce MAC core cleanup method Serge Semin
2021-02-08 14:08   ` Serge Semin
2021-02-08 14:08 ` [PATCH 04/16] net: stmmac: Introduce DMA " Serge Semin
2021-02-08 14:08   ` Serge Semin
2021-02-08 14:08 ` [PATCH 05/16] net: stmmac: Introduce MAC IRQs enable/disable methods Serge Semin
2021-02-08 14:08   ` Serge Semin
2021-02-08 14:08 ` [PATCH 06/16] net: stmmac: Extend DMA IRQs enable/disable interface Serge Semin
2021-02-08 14:08   ` Serge Semin
2021-02-08 14:08 ` [PATCH 07/16] net: stmmac: Introduce MTL IRQs enable/disable methods Serge Semin
2021-02-08 14:08   ` Serge Semin
2021-02-08 14:08 ` [PATCH 08/16] net: stmmac: Introduce Safety Feature " Serge Semin
2021-02-08 14:08   ` Serge Semin
2021-02-08 14:08 ` [PATCH 09/16] net: stmmac: Disable MMC IRQs in the generic IRQs disable method Serge Semin
2021-02-08 14:08   ` Serge Semin
2021-02-08 14:08 ` [PATCH 10/16] net: stmmac: Convert STMMAC_DOWN flag to STMMAC_UP Serge Semin
2021-02-08 14:08   ` Serge Semin
2021-02-08 14:08 ` [PATCH 11/16] net: stmmac: Add STMMAC state getter Serge Semin
2021-02-08 14:08   ` Serge Semin
2021-02-08 14:08 ` [PATCH 12/16] net: stmmac: Introduce NIC software reset function Serge Semin
2021-02-08 14:08   ` Serge Semin
2021-02-08 14:08 ` [PATCH 13/16] net: stmmac: Request IRQs at device probe stage Serge Semin
2021-02-08 14:08   ` Serge Semin
2021-02-08 14:08 ` [PATCH 14/16] net: stmmac: Add Generic DW MAC GPIO port driver Serge Semin
2021-02-08 14:08   ` Serge Semin
2021-02-08 14:08 ` [PATCH 15/16] net: stmmac: Add DW GMAC GPIOs support Serge Semin
2021-02-08 14:08   ` Serge Semin
2021-02-08 14:08 ` [PATCH 16/16] net: stmmac: Add DW MAC IPs of 3.72a/3.73a/3.74a versions Serge Semin
2021-02-08 14:08   ` Serge Semin
2021-02-08 19:36 ` [PATCH 00/16] net: stmmac: Add DW MAC GPIOs and Baikal-T1 GMAC support Andrew Lunn
2021-02-08 19:36   ` Andrew Lunn
2021-02-09 11:16   ` Serge Semin
2021-02-09 11:16     ` Serge Semin
2021-02-09 14:11     ` Andrew Lunn
2021-02-09 14:11       ` Andrew Lunn
2021-02-10 18:00       ` Serge Semin
2021-02-10 18:00         ` Serge Semin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210208140820.10410-3-Sergey.Semin@baikalelectronics.ru \
    --to=sergey.semin@baikalelectronics.ru \
    --cc=Alexey.Malahov@baikalelectronics.ru \
    --cc=Pavel.Parkhomenko@baikalelectronics.ru \
    --cc=Vyacheslav.Mitrofanov@baikalelectronics.ru \
    --cc=alexandre.torgue@st.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=fancer.lancer@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.