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

David Lechner dlechner at baylibre.com
Mon Jun 15 21:23:30 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 two patches are setting this new option when a driver that
requires it is enabled. 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>
---
Changes in v2:
- Make Kconfig depend on individual drivers rather than entire MediaTek
  ARCH. Only certain IP blocks have the 32-bit DMA address limitation.
- Link to v1: https://patch.msgid.link/20260611-mtk-fix-ram-size-v1-0-42ed330660ca@baylibre.com

To: Peng Fan <peng.fan at nxp.com>
To: Jaehoon Chung <jh80.chung at samsung.com>
To: Tom Rini <trini at konsulko.com>
To: Ryder Lee <ryder.lee at mediatek.com>
To: Weijie Gao <weijie.gao at mediatek.com>
To: Chunfeng Yun <chunfeng.yun at mediatek.com>
To: Igor Belwon <igor.belwon at mentallysanemainliners.org>
To: David Lechner <dlechner at baylibre.com>
To: GSS_MTK_Uboot_upstream <GSS_MTK_Uboot_upstream at mediatek.com>
To: Jerome Forissier <jerome.forissier at arm.com>
To: Sam Shih <sam.shih at mediatek.com>
To: Macpaul Lin <macpaul.lin at mediatek.com>
To: Chris-QJ Chen <chris-qj.chen at mediatek.com>
Cc: Julien Stephan <jstephan at baylibre.com>
Cc: u-boot at lists.denx.de

---
David Lechner (8):
      mmc: mtk-sd: select LMB_LIMIT_DMA_BELOW_RAM_TOP
      net: mtk_eth: select LMB_LIMIT_DMA_BELOW_RAM_TOP
      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 -
 drivers/mmc/Kconfig                  |  1 +
 drivers/net/mtk_eth/Kconfig          |  1 +
 include/configs/mt7987.h             | 14 --------------
 include/configs/mt7988.h             | 14 --------------
 13 files changed, 33 insertions(+), 49 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