1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2021,2023 Renesas Electronics Corporation
7 #include <mach/renesas.h>
9 #include <linux/libfdt.h>
11 #define SYSC_LSI_DEVID 0x11020A04
13 /* If the firmware passed a device tree, use it for soc identification. */
14 extern u64 rcar_atf_boot_args[];
16 /* CPU information table */
23 static const struct tfa_info tfa_info[] = {
24 { "renesas,r9a07g044l2", "R9A07G044L", RENESAS_CPU_TYPE_R9A07G044L },
27 static const struct tfa_info invalid_tfa_info = { NULL, "(invalid)", 0 };
29 static const struct tfa_info *get_tfa_info(void)
31 void *atf_fdt_blob = (void *)(rcar_atf_boot_args[1]);
33 if (fdt_magic(atf_fdt_blob) == FDT_MAGIC) {
35 for (i = 0; i < ARRAY_SIZE(tfa_info); i++) {
36 if (!fdt_node_check_compatible(atf_fdt_blob, 0,
37 tfa_info[i].soc_name))
42 return &invalid_tfa_info;
45 const u8 *rzg_get_cpu_name(void)
47 return get_tfa_info()->cpu_name;
50 u32 renesas_get_cpu_type(void)
52 return get_tfa_info()->cpu_type;
55 u32 renesas_get_cpu_rev_integer(void)
57 return (readl(SYSC_LSI_DEVID) >> 28) + 1;
60 u32 renesas_get_cpu_rev_fraction(void)