diff options
| author | Tom Rini <[email protected]> | 2026-02-18 16:35:12 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-02-18 16:35:12 -0600 |
| commit | cf6aa7cf731d3b1b296802e47e9800b0d6bed65a (patch) | |
| tree | 84dfbc1bb014bcae37f1f9239075d8cb4b082f62 /include | |
| parent | 68e542d4f59f37889b8822f9a98d526c720f4273 (diff) | |
| parent | f97642853cd379ef69d00bca6c3928bce226dc5e (diff) | |
Merge patch series "bootcount: Small clean-up and fix, and dm_i2c single-word support"
Niko Mauno <[email protected]> says:
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.
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'include')
| -rw-r--r-- | include/bootcount.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/bootcount.h b/include/bootcount.h index 847c0f02d98..86474569d36 100644 --- a/include/bootcount.h +++ b/include/bootcount.h @@ -10,6 +10,7 @@ #include <asm/io.h> #include <asm/byteorder.h> #include <env.h> +#include <linux/bitops.h> #ifdef CONFIG_DM_BOOTCOUNT @@ -59,6 +60,10 @@ int dm_bootcount_set(struct udevice *dev, u32 bootcount); #endif +/* Bit masks for magic and count parts in single word scheme */ +#define BOOTCOUNT_MAGIC_MASK GENMASK(31, 16) +#define BOOTCOUNT_COUNT_MASK GENMASK(15, 0) + /** bootcount_store() - store the current bootcount */ void bootcount_store(ulong); |
