embedded - Implementing U-Boot bootcount for TI AM62x - Stack Overflow

admin2025-04-18  5

I'm interested in porting the bootcount feature in u-boot to the TI AM62x SoC. The AM62x appears to take inspiration from its predecessor, the popular AM33x. Both SoCs have an RTC register block with a few "SCRATCH" registers that survive chip reset.

U-boot has explicit support for the AM33 RTC (bootcount_davinci.c).

Also, I've confirmed that on an AM625 I can indeed unlock the RTCSS block then write to SCRATCH2 from Linux userspace, and confirmed the value survives chip reset:

Options:

  1. SoC-spefific driver similar to bootcount_davinci.c
  2. Use the RTC or MEM driver?

Certainly I could transliterate the bootcount_davinci.c implementation and change the register addresses and KICK magic numbers. However u-boot supports several more generic bootcount models including "MEM", and "RTC." I don't yet understand these well enough to know if either of those drivers can support the AM62x scratch register, and I haven't yet found any examples of their use in mainline .dts files. So I'm hoping someone with familiarity with modern u-boot development could point me in the right direction.

The TI E2E forums have little discussion on the topic.

I think the davinci driver may be considered legacy at this point, and I imagine using the RTC driver - assuming it can support the AM62x - would be preferable vs adding a new SoC-specific driver. So my question may just be "how would one configure the bootcount-rtc driver for AM62x?"

Ref. and related:

  • userspace impl for AM62
  • u-boot/drivers/bootcount/rtc.c
  • u-boot/drivers/bootcount/bootcount_davinci.c
  • u-boot: how to access 'bootcount' from linux userspace?: My own prior SO question that led to the AM33x solution and birth of the uboot-bootcount project.
转载请注明原文地址:http://anycun.com/QandA/1744942824a89814.html