Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Lowlevel setup for SMDK5250 board based on S5PC520 |
| 4 | * |
| 5 | * Copyright (C) 2012 Samsung Electronics |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
Tom Rini | dec7ea0 | 2024-05-20 13:35:03 -0600 | [diff] [blame^] | 8 | #include <mach/cpu.h> |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 9 | #include <asm/arch/tzpc.h> |
Inderpal Singh | b472f58 | 2013-04-04 23:09:19 +0000 | [diff] [blame] | 10 | #include <asm/io.h> |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 11 | |
| 12 | /* Setting TZPC[TrustZone Protection Controller] */ |
| 13 | void tzpc_init(void) |
| 14 | { |
Chander Kashyap | 8f22378 | 2012-03-14 17:34:02 +0000 | [diff] [blame] | 15 | struct exynos_tzpc *tzpc; |
Inderpal Singh | 848048a | 2013-04-04 23:09:20 +0000 | [diff] [blame] | 16 | unsigned int addr, start = 0, end = 0; |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 17 | |
Inderpal Singh | 848048a | 2013-04-04 23:09:20 +0000 | [diff] [blame] | 18 | start = samsung_get_base_tzpc(); |
| 19 | |
| 20 | if (cpu_is_exynos5()) |
| 21 | end = start + ((EXYNOS5_NR_TZPC_BANKS - 1) * TZPC_BASE_OFFSET); |
| 22 | else if (cpu_is_exynos4()) |
| 23 | end = start + ((EXYNOS4_NR_TZPC_BANKS - 1) * TZPC_BASE_OFFSET); |
| 24 | |
| 25 | for (addr = start; addr <= end; addr += TZPC_BASE_OFFSET) { |
Minkyu Kang | 1b65ea9 | 2012-04-02 16:51:33 +0900 | [diff] [blame] | 26 | tzpc = (struct exynos_tzpc *)addr; |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 27 | |
Inderpal Singh | 848048a | 2013-04-04 23:09:20 +0000 | [diff] [blame] | 28 | if (addr == start) |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 29 | writel(R0SIZE, &tzpc->r0size); |
| 30 | |
| 31 | writel(DECPROTXSET, &tzpc->decprot0set); |
| 32 | writel(DECPROTXSET, &tzpc->decprot1set); |
| 33 | |
Inderpal Singh | 848048a | 2013-04-04 23:09:20 +0000 | [diff] [blame] | 34 | if (cpu_is_exynos5() && (addr == end)) |
| 35 | break; |
| 36 | |
| 37 | writel(DECPROTXSET, &tzpc->decprot2set); |
| 38 | writel(DECPROTXSET, &tzpc->decprot3set); |
Chander Kashyap | ed2e25a | 2012-02-05 23:01:47 +0000 | [diff] [blame] | 39 | } |
| 40 | } |