From patchwork Tue Jul 31 06:13:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Xie X-Patchwork-Id: 1258101 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 5A3D93FC1A for ; Tue, 31 Jul 2012 06:33:04 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Sw5ve-0002SS-RI; Tue, 31 Jul 2012 06:27:38 +0000 Received: from na3sys009aog134.obsmtp.com ([74.125.149.83]) by merlin.infradead.org with smtps (Exim 4.76 #1 (Red Hat Linux)) id 1Sw5rF-0001sg-KH for linux-arm-kernel@lists.infradead.org; Tue, 31 Jul 2012 06:23:07 +0000 Received: from MSI-MTA.marvell.com ([65.219.4.132]) (using TLSv1) by na3sys009aob134.postini.com ([74.125.148.12]) with SMTP ID DSNKUBd5xojSGoS/le2SQ5DlYD35cB/h/2Q8@postini.com; Mon, 30 Jul 2012 23:23:05 PDT Received: from maili.marvell.com ([10.68.76.210]) by MSI-MTA.marvell.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 30 Jul 2012 23:13:11 -0700 Received: from localhost (unknown [10.38.36.110]) by maili.marvell.com (Postfix) with ESMTP id 85E734E50D; Mon, 30 Jul 2012 23:13:11 -0700 (PDT) From: Chao Xie To: haojian.zhuang@gmail.com, linux-arm-kernel@lists.infradead.org, chao.xie@marvell.com Subject: [PATCH 7/7] arm: cache: add dt support for tauros2 cache Date: Tue, 31 Jul 2012 14:13:14 +0800 Message-Id: <1343715194-25900-7-git-send-email-xiechao.mail@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1343715194-25900-1-git-send-email-xiechao.mail@gmail.com> References: <1343715194-25900-1-git-send-email-xiechao.mail@gmail.com> X-OriginalArrivalTime: 31 Jul 2012 06:13:11.0894 (UTC) FILETIME=[902A5F60:01CD6EE3] X-Spam-Note: CRM114 invocation failed X-Spam-Note: SpamAssassin invocation failed Cc: Chao Xie X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Chao Xie Signed-off-by: Chao Xie --- .../devicetree/bindings/arm/mrvl/tauros2.txt | 18 ++++++++++ arch/arm/mm/cache-tauros2.c | 35 +++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/mrvl/tauros2.txt diff --git a/Documentation/devicetree/bindings/arm/mrvl/tauros2.txt b/Documentation/devicetree/bindings/arm/mrvl/tauros2.txt new file mode 100644 index 0000000..3616b75 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/mrvl/tauros2.txt @@ -0,0 +1,18 @@ +* Marvell Tauros2 Cache + +Required properties: +- compatible : Should be "marvell,tauros2-cache". +- marvell,tauros2-cache-features : Specify the features supported for the + tauros2 cache. + The features including + CACHE_TAUROS2_PREFETCH_ON (1 << 0) + CACHE_TAUROS2_LINEFILL_BURST8 (1 << 1) + The definition can be found at + arch/arm/include/asm/hardware/cache-tauros2.h + +Example: + L2: l2-cache { + compatible = "marvell,tauros2-cache"; + marvell,tauros2-cache-features = <0x3>; + }; + diff --git a/arch/arm/mm/cache-tauros2.c b/arch/arm/mm/cache-tauros2.c index e9f054f..1be0f4e 100644 --- a/arch/arm/mm/cache-tauros2.c +++ b/arch/arm/mm/cache-tauros2.c @@ -15,6 +15,8 @@ */ #include +#include +#include #include #include #include @@ -198,7 +200,7 @@ static void enable_extra_feature(unsigned int features) write_extra_features(u); } -void __init tauros2_init(unsigned int features) +static void __init tauros2_internal_init(unsigned int features) { char *mode = NULL; @@ -294,3 +296,34 @@ void __init tauros2_init(unsigned int features) printk(KERN_INFO "Tauros2: L2 cache support initialised " "in %s mode.\n", mode); } + +#ifdef CONFIG_OF +static const struct of_device_id tauros2_ids[] __initconst = { + { .compatible = "marvell,tauros2-cache"}, + {} +}; +#endif + +void __init tauros2_init(unsigned int features) +{ +#ifdef CONFIG_OF + struct device_node *node; + int ret; + unsigned int f; + + node = of_find_matching_node(NULL, tauros2_ids); + if (!node) { + pr_info("Not found marvell,tauros2-cache, disable it\n"); + return; + } + + ret = of_property_read_u32(node, "marvell,tauros2-cache-features", &f); + if (ret) { + pr_info("Not found marvell,tauros-cache-features property, " + "disable extra features\n"); + features = 0; + } else + features = f; +#endif + tauros2_internal_init(features); +}