Skip to contentSkip to conversation

Add pmic bootcount driver

PATCH Superseded Philip Oberfichtner 2 participants 5 messages Feb 25, 2022 – Mar 18, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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.

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/bootcount_pmic_pfuze100.c | 83 +++++++++++++++++++++
 include/power/pfuze100_pmic.h               |  5 ++
 4 files changed, 96 insertions(+)
 create mode 100644 drivers/bootcount/bootcount_pmic_pfuze100.c
Signature · 1 line
2.34.1
#1 lore raw

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

Add missing MEMA - MEMD register definitions for PFUZE100.

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

---

 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
#2 lore raw

PATCH 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]>.

---

 drivers/bootcount/Kconfig                   |  7 ++
 drivers/bootcount/Makefile                  |  1 +
 drivers/bootcount/bootcount_pmic_pfuze100.c | 83 +++++++++++++++++++++
 3 files changed, 91 insertions(+)
 create mode 100644 drivers/bootcount/bootcount_pmic_pfuze100.c
drivers/bootcount/Kconfig +7 -0
index 607027c968..9c37fa8ec8 100644
@@ -73,6 +73,13 @@ config BOOTCOUNT_ENV
 	  So the Userspace Application must set the "upgrade_available"
 	  and "bootcount" variable to 0, if a boot was successfully.
 
+config 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 BOOTCOUNT_RAM
 	bool "Boot counter in RAM"
 	help
drivers/bootcount/Makefile +1 -0
index 3a784bb0a6..d167815b3c 100644
@@ -9,6 +9,7 @@ obj-$(CONFIG_BOOTCOUNT_ENV)	+= bootcount_env.o
 obj-$(CONFIG_BOOTCOUNT_I2C)	+= bootcount_i2c.o
 obj-$(CONFIG_BOOTCOUNT_EXT)	+= bootcount_ext.o
 obj-$(CONFIG_BOOTCOUNT_AM33XX_NVMEM)	+= bootcount_nvmem.o
+obj-$(CONFIG_BOOTCOUNT_PMIC_PFUZE100)	+= bootcount_pmic_pfuze100.o
 
 obj-$(CONFIG_DM_BOOTCOUNT)      += bootcount-uclass.o
 obj-$(CONFIG_DM_BOOTCOUNT_RTC)  += rtc.o
drivers/bootcount/bootcount_pmic_pfuze100.c new file +83 -0

83 lines not on this page · raw message

Signature · 1 line
2.34.1
#3 lore raw

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

Hi Philip,

Quoted 7 lines · Philip Oberfichtner

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

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

Quoted 7 lines

---

 drivers/bootcount/Kconfig                   |  7 ++
 drivers/bootcount/Makefile                  |  1 +
 drivers/bootcount/bootcount_pmic_pfuze100.c | 83 +++++++++++++++++++++
 3 files changed, 91 insertions(+)
 create mode 100644 drivers/bootcount/bootcount_pmic_pfuze100.c

This should use driver model (DM_PMIC). Please don't add new features to unmigrated code.

Regards,
Simon

#4 lore raw

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

Quoted 19 lines · Simon Glass

Hi Philip,

Quoted 6 lines · Philip Oberfichtner

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

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

Quoted 8 lines

---

 drivers/bootcount/Kconfig                   |  7 ++
 drivers/bootcount/Makefile                  |  1 +
 drivers/bootcount/bootcount_pmic_pfuze100.c | 83
+++++++++++++++++++++
 3 files changed, 91 insertions(+)
 create mode 100644 drivers/bootcount/bootcount_pmic_pfuze100.c
Quoted 5 lines

This should use driver model (DM_PMIC). Please don't add new features to unmigrated code.

Regards,
Simon

Hi Simon,
thanks for the feedback. I sent a V2 using DM.

Best regardsPhilip