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*4882a593Smuzhiyunvoid 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