blob: 970dd3447dec4b2d2c6d33551ec99e9427d5c574 [file] [log] [blame]
Emanuele Ghidolid7e0b072023-07-14 17:23:10 +02001// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright 2023 Toradex - https://www.toradex.com/
4 */
5
6#include <asm/hardware.h>
7#include "common_fdt.h"
8#include <fdt_support.h>
9
10static void fdt_fixup_cores_nodes_am625(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
27static void fdt_fixup_gpu_nodes_am625(void *blob, int has_gpu)
28{
29 if (!has_gpu) {
30 fdt_del_node_path(blob, "/bus@f0000/gpu@fd00000");
31 fdt_del_node_path(blob, "/bus@f0000/watchdog@e0f0000");
32 }
33}
34
35static void fdt_fixup_pru_node_am625(void *blob, int has_pru)
36{
37 if (!has_pru)
38 fdt_del_node_path(blob, "/bus@f0000/pruss@30040000");
39}
40
Emanuele Ghidolid7e0b072023-07-14 17:23:10 +020041int ft_system_setup(void *blob, struct bd_info *bd)
42{
43 fdt_fixup_cores_nodes_am625(blob, k3_get_core_nr());
44 fdt_fixup_gpu_nodes_am625(blob, k3_has_gpu());
45 fdt_fixup_pru_node_am625(blob, k3_has_pru());
46
47 return 0;
48}