blob: c9ebc9f40ed642be9d47e51944ff701bad04bf45 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +09002/*
3 * (C) Copyright 2012 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
4 * (C) Copyright 2012 Renesas Solutions Corp.
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +09005 */
6#include <common.h>
7#include <asm/io.h>
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +09008
Marek Vasute5cb6bd2018-10-31 15:06:50 +01009/* R-Car Gen3 caches are enabled in memmap-gen3.c */
10#ifndef CONFIG_RCAR_GEN3
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090011#ifdef CONFIG_ARCH_CPU_INIT
12int arch_cpu_init(void)
13{
14 icache_enable();
15 return 0;
16}
17#endif
18
19#ifndef CONFIG_SYS_DCACHE_OFF
20void enable_caches(void)
21{
22 dcache_enable();
23}
24#endif
Marek Vasute5cb6bd2018-10-31 15:06:50 +010025#endif
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090026
27#ifdef CONFIG_DISPLAY_CPUINFO
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000028static u32 __rmobile_get_cpu_type(void)
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090029{
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000030 return 0x0;
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090031}
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000032u32 rmobile_get_cpu_type(void)
33 __attribute__((weak, alias("__rmobile_get_cpu_type")));
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090034
Tetsuyuki Kobayashi4f007b82012-07-25 18:24:21 +000035static u32 __rmobile_get_cpu_rev_integer(void)
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090036{
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000037 return 0;
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090038}
Tetsuyuki Kobayashi4f007b82012-07-25 18:24:21 +000039u32 rmobile_get_cpu_rev_integer(void)
40 __attribute__((weak, alias("__rmobile_get_cpu_rev_integer")));
41
42static u32 __rmobile_get_cpu_rev_fraction(void)
43{
44 return 0;
45}
46u32 rmobile_get_cpu_rev_fraction(void)
47 __attribute__((weak, alias("__rmobile_get_cpu_rev_fraction")));
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090048
Nobuhiro Iwamatsu73ff6802014-03-28 11:54:22 +090049/* CPU infomation table */
50static const struct {
51 u16 cpu_type;
52 u8 cpu_name[10];
53} rmobile_cpuinfo[] = {
Marek Vasut262e9152017-11-25 23:54:10 +010054 { RMOBILE_CPU_TYPE_SH73A0, "SH73A0" },
55 { RMOBILE_CPU_TYPE_R8A7740, "R8A7740" },
56 { RMOBILE_CPU_TYPE_R8A7790, "R8A7790" },
57 { RMOBILE_CPU_TYPE_R8A7791, "R8A7791" },
58 { RMOBILE_CPU_TYPE_R8A7792, "R8A7792" },
59 { RMOBILE_CPU_TYPE_R8A7793, "R8A7793" },
60 { RMOBILE_CPU_TYPE_R8A7794, "R8A7794" },
61 { RMOBILE_CPU_TYPE_R8A7795, "R8A7795" },
62 { RMOBILE_CPU_TYPE_R8A7796, "R8A7796" },
Marek Vasutf295a562018-02-26 10:35:15 +010063 { RMOBILE_CPU_TYPE_R8A77965, "R8A77965" },
Marek Vasut5cb19e72017-10-09 20:39:47 +020064 { RMOBILE_CPU_TYPE_R8A77970, "R8A77970" },
Marek Vasuta0410a62018-04-26 10:09:06 +020065 { RMOBILE_CPU_TYPE_R8A77990, "R8A77990" },
Marek Vasut11545412017-10-08 20:52:52 +020066 { RMOBILE_CPU_TYPE_R8A77995, "R8A77995" },
Nobuhiro Iwamatsu73ff6802014-03-28 11:54:22 +090067 { 0x0, "CPU" },
68};
69
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090070int print_cpuinfo(void)
71{
Nobuhiro Iwamatsu73ff6802014-03-28 11:54:22 +090072 int i = 0;
73 u32 cpu_type = rmobile_get_cpu_type();
74 for (; i < ARRAY_SIZE(rmobile_cpuinfo); i++) {
75 if (rmobile_cpuinfo[i].cpu_type == cpu_type) {
76 printf("CPU: Renesas Electronics %s rev %d.%d\n",
77 rmobile_cpuinfo[i].cpu_name,
78 rmobile_get_cpu_rev_integer(),
79 rmobile_get_cpu_rev_fraction());
80 break;
81 }
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090082 }
83 return 0;
84}
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000085#endif /* CONFIG_DISPLAY_CPUINFO */