From: Nandor Han <nandor.han@vaisala.com>
To: srinivas.kandagatla@linaro.org, robh+dt@kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Cc: Nandor Han <nandor.han@vaisala.com>
Subject: [PATCH v3 0/4] Bootcount driver using NVMEM cell as backend.
Date: Thu, 29 Apr 2021 17:07:21 +0300 [thread overview]
Message-ID: <cover.1619704986.git.nandor.han@vaisala.com> (raw)
Description
-----------
Implement a bootcount (1) related driver that uses
NVMEM as a backend. The patchset will also update the
`snvs_lpgpr` driver to support 2 bytes NVMEM cells.
1. https://www.denx.de/wiki/view/DULG/UBootBootCountLimit
Testing
-------
Hardware: i.MX6sx evaluation board
Kernel: linux-imx-5.4.24
1. Configure the bootcount hardware in DT to use a NVMEM cell provided
by `snvs_lpgpr` driver as backend.
e.g. This will configure a 4 bytes long NVMEM cell
```
bootcount_regs: bootcount-snvs-regs@0 {
reg = <0x0 0x04>;
};
```
2. Record the current NVMEM cell content:
```
~ # hexdump -C
/sys/devices/soc0/soc/2000000.aips-bus/20cc000.snvs/20cc000.snvs:snvs-lpgpr/20cc000.snvs:snvs-lpgpr0/nvmem
00000000 00 00 01 b0 |....|
00000004
```
3. Write the bootcount and check that is successful: PASS
```
~ # echo 1 > /sys/bus/platform/drivers/bootcount-nvmem/bootcount/value
bootcount: Write regval: 0xb0010001
~ # hexdump -C
/sys/devices/soc0/soc/2000000.aips-bus/20cc000.snvs/20cc000.snvs:snvs-lpgpr/20cc000.snvs:snvs-lpgpr0/nvmem
00000000 01 00 01 b0 |....|
00000004
```
Note: similar tests were done also for 2 bytes NVMEM cell size.
Kernel: linux-next, tag: next-20210322
1. Enable bootcount and snvs_lpgpr drivers
2. Verify that they compile succesfully: PASS
```
kernel-master> make -j2 drivers/nvmem/
DESCEND objtool
CALL scripts/atomic/check-atomics.sh
CC arch/x86/kernel/asm-offsets.s
CALL scripts/checksyscalls.sh
CC drivers/nvmem/core.o
CC drivers/nvmem/bootcount-nvmem.o
CC drivers/nvmem/snvs_lpgpr.o
AR drivers/nvmem/built-in.
```
Testing the bootcount YAML document:
1. Check the document by running the command:
`make DT_CHECKER_FLAGS=-m dt_binding_check`
2. Verify that is successful: PASS
3. Verify that no warnings are generated by bootcount related yaml file: PASS
```
...
CHECK Documentation/devicetree/bindings/nvmem/brcm,nvram.example.dt.yaml DTC Documentation/devicetree/bindings/nvmem/bootcount-nvmem.example.dt.yaml
CHECK Documentation/devicetree/bindings/nvmem/bootcount-nvmem.example.dt.yaml
DTC Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.example.dt.yaml
...
```
Changes since v1
----------------
- Fix the dt-bindings YAML document.
Changes since v2
----------------
- Fix the dt-bindings YAML document warnings.
Nandor Han (4):
dt-bindings: nvmem: Add bootcount-nvmem
nvmem: bootcount: add bootcount driver
nvmem: snvs_lpgpr: use cell stride for regmap size calculation
nvmem: snvs_lpgpr: support two bytes NVMEM cell size
.../bindings/nvmem/bootcount-nvmem.yaml | 74 +++++++
drivers/nvmem/Kconfig | 10 +
drivers/nvmem/Makefile | 1 +
drivers/nvmem/bootcount-nvmem.c | 195 ++++++++++++++++++
drivers/nvmem/snvs_lpgpr.c | 67 +++++-
5 files changed, 341 insertions(+), 6 deletions(-)
create mode 100644 Documentation/devicetree/bindings/nvmem/bootcount-nvmem.yaml
create mode 100644 drivers/nvmem/bootcount-nvmem.c
--
2.26.3
next reply other threads:[~2021-04-29 14:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 14:07 Nandor Han [this message]
2021-04-29 14:07 ` [PATCH v3 1/4] dt-bindings: nvmem: Add bootcount-nvmem Nandor Han
2021-04-29 14:07 ` [PATCH v3 2/4] nvmem: bootcount: add bootcount driver Nandor Han
2021-04-29 14:07 ` [PATCH v3 3/4] nvmem: snvs_lpgpr: use cell stride for regmap size calculation Nandor Han
2021-04-29 14:07 ` [PATCH v3 4/4] nvmem: snvs_lpgpr: support two bytes NVMEM cell size Nandor Han
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=cover.1619704986.git.nandor.han@vaisala.com \
--to=nandor.han@vaisala.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.