diff options
author | Biju Das <biju.das.jz@bp.renesas.com> | 2021-03-17 17:11:50 +0300 |
---|---|---|
committer | Marek Vasut <marek.vasut+renesas@gmail.com> | 2021-04-14 00:36:25 +0300 |
commit | 3e5f3dbe3a8556503afc0020db5dd6f6ae62fef9 (patch) | |
tree | e253220878ba4c9f8edcef0cf1a2267f78bd3ab0 /arch/arm/mach-rmobile/cpu_info-rzg.c | |
parent | a94ab561e2f49a80d8579930e840b810ab1a1330 (diff) | |
download | u-boot-3e5f3dbe3a8556503afc0020db5dd6f6ae62fef9.tar.xz |
arm: mach-rmobile: Add CPU info support for RZ/G2
Add CPU info support for RZ/G2 SoC's.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Diffstat (limited to 'arch/arm/mach-rmobile/cpu_info-rzg.c')
-rw-r--r-- | arch/arm/mach-rmobile/cpu_info-rzg.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/arch/arm/mach-rmobile/cpu_info-rzg.c b/arch/arm/mach-rmobile/cpu_info-rzg.c new file mode 100644 index 0000000000..1c18fd06f0 --- /dev/null +++ b/arch/arm/mach-rmobile/cpu_info-rzg.c @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2021 Renesas Electronics Corporation + * + */ +#include <common.h> +#include <linux/libfdt.h> + +/* If the firmware passed a device tree, use it for soc identification. */ +extern u64 rcar_atf_boot_args[]; + +/* CPU information table */ +static const struct { + char *soc_name; + u8 cpu_name[10]; +} tfa_info[] = { + { "renesas,r8a774a1", "R8A774A1" }, + { "renesas,r8a774b1", "R8A774B1" }, + { "renesas,r8a774c0", "R8A774C0" }, + { "renesas,r8a774e1", "R8A774E1" } +}; + +const u8 *rzg_get_cpu_name(void) +{ + void *atf_fdt_blob = (void *)(rcar_atf_boot_args[1]); + bool ret = false; + int i; + + if (fdt_magic(atf_fdt_blob) != FDT_MAGIC) + return NULL; + + for (i = 0; i < ARRAY_SIZE(tfa_info); i++) { + if (fdt_node_check_compatible(atf_fdt_blob, 0, + tfa_info[i].soc_name) == 0) { + ret = true; + break; + } + } + + return ret ? tfa_info[i].cpu_name : NULL; +} |