[PATCH 2/2] dt-bindings: rng: convert Samsung Exynos TRNG to dtschema

Rob Herring robh+dt at kernel.org
Fri Aug 20 11:27:39 PDT 2021


On Tue, Aug 17, 2021 at 5:17 PM Lukasz Stelmach <l.stelmach at samsung.com> wrote:
>
> It was <2021-08-17 wto 16:07>, when Krzysztof Kozlowski wrote:
> > On 17/08/2021 14:34, Lukasz Stelmach wrote:
> >> It was <2021-08-17 wto 12:05>, when Krzysztof Kozlowski wrote:
> >>> On 17/08/2021 11:55, Lukasz Stelmach wrote:
> >>>> It was <2021-08-11 śro 10:43>, when Krzysztof Kozlowski wrote:
> >>>>> Convert Samsung Exynos SoC True Random Number Generator bindings to DT
> >>>>> schema format using json-schema.
> >>>>>
> >>>>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski at canonical.com>
> >>>>> ---
> >>>>>  .../bindings/rng/samsung,exynos5250-trng.txt  | 17 -------
> >>>>>  .../bindings/rng/samsung,exynos5250-trng.yaml | 44 +++++++++++++++++++
> >>>>>  MAINTAINERS                                   |  2 +-
> >>>>>  3 files changed, 45 insertions(+), 18 deletions(-)
> >>>>>  delete mode 100644 Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.txt
> >>>>>  create mode 100644 Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.yaml
> >>>>>
> >>>>> diff --git
> >>>>> a/Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.txt
> >>>>> b/Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.txt
> >>>>> deleted file mode 100644
> >>>>> index 5a613a4ec780..000000000000
> >>>>> --- a/Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.txt
> >>>>> +++ /dev/null
> >>>>> @@ -1,17 +0,0 @@
> >>>>> -Exynos True Random Number Generator
> >>>>> -
> >>>>> -Required properties:
> >>>>> -
> >>>>> -- compatible  : Should be "samsung,exynos5250-trng".
> >>>>> -- reg         : Specifies base physical address and size of the registers map.
> >>>>> -- clocks      : Phandle to clock-controller plus clock-specifier pair.
> >>>>> -- clock-names : "secss" as a clock name.
> >>>>> -
> >>>>> -Example:
> >>>>> -
> >>>>> - rng at 10830600 {
> >>>>> -         compatible = "samsung,exynos5250-trng";
> >>>>> -         reg = <0x10830600 0x100>;
> >>>>> -         clocks = <&clock CLK_SSS>;
> >>>>> -         clock-names = "secss";
> >>>>> - };
> >>>>> diff --git
> >>>>> a/Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.yaml
> >>>>> b/Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.yaml
> >>>>> new file mode 100644
> >>>>> index 000000000000..a50c34d5d199
> >>>>> --- /dev/null
> >>>>> +++ b/Documentation/devicetree/bindings/rng/samsung,exynos5250-trng.yaml
> >>>>> @@ -0,0 +1,44 @@
> >>>>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> >>>>> +%YAML 1.2
> >>>>> +---
> >>>>> +$id:
> >>>>> https://protect2.fireeye.com/v1/url?k=f38ca35b-ac179a0d-f38d2814-0cc47a31ce52-1faa1ecb65482b8a&q=1&e=8b3490f9-a5fc-4da0-b2ee-7b0aec781403&u=http%3A%2F%2Fdevicetree.org%2Fschemas%2Frng%2Fsamsung%2Cexynos5250-trng.yaml%23
> >>>>> +$schema:
> >>>>> https://protect2.fireeye.com/v1/url?k=9409519d-cb9268cb-9408dad2-0cc47a31ce52-12394c4409905980&q=1&e=8b3490f9-a5fc-4da0-b2ee-7b0aec781403&u=http%3A%2F%2Fdevicetree.org%2Fmeta-schemas%2Fcore.yaml%23
> >>>>> +
> >>>>> +title: Samsung Exynos SoC True Random Number Generator
> >>>>> +
> >>>>> +maintainers:
> >>>>> +  - Krzysztof Kozlowski <krzysztof.kozlowski at canonical.com>
> >>>>> +  - Łukasz Stelmach <l.stelmach at samsung.com>
> >>>>> +
> >>>>> +properties:
> >>>>> +  compatible:
> >>>>> +    const: samsung,exynos5250-trng
> >>>>> +
> >>>>> +  clocks:
> >>>>> +    maxItems: 1
> >>>>
> >>>> How about copying description from above into the description: property?
> >>>
> >>> But what to copy? There is no description except generic clock bindings.
> >>>
> >>
> >> The description that "was" in the txt file.
> >
> > But there was no description of fields except copy&paste of the core
> > schema. Do you describe C code like:
> >
> > ...
> > /* unsigned int is a integer number greater or equal 0 */
> > unsigned int i;
> > ...
>
> I believe having descriptions for reg and clocks
>
> >>>>> -- reg         : Specifies base physical address and size of the registers map.
> >>>>> -- clocks      : Phandle to clock-controller plus clock-specifier pair.
>
> right next to properties' formal definitions is beneficial for anyone
> browsing the YAML file. If you think otherwise, oh well, I am fine with
> that.

We have 2000 schemas currently (and 2300 still to convert). Of the
~2000, 1646 have 'reg' and 1005 have 'clocks' (I was going to guess
3/4 and 1/2, respectively, but with a nice uniform, parsable format we
don't have to guess). Do we need that many copies of variations of the
same description?

What I would like to have is generated documentation from the schemas.
With that we could either insert a description or a link on all the
common properties. There are already tools that generate documentation
out of json-schema, but I don't have the time to investigate them or
work on any of that.

My other idea is some sort of property grepping utility. While grep
generally works, it would be nice to have some tools aware of the
schema structure where you could just run 'dt-grep clocks' and have it
spit out the description. Another example would be to list all the
valid properties for a given compatible string. Lots of possibilities
with machine readable bindings.

Rob



More information about the linux-arm-kernel mailing list