Skip to contentSkip to conversation

configs: icorem6: Use imx6 cratch register for bootcount

PATCH New Jagan Teki 3 participants 4 messages Mar 21, 2019 Arm i.MX and Layerscape

lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

PATCH 1/1 configs: icorem6: Use imx6 cratch register for bootcount

SRAM address used for bootcount on exiting code is erasing previous count value when system reset from Linux. So use the dedicated imx6 scratch register, GPR2 to preserve the contents even if the system reset from Linux.

Fixes 4eb9aa39350e ("configs: imx6qdl_icore_mmc: Enable watchdog and bootcounter")
---
 configs/imx6qdl_icore_mmc_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configs/imx6qdl_icore_mmc_defconfig +1 -1
index 68ad1c6d20..24e99718e6 100644
@@ -16,7 +16,7 @@ CONFIG_CMD_BOOTCOUNT=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_BOOTLIMIT=3
 CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y
-CONFIG_SYS_BOOTCOUNT_ADDR=0x00900000
+CONFIG_SYS_BOOTCOUNT_ADDR=0x020D8024
 CONFIG_SYS_BOOTCOUNT_MAGIC=0x0B01C041
 CONFIG_IMX_WATCHDOG=y
 CONFIG_DEBUG_UART=y
Signature · 1 line
2.18.0.321.gffc6fa0e3
#1 lore raw

PATCH 1/1 configs: icorem6: Use imx6 cratch register for bootcount

Hi,

Quoted 8 lines

SRAM address used for bootcount on exiting code is erasing previous count value when system reset from Linux. So use the dedicated imx6 scratch register, GPR2 to preserve the contents even if the system reset from Linux.

Fixes 4eb9aa39350e ("configs: imx6qdl_icore_mmc: Enable watchdog and bootcounter")

I tested this on Engicam imx6q-icore, so

#2 lore raw

PATCH 1/1 configs: icorem6: Use imx6 cratch register for bootcount

In reply to Jagan Teki

Hi Jagan,

nitpick: cratch ==> scratch

Quoted 18 lines · Jagan Teki

SRAM address used for bootcount on exiting code is erasing previous count value when system reset from Linux. So use the dedicated imx6 scratch register, GPR2 to preserve the contents even if the system reset from Linux.

Fixes 4eb9aa39350e ("configs: imx6qdl_icore_mmc: Enable watchdog and bootcounter")
---
 configs/imx6qdl_icore_mmc_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configs/imx6qdl_icore_mmc_defconfig +0 -0
index 68ad1c6d20..24e99718e6 100644

configs/imx6qdl_icore_mmc_defconfig CONFIG_CMD_BOOTCOUNT=y · line 22

Quoted 8 lines
configs/imx6qdl_icore_mmc_defconfig +1 -1
@@ -16,7 +16,7 @@ CONFIG_CMD_BOOTCOUNT=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_BOOTLIMIT=3
 CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y
-CONFIG_SYS_BOOTCOUNT_ADDR=0x00900000
+CONFIG_SYS_BOOTCOUNT_ADDR=0x020D8024
 CONFIG_SYS_BOOTCOUNT_MAGIC=0x0B01C041
 CONFIG_IMX_WATCHDOG=y
 CONFIG_DEBUG_UART=y

Just as info: I confirm that using start address of SRAM does not work. Rather even the GPRx registers are not a common solution. I have already seen that even the GPRx registers are touched and cannot be used on some i.MX6 variant. Anyway, if this works on your board, fine.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#3 lore raw

PATCH 1/1 configs: icorem6: Use imx6 cratch register for bootcount

Hi Stefano,

Thanks a lot for reviewing this

Quoted 26 lines

nitpick: cratch ==> scratch

Quoted 23 lines · Jagan Teki

SRAM address used for bootcount on exiting code is erasing previous count value when system reset from Linux. So use the dedicated imx6 scratch register, GPR2 to preserve the contents even if the system reset from Linux.

Fixes 4eb9aa39350e ("configs: imx6qdl_icore_mmc: Enable watchdog and bootcounter")
---
 configs/imx6qdl_icore_mmc_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configs/imx6qdl_icore_mmc_defconfig +1 -1
index 68ad1c6d20..24e99718e6 100644
@@ -16,7 +16,7 @@ CONFIG_CMD_BOOTCOUNT=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_BOOTLIMIT=3
 CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y
-CONFIG_SYS_BOOTCOUNT_ADDR=0x00900000
+CONFIG_SYS_BOOTCOUNT_ADDR=0x020D8024
 CONFIG_SYS_BOOTCOUNT_MAGIC=0x0B01C041
Quoted 8 lines

configs/imx6qdl_icore_mmc_defconfig CONFIG_CMD_BOOTCOUNT=y · line 22

Quoted 3 lines
configs/imx6qdl_icore_mmc_defconfig +0 -0
 CONFIG_IMX_WATCHDOG=y
 CONFIG_DEBUG_UART=y

Just as info: I confirm that using start address of SRAM does not work. Rather even the GPRx registers are not a common solution. I have already seen that even the GPRx registers are touched and cannot be used on some i.MX6 variant. Anyway, if this works on your board, fine.

Since GPRx registers are common to i.MX6, I think it can work irrespective of boards, please correct me
if I am missing something here.

Did you come across any generic and robust solution for this ? It would be great if we can use more generic or better solution. Please let us know.

Thanks a lot,
Shyam