1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2012 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
4 * (C) Copyright 2012 Renesas Solutions Corp.
10 #include <linux/ctype.h>
12 #ifdef CONFIG_ARCH_CPU_INIT
13 int arch_cpu_init(void)
20 /* R-Car Gen3 D-cache is enabled in memmap-gen3.c */
21 #ifndef CONFIG_RCAR_GEN3
22 #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
23 void enable_caches(void)
30 #ifdef CONFIG_DISPLAY_CPUINFO
32 static u32 __rmobile_get_cpu_type(void)
36 u32 rmobile_get_cpu_type(void)
37 __attribute__((weak, alias("__rmobile_get_cpu_type")));
39 static u32 __rmobile_get_cpu_rev_integer(void)
43 u32 rmobile_get_cpu_rev_integer(void)
44 __attribute__((weak, alias("__rmobile_get_cpu_rev_integer")));
46 static u32 __rmobile_get_cpu_rev_fraction(void)
50 u32 rmobile_get_cpu_rev_fraction(void)
51 __attribute__((weak, alias("__rmobile_get_cpu_rev_fraction")));
53 /* CPU infomation table */
57 } rmobile_cpuinfo[] = {
58 { RMOBILE_CPU_TYPE_SH73A0, "SH73A0" },
59 { RMOBILE_CPU_TYPE_R8A7740, "R8A7740" },
60 { RMOBILE_CPU_TYPE_R8A7790, "R8A7790" },
61 { RMOBILE_CPU_TYPE_R8A7791, "R8A7791" },
62 { RMOBILE_CPU_TYPE_R8A7792, "R8A7792" },
63 { RMOBILE_CPU_TYPE_R8A7793, "R8A7793" },
64 { RMOBILE_CPU_TYPE_R8A7794, "R8A7794" },
65 { RMOBILE_CPU_TYPE_R8A7795, "R8A7795" },
66 { RMOBILE_CPU_TYPE_R8A7796, "R8A7796" },
67 { RMOBILE_CPU_TYPE_R8A77965, "R8A77965" },
68 { RMOBILE_CPU_TYPE_R8A77970, "R8A77970" },
69 { RMOBILE_CPU_TYPE_R8A77980, "R8A77980" },
70 { RMOBILE_CPU_TYPE_R8A77990, "R8A77990" },
71 { RMOBILE_CPU_TYPE_R8A77995, "R8A77995" },
75 static int rmobile_cpuinfo_idx(void)
78 u32 cpu_type = rmobile_get_cpu_type();
80 for (; i < ARRAY_SIZE(rmobile_cpuinfo); i++)
81 if (rmobile_cpuinfo[i].cpu_type == cpu_type)
87 #ifdef CONFIG_ARCH_MISC_INIT
88 int arch_misc_init(void)
90 int i, idx = rmobile_cpuinfo_idx();
93 for (i = 0; i < sizeof(cpu); i++)
94 cpu[i] = tolower(rmobile_cpuinfo[idx].cpu_name[i]);
96 env_set("platform", cpu);
102 int print_cpuinfo(void)
104 int i = rmobile_cpuinfo_idx();
106 printf("CPU: Renesas Electronics %s rev %d.%d\n",
107 rmobile_cpuinfo[i].cpu_name, rmobile_get_cpu_rev_integer(),
108 rmobile_get_cpu_rev_fraction());
113 int print_cpuinfo(void)
115 printf("CPU: Renesas Electronics RZ/A1\n");
119 #endif /* CONFIG_DISPLAY_CPUINFO */