soc/mediatek: Refactor MMU configuration for DMA region

This patch refactors the MMU configuration for the DMA region by moving
the logic from mmu_cmops.c to the common/mmu_operations.c. This
centralization simplifies the code and removes duplication.

The following changes are included:
- Deleted src/soc/mediatek/common/mmu_cmops.c
- Moved DMA region configuration to mtk_mmu_after_dram
- Updated Makefiles to remove references to the deleted file

BRANCH=none
BUG=none
TEST=emerge-kukui coreboot -j && emerge-elm  coreboot -j && \
     emerge-rauru coreboot -j

Change-Id: I06289afa74248d55fc1eabeef2f6591bc805a8cf
Signed-off-by: Yidi Lin <yidilin@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/89411
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Yidi Lin 2025-10-03 13:57:21 +08:00
commit b48532c694
9 changed files with 14 additions and 28 deletions

View file

@ -1,11 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <soc/symbols.h>
#include <soc/mmu_operations.h>
/* mtk_soc_after_dram is called in romstage */
void mtk_soc_after_dram(void)
{
mmu_config_range(_dram_dma, REGION_SIZE(dram_dma),
NONSECURE_UNCACHED_MEM);
}

View file

@ -49,6 +49,8 @@ void mtk_mmu_after_dram(void)
/* Map DRAM as cached now that it's up and running */
mmu_config_range(_dram, (uintptr_t)sdram_size(), NONSECURE_CACHED_MEM);
mmu_config_range(_dram_dma, REGION_SIZE(dram_dma), NONSECURE_UNCACHED_MEM);
mtk_soc_after_dram();
}

View file

@ -1,17 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <device/mmio.h>
#include <arch/mmu.h>
#include <symbols.h>
#include <soc/symbols.h>
#include <soc/infracfg.h>
#include <soc/mcucfg.h>
#include <soc/mmu_operations.h>
void mtk_soc_after_dram(void)
{
mmu_config_range(_dram_dma, REGION_SIZE(dram_dma),
NONSECURE_UNCACHED_MEM);
mtk_mmu_disable_l2c_sram();
}

View file

@ -26,7 +26,7 @@ romstage-y += ../common/emi.c
romstage-y += ../common/l2c_ops.c
romstage-y += ../common/memory.c
romstage-y += ../common/memory_test.c
romstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c
romstage-y += ../common/mmu_operations.c
romstage-y += ../common/mt6315.c mt6315.c
romstage-y += ../common/pmic_wrap.c pmic_wrap.c pmif.c mt6366.c
romstage-y += ../common/pmif.c ../common/pmif_clk.c ../common/pmif_init.c pmif_clk.c
@ -44,7 +44,7 @@ ramstage-y += ../common/dsi.c ../common/mtk_mipi_dphy.c
ramstage-y += ../common/emi.c
ramstage-y += ../common/l2c_ops.c
ramstage-y += ../common/mcu.c
ramstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c
ramstage-y += ../common/mmu_operations.c
ramstage-$(CONFIG_COMMONLIB_STORAGE_MMC) += ../common/msdc.c msdc.c
ramstage-y += ../common/mtcmos.c mtcmos.c
ramstage-y += ../common/pmic_wrap.c pmic_wrap.c pmif.c mt6366.c

View file

@ -24,7 +24,7 @@ romstage-y += ../common/emi.c
romstage-y += ../common/l2c_ops.c
romstage-y += ../common/memory.c
romstage-y += ../common/memory_test.c
romstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c
romstage-y += ../common/mmu_operations.c
romstage-y += ../common/mt6315.c mt6315.c
romstage-y += ../common/mt6359p.c mt6359p.c
romstage-y += ../common/pmif.c ../common/pmif_clk.c ../common/pmif_init.c pmif_clk.c
@ -50,7 +50,7 @@ ramstage-y += ../common/emi.c
ramstage-y += ../common/l2c_ops.c
ramstage-y += ../common/mcu.c
ramstage-y += ../common/mcupm.c
ramstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c
ramstage-y += ../common/mmu_operations.c
ramstage-$(CONFIG_COMMONLIB_STORAGE_MMC) += ../common/msdc.c msdc.c
ramstage-y += ../common/mt6359p.c mt6359p.c
ramstage-y += ../common/mtcmos.c mtcmos.c

View file

@ -26,7 +26,7 @@ romstage-y += ../common/dramc_param.c
romstage-y += dvfs.c
romstage-y += ../common/emi.c
romstage-y += ../common/memory.c ../common/memory_test.c ../common/memory_type.c
romstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c
romstage-y += ../common/mmu_operations.c
romstage-y += ../common/thermal.c thermal.c
romstage-y += ../common/thermal_sram.c thermal_sram.c
romstage-y += ../common/mt6315.c mt6315.c
@ -49,7 +49,7 @@ ramstage-y += ../common/dramc_info.c
ramstage-y += ../common/emi.c
ramstage-y += ../common/mcu.c mcupm.c
ramstage-y += ../common/memory.c
ramstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c
ramstage-y += ../common/mmu_operations.c
ramstage-$(CONFIG_COMMONLIB_STORAGE_MMC) += ../common/msdc.c msdc.c
ramstage-y += ../common/mt6315.c mt6315.c
ramstage-y += ../common/mt6359p.c mt6359p.c

View file

@ -23,7 +23,7 @@ romstage-y += ../common/dram_init.c
romstage-y += ../common/dramc_param.c
romstage-y += ../common/l2c_ops.c
romstage-y += ../common/memory.c ../common/memory_test.c
romstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c
romstage-y += ../common/mmu_operations.c
romstage-y += ../common/pll.c pll.c
romstage-y += ../common/pmif.c ../common/pmif_clk.c ../common/pmif_init.c pmif_clk.c
romstage-y += ../common/pmif_spi.c pmif_spi.c
@ -44,7 +44,7 @@ ramstage-y += ../common/dsi.c ../common/mtk_mipi_dphy.c
ramstage-y += ../common/l2c_ops.c
ramstage-y += ../common/mcu.c
ramstage-y += ../common/mcupm.c
ramstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c
ramstage-y += ../common/mmu_operations.c
ramstage-$(CONFIG_COMMONLIB_STORAGE_MMC) += ../common/msdc.c msdc.c
ramstage-y += ../common/mtcmos.c mtcmos.c
ramstage-y += ../common/pmif.c ../common/pmif_init.c

View file

@ -26,7 +26,7 @@ romstage-y += emi.c
romstage-y += ../common/l2c_ops.c
romstage-y += ../common/memory.c
romstage-y += ../common/memory_test.c
romstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c
romstage-y += ../common/mmu_operations.c
romstage-y += ../common/pll.c pll.c
romstage-y += scp.c
romstage-y += ../common/pmif.c ../common/pmif_clk.c ../common/pmif_init.c pmif_clk.c
@ -59,7 +59,7 @@ ramstage-y += hdmi.c
ramstage-y += ../common/l2c_ops.c
ramstage-y += ../common/mcu.c
ramstage-y += ../common/mcupm.c
ramstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c
ramstage-y += ../common/mmu_operations.c
ramstage-$(CONFIG_COMMONLIB_STORAGE_MMC) += ../common/msdc.c msdc.c
ramstage-y += mt6360.c
ramstage-y += ../common/mtcmos.c mtcmos.c

View file

@ -37,7 +37,7 @@ romstage-y += l2c_ops.c
romstage-y += modem_power_ctrl.c
romstage-y += ../common/memory.c ../common/memory_type.c
romstage-y += ../common/memory_test.c
romstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c
romstage-y += ../common/mmu_operations.c
romstage-y += ../common/mt6316.c mt6316.c
romstage-y += ../common/mt6363.c mt6363.c
romstage-y += ../common/mt6373.c mt6373.c
@ -68,7 +68,7 @@ ramstage-y += ../common/emi.c
ramstage-y += gpueb.c
ramstage-y += l2c_ops.c
ramstage-y += ../common/mcu.c mcupm.c
ramstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c
ramstage-y += ../common/mmu_operations.c
ramstage-$(CONFIG_PCI) += ../common/pcie.c pcie.c
ramstage-$(CONFIG_COMMONLIB_STORAGE_MMC) += msdc.c
ramstage-y += ../common/mt6363.c mt6363.c