blob: 395077cf25652bafe6b326e4229fcc5e1ae92bde [file] [log] [blame]
Chander Kashyaped2e25a2012-02-05 23:01:47 +00001/*
2 * Lowlevel setup for SMDK5250 board based on S5PC520
3 *
4 * Copyright (C) 2012 Samsung Electronics
5 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Chander Kashyaped2e25a2012-02-05 23:01:47 +00007 */
8
Inderpal Singh848048a2013-04-04 23:09:20 +00009#include <common.h>
Chander Kashyaped2e25a2012-02-05 23:01:47 +000010#include <asm/arch/tzpc.h>
Inderpal Singhb472f582013-04-04 23:09:19 +000011#include <asm/io.h>
Chander Kashyaped2e25a2012-02-05 23:01:47 +000012
13/* Setting TZPC[TrustZone Protection Controller] */
14void tzpc_init(void)
15{
Chander Kashyap8f223782012-03-14 17:34:02 +000016 struct exynos_tzpc *tzpc;
Inderpal Singh848048a2013-04-04 23:09:20 +000017 unsigned int addr, start = 0, end = 0;
Chander Kashyaped2e25a2012-02-05 23:01:47 +000018
Inderpal Singh848048a2013-04-04 23:09:20 +000019 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 Kang1b65ea92012-04-02 16:51:33 +090027 tzpc = (struct exynos_tzpc *)addr;
Chander Kashyaped2e25a2012-02-05 23:01:47 +000028
Inderpal Singh848048a2013-04-04 23:09:20 +000029 if (addr == start)
Chander Kashyaped2e25a2012-02-05 23:01:47 +000030 writel(R0SIZE, &tzpc->r0size);
31
32 writel(DECPROTXSET, &tzpc->decprot0set);
33 writel(DECPROTXSET, &tzpc->decprot1set);
34
Inderpal Singh848048a2013-04-04 23:09:20 +000035 if (cpu_is_exynos5() && (addr == end))
36 break;
37
38 writel(DECPROTXSET, &tzpc->decprot2set);
39 writel(DECPROTXSET, &tzpc->decprot3set);
Chander Kashyaped2e25a2012-02-05 23:01:47 +000040 }
41}