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