Yidi Lin | 27be904 | 2021-03-25 17:50:14 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <device/mmio.h> |
| 4 | #include <soc/mcucfg.h> |
| 5 | #include <soc/mmu_operations.h> |
| 6 | #include <soc/symbols.h> |
| 7 | |
| 8 | DEFINE_BIT(MP0_CLUSTER_CFG0_L3_SHARE_EN, 9) |
| 9 | DEFINE_BIT(MP0_CLUSTER_CFG0_L3_SHARE_PRE_EN, 8) |
| 10 | |
| 11 | void mtk_soc_disable_l2c_sram(void) |
| 12 | { |
| 13 | unsigned long v; |
| 14 | |
Rex-BC Chen | 7d9bd17 | 2021-11-11 15:45:27 +0800 | [diff] [blame] | 15 | SET32_BITFIELDS(&mtk_mcucfg->mp0_cluster_cfg0, |
Yidi Lin | 27be904 | 2021-03-25 17:50:14 +0800 | [diff] [blame] | 16 | MP0_CLUSTER_CFG0_L3_SHARE_EN, 0); |
| 17 | dsb(); |
| 18 | |
| 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(); |
| 23 | |
| 24 | do { |
| 25 | __asm__ volatile ("mrs %0, S3_0_C15_C3_7" : "=r" (v)); |
| 26 | } while (((v >> 0x4) & 0xf) != 0xf); |
| 27 | |
Rex-BC Chen | 7d9bd17 | 2021-11-11 15:45:27 +0800 | [diff] [blame] | 28 | SET32_BITFIELDS(&mtk_mcucfg->mp0_cluster_cfg0, |
Yidi Lin | 27be904 | 2021-03-25 17:50:14 +0800 | [diff] [blame] | 29 | MP0_CLUSTER_CFG0_L3_SHARE_PRE_EN, 0); |
| 30 | dsb(); |
| 31 | } |
Rex-BC Chen | 00b43c9 | 2021-05-10 20:06:35 +0800 | [diff] [blame] | 32 | |
| 33 | /* mtk_soc_after_dram is called in romstage */ |
| 34 | void mtk_soc_after_dram(void) |
| 35 | { |
| 36 | mmu_config_range(_dram_dma, REGION_SIZE(dram_dma), |
| 37 | NONSECURE_UNCACHED_MEM); |
| 38 | } |