diff mbox series

[v3,1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem

Message ID 1a3d4ff8ce34a5e676d1cb1fafd40525378e29a4.1721999833.git.geert+renesas@glider.be (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series Add Renesas R-Car Gen4 E-FUSE support | expand

Commit Message

Geert Uytterhoeven July 26, 2024, 1:38 p.m. UTC
The R-Car E-FUSE blocks can be modelled better using the nvmem
framework.

Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show
the definition of nvmem cells.  While at it, drop unneeded labels from
the examples, and fix indentation.

Add an entry to the MAINTAINERS file.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - New.

I would expect that the calib@144 node needs:

    #nvmem-cell-cells = <0>;

but after adding that, "make dt_binding_check" starts complaining:

    Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: 'oneOf' conditional failed, one must be fixed:
	    '#address-cells', '#size-cells', 'calib@144' do not match any of the regexes: 'pinctrl-[0-9]+'
	    Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)
	    'kontron,sl28-vpd' was expected
	    'onie,tlv-layout' was expected
	    from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
    Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: Unevaluated properties are not allowed ('#address-cells', '#size-cells', 'calib@144' were unexpected)
	    from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
    Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: Unevaluated properties are not allowed ('nvmem-layout' was unexpected)
	    from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
---
 .../{fuse => nvmem}/renesas,rcar-efuse.yaml   | 35 +++++++++++++------
 .../{fuse => nvmem}/renesas,rcar-otp.yaml     | 17 +++++----
 MAINTAINERS                                   |  1 +
 3 files changed, 36 insertions(+), 17 deletions(-)
 rename Documentation/devicetree/bindings/{fuse => nvmem}/renesas,rcar-efuse.yaml (54%)
 rename Documentation/devicetree/bindings/{fuse => nvmem}/renesas,rcar-otp.yaml (60%)

Comments

Rob Herring (Arm) July 30, 2024, 4:24 p.m. UTC | #1
On Fri, Jul 26, 2024 at 03:38:06PM +0200, Geert Uytterhoeven wrote:
> The R-Car E-FUSE blocks can be modelled better using the nvmem
> framework.
> 
> Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show
> the definition of nvmem cells.  While at it, drop unneeded labels from
> the examples, and fix indentation.
> 
> Add an entry to the MAINTAINERS file.
> 
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> v3:
>   - New.
> 
> I would expect that the calib@144 node needs:
> 
>     #nvmem-cell-cells = <0>;
> 
> but after adding that, "make dt_binding_check" starts complaining:
> 
>     Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: 'oneOf' conditional failed, one must be fixed:
> 	    '#address-cells', '#size-cells', 'calib@144' do not match any of the regexes: 'pinctrl-[0-9]+'
> 	    Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)

Did you want 'nvmem-cell-cells' or '#nvmem-cell-cells'?

> 	    'kontron,sl28-vpd' was expected
> 	    'onie,tlv-layout' was expected
> 	    from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
>     Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: Unevaluated properties are not allowed ('#address-cells', '#size-cells', 'calib@144' were unexpected)
> 	    from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
>     Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: Unevaluated properties are not allowed ('nvmem-layout' was unexpected)
> 	    from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Geert Uytterhoeven July 31, 2024, 7:37 a.m. UTC | #2
Hi Rob,

On Tue, Jul 30, 2024 at 6:24 PM Rob Herring <robh@kernel.org> wrote:
> On Fri, Jul 26, 2024 at 03:38:06PM +0200, Geert Uytterhoeven wrote:
> > The R-Car E-FUSE blocks can be modelled better using the nvmem
> > framework.
> >
> > Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show
> > the definition of nvmem cells.  While at it, drop unneeded labels from
> > the examples, and fix indentation.
> >
> > Add an entry to the MAINTAINERS file.
> >
> > Reported-by: Arnd Bergmann <arnd@arndb.de>
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
> > v3:
> >   - New.
> >
> > I would expect that the calib@144 node needs:
> >
> >     #nvmem-cell-cells = <0>;
> >
> > but after adding that, "make dt_binding_check" starts complaining:
> >
> >     Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: 'oneOf' conditional failed, one must be fixed:
> >           '#address-cells', '#size-cells', 'calib@144' do not match any of the regexes: 'pinctrl-[0-9]+'
> >           Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)
>
> Did you want 'nvmem-cell-cells' or '#nvmem-cell-cells'?

Oops, I've been (manually) re-adding and removing it again too many
times during my investigations. "#nvmem-cell-cells", of course.
According to my build logs, I had it right at least once ;-)

> >           'kontron,sl28-vpd' was expected
> >           'onie,tlv-layout' was expected
> >           from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
> >     Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: Unevaluated properties are not allowed ('#address-cells', '#size-cells', 'calib@144' were unexpected)
> >           from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
> >     Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: Unevaluated properties are not allowed ('nvmem-layout' was unexpected)
> >           from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#

Anyway, with or without the typo, the error message is about the same:

- Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)
+ Unevaluated properties are not allowed ('#nvmem-cell-cells' was unexpected)

Gr{oetje,eeting}s,

                        Geert
Krzysztof Kozlowski Aug. 19, 2024, 11:11 a.m. UTC | #3
On Wed, Jul 31, 2024 at 09:37:36AM +0200, Geert Uytterhoeven wrote:
> Hi Rob,
> 
> On Tue, Jul 30, 2024 at 6:24 PM Rob Herring <robh@kernel.org> wrote:
> > On Fri, Jul 26, 2024 at 03:38:06PM +0200, Geert Uytterhoeven wrote:
> > > The R-Car E-FUSE blocks can be modelled better using the nvmem
> > > framework.
> > >
> > > Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show
> > > the definition of nvmem cells.  While at it, drop unneeded labels from
> > > the examples, and fix indentation.
> > >
> > > Add an entry to the MAINTAINERS file.
> > >
> > > Reported-by: Arnd Bergmann <arnd@arndb.de>
> > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > ---
> > > v3:
> > >   - New.
> > >
> > > I would expect that the calib@144 node needs:
> > >
> > >     #nvmem-cell-cells = <0>;
> > >
> > > but after adding that, "make dt_binding_check" starts complaining:
> > >
> > >     Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: 'oneOf' conditional failed, one must be fixed:
> > >           '#address-cells', '#size-cells', 'calib@144' do not match any of the regexes: 'pinctrl-[0-9]+'
> > >           Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)
> >
> > Did you want 'nvmem-cell-cells' or '#nvmem-cell-cells'?
> 
> Oops, I've been (manually) re-adding and removing it again too many
> times during my investigations. "#nvmem-cell-cells", of course.
> According to my build logs, I had it right at least once ;-)
> 
> > >           'kontron,sl28-vpd' was expected
> > >           'onie,tlv-layout' was expected
> > >           from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
> > >     Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: Unevaluated properties are not allowed ('#address-cells', '#size-cells', 'calib@144' were unexpected)
> > >           from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
> > >     Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: Unevaluated properties are not allowed ('nvmem-layout' was unexpected)
> > >           from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
> 
> Anyway, with or without the typo, the error message is about the same:
> 
> - Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)
> + Unevaluated properties are not allowed ('#nvmem-cell-cells' was unexpected)

And if you test your schema or DTS with all nvmem (so also layouts)
schemas?

Apparently fixed-layout schema was not applied.

Best regards,
Krzysztof
Geert Uytterhoeven Aug. 28, 2024, 8:10 p.m. UTC | #4
Hi Krzysztof,

On Mon, Aug 19, 2024 at 1:11 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> On Wed, Jul 31, 2024 at 09:37:36AM +0200, Geert Uytterhoeven wrote:
> > On Tue, Jul 30, 2024 at 6:24 PM Rob Herring <robh@kernel.org> wrote:
> > > On Fri, Jul 26, 2024 at 03:38:06PM +0200, Geert Uytterhoeven wrote:
> > > > The R-Car E-FUSE blocks can be modelled better using the nvmem
> > > > framework.
> > > >
> > > > Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show
> > > > the definition of nvmem cells.  While at it, drop unneeded labels from
> > > > the examples, and fix indentation.
> > > >
> > > > Add an entry to the MAINTAINERS file.
> > > >
> > > > Reported-by: Arnd Bergmann <arnd@arndb.de>
> > > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > > ---
> > > > v3:
> > > >   - New.
> > > >
> > > > I would expect that the calib@144 node needs:
> > > >
> > > >     #nvmem-cell-cells = <0>;
> > > >
> > > > but after adding that, "make dt_binding_check" starts complaining:
> > > >
> > > >     Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: 'oneOf' conditional failed, one must be fixed:
> > > >           '#address-cells', '#size-cells', 'calib@144' do not match any of the regexes: 'pinctrl-[0-9]+'
> > > >           Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)
> > >
> > > Did you want 'nvmem-cell-cells' or '#nvmem-cell-cells'?
> >
> > Oops, I've been (manually) re-adding and removing it again too many
> > times during my investigations. "#nvmem-cell-cells", of course.
> > According to my build logs, I had it right at least once ;-)
> >
> > > >           'kontron,sl28-vpd' was expected
> > > >           'onie,tlv-layout' was expected
> > > >           from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
> > > >     Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: Unevaluated properties are not allowed ('#address-cells', '#size-cells', 'calib@144' were unexpected)
> > > >           from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
> > > >     Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: Unevaluated properties are not allowed ('nvmem-layout' was unexpected)
> > > >           from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
> >
> > Anyway, with or without the typo, the error message is about the same:
> >
> > - Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)
> > + Unevaluated properties are not allowed ('#nvmem-cell-cells' was unexpected)
>
> And if you test your schema or DTS with all nvmem (so also layouts)
> schemas?
>
> Apparently fixed-layout schema was not applied.

With today's dt-schema:

Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb:
fuse@e6078800: nvmem-layout: 'oneOf' conditional failed, one must be
fixed:
        '#address-cells', '#size-cells', 'calib@144' do not match any
of the regexes: 'pinctrl-[0-9]+'
        Unevaluated properties are not allowed ('#nvmem-cell-cells'
was unexpected)
        'kontron,sl28-vpd' was expected
        'onie,tlv-layout' was expected
        from schema $id:
http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb:
fuse@e6078800: nvmem-layout: Unevaluated properties are not allowed
('#address-cells', '#size-cells', 'calib@144' were unexpected)
        from schema $id:
http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb:
fuse@e6078800: Unevaluated properties are not allowed ('nvmem-layout'
was unexpected)
        from schema $id:
http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb:
nvmem-layout: calib@144: Unevaluated properties are not allowed
('#nvmem-cell-cells' was unexpected)
        from schema $id:
http://devicetree.org/schemas/nvmem/layouts/fixed-layout.yaml#

According to the last line, fixed-layout.yaml is applied.
Am I missing something?

Thanks!

Gr{oetje,eeting}s,

                        Geert
Krzysztof Kozlowski Aug. 29, 2024, 8:55 a.m. UTC | #5
On 28/08/2024 22:10, Geert Uytterhoeven wrote:
> Hi Krzysztof,
> 
> On Mon, Aug 19, 2024 at 1:11 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>> On Wed, Jul 31, 2024 at 09:37:36AM +0200, Geert Uytterhoeven wrote:
>>> On Tue, Jul 30, 2024 at 6:24 PM Rob Herring <robh@kernel.org> wrote:
>>>> On Fri, Jul 26, 2024 at 03:38:06PM +0200, Geert Uytterhoeven wrote:
>>>>> The R-Car E-FUSE blocks can be modelled better using the nvmem
>>>>> framework.
>>>>>
>>>>> Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show
>>>>> the definition of nvmem cells.  While at it, drop unneeded labels from
>>>>> the examples, and fix indentation.
>>>>>
>>>>> Add an entry to the MAINTAINERS file.
>>>>>
>>>>> Reported-by: Arnd Bergmann <arnd@arndb.de>
>>>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>>>>> ---
>>>>> v3:
>>>>>   - New.
>>>>>
>>>>> I would expect that the calib@144 node needs:
>>>>>
>>>>>     #nvmem-cell-cells = <0>;


So this is for mac-base...

>>>>>
>>>>> but after adding that, "make dt_binding_check" starts complaining:
>>>>>
>>>>>     Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: 'oneOf' conditional failed, one must be fixed:
>>>>>           '#address-cells', '#size-cells', 'calib@144' do not match any of the regexes: 'pinctrl-[0-9]+'
>>>>>           Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)
>>>>
>>>> Did you want 'nvmem-cell-cells' or '#nvmem-cell-cells'?
>>>
>>> Oops, I've been (manually) re-adding and removing it again too many
>>> times during my investigations. "#nvmem-cell-cells", of course.
>>> According to my build logs, I had it right at least once ;-)
>>>
>>>>>           'kontron,sl28-vpd' was expected
>>>>>           'onie,tlv-layout' was expected
>>>>>           from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
>>>>>     Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: Unevaluated properties are not allowed ('#address-cells', '#size-cells', 'calib@144' were unexpected)
>>>>>           from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
>>>>>     Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: Unevaluated properties are not allowed ('nvmem-layout' was unexpected)
>>>>>           from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
>>>
>>> Anyway, with or without the typo, the error message is about the same:
>>>
>>> - Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)
>>> + Unevaluated properties are not allowed ('#nvmem-cell-cells' was unexpected)
>>
>> And if you test your schema or DTS with all nvmem (so also layouts)
>> schemas?
>>
>> Apparently fixed-layout schema was not applied.
> 
> With today's dt-schema:
> 
> Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb:
> fuse@e6078800: nvmem-layout: 'oneOf' conditional failed, one must be
> fixed:
>         '#address-cells', '#size-cells', 'calib@144' do not match any
> of the regexes: 'pinctrl-[0-9]+'
>         Unevaluated properties are not allowed ('#nvmem-cell-cells'
> was unexpected)
>         'kontron,sl28-vpd' was expected
>         'onie,tlv-layout' was expected
>         from schema $id:
> http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
> Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb:
> fuse@e6078800: nvmem-layout: Unevaluated properties are not allowed
> ('#address-cells', '#size-cells', 'calib@144' were unexpected)
>         from schema $id:
> http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
> Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb:
> fuse@e6078800: Unevaluated properties are not allowed ('nvmem-layout'
> was unexpected)
>         from schema $id:
> http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
> Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb:
> nvmem-layout: calib@144: Unevaluated properties are not allowed
> ('#nvmem-cell-cells' was unexpected)
>         from schema $id:
> http://devicetree.org/schemas/nvmem/layouts/fixed-layout.yaml#
> 
> According to the last line, fixed-layout.yaml is applied.
> Am I missing something?

I cannot reproduce it. Neither on 2024.6.dev5+g0e44e14b7eb4 nor on
todays 2024.6.dev16+gc51125d571ca (which is actually from 15th of Aug).

But maybe we talk about modified patch, but then which exactly?

Best regards,
Krzysztof
Geert Uytterhoeven Aug. 29, 2024, 9:10 a.m. UTC | #6
Hi Krzysztof,

On Thu, Aug 29, 2024 at 10:55 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> On 28/08/2024 22:10, Geert Uytterhoeven wrote:
> > On Mon, Aug 19, 2024 at 1:11 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> >> On Wed, Jul 31, 2024 at 09:37:36AM +0200, Geert Uytterhoeven wrote:
> >>> On Tue, Jul 30, 2024 at 6:24 PM Rob Herring <robh@kernel.org> wrote:
> >>>> On Fri, Jul 26, 2024 at 03:38:06PM +0200, Geert Uytterhoeven wrote:
> >>>>> The R-Car E-FUSE blocks can be modelled better using the nvmem
> >>>>> framework.
> >>>>>
> >>>>> Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show
> >>>>> the definition of nvmem cells.  While at it, drop unneeded labels from
> >>>>> the examples, and fix indentation.
> >>>>>
> >>>>> Add an entry to the MAINTAINERS file.
> >>>>>
> >>>>> Reported-by: Arnd Bergmann <arnd@arndb.de>
> >>>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >>>>> ---
> >>>>> v3:
> >>>>>   - New.
> >>>>>
> >>>>> I would expect that the calib@144 node needs:
> >>>>>
> >>>>>     #nvmem-cell-cells = <0>;
>
> So this is for mac-base...

No, mac-base is not involved.

> >>>>> but after adding that, "make dt_binding_check" starts complaining:

[...]

> >> And if you test your schema or DTS with all nvmem (so also layouts)
> >> schemas?
> >>
> >> Apparently fixed-layout schema was not applied.
> >
> > With today's dt-schema:

[...]

> > Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb:
> > nvmem-layout: calib@144: Unevaluated properties are not allowed
> > ('#nvmem-cell-cells' was unexpected)
> >         from schema $id:
> > http://devicetree.org/schemas/nvmem/layouts/fixed-layout.yaml#
> >
> > According to the last line, fixed-layout.yaml is applied.
> > Am I missing something?
>
> I cannot reproduce it. Neither on 2024.6.dev5+g0e44e14b7eb4 nor on
> todays 2024.6.dev16+gc51125d571ca (which is actually from 15th of Aug).
>
> But maybe we talk about modified patch, but then which exactly?

Yes, you have to add "#nvmem-cell-cells = <0>;" to the calib@144 node
after applying my series (or at least the bindings patch).

I can reproduce it on Linux v6.11-rc5 and dt-schema
v2024.05-16-gc51125d571cac959 by modifying the fixed-layout example:

--- a/Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml
+++ b/Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml
@@ -58,5 +58,6 @@ examples:

         calibration@4000 {
             reg = <0x4000 0x100>;
+            #nvmem-cell-cells = <0>;
         };
     };

Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.example.dtb:
nvmem-layout: calibration@4000: Unevaluated properties are not allowed
('#nvmem-cell-cells' was unexpected)
        from schema $id:
http://devicetree.org/schemas/nvmem/layouts/fixed-layout.yaml#

Gr{oetje,eeting}s,

                        Geert
Rob Herring (Arm) Aug. 29, 2024, 1:58 p.m. UTC | #7
On Thu, Aug 29, 2024 at 11:10:41AM +0200, Geert Uytterhoeven wrote:
> Hi Krzysztof,
> 
> On Thu, Aug 29, 2024 at 10:55 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > On 28/08/2024 22:10, Geert Uytterhoeven wrote:
> > > On Mon, Aug 19, 2024 at 1:11 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > >> On Wed, Jul 31, 2024 at 09:37:36AM +0200, Geert Uytterhoeven wrote:
> > >>> On Tue, Jul 30, 2024 at 6:24 PM Rob Herring <robh@kernel.org> wrote:
> > >>>> On Fri, Jul 26, 2024 at 03:38:06PM +0200, Geert Uytterhoeven wrote:
> > >>>>> The R-Car E-FUSE blocks can be modelled better using the nvmem
> > >>>>> framework.
> > >>>>>
> > >>>>> Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show
> > >>>>> the definition of nvmem cells.  While at it, drop unneeded labels from
> > >>>>> the examples, and fix indentation.
> > >>>>>
> > >>>>> Add an entry to the MAINTAINERS file.
> > >>>>>
> > >>>>> Reported-by: Arnd Bergmann <arnd@arndb.de>
> > >>>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > >>>>> ---
> > >>>>> v3:
> > >>>>>   - New.
> > >>>>>
> > >>>>> I would expect that the calib@144 node needs:
> > >>>>>
> > >>>>>     #nvmem-cell-cells = <0>;
> >
> > So this is for mac-base...
> 
> No, mac-base is not involved.

It is because that's the only case that allows #nvmem-cell-cells in 
fixed-cell.yaml. While fixed-cell.yaml allows additional properties, 
where it is referenced in fixed-layout.yaml does not.

Rob
Geert Uytterhoeven Aug. 29, 2024, 2:34 p.m. UTC | #8
Hi Rob,

On Thu, Aug 29, 2024 at 3:58 PM Rob Herring <robh@kernel.org> wrote:
> On Thu, Aug 29, 2024 at 11:10:41AM +0200, Geert Uytterhoeven wrote:
> > On Thu, Aug 29, 2024 at 10:55 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > > On 28/08/2024 22:10, Geert Uytterhoeven wrote:
> > > > On Mon, Aug 19, 2024 at 1:11 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > > >> On Wed, Jul 31, 2024 at 09:37:36AM +0200, Geert Uytterhoeven wrote:
> > > >>> On Tue, Jul 30, 2024 at 6:24 PM Rob Herring <robh@kernel.org> wrote:
> > > >>>> On Fri, Jul 26, 2024 at 03:38:06PM +0200, Geert Uytterhoeven wrote:
> > > >>>>> The R-Car E-FUSE blocks can be modelled better using the nvmem
> > > >>>>> framework.
> > > >>>>>
> > > >>>>> Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show
> > > >>>>> the definition of nvmem cells.  While at it, drop unneeded labels from
> > > >>>>> the examples, and fix indentation.
> > > >>>>>
> > > >>>>> Add an entry to the MAINTAINERS file.
> > > >>>>>
> > > >>>>> Reported-by: Arnd Bergmann <arnd@arndb.de>
> > > >>>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > >>>>> ---
> > > >>>>> v3:
> > > >>>>>   - New.
> > > >>>>>
> > > >>>>> I would expect that the calib@144 node needs:
> > > >>>>>
> > > >>>>>     #nvmem-cell-cells = <0>;
> > >
> > > So this is for mac-base...
> >
> > No, mac-base is not involved.
>
> It is because that's the only case that allows #nvmem-cell-cells in
> fixed-cell.yaml. While fixed-cell.yaml allows additional properties,
> where it is referenced in fixed-layout.yaml does not.

So all of this is normal, and you should just never use #nvmem-cell-cells,
except in a node describing the location of the MAC address?

When no #nvmem-cell-cells property is present,
of_parse_phandle_with_optional_args() (as used in
of_nvmem_cell_get()) returns zero anyway

Gr{oetje,eeting}s,

                        Geert
Rob Herring (Arm) Aug. 30, 2024, 3:47 p.m. UTC | #9
On Thu, Aug 29, 2024 at 04:34:41PM +0200, Geert Uytterhoeven wrote:
> Hi Rob,
> 
> On Thu, Aug 29, 2024 at 3:58 PM Rob Herring <robh@kernel.org> wrote:
> > On Thu, Aug 29, 2024 at 11:10:41AM +0200, Geert Uytterhoeven wrote:
> > > On Thu, Aug 29, 2024 at 10:55 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > > > On 28/08/2024 22:10, Geert Uytterhoeven wrote:
> > > > > On Mon, Aug 19, 2024 at 1:11 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > > > >> On Wed, Jul 31, 2024 at 09:37:36AM +0200, Geert Uytterhoeven wrote:
> > > > >>> On Tue, Jul 30, 2024 at 6:24 PM Rob Herring <robh@kernel.org> wrote:
> > > > >>>> On Fri, Jul 26, 2024 at 03:38:06PM +0200, Geert Uytterhoeven wrote:
> > > > >>>>> The R-Car E-FUSE blocks can be modelled better using the nvmem
> > > > >>>>> framework.
> > > > >>>>>
> > > > >>>>> Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show
> > > > >>>>> the definition of nvmem cells.  While at it, drop unneeded labels from
> > > > >>>>> the examples, and fix indentation.
> > > > >>>>>
> > > > >>>>> Add an entry to the MAINTAINERS file.
> > > > >>>>>
> > > > >>>>> Reported-by: Arnd Bergmann <arnd@arndb.de>
> > > > >>>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > > >>>>> ---
> > > > >>>>> v3:
> > > > >>>>>   - New.
> > > > >>>>>
> > > > >>>>> I would expect that the calib@144 node needs:
> > > > >>>>>
> > > > >>>>>     #nvmem-cell-cells = <0>;
> > > >
> > > > So this is for mac-base...
> > >
> > > No, mac-base is not involved.
> >
> > It is because that's the only case that allows #nvmem-cell-cells in
> > fixed-cell.yaml. While fixed-cell.yaml allows additional properties,
> > where it is referenced in fixed-layout.yaml does not.
> 
> So all of this is normal, and you should just never use #nvmem-cell-cells,
> except in a node describing the location of the MAC address?

I was just explaining the source. If you have another use, then adjust 
the schema.

> When no #nvmem-cell-cells property is present,
> of_parse_phandle_with_optional_args() (as used in
> of_nvmem_cell_get()) returns zero anyway

Yeah, I don't see much value in disallowing #nvmem-cell-cells.

Rob
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/fuse/renesas,rcar-efuse.yaml b/Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.yaml
similarity index 54%
rename from Documentation/devicetree/bindings/fuse/renesas,rcar-efuse.yaml
rename to Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.yaml
index d7e289244e72cce1..ce7d65afa4602537 100644
--- a/Documentation/devicetree/bindings/fuse/renesas,rcar-efuse.yaml
+++ b/Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.yaml
@@ -1,7 +1,7 @@ 
 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
 %YAML 1.2
 ---
-$id: http://devicetree.org/schemas/fuse/renesas,rcar-efuse.yaml#
+$id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
 title: R-Car E-FUSE connected to PFC
@@ -13,6 +13,9 @@  description:
   The E-FUSE is a type of non-volatile memory, which is accessible through the
   Pin Function Controller (PFC) on some R-Car Gen4 SoCs.
 
+allOf:
+  - $ref: nvmem.yaml#
+
 properties:
   compatible:
     enum:
@@ -39,17 +42,27 @@  required:
   - power-domains
   - resets
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |
-    #include <dt-bindings/clock/r8a779a0-cpg-mssr.h>
-    #include <dt-bindings/power/r8a779a0-sysc.h>
-
-    fuse: fuse@e6078800 {
-            compatible = "renesas,r8a779a0-efuse";
-            reg = <0xe6078800 0x100>;
-            clocks = <&cpg CPG_MOD 916>;
-            power-domains = <&sysc R8A779A0_PD_ALWAYS_ON>;
-            resets = <&cpg 916>;
+    #include <dt-bindings/clock/r8a779f0-cpg-mssr.h>
+    #include <dt-bindings/power/r8a779f0-sysc.h>
+
+    fuse@e6078800 {
+        compatible = "renesas,r8a779f0-efuse";
+        reg = <0xe6078800 0x200>;
+        clocks = <&cpg CPG_MOD 915>;
+        power-domains = <&sysc R8A779F0_PD_ALWAYS_ON>;
+        resets = <&cpg 915>;
+
+        nvmem-layout {
+            compatible = "fixed-layout";
+            #address-cells = <1>;
+            #size-cells = <1>;
+
+            calib@144 {
+                reg = <0x144 0x08>;
+            };
+        };
     };
diff --git a/Documentation/devicetree/bindings/fuse/renesas,rcar-otp.yaml b/Documentation/devicetree/bindings/nvmem/renesas,rcar-otp.yaml
similarity index 60%
rename from Documentation/devicetree/bindings/fuse/renesas,rcar-otp.yaml
rename to Documentation/devicetree/bindings/nvmem/renesas,rcar-otp.yaml
index d74872ae9ff378f9..3313c03ea68dfd57 100644
--- a/Documentation/devicetree/bindings/fuse/renesas,rcar-otp.yaml
+++ b/Documentation/devicetree/bindings/nvmem/renesas,rcar-otp.yaml
@@ -1,7 +1,7 @@ 
 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
 %YAML 1.2
 ---
-$id: http://devicetree.org/schemas/fuse/renesas,rcar-otp.yaml#
+$id: http://devicetree.org/schemas/nvmem/renesas,rcar-otp.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
 title: R-Car E-FUSE connected to OTP_MEM
@@ -13,6 +13,9 @@  description:
   The E-FUSE is a type of non-volatile memory, which is accessible through the
   One-Time Programmable Memory (OTP_MEM) module on some R-Car Gen4 SoCs.
 
+allOf:
+  - $ref: nvmem.yaml#
+
 properties:
   compatible:
     enum:
@@ -22,17 +25,19 @@  properties:
   reg:
     items:
       - description: OTP_MEM_0
-      - description: OTP_MEM_1
+      - description: OTP_MEM_1.
+          The addresses of cells defined under the optional nvmem-layout
+          subnode are relative to this register bank.
 
 required:
   - compatible
   - reg
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |
-    otp: otp@e61be000 {
-            compatible = "renesas,r8a779g0-otp";
-            reg = <0xe61be000 0x1000>, <0xe61bf000 0x1000>;
+    otp@e61be000 {
+        compatible = "renesas,r8a779g0-otp";
+        reg = <0xe61be000 0x1000>, <0xe61bf000 0x1000>;
     };
diff --git a/MAINTAINERS b/MAINTAINERS
index 990aced7e7a57e1f..8da9c4ee231b4db4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2794,6 +2794,7 @@  Q:	http://patchwork.kernel.org/project/linux-renesas-soc/list/
 C:	irc://irc.libera.chat/renesas-soc
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git next
 F:	Documentation/devicetree/bindings/hwinfo/renesas,prr.yaml
+F:	Documentation/devicetree/bindings/nvmem/renesas,*
 F:	Documentation/devicetree/bindings/soc/renesas/
 F:	arch/arm/boot/dts/renesas/
 F:	arch/arm/configs/shmobile_defconfig