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