Skip to contentSkip to conversation

Add pmic bootcount driver

PATCH In review Philip Oberfichtner 2 participants 5 messages Mar 18, 2022 – Mar 26, 2022

lore
Share & tools
lore
#0 lore raw

v2 cover Add pmic bootcount driver

This series adds a new bootcount driver. The required register definitions and the actual driver are separated in two patches.

Changes in v2:
- Migrated bootcount driver to driver model
- Introduced error handling. Previously errors were ignored.

Philip Oberfichtner (2):
power: pfuze100: Add MEMx register definitions
bootcount: Add pmic pfuze100 bootcount driver

 drivers/bootcount/Kconfig         |   7 ++
 drivers/bootcount/Makefile        |   1 +
 drivers/bootcount/pmic_pfuze100.c | 161 ++++++++++++++++++++++++++++++
 include/power/pfuze100_pmic.h     |   5 +
 4 files changed, 174 insertions(+)
 create mode 100644 drivers/bootcount/pmic_pfuze100.c
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/2 power: pfuze100: Add MEMx register definitions

Add missing MEMA - MEMD register definitions for PFUZE100.

Based on work from Heiko Schocher <[email protected]>.

---

(no changes since v1)

 include/power/pfuze100_pmic.h | 5 +++++
 1 file changed, 5 insertions(+)
include/power/pfuze100_pmic.h +5 -0
index f4383ed778..278f2549bf 100644
@@ -18,6 +18,11 @@ enum {
 	PFUZE100_REVID		= 0x03,
 	PFUZE100_FABID		= 0x04,
 
+	PFUZE100_MEMA		= 0x1c,
+	PFUZE100_MEMB		= 0x1d,
+	PFUZE100_MEMC		= 0x1e,
+	PFUZE100_MEMD		= 0x1f,
+
 	PFUZE100_SW1ABVOL	= 0x20,
 	PFUZE100_SW1ABSTBY	= 0x21,
 	PFUZE100_SW1ABOFF	= 0x22,
Signature · 1 line
2.34.1
#3 lore raw

PATCH v2 2/2 bootcount: Add pmic pfuze100 bootcount driver

In reply to Philip Oberfichtner

Use the MEMA - MEMD registers on the PFUZE100 as bootcount registers.

Based on work from Heiko Schocher <[email protected]>.

---

Changes in v2:
- Migrated bootcount driver to driver model
- Introduced error handling. Previously errors were ignored.

 drivers/bootcount/Kconfig         |   7 ++
 drivers/bootcount/Makefile        |   1 +
 drivers/bootcount/pmic_pfuze100.c | 161 ++++++++++++++++++++++++++++++
 3 files changed, 169 insertions(+)
 create mode 100644 drivers/bootcount/pmic_pfuze100.c
drivers/bootcount/Kconfig +7 -0
index 607027c968..509d01d41e 100644
@@ -127,6 +127,13 @@ config DM_BOOTCOUNT_I2C_EEPROM
 	  pointing to the underlying i2c eeprom device) and an optional 'offset'
 	  property are supported.
 
+config DM_BOOTCOUNT_PMIC_PFUZE100
+	bool "Enable Bootcount driver for PMIC PFUZE100"
+	depends on DM_PMIC_PFUZE100
+	help
+	  Enable support for the bootcounter using PMIC PFUZE100 registers.
+	  This works only, if the PMIC is not connected.
+
 config DM_BOOTCOUNT_SPI_FLASH
 	bool "Support SPI flash devices as a backing store for bootcount"
 	depends on DM_SPI_FLASH
drivers/bootcount/Makefile +1 -0
index 3a784bb0a6..b65959a384 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_BOOTCOUNT_EXT)	+= bootcount_ext.o
 obj-$(CONFIG_BOOTCOUNT_AM33XX_NVMEM)	+= bootcount_nvmem.o
 
 obj-$(CONFIG_DM_BOOTCOUNT)      += bootcount-uclass.o
+obj-$(CONFIG_DM_BOOTCOUNT_PMIC_PFUZE100) += pmic_pfuze100.o
 obj-$(CONFIG_DM_BOOTCOUNT_RTC)  += rtc.o
 obj-$(CONFIG_DM_BOOTCOUNT_I2C_EEPROM)	+= i2c-eeprom.o
 obj-$(CONFIG_DM_BOOTCOUNT_SPI_FLASH)	+= spi-flash.o
drivers/bootcount/pmic_pfuze100.c new file +161 -0

161 lines not on this page · raw message

Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH v2 2/2] bootcount: Add pmic pfuze100 bootcount driver

Quoted 5 lines · Philip Oberfichtner

Use the MEMA - MEMD registers on the PFUZE100 as bootcount registers.

Based on work from Heiko Schocher <[email protected]>.

Applied to u-boot/next, thanks!

Signature · 1 line
Tom