All of lore.kernel.org
 help / color / mirror / Atom feed
* i.MX6UL: Adding bootcount support
@ 2025-07-07  1:18 Fabio Estevam
  2025-07-07  4:31 ` Heiko Schocher
  0 siblings, 1 reply; 6+ messages in thread
From: Fabio Estevam @ 2025-07-07  1:18 UTC (permalink / raw)
  To: U-Boot-Denx
  Cc: Francesco Dolcini, Schrempf Frieder, Michael Trimarchi,
	Marek Vašut, Heiko Schocher

Hi,

I'm trying to enable bootcount support on the imx6ul-evk board like this:

--- a/configs/mx6ul_14x14_evk_defconfig
+++ b/configs/mx6ul_14x14_evk_defconfig
@@ -110,3 +110,8 @@ CONFIG_SPLASH_SCREEN=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_BMP_16BPP=y
 CONFIG_IMX_WATCHDOG=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0x020B0068
+CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y
+CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_MAGIC=0xB0C4000
+CONFIG_SYS_BOOTCOUNT_BE=y

However, the 'bootcount' variable does not increment after a 'reset' command:

=> print bootcount
bootcount=1

Has anyone managed to get bootcount working on it?MX6UL?

Thanks,

Fabio Estevam

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: i.MX6UL: Adding bootcount support
  2025-07-07  1:18 i.MX6UL: Adding bootcount support Fabio Estevam
@ 2025-07-07  4:31 ` Heiko Schocher
  2025-07-08  1:36   ` Fabio Estevam
  0 siblings, 1 reply; 6+ messages in thread
From: Heiko Schocher @ 2025-07-07  4:31 UTC (permalink / raw)
  To: Fabio Estevam, U-Boot-Denx
  Cc: Francesco Dolcini, Schrempf Frieder, Michael Trimarchi,
	Marek Vašut

Hi Fabio,

On 07.07.25 03:18, Fabio Estevam wrote:
> Hi,
> 
> I'm trying to enable bootcount support on the imx6ul-evk board like this:
> 
> --- a/configs/mx6ul_14x14_evk_defconfig
> +++ b/configs/mx6ul_14x14_evk_defconfig
> @@ -110,3 +110,8 @@ CONFIG_SPLASH_SCREEN=y
>   CONFIG_SPLASH_SCREEN_ALIGN=y
>   CONFIG_BMP_16BPP=y
>   CONFIG_IMX_WATCHDOG=y
> +CONFIG_SYS_BOOTCOUNT_ADDR=0x020B0068
> +CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y
> +CONFIG_BOOTCOUNT_LIMIT=y
> +CONFIG_SYS_BOOTCOUNT_MAGIC=0xB0C4000
> +CONFIG_SYS_BOOTCOUNT_BE=y
> 
> However, the 'bootcount' variable does not increment after a 'reset' command:
> 
> => print bootcount
> bootcount=1
> 
> Has anyone managed to get bootcount working on it?MX6UL?

Have you checked if CONFIG_SYS_BOOTCOUNT_ADDR address is stable over
reset? May someone overwrites it...

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

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

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@denx.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: i.MX6UL: Adding bootcount support
  2025-07-07  4:31 ` Heiko Schocher
@ 2025-07-08  1:36   ` Fabio Estevam
  2025-07-08  3:50     ` Heiko Schocher
  0 siblings, 1 reply; 6+ messages in thread
From: Fabio Estevam @ 2025-07-08  1:36 UTC (permalink / raw)
  To: hs
  Cc: U-Boot-Denx, Francesco Dolcini, Schrempf Frieder,
	Michael Trimarchi, Marek Vašut

Hi Heiko,

Thanks for your email.

On Mon, Jul 7, 2025 at 1:30 AM Heiko Schocher <hs@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.

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

Do you happen to remember which U-Boot version you used?

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

Regards,

Fabio Estevam

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: i.MX6UL: Adding bootcount support
  2025-07-08  1:36   ` Fabio Estevam
@ 2025-07-08  3:50     ` Heiko Schocher
  2025-07-08 11:37       ` Fabio Estevam
  0 siblings, 1 reply; 6+ messages in thread
From: Heiko Schocher @ 2025-07-08  3:50 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: U-Boot-Denx, Francesco Dolcini, Schrempf Frieder,
	Michael Trimarchi, Marek Vašut

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@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@denx.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: i.MX6UL: Adding bootcount support
  2025-07-08  3:50     ` Heiko Schocher
@ 2025-07-08 11:37       ` Fabio Estevam
  2025-07-11  4:00         ` Peng Fan
  0 siblings, 1 reply; 6+ messages in thread
From: Fabio Estevam @ 2025-07-08 11:37 UTC (permalink / raw)
  To: hs
  Cc: U-Boot-Denx, Francesco Dolcini, Schrempf Frieder,
	Michael Trimarchi, Marek Vašut

Hi Heiko,

On Tue, Jul 8, 2025 at 12:49 AM Heiko Schocher <hs@denx.de> wrote:

> 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 !)

Thanks for your help. It works now with the changes below:

diff --git a/arch/arm/dts/imx6ul-14x14-evk.dtsi
b/arch/arm/dts/imx6ul-14x14-evk.dtsi
index 1a18c41ce385..0239a153080c 100644
--- a/arch/arm/dts/imx6ul-14x14-evk.dtsi
+++ b/arch/arm/dts/imx6ul-14x14-evk.dtsi
@@ -384,7 +384,6 @@
 &wdog1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_wdog>;
-       fsl,ext-reset-output;
 };

 &iomuxc {
diff --git a/configs/mx6ul_14x14_evk_defconfig
b/configs/mx6ul_14x14_evk_defconfig
index 0e35e5e6af57..4a6a35346759 100644
--- a/configs/mx6ul_14x14_evk_defconfig
+++ b/configs/mx6ul_14x14_evk_defconfig
@@ -110,3 +110,7 @@ CONFIG_SPLASH_SCREEN=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_BMP_16BPP=y
 CONFIG_IMX_WATCHDOG=y
+CONFIG_BOOTCOUNT_BOOTLIMIT=3
+CONFIG_SYS_BOOTCOUNT_ADDR=0x20d8024
+CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y
+CONFIG_BOOTCOUNT_LIMIT=y

Thanks,

Fabio Estevam

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: i.MX6UL: Adding bootcount support
  2025-07-08 11:37       ` Fabio Estevam
@ 2025-07-11  4:00         ` Peng Fan
  0 siblings, 0 replies; 6+ messages in thread
From: Peng Fan @ 2025-07-11  4:00 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: hs, U-Boot-Denx, Francesco Dolcini, Schrempf Frieder,
	Michael Trimarchi, Marek Va??ut

On Tue, Jul 08, 2025 at 08:37:53AM -0300, Fabio Estevam wrote:
>Hi Heiko,
>
>On Tue, Jul 8, 2025 at 12:49???AM Heiko Schocher <hs@denx.de> wrote:
>
>> 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 !)
>
>Thanks for your help. It works now with the changes below:
>
>diff --git a/arch/arm/dts/imx6ul-14x14-evk.dtsi
>b/arch/arm/dts/imx6ul-14x14-evk.dtsi
>index 1a18c41ce385..0239a153080c 100644
>--- a/arch/arm/dts/imx6ul-14x14-evk.dtsi
>+++ b/arch/arm/dts/imx6ul-14x14-evk.dtsi
>@@ -384,7 +384,6 @@
> &wdog1 {
>        pinctrl-names = "default";
>        pinctrl-0 = <&pinctrl_wdog>;
>-       fsl,ext-reset-output;

Without this, there is no wdog output to 
reset pmic, so only SoC reset, the value will
be retained for bootcount.

Regards
Peng

> };
>
> &iomuxc {
>diff --git a/configs/mx6ul_14x14_evk_defconfig
>b/configs/mx6ul_14x14_evk_defconfig
>index 0e35e5e6af57..4a6a35346759 100644
>--- a/configs/mx6ul_14x14_evk_defconfig
>+++ b/configs/mx6ul_14x14_evk_defconfig
>@@ -110,3 +110,7 @@ CONFIG_SPLASH_SCREEN=y
> CONFIG_SPLASH_SCREEN_ALIGN=y
> CONFIG_BMP_16BPP=y
> CONFIG_IMX_WATCHDOG=y
>+CONFIG_BOOTCOUNT_BOOTLIMIT=3
>+CONFIG_SYS_BOOTCOUNT_ADDR=0x20d8024
>+CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y
>+CONFIG_BOOTCOUNT_LIMIT=y
>
>Thanks,
>
>Fabio Estevam

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-07-11  2:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-07  1:18 i.MX6UL: Adding bootcount support Fabio Estevam
2025-07-07  4:31 ` Heiko Schocher
2025-07-08  1:36   ` Fabio Estevam
2025-07-08  3:50     ` Heiko Schocher
2025-07-08 11:37       ` Fabio Estevam
2025-07-11  4:00         ` Peng Fan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.