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