From patchwork Tue Dec 27 01:33:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Chen X-Patchwork-Id: 5982 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 2AEE323E13 for ; Tue, 27 Dec 2011 01:34:17 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id 1BB65A18492 for ; Tue, 27 Dec 2011 01:34:17 +0000 (UTC) Received: by mail-ey0-f180.google.com with SMTP id c11so9499893eaa.11 for ; Mon, 26 Dec 2011 17:34:17 -0800 (PST) Received: by 10.205.132.148 with SMTP id hu20mr4226524bkc.96.1324949656904; Mon, 26 Dec 2011 17:34:16 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.82.144 with SMTP id ac16cs159923bkc; Mon, 26 Dec 2011 17:34:16 -0800 (PST) Received: by 10.182.14.5 with SMTP id l5mr23614911obc.2.1324949654776; Mon, 26 Dec 2011 17:34:14 -0800 (PST) Received: from TX2EHSOBE009.bigfish.com (tx2ehsobe004.messaging.microsoft.com. [65.55.88.14]) by mx.google.com with ESMTPS id ho6si7166971obb.172.2011.12.26.17.34.13 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Dec 2011 17:34:14 -0800 (PST) Received-SPF: neutral (google.com: 65.55.88.14 is neither permitted nor denied by best guess record for domain of jason.chen@linaro.org) client-ip=65.55.88.14; Authentication-Results: mx.google.com; spf=neutral (google.com: 65.55.88.14 is neither permitted nor denied by best guess record for domain of jason.chen@linaro.org) smtp.mail=jason.chen@linaro.org Received: from mail118-tx2-R.bigfish.com (10.9.14.235) by TX2EHSOBE009.bigfish.com (10.9.40.29) with Microsoft SMTP Server id 14.1.225.23; Tue, 27 Dec 2011 01:33:54 +0000 Received: from mail118-tx2 (localhost [127.0.0.1]) by mail118-tx2-R.bigfish.com (Postfix) with ESMTP id B70ED5401D7; Tue, 27 Dec 2011 01:33:58 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275dhz2dh87h2a8h668h839h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-FB-SS: 0, X-FB-DOMAIN-IP-MATCH: fail Received: from mail118-tx2 (localhost.localdomain [127.0.0.1]) by mail118-tx2 (MessageSwitch) id 1324949601942267_28455; Tue, 27 Dec 2011 01:33:21 +0000 (UTC) Received: from TX2EHSMHS015.bigfish.com (unknown [10.9.14.252]) by mail118-tx2.bigfish.com (Postfix) with ESMTP id 656FB30004E; Tue, 27 Dec 2011 01:33:19 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by TX2EHSMHS015.bigfish.com (10.9.99.115) with Microsoft SMTP Server (TLS) id 14.1.225.23; Tue, 27 Dec 2011 01:33:10 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server id 14.1.355.3; Mon, 26 Dec 2011 19:33:22 -0600 Received: from weitway.ap.freescale.net (weitway.ap.freescale.net [10.192.242.173]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id pBR1XIdB008644; Mon, 26 Dec 2011 19:33:19 -0600 (CST) From: Jason Chen To: CC: , , Subject: [PATCH 1/2] ARM: imx: add dt support of IRAM Date: Tue, 27 Dec 2011 09:33:16 +0800 Message-ID: <1324949596-27214-1-git-send-email-jason.chen@linaro.org> X-Mailer: git-send-email 1.7.4.1 MIME-Version: 1.0 X-OriginatorOrg: sigmatel.com Signed-off-by: Jason Chen Signed-off-by: Eric Miao --- arch/arm/plat-mxc/include/mach/iram.h | 6 ++++++ arch/arm/plat-mxc/iram_alloc.c | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-) diff --git a/arch/arm/plat-mxc/include/mach/iram.h b/arch/arm/plat-mxc/include/mach/iram.h index 022690c..f8372cf 100644 --- a/arch/arm/plat-mxc/include/mach/iram.h +++ b/arch/arm/plat-mxc/include/mach/iram.h @@ -21,6 +21,7 @@ #ifdef CONFIG_IRAM_ALLOC int __init iram_init(unsigned long base, unsigned long size); +int __init of_iram_init(void); void __iomem *iram_alloc(unsigned int size, unsigned long *dma_addr); void iram_free(unsigned long dma_addr, unsigned int size); @@ -31,6 +32,11 @@ static inline int __init iram_init(unsigned long base, unsigned long size) return -ENOMEM; } +static inline int __init of_iram_init(void) +{ + return -EINVAL; +} + static inline void __iomem *iram_alloc(unsigned int size, unsigned long *dma_addr) { return NULL; diff --git a/arch/arm/plat-mxc/iram_alloc.c b/arch/arm/plat-mxc/iram_alloc.c index 074c386..f73ca9d 100644 --- a/arch/arm/plat-mxc/iram_alloc.c +++ b/arch/arm/plat-mxc/iram_alloc.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include static unsigned long iram_phys_base; @@ -71,3 +73,17 @@ int __init iram_init(unsigned long base, unsigned long size) pr_debug("i.MX IRAM pool: %ld KB@0x%p\n", size / 1024, iram_virt_base); return 0; } + +int __init of_iram_init(void) +{ + struct device_node *np; + struct resource res; + + np = of_find_compatible_node(NULL, NULL, "fsl,imx-iram"); + if (of_address_to_resource(np, 0, &res)) + return -EINVAL; + if (res.start && (res.end > res.start)) + return iram_init(res.start, res.end - res.start + 1); + else + return -EINVAL; +}