1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * Lowlevel setup for SMDK5250 board based on S5PC520 4 * 5 * Copyright (C) 2012 Samsung Electronics 6 */ 7 8 #include <common.h> 9 #include <asm/arch/tzpc.h> 10 #include <asm/io.h> 11 12 /* Setting TZPC[TrustZone Protection Controller] */ 13 void tzpc_init(void) 14 { 15 struct exynos_tzpc *tzpc; 16 unsigned int addr, start = 0, end = 0; 17 18 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) { 26 tzpc = (struct exynos_tzpc *)addr; 27 28 if (addr == start) 29 writel(R0SIZE, &tzpc->r0size); 30 31 writel(DECPROTXSET, &tzpc->decprot0set); 32 writel(DECPROTXSET, &tzpc->decprot1set); 33 34 if (cpu_is_exynos5() && (addr == end)) 35 break; 36 37 writel(DECPROTXSET, &tzpc->decprot2set); 38 writel(DECPROTXSET, &tzpc->decprot3set); 39 } 40 } 41