coreboot-kgpe-d16/src/soc/mediatek/mt8192/mmu_operations.c
Yidi Lin 2832d11dd1 mediatek/mt8192: memlayout: Add DRAM DMA region
SPM DMA hardware requires a non-cacheable buffer to load SPM
firmware.

TEST=verified with SPM WIP patch.
     SPM PC stays at 0x3f4 after SPM firmware is loaded.

Signed-off-by: Yidi Lin <yidi.lin@mediatek.com>
Change-Id: If6e803da23126419a96ffc0337d35edd0e181871
Reviewed-on: https://review.coreboot.org/c/coreboot/+/47293
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
2020-11-20 08:40:58 +00:00

38 lines
906 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
#include <device/mmio.h>
#include <soc/mcucfg.h>
#include <soc/mmu_operations.h>
#include <soc/symbols.h>
DEFINE_BIT(MP0_CLUSTER_CFG0_L3_SHARE_EN, 9)
DEFINE_BIT(MP0_CLUSTER_CFG0_L3_SHARE_PRE_EN, 8)
void mtk_soc_disable_l2c_sram(void)
{
unsigned long v;
SET32_BITFIELDS(&mt8192_mcucfg->mp0_cluster_cfg0,
MP0_CLUSTER_CFG0_L3_SHARE_EN, 0);
dsb();
__asm__ volatile ("mrs %0, S3_0_C15_C3_5" : "=r" (v));
v |= (0xf << 4);
__asm__ volatile ("msr S3_0_C15_C3_5, %0" : : "r" (v));
dsb();
do {
__asm__ volatile ("mrs %0, S3_0_C15_C3_7" : "=r" (v));
} while (((v >> 0x4) & 0xf) != 0xf);
SET32_BITFIELDS(&mt8192_mcucfg->mp0_cluster_cfg0,
MP0_CLUSTER_CFG0_L3_SHARE_PRE_EN, 0);
dsb();
}
/* 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);
}