Skip to content

dm_rtc: bootcount rtc driver#21

Merged
thom-nic merged 3 commits intomasterfrom
tmn-20-dm-rtc-support
Nov 2, 2025
Merged

dm_rtc: bootcount rtc driver#21
thom-nic merged 3 commits intomasterfrom
tmn-20-dm-rtc-support

Conversation

@thom-nic
Copy link
Copy Markdown
Contributor

@thom-nic thom-nic commented Oct 8, 2025

dts example:

	chosen {
		// see: u-boot/drivers/bootcount/bootcount-uclass.c
		u-boot,bootcount-device = &bootcount_rv3028;
	};

	/* Phycore contains an RV-3028-C7 RTC with user EEPROM:
	   https://www.microcrystal.com/fileadmin/Media/Products/RTC/App.Manual/RV-3028-C7_App-Manual.pdf
	   ensure the following config are enabled:
	   - CONFIG_DM_BOOTCOUNT_RTC
	   - CONFIG_RV3028
	  NOTE: u-boot/drivers/rtc/rv3028.c does not appear to support EEPROM access so we can only use
	  the two "User RAM" registers at 0x1F-0x20
	*/
	bootcount_rv3028: bc_rv3028 {
		// see: u-boot/drivers/bootcount/rtc.c
		compatible = "u-boot,bootcount-rtc";
		rtc = <&i2c_som_rtc>;
		offset = <0x1F>; // registers 0x1F-0x20 are "User RAM"
		/* NOTE: the linux rtc-rv3028 driver exposes *two* nvmem devices, one for the
		   user RAM registers and one for the EEPROM.
		   See: https://github.com/torvalds/linux/blob/v6.12/drivers/rtc/rtc-rv3028.c#L920-L927
		   These hints help the bootcount userspace program choose the correct nvmem device:
		*/
		linux,nvmem-type = "Battery backed";
		linux,nvmem-offset = <0x00>;
	};

Any rtc driver that exposes nvmem should work but the RV3028 is an example.

@thom-nic thom-nic self-assigned this Oct 8, 2025
@thom-nic thom-nic added the enhancement New feature or request label Oct 8, 2025
@thom-nic thom-nic force-pushed the tmn-20-dm-rtc-support branch 2 times, most recently from d2d718f to 8678683 Compare October 8, 2025 19:26
@thom-nic thom-nic force-pushed the tmn-dm-eeprom-support branch from b677e54 to 7a5d61a Compare October 9, 2025 12:48
@thom-nic thom-nic force-pushed the tmn-20-dm-rtc-support branch from 8678683 to e41ac84 Compare October 9, 2025 13:13
@thom-nic thom-nic force-pushed the tmn-dm-eeprom-support branch 3 times, most recently from b9d8156 to 754a1d6 Compare October 9, 2025 14:14
@thom-nic thom-nic force-pushed the tmn-20-dm-rtc-support branch from e41ac84 to bcd414e Compare October 9, 2025 14:32
@thom-nic thom-nic force-pushed the tmn-dm-eeprom-support branch 3 times, most recently from b575384 to f3ef673 Compare October 9, 2025 21:56
@thom-nic thom-nic force-pushed the tmn-20-dm-rtc-support branch from bcd414e to 35fa95b Compare October 10, 2025 02:04
@thom-nic thom-nic force-pushed the tmn-dm-eeprom-support branch from f3ef673 to d3f427a Compare October 15, 2025 02:17
@thom-nic thom-nic force-pushed the tmn-20-dm-rtc-support branch 2 times, most recently from a132d72 to b061e38 Compare October 15, 2025 20:05
@thom-nic thom-nic force-pushed the tmn-dm-eeprom-support branch 2 times, most recently from 140ba96 to 012cc96 Compare October 15, 2025 20:06
@thom-nic thom-nic force-pushed the tmn-20-dm-rtc-support branch 5 times, most recently from 3d01695 to fc5341c Compare October 16, 2025 17:44
@thom-nic thom-nic force-pushed the tmn-dm-eeprom-support branch from 012cc96 to 086e6ee Compare October 17, 2025 03:27
@thom-nic thom-nic force-pushed the tmn-20-dm-rtc-support branch from fc5341c to 3e98c18 Compare October 17, 2025 04:00
@thom-nic thom-nic force-pushed the tmn-dm-eeprom-support branch from 086e6ee to f84decf Compare October 17, 2025 04:01
@thom-nic thom-nic force-pushed the tmn-20-dm-rtc-support branch from 3e98c18 to 365acd1 Compare October 23, 2025 22:21
@thom-nic thom-nic force-pushed the tmn-dm-eeprom-support branch 2 times, most recently from cb9ecb7 to 256efb2 Compare October 24, 2025 14:05
@thom-nic thom-nic force-pushed the tmn-20-dm-rtc-support branch from 365acd1 to 6d84b9f Compare October 24, 2025 14:07
@thom-nic thom-nic force-pushed the tmn-dm-eeprom-support branch from 256efb2 to ce0ebaf Compare October 31, 2025 14:58
@thom-nic thom-nic marked this pull request as ready for review November 2, 2025 01:08
…he first

u-boot,bootcount* device that is defined. This matches the behavior in bootcount-uclass
@thom-nic thom-nic force-pushed the tmn-20-dm-rtc-support branch from 6d84b9f to 1a3433d Compare November 2, 2025 01:09
@thom-nic thom-nic changed the base branch from tmn-dm-eeprom-support to master November 2, 2025 01:10
@thom-nic thom-nic merged commit e4653a5 into master Nov 2, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support rtc nvmem

1 participant