tzpc.c 959 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. #include <common.h>
  8. #include <asm/arch/tzpc.h>
  9. #include <asm/io.h>
  10. /* Setting TZPC[TrustZone Protection Controller] */
  11. void tzpc_init(void)
  12. {
  13. struct exynos_tzpc *tzpc;
  14. unsigned int addr, start = 0, end = 0;
  15. start = samsung_get_base_tzpc();
  16. if (cpu_is_exynos5())
  17. end = start + ((EXYNOS5_NR_TZPC_BANKS - 1) * TZPC_BASE_OFFSET);
  18. else if (cpu_is_exynos4())
  19. end = start + ((EXYNOS4_NR_TZPC_BANKS - 1) * TZPC_BASE_OFFSET);
  20. for (addr = start; addr <= end; addr += TZPC_BASE_OFFSET) {
  21. tzpc = (struct exynos_tzpc *)addr;
  22. if (addr == start)
  23. writel(R0SIZE, &tzpc->r0size);
  24. writel(DECPROTXSET, &tzpc->decprot0set);
  25. writel(DECPROTXSET, &tzpc->decprot1set);
  26. if (cpu_is_exynos5() && (addr == end))
  27. break;
  28. writel(DECPROTXSET, &tzpc->decprot2set);
  29. writel(DECPROTXSET, &tzpc->decprot3set);
  30. }
  31. }