xref: /rk3399_rockchip-uboot/arch/arm/cpu/armv7/sunxi/tzpc.c (revision 9e4de7fd4acc8f99b6d383c711d21c0159849629)
192369844SChen-Yu Tsai /*
292369844SChen-Yu Tsai  * (C) Copyright 2015 Chen-Yu Tsai <wens@csie.org>
392369844SChen-Yu Tsai  *
492369844SChen-Yu Tsai  * SPDX-License-Identifier:	GPL-2.0+
592369844SChen-Yu Tsai  */
692369844SChen-Yu Tsai 
792369844SChen-Yu Tsai #include <asm/io.h>
892369844SChen-Yu Tsai #include <asm/arch/cpu.h>
992369844SChen-Yu Tsai #include <asm/arch/tzpc.h>
1092369844SChen-Yu Tsai 
1192369844SChen-Yu Tsai /* Configure Trust Zone Protection Controller */
tzpc_init(void)1292369844SChen-Yu Tsai void tzpc_init(void)
1392369844SChen-Yu Tsai {
1492369844SChen-Yu Tsai 	struct sunxi_tzpc *tzpc = (struct sunxi_tzpc *)SUNXI_TZPC_BASE;
1592369844SChen-Yu Tsai 
16*5823664fSChen-Yu Tsai #ifdef CONFIG_MACH_SUN6I
1792369844SChen-Yu Tsai 	/* Enable non-secure access to the RTC */
18*5823664fSChen-Yu Tsai 	writel(SUN6I_TZPC_DECPORT0_RTC, &tzpc->decport0_set);
19*5823664fSChen-Yu Tsai #endif
20*5823664fSChen-Yu Tsai 
21*5823664fSChen-Yu Tsai #ifdef CONFIG_MACH_SUN8I_H3
22*5823664fSChen-Yu Tsai 	/* Enable non-secure access to all peripherals */
23*5823664fSChen-Yu Tsai 	writel(SUN8I_H3_TZPC_DECPORT0_ALL, &tzpc->decport0_set);
24*5823664fSChen-Yu Tsai 	writel(SUN8I_H3_TZPC_DECPORT1_ALL, &tzpc->decport1_set);
25*5823664fSChen-Yu Tsai 	writel(SUN8I_H3_TZPC_DECPORT2_ALL, &tzpc->decport2_set);
26*5823664fSChen-Yu Tsai #endif
2792369844SChen-Yu Tsai }
28