From 1af249f511af6d88fb365bfc335f6b84e860b77b Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 9 Feb 2026 10:39:26 -0600 Subject: [PATCH 1/7] arm: mediatek: use default weak mtk_soc_early_init() Add a weak default implementation of mtk_soc_early_init() in spl.c to avoid having to define it in every SoC init.c file that does not need any additional early initialization. The init.h header file is no longer needed in this case and is removed. Signed-off-by: David Lechner --- arch/arm/mach-mediatek/init.h | 11 ----------- arch/arm/mach-mediatek/mt7623/init.c | 5 ----- arch/arm/mach-mediatek/mt8183/init.c | 5 ----- arch/arm/mach-mediatek/mt8188/init.c | 5 ----- arch/arm/mach-mediatek/mt8365/init.c | 5 ----- arch/arm/mach-mediatek/spl.c | 5 ++++- 6 files changed, 4 insertions(+), 32 deletions(-) delete mode 100644 arch/arm/mach-mediatek/init.h diff --git a/arch/arm/mach-mediatek/init.h b/arch/arm/mach-mediatek/init.h deleted file mode 100644 index 1d896fbbf7e..00000000000 --- a/arch/arm/mach-mediatek/init.h +++ /dev/null @@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Copyright (C) 2018 MediaTek Inc. - */ - -#ifndef __MEDIATEK_INIT_H_ -#define __MEDIATEK_INIT_H_ - -extern int mtk_soc_early_init(void); - -#endif /* __MEDIATEK_INIT_H_ */ diff --git a/arch/arm/mach-mediatek/mt7623/init.c b/arch/arm/mach-mediatek/mt7623/init.c index 3d6ba3f383c..8713889b92d 100644 --- a/arch/arm/mach-mediatek/mt7623/init.c +++ b/arch/arm/mach-mediatek/mt7623/init.c @@ -16,11 +16,6 @@ DECLARE_GLOBAL_DATA_PTR; struct boot_argument *preloader_param; -int mtk_soc_early_init(void) -{ - return 0; -} - int dram_init(void) { u32 i; diff --git a/arch/arm/mach-mediatek/mt8183/init.c b/arch/arm/mach-mediatek/mt8183/init.c index 37243547da8..39072622788 100644 --- a/arch/arm/mach-mediatek/mt8183/init.c +++ b/arch/arm/mach-mediatek/mt8183/init.c @@ -42,11 +42,6 @@ int mtk_pll_early_init(void) return 0; } -int mtk_soc_early_init(void) -{ - return 0; -} - void reset_cpu(void) { psci_system_reset(); diff --git a/arch/arm/mach-mediatek/mt8188/init.c b/arch/arm/mach-mediatek/mt8188/init.c index ed67150e611..9743e39d582 100644 --- a/arch/arm/mach-mediatek/mt8188/init.c +++ b/arch/arm/mach-mediatek/mt8188/init.c @@ -45,11 +45,6 @@ int dram_init_banksize(void) return 0; } -int mtk_soc_early_init(void) -{ - return 0; -} - void reset_cpu(void) { struct udevice *wdt; diff --git a/arch/arm/mach-mediatek/mt8365/init.c b/arch/arm/mach-mediatek/mt8365/init.c index 8f03ed28763..fb14a5a1902 100644 --- a/arch/arm/mach-mediatek/mt8365/init.c +++ b/arch/arm/mach-mediatek/mt8365/init.c @@ -26,11 +26,6 @@ int dram_init_banksize(void) return 0; } -int mtk_soc_early_init(void) -{ - return 0; -} - void reset_cpu(void) { struct udevice *wdt; diff --git a/arch/arm/mach-mediatek/spl.c b/arch/arm/mach-mediatek/spl.c index 247d7ee6f1d..6f1ec052b95 100644 --- a/arch/arm/mach-mediatek/spl.c +++ b/arch/arm/mach-mediatek/spl.c @@ -9,7 +9,10 @@ #include #include -#include "init.h" +__weak int mtk_soc_early_init(void) +{ + return 0; +} void board_init_f(ulong dummy) { From d8c550fb7a348ce2496adc22730157416938baab Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 9 Feb 2026 10:39:27 -0600 Subject: [PATCH 2/7] board: mediatek: mt8390_evk: remove empty board_init() Remove empty board_init() function and adjust defconfig to not require it. Signed-off-by: David Lechner Reviewed-by: Macpaul Lin --- board/mediatek/mt8390_evk/mt8390_evk.c | 5 ----- configs/mt8390_evk_defconfig | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/board/mediatek/mt8390_evk/mt8390_evk.c b/board/mediatek/mt8390_evk/mt8390_evk.c index 1ca40366a55..5731199bf83 100644 --- a/board/mediatek/mt8390_evk/mt8390_evk.c +++ b/board/mediatek/mt8390_evk/mt8390_evk.c @@ -7,11 +7,6 @@ #include #include -int board_init(void) -{ - return 0; -} - static struct mm_region mt8390_evk_mem_map[] = { { /* DDR */ diff --git a/configs/mt8390_evk_defconfig b/configs/mt8390_evk_defconfig index 9bc1d922587..06437be625e 100644 --- a/configs/mt8390_evk_defconfig +++ b/configs/mt8390_evk_defconfig @@ -9,6 +9,7 @@ CONFIG_DEFAULT_DEVICE_TREE="mediatek/mt8390-genio-700-evk" CONFIG_TARGET_MT8188=y CONFIG_SYS_LOAD_ADDR=0x4c000000 CONFIG_IDENT_STRING="mt8390-evk" +# CONFIG_BOARD_INIT is not set CONFIG_CMD_CLK=y CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y From 35d5cd54153d4ca06547712c33810e8095967745 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 9 Feb 2026 10:39:28 -0600 Subject: [PATCH 3/7] arm: mediatek: mt8183: remove unused function Remove the mtk_pll_early_init() function as it is not used anywhere. Signed-off-by: David Lechner Reviewed-by: Macpaul Lin --- arch/arm/mach-mediatek/mt8183/init.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/arch/arm/mach-mediatek/mt8183/init.c b/arch/arm/mach-mediatek/mt8183/init.c index 39072622788..b445f3ea1e3 100644 --- a/arch/arm/mach-mediatek/mt8183/init.c +++ b/arch/arm/mach-mediatek/mt8183/init.c @@ -37,11 +37,6 @@ int dram_init_banksize(void) return 0; } -int mtk_pll_early_init(void) -{ - return 0; -} - void reset_cpu(void) { psci_system_reset(); From 9260339c0ed0cb6989f1fc1959d7619fcff7ed7c Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 9 Feb 2026 10:39:29 -0600 Subject: [PATCH 4/7] arm: mediatek: make mtk_pll_early_init() static Make the mtk_pll_early_init() function static in several files. It is only used within those files, so there is no need to have it in the global namespace. Reviewed-by: Macpaul Lin --- arch/arm/mach-mediatek/mt7629/init.c | 2 +- arch/arm/mach-mediatek/mt8516/init.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-mediatek/mt7629/init.c b/arch/arm/mach-mediatek/mt7629/init.c index 7cb8b72c364..ff027ed03ef 100644 --- a/arch/arm/mach-mediatek/mt7629/init.c +++ b/arch/arm/mach-mediatek/mt7629/init.c @@ -27,7 +27,7 @@ DECLARE_GLOBAL_DATA_PTR; -int mtk_pll_early_init(void) +static int mtk_pll_early_init(void) { unsigned long pll_rates[] = { [CLK_APMIXED_ARMPLL] = 1250000000, diff --git a/arch/arm/mach-mediatek/mt8516/init.c b/arch/arm/mach-mediatek/mt8516/init.c index 892bd441a33..82f8c509745 100644 --- a/arch/arm/mach-mediatek/mt8516/init.c +++ b/arch/arm/mach-mediatek/mt8516/init.c @@ -40,7 +40,7 @@ int dram_init_banksize(void) return 0; } -int mtk_pll_early_init(void) +static int mtk_pll_early_init(void) { unsigned long pll_rates[] = { [CLK_APMIXED_ARMPLL] = 1300000000, From 8b621407386eae25dc299823185ecdb5bb7822ef Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 9 Feb 2026 10:39:30 -0600 Subject: [PATCH 5/7] board/mediatek: move EVK MAINTAINERS to common file Move the mt8365_evk and mt8390_evk MAINTAINERS files to a common MAINTAINERS file. We will be deleting the board-specific directories soon but we need to keep the MAINTAINERS for the defconfig entries. Signed-off-by: David Lechner --- board/mediatek/{mt8390_evk => }/MAINTAINERS | 6 ++++++ board/mediatek/mt8365_evk/MAINTAINERS | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) rename board/mediatek/{mt8390_evk => }/MAINTAINERS (56%) delete mode 100644 board/mediatek/mt8365_evk/MAINTAINERS diff --git a/board/mediatek/mt8390_evk/MAINTAINERS b/board/mediatek/MAINTAINERS similarity index 56% rename from board/mediatek/mt8390_evk/MAINTAINERS rename to board/mediatek/MAINTAINERS index d46b8b2e156..3345c87d30b 100644 --- a/board/mediatek/mt8390_evk/MAINTAINERS +++ b/board/mediatek/MAINTAINERS @@ -1,3 +1,9 @@ +MT8365 EVK +M: Julien Masson +S: Maintained +F: board/mediatek/mt8365_evk/ +F: configs/mt8365_evk_defconfig + MT8390 EVK M: Julien Masson M: Macpaul Lin diff --git a/board/mediatek/mt8365_evk/MAINTAINERS b/board/mediatek/mt8365_evk/MAINTAINERS deleted file mode 100644 index e0d65efe812..00000000000 --- a/board/mediatek/mt8365_evk/MAINTAINERS +++ /dev/null @@ -1,5 +0,0 @@ -MT8365 EVK -M: Julien Masson -S: Maintained -F: board/mediatek/mt8365_evk/ -F: configs/mt8365_evk_defconfig From 24ffbb2aa17e287578aa359e773f075b9c96ebc0 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 9 Feb 2026 10:39:31 -0600 Subject: [PATCH 6/7] arm: mediatek: consolidate ARMv8 memory maps Consolidate all mem_map definitions for MediaTek ARMv8 platforms into a single file. The size of the DDR and MMIO regions can vary, so Kconfig options are added to configure them by target. Signed-off-by: David Lechner --- arch/arm/mach-mediatek/Kconfig | 21 ++++++++++++++ arch/arm/mach-mediatek/Makefile | 1 + .../arm/mach-mediatek/armv8-mem-map.c | 16 ++++------ arch/arm/mach-mediatek/mt7622/init.c | 20 ------------- arch/arm/mach-mediatek/mt7981/init.c | 21 -------------- arch/arm/mach-mediatek/mt7986/init.c | 21 -------------- arch/arm/mach-mediatek/mt7987/init.c | 21 -------------- arch/arm/mach-mediatek/mt7988/init.c | 21 -------------- arch/arm/mach-mediatek/mt8183/init.c | 20 ------------- arch/arm/mach-mediatek/mt8512/init.c | 21 -------------- arch/arm/mach-mediatek/mt8516/init.c | 20 ------------- arch/arm/mach-mediatek/mt8518/init.c | 21 -------------- board/mediatek/MAINTAINERS | 2 -- board/mediatek/mt8365_evk/Makefile | 3 -- board/mediatek/mt8390_evk/Makefile | 3 -- board/mediatek/mt8390_evk/mt8390_evk.c | 29 ------------------- 16 files changed, 28 insertions(+), 233 deletions(-) rename board/mediatek/mt8365_evk/mt8365_evk.c => arch/arm/mach-mediatek/armv8-mem-map.c (54%) delete mode 100644 board/mediatek/mt8365_evk/Makefile delete mode 100644 board/mediatek/mt8390_evk/Makefile delete mode 100644 board/mediatek/mt8390_evk/mt8390_evk.c diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig index d1d2605b2cc..33717a1864f 100644 --- a/arch/arm/mach-mediatek/Kconfig +++ b/arch/arm/mach-mediatek/Kconfig @@ -130,6 +130,27 @@ config TARGET_MT8518 endchoice +if ARM64 + +config MTK_MEM_MAP_DDR_SIZE + hex "DDR .size in mem_map" + default 0x200000000 if TARGET_MT7987 || TARGET_MT7988 || TARGET_MT8188 + default 0xc0000000 if TARGET_MT8365 + default 0x80000000 if TARGET_MT7981 || TARGET_MT7986 || TARGET_MT8183 + default 0x40000000 if TARGET_MT7622 || TARGET_MT8512 + default 0x20000000 + help + Target-specific DDR region size in mem_map. + +config MTK_MEM_MAP_MMIO_SIZE + hex "MMIO .size in mem_map" + default 0x40000000 if TARGET_MT7622 || TARGET_MT7981 || TARGET_MT7986 || TARGET_MT7987 || TARGET_MT7988 || TARGET_MT8512 + default 0x20000000 + help + Target-specific MMIO region size in mem_map. + +endif + config SYS_BOARD string "Board name" default "mt7622" if TARGET_MT7622 diff --git a/arch/arm/mach-mediatek/Makefile b/arch/arm/mach-mediatek/Makefile index 44591bed6fa..17e645989e5 100644 --- a/arch/arm/mach-mediatek/Makefile +++ b/arch/arm/mach-mediatek/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_ARM64) += armv8-mem-map.o obj-y += cpu.o obj-$(CONFIG_MTK_TZ_MOVABLE) += tzcfg.o obj-$(CONFIG_XPL_BUILD) += spl.o diff --git a/board/mediatek/mt8365_evk/mt8365_evk.c b/arch/arm/mach-mediatek/armv8-mem-map.c similarity index 54% rename from board/mediatek/mt8365_evk/mt8365_evk.c rename to arch/arm/mach-mediatek/armv8-mem-map.c index 41a6febf03d..3587a2a9dd2 100644 --- a/board/mediatek/mt8365_evk/mt8365_evk.c +++ b/arch/arm/mach-mediatek/armv8-mem-map.c @@ -1,28 +1,24 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 2023 BayLibre SAS - * Author: Julien Masson - */ +// SPDX-License-Identifier: GPL-2.0-only #include -static struct mm_region mt8365_evk_mem_map[] = { +static struct mm_region mediatek_mem_map[] = { { /* DDR */ .virt = 0x40000000UL, .phys = 0x40000000UL, - .size = 0xc0000000UL, + .size = CONFIG_MTK_MEM_MAP_DDR_SIZE, .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE, }, { .virt = 0x00000000UL, .phys = 0x00000000UL, - .size = 0x20000000UL, + .size = CONFIG_MTK_MEM_MAP_MMIO_SIZE, .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | PTE_BLOCK_NON_SHARE | PTE_BLOCK_PXN | PTE_BLOCK_UXN }, { - 0, + /* List terminator */ } }; -struct mm_region *mem_map = mt8365_evk_mem_map; +struct mm_region *mem_map = mediatek_mem_map; diff --git a/arch/arm/mach-mediatek/mt7622/init.c b/arch/arm/mach-mediatek/mt7622/init.c index 368f2916224..a043ca87398 100644 --- a/arch/arm/mach-mediatek/mt7622/init.c +++ b/arch/arm/mach-mediatek/mt7622/init.c @@ -36,23 +36,3 @@ void reset_cpu(void) { psci_system_reset(); } - -static struct mm_region mt7622_mem_map[] = { - { - /* DDR */ - .virt = 0x40000000UL, - .phys = 0x40000000UL, - .size = 0x40000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE, - }, { - .virt = 0x00000000UL, - .phys = 0x00000000UL, - .size = 0x40000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | - PTE_BLOCK_NON_SHARE | - PTE_BLOCK_PXN | PTE_BLOCK_UXN - }, { - 0, - } -}; -struct mm_region *mem_map = mt7622_mem_map; diff --git a/arch/arm/mach-mediatek/mt7981/init.c b/arch/arm/mach-mediatek/mt7981/init.c index 07da5897190..79afd6ce6be 100644 --- a/arch/arm/mach-mediatek/mt7981/init.c +++ b/arch/arm/mach-mediatek/mt7981/init.c @@ -30,24 +30,3 @@ void reset_cpu(void) { psci_system_reset(); } - -static struct mm_region mt7981_mem_map[] = { - { - /* DDR */ - .virt = 0x40000000UL, - .phys = 0x40000000UL, - .size = 0x80000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE, - }, { - .virt = 0x00000000UL, - .phys = 0x00000000UL, - .size = 0x40000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | - PTE_BLOCK_NON_SHARE | - PTE_BLOCK_PXN | PTE_BLOCK_UXN - }, { - 0, - } -}; - -struct mm_region *mem_map = mt7981_mem_map; diff --git a/arch/arm/mach-mediatek/mt7986/init.c b/arch/arm/mach-mediatek/mt7986/init.c index a521c95bd9d..1fe56b3f145 100644 --- a/arch/arm/mach-mediatek/mt7986/init.c +++ b/arch/arm/mach-mediatek/mt7986/init.c @@ -30,24 +30,3 @@ void reset_cpu(void) { psci_system_reset(); } - -static struct mm_region mt7986_mem_map[] = { - { - /* DDR */ - .virt = 0x40000000UL, - .phys = 0x40000000UL, - .size = 0x80000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE, - }, { - .virt = 0x00000000UL, - .phys = 0x00000000UL, - .size = 0x40000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | - PTE_BLOCK_NON_SHARE | - PTE_BLOCK_PXN | PTE_BLOCK_UXN - }, { - 0, - } -}; - -struct mm_region *mem_map = mt7986_mem_map; diff --git a/arch/arm/mach-mediatek/mt7987/init.c b/arch/arm/mach-mediatek/mt7987/init.c index 8b268297809..6364ab497f7 100644 --- a/arch/arm/mach-mediatek/mt7987/init.c +++ b/arch/arm/mach-mediatek/mt7987/init.c @@ -39,24 +39,3 @@ void reset_cpu(ulong addr) { psci_system_reset(); } - -static struct mm_region mt7987_mem_map[] = { - { - /* DDR */ - .virt = 0x40000000UL, - .phys = 0x40000000UL, - .size = 0x200000000ULL, - .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE, - }, { - .virt = 0x00000000UL, - .phys = 0x00000000UL, - .size = 0x40000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | - PTE_BLOCK_NON_SHARE | - PTE_BLOCK_PXN | PTE_BLOCK_UXN - }, { - 0, - } -}; - -struct mm_region *mem_map = mt7987_mem_map; diff --git a/arch/arm/mach-mediatek/mt7988/init.c b/arch/arm/mach-mediatek/mt7988/init.c index 8bdd3848d26..7ff843585ec 100644 --- a/arch/arm/mach-mediatek/mt7988/init.c +++ b/arch/arm/mach-mediatek/mt7988/init.c @@ -38,24 +38,3 @@ void reset_cpu(ulong addr) { psci_system_reset(); } - -static struct mm_region mt7988_mem_map[] = { - { - /* DDR */ - .virt = 0x40000000UL, - .phys = 0x40000000UL, - .size = 0x200000000ULL, - .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE, - }, { - .virt = 0x00000000UL, - .phys = 0x00000000UL, - .size = 0x40000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | - PTE_BLOCK_NON_SHARE | - PTE_BLOCK_PXN | PTE_BLOCK_UXN - }, { - 0, - } -}; - -struct mm_region *mem_map = mt7988_mem_map; diff --git a/arch/arm/mach-mediatek/mt8183/init.c b/arch/arm/mach-mediatek/mt8183/init.c index b445f3ea1e3..8dbf9c3df7e 100644 --- a/arch/arm/mach-mediatek/mt8183/init.c +++ b/arch/arm/mach-mediatek/mt8183/init.c @@ -47,23 +47,3 @@ int print_cpuinfo(void) printf("CPU: MediaTek MT8183\n"); return 0; } - -static struct mm_region mt8183_mem_map[] = { - { - /* DDR */ - .virt = 0x40000000UL, - .phys = 0x40000000UL, - .size = 0x80000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE, - }, { - .virt = 0x00000000UL, - .phys = 0x00000000UL, - .size = 0x20000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | - PTE_BLOCK_NON_SHARE | - PTE_BLOCK_PXN | PTE_BLOCK_UXN - }, { - 0, - } -}; -struct mm_region *mem_map = mt8183_mem_map; diff --git a/arch/arm/mach-mediatek/mt8512/init.c b/arch/arm/mach-mediatek/mt8512/init.c index 3b48caf5196..361c589cbc2 100644 --- a/arch/arm/mach-mediatek/mt8512/init.c +++ b/arch/arm/mach-mediatek/mt8512/init.c @@ -59,24 +59,3 @@ int print_cpuinfo(void) debug("CPU: MediaTek MT8512\n"); return 0; } - -static struct mm_region mt8512_mem_map[] = { - { - /* DDR */ - .virt = 0x40000000UL, - .phys = 0x40000000UL, - .size = 0x40000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE, - }, { - .virt = 0x00000000UL, - .phys = 0x00000000UL, - .size = 0x40000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | - PTE_BLOCK_NON_SHARE | - PTE_BLOCK_PXN | PTE_BLOCK_UXN - }, { - 0, - } -}; - -struct mm_region *mem_map = mt8512_mem_map; diff --git a/arch/arm/mach-mediatek/mt8516/init.c b/arch/arm/mach-mediatek/mt8516/init.c index 82f8c509745..1d925dd478a 100644 --- a/arch/arm/mach-mediatek/mt8516/init.c +++ b/arch/arm/mach-mediatek/mt8516/init.c @@ -94,23 +94,3 @@ int print_cpuinfo(void) printf("CPU: MediaTek MT8516\n"); return 0; } - -static struct mm_region mt8516_mem_map[] = { - { - /* DDR */ - .virt = 0x40000000UL, - .phys = 0x40000000UL, - .size = 0x20000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE, - }, { - .virt = 0x00000000UL, - .phys = 0x00000000UL, - .size = 0x20000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | - PTE_BLOCK_NON_SHARE | - PTE_BLOCK_PXN | PTE_BLOCK_UXN - }, { - 0, - } -}; -struct mm_region *mem_map = mt8516_mem_map; diff --git a/arch/arm/mach-mediatek/mt8518/init.c b/arch/arm/mach-mediatek/mt8518/init.c index c04bcb63517..8fa1346021a 100644 --- a/arch/arm/mach-mediatek/mt8518/init.c +++ b/arch/arm/mach-mediatek/mt8518/init.c @@ -51,24 +51,3 @@ int print_cpuinfo(void) printf("CPU: MediaTek MT8518\n"); return 0; } - -static struct mm_region mt8518_mem_map[] = { - { - /* DDR */ - .virt = 0x40000000UL, - .phys = 0x40000000UL, - .size = 0x20000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE, - }, { - .virt = 0x00000000UL, - .phys = 0x00000000UL, - .size = 0x20000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | - PTE_BLOCK_NON_SHARE | - PTE_BLOCK_PXN | PTE_BLOCK_UXN - }, { - 0, - } -}; - -struct mm_region *mem_map = mt8518_mem_map; diff --git a/board/mediatek/MAINTAINERS b/board/mediatek/MAINTAINERS index 3345c87d30b..5d19892e26b 100644 --- a/board/mediatek/MAINTAINERS +++ b/board/mediatek/MAINTAINERS @@ -1,12 +1,10 @@ MT8365 EVK M: Julien Masson S: Maintained -F: board/mediatek/mt8365_evk/ F: configs/mt8365_evk_defconfig MT8390 EVK M: Julien Masson M: Macpaul Lin S: Maintained -F: board/mediatek/mt8390_evk/ F: configs/mt8390_evk_defconfig diff --git a/board/mediatek/mt8365_evk/Makefile b/board/mediatek/mt8365_evk/Makefile deleted file mode 100644 index 90fc92b28c5..00000000000 --- a/board/mediatek/mt8365_evk/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 - -obj-y += mt8365_evk.o diff --git a/board/mediatek/mt8390_evk/Makefile b/board/mediatek/mt8390_evk/Makefile deleted file mode 100644 index a26d46838c4..00000000000 --- a/board/mediatek/mt8390_evk/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 - -obj-y += mt8390_evk.o diff --git a/board/mediatek/mt8390_evk/mt8390_evk.c b/board/mediatek/mt8390_evk/mt8390_evk.c deleted file mode 100644 index 5731199bf83..00000000000 --- a/board/mediatek/mt8390_evk/mt8390_evk.c +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 2026 BayLibre SAS - * Author: Julien Masson - */ - -#include -#include - -static struct mm_region mt8390_evk_mem_map[] = { - { - /* DDR */ - .virt = 0x40000000UL, - .phys = 0x40000000UL, - .size = 0x200000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE, - }, { - .virt = 0x00000000UL, - .phys = 0x00000000UL, - .size = 0x20000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | - PTE_BLOCK_NON_SHARE | - PTE_BLOCK_PXN | PTE_BLOCK_UXN - }, { - 0, - } -}; - -struct mm_region *mem_map = mt8390_evk_mem_map; From f1c0e637cd67ffddee154f8c5282c4e910a7179e Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 9 Feb 2026 10:39:32 -0600 Subject: [PATCH 7/7] arm: mediatek: add CONFIG_MTK_MEM_MAP_DDR_BASE_PHY Add a CONFIG_MTK_MEM_MAP_DDR_BASE_PHY variable to specify the DDR base physical address for the Mediatek ARMv8 memory map. This will be used by MT8196 in the future which has a different DDR base address than other Mediatek SoCs. Signed-off-by: David Lechner Reviewed-by: Macpaul Lin --- arch/arm/mach-mediatek/Kconfig | 6 ++++++ arch/arm/mach-mediatek/armv8-mem-map.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig index 33717a1864f..d10aedc303b 100644 --- a/arch/arm/mach-mediatek/Kconfig +++ b/arch/arm/mach-mediatek/Kconfig @@ -132,6 +132,12 @@ endchoice if ARM64 +config MTK_MEM_MAP_DDR_BASE_PHY + hex "DDR physical base address" + default 0x40000000 + help + Target-specific DDR physical base address. + config MTK_MEM_MAP_DDR_SIZE hex "DDR .size in mem_map" default 0x200000000 if TARGET_MT7987 || TARGET_MT7988 || TARGET_MT8188 diff --git a/arch/arm/mach-mediatek/armv8-mem-map.c b/arch/arm/mach-mediatek/armv8-mem-map.c index 3587a2a9dd2..cbaa9b4c267 100644 --- a/arch/arm/mach-mediatek/armv8-mem-map.c +++ b/arch/arm/mach-mediatek/armv8-mem-map.c @@ -5,8 +5,8 @@ static struct mm_region mediatek_mem_map[] = { { /* DDR */ - .virt = 0x40000000UL, - .phys = 0x40000000UL, + .virt = CONFIG_MTK_MEM_MAP_DDR_BASE_PHY, + .phys = CONFIG_MTK_MEM_MAP_DDR_BASE_PHY, .size = CONFIG_MTK_MEM_MAP_DDR_SIZE, .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE, }, {