i.MX6UL: Adding bootcount support
Heiko Schocher
hs at denx.de
Tue Jul 8 05:50:28 CEST 2025
Hi Fabio,
On 08.07.25 03:36, Fabio Estevam wrote:
> Hi Heiko,
>
> Thanks for your email.
>
> On Mon, Jul 7, 2025 at 1:30 AM Heiko Schocher <hs at denx.de> wrote:
>
>> Have you checked if CONFIG_SYS_BOOTCOUNT_ADDR address is stable over
>> reset? May someone overwrites it...
>
> When I inspect via md.l, it is always zero.
?
Did you tried to write it with mw ? After boot, it should be != 0
>
>> I had it working on imx6ull
>>
>> CONFIG_BOOTCOUNT_BOOTLIMIT=3
>> CONFIG_SYS_BOOTCOUNT_ADDR=0x20d8024
>> CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y
>> CONFIG_BOOTCOUNT_LIMIT=y
>
> I tried these changes, but they did not help.
Hmm.. of course the address do not fit for imx6ul... Here I used
SRC_GPR2...
The imx6ull says here:
Holds argument of entry function for core0 for waking-up from low power mode. The SRC ensures that
the register value will persist across system resets.
Which is, what I need for bootcount feature...
=> md 20d8024 1
020d8024: b0010002 ....
=>
=> res
[...]
=> md 20d8024 1
020d8024: b0010003 ....
=>
So fine incrementing value, with magic number here...
> Do you happen to remember which U-Boot version you used?
2023.10
>> I did not needed
>>
>> > +CONFIG_SYS_BOOTCOUNT_MAGIC=0xB0C4000
>> > +CONFIG_SYS_BOOTCOUNT_BE=y
>>
>> but may because I have an older base...
>>
>> Hmm.. your register seems fine ... I read in RM:
>> """
>> For backward compatibility with earlier
>> versions of SNVS LPGPR0 is aliased at its original offset of 68h.The GPR will be
>> automatically zeroized when a tamper event occurs, unless GPR zeroization is disabled
>> via the GPR_Z_DIS bit in the LP Control Register.
>> """
>>
>> May try 0x20b00090 ... just a try...
>
> Also, tried, but it also stays at 0.
>
>> May tamper event occurs? And the register is in "low power domain" ... may
>> there is a problem... so no real idea here from my side, just speculation...
>
> It seems that I am missing something to get the LPGPR register to increment.
Yep...
Ah, looked into RM of imx6ul ... it has also a SRC_GPR2 with the same
comment as imx6ull has ... uff... why does this not work for you than?
Try with md and mw and make soft resets (not power off/on !)
And try may the other SRC_GPRx registers ... but of course you need to
check, that your kernel does not use them...
bye,
Heiko
--
DENX Software Engineering GmbH, Managing Director: Johanna Denk, Tabea Lutz
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs at denx.de
More information about the U-Boot
mailing list