From patchwork Tue Apr 24 05:34:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Kristiansson X-Patchwork-Id: 154594 X-Patchwork-Delegate: vapier@gentoo.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 69756B6F62 for ; Tue, 24 Apr 2012 15:42:41 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F32AD282A2; Tue, 24 Apr 2012 07:42:37 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id goB+fPpj3f8H; Tue, 24 Apr 2012 07:42:36 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8C90628299; Tue, 24 Apr 2012 07:42:30 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id ABABE28299 for ; Tue, 24 Apr 2012 07:42:28 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Pmp+dCITVqOn for ; Tue, 24 Apr 2012 07:42:28 +0200 (CEST) X-Greylist: delayed 434 seconds by postgrey-1.27 at theia; Tue, 24 Apr 2012 07:42:26 CEST X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtp-68.nebula.fi (smtp-68.nebula.fi [83.145.220.68]) by theia.denx.de (Postfix) with ESMTPS id 2B15E2825F for ; Tue, 24 Apr 2012 07:42:26 +0200 (CEST) Received: from wonka.TeleWell.gateway (nblzone-224-141.nblnetworks.fi [83.145.224.141]) by smtp-68.nebula.fi (Postfix) with ESMTP id 67FEF43F08B5; Tue, 24 Apr 2012 08:35:08 +0300 (EEST) From: Stefan Kristiansson To: u-boot@lists.denx.de Date: Tue, 24 Apr 2012 08:34:31 +0300 Message-Id: <1335245671-20544-1-git-send-email-stefan.kristiansson@saunalahti.fi> X-Mailer: git-send-email 1.7.5.4 Subject: [U-Boot] [PATCH] openrisc/cache: disable icache during invalidation X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de invalidating the memory area that is being executed while icache is on is a bit adventurous, make sure it's turned off during this operation Signed-off-by: Stefan Kristiansson --- arch/openrisc/cpu/cache.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/openrisc/cpu/cache.c b/arch/openrisc/cpu/cache.c index 2a73a4f..fedfd89 100644 --- a/arch/openrisc/cpu/cache.c +++ b/arch/openrisc/cpu/cache.c @@ -44,11 +44,15 @@ void invalidate_dcache_range(unsigned long addr, unsigned long stop) static void invalidate_icache_range(unsigned long addr, unsigned long stop) { ulong block_size = (mfspr(SPR_ICCFGR) & SPR_ICCFGR_CBS) ? 32 : 16; + ulong ie = icache_status(); + icache_disable(); while (addr < stop) { mtspr(SPR_ICBIR, addr); addr += block_size; } + if (ie) + icache_enable(); } void flush_cache(unsigned long addr, unsigned long size)