xref: /OK3568_Linux_fs/u-boot/arch/arm/cpu/armv7/sunxi/tzpc.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * (C) Copyright 2015 Chen-Yu Tsai <wens@csie.org>
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * SPDX-License-Identifier:	GPL-2.0+
5*4882a593Smuzhiyun  */
6*4882a593Smuzhiyun 
7*4882a593Smuzhiyun #include <asm/io.h>
8*4882a593Smuzhiyun #include <asm/arch/cpu.h>
9*4882a593Smuzhiyun #include <asm/arch/tzpc.h>
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun /* Configure Trust Zone Protection Controller */
tzpc_init(void)12*4882a593Smuzhiyun void tzpc_init(void)
13*4882a593Smuzhiyun {
14*4882a593Smuzhiyun 	struct sunxi_tzpc *tzpc = (struct sunxi_tzpc *)SUNXI_TZPC_BASE;
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun #ifdef CONFIG_MACH_SUN6I
17*4882a593Smuzhiyun 	/* Enable non-secure access to the RTC */
18*4882a593Smuzhiyun 	writel(SUN6I_TZPC_DECPORT0_RTC, &tzpc->decport0_set);
19*4882a593Smuzhiyun #endif
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun #ifdef CONFIG_MACH_SUN8I_H3
22*4882a593Smuzhiyun 	/* Enable non-secure access to all peripherals */
23*4882a593Smuzhiyun 	writel(SUN8I_H3_TZPC_DECPORT0_ALL, &tzpc->decport0_set);
24*4882a593Smuzhiyun 	writel(SUN8I_H3_TZPC_DECPORT1_ALL, &tzpc->decport1_set);
25*4882a593Smuzhiyun 	writel(SUN8I_H3_TZPC_DECPORT2_ALL, &tzpc->decport2_set);
26*4882a593Smuzhiyun #endif
27*4882a593Smuzhiyun }
28