blob: ba87d21b738558eb32d95bcdcef2a7f9680ea047 [file] [log] [blame]
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +09001/*
2 * (C) Copyright 2012 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
3 * (C) Copyright 2012 Renesas Solutions Corp.
4 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +09006 */
7#include <common.h>
8#include <asm/io.h>
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +09009
10#ifdef CONFIG_ARCH_CPU_INIT
11int arch_cpu_init(void)
12{
13 icache_enable();
14 return 0;
15}
16#endif
17
18#ifndef CONFIG_SYS_DCACHE_OFF
19void enable_caches(void)
20{
Marek Vasuta523af62017-11-25 23:24:01 +010021#if defined(CONFIG_RCAR_GEN3)
22 rcar_gen3_memmap_fixup();
23#endif
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090024 dcache_enable();
25}
26#endif
27
28#ifdef CONFIG_DISPLAY_CPUINFO
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000029static u32 __rmobile_get_cpu_type(void)
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090030{
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000031 return 0x0;
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090032}
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000033u32 rmobile_get_cpu_type(void)
34 __attribute__((weak, alias("__rmobile_get_cpu_type")));
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090035
Tetsuyuki Kobayashi4f007b82012-07-25 18:24:21 +000036static u32 __rmobile_get_cpu_rev_integer(void)
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090037{
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000038 return 0;
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090039}
Tetsuyuki Kobayashi4f007b82012-07-25 18:24:21 +000040u32 rmobile_get_cpu_rev_integer(void)
41 __attribute__((weak, alias("__rmobile_get_cpu_rev_integer")));
42
43static u32 __rmobile_get_cpu_rev_fraction(void)
44{
45 return 0;
46}
47u32 rmobile_get_cpu_rev_fraction(void)
48 __attribute__((weak, alias("__rmobile_get_cpu_rev_fraction")));
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090049
Nobuhiro Iwamatsu73ff6802014-03-28 11:54:22 +090050/* CPU infomation table */
51static const struct {
52 u16 cpu_type;
53 u8 cpu_name[10];
54} rmobile_cpuinfo[] = {
Marek Vasut262e9152017-11-25 23:54:10 +010055 { RMOBILE_CPU_TYPE_SH73A0, "SH73A0" },
56 { RMOBILE_CPU_TYPE_R8A7740, "R8A7740" },
57 { RMOBILE_CPU_TYPE_R8A7790, "R8A7790" },
58 { RMOBILE_CPU_TYPE_R8A7791, "R8A7791" },
59 { RMOBILE_CPU_TYPE_R8A7792, "R8A7792" },
60 { RMOBILE_CPU_TYPE_R8A7793, "R8A7793" },
61 { RMOBILE_CPU_TYPE_R8A7794, "R8A7794" },
62 { RMOBILE_CPU_TYPE_R8A7795, "R8A7795" },
63 { RMOBILE_CPU_TYPE_R8A7796, "R8A7796" },
Marek Vasutf295a562018-02-26 10:35:15 +010064 { RMOBILE_CPU_TYPE_R8A77965, "R8A77965" },
Marek Vasut5cb19e72017-10-09 20:39:47 +020065 { RMOBILE_CPU_TYPE_R8A77970, "R8A77970" },
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 */