[PATCH 0/7] arm: mediatek: fix gd->bd->bi_dram[0].size

David Lechner dlechner at baylibre.com
Thu Jun 11 22:30:59 CEST 2026


During some recent cleanups we made some changes that had an unintended
consequence of changing the value of gd->bd->bi_dram[0].size on some
boards.

64-bit Mediatek ARM SoCs have some peripherals that require DMA memory
to be allocated below the 4GB boundary. We were using
get_effective_memsize() to work around this. However, this also sets
gd->bd->bi_dram[0].size to the value of get_effective_memsize(). This
variable can be used for other things, so needs to be set to the actual
size of the DRAM.

Now that we have the LMB_LIMIT_DMA_BELOW_RAM_TOP config option, we can
set that for these SoCs and use board_get_usable_ram_top() to have the
desired effect without changing gd->bd->bi_dram[0].size.

The first patch is setting this new option for Mediatek ARM SoCs and
then the rest of the patches are fixing the board implementations.

I have tested the mt8189 patch but don't have hardware to test most of
the others. Most are quite similar though, so I am reasonably confident
they should be correct. And ideally Randy can test the mt7988 patch.

Signed-off-by: David Lechner <dlechner at baylibre.com>
---
David Lechner (7):
      lmb: default LMB_LIMIT_DMA_BELOW_RAM_TOP for 64-bit Mediatek SoCs
      arm: mediatek: mt7987: fix gd->bd->bi_dram[0].size
      arm: mediatek: mt7988: fix gd->bd->bi_dram[0].size
      arm: mediatek: mt8188: fix gd->bd->bi_dram[0].size
      arm: mediatek: mt8189: fix gd->bd->bi_dram[0].size
      arm: mediatek: mt8195: fix gd->bd->bi_dram[0].size
      arm: mediatek: mt8512: fix gd->bd->bi_dram[0].size

 arch/arm/mach-mediatek/Kconfig       |  2 --
 arch/arm/mach-mediatek/mt7988/init.c | 10 ++++++++++
 arch/arm/mach-mediatek/mt8188/init.c |  4 ++--
 arch/arm/mach-mediatek/mt8189/init.c |  4 ++--
 arch/arm/mach-mediatek/mt8195/init.c |  4 ++--
 arch/arm/mach-mediatek/mt8512/init.c |  4 ++--
 arch/arm/mach-mediatek/tzcfg.c       | 22 +++++++++++++---------
 board/mediatek/mt7987/MAINTAINERS    |  1 -
 board/mediatek/mt7988/MAINTAINERS    |  1 -
 include/configs/mt7987.h             | 14 --------------
 include/configs/mt7988.h             | 14 --------------
 lib/Kconfig                          |  2 +-
 12 files changed, 32 insertions(+), 50 deletions(-)
---
base-commit: 3cdce049f90d77c3f9221f1eb73922384c8972c3
change-id: 20260611-mtk-fix-ram-size-045373f234c6

Best regards,
--  
David Lechner <dlechner at baylibre.com>



More information about the U-Boot mailing list