From: Marek Vasut <marex@denx.de>
To: Rob Herring <robh@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org,
"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
"Rafał Miłecki" <rafal@milecki.pl>,
"Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
devicetree@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com
Subject: Re: [PATCH 1/3] [RFC] dt-bindings: nvmem: syscon: Add syscon backed nvmem bindings
Date: Sun, 27 Nov 2022 23:05:18 +0100 [thread overview]
Message-ID: <f54b0c3f-07c5-32bb-b64f-b2986c35d7c3@denx.de> (raw)
In-Reply-To: <20221028212838.GA2286583-robh@kernel.org>
On 10/28/22 23:28, Rob Herring wrote:
> 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?
If it is a continuous register array, the user can use the size field to
describe such register array here.
If it is a sparse register array, multiple nvmem-syscon nodes would be
needed. I haven't seen anything which would require one node for sparse
register arrays, like boot counter distributed across multiple
non-continuous registers or such.
>> +properties:
>> + compatible:
>> + enum:
>> + - nvmem-syscon
>> +
>> + reg:
>> + maxItems: 1
>> +
>> +required:
>> + - compatible
>> + - reg
>> +
>> +additionalProperties: false
>> +
>> +examples:
>> + - |
>> + tamp@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.
So what exactly should be changed here?
>> + reg = <0x5c00a000 0x400>;
>> +
>> + nvmem-syscon {
>> + compatible = "nvmem-syscon";
>> + reg = <0x14c 0x4>;
>
> How does one identify this is the bootloader's boot count?
The user has to know where the boot counter is stored (by hardware
path). I wouldn't attempt to assign any complex logic here, since the
boot counter could be implemented in various ways. Besides, this may not
even be a boot counter, but some other variable exposed to user space.
Maybe a unique node name can be used to discern the different
nvmem-syscon nodes representing different variables if needed.
> How does the
> bootloader know it can write to this?
The bootloader implementer selected the bootcounter register based on
hardware knowledge .
prev parent reply other threads:[~2022-11-27 22:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-27 22:50 [PATCH 1/3] [RFC] dt-bindings: nvmem: syscon: Add syscon backed nvmem bindings Marek Vasut
2022-10-27 22:50 ` [PATCH 2/3] [RFC] nvmem: syscon: Add syscon backed nvmem driver Marek Vasut
2022-10-27 22:50 ` [PATCH 3/3] [RFC] ARM: dts: stm32: Add nvmem-syscon node to TAMP to expose boot count on DHSOM Marek Vasut
2022-10-28 12:20 ` [PATCH 1/3] [RFC] dt-bindings: nvmem: syscon: Add syscon backed nvmem bindings Rob Herring
2022-10-28 21:28 ` Rob Herring
2022-11-27 22:05 ` Marek Vasut [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f54b0c3f-07c5-32bb-b64f-b2986c35d7c3@denx.de \
--to=marex@denx.de \
--cc=alexandre.torgue@foss.st.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=rafal@milecki.pl \
--cc=robh@kernel.org \
--cc=srinivas.kandagatla@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).