Andrew Davis | e819fab | 2024-02-14 10:30:08 -0600 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 2 | /* |
| 3 | * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/ |
| 4 | */ |
| 5 | |
| 6 | #include <asm/hardware.h> |
Tom Rini | a9705f0 | 2024-06-03 18:42:11 -0600 | [diff] [blame] | 7 | #include "../common_fdt.h" |
Andrew Davis | e819fab | 2024-02-14 10:30:08 -0600 | [diff] [blame] | 8 | #include <fdt_support.h> |
| 9 | |
Aparna Patra | 3beefff | 2025-01-08 10:19:36 +0530 | [diff] [blame^] | 10 | static void fdt_fixup_cores_wdt_nodes_am62p(void *blob, int core_nr) |
| 11 | { |
| 12 | char node_path[32]; |
| 13 | |
| 14 | if (core_nr < 1) |
| 15 | return; |
| 16 | |
| 17 | for (; core_nr < 4; core_nr++) { |
| 18 | snprintf(node_path, sizeof(node_path), "/cpus/cpu@%d", core_nr); |
| 19 | fdt_del_node_path(blob, node_path); |
| 20 | snprintf(node_path, sizeof(node_path), "/cpus/cpu-map/cluster0/core%d", core_nr); |
| 21 | fdt_del_node_path(blob, node_path); |
| 22 | snprintf(node_path, sizeof(node_path), "/bus@f0000/watchdog@e0%d0000", core_nr); |
| 23 | fdt_del_node_path(blob, node_path); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | static void fdt_fixup_video_codec_nodes_am62p(void *blob, bool has_video_codec) |
| 28 | { |
| 29 | if (!has_video_codec) |
| 30 | fdt_del_node_path(blob, "/bus@f0000/video-codec@30210000"); |
| 31 | } |
| 32 | |
| 33 | static void fdt_fixup_canfd_nodes_am62p(void *blob, bool has_canfd) |
| 34 | { |
| 35 | if (!has_canfd) { |
| 36 | fdt_del_node_path(blob, "/bus@f0000/can@20701000"); |
| 37 | fdt_del_node_path(blob, "/bus@f0000/can@20711000"); |
| 38 | } |
| 39 | } |
| 40 | |
Andrew Davis | e819fab | 2024-02-14 10:30:08 -0600 | [diff] [blame] | 41 | int ft_system_setup(void *blob, struct bd_info *bd) |
| 42 | { |
Aparna Patra | 3beefff | 2025-01-08 10:19:36 +0530 | [diff] [blame^] | 43 | fdt_fixup_cores_wdt_nodes_am62p(blob, k3_get_core_nr()); |
| 44 | fdt_fixup_video_codec_nodes_am62p(blob, k3_has_video_codec()); |
| 45 | fdt_fixup_canfd_nodes_am62p(blob, k3_has_canfd()); |
Andrew Davis | e819fab | 2024-02-14 10:30:08 -0600 | [diff] [blame] | 46 | fdt_fixup_reserved(blob, "tfa", CONFIG_K3_ATF_LOAD_ADDR, 0x80000); |
| 47 | fdt_fixup_reserved(blob, "optee", CONFIG_K3_OPTEE_LOAD_ADDR, 0x1800000); |
| 48 | |
| 49 | return 0; |
| 50 | } |