mb/system76/cml-u/dt: Make use of chipset devicetree
[coreboot.git] / src / soc / mediatek / common / mmu_cmops.c
blob4b81a276b64a9467c68b50615f428ff7da91184f
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <device/mmio.h>
4 #include <soc/mcucfg.h>
5 #include <soc/mmu_operations.h>
6 #include <soc/symbols.h>
8 DEFINE_BIT(MP0_CLUSTER_CFG0_L3_SHARE_EN, 9)
9 DEFINE_BIT(MP0_CLUSTER_CFG0_L3_SHARE_PRE_EN, 8)
11 void mtk_soc_disable_l2c_sram(void)
13 unsigned long v;
15 SET32_BITFIELDS(&mtk_mcucfg->mp0_cluster_cfg0,
16 MP0_CLUSTER_CFG0_L3_SHARE_EN, 0);
17 dsb();
19 __asm__ volatile ("mrs %0, S3_0_C15_C3_5" : "=r" (v));
20 v |= (0xf << 4);
21 __asm__ volatile ("msr S3_0_C15_C3_5, %0" : : "r" (v));
22 dsb();
24 do {
25 __asm__ volatile ("mrs %0, S3_0_C15_C3_7" : "=r" (v));
26 } while (((v >> 0x4) & 0xf) != 0xf);
28 SET32_BITFIELDS(&mtk_mcucfg->mp0_cluster_cfg0,
29 MP0_CLUSTER_CFG0_L3_SHARE_PRE_EN, 0);
30 dsb();
33 /* mtk_soc_after_dram is called in romstage */
34 void mtk_soc_after_dram(void)
36 mmu_config_range(_dram_dma, REGION_SIZE(dram_dma),
37 NONSECURE_UNCACHED_MEM);