xref: /openbmc/u-boot/arch/arm/mach-rmobile/cpu_info.c (revision d024236e5a31a2b4b82cbcc98b31b8170fc88d28)
1 /*
2  * (C) Copyright 2012 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
3  * (C) Copyright 2012 Renesas Solutions Corp.
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 #include <common.h>
8 #include <asm/io.h>
9 
10 #ifdef CONFIG_ARCH_CPU_INIT
11 int arch_cpu_init(void)
12 {
13 	icache_enable();
14 	return 0;
15 }
16 #endif
17 
18 #ifndef CONFIG_SYS_DCACHE_OFF
19 void enable_caches(void)
20 {
21 	dcache_enable();
22 }
23 #endif
24 
25 #ifdef CONFIG_DISPLAY_CPUINFO
26 static u32 __rmobile_get_cpu_type(void)
27 {
28 	return 0x0;
29 }
30 u32 rmobile_get_cpu_type(void)
31 		__attribute__((weak, alias("__rmobile_get_cpu_type")));
32 
33 static u32 __rmobile_get_cpu_rev_integer(void)
34 {
35 	return 0;
36 }
37 u32 rmobile_get_cpu_rev_integer(void)
38 		__attribute__((weak, alias("__rmobile_get_cpu_rev_integer")));
39 
40 static u32 __rmobile_get_cpu_rev_fraction(void)
41 {
42 	return 0;
43 }
44 u32 rmobile_get_cpu_rev_fraction(void)
45 		__attribute__((weak, alias("__rmobile_get_cpu_rev_fraction")));
46 
47 /* CPU infomation table */
48 static const struct {
49 	u16 cpu_type;
50 	u8 cpu_name[10];
51 } rmobile_cpuinfo[] = {
52 	{ RMOBILE_CPU_TYPE_SH73A0, "SH73A0" },
53 	{ RMOBILE_CPU_TYPE_R8A7740, "R8A7740" },
54 	{ RMOBILE_CPU_TYPE_R8A7790, "R8A7790" },
55 	{ RMOBILE_CPU_TYPE_R8A7791, "R8A7791" },
56 	{ RMOBILE_CPU_TYPE_R8A7792, "R8A7792" },
57 	{ RMOBILE_CPU_TYPE_R8A7793, "R8A7793" },
58 	{ RMOBILE_CPU_TYPE_R8A7794, "R8A7794" },
59 	{ RMOBILE_CPU_TYPE_R8A7795, "R8A7795" },
60 	{ RMOBILE_CPU_TYPE_R8A7796, "R8A7796" },
61 	{ RMOBILE_CPU_TYPE_R8A77965, "R8A77965" },
62 	{ RMOBILE_CPU_TYPE_R8A77970, "R8A77970" },
63 	{ RMOBILE_CPU_TYPE_R8A77995, "R8A77995" },
64 	{ 0x0, "CPU" },
65 };
66 
67 int print_cpuinfo(void)
68 {
69 	int i = 0;
70 	u32 cpu_type = rmobile_get_cpu_type();
71 	for (; i < ARRAY_SIZE(rmobile_cpuinfo); i++) {
72 		if (rmobile_cpuinfo[i].cpu_type == cpu_type) {
73 			printf("CPU: Renesas Electronics %s rev %d.%d\n",
74 			       rmobile_cpuinfo[i].cpu_name,
75 			       rmobile_get_cpu_rev_integer(),
76 			       rmobile_get_cpu_rev_fraction());
77 			break;
78 		}
79 	}
80 	return 0;
81 }
82 #endif /* CONFIG_DISPLAY_CPUINFO */
83