{"id":2223743,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2223743/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20260416055948.130041-3-ilias.apalodimas@linaro.org/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.1/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20260416055948.130041-3-ilias.apalodimas@linaro.org>","date":"2026-04-16T05:59:38","name":"[v2,2/6] fdtdec: Introduce fdtdec_setup_mem_ram_top() to determine end of topmost DRAM bank","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"9533719ef82ddcd91d60c2af702ebf8c1276d057","submitter":{"id":74147,"url":"http://patchwork.ozlabs.org/api/1.1/people/74147/?format=json","name":"Ilias Apalodimas","email":"ilias.apalodimas@linaro.org"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/1.1/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260416055948.130041-3-ilias.apalodimas@linaro.org/mbox/","series":[{"id":500079,"url":"http://patchwork.ozlabs.org/api/1.1/series/500079/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=500079","date":"2026-04-16T05:59:37","name":"Relocate U-Boot in the last bank","version":2,"mbox":"http://patchwork.ozlabs.org/series/500079/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2223743/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2223743/checks/","tags":{},"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=p/ZKko6y;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=linaro.org","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.b=\"p/ZKko6y\";\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=linaro.org","phobos.denx.de;\n spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org"],"Received":["from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fx6nN3JZGz1yG9\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 16:00:40 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 2130384227;\n\tThu, 16 Apr 2026 08:00:20 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id 1E0E883EEF; Thu, 16 Apr 2026 08:00:15 +0200 (CEST)","from mail-wm1-x329.google.com (mail-wm1-x329.google.com\n [IPv6:2a00:1450:4864:20::329])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id A14CA84207\n for <u-boot@lists.denx.de>; Thu, 16 Apr 2026 08:00:09 +0200 (CEST)","by mail-wm1-x329.google.com with SMTP id\n 5b1f17b1804b1-488a8ca4aadso90009325e9.3\n for <u-boot@lists.denx.de>; Wed, 15 Apr 2026 23:00:09 -0700 (PDT)","from hera ([94.131.143.12]) by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-488f0e9a770sm36379755e9.19.2026.04.15.23.00.06\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 15 Apr 2026 23:00:07 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,\n SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1776319208; x=1776924008; darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=HqsYMUeGyUGXw34cIjdntI8dEFhH9ejtFq3bqgVy0sk=;\n b=p/ZKko6yg8GQFCxVCKC9uoZGieGJnlj0tsPGzE1+CSRpb6MUWWlH0m/VGO5N15gZBx\n lDkgtMsGpOW9FEi2JhVWEZFFEVC8QOpvQazUbbRvOic5LSId0gaNKkVc4Ig3HJWd3PWX\n uloEN9BakZp7NJuK7gP9qbvoq2K+mgpBDYOeidhT1gXIhEPrOY7dflKJ1SsWkcfOhOND\n UndsZOgPtN1cxbY3sUmw4krf6OIFWZeAnJ2xZjoVDD1PzCjkOYgsaX5bgq13CAukw5xh\n JE6s00vJKATIZsBhtjP7dYqFqBvFEb5iA9rCIfFGQzYUiu3ipylXfr3OBxQSASfQeYaC\n kYsA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776319208; x=1776924008;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=HqsYMUeGyUGXw34cIjdntI8dEFhH9ejtFq3bqgVy0sk=;\n b=EU858pNcfv+0+eLkU10wVn7FU++T1+UMQ4rBu9X/zQClkr3EG3+goKRwKUoGNALtah\n 3DFz0Mtk/xDXL/+PMAgBla3Ni1f4fSf7G6/OIY9HBRQ1Ex2hsAnr9hCrlk1AeoG3DWFF\n jqH9/NSCcaOfzW2cuF4gK/wWRUaUeHcilgiqwSFRWMIpbWe2RN2CoH02iXBrn18hwr4P\n vcozt4t+vmJRmi+kwMAmkKrfWOjBrw+GJsrBR9H1OW8vW+xX2DqEk0fLMkimJbp3kiTI\n i7tGHdkusBd0dRJRWWbzP68BQYhF2CbynOnM5KBDQNynVZcCZCmYF4c09oBK8dJzsgPi\n pphw==","X-Forwarded-Encrypted":"i=1;\n AFNElJ9VxR4sPEzwK5Yw0tR8GrRMNtXmXYzNgEqYcL5WO4dCSBugBRPCxNkZ+yG58Y6LFMQw9CshoBU=@lists.denx.de","X-Gm-Message-State":"AOJu0YxBXE3QPC8Z+yMOnjv7X6s/wxD/9+O6HgnYV3TS6KlJtzcOWQOp\n zNswGpcFt7mXjp05wJ+Wc82CDl8IGPKjywuxCj6TCb9MOLne73rUYP7UkBilmC1JY4k=","X-Gm-Gg":"AeBDievsdsesbtVYlUWa0rvCTsSPTpj8IUHkmIF2me9fTOPOz+yV5Q1IQTO5GwgdN2f\n 2oyGg1Vuti6BDRY1++19ZIN6iNb8xcIjDhefAwtxtF4fIlvJaDLp0I2Qg3B0qem20RM3Q949zrf\n gb8OdwGPuLCstAbGN3wKnIanwsy9TTF9SLbdbJtpY3gGSS+llO6NFFolcLxqKUOMTp0+YFq4nfa\n OMuVRLJ288WJP5tZoCtZPn5WOaLhj7DOuL5SfhClmuMxiEtejVuqEGKEzG/K5jfn9zpSQ1SIU+f\n lOI2vY1VYpDeLBM8OBI6AnqRug+GW3CSzVPHeC82CVff3ixaUlnLqMtM8kUCM4MprdvnUVDqBJp\n Q2doQm1wbCOsKouPer+w6AmdXUc+HBgUO85RoGbYzxposln0T3YrMrRIS4dW2q0ogwkaS5VdcFU\n YFuguOp0WFIt4Ic3i0/wfIuZn6CGniuPhb1X8FcEhXCtolHDlSuIoQZTGVjfJd6liWlW1zfa7KM\n Hk3ngfMQ86I+CySnNylBlb0kIQmqWOrq1RWjyoeF0B9yQdvlO84ilPBeU7Uh07mpMLuQTxyjUsf\n I9aeGTX1pcA9V+ILCaDBI3hPCju8H1Fb1IiTKHPuuRjn/7X8hMpXhOrdODoacRk1K1abiBekXdL\n Rx8/JbEkZPnJlLqDAkHxKBcpZQkS7m6/nT4icFUDSfUuSsqwyruJvuCAUIb1Pjx84uozJJPaFJG\n P6VkpOhTTQT7E/28lzo7cdgZGX/Jv2sjihByEAvYtzrWNDWVV5t+TFMrrI3Ziu","X-Received":"by 2002:a05:600c:a415:b0:487:1108:48af with SMTP id\n 5b1f17b1804b1-488d67bf7c7mr254263745e9.4.1776319208289;\n Wed, 15 Apr 2026 23:00:08 -0700 (PDT)","From":"Ilias Apalodimas <ilias.apalodimas@linaro.org>","To":"trini@konsulko.com","Cc":"marek.vasut+renesas@mailbox.org, jonas@kwiboo.se, anshuld@ti.com,\n sjg@chromium.org, Ilias Apalodimas <ilias.apalodimas@linaro.org>,\n u-boot@lists.denx.de","Subject":"[PATCH v2 2/6] fdtdec: Introduce fdtdec_setup_mem_ram_top() to\n determine end of topmost DRAM bank","Date":"Thu, 16 Apr 2026 08:59:38 +0300","Message-ID":"<20260416055948.130041-3-ilias.apalodimas@linaro.org>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260416055948.130041-1-ilias.apalodimas@linaro.org>","References":"<20260416055948.130041-1-ilias.apalodimas@linaro.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"},"content":"From: Marek Vasut <marek.vasut+renesas@mailbox.org>\n\nIntroduce function fdtdec_setup_mem_ram_top(), which determines the topmost\naddress in the last DRAM bank, to be assigned into gd->ram_top in order to\nrelocate U-Boot to the actual end of all DRAM. This makes use of iterator\nfunction fdtdec_setup_mem_for_each_bank() introduced in previous commit.\n\nReviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>\nReviewed-by: Simon Glass <sjg@chromium.org>\nReviewed-by: Anshul Dalal <anshuld@ti.com>\nSigned-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>\nSigned-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>\n---\n include/fdtdec.h | 16 ++++++++++++++++\n lib/fdtdec.c     | 18 ++++++++++++++++++\n 2 files changed, 34 insertions(+)","diff":"diff --git a/include/fdtdec.h b/include/fdtdec.h\nindex 4e09f9d718c5..35caf4b789e8 100644\n--- a/include/fdtdec.h\n+++ b/include/fdtdec.h\n@@ -957,6 +957,22 @@ int fdtdec_setup_mem_size_base(void);\n  */\n int fdtdec_setup_mem_size_base_lowest(void);\n \n+/**\n+ * fdtdec_setup_mem_ram_top() - decode and setup gd->ram_top to highest address\n+ * available in any memory bank\n+ *\n+ * Decode the /memory 'reg' property to determine the highest end of the memory\n+ * bank and populate the global data ram_top with it.\n+ *\n+ * This function should be called from a boards board_get_usable_ram_top().\n+ * This helper function allows for boards to query the device tree for topmost\n+ * DRAM address.\n+ *\n+ * Return: 0 if OK, -EINVAL if the /memory node or reg property is missing or\n+ * invalid\n+ */\n+int fdtdec_setup_mem_ram_top(void);\n+\n /**\n  * fdtdec_setup_memory_banksize() - decode and populate gd->bd->bi_dram\n  *\ndiff --git a/lib/fdtdec.c b/lib/fdtdec.c\nindex 9c35b08e709f..a173c4ab323d 100644\n--- a/lib/fdtdec.c\n+++ b/lib/fdtdec.c\n@@ -1166,6 +1166,24 @@ int fdtdec_setup_mem_size_base_lowest(void)\n \treturn fdtdec_setup_mem_for_each_bank(fdtdec_setup_mem_size_base_lowest_bankfn);\n }\n \n+static void fdtdec_setup_mem_ram_top_bankfn(struct resource *res, int bank)\n+{\n+\tif ((res->end + 1) > gd->ram_top)\n+\t\tgd->ram_top = res->end + 1;\n+}\n+\n+int fdtdec_setup_mem_ram_top(void)\n+{\n+\tphys_addr_t old_top = gd->ram_top;\n+\tint ret;\n+\n+\tret = fdtdec_setup_mem_for_each_bank(fdtdec_setup_mem_ram_top_bankfn);\n+\tif (ret)\n+\t\tgd->ram_top = old_top;\n+\n+\treturn ret;\n+}\n+\n static int uncompress_blob(const void *src, ulong sz_src, void **dstp)\n {\n #if CONFIG_IS_ENABLED(MULTI_DTB_FIT_GZIP) ||\\\n","prefixes":["v2","2/6"]}