blob: abe8e7f4589848243751997f074f88f253b2dcd1 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Chander Kashyaped2e25a2012-02-05 23:01:47 +00002/*
3 * Lowlevel setup for SMDK5250 board based on S5PC520
4 *
5 * Copyright (C) 2012 Samsung Electronics
Chander Kashyaped2e25a2012-02-05 23:01:47 +00006 */
7
Inderpal Singh848048a2013-04-04 23:09:20 +00008#include <common.h>
Chander Kashyaped2e25a2012-02-05 23:01:47 +00009#include <asm/arch/tzpc.h>
Inderpal Singhb472f582013-04-04 23:09:19 +000010#include <asm/io.h>
Chander Kashyaped2e25a2012-02-05 23:01:47 +000011
12/* Setting TZPC[TrustZone Protection Controller] */
13void tzpc_init(void)
14{
Chander Kashyap8f223782012-03-14 17:34:02 +000015 struct exynos_tzpc *tzpc;
Inderpal Singh848048a2013-04-04 23:09:20 +000016 unsigned int addr, start = 0, end = 0;
Chander Kashyaped2e25a2012-02-05 23:01:47 +000017
Inderpal Singh848048a2013-04-04 23:09:20 +000018 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 Kang1b65ea92012-04-02 16:51:33 +090026 tzpc = (struct exynos_tzpc *)addr;
Chander Kashyaped2e25a2012-02-05 23:01:47 +000027
Inderpal Singh848048a2013-04-04 23:09:20 +000028 if (addr == start)
Chander Kashyaped2e25a2012-02-05 23:01:47 +000029 writel(R0SIZE, &tzpc->r0size);
30
31 writel(DECPROTXSET, &tzpc->decprot0set);
32 writel(DECPROTXSET, &tzpc->decprot1set);
33
Inderpal Singh848048a2013-04-04 23:09:20 +000034 if (cpu_is_exynos5() && (addr == end))
35 break;
36
37 writel(DECPROTXSET, &tzpc->decprot2set);
38 writel(DECPROTXSET, &tzpc->decprot3set);
Chander Kashyaped2e25a2012-02-05 23:01:47 +000039 }
40}