Skip to contentSkip to conversation

: bootcount: zynqmp: Add bootcount API

PATCH Applied Vasileios Amoiridis 2 participants 3 messages Nov 5, 2024 – Nov 14, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover : bootcount: zynqmp: Add bootcount API

From: Vasileios Amoiridis <[email protected]>

Changes in v3:

1) Organize correctly headers
2) Remove redundant "mio" and change "write" to "read"
3) Add "depends on ARCH_ZYNQMP"

v2: https://lore.kernel.org/u-boot/[email protected]/
v1: https://lore.kernel.org/u-boot/[email protected]/

Vasileios Amoiridis (1):
drivers: bootcount: Add ZynqMP specific bootcount support

 MAINTAINERS                                  |  1 +
 arch/arm/mach-zynqmp/include/mach/hardware.h |  2 +
 drivers/bootcount/Kconfig                    |  7 +++
 drivers/bootcount/Makefile                   |  1 +
 drivers/bootcount/bootcount_zynqmp.c         | 47 ++++++++++++++++++++
 5 files changed, 58 insertions(+)
 create mode 100644 drivers/bootcount/bootcount_zynqmp.c

base-commit: 56accc56b9aab87ef4809ccc588e1257969cd271

Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 1/1 drivers: bootcount: Add ZynqMP specific bootcount support

From: Vasileios Amoiridis <[email protected]>

Add native support of the bootcount mechanism in the ZynqMP by utilising internal PMU registers. The Persistent Global Storage Registers of the Platform Management Unit can keep their value during reboot cycles unless there is a POR reset, making them appropriate for the bootcount mechanism.

---
 MAINTAINERS                                  |  1 +
 arch/arm/mach-zynqmp/include/mach/hardware.h |  2 +
 drivers/bootcount/Kconfig                    |  7 +++
 drivers/bootcount/Makefile                   |  1 +
 drivers/bootcount/bootcount_zynqmp.c         | 47 ++++++++++++++++++++
 5 files changed, 58 insertions(+)
 create mode 100644 drivers/bootcount/bootcount_zynqmp.c
MAINTAINERS +1 -0
index 0399ed1dbf..bc27a514e8 100644
@@ -860,6 +860,7 @@ M:	Michal Simek <[email protected]>
 S:	Maintained
 T:	git https://source.denx.de/u-boot/custodians/u-boot-microblaze.git
 F:	arch/arm/mach-zynqmp/
+F:	drivers/bootcount/bootcount_zynqmp.c
 F:	drivers/clk/clk_zynqmp.c
 F:	driver/firmware/firmware-zynqmp.c
 F:	drivers/fpga/zynqpl.c
arch/arm/mach-zynqmp/include/mach/hardware.h +2 -0
index 49e449ebd6..3c372bd6dc 100644
@@ -188,6 +188,8 @@ struct pmu_regs {
 	u32 gen_storage4; /* 0x40 */
 	u32 reserved1[1];
 	u32 gen_storage6; /* 0x48 */
+	u32 reserved2[3];
+	u32 pers_gen_storage2; /* 0x58 */
 };
 
 #define pmu_base ((struct pmu_regs *)ZYNQMP_PMU_BASEADDR)
drivers/bootcount/Kconfig +7 -0
index fa6d8e7128..0080d2a165 100644
@@ -164,6 +164,13 @@ config DM_BOOTCOUNT_SYSCON
 
 	  Accessing the backend is done using the regmap interface.
 
+config DM_BOOTCOUNT_ZYNQMP
+	bool "Support ZynqMP PMUFW as a backing store for bootcount"
+	depends on ARCH_ZYNQMP
+	help
+	  Enable support for the bootcount API by utilising the Persistent
+	  Global General Storage Register 2 of the PMU.
+
 endmenu
 
 endif
drivers/bootcount/Makefile +1 -0
index 245f879633..0cf79e428d 100644
@@ -16,3 +16,4 @@ obj-$(CONFIG_DM_BOOTCOUNT_I2C_EEPROM)	+= i2c-eeprom.o
 obj-$(CONFIG_DM_BOOTCOUNT_I2C)	+= bootcount_dm_i2c.o
 obj-$(CONFIG_DM_BOOTCOUNT_SPI_FLASH)	+= spi-flash.o
 obj-$(CONFIG_DM_BOOTCOUNT_SYSCON) += bootcount_syscon.o
+obj-$(CONFIG_DM_BOOTCOUNT_ZYNQMP)	+= bootcount_zynqmp.o
drivers/bootcount/bootcount_zynqmp.c new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
2.34.1
maintainer Applied
#2 lore raw
In reply to Vasileios Amoiridis
Quoted 20 lines · Vasileios Amoiridis

From: Vasileios Amoiridis <[email protected]>

Changes in v3:

1) Organize correctly headers
2) Remove redundant "mio" and change "write" to "read"
3) Add "depends on ARCH_ZYNQMP"

v2: https://lore.kernel.org/u-boot/[email protected]/
v1: https://lore.kernel.org/u-boot/[email protected]/

Vasileios Amoiridis (1):
drivers: bootcount: Add ZynqMP specific bootcount support

  MAINTAINERS                                  |  1 +
  arch/arm/mach-zynqmp/include/mach/hardware.h |  2 +
  drivers/bootcount/Kconfig                    |  7 +++
  drivers/bootcount/Makefile                   |  1 +
  drivers/bootcount/bootcount_zynqmp.c         | 47 ++++++++++++++++++++
  5 files changed, 58 insertions(+)
Quoted 4 lines

create mode 100644 drivers/bootcount/bootcount_zynqmp.c

base-commit: 56accc56b9aab87ef4809ccc588e1257969cd271

Applied.
M