2023-02-15 13:29:38

by Daniel Golle

[permalink] [raw]
Subject: [PATCH 2/2] dt-bindings: rng: Add MediaTek MT7981 TRNG

Add documentation to describe the MediaTek true random number generator
which is provided by ARM TrustedFirmware-A of the MT7981.

Signed-off-by: Daniel Golle <[email protected]>
---
.../bindings/rng/mediatek,mt7981-rng.yaml | 39 +++++++++++++++++++
MAINTAINERS | 1 +
2 files changed, 40 insertions(+)
create mode 100644 Documentation/devicetree/bindings/rng/mediatek,mt7981-rng.yaml

diff --git a/Documentation/devicetree/bindings/rng/mediatek,mt7981-rng.yaml b/Documentation/devicetree/bindings/rng/mediatek,mt7981-rng.yaml
new file mode 100644
index 000000000000..d577d60538d8
--- /dev/null
+++ b/Documentation/devicetree/bindings/rng/mediatek,mt7981-rng.yaml
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/rng/mediatek,mt7981-rng.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek Random number generator (v2/SMC)
+
+maintainers:
+ - Daniel Golle <[email protected]>
+
+properties:
+ $nodename:
+ pattern: "^rng$"
+
+ compatible:
+ enum:
+ - mediatek,mt7981-rng
+
+ reg:
+ maxItems: 1
+
+ clocks:
+ maxItems: 1
+
+ clock-names:
+ items:
+ - const: rng
+
+required:
+ - compatible
+
+additionalProperties: false
+
+examples:
+ - |
+ rng {
+ compatible = "mediatek,mt7981-rng";
+ };
diff --git a/MAINTAINERS b/MAINTAINERS
index 90d82aba6d73..523f1abf00d5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -13148,6 +13148,7 @@ F: drivers/leds/leds-mt6323.c
MEDIATEK RANDOM NUMBER GENERATOR SUPPORT
M: Sean Wang <[email protected]>
S: Maintained
+F: Documentation/devicetree/bindings/rng/mediatek,*
F: drivers/char/hw_random/mtk-rng-v2.c
F: drivers/char/hw_random/mtk-rng.c

--
2.39.1



2023-02-16 09:14:46

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 2/2] dt-bindings: rng: Add MediaTek MT7981 TRNG

On 15/02/2023 14:27, Daniel Golle wrote:
> Add documentation to describe the MediaTek true random number generator
> which is provided by ARM TrustedFirmware-A of the MT7981.
>
> Signed-off-by: Daniel Golle <[email protected]>
> ---
> .../bindings/rng/mediatek,mt7981-rng.yaml | 39 +++++++++++++++++++
> MAINTAINERS | 1 +
> 2 files changed, 40 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/rng/mediatek,mt7981-rng.yaml
>
> diff --git a/Documentation/devicetree/bindings/rng/mediatek,mt7981-rng.yaml b/Documentation/devicetree/bindings/rng/mediatek,mt7981-rng.yaml
> new file mode 100644
> index 000000000000..d577d60538d8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rng/mediatek,mt7981-rng.yaml
> @@ -0,0 +1,39 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/rng/mediatek,mt7981-rng.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: MediaTek Random number generator (v2/SMC)
> +
> +maintainers:
> + - Daniel Golle <[email protected]>
> +
> +properties:
> + $nodename:
> + pattern: "^rng$"

1. We don't enforce it in device bindings, so drop it.
2. It's not even correct. You have reg.


> +
> + compatible:
> + enum:
> + - mediatek,mt7981-rng
> +
> + reg:
> + maxItems: 1
> +
> + clocks:
> + maxItems: 1
> +
> + clock-names:
> + items:
> + - const: rng

Drop clock-names and rely on index.

> +
> +required:
> + - compatible

and reg?

> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + rng {
> + compatible = "mediatek,mt7981-rng";
> + };

Best regards,
Krzysztof


2023-02-16 09:19:22

by Daniel Golle

[permalink] [raw]
Subject: Re: [PATCH 2/2] dt-bindings: rng: Add MediaTek MT7981 TRNG

On Thu, Feb 16, 2023 at 10:14:33AM +0100, Krzysztof Kozlowski wrote:
> On 15/02/2023 14:27, Daniel Golle wrote:
> > Add documentation to describe the MediaTek true random number generator
> > which is provided by ARM TrustedFirmware-A of the MT7981.
> >
> > Signed-off-by: Daniel Golle <[email protected]>
> > ---
> > .../bindings/rng/mediatek,mt7981-rng.yaml | 39 +++++++++++++++++++
> > MAINTAINERS | 1 +
> > 2 files changed, 40 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/rng/mediatek,mt7981-rng.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/rng/mediatek,mt7981-rng.yaml b/Documentation/devicetree/bindings/rng/mediatek,mt7981-rng.yaml
> > new file mode 100644
> > index 000000000000..d577d60538d8
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/rng/mediatek,mt7981-rng.yaml
> > @@ -0,0 +1,39 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/rng/mediatek,mt7981-rng.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: MediaTek Random number generator (v2/SMC)
> > +
> > +maintainers:
> > + - Daniel Golle <[email protected]>
> > +
> > +properties:
> > + $nodename:
> > + pattern: "^rng$"
>
> 1. We don't enforce it in device bindings, so drop it.

Ack.

> 2. It's not even correct. You have reg.

No, there isn't any reg, as this driver does not access a MMIO mapped
resource but rather uses Secure Monitor Call interface to access the
TRNG via ARM TrustedFirmware-A.

>
>
> > +
> > + compatible:
> > + enum:
> > + - mediatek,mt7981-rng
> > +
> > + reg:
> > + maxItems: 1
> > +
> > + clocks:
> > + maxItems: 1
> > +
> > + clock-names:
> > + items:
> > + - const: rng
>
> Drop clock-names and rely on index.

Will drop, reg, clocks and clock-names, that slipped in from the
document I used as template for this one. The driver uses neither of
those.

>
> > +
> > +required:
> > + - compatible
>
> and reg?
>
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > + - |
> > + rng {
> > + compatible = "mediatek,mt7981-rng";
> > + };
>
> Best regards,
> Krzysztof
>
>