blob: 73201a8c69e5f33ffb081e378831ea106754932d [file] [log] [blame]
Paul Barker60a0b942023-10-16 10:25:43 +01001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * RZ/G2L board support.
4 * Copyright (C) 2023 Renesas Electronics Corporation
5 */
6
Paul Barker60a0b942023-10-16 10:25:43 +01007#include <fdtdec.h>
8#include <linux/libfdt.h>
9
10#if IS_ENABLED(CONFIG_MULTI_DTB_FIT)
11/* If the firmware passed a device tree, use it for board identification. */
12extern u64 rcar_atf_boot_args[];
13
14static bool is_rzg2l_board(const char *board_name)
15{
16 void *atf_fdt_blob = (void *)(rcar_atf_boot_args[1]);
17
18 return fdt_node_check_compatible(atf_fdt_blob, 0, board_name) == 0;
19}
20
21int board_fit_config_name_match(const char *name)
22{
23 void *atf_fdt_blob = (void *)(rcar_atf_boot_args[1]);
24
25 if (fdt_magic(atf_fdt_blob) != FDT_MAGIC)
26 return -1;
27
28 if (is_rzg2l_board("renesas,r9a07g044l2"))
29 return strcmp(name, "r9a07g044l2-smarc");
30
31 return -1;
32}
33#endif
34
35static void apply_atf_overlay(void *fdt_blob)
36{
37 void *atf_fdt_blob = (void *)(rcar_atf_boot_args[1]);
38
39 if (fdt_magic(atf_fdt_blob) == FDT_MAGIC)
40 fdt_overlay_apply_node(fdt_blob, 0, atf_fdt_blob, 0);
41}
42
43int fdtdec_board_setup(const void *fdt_blob)
44{
45 apply_atf_overlay((void *)fdt_blob);
46
47 return 0;
48}
49
50int ft_board_setup(void *blob, struct bd_info *bd)
51{
52 return 0;
53}
54
55int board_init(void)
56{
57 return 0;
58}
59
60void reset_cpu(void)
61{
62 /*
63 * TODO: Implement reset support once TrustedFirmware supports
64 * the appropriate call.
65 */
66}