From patchwork Tue Jan 31 02:35:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 721789 X-Patchwork-Delegate: sjg@chromium.org 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 3vC9PF0YYZz9s3T for ; Tue, 31 Jan 2017 13:36:16 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E88984AA22; Tue, 31 Jan 2017 03:36:09 +0100 (CET) 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 BVavTFAkmPJ5; Tue, 31 Jan 2017 03:36:09 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 416FE4A068; Tue, 31 Jan 2017 03:36:09 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7397E4A068 for ; Tue, 31 Jan 2017 03:36:06 +0100 (CET) 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 jHkz1bzCCTwP for ; Tue, 31 Jan 2017 03:36:06 +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 cvs.linux-mips.org (eddie.linux-mips.org [148.251.95.138]) by theia.denx.de (Postfix) with ESMTP id 2D0344A05F for ; Tue, 31 Jan 2017 03:36:02 +0100 (CET) Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23992781AbdAaCgCSevGk (ORCPT ); Tue, 31 Jan 2017 03:36:02 +0100 Date: Tue, 31 Jan 2017 03:35:51 +0100 From: Ladislav Michl To: u-boot@lists.denx.de Message-ID: <20170131023551.mtas7csvuk4hkxtw@lenoch> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20161126 (1.7.1) Subject: [U-Boot] [RFC] cmd: fdt: memory fixup X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 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" To get Falcon mode working with zImage is currently non trivial as zImages do not fit into U-Boot's image concept too well. Fortunately at least for ARM boards it seems getting memory node right is quite sufficient. What about changing 'fdt memory' command to update memory node according to detected memory layout when called without parameters? ladis diff --git a/cmd/fdt.c b/cmd/fdt.c index 95dd673b95..e08296d51c 100644 --- a/cmd/fdt.c +++ b/cmd/fdt.c @@ -517,11 +517,23 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) * memory command */ } else if (strncmp(argv[1], "me", 2) == 0) { - uint64_t addr, size; int err; - addr = simple_strtoull(argv[2], NULL, 16); - size = simple_strtoull(argv[3], NULL, 16); - err = fdt_fixup_memory(working_fdt, addr, size); + if (argc < 4) { + int i; + uint64_t start[CONFIG_NR_DRAM_BANKS]; + uint64_t size[CONFIG_NR_DRAM_BANKS]; + bd_t *bd = gd->bd; + for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { + start[i] = bd->bi_dram[i].start; + size[i] = bd->bi_dram[i].size; + } + err = fdt_fixup_memory_banks(working_fdt, start, size, + CONFIG_NR_DRAM_BANKS); + } else { + uint64_t addr = simple_strtoull(argv[2], NULL, 16); + uint64_t size = simple_strtoull(argv[3], NULL, 16); + err = fdt_fixup_memory(working_fdt, addr, size); + } if (err < 0) return err;