fdt.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright 2017 Texas Instruments, Inc.
  4. */
  5. #include <common.h>
  6. #include <hang.h>
  7. #include <linux/libfdt.h>
  8. #include <fdt_support.h>
  9. #include <malloc.h>
  10. #include <asm/omap_common.h>
  11. #include <asm/arch-am33xx/sys_proto.h>
  12. #ifdef CONFIG_TI_SECURE_DEVICE
  13. static void ft_hs_fixups(void *fdt, struct bd_info *bd)
  14. {
  15. /* Check we are running on an HS/EMU device type */
  16. if (GP_DEVICE != get_device_type()) {
  17. if ((ft_hs_disable_rng(fdt, bd) == 0) &&
  18. (ft_hs_fixup_dram(fdt, bd) == 0) &&
  19. (ft_hs_add_tee(fdt, bd) == 0))
  20. return;
  21. } else {
  22. printf("ERROR: Incorrect device type (GP) detected!");
  23. }
  24. /* Fixup failed or wrong device type */
  25. hang();
  26. }
  27. #else
  28. static void ft_hs_fixups(void *fdt, struct bd_info *bd) { }
  29. #endif /* #ifdef CONFIG_TI_SECURE_DEVICE */
  30. /*
  31. * Place for general cpu/SoC FDT fixups. Board specific
  32. * fixups should remain in the board files which is where
  33. * this function should be called from.
  34. */
  35. void ft_cpu_setup(void *fdt, struct bd_info *bd)
  36. {
  37. ft_hs_fixups(fdt, bd);
  38. }