1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <console/console.h>
4 #include <device/mmio.h>
5 #include <soc/apusys.h>
6 #include <soc/infracfg.h>
7
8 /* INFRA2APU_SRAM_PROT_EN */
9 DEFINE_BITFIELD(PROT_EN, 31, 30)
10
11 /* MBOX Functional Configuration */
12 DEFINE_BITFIELD(LOCK, 0, 0)
13 DEFINE_BITFIELD(NO_MPU, 16, 16)
14
dump_apusys_reg(void)15 static void dump_apusys_reg(void)
16 {
17 int i;
18
19 printk(BIOS_INFO, "INFRA2APU_SRAM_PROT_EN %p = %#x\n",
20 (void *)&mt8192_infracfg->infra_ao_mm_hang_free,
21 read32(&mt8192_infracfg->infra_ao_mm_hang_free));
22
23 for (i = 0; i < ARRAY_SIZE(mt8192_apu_mbox); i++) {
24 printk(BIOS_INFO, "APU_MBOX %p = %#x\n",
25 (void *)&mt8192_apu_mbox[i]->mbox_func_cfg,
26 read32(&mt8192_apu_mbox[i]->mbox_func_cfg));
27 }
28 }
29
apusys_init(void)30 void apusys_init(void)
31 {
32 int i;
33
34 SET32_BITFIELDS(&mt8192_infracfg->infra_ao_mm_hang_free, PROT_EN, 0);
35
36 /* Setup MBOX MPU for non secure access */
37 for (i = 0; i < ARRAY_SIZE(mt8192_apu_mbox); i++)
38 SET32_BITFIELDS(&mt8192_apu_mbox[i]->mbox_func_cfg, NO_MPU, 1, LOCK, 1);
39
40 dump_apusys_reg();
41 }
42