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: 3430861 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BB91AC02DC for ; Fri, 3 Jan 2014 10:14:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C1FC7200D6 for ; Fri, 3 Jan 2014 10:14:38 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9D264200F3 for ; Fri, 3 Jan 2014 10:14:37 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vz1kK-0007Vo-Rt; Fri, 03 Jan 2014 10:12:53 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vz1jr-0003Ie-6G; Fri, 03 Jan 2014 10:12:23 +0000 Received: from mail-ea0-f181.google.com ([209.85.215.181]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vz1jG-00039m-TV for linux-arm-kernel@lists.infradead.org; Fri, 03 Jan 2014 10:11:48 +0000 Received: by mail-ea0-f181.google.com with SMTP id m10so6714585eaj.12 for ; Fri, 03 Jan 2014 02:11:25 -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=Y0AE/sAq+xNDKAzk3hToq+iwgzGfOaIW/qVtIu/DZmA/vXDFWgYBWetzSJByMQMNDg 8F+AyFcXYBZ1nar93PPhjB3dDB3qURp3s8yaMdNp87aMpR4meaVj3uN1WhSQze/knjKD JAWIuHMH9tZxltnRSg+XlFfWjyw4dcUI+iZbOx9+6uL5F+TfKFKGg7UYzN3/R5MfosRT zJMvvQrE/UzdELu1a5gerLJ5/bEoYsnVeNLOjiGo8j27xcZKw5WoI5OrUxTLElbnKTu2 7Fc3wlTlScSD1kbqEfZv7Om1CLfc4ApmIRHugwtEZ/zt1/A0Qi5UFmplkH6KqZ2R2tNA GCUA== X-Gm-Message-State: ALoCoQkp+AdHNbQ/qP6tdJev7sMoJ6jpEGEkvC2zpy/2R20OK9GbvlDrGWkETOBDIJspg5qBgekl 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 Subject: [PATCH v1 04/24] zynq: Add OF ram initialization support 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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140103_051147_109398_E719F2C2 X-CRM114-Status: GOOD ( 13.43 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;