Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Chen-Yu Tsai | fcc7b70 | 2015-08-25 10:49:19 +0800 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2015 Chen-Yu Tsai <wens@csie.org> |
Chen-Yu Tsai | fcc7b70 | 2015-08-25 10:49:19 +0800 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <asm/io.h> |
| 7 | #include <asm/arch/cpu.h> |
| 8 | #include <asm/arch/tzpc.h> |
| 9 | |
| 10 | /* Configure Trust Zone Protection Controller */ |
| 11 | void tzpc_init(void) |
| 12 | { |
| 13 | struct sunxi_tzpc *tzpc = (struct sunxi_tzpc *)SUNXI_TZPC_BASE; |
| 14 | |
Chen-Yu Tsai | 0932b63 | 2016-01-06 15:13:06 +0800 | [diff] [blame] | 15 | #ifdef CONFIG_MACH_SUN6I |
Chen-Yu Tsai | fcc7b70 | 2015-08-25 10:49:19 +0800 | [diff] [blame] | 16 | /* Enable non-secure access to the RTC */ |
Chen-Yu Tsai | 0932b63 | 2016-01-06 15:13:06 +0800 | [diff] [blame] | 17 | writel(SUN6I_TZPC_DECPORT0_RTC, &tzpc->decport0_set); |
| 18 | #endif |
| 19 | |
| 20 | #ifdef CONFIG_MACH_SUN8I_H3 |
| 21 | /* Enable non-secure access to all peripherals */ |
| 22 | writel(SUN8I_H3_TZPC_DECPORT0_ALL, &tzpc->decport0_set); |
| 23 | writel(SUN8I_H3_TZPC_DECPORT1_ALL, &tzpc->decport1_set); |
| 24 | writel(SUN8I_H3_TZPC_DECPORT2_ALL, &tzpc->decport2_set); |
| 25 | #endif |
Chen-Yu Tsai | fcc7b70 | 2015-08-25 10:49:19 +0800 | [diff] [blame] | 26 | } |