blob: d555e9d22c22a2a624ee396fbee9b749a44f61d8 [file] [log] [blame]
Gabe Black8128a562013-09-18 05:48:37 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2013 Google Inc.
5 * Copyright (C) 2012 Samsung Electronics
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Gabe Black8128a562013-09-18 05:48:37 -070015 */
16
17#include <arch/io.h>
Julius Werner1ed0c8c2014-10-20 13:16:29 -070018#include <soc/trustzone.h>
Gabe Black8128a562013-09-18 05:48:37 -070019
20/* Setting TZPC[TrustZone Protection Controller] */
21void trustzone_init(void)
22{
23 struct exynos_tzpc *tzpc;
24 unsigned int addr;
25
26 for (addr = TZPC0_BASE; addr <= TZPC9_BASE; addr += TZPC_BASE_OFFSET) {
27 tzpc = (struct exynos_tzpc *)addr;
28
29 if (addr == TZPC0_BASE)
Julius Werner2f37bd62015-02-19 14:51:15 -080030 write32(&tzpc->r0size, R0SIZE);
Gabe Black8128a562013-09-18 05:48:37 -070031
Julius Werner2f37bd62015-02-19 14:51:15 -080032 write32(&tzpc->decprot0set, DECPROTXSET);
33 write32(&tzpc->decprot1set, DECPROTXSET);
Gabe Black8128a562013-09-18 05:48:37 -070034
35 if (addr != TZPC9_BASE) {
Julius Werner2f37bd62015-02-19 14:51:15 -080036 write32(&tzpc->decprot2set, DECPROTXSET);
37 write32(&tzpc->decprot3set, DECPROTXSET);
Gabe Black8128a562013-09-18 05:48:37 -070038 }
39 }
40}