From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Roese Date: Wed, 11 Mar 2015 09:51:38 +0100 Subject: [U-Boot] [PATCH] bootcount: Add dcache flush to bootcount_store() In-Reply-To: <1426063900-7267-1-git-send-email-sr@denx.de> References: <1426063900-7267-1-git-send-email-sr@denx.de> Message-ID: <1426063900-7267-2-git-send-email-sr@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Without this dcache_flush the updated bootcounter may not be saved to its location. This was detected on an iMX.6 platform using the OCRAM (internal SRAM) as bootcounter storage area. And issuing "reset" from within U-Boot cause the bootcounter to stay on its initial value. Signed-off-by: Stefan Roese --- drivers/bootcount/bootcount.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/bootcount/bootcount.c b/drivers/bootcount/bootcount.c index e0343f7..b3e79de 100644 --- a/drivers/bootcount/bootcount.c +++ b/drivers/bootcount/bootcount.c @@ -57,9 +57,11 @@ __weak void bootcount_store(ulong a) #if defined(CONFIG_SYS_BOOTCOUNT_SINGLEWORD) raw_bootcount_store(reg, (BOOTCOUNT_MAGIC & 0xffff0000) | a); + flush_dcache_range((u32)reg, (u32)reg + 4); #else raw_bootcount_store(reg, a); raw_bootcount_store(reg + 4, BOOTCOUNT_MAGIC); + flush_dcache_range((u32)reg, (u32)reg + 8); #endif } -- 2.3.2