Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Andrew F. Davis | ddf0134 | 2017-07-10 14:45:52 -0500 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 2017 Texas Instruments, Inc. |
Andrew F. Davis | ddf0134 | 2017-07-10 14:45:52 -0500 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <common.h> |
Simon Glass | db41d65 | 2019-12-28 10:45:07 -0700 | [diff] [blame] | 7 | #include <hang.h> |
Masahiro Yamada | b08c8c4 | 2018-03-05 01:20:11 +0900 | [diff] [blame] | 8 | #include <linux/libfdt.h> |
Andrew F. Davis | ddf0134 | 2017-07-10 14:45:52 -0500 | [diff] [blame] | 9 | #include <fdt_support.h> |
| 10 | #include <malloc.h> |
| 11 | |
| 12 | #include <asm/omap_common.h> |
| 13 | #include <asm/arch-am33xx/sys_proto.h> |
| 14 | |
| 15 | #ifdef CONFIG_TI_SECURE_DEVICE |
| 16 | |
| 17 | static void ft_hs_fixups(void *fdt, bd_t *bd) |
| 18 | { |
| 19 | /* Check we are running on an HS/EMU device type */ |
| 20 | if (GP_DEVICE != get_device_type()) { |
| 21 | if ((ft_hs_disable_rng(fdt, bd) == 0) && |
| 22 | (ft_hs_fixup_dram(fdt, bd) == 0) && |
| 23 | (ft_hs_add_tee(fdt, bd) == 0)) |
| 24 | return; |
| 25 | } else { |
| 26 | printf("ERROR: Incorrect device type (GP) detected!"); |
| 27 | } |
| 28 | /* Fixup failed or wrong device type */ |
| 29 | hang(); |
| 30 | } |
| 31 | #else |
| 32 | static void ft_hs_fixups(void *fdt, bd_t *bd) { } |
| 33 | #endif /* #ifdef CONFIG_TI_SECURE_DEVICE */ |
| 34 | |
| 35 | /* |
| 36 | * Place for general cpu/SoC FDT fixups. Board specific |
| 37 | * fixups should remain in the board files which is where |
| 38 | * this function should be called from. |
| 39 | */ |
| 40 | void ft_cpu_setup(void *fdt, bd_t *bd) |
| 41 | { |
| 42 | ft_hs_fixups(fdt, bd); |
| 43 | } |