[PATCH 1/3] [RFC] dt-bindings: nvmem: syscon: Add syscon backed nvmem bindings

Rob Herring robh at kernel.org
Fri Oct 28 14:28:38 PDT 2022


On Fri, Oct 28, 2022 at 12:50:18AM +0200, Marek Vasut wrote:
> Add trivial bindings for driver which permits exposing syscon backed
> register to userspace. This is useful e.g. to expose U-Boot boot
> counter on various platforms where the boot counter is stored in
> random volatile register, like STM32MP15xx TAMP_BKPxR register.

Generic bindings always start trivial until they get appended one 
property at a time...

What happens when you have more than 1 field and/or more than 1 
register?

> Signed-off-by: Marek Vasut <marex at denx.de>
> ---
> Cc: Alexandre Torgue <alexandre.torgue at foss.st.com>
> Cc: Rafał Miłecki <rafal at milecki.pl>
> Cc: Rob Herring <robh+dt at kernel.org>
> Cc: Srinivas Kandagatla <srinivas.kandagatla at linaro.org>
> Cc: devicetree at vger.kernel.org
> Cc: linux-stm32 at st-md-mailman.stormreply.com
> To: linux-arm-kernel at lists.infradead.org
> ---
>  .../bindings/nvmem/nvmem-syscon.yaml          | 39 +++++++++++++++++++
>  1 file changed, 39 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/nvmem/nvmem-syscon.yaml
> 
> diff --git a/Documentation/devicetree/bindings/nvmem/nvmem-syscon.yaml b/Documentation/devicetree/bindings/nvmem/nvmem-syscon.yaml
> new file mode 100644
> index 0000000000000..3035a0b2cd24a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/nvmem/nvmem-syscon.yaml
> @@ -0,0 +1,39 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/nvmem/nvmem-syscon.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Generic syscon backed nvmem
> +
> +maintainers:
> +  - Marek Vasut <marex at denx.de>
> +
> +allOf:
> +  - $ref: "nvmem.yaml#"
> +
> +properties:
> +  compatible:
> +    enum:
> +      - nvmem-syscon
> +
> +  reg:
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    tamp at 5c00a000 {
> +        compatible = "st,stm32-tamp", "syscon", "simple-mfd";

This is very common, but personally I think "syscon" and "simple-mfd" 
should be mutually exclusive. "simple-mfd" is saying the children have 
no dependency on the parent, yet the child nodes need a regmap from the 
parent. Sounds like a dependency.

> +        reg = <0x5c00a000 0x400>;
> +
> +        nvmem-syscon {
> +            compatible = "nvmem-syscon";
> +            reg = <0x14c 0x4>;

How does one identify this is the bootloader's boot count? How does the 
bootloader know it can write to this?

> +        };
> +    };
> -- 
> 2.35.1
> 
> 



More information about the linux-arm-kernel mailing list