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