From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89022C4320A for ; Mon, 16 Aug 2021 12:27:27 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0107963254 for ; Mon, 16 Aug 2021 12:27:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0107963254 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1345783175; Mon, 16 Aug 2021 14:26:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 2C41A82E4A; Mon, 16 Aug 2021 14:26:24 +0200 (CEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 844DB82EB9 for ; Mon, 16 Aug 2021 14:26:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=clement.leger@bootlin.com Received: (Authenticated sender: clement.leger@bootlin.com) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id DA5D51C0003; Mon, 16 Aug 2021 12:26:15 +0000 (UTC) From: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= To: u-boot@lists.denx.de, Eugen Hristev Cc: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Wenyou Yang , Nicolas Ferre Subject: [PATCH v2 4/5] board: sama5d2_xplained: Get dram size and base from device tree Date: Mon, 16 Aug 2021 14:25:42 +0200 Message-Id: <20210816122543.33532-5-clement.leger@bootlin.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210816122543.33532-1-clement.leger@bootlin.com> References: <20210816122543.33532-1-clement.leger@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean In order to make it more flexible and allow modifying the base address of DRAM without recompiling U-Boot, use memory node from device tree with fdtdec functions. Signed-off-by: Clément Léger --- board/atmel/sama5d2_xplained/sama5d2_xplained.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/board/atmel/sama5d2_xplained/sama5d2_xplained.c b/board/atmel/sama5d2_xplained/sama5d2_xplained.c index 5110ec8969..8b5cd533d0 100644 --- a/board/atmel/sama5d2_xplained/sama5d2_xplained.c +++ b/board/atmel/sama5d2_xplained/sama5d2_xplained.c @@ -68,7 +68,7 @@ int board_early_init_f(void) int board_init(void) { /* address of boot parameters */ - gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; + gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100; #ifdef CONFIG_CMD_USB board_usb_hw_init(); @@ -77,11 +77,14 @@ int board_init(void) return 0; } +int dram_init_banksize(void) +{ + return fdtdec_setup_memory_banksize(); +} + int dram_init(void) { - gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE, - CONFIG_SYS_SDRAM_SIZE); - return 0; + return fdtdec_setup_mem_size_base(); } #define AT24MAC_MAC_OFFSET 0x9a -- 2.32.0