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 <[email protected]> --- 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/[email protected] To: Peng Fan <[email protected]> To: Jaehoon Chung <[email protected]> To: Tom Rini <[email protected]> To: Ryder Lee <[email protected]> To: Weijie Gao <[email protected]> To: Chunfeng Yun <[email protected]> To: Igor Belwon <[email protected]> To: David Lechner <[email protected]> To: GSS_MTK_Uboot_upstream <[email protected]> To: Jerome Forissier <[email protected]> To: Sam Shih <[email protected]> To: Macpaul Lin <[email protected]> To: Chris-QJ Chen <[email protected]> Cc: Julien Stephan <[email protected]> Cc: [email protected] --- 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 <[email protected]>

