All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] configs: icorem6: Use imx6 cratch register for bootcount
@ 2019-03-21  8:35 Jagan Teki
  2019-03-21  8:45 ` Shyam Saini
  2019-03-21  9:05 ` Stefano Babic
  0 siblings, 2 replies; 4+ messages in thread
From: Jagan Teki @ 2019-03-21  8:35 UTC (permalink / raw)
  To: u-boot

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")
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 configs/imx6qdl_icore_mmc_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/imx6qdl_icore_mmc_defconfig b/configs/imx6qdl_icore_mmc_defconfig
index 68ad1c6d20..24e99718e6 100644
--- a/configs/imx6qdl_icore_mmc_defconfig
+++ b/configs/imx6qdl_icore_mmc_defconfig
@@ -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
-- 
2.18.0.321.gffc6fa0e3

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

* [U-Boot] [PATCH] configs: icorem6: Use imx6 cratch register for bootcount
  2019-03-21  8:35 [U-Boot] [PATCH] configs: icorem6: Use imx6 cratch register for bootcount Jagan Teki
@ 2019-03-21  8:45 ` Shyam Saini
  2019-03-21  9:05 ` Stefano Babic
  1 sibling, 0 replies; 4+ messages in thread
From: Shyam Saini @ 2019-03-21  8:45 UTC (permalink / raw)
  To: u-boot

Hi,

> 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")
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

I tested this on Engicam imx6q-icore, so

Tested-by: Shyam Saini <shyam.saini@amarulasolutions.com>

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

* [U-Boot] [PATCH] configs: icorem6: Use imx6 cratch register for bootcount
  2019-03-21  8:35 [U-Boot] [PATCH] configs: icorem6: Use imx6 cratch register for bootcount Jagan Teki
  2019-03-21  8:45 ` Shyam Saini
@ 2019-03-21  9:05 ` Stefano Babic
  2019-03-21  9:51   ` Shyam Saini
  1 sibling, 1 reply; 4+ messages in thread
From: Stefano Babic @ 2019-03-21  9:05 UTC (permalink / raw)
  To: u-boot

Hi Jagan,

nitpick: cratch ==> scratch

On 21/03/19 09:35, Jagan Teki wrote:
> 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")
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>  configs/imx6qdl_icore_mmc_defconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configs/imx6qdl_icore_mmc_defconfig b/configs/imx6qdl_icore_mmc_defconfig
> index 68ad1c6d20..24e99718e6 100644
> --- a/configs/imx6qdl_icore_mmc_defconfig
> +++ b/configs/imx6qdl_icore_mmc_defconfig
> @@ -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.

Reviewed-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic

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

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

* [U-Boot] [PATCH] configs: icorem6: Use imx6 cratch register for bootcount
  2019-03-21  9:05 ` Stefano Babic
@ 2019-03-21  9:51   ` Shyam Saini
  0 siblings, 0 replies; 4+ messages in thread
From: Shyam Saini @ 2019-03-21  9:51 UTC (permalink / raw)
  To: u-boot

Hi Stefano,

Thanks a lot for reviewing this

> nitpick: cratch ==> scratch
>
> On 21/03/19 09:35, Jagan Teki wrote:
> > 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")
> > Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> > ---
> >  configs/imx6qdl_icore_mmc_defconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/configs/imx6qdl_icore_mmc_defconfig b/configs/imx6qdl_icore_mmc_defconfig
> > index 68ad1c6d20..24e99718e6 100644
> > --- a/configs/imx6qdl_icore_mmc_defconfig
> > +++ b/configs/imx6qdl_icore_mmc_defconfig
> > @@ -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.

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

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

end of thread, other threads:[~2019-03-21  9:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-21  8:35 [U-Boot] [PATCH] configs: icorem6: Use imx6 cratch register for bootcount Jagan Teki
2019-03-21  8:45 ` Shyam Saini
2019-03-21  9:05 ` Stefano Babic
2019-03-21  9:51   ` Shyam Saini

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.