{"id":2228750,"url":"http://patchwork.ozlabs.org/api/patches/2228750/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20260427100832.581887-3-ilias.apalodimas@linaro.org/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/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,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260427100832.581887-3-ilias.apalodimas@linaro.org>","list_archive_url":null,"date":"2026-04-27T10:08:23","name":"[v3,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/people/74147/?format=json","name":"Ilias Apalodimas","email":"ilias.apalodimas@linaro.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260427100832.581887-3-ilias.apalodimas@linaro.org/mbox/","series":[{"id":501617,"url":"http://patchwork.ozlabs.org/api/series/501617/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=501617","date":"2026-04-27T10:08:21","name":"Relocate U-Boot in the last bank","version":3,"mbox":"http://patchwork.ozlabs.org/series/501617/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2228750/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2228750/checks/","tags":{},"related":[],"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=mRHnjF3u;\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=\"mRHnjF3u\";\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 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g3zn25Tqrz1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 20:09:10 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 4CAD083693;\n\tMon, 27 Apr 2026 12:08:53 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id 7342684178; Mon, 27 Apr 2026 12:08:52 +0200 (CEST)","from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com\n [IPv6:2a00:1450:4864:20::22c])\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 2B20A80433\n for <u-boot@lists.denx.de>; Mon, 27 Apr 2026 12:08:50 +0200 (CEST)","by mail-lj1-x22c.google.com with SMTP id\n 38308e7fff4ca-38ccde812ecso98278371fa.0\n for <u-boot@lists.denx.de>; Mon, 27 Apr 2026 03:08:50 -0700 (PDT)","from hera ([94.131.143.12]) by smtp.gmail.com with ESMTPSA id\n 38308e7fff4ca-38ecb6f0b88sm68554791fa.27.2026.04.27.03.08.47\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 27 Apr 2026 03:08:48 -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=1777284529; x=1777889329; 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=sOVOfOQIbVfM7hlfoBdXKZYK6qEJROqtwbm2aVGMDs0=;\n b=mRHnjF3u/NDbsdj06IB5JbLXLlJ3VbJ5WEUxEmSYTaJf56/rzC2h5RHSbx4zj6t4ER\n Gx8LJ+C1wxMZ4F6UNnBU7gfHxe8gT1QRut9CHboE/k64Eg2vfPGaNhOPwwXK7jfkvz3T\n IICHIqenn5isX+w/ydB40PPk83fedawM2+1zTZMF/KxmbJOeSKJvaWQ374a1hDvaAs/q\n ZhNUAbp4KgBCVc1k/17M42qPeNQNebXLXVGlSh1e+Nk4o/qJQRPKKI5FxmcZyW5SxPRG\n Mv2zW0xAefrzUWDScOvL1iS+eHitpw0V5TbR42HtCLiIw1+0OHdFfuevW1TfNnUcJ/6/\n rULg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777284529; x=1777889329;\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=sOVOfOQIbVfM7hlfoBdXKZYK6qEJROqtwbm2aVGMDs0=;\n b=pe9kxCYTckS5F3O4gEJJBaQ9CjTf3MKy9KKgq/f3+qtM6V9mpn9ApKjFFW66BUYIAo\n YLp9ZSD4m8RTSu3HeCU4tPukSIwJC7vtdQAFC3W3u88kcVlZI5A86iqpY748gyWKTvK3\n ZXB8OkgwuvtNHUDcArqxT0fa+hZpiJK1AxMh0KtitlVwccHBd7AVARUYKCEazm/T/HnI\n d3coAZV9qFlOm9yG4aD7LGfBF4f4o7E2jy2tIaiLvjs5V8N8GtlEUajOPGu5Cl15wq9L\n cbmcS6Lq9SmYvo7s9q2ymUNjYObkVNOumKCz+0ho13NKVlIxFQuxuCerJE0eCrqwgEqy\n BuPA==","X-Forwarded-Encrypted":"i=1;\n AFNElJ/MsPzfg+HE33+ynBNEYIxQnWLIIoX0afE+ElurckK3I8exElifGX5YZNCiPTsFsYG/fSqOuN4=@lists.denx.de","X-Gm-Message-State":"AOJu0YzlV/LlaEH28jUVTSrEdiSYOKfqRO5M93GsAmXlS6+XuUW7sfmi\n iqc8LmJZfKo2xny1Aktx73i93Bbaeqed9038hMci6YCjeRSyWXvvDigEyEH2FlffwqE=","X-Gm-Gg":"AeBDies6Dauo22+fpFS+86xP3gx76YfZBQDLy7u/27AL1XpLnPUvOZk4ZZ2OCpdJwMA\n AqcJHaMrohCz4FAbpvPWcS7Qskp6uuF23jJl4idgF6LIAUFpfEZdaoFV+G3eYBlYDYpRL+/UE6e\n rpmHwZdCyLC+Uav4XzSW9olybTUZGQshyfO33yk134maP2Zqzt7esxo+n2U6NK0wW5B6mtnFzyN\n /SCe7CvRkRZSoxfCp9GF/t+RQUZYQhEiHyPGZ0YC9qQcZMRo+oafAHRSjC/kdVSbUQbCcXD8CTA\n nAEi+fFQUfHSLLeY6dlYs//bdsnQEpO8/3fhSSXDzvXXwMVm6c6vmAuAzyZLNo8W+Q2hDEd7BoJ\n GWGVZgL7cY7tN3PUgoqY0r6aM0Fpq+MgTrl1OZ89Qkydu2Q6c4fhxYCKjqHGglliPChwKTg0E55\n U80B5IsRMQiCbRU6Ls288xD8kqwmBcNb1ZO4eE/NXYi5zv9goEi8QGO+QieChfvHuW3/Xj/yI9s\n +ZMFjNP7JqBtbdUZsYhKac62cIGplF85prG1lppUX5uawZ310E+KCHm7rnqHcxvZxmPX42VQXi2\n b4SHTo/37ob19aQNCRGibPxp3EbxCc27ZW0LPu5mY422vsJ9Rw+qloHbNnnWZktIITMFIBRfNjB\n lYZdS0if+FiZOXQBFXWMvEkcwomc9ySijVEoiCWaN9vWxIvhsmXC6HfNXJAnm/GSoh2yjOPc0vm\n IoMxJpNHF+za8JzjE0djogfQvs9d/RkuYv3Xt1ik6jhe0A7bpYJkVlpjxfCzJ9l1YnLpLjczNVX\n mPAkFL+++wbMsOmndy24JuJdOGzenTGHtVcb7052hLo/YQ=","X-Received":"by 2002:a2e:a58d:0:b0:38b:f0f0:e39b with SMTP id\n 38308e7fff4ca-38ec94f600cmr142691981fa.10.1777284529192;\n Mon, 27 Apr 2026 03:08:49 -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 v3 2/6] fdtdec: Introduce fdtdec_setup_mem_ram_top() to\n determine end of topmost DRAM bank","Date":"Mon, 27 Apr 2026 13:08:23 +0300","Message-ID":"<20260427100832.581887-3-ilias.apalodimas@linaro.org>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260427100832.581887-1-ilias.apalodimas@linaro.org>","References":"<20260427100832.581887-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: Marek Vasut <marek.vasut+renesas@mailbox.org>\nSigned-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.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 46eaa0da63c6..c43e78de4147 100644\n--- a/include/fdtdec.h\n+++ b/include/fdtdec.h\n@@ -973,6 +973,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 01be5edf7484..288966936606 100644\n--- a/lib/fdtdec.c\n+++ b/lib/fdtdec.c\n@@ -1184,6 +1184,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":["v3","2/6"]}