diff mbox series

[v2] dt-bindings: net: renesas,ethertsn: Add Ethernet TSN

Message ID 20231121183738.656192-1-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
State Accepted
Commit c5b9f4792ea6b9abfcfb9486ba256f55e296aaa7
Delegated to: Netdev Maintainers
Headers show
Series [v2] dt-bindings: net: renesas,ethertsn: Add Ethernet TSN | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Niklas Söderlund Nov. 21, 2023, 6:37 p.m. UTC
Add bindings for Renesas R-Car Ethernet TSN End-station IP. The RTSN
device provides Ethernet network.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
* Changes since v1
- Update patch subject, was "dt-bindings: net: renesas,ethertsn: Add
  bindings for Ethernet TSN".
- Add top-level $ref to ethernet-controller.yaml.
- Rework compatible node to have a fallback, renesas,rcar-gen4-ethertsn.
- Change compatible value to match renesas style, was
  renesas,ethertsn-r8a779g0.
- Change interrupt names from "tx_data", "rx_data" to "tx", "rx".
- Add missing unevaluatedProperties.
- Use the generic properties for internal delay tx-internal-delay-ps and
  rx-internal-delay-ps instead of vendor specific ones.
---
 .../bindings/net/renesas,ethertsn.yaml        | 133 ++++++++++++++++++
 1 file changed, 133 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/renesas,ethertsn.yaml

Comments

Krzysztof Kozlowski Nov. 22, 2023, 8:31 a.m. UTC | #1
On 21/11/2023 19:37, Niklas Söderlund wrote:
> Add bindings for Renesas R-Car Ethernet TSN End-station IP. The RTSN
> device provides Ethernet network.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

...

> +patternProperties:
> +  "^ethernet-phy@[0-9a-f]$":
> +    type: object
> +    $ref: ethernet-phy.yaml#
> +    unevaluatedProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +  - reg-names
> +  - interrupts
> +  - interrupt-names
> +  - clocks
> +  - power-domains
> +  - resets
> +  - phy-mode
> +  - phy-handle
> +  - '#address-cells'
> +  - '#size-cells'

If there is going to be respin, please use consistent quotes - either '
or " (see pattern a bit above). You also need net-next in PATCH. In any
case:

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof
patchwork-bot+netdevbpf@kernel.org Nov. 23, 2023, 12:20 p.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Tue, 21 Nov 2023 19:37:38 +0100 you wrote:
> Add bindings for Renesas R-Car Ethernet TSN End-station IP. The RTSN
> device provides Ethernet network.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
> * Changes since v1
> - Update patch subject, was "dt-bindings: net: renesas,ethertsn: Add
>   bindings for Ethernet TSN".
> - Add top-level $ref to ethernet-controller.yaml.
> - Rework compatible node to have a fallback, renesas,rcar-gen4-ethertsn.
> - Change compatible value to match renesas style, was
>   renesas,ethertsn-r8a779g0.
> - Change interrupt names from "tx_data", "rx_data" to "tx", "rx".
> - Add missing unevaluatedProperties.
> - Use the generic properties for internal delay tx-internal-delay-ps and
>   rx-internal-delay-ps instead of vendor specific ones.
> 
> [...]

Here is the summary with links:
  - [v2] dt-bindings: net: renesas,ethertsn: Add Ethernet TSN
    https://git.kernel.org/netdev/net-next/c/c5b9f4792ea6

You are awesome, thank you!
Geert Uytterhoeven Feb. 15, 2024, 4:03 p.m. UTC | #3
Hi Niklas,

On Tue, Nov 21, 2023 at 7:38 PM Niklas Söderlund
<niklas.soderlund+renesas@ragnatech.se> wrote:
> Add bindings for Renesas R-Car Ethernet TSN End-station IP. The RTSN
> device provides Ethernet network.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Thanks for your patch, which is now commit c5b9f4792ea6b9ab
("dt-bindings: net: renesas,ethertsn: Add Ethernet TSN") in v6.8-rc1.

> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/renesas,ethertsn.yaml

> +  interrupts:
> +    items:
> +      - description: TX data interrupt
> +      - description: RX data interrupt
> +
> +  interrupt-names:
> +    items:
> +      - const: tx
> +      - const: rx

What about the (17!) other interrupts?

> +  rx-internal-delay-ps:
> +    enum: [0, 1800]
> +
> +  tx-internal-delay-ps:
> +    enum: [0, 2000]

These two should either have a default, or be required (like on
EtherAVB, where we couldn't have a default because the absence of
 these properties is used to enable a legacy fallback).

Gr{oetje,eeting}s,

                        Geert
Niklas Söderlund Feb. 23, 2024, 8:21 p.m. UTC | #4
Hi Geert,

Thanks for your feedback.

On 2024-02-15 17:03:33 +0100, Geert Uytterhoeven wrote:
> Hi Niklas,
> 
> On Tue, Nov 21, 2023 at 7:38 PM Niklas Söderlund
> <niklas.soderlund+renesas@ragnatech.se> wrote:
> > Add bindings for Renesas R-Car Ethernet TSN End-station IP. The RTSN
> > device provides Ethernet network.
> >
> > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> 
> Thanks for your patch, which is now commit c5b9f4792ea6b9ab
> ("dt-bindings: net: renesas,ethertsn: Add Ethernet TSN") in v6.8-rc1.
> 
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/net/renesas,ethertsn.yaml
> 
> > +  interrupts:
> > +    items:
> > +      - description: TX data interrupt
> > +      - description: RX data interrupt
> > +
> > +  interrupt-names:
> > +    items:
> > +      - const: tx
> > +      - const: rx
> 
> What about the (17!) other interrupts?

I did consider them but compared to say ravb each rtsn interrupt have a 
rather lose description and no easy to define name. So I reasoned it was 
better to only name the ones we use as we can give them sane names and 
then as the driver grows with features we can extend the binding.

As each interrupt have a name this would not cause any backward 
compatibility issues right?

> 
> > +  rx-internal-delay-ps:
> > +    enum: [0, 1800]
> > +
> > +  tx-internal-delay-ps:
> > +    enum: [0, 2000]
> 
> These two should either have a default, or be required (like on
> EtherAVB, where we couldn't have a default because the absence of
>  these properties is used to enable a legacy fallback).

This is a good point, I have sent a patch to address this by adding a 
default value.

> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> -- 
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/renesas,ethertsn.yaml b/Documentation/devicetree/bindings/net/renesas,ethertsn.yaml
new file mode 100644
index 000000000000..475aff7714d6
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/renesas,ethertsn.yaml
@@ -0,0 +1,133 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/renesas,ethertsn.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas Ethernet TSN End-station
+
+maintainers:
+  - Niklas Söderlund <niklas.soderlund@ragnatech.se>
+
+description:
+  The RTSN device provides Ethernet network using a 10 Mbps, 100 Mbps, or 1
+  Gbps full-duplex link via MII/GMII/RMII/RGMII. Depending on the connected PHY.
+
+allOf:
+  - $ref: ethernet-controller.yaml#
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - renesas,r8a779g0-ethertsn       # R-Car V4H
+      - const: renesas,rcar-gen4-ethertsn
+
+  reg:
+    items:
+      - description: TSN End Station target
+      - description: generalized Precision Time Protocol target
+
+  reg-names:
+    items:
+      - const: tsnes
+      - const: gptp
+
+  interrupts:
+    items:
+      - description: TX data interrupt
+      - description: RX data interrupt
+
+  interrupt-names:
+    items:
+      - const: tx
+      - const: rx
+
+  clocks:
+    maxItems: 1
+
+  power-domains:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  phy-mode:
+    contains:
+      enum:
+        - mii
+        - rgmii
+
+  phy-handle:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      Specifies a reference to a node representing a PHY device.
+
+  rx-internal-delay-ps:
+    enum: [0, 1800]
+
+  tx-internal-delay-ps:
+    enum: [0, 2000]
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+patternProperties:
+  "^ethernet-phy@[0-9a-f]$":
+    type: object
+    $ref: ethernet-phy.yaml#
+    unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - interrupts
+  - interrupt-names
+  - clocks
+  - power-domains
+  - resets
+  - phy-mode
+  - phy-handle
+  - '#address-cells'
+  - '#size-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/r8a779g0-cpg-mssr.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/power/r8a779g0-sysc.h>
+    #include <dt-bindings/gpio/gpio.h>
+
+    tsn0: ethernet@e6460000 {
+        compatible = "renesas,r8a779g0-ethertsn", "renesas,rcar-gen4-ethertsn";
+        reg = <0xe6460000 0x7000>,
+              <0xe6449000 0x500>;
+        reg-names = "tsnes", "gptp";
+        interrupts = <GIC_SPI 429 IRQ_TYPE_LEVEL_HIGH>,
+                     <GIC_SPI 430 IRQ_TYPE_LEVEL_HIGH>;
+        interrupt-names = "tx", "rx";
+        clocks = <&cpg CPG_MOD 2723>;
+        power-domains = <&sysc R8A779G0_PD_ALWAYS_ON>;
+        resets = <&cpg 2723>;
+
+        phy-mode = "rgmii";
+        tx-internal-delay-ps = <2000>;
+        phy-handle = <&phy3>;
+
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        phy3: ethernet-phy@3 {
+            compatible = "ethernet-phy-ieee802.3-c45";
+            reg = <0>;
+            interrupt-parent = <&gpio4>;
+            interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
+            reset-gpios = <&gpio1 23 GPIO_ACTIVE_LOW>;
+        };
+    };