blob: faa53197d5b0de7730ad55a20857d1777e2c0077 [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{
21 dcache_enable();
22}
23#endif
24
25#ifdef CONFIG_DISPLAY_CPUINFO
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000026static u32 __rmobile_get_cpu_type(void)
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090027{
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000028 return 0x0;
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090029}
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000030u32 rmobile_get_cpu_type(void)
31 __attribute__((weak, alias("__rmobile_get_cpu_type")));
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090032
Tetsuyuki Kobayashi4f007b82012-07-25 18:24:21 +000033static u32 __rmobile_get_cpu_rev_integer(void)
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090034{
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000035 return 0;
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090036}
Tetsuyuki Kobayashi4f007b82012-07-25 18:24:21 +000037u32 rmobile_get_cpu_rev_integer(void)
38 __attribute__((weak, alias("__rmobile_get_cpu_rev_integer")));
39
40static u32 __rmobile_get_cpu_rev_fraction(void)
41{
42 return 0;
43}
44u32 rmobile_get_cpu_rev_fraction(void)
45 __attribute__((weak, alias("__rmobile_get_cpu_rev_fraction")));
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090046
Nobuhiro Iwamatsu73ff6802014-03-28 11:54:22 +090047/* CPU infomation table */
48static const struct {
49 u16 cpu_type;
50 u8 cpu_name[10];
51} rmobile_cpuinfo[] = {
52 { 0x37, "SH73A0" },
53 { 0x40, "R8A7740" },
54 { 0x45, "R8A7790" },
55 { 0x47, "R8A7791" },
masakazu.mochizuki.wd@hitachi.com6f107e42016-04-12 17:11:41 +090056 { 0x4A, "R8A7792" },
Nobuhiro Iwamatsu062edd22014-11-05 06:50:06 +090057 { 0x4B, "R8A7793" },
Nobuhiro Iwamatsufafcfc52014-06-24 17:10:02 +090058 { 0x4C, "R8A7794" },
Marek Vasut3a38c7d2017-05-13 15:57:36 +020059 { 0x4F, "R8A7795" },
Marek Vasutbc271a02017-05-13 15:57:37 +020060 { 0x52, "R8A7796" },
Nobuhiro Iwamatsu73ff6802014-03-28 11:54:22 +090061 { 0x0, "CPU" },
62};
63
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090064int print_cpuinfo(void)
65{
Nobuhiro Iwamatsu73ff6802014-03-28 11:54:22 +090066 int i = 0;
67 u32 cpu_type = rmobile_get_cpu_type();
68 for (; i < ARRAY_SIZE(rmobile_cpuinfo); i++) {
69 if (rmobile_cpuinfo[i].cpu_type == cpu_type) {
70 printf("CPU: Renesas Electronics %s rev %d.%d\n",
71 rmobile_cpuinfo[i].cpu_name,
72 rmobile_get_cpu_rev_integer(),
73 rmobile_get_cpu_rev_fraction());
74 break;
75 }
Nobuhiro Iwamatsu4fb44e22012-06-13 16:29:47 +090076 }
77 return 0;
78}
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000079#endif /* CONFIG_DISPLAY_CPUINFO */