fdt.c 1004 B

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