tzpc.c 962 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Lowlevel setup for SMDK5250 board based on S5PC520
  3. *
  4. * Copyright (C) 2012 Samsung Electronics
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. */
  8. #include <common.h>
  9. #include <asm/arch/tzpc.h>
  10. #include <asm/io.h>
  11. /* Setting TZPC[TrustZone Protection Controller] */
  12. void tzpc_init(void)
  13. {
  14. struct exynos_tzpc *tzpc;
  15. unsigned int addr, start = 0, end = 0;
  16. start = samsung_get_base_tzpc();
  17. if (cpu_is_exynos5())
  18. end = start + ((EXYNOS5_NR_TZPC_BANKS - 1) * TZPC_BASE_OFFSET);
  19. else if (cpu_is_exynos4())
  20. end = start + ((EXYNOS4_NR_TZPC_BANKS - 1) * TZPC_BASE_OFFSET);
  21. for (addr = start; addr <= end; addr += TZPC_BASE_OFFSET) {
  22. tzpc = (struct exynos_tzpc *)addr;
  23. if (addr == start)
  24. writel(R0SIZE, &tzpc->r0size);
  25. writel(DECPROTXSET, &tzpc->decprot0set);
  26. writel(DECPROTXSET, &tzpc->decprot1set);
  27. if (cpu_is_exynos5() && (addr == end))
  28. break;
  29. writel(DECPROTXSET, &tzpc->decprot2set);
  30. writel(DECPROTXSET, &tzpc->decprot3set);
  31. }
  32. }