U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rudy Andram <rmandrad@gmail.com>
To: u-boot@lists.denx.de
Cc: trini@konsulko.com, ryder.lee@mediatek.com,
	weijie.gao@mediatek.com, chunfeng.yun@mediatek.com,
	igor.belwon@mentallysanemainliners.org, dlechner@baylibre.com,
	jstephan@baylibre.com, GSS_MTK_Uboot_upstream@mediatek.com,
	emanuele.ghidoli@toradex.com, Rudy Andram <rmandrad@gmail.com>
Subject: [PATCH] arm: mediatek: mt7988: restore full DRAM bank reporting
Date: Sat, 30 May 2026 06:37:05 +0100	[thread overview]
Message-ID: <20260530053705.2140146-1-rmandrad@gmail.com> (raw)

MT7988 detects the full installed DRAM in dram_init(), but after
commit bddd6bbef3dc ("arm: mediatek: mt7988: drop dram_init_banksize()")
it fell back to the generic dram_init_banksize() implementation.

That generic path populates bd->bi_dram[0].size with
get_effective_memsize(), which is capped by CFG_MAX_MEM_MAPPED. On
MT7988 this limits the exported DRAM bank to 3 GiB even when 8 GiB is
installed.

As a result, U-Boot reports the full DRAM in gd->ram_size but exposes
only the low 3 GiB through bd->bi_dram[]. This truncated map can then
propagate to later stages through memory handoff and DT fixups.

On a Banana Pi R4 Pro 8G (MT7988), bdinfo shows:

Before:
  DRAM bank   = 0x000000000
  -> start    = 0x0000000040000000
  -> size     = 0x00000000c0000000

After:
  DRAM bank   = 0x000000000
  -> start    = 0x0000000040000000
  -> size     = 0x0000000200000000

Restore the MT7988-specific dram_init_banksize() implementation so
bd->bi_dram[0] publishes gd->ram_base and gd->ram_size again.

Version tested
U-Boot 2026.07-rc2-bpi-g6a1580973a11-dirty (May 27 2026 - 14:39:18 +0000)

Fixes: bddd6bbef3dc ("arm: mediatek: mt7988: drop dram_init_banksize()")
Tested-by: Rudy Andram <rmandrad@gmail.com>
Signed-off-by: Rudy Andram <rmandrad@gmail.com>
---
 arch/arm/mach-mediatek/mt7988/init.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/mach-mediatek/mt7988/init.c b/arch/arm/mach-mediatek/mt7988/init.c
index 7f4d934bfe9..08eb73d42b1 100644
--- a/arch/arm/mach-mediatek/mt7988/init.c
+++ b/arch/arm/mach-mediatek/mt7988/init.c
@@ -26,6 +26,15 @@ int dram_init(void)
 	return 0;
 }
 
+int dram_init_banksize(void)
+{
+	/* Report the full detected DRAM size to later stages. */
+	gd->bd->bi_dram[0].start = gd->ram_base;
+	gd->bd->bi_dram[0].size = gd->ram_size;
+
+	return 0;
+}
+
 void reset_cpu(ulong addr)
 {
 	psci_system_reset();
-- 
2.54.0


             reply	other threads:[~2026-05-30  7:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-30  5:37 Rudy Andram [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-06-02 16:22 [PATCH] arm: mediatek: mt7988: restore full DRAM bank reporting Rudy Andram
2026-06-05 12:51 ` David Lechner
2026-06-05 13:08   ` rmandrad
2026-06-05 14:30     ` David Lechner
2026-06-05 14:48       ` David Lechner
2026-06-05 14:54         ` rmandrad
2026-06-05 15:00           ` David Lechner
2026-06-10  1:05             ` Weijie Gao
2026-05-30  5:24 Rudy Andram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260530053705.2140146-1-rmandrad@gmail.com \
    --to=rmandrad@gmail.com \
    --cc=GSS_MTK_Uboot_upstream@mediatek.com \
    --cc=chunfeng.yun@mediatek.com \
    --cc=dlechner@baylibre.com \
    --cc=emanuele.ghidoli@toradex.com \
    --cc=igor.belwon@mentallysanemainliners.org \
    --cc=jstephan@baylibre.com \
    --cc=ryder.lee@mediatek.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=weijie.gao@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox