Re: [PATCH 1/2] dt-bindings: rng: mtk-rng: add SMC-based TRNG variants

From: Daniel Golle

Date: Wed Mar 04 2026 - 07:16:54 EST


On Wed, Mar 04, 2026 at 12:34:45PM +0100, Krzysztof Kozlowski wrote:
> On Wed, Mar 04, 2026 at 12:55:27AM +0000, Daniel Golle wrote:
> > diff --git a/Documentation/devicetree/bindings/rng/mtk-rng.yaml b/Documentation/devicetree/bindings/rng/mtk-rng.yaml
> > index 7e8dc62e5d3a6..6074758552ac3 100644
> > --- a/Documentation/devicetree/bindings/rng/mtk-rng.yaml
> > +++ b/Documentation/devicetree/bindings/rng/mtk-rng.yaml
> > @@ -11,12 +11,15 @@ maintainers:
> >
> > properties:
> > $nodename:
> > - pattern: "^rng@[0-9a-f]+$"
> > + pattern: "^rng(@[0-9a-f]+)?$"
> >
> > compatible:
> > oneOf:
> > - enum:
> > - mediatek,mt7623-rng
> > + - mediatek,mt7981-rng
> > + - mediatek,mt7987-rng
> > + - mediatek,mt7988-rng
>
> Not compatible with each other?

MT7623 is the original hardware first supported in Linux. It can be
accessed via MMIO and requires the clock to be enabled by Linux.

Starting with MT7981 and followed by MT7988 and MT7987 it is
technically the same hardware, but on those ARMv8 SoCs TF-A assigns
the MMIO range of the TRNG to only be accessible from within the
secure/trusted land, and TF-A provides a (vendor-specific) API
allowing non-trusted land (ie. Linux) to acquire random bytes.

With MT7986 they made the unlucky choice to initially allow direct
access to the MMIO range, but later updates to TF-A then also locked
it to secure/trusted land, offering the same API as on the newer SoCs.
So for MT7986 the driver has to try and figure out which convention to
use.


>
> > - items:
> > - enum:
> > - mediatek,mt7622-rng
> > @@ -38,9 +41,22 @@ properties:
> >
> > required:
> > - compatible
> > - - reg
> > - - clocks
> > - - clock-names
> > +
> > +allOf:
> > + - if:
> > + properties:
> > + compatible:
> > + not:
>
> Use rather positive list, so drop "not:" and use cntains for only one
> compatible - mediatek,mt7623-rng.

Ack.

>
> > + contains:
> > + enum:
> > + - mediatek,mt7981-rng
> > + - mediatek,mt7987-rng
> > + - mediatek,mt7988-rng
> > + then:
> > + required:
> > + - reg
> > + - clocks
> > + - clock-names
> >
> > additionalProperties: false
> >
> > @@ -53,3 +69,7 @@ examples:
> > clocks = <&infracfg CLK_INFRA_TRNG>;
> > clock-names = "rng";
> > };
> > + - |
> > + rng {
> > + compatible = "mediatek,mt7981-rng";
>
> Use four spaces for indentation.

Oh sorry, I knew that actually but forgot...