Message ID | 20210302074405.18998-1-zajec5@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [stblinux.git,1/2] dt-bindings: firmware: add Broadcom's NVRAM memory mapping | expand |
On Tue, Mar 02, 2021 at 08:44:04AM +0100, Rafał Miłecki wrote: > From: Rafał Miłecki <rafal@milecki.pl> > > NVRAM structure contains device data and can be accessed using MMIO. > > Signed-off-by: Rafał Miłecki <rafal@milecki.pl> > --- > .../bindings/firmware/brcm,nvram.yaml | 41 +++++++++++++++++++ > 1 file changed, 41 insertions(+) > create mode 100644 Documentation/devicetree/bindings/firmware/brcm,nvram.yaml > > diff --git a/Documentation/devicetree/bindings/firmware/brcm,nvram.yaml b/Documentation/devicetree/bindings/firmware/brcm,nvram.yaml > new file mode 100644 > index 000000000000..12af8e2e7c9c > --- /dev/null > +++ b/Documentation/devicetree/bindings/firmware/brcm,nvram.yaml > @@ -0,0 +1,41 @@ > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: "http://devicetree.org/schemas/firmware/brcm,nvram.yaml#" > +$schema: "http://devicetree.org/meta-schemas/core.yaml#" > + > +title: Broadcom's NVRAM > + > +maintainers: > + - Rafał Miłecki <rafal@milecki.pl> > + > +description: | > + NVRAM is a structure containing device specific environment variables. > + It is used for storing device configuration, booting parameters and > + calibration data. The structure of the data is fully discoverable just from a genericish 'brcm,nvram'? And it's a dedicated memory outside of regular RAM? > + > + It's required very early in booting process and so is made available > + using memory mapping. > + > + NVRAM can be found on Broadcom BCM47xx MIPS, Northstar ARM Cortex-A9 > + and some more devices. > + > +properties: > + compatible: > + const: brcm,nvram > + > + reg: > + description: memory region with NVRAM data > + maxItems: 1 > + > +required: > + - reg > + > +additionalProperties: false > + > +examples: > + - | > + nvram@1e000000 { > + compatible = "brcm,nvram"; > + reg = <0x1e000000 0x10000>; > + }; > -- > 2.26.2 >
On 08.03.2021 19:43, Rob Herring wrote: > On Tue, Mar 02, 2021 at 08:44:04AM +0100, Rafał Miłecki wrote: >> From: Rafał Miłecki <rafal@milecki.pl> >> >> NVRAM structure contains device data and can be accessed using MMIO. >> >> Signed-off-by: Rafał Miłecki <rafal@milecki.pl> >> --- >> .../bindings/firmware/brcm,nvram.yaml | 41 +++++++++++++++++++ >> 1 file changed, 41 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/firmware/brcm,nvram.yaml >> >> diff --git a/Documentation/devicetree/bindings/firmware/brcm,nvram.yaml b/Documentation/devicetree/bindings/firmware/brcm,nvram.yaml >> new file mode 100644 >> index 000000000000..12af8e2e7c9c >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/firmware/brcm,nvram.yaml >> @@ -0,0 +1,41 @@ >> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) >> +%YAML 1.2 >> +--- >> +$id: "http://devicetree.org/schemas/firmware/brcm,nvram.yaml#" >> +$schema: "http://devicetree.org/meta-schemas/core.yaml#" >> + >> +title: Broadcom's NVRAM >> + >> +maintainers: >> + - Rafał Miłecki <rafal@milecki.pl> >> + >> +description: | >> + NVRAM is a structure containing device specific environment variables. >> + It is used for storing device configuration, booting parameters and >> + calibration data. > > The structure of the data is fully discoverable just from a genericish > 'brcm,nvram'? Yes, NVRAM structure is a header (with magic and length) and a list of key-value pairs separated by \0. If you map memory at given address you should verify magic and start reading key-value pairs. Content example: foo=bar\0baz=qux\0quux(...) There is no predefined order of pairs, set of keys or anything similar I could think of. I can't think of anything more worth describing in DT. > And it's a dedicated memory outside of regular RAM? Yes
On 08.03.2021 22:37, Rafał Miłecki wrote: > On 08.03.2021 19:43, Rob Herring wrote: >> On Tue, Mar 02, 2021 at 08:44:04AM +0100, Rafał Miłecki wrote: >>> From: Rafał Miłecki <rafal@milecki.pl> >>> >>> NVRAM structure contains device data and can be accessed using MMIO. >>> >>> Signed-off-by: Rafał Miłecki <rafal@milecki.pl> >>> --- >>> .../bindings/firmware/brcm,nvram.yaml | 41 +++++++++++++++++++ >>> 1 file changed, 41 insertions(+) >>> create mode 100644 Documentation/devicetree/bindings/firmware/brcm,nvram.yaml >>> >>> diff --git a/Documentation/devicetree/bindings/firmware/brcm,nvram.yaml b/Documentation/devicetree/bindings/firmware/brcm,nvram.yaml >>> new file mode 100644 >>> index 000000000000..12af8e2e7c9c >>> --- /dev/null >>> +++ b/Documentation/devicetree/bindings/firmware/brcm,nvram.yaml >>> @@ -0,0 +1,41 @@ >>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) >>> +%YAML 1.2 >>> +--- >>> +$id: "http://devicetree.org/schemas/firmware/brcm,nvram.yaml#" >>> +$schema: "http://devicetree.org/meta-schemas/core.yaml#" >>> + >>> +title: Broadcom's NVRAM >>> + >>> +maintainers: >>> + - Rafał Miłecki <rafal@milecki.pl> >>> + >>> +description: | >>> + NVRAM is a structure containing device specific environment variables. >>> + It is used for storing device configuration, booting parameters and >>> + calibration data. >> >> The structure of the data is fully discoverable just from a genericish >> 'brcm,nvram'? > > Yes, NVRAM structure is a header (with magic and length) and a list of > key-value pairs separated by \0. If you map memory at given address you > should verify magic and start reading key-value pairs. > > Content example: foo=bar\0baz=qux\0quux(...) > > There is no predefined order of pairs, set of keys or anything similar I > could think of. I can't think of anything more worth describing in DT. Ah, I've just realized, I'm replying to the "firmware" binding patch. Florian suggested to look at NVMEM subsystem instead. Please kindly check [PATCH V2 1/2] dt-bindings: nvmem: add Broadcom's NVRAM
diff --git a/Documentation/devicetree/bindings/firmware/brcm,nvram.yaml b/Documentation/devicetree/bindings/firmware/brcm,nvram.yaml new file mode 100644 index 000000000000..12af8e2e7c9c --- /dev/null +++ b/Documentation/devicetree/bindings/firmware/brcm,nvram.yaml @@ -0,0 +1,41 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/firmware/brcm,nvram.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Broadcom's NVRAM + +maintainers: + - Rafał Miłecki <rafal@milecki.pl> + +description: | + NVRAM is a structure containing device specific environment variables. + It is used for storing device configuration, booting parameters and + calibration data. + + It's required very early in booting process and so is made available + using memory mapping. + + NVRAM can be found on Broadcom BCM47xx MIPS, Northstar ARM Cortex-A9 + and some more devices. + +properties: + compatible: + const: brcm,nvram + + reg: + description: memory region with NVRAM data + maxItems: 1 + +required: + - reg + +additionalProperties: false + +examples: + - | + nvram@1e000000 { + compatible = "brcm,nvram"; + reg = <0x1e000000 0x10000>; + };