From patchwork Tue Jun 14 23:27:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Brown X-Patchwork-Id: 880472 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5ENSU85022814 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 14 Jun 2011 23:28:52 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QWd1p-0004hw-8j; Tue, 14 Jun 2011 23:28:13 +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 1QWd1o-0002SK-Rf; Tue, 14 Jun 2011 23:28:12 +0000 Received: from wolverine02.qualcomm.com ([199.106.114.251]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QWd1l-0002S1-PP for linux-arm-kernel@lists.infradead.org; Tue, 14 Jun 2011 23:28:10 +0000 X-IronPort-AV: E=McAfee;i="5400,1158,6377"; a="97537414" Received: from pdmz-ns-mip.qualcomm.com (HELO mostmsg01.qualcomm.com) ([199.106.114.10]) by wolverine02.qualcomm.com with ESMTP/TLS/ADH-AES256-SHA; 14 Jun 2011 16:28:05 -0700 Received: from codeaurora.org (pdmz-snip-v218.qualcomm.com [192.168.218.1]) by mostmsg01.qualcomm.com (Postfix) with ESMTPA id 82DB110004D0; Tue, 14 Jun 2011 16:28:05 -0700 (PDT) From: David Brown To: Nicolas Pitre Subject: [PATCH] Support multiple MEM tags with atags->fdt conversion Date: Tue, 14 Jun 2011 16:27:54 -0700 Message-Id: <1308094074-24898-1-git-send-email-davidb@codeaurora.org> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110614_192810_132396_7C5BAFE5 X-CRM114-Status: GOOD ( 21.97 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [199.106.114.251 listed in list.dnswl.org] Cc: Russell King - ARM Linux , Tony Lindgren , linux-arm-msm@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, John Bonesio , David Brown , Shawn Guo 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 (demeter2.kernel.org [140.211.167.43]); Tue, 14 Jun 2011 23:28:52 +0000 (UTC) Some targets have multiple memory regions. Parse up to 8 of these when converting the atags to fdt. Signed-off-by: David Brown --- With this change, I am able to boot MSM8x60 combining ATAGS and my DT. It seems to work as long as my device tree has placeholders for all of the properties I need. It still seems rather clunky, especially that it requires bootimg from a zImage. David arch/arm/boot/compressed/atags_to_fdt.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c index 11c1a88..ac93e28 100644 --- a/arch/arm/boot/compressed/atags_to_fdt.c +++ b/arch/arm/boot/compressed/atags_to_fdt.c @@ -31,6 +31,8 @@ static int setprop_cell(void *fdt, const char *node_path, int atags_to_fdt(void *dt, void *atag_list) { struct tag *atag = atag_list; + uint32_t mem_reg_property[16]; + int memcount = 0; /* make sure we've got an aligned pointer */ if ((u32)atag_list & 0x3) @@ -51,11 +53,10 @@ int atags_to_fdt(void *dt, void *atag_list) setprop_string(dt, "/chosen", "bootargs", atag->u.cmdline.cmdline); } else if (atag->hdr.tag == ATAG_MEM) { - uint32_t mem_reg_property[2]; - mem_reg_property[0] = cpu_to_fdt32(atag->u.mem.start); - mem_reg_property[1] = cpu_to_fdt32(atag->u.mem.size); - setprop(dt, "/memory", "reg", mem_reg_property, - sizeof(mem_reg_property)); + if (memcount >= sizeof(mem_reg_property)/sizeof(uint32_t)) + continue; + mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.start); + mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.size); } else if (atag->hdr.tag == ATAG_INITRD2) { uint32_t initrd_start, initrd_size; initrd_start = atag->u.initrd.start; @@ -67,5 +68,10 @@ int atags_to_fdt(void *dt, void *atag_list) } } + if (memcount) { + setprop(dt, "/memory", "reg", mem_reg_property, + 4*memcount); + } + return 0; }