Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Nobuhiro Iwamatsu | f3db9da | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2012 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> |
| 4 | * (C) Copyright 2012 Renesas Solutions Corp. |
Nobuhiro Iwamatsu | f3db9da | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 5 | */ |
| 6 | #include <common.h> |
| 7 | #include <asm/io.h> |
Nobuhiro Iwamatsu | f3db9da | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 8 | |
| 9 | #ifdef CONFIG_ARCH_CPU_INIT |
| 10 | int arch_cpu_init(void) |
| 11 | { |
| 12 | icache_enable(); |
| 13 | return 0; |
| 14 | } |
| 15 | #endif |
| 16 | |
| 17 | #ifndef CONFIG_SYS_DCACHE_OFF |
| 18 | void enable_caches(void) |
| 19 | { |
| 20 | dcache_enable(); |
| 21 | } |
| 22 | #endif |
| 23 | |
| 24 | #ifdef CONFIG_DISPLAY_CPUINFO |
Nobuhiro Iwamatsu | 940103d | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 25 | static u32 __rmobile_get_cpu_type(void) |
Nobuhiro Iwamatsu | f3db9da | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 26 | { |
Nobuhiro Iwamatsu | 940103d | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 27 | return 0x0; |
Nobuhiro Iwamatsu | f3db9da | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 28 | } |
Nobuhiro Iwamatsu | 940103d | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 29 | u32 rmobile_get_cpu_type(void) |
| 30 | __attribute__((weak, alias("__rmobile_get_cpu_type"))); |
Nobuhiro Iwamatsu | f3db9da | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 31 | |
Tetsuyuki Kobayashi | 7811e54 | 2012-07-25 18:24:21 +0000 | [diff] [blame] | 32 | static u32 __rmobile_get_cpu_rev_integer(void) |
Nobuhiro Iwamatsu | f3db9da | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 33 | { |
Nobuhiro Iwamatsu | 940103d | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 34 | return 0; |
Nobuhiro Iwamatsu | f3db9da | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 35 | } |
Tetsuyuki Kobayashi | 7811e54 | 2012-07-25 18:24:21 +0000 | [diff] [blame] | 36 | u32 rmobile_get_cpu_rev_integer(void) |
| 37 | __attribute__((weak, alias("__rmobile_get_cpu_rev_integer"))); |
| 38 | |
| 39 | static u32 __rmobile_get_cpu_rev_fraction(void) |
| 40 | { |
| 41 | return 0; |
| 42 | } |
| 43 | u32 rmobile_get_cpu_rev_fraction(void) |
| 44 | __attribute__((weak, alias("__rmobile_get_cpu_rev_fraction"))); |
Nobuhiro Iwamatsu | f3db9da | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 45 | |
Nobuhiro Iwamatsu | 524ed8b | 2014-03-28 11:54:22 +0900 | [diff] [blame] | 46 | /* CPU infomation table */ |
| 47 | static const struct { |
| 48 | u16 cpu_type; |
| 49 | u8 cpu_name[10]; |
| 50 | } rmobile_cpuinfo[] = { |
Marek Vasut | b8f814b | 2017-11-25 23:54:10 +0100 | [diff] [blame] | 51 | { 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 Vasut | 1ecc0bd | 2018-02-26 10:35:15 +0100 | [diff] [blame] | 60 | { RMOBILE_CPU_TYPE_R8A77965, "R8A77965" }, |
Marek Vasut | 46175fc | 2017-10-09 20:39:47 +0200 | [diff] [blame] | 61 | { RMOBILE_CPU_TYPE_R8A77970, "R8A77970" }, |
Marek Vasut | 001dbf3 | 2018-04-26 10:09:06 +0200 | [diff] [blame] | 62 | { RMOBILE_CPU_TYPE_R8A77990, "R8A77990" }, |
Marek Vasut | 04cd2e2 | 2017-10-08 20:52:52 +0200 | [diff] [blame] | 63 | { RMOBILE_CPU_TYPE_R8A77995, "R8A77995" }, |
Nobuhiro Iwamatsu | 524ed8b | 2014-03-28 11:54:22 +0900 | [diff] [blame] | 64 | { 0x0, "CPU" }, |
| 65 | }; |
| 66 | |
Nobuhiro Iwamatsu | f3db9da | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 67 | int print_cpuinfo(void) |
| 68 | { |
Nobuhiro Iwamatsu | 524ed8b | 2014-03-28 11:54:22 +0900 | [diff] [blame] | 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 | } |
Nobuhiro Iwamatsu | f3db9da | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 79 | } |
| 80 | return 0; |
| 81 | } |
Nobuhiro Iwamatsu | 940103d | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 82 | #endif /* CONFIG_DISPLAY_CPUINFO */ |