[U-Boot] [PATCH] ARM: Consolidate bootcount_{store|load}
Reinhard Meyer
u-boot at emk-elektronik.de
Tue Sep 14 02:33:58 CEST 2010
Dear Anatolij Gustschin,
> The latter was already used by AT91.
Looking at your patch I just noticed that the AT91 version is not up to
date. It won't work for AT91SAM9XE. I had a better, struct access variant
in my tree but somehow due to rebasing I must have lost it...
I'll reconstruct it and send you the source snippets to access the bootcount
with struct and readl/writel using the defines in at91_gpbr.h ?
It was something like
at91_gpbr_t *gpbr = (at91_gpbr_t *) AT91_GPR_BASE;
value = readl(&gpbr->reg[AT91_GPBR_INDEX_BOOTCOUNT]);
writel(value, &gpbr->reg[AT91_GPBR_INDEX_BOOTCOUNT]);
I don't think we should keep using the *(volatile *) access methods here,
but if, the address calculation would have to be:
+#include <asm/arch/at91_gpbr.h>
-#define AT91_GPBR_BOOTCOUNT_REGISTER 3
-#define AT91_BOOTCOUNT_ADDRESS (AT91_GPBR + 4 * AT91_GPBR_BOOTCOUNT_REGISTER)
-#define CONFIG_SYS_BOOTCOUNT_ADDR (AT91_BASE_SYS + AT91_BOOTCOUNT_ADDRESS)
+#define CONFIG_SYS_BOOTCOUNT_ADDR (AT91_GPBR_BASE + 4 * AT91_GPBR_INDEX_BOOTCOUNT)
Looking at this, I think its not really helpful to extract the bootcount access
from at91 / cpu.c ... to a common arm file.
Reinhard
More information about the U-Boot
mailing list