public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: niko.mauno@vaisala.com
To: u-boot@lists.denx.de
Cc: trini@konsulko.com, Niko Mauno <niko.mauno@vaisala.com>
Subject: [PATCH v2 0/3] bootcount: Small clean-up and fix, and dm_i2c single-word support
Date: Wed,  4 Feb 2026 15:17:34 +0200	[thread overview]
Message-ID: <cover.1770197302.git.niko.mauno@vaisala.com> (raw)

From: Niko Mauno <niko.mauno@vaisala.com>

In this series, we first introduce a clean-up where we switch to use
predefined bit masks instead of hard-coded values for count and magic
halves in the single-word (32-bit) boot count scheme.

Then we fix a case of missing boot count value masking in single-word
scenario in bootcount.c, which allowed clobbering of the magic half
when storing the value. With this change the clobbering preventing
behavior becomes consistent with existing single word bootcount storing
implementations in bootcount_at91.c and bootcount_davinci.c.

Finally, we enable the DM I2C bootcount driver to work also in single
word (4 byte) mode, in addition to the pre-existing half-word (2 byte)
mode. By default the driver still operates in half word mode as so far,
but can now be used alternatively in single word mode by adding
'size = <0x4>;' in the associated device tree node.

Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
--
Niko Mauno (3):
  bootcount: Use predefined count/magic bit masks
  bootcount: Fix potential clobbering issue
  bootcount: dm_i2c: Support also single word mode

 drivers/bootcount/bootcount.c         | 14 ++---
 drivers/bootcount/bootcount_at91.c    |  7 +--
 drivers/bootcount/bootcount_davinci.c |  6 +--
 drivers/bootcount/bootcount_dm_i2c.c  | 74 +++++++++++++++++++--------
 include/bootcount.h                   |  5 ++
 5 files changed, 74 insertions(+), 32 deletions(-)

-- 
2.47.3


             reply	other threads:[~2026-02-04 13:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-04 13:17 niko.mauno [this message]
2026-02-04 13:17 ` [PATCH v2 1/3] bootcount: Use predefined count/magic bit masks niko.mauno
2026-02-04 13:17 ` [PATCH v2 2/3] bootcount: Fix potential clobbering issue niko.mauno
2026-02-04 13:17 ` [PATCH v2 3/3] bootcount: dm_i2c: Support also single word mode niko.mauno
2026-02-19  0:15 ` [PATCH v2 0/3] bootcount: Small clean-up and fix, and dm_i2c single-word support Tom Rini

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.1770197302.git.niko.mauno@vaisala.com \
    --to=niko.mauno@vaisala.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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