blob: e110737471bb391eb6255a4b2dd2768bd093c2fa [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Nobuhiro Iwamatsuf3db9da2012-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 Iwamatsuf3db9da2012-06-13 16:29:47 +09005 */
6#include <common.h>
7#include <asm/io.h>
Nobuhiro Iwamatsuf3db9da2012-06-13 16:29:47 +09008
9#ifdef CONFIG_ARCH_CPU_INIT
10int arch_cpu_init(void)
11{
12 icache_enable();
13 return 0;
14}
15#endif
16
17#ifndef CONFIG_SYS_DCACHE_OFF
18void enable_caches(void)
19{
20 dcache_enable();
21}
22#endif
23
24#ifdef CONFIG_DISPLAY_CPUINFO
Nobuhiro Iwamatsu940103d2012-08-19 04:40:05 +000025static u32 __rmobile_get_cpu_type(void)
Nobuhiro Iwamatsuf3db9da2012-06-13 16:29:47 +090026{
Nobuhiro Iwamatsu940103d2012-08-19 04:40:05 +000027 return 0x0;
Nobuhiro Iwamatsuf3db9da2012-06-13 16:29:47 +090028}
Nobuhiro Iwamatsu940103d2012-08-19 04:40:05 +000029u32 rmobile_get_cpu_type(void)
30 __attribute__((weak, alias("__rmobile_get_cpu_type")));
Nobuhiro Iwamatsuf3db9da2012-06-13 16:29:47 +090031
Tetsuyuki Kobayashi7811e542012-07-25 18:24:21 +000032static u32 __rmobile_get_cpu_rev_integer(void)
Nobuhiro Iwamatsuf3db9da2012-06-13 16:29:47 +090033{
Nobuhiro Iwamatsu940103d2012-08-19 04:40:05 +000034 return 0;
Nobuhiro Iwamatsuf3db9da2012-06-13 16:29:47 +090035}
Tetsuyuki Kobayashi7811e542012-07-25 18:24:21 +000036u32 rmobile_get_cpu_rev_integer(void)
37 __attribute__((weak, alias("__rmobile_get_cpu_rev_integer")));
38
39static u32 __rmobile_get_cpu_rev_fraction(void)
40{
41 return 0;
42}
43u32 rmobile_get_cpu_rev_fraction(void)
44 __attribute__((weak, alias("__rmobile_get_cpu_rev_fraction")));
Nobuhiro Iwamatsuf3db9da2012-06-13 16:29:47 +090045
Nobuhiro Iwamatsu524ed8b2014-03-28 11:54:22 +090046/* CPU infomation table */
47static const struct {
48 u16 cpu_type;
49 u8 cpu_name[10];
50} rmobile_cpuinfo[] = {
Marek Vasutb8f814b2017-11-25 23:54:10 +010051 { RMOBILE_CPU_TYPE_SH73A0, "SH73A0" },
52 { RMOBILE_CPU_TYPE_R8A7740, "R8A7740" },
53 { RMOBILE_CPU_TYPE_R8A7790, "R8A7790" },
54 { RMOBILE_CPU_TYPE_R8A7791, "R8A7791" },
55 { RMOBILE_CPU_TYPE_R8A7792, "R8A7792" },
56 { RMOBILE_CPU_TYPE_R8A7793, "R8A7793" },
57 { RMOBILE_CPU_TYPE_R8A7794, "R8A7794" },
58 { RMOBILE_CPU_TYPE_R8A7795, "R8A7795" },
59 { RMOBILE_CPU_TYPE_R8A7796, "R8A7796" },
Marek Vasut1ecc0bd2018-02-26 10:35:15 +010060 { RMOBILE_CPU_TYPE_R8A77965, "R8A77965" },
Marek Vasut46175fc2017-10-09 20:39:47 +020061 { RMOBILE_CPU_TYPE_R8A77970, "R8A77970" },
Marek Vasut001dbf32018-04-26 10:09:06 +020062 { RMOBILE_CPU_TYPE_R8A77990, "R8A77990" },
Marek Vasut04cd2e22017-10-08 20:52:52 +020063 { RMOBILE_CPU_TYPE_R8A77995, "R8A77995" },
Nobuhiro Iwamatsu524ed8b2014-03-28 11:54:22 +090064 { 0x0, "CPU" },
65};
66
Nobuhiro Iwamatsuf3db9da2012-06-13 16:29:47 +090067int print_cpuinfo(void)
68{
Nobuhiro Iwamatsu524ed8b2014-03-28 11:54:22 +090069 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 }
Nobuhiro Iwamatsuf3db9da2012-06-13 16:29:47 +090079 }
80 return 0;
81}
Nobuhiro Iwamatsu940103d2012-08-19 04:40:05 +000082#endif /* CONFIG_DISPLAY_CPUINFO */