From patchwork Fri Jan 3 10:10:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 306531 X-Patchwork-Delegate: albert.aribaud@free.fr Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id DB97E2C0084 for ; Fri, 3 Jan 2014 21:12:22 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2BC584AEC5; Fri, 3 Jan 2014 11:12:21 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NUUE02gFZg4I; Fri, 3 Jan 2014 11:12:20 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A46A64AE75; Fri, 3 Jan 2014 11:11:47 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 59CC94AE05 for ; Fri, 3 Jan 2014 11:11:44 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pSqpqDO4cteL for ; Fri, 3 Jan 2014 11:11:39 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ee0-f41.google.com (mail-ee0-f41.google.com [74.125.83.41]) by theia.denx.de (Postfix) with ESMTPS id 5EFD74AE12 for ; Fri, 3 Jan 2014 11:11:26 +0100 (CET) Received: by mail-ee0-f41.google.com with SMTP id t10so6689941eei.14 for ; Fri, 03 Jan 2014 02:11:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:in-reply-to:references:content-type; bh=YTW+IIULT/gPTwRlpZ+r8bOBI1vVRfHtP6sDyqyAt7M=; b=AVX7zAifU2Db7c09qUiDSecTwRMfJLQz2LJACHQmipA73KYohYwJIGWOolbS0tU4rq uyD3yscZxdTo3/FgyvQSmGVidiChCMUu5iVL78Vn+XeD/xs2STSaSPz93fcwLaqim9Wn A69Pdj5tY5smA7nfWD+sYAsoDBlGxNZHbgRR9NB/RKi4ZpWRb76ckVS2H+6oazTLTUQe 6kN60l2EurCJCALKftwGlXHtp5jTrRigph/FWXy6eOdgobv67q9XFA+mgGzAVb6MDv75 o72vvJ9x05M/S/OHSz8w0VxVI7BFkElfoL3Zt51WxPDGk+MqNtwEy0GWoQmRtUhcSpva g0Ow== X-Gm-Message-State: ALoCoQkm8ZkF12zvKonkq7QdwylXqeVgXvF7ZAnbRYQLuQjWpj8HPlHDGMLFlZNPPLx9QZsnFxsl X-Received: by 10.15.48.70 with SMTP id g46mr17997eew.116.1388743885006; Fri, 03 Jan 2014 02:11:25 -0800 (PST) Received: from localhost (nat-63.starnet.cz. [178.255.168.63]) by mx.google.com with ESMTPSA id 44sm143621852eek.5.2014.01.03.02.11.23 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Fri, 03 Jan 2014 02:11:23 -0800 (PST) From: Michal Simek To: Michal Simek , u-boot@lists.denx.de, Joe Hershberger , linux-arm-kernel@lists.infradead.org, Albert Aribaud , Tom Rini Date: Fri, 3 Jan 2014 11:10:49 +0100 Message-Id: X-Mailer: git-send-email 1.8.2.3 In-Reply-To: References: In-Reply-To: References: Subject: [U-Boot] [PATCH v1 04/24] zynq: Add OF ram initialization support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Read ram size directly from DTB. Signed-off-by: Michal Simek --- Changes in v1: None board/xilinx/zynq/board.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) -- 1.8.2.3 diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c index 5119c09..6b691f3 100644 --- a/board/xilinx/zynq/board.c +++ b/board/xilinx/zynq/board.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -115,8 +116,27 @@ int board_mmc_init(bd_t *bd) int dram_init(void) { +#ifdef CONFIG_OF_CONTROL + int node; + fdt_addr_t addr; + fdt_size_t size; + const void *blob = gd->fdt_blob; + + node = fdt_node_offset_by_prop_value(blob, -1, "device_type", + "memory", 7); + if (node == -FDT_ERR_NOTFOUND) { + debug("ZYNQ DRAM: Can't get memory node\n"); + return -1; + } + addr = fdtdec_get_addr_size(blob, node, "reg", &size); + if (addr == FDT_ADDR_T_NONE || size == 0) { + debug("ZYNQ DRAM: Can't get base address or size\n"); + return -1; + } + gd->ram_size = size; +#else gd->ram_size = CONFIG_SYS_SDRAM_SIZE; - +#endif zynq_ddrc_init(); return 0;