blob: 6c8a0fd9a25bab942a67a4118be9500726d75a32 [file] [log] [blame]
Chen-Yu Tsaifcc7b702015-08-25 10:49:19 +08001/*
2 * (C) Copyright 2015 Chen-Yu Tsai <wens@csie.org>
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <asm/io.h>
8#include <asm/arch/cpu.h>
9#include <asm/arch/tzpc.h>
10
11/* Configure Trust Zone Protection Controller */
12void tzpc_init(void)
13{
14 struct sunxi_tzpc *tzpc = (struct sunxi_tzpc *)SUNXI_TZPC_BASE;
15
Chen-Yu Tsai0932b632016-01-06 15:13:06 +080016#ifdef CONFIG_MACH_SUN6I
Chen-Yu Tsaifcc7b702015-08-25 10:49:19 +080017 /* Enable non-secure access to the RTC */
Chen-Yu Tsai0932b632016-01-06 15:13:06 +080018 writel(SUN6I_TZPC_DECPORT0_RTC, &tzpc->decport0_set);
19#endif
20
21#ifdef CONFIG_MACH_SUN8I_H3
22 /* Enable non-secure access to all peripherals */
23 writel(SUN8I_H3_TZPC_DECPORT0_ALL, &tzpc->decport0_set);
24 writel(SUN8I_H3_TZPC_DECPORT1_ALL, &tzpc->decport1_set);
25 writel(SUN8I_H3_TZPC_DECPORT2_ALL, &tzpc->decport2_set);
26#endif
Chen-Yu Tsaifcc7b702015-08-25 10:49:19 +080027}