From patchwork Fri May 29 07:41:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 26879 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n4T7fXwk013399 for ; Fri, 29 May 2009 07:41:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754575AbZE2Hlj (ORCPT ); Fri, 29 May 2009 03:41:39 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754759AbZE2Hli (ORCPT ); Fri, 29 May 2009 03:41:38 -0400 Received: from mail.renesas.com ([202.234.163.13]:64834 "EHLO mail04.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754575AbZE2Hlh (ORCPT ); Fri, 29 May 2009 03:41:37 -0400 X-AuditID: ac140387-00000008000005fd-60-4a1f91a03563 Received: from guardian01.idc.renesas.com ([172.20.8.200]) by mail04.idc.renesas.com (sendmail) with ESMTP id n4T7fK8R008127; Fri, 29 May 2009 16:41:20 +0900 (JST) Received: (from root@localhost) by guardian01.idc.renesas.com with id n4T7fK4f006187; Fri, 29 May 2009 16:41:20 +0900 (JST) Received: from mta04.idc.renesas.com (localhost [127.0.0.1]) by mta04.idc.renesas.com with ESMTP id n4T7fKV8024835; Fri, 29 May 2009 16:41:20 +0900 (JST) Received: from PG10870.renesas.com ([172.30.8.159]) by ims05.idc.renesas.com (Sendmail) with ESMTPA id <0KKE00GBPAOUWW@ims05.idc.renesas.com>; Fri, 29 May 2009 16:41:18 +0900 (JST) Date: Fri, 29 May 2009 16:41:18 +0900 From: Kuninori Morimoto Subject: [PATCH] sh4a: add L2 cache support To: Paul Mundt Cc: SH-Linux Message-id: MIME-version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-type: text/plain; charset=US-ASCII User-Agent: SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.7 Emacs/22.1 (i386-mingw-nt5.1.2600) MULE/5.0 (SAKAKI) Meadow/3.00-dev (KIKU) X-Brightmail-Tracker: AAAAAA== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Signed-off-by: Kuninori Morimoto --- arch/sh/include/cpu-sh4/cpu/cache.h | 5 +++++ arch/sh/kernel/cpu/init.c | 8 ++++++++ arch/sh/mm/Kconfig | 5 +++++ 3 files changed, 18 insertions(+), 0 deletions(-) diff --git a/arch/sh/include/cpu-sh4/cpu/cache.h b/arch/sh/include/cpu-sh4/cpu/cache.h index 1c61ebf..0a438f5 100644 --- a/arch/sh/include/cpu-sh4/cpu/cache.h +++ b/arch/sh/include/cpu-sh4/cpu/cache.h @@ -31,6 +31,11 @@ #define CCR_CACHE_EMODE 0x80000000 /* EMODE Enable */ #endif +#define RAMCR 0xFF000074 +#define RAMCR_CACHE_L2FC 0x0002 +#define RAMCR_CACHE_L2E 0x0001 +#define L2_CACHE_ENABLE (RAMCR_CACHE_L2E|RAMCR_CACHE_L2FC) + /* Default CCR setup: 8k+16k-byte cache,P1-wb,enable */ #define CCR_CACHE_ENABLE (CCR_CACHE_OCE|CCR_CACHE_ICE) #define CCR_CACHE_INVALIDATE (CCR_CACHE_OCI|CCR_CACHE_ICI) diff --git a/arch/sh/kernel/cpu/init.c b/arch/sh/kernel/cpu/init.c index d29e69c..79646e8 100644 --- a/arch/sh/kernel/cpu/init.c +++ b/arch/sh/kernel/cpu/init.c @@ -146,6 +146,14 @@ static void __uses_jump_to_uncached cache_init(void) flags &= ~CCR_CACHE_ENABLE; #endif +#ifdef CONFIG_L2_CACHE_ENABLE + /* Enabel L2 cache */ + if (current_cpu_data.flags & CPU_HAS_L2_CACHE) { + ctrl_outl(flags & ~CCR_CACHE_ENABLE, CCR); + ctrl_outl(L2_CACHE_ENABLE, RAMCR); + } +#endif + ctrl_outl(flags, CCR); back_to_cached(); } diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig index 2795618..8be9d95 100644 --- a/arch/sh/mm/Kconfig +++ b/arch/sh/mm/Kconfig @@ -291,4 +291,9 @@ config CACHE_OFF endchoice +config L2_CACHE_ENABLE + bool "L2 Cache Enable" + depends on CACHE_WRITEBACK || CACHE_WRITETHROUGH + depends on CPU_SH4 + endmenu