From 7aedd1f7fb5ead34df91979bdf9459dac6613a0c Mon Sep 17 00:00:00 2001 From: David Lechner Date: Thu, 11 Jun 2026 19:12:20 -0500 Subject: arm64: dts: mediatek: mt6359: give regulators unique names Change the regulator-name properties to be unique for all regulators. U-Boot cannot handle duplicate names. Signed-off-by: David Lechner Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: AngeloGioacchino Del Regno [ upstream commit: d91639d0ab3223b61c00442021dc639c9ddc2b76 ] (cherry picked from commit 22ce1d7d45a696128b8ad2cb9fbc4f2073bcb4f6) Reviewed-by: Julien Stephan Link: https://patch.msgid.link/20260611-mtk-pick-dt-mt6359-unique-names-v1-1-601546be1210@baylibre.com Signed-off-by: David Lechner --- dts/upstream/src/arm64/mediatek/mt6359.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dts/upstream/src/arm64/mediatek/mt6359.dtsi b/dts/upstream/src/arm64/mediatek/mt6359.dtsi index 467d8a4c2aa..45ad69ee49e 100644 --- a/dts/upstream/src/arm64/mediatek/mt6359.dtsi +++ b/dts/upstream/src/arm64/mediatek/mt6359.dtsi @@ -205,7 +205,7 @@ regulator-max-microvolt = <1700000>; }; mt6359_vrfck_1_ldo_reg: ldo_vrfck_1 { - regulator-name = "vrfck"; + regulator-name = "vrfck_1"; regulator-min-microvolt = <1240000>; regulator-max-microvolt = <1600000>; }; @@ -227,7 +227,7 @@ regulator-max-microvolt = <3300000>; }; mt6359_vemc_1_ldo_reg: ldo_vemc_1 { - regulator-name = "vemc"; + regulator-name = "vemc_1"; regulator-min-microvolt = <2500000>; regulator-max-microvolt = <3300000>; }; -- cgit v1.3.1 From ae73cc6df7246b80ebc3c602da952e13fa72f2f7 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 15 Jun 2026 14:23:31 -0500 Subject: mmc: mtk-sd: select LMB_LIMIT_DMA_BELOW_RAM_TOP Default to CONFIG_LMB_LIMIT_DMA_BELOW_RAM_TOP=y when CONFIG_MTK_SD is enabled. The MediaTek SD controller can only access the first 4GB of RAM when DMA is used. "imply" is used rather than "select" in case someone want's to turn off the option when DMA is not used. Link: https://patch.msgid.link/20260615-mtk-fix-ram-size-v2-1-f72cfc52ce58@baylibre.com Signed-off-by: David Lechner --- drivers/mmc/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index 24bd16ad5f3..6c513328de2 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -858,6 +858,7 @@ config MMC_MTK bool "MediaTek SD/MMC Card Interface support" depends on ARCH_MEDIATEK || ARCH_MTMIPS || ARCH_AIROHA depends on OF_CONTROL + imply LMB_LIMIT_DMA_BELOW_RAM_TOP help This selects the MediaTek(R) Secure digital and Multimedia card Interface. If you have a machine with a integrated SD/MMC card reader, say Y here. -- cgit v1.3.1 From 2d9a9f1cad906bbc13e8c131ed6932d0da4e28ee Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 15 Jun 2026 14:23:32 -0500 Subject: net: mtk_eth: select LMB_LIMIT_DMA_BELOW_RAM_TOP Default to CONFIG_LMB_LIMIT_DMA_BELOW_RAM_TOP=y when MEDIATEK_ETH is enabled. The MediaTek Ethernet controller can only access the first 4GB of RAM when DMA is used. Link: https://patch.msgid.link/20260615-mtk-fix-ram-size-v2-2-f72cfc52ce58@baylibre.com Signed-off-by: David Lechner --- drivers/net/mtk_eth/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/mtk_eth/Kconfig b/drivers/net/mtk_eth/Kconfig index 5d4e54ab90e..7d58f542bde 100644 --- a/drivers/net/mtk_eth/Kconfig +++ b/drivers/net/mtk_eth/Kconfig @@ -5,6 +5,7 @@ config MEDIATEK_ETH select PHYLIB select DM_GPIO select DM_RESET + select LMB_LIMIT_DMA_BELOW_RAM_TOP help This Driver support MediaTek Ethernet GMAC Say Y to enable support for the MediaTek Ethernet GMAC. -- cgit v1.3.1 From c074950b489957931296bc1efdb5e19f6f64e9a5 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 15 Jun 2026 14:23:33 -0500 Subject: arm: mediatek: mt7987: fix gd->bd->bi_dram[0].size Use board_get_usable_ram_top() instead of get_effective_memsize() to set gd->ram_top to something <= 4GiB. Both board_get_usable_ram_top() and get_effective_memsize() are used to set gd->ram_top in setup_dest_addr(). However, get_effective_memsize() also sets gd->bd->bi_dram[0].size in dram_init_banksize(), which is undesirable. Prior to commit 56183fb025c2 ("arm: mediatek: mt7987: drop dram_init_banksize()"), gd->bd->bi_dram[0].size was overridden in a board-specific dram_init_banksize() implementation. When that was removed get_effective_memsize() set gd->bd->bi_dram[0].size to the wrong value because of CFG_MAX_MEM_MAPPED. Rather than continue to use an old-style CFG_ option and the potentially confusing overriding of gd->bd->bi_dram[0].size (it is difficult to see which order the functions that set it are called), we can just use board_get_usable_ram_top() to set gd->ram_top to the correct value instead. This is possible now, thanks to LMB_LIMIT_DMA_BELOW_RAM_TOP being set by default for 64-bit Mediatek ARM SoCs. On mt7987, there is already an implementation of board_get_usable_ram_top() for other reasons, so it is modified to also limit ram_top to 4GiB (mt7987 is currently the only thing that sets CONFIG_MTK_TZ_MOVABLE=y so it is safe to change this here without unintentional side-effects). The CFG_MAX_MEM_MAPPED option is removed since it is no longer needed. The config header and Kconfig option are also removed since that was the last CFG_ option. Fixes: 56183fb025c2 ("arm: mediatek: mt7987: drop dram_init_banksize()") Link: https://patch.msgid.link/20260615-mtk-fix-ram-size-v2-3-f72cfc52ce58@baylibre.com Signed-off-by: David Lechner --- arch/arm/mach-mediatek/Kconfig | 1 - arch/arm/mach-mediatek/tzcfg.c | 22 +++++++++++++--------- board/mediatek/mt7987/MAINTAINERS | 1 - include/configs/mt7987.h | 14 -------------- 4 files changed, 13 insertions(+), 25 deletions(-) delete mode 100644 include/configs/mt7987.h diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig index 80f7185e929..054b1bf92bf 100644 --- a/arch/arm/mach-mediatek/Kconfig +++ b/arch/arm/mach-mediatek/Kconfig @@ -199,7 +199,6 @@ config SYS_CONFIG_NAME default "mt7629" if TARGET_MT7629 default "mt7981" if TARGET_MT7981 default "mt7986" if TARGET_MT7986 - default "mt7987" if TARGET_MT7987 default "mt7988" if TARGET_MT7988 default "mt8183" if TARGET_MT8183 default "mt8512" if TARGET_MT8512 diff --git a/arch/arm/mach-mediatek/tzcfg.c b/arch/arm/mach-mediatek/tzcfg.c index c8fe8ac0e9b..fbc96d96a4b 100644 --- a/arch/arm/mach-mediatek/tzcfg.c +++ b/arch/arm/mach-mediatek/tzcfg.c @@ -35,12 +35,13 @@ struct tz_reserved_region { }; static bool fix_tz_region(struct tz_reserved_region region[], - uint32_t used_regions) + uint32_t used_regions, + phys_addr_t ram_top) { phys_addr_t size; - if (region[0].addr + region[0].size > gd->ram_top) { - if (region[0].addr >= gd->ram_top) { + if (region[0].addr + region[0].size > ram_top) { + if (region[0].addr >= ram_top) { debug("Discarded region 0x%08llx, size 0x%llx\n", region[0].addr, region[0].size); @@ -50,7 +51,7 @@ static bool fix_tz_region(struct tz_reserved_region region[], return true; } - size = gd->ram_top - region[0].addr; + size = ram_top - region[0].addr; debug("Truncated region 0x%08llx, size 0x%llx -> 0x%llx\n", region[0].addr, region[0].size, size); @@ -63,12 +64,15 @@ static bool fix_tz_region(struct tz_reserved_region region[], phys_addr_t board_get_usable_ram_top(phys_size_t total_size) { - phys_addr_t uboot_ram_top, pstore_size, uboot_size = 0; + phys_addr_t uboot_ram_top, ram_top, pstore_size = 0, uboot_size = 0; struct tz_reserved_region region[2], tmp; phys_addr_t top_addr, low_addr; struct arm_smccc_res res; u32 used_regions = 1; + /* ram_top must be <= 4GiB due to DMA limitations */ + ram_top = min_t(phys_addr_t, gd->ram_top, SZ_4G); + /* BL31 region */ arm_smccc_smc(MTK_SIP_GET_BL31_REGION, 0, 0, 0, 0, 0, 0, 0, &res); if (res.a0) { @@ -119,14 +123,14 @@ phys_addr_t board_get_usable_ram_top(phys_size_t total_size) } debug("Effective memory @ 0x%08zx, size 0x%llx\n", gd->ram_base, - gd->ram_top - gd->ram_base); + ram_top - gd->ram_base); /* Discard/fix region which is outside the effective memory */ - if (fix_tz_region(region, used_regions)) { + if (fix_tz_region(region, used_regions, ram_top)) { used_regions--; if (used_regions) { - if (fix_tz_region(region, used_regions)) + if (fix_tz_region(region, used_regions, ram_top)) used_regions--; } } @@ -144,7 +148,7 @@ phys_addr_t board_get_usable_ram_top(phys_size_t total_size) uboot_size += U_BOOT_MIN_STACK_SIZE + REGION_ALIGNMENT - 1; uboot_size &= ~(REGION_ALIGNMENT - 1); - uboot_ram_top = gd->ram_top & ~(REGION_ALIGNMENT - 1); + uboot_ram_top = ram_top & ~(REGION_ALIGNMENT - 1); if (!used_regions || (uboot_ram_top - region[0].addr - region[0].size >= uboot_size)) { diff --git a/board/mediatek/mt7987/MAINTAINERS b/board/mediatek/mt7987/MAINTAINERS index c257d0b09df..b245174b0f7 100644 --- a/board/mediatek/mt7987/MAINTAINERS +++ b/board/mediatek/mt7987/MAINTAINERS @@ -2,7 +2,6 @@ MT7987 M: Sam Shih S: Maintained F: board/mediatek/mt7987 -F: include/configs/mt7987.h F: configs/mt7987_rfb_defconfig F: configs/mt7987_emmc_rfb_defconfig F: configs/mt7987_sd_rfb_defconfig diff --git a/include/configs/mt7987.h b/include/configs/mt7987.h deleted file mode 100644 index 18ed3c7a55b..00000000000 --- a/include/configs/mt7987.h +++ /dev/null @@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Configuration for MediaTek MT7987 SoC - * - * Copyright (C) 2025 MediaTek Inc. - * Author: Sam Shih - */ - -#ifndef __MT7987_H -#define __MT7987_H - -#define CFG_MAX_MEM_MAPPED 0xC0000000 - -#endif -- cgit v1.3.1 From 3b7adad0b5223422d9993e08faa9c879c023742d Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 15 Jun 2026 14:23:34 -0500 Subject: arm: mediatek: mt7988: fix gd->bd->bi_dram[0].size Use board_get_usable_ram_top() instead of get_effective_memsize() to set gd->ram_top to something <= 4GiB. Both board_get_usable_ram_top() and get_effective_memsize() are used to set gd->ram_top in setup_dest_addr(). However, get_effective_memsize() also sets gd->bd->bi_dram[0].size in dram_init_banksize(), which is undesirable. Prior to commit bddd6bbef3dc ("arm: mediatek: mt7988: drop dram_init_banksize()"), gd->bd->bi_dram[0].size was overridden in a board-specific dram_init_banksize() implementation. When that was removed get_effective_memsize() set gd->bd->bi_dram[0].size to the wrong value because of CFG_MAX_MEM_MAPPED. Rather than continue to use an old-style CFG_ option and the potentially confusing overriding of gd->bd->bi_dram[0].size (it is difficult to see which order the functions that set it are called), we can just use board_get_usable_ram_top() to set gd->ram_top to the correct value instead. This is possible now, thanks to LMB_LIMIT_DMA_BELOW_RAM_TOP being set by default for 64-bit Mediatek ARM SoCs. The CFG_MAX_MEM_MAPPED option is removed since it is no longer needed. The config header and Kconfig option are also removed since that was the last CFG_ option. Reported-by: Rudy Andram Closes: https://lore.kernel.org/u-boot/20260602162233.2418471-1-rmandrad@gmail.com/ Fixes: bddd6bbef3dc ("arm: mediatek: mt7988: drop dram_init_banksize()") Link: https://patch.msgid.link/20260615-mtk-fix-ram-size-v2-4-f72cfc52ce58@baylibre.com Signed-off-by: David Lechner --- arch/arm/mach-mediatek/Kconfig | 1 - arch/arm/mach-mediatek/mt7988/init.c | 10 ++++++++++ board/mediatek/mt7988/MAINTAINERS | 1 - include/configs/mt7988.h | 14 -------------- 4 files changed, 10 insertions(+), 16 deletions(-) delete mode 100644 include/configs/mt7988.h diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig index 054b1bf92bf..799c630fed3 100644 --- a/arch/arm/mach-mediatek/Kconfig +++ b/arch/arm/mach-mediatek/Kconfig @@ -199,7 +199,6 @@ config SYS_CONFIG_NAME default "mt7629" if TARGET_MT7629 default "mt7981" if TARGET_MT7981 default "mt7986" if TARGET_MT7986 - default "mt7988" if TARGET_MT7988 default "mt8183" if TARGET_MT8183 default "mt8512" if TARGET_MT8512 default "mt8516" if TARGET_MT8516 diff --git a/arch/arm/mach-mediatek/mt7988/init.c b/arch/arm/mach-mediatek/mt7988/init.c index 7f4d934bfe9..5b37a91cd72 100644 --- a/arch/arm/mach-mediatek/mt7988/init.c +++ b/arch/arm/mach-mediatek/mt7988/init.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -26,6 +27,15 @@ int dram_init(void) return 0; } +phys_addr_t board_get_usable_ram_top(phys_size_t total_size) +{ + /* + * Limit gd->ram_top not exceeding SZ_4G. Because some peripherals like + * MMC requires DMA buffer allocated below SZ_4G. + */ + return min(gd->ram_top, SZ_4G); +} + void reset_cpu(ulong addr) { psci_system_reset(); diff --git a/board/mediatek/mt7988/MAINTAINERS b/board/mediatek/mt7988/MAINTAINERS index a45bfff26ca..c7e30342e5c 100644 --- a/board/mediatek/mt7988/MAINTAINERS +++ b/board/mediatek/mt7988/MAINTAINERS @@ -2,6 +2,5 @@ MT7988 M: Sam Shih S: Maintained F: board/mediatek/mt7988 -F: include/configs/mt7988.h F: configs/mt7988_rfb_defconfig F: configs/mt7988_sd_rfb_defconfig diff --git a/include/configs/mt7988.h b/include/configs/mt7988.h deleted file mode 100644 index e63825a5a19..00000000000 --- a/include/configs/mt7988.h +++ /dev/null @@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Configuration for MediaTek MT7988 SoC - * - * Copyright (C) 2022 MediaTek Inc. - * Author: Sam Shih - */ - -#ifndef __MT7988_H -#define __MT7988_H - -#define CFG_MAX_MEM_MAPPED 0xC0000000 - -#endif -- cgit v1.3.1 From 6f274732f7960319ea0337e34210d440753ff11e Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 15 Jun 2026 14:23:35 -0500 Subject: arm: mediatek: mt8188: fix gd->bd->bi_dram[0].size Use board_get_usable_ram_top() instead of get_effective_memsize() to set gd->ram_top to something <= 4GiB. Both board_get_usable_ram_top() and get_effective_memsize() are used to set gd->ram_top in setup_dest_addr(). However, get_effective_memsize() also sets gd->bd->bi_dram[0].size in dram_init_banksize(), which is undesirable. Prior to commit b3467e51e92b ("arm: mediatek: mt8188: drop dram_init_banksize()"), gd->bd->bi_dram[0].size was overridden in a board-specific dram_init_banksize() implementation. When that was removed get_effective_memsize() set gd->bd->bi_dram[0].size to the wrong value because of get_effective_memsize() being overridden in commit 7518e10cd235 ("arm: mediatek: mt8188: fix gd->ram_top limit"). We can just use board_get_usable_ram_top() now to set gd->ram_top to the correct value instead. This is possible now, thanks to LMB_LIMIT_DMA_BELOW_RAM_TOP being set by default for 64-bit Mediatek ARM SoCs. Fixes: b3467e51e92b ("arm: mediatek: mt8188: drop dram_init_banksize()") Link: https://patch.msgid.link/20260615-mtk-fix-ram-size-v2-5-f72cfc52ce58@baylibre.com Signed-off-by: David Lechner --- arch/arm/mach-mediatek/mt8188/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-mediatek/mt8188/init.c b/arch/arm/mach-mediatek/mt8188/init.c index a48a41f3b97..1108bc19373 100644 --- a/arch/arm/mach-mediatek/mt8188/init.c +++ b/arch/arm/mach-mediatek/mt8188/init.c @@ -20,13 +20,13 @@ int dram_init(void) return fdtdec_setup_mem_size_base(); } -phys_size_t get_effective_memsize(void) +phys_addr_t board_get_usable_ram_top(phys_size_t total_size) { /* * Limit gd->ram_top not exceeding SZ_4G. Because some peripherals like * MMC requires DMA buffer allocated below SZ_4G. */ - return min(SZ_4G - gd->ram_base, gd->ram_size); + return min(gd->ram_top, SZ_4G); } void reset_cpu(void) -- cgit v1.3.1 From 58c7145d687a6442c077b0ed0a8c57012de347af Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 15 Jun 2026 14:23:36 -0500 Subject: arm: mediatek: mt8189: fix gd->bd->bi_dram[0].size Use board_get_usable_ram_top() instead of get_effective_memsize() to set gd->ram_top to something <= 4GiB. Both board_get_usable_ram_top() and get_effective_memsize() are used to set gd->ram_top in setup_dest_addr(). However, get_effective_memsize() also sets gd->bd->bi_dram[0].size in dram_init_banksize(), which is undesirable. We can just use board_get_usable_ram_top() now to set gd->ram_top to the correct value instead. This is possible now, thanks to LMB_LIMIT_DMA_BELOW_RAM_TOP being set by default for 64-bit Mediatek ARM SoCs. Fixes: a7c682565b4b ("arm: mediatek: add support of MT8189 SoC family") Link: https://patch.msgid.link/20260615-mtk-fix-ram-size-v2-6-f72cfc52ce58@baylibre.com Signed-off-by: David Lechner --- arch/arm/mach-mediatek/mt8189/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-mediatek/mt8189/init.c b/arch/arm/mach-mediatek/mt8189/init.c index ec7587c3586..4435c75a656 100644 --- a/arch/arm/mach-mediatek/mt8189/init.c +++ b/arch/arm/mach-mediatek/mt8189/init.c @@ -20,13 +20,13 @@ int dram_init(void) return fdtdec_setup_mem_size_base(); } -phys_size_t get_effective_memsize(void) +phys_addr_t board_get_usable_ram_top(phys_size_t total_size) { /* * Limit gd->ram_top not exceeding SZ_4G. Because some peripherals like * MMC requires DMA buffer allocated below SZ_4G. */ - return min(SZ_4G - gd->ram_base, gd->ram_size); + return min(gd->ram_top, SZ_4G); } void reset_cpu(ulong addr) -- cgit v1.3.1 From ec457f7cfde59a2122297a7a217c88f02acc63a5 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 15 Jun 2026 14:23:37 -0500 Subject: arm: mediatek: mt8195: fix gd->bd->bi_dram[0].size Use board_get_usable_ram_top() instead of get_effective_memsize() to set gd->ram_top to something <= 4GiB. Both board_get_usable_ram_top() and get_effective_memsize() are used to set gd->ram_top in setup_dest_addr(). However, get_effective_memsize() also sets gd->bd->bi_dram[0].size in dram_init_banksize(), which is undesirable. Prior to commit d83bd9729d75 ("arm: mediatek: mt8195: drop dram_init_banksize()"), gd->bd->bi_dram[0].size was overridden in a board-specific dram_init_banksize() implementation. When that was removed get_effective_memsize() set gd->bd->bi_dram[0].size to the wrong value because of get_effective_memsize() being overridden in commit af4cba9a05aa ("arm: mediatek: mt8195: fix gd->ram_top limit") We can just use board_get_usable_ram_top() now to set gd->ram_top to the correct value instead. This is possible now, thanks to LMB_LIMIT_DMA_BELOW_RAM_TOP being set by default for 64-bit Mediatek ARM SoCs. Fixes: d83bd9729d75 ("arm: mediatek: mt8195: drop dram_init_banksize()") Link: https://patch.msgid.link/20260615-mtk-fix-ram-size-v2-7-f72cfc52ce58@baylibre.com Signed-off-by: David Lechner --- arch/arm/mach-mediatek/mt8195/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-mediatek/mt8195/init.c b/arch/arm/mach-mediatek/mt8195/init.c index e31d4eec0fb..83cac9d01d6 100644 --- a/arch/arm/mach-mediatek/mt8195/init.c +++ b/arch/arm/mach-mediatek/mt8195/init.c @@ -20,13 +20,13 @@ int dram_init(void) return fdtdec_setup_mem_size_base(); } -phys_size_t get_effective_memsize(void) +phys_addr_t board_get_usable_ram_top(phys_size_t total_size) { /* * Limit gd->ram_top not exceeding SZ_4G. Because some peripherals like * MMC requires DMA buffer allocated below SZ_4G. */ - return min(SZ_4G - gd->ram_base, gd->ram_size); + return min(gd->ram_top, SZ_4G); } int mtk_soc_early_init(void) -- cgit v1.3.1 From b4fa246a1565aa63375de06b732c6d1eb1f82d27 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 15 Jun 2026 14:23:38 -0500 Subject: arm: mediatek: mt8512: fix gd->bd->bi_dram[0].size Use board_get_usable_ram_top() instead of get_effective_memsize() to limit gd->ram_top. Both board_get_usable_ram_top() and get_effective_memsize() are used to set gd->ram_top in setup_dest_addr(). However, get_effective_memsize() also sets gd->bd->bi_dram[0].size in dram_init_banksize(), which is undesirable. Prior to commit b9e6281632a8 ("arm: mediatek: mt8512: drop dram_init_banksize()"), gd->bd->bi_dram[0].size was overridden in a board-specific dram_init_banksize() implementation. We can just use board_get_usable_ram_top() now to set gd->ram_top to the correct value instead. Overriding gd->bd->bi_dram[0].size was a bit confusing since it isn't easily apparent which order the functions that set it are called. Fixes: b9e6281632a8 ("arm: mediatek: mt8512: drop dram_init_banksize()") Link: https://patch.msgid.link/20260615-mtk-fix-ram-size-v2-8-f72cfc52ce58@baylibre.com Signed-off-by: David Lechner --- arch/arm/mach-mediatek/mt8512/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-mediatek/mt8512/init.c b/arch/arm/mach-mediatek/mt8512/init.c index bc1d515fcca..6a9ae776794 100644 --- a/arch/arm/mach-mediatek/mt8512/init.c +++ b/arch/arm/mach-mediatek/mt8512/init.c @@ -29,10 +29,10 @@ int dram_init(void) return fdtdec_setup_mem_size_base(); } -phys_size_t get_effective_memsize(void) +phys_addr_t board_get_usable_ram_top(phys_size_t total_size) { /* limit stack below tee reserve memory */ - return gd->ram_size - 6 * SZ_1M; + return gd->ram_base + gd->ram_size - 6 * SZ_1M; } void reset_cpu(void) -- cgit v1.3.1