From patchwork Wed Jun 1 16:37:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 840812 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p51GddEv009057 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 1 Jun 2011 16:40:00 GMT Received: from canuck.infradead.org ([134.117.69.58]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QRoRc-0001ZA-Al; Wed, 01 Jun 2011 16:38:56 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QRoRb-0007IT-Qh; Wed, 01 Jun 2011 16:38:55 +0000 Received: from mail-gw0-f49.google.com ([74.125.83.49]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QRoQr-000788-Qs for linux-arm-kernel@lists.infradead.org; Wed, 01 Jun 2011 16:38:11 +0000 Received: by gwb1 with SMTP id 1so2758964gwb.36 for ; Wed, 01 Jun 2011 09:38:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:date:message-id:x-mailer :in-reply-to:references; bh=GobafS48I2tYTBidh7Q2V27krH7u95zfY7VjHMFwWnY=; b=EJEnRjUIYeBGSmtDPC7Rz1WKFWk4apxLRBLG0iRo9rHofWZZWo0Ur2zc6p1JENJcOt 6qPlCOS9pxttg2LbAO1LuKc+mNPh8/kx+tnrA/AyvLZnv89AE8OAbucl2BxjtDvir07P 4B6Y81bMcOTYM9xfq3y/yp0zG7HsMqoIBRAD8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; b=B+uX3IBrHl4IRMFvlSias68ImC0r8VDWqJns8iUiys14M/ggpFyM1ljcP9iQKKCJw5 H6N6sh+/+pSBB43bQ5/SQ/1b4K4WfKJEPq6FadaK4FLKGrQ0Q7WMVA5IyE2ZEQbTVCY6 JQ8fx22WnXZ64unf0Z/aWQhMSjQRZQsyHOViQ= Received: by 10.100.21.17 with SMTP id 17mr4678135anu.142.1306946287476; Wed, 01 Jun 2011 09:38:07 -0700 (PDT) Received: from rob-laptop.i.smooth-stone.com ([173.226.190.126]) by mx.google.com with ESMTPS id t27sm802923anh.1.2011.06.01.09.38.06 (version=SSLv3 cipher=OTHER); Wed, 01 Jun 2011 09:38:06 -0700 (PDT) From: Rob Herring To: devicetree-discuss@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/3] ARM: l2x0: Add OF based initialization Date: Wed, 1 Jun 2011 11:37:50 -0500 Message-Id: <1306946270-18379-4-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1306946270-18379-1-git-send-email-robherring2@gmail.com> References: <1306946270-18379-1-git-send-email-robherring2@gmail.com> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110601_123810_262682_F6AC0923 X-CRM114-Status: GOOD ( 13.16 ) X-Spam-Score: 1.4 (+) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (1.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.83.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is freemail (robherring2[at]gmail.com) 2.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (robherring2[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 RFC_ABUSE_POST Both abuse and postmaster missing on sender domain 0.0 T_TO_NO_BRKTS_FREEMAIL T_TO_NO_BRKTS_FREEMAIL X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 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 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 01 Jun 2011 16:40:58 +0000 (UTC) From: Rob Herring This adds probing for pl310 cache controller via device tree. An example binding looks like this: L2: l2-cache { compatible = "arm,pl310-cache", "cache"; reg = <0xfff12000 0x1000>; aux-value = <0>; aux-mask = <0xffffffff>; cache-unified; cache-level = <2>; }; Signed-off-by: Rob Herring --- arch/arm/include/asm/hardware/cache-l2x0.h | 1 + arch/arm/mm/cache-l2x0.c | 36 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 0 deletions(-) diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h index 16bd480..1d36632 100644 --- a/arch/arm/include/asm/hardware/cache-l2x0.h +++ b/arch/arm/include/asm/hardware/cache-l2x0.h @@ -74,6 +74,7 @@ #ifndef __ASSEMBLY__ extern void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask); +extern int l2x0_of_init(void); #endif #endif diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index ef59099..6dd521c 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c @@ -16,9 +16,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include #include +#include +#include #include #include @@ -344,3 +347,36 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask) printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n", ways, cache_id, aux, l2x0_size); } + +#ifdef CONFIG_OF +static struct of_device_id l2x0_ids[] __initdata = { + { .compatible = "arm,pl310-cache" }, + { .compatible = "arm,l220-cache" }, + { .compatible = "arm,l210-cache" }, +}; + +int __init l2x0_of_init(void) +{ + struct device_node *np; + void __iomem *l2_base; + __u32 aux_val = 0; + __u32 aux_mask = ~0UL; + const __be32 *val; + + np = of_find_matching_node(NULL, l2x0_ids); + if (!np) + return -ENODEV; + l2_base = of_iomap(np, 0); + if (!l2_base) + return -ENOMEM; + + if ((val = of_get_property(np, "aux-value", NULL)) != NULL); + aux_val = of_read_ulong(val, 1); + + if ((val = of_get_property(np, "aux-mask", NULL)) != NULL); + aux_mask = of_read_ulong(val, 1); + + l2x0_init(l2_base, aux_val, aux_mask); + return 0; +} +#endif