From: Reinhard Meyer Date: Tue, 14 Sep 2010 02:33:58 +0200 Subject: [U-Boot] [PATCH] ARM: Consolidate bootcount_{store|load} In-Reply-To: <1284406319-9032-1-git-send-email-agust@denx.de> References: <1284406319-9032-1-git-send-email-agust@denx.de> Message-ID: <4C8EC2F6.6090303@emk-elektronik.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 -#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