Nobuhiro Iwamatsu | 4fb44e2 | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2012 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> |
| 3 | * (C) Copyright 2012 Renesas Solutions Corp. |
| 4 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Nobuhiro Iwamatsu | 4fb44e2 | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 6 | */ |
| 7 | #include <common.h> |
| 8 | #include <asm/io.h> |
Nobuhiro Iwamatsu | 4fb44e2 | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 9 | |
| 10 | #ifdef CONFIG_ARCH_CPU_INIT |
| 11 | int arch_cpu_init(void) |
| 12 | { |
| 13 | icache_enable(); |
| 14 | return 0; |
| 15 | } |
| 16 | #endif |
| 17 | |
| 18 | #ifndef CONFIG_SYS_DCACHE_OFF |
| 19 | void enable_caches(void) |
| 20 | { |
Marek Vasut | a523af6 | 2017-11-25 23:24:01 +0100 | [diff] [blame] | 21 | #if defined(CONFIG_RCAR_GEN3) |
| 22 | rcar_gen3_memmap_fixup(); |
| 23 | #endif |
Nobuhiro Iwamatsu | 4fb44e2 | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 24 | dcache_enable(); |
| 25 | } |
| 26 | #endif |
| 27 | |
| 28 | #ifdef CONFIG_DISPLAY_CPUINFO |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 29 | static u32 __rmobile_get_cpu_type(void) |
Nobuhiro Iwamatsu | 4fb44e2 | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 30 | { |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 31 | return 0x0; |
Nobuhiro Iwamatsu | 4fb44e2 | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 32 | } |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 33 | u32 rmobile_get_cpu_type(void) |
| 34 | __attribute__((weak, alias("__rmobile_get_cpu_type"))); |
Nobuhiro Iwamatsu | 4fb44e2 | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 35 | |
Tetsuyuki Kobayashi | 4f007b8 | 2012-07-25 18:24:21 +0000 | [diff] [blame] | 36 | static u32 __rmobile_get_cpu_rev_integer(void) |
Nobuhiro Iwamatsu | 4fb44e2 | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 37 | { |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 38 | return 0; |
Nobuhiro Iwamatsu | 4fb44e2 | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 39 | } |
Tetsuyuki Kobayashi | 4f007b8 | 2012-07-25 18:24:21 +0000 | [diff] [blame] | 40 | u32 rmobile_get_cpu_rev_integer(void) |
| 41 | __attribute__((weak, alias("__rmobile_get_cpu_rev_integer"))); |
| 42 | |
| 43 | static u32 __rmobile_get_cpu_rev_fraction(void) |
| 44 | { |
| 45 | return 0; |
| 46 | } |
| 47 | u32 rmobile_get_cpu_rev_fraction(void) |
| 48 | __attribute__((weak, alias("__rmobile_get_cpu_rev_fraction"))); |
Nobuhiro Iwamatsu | 4fb44e2 | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 49 | |
Nobuhiro Iwamatsu | 73ff680 | 2014-03-28 11:54:22 +0900 | [diff] [blame] | 50 | /* CPU infomation table */ |
| 51 | static const struct { |
| 52 | u16 cpu_type; |
| 53 | u8 cpu_name[10]; |
| 54 | } rmobile_cpuinfo[] = { |
Marek Vasut | 262e915 | 2017-11-25 23:54:10 +0100 | [diff] [blame] | 55 | { 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 Vasut | f295a56 | 2018-02-26 10:35:15 +0100 | [diff] [blame^] | 64 | { RMOBILE_CPU_TYPE_R8A77965, "R8A77965" }, |
Marek Vasut | 5cb19e7 | 2017-10-09 20:39:47 +0200 | [diff] [blame] | 65 | { RMOBILE_CPU_TYPE_R8A77970, "R8A77970" }, |
Marek Vasut | 1154541 | 2017-10-08 20:52:52 +0200 | [diff] [blame] | 66 | { RMOBILE_CPU_TYPE_R8A77995, "R8A77995" }, |
Nobuhiro Iwamatsu | 73ff680 | 2014-03-28 11:54:22 +0900 | [diff] [blame] | 67 | { 0x0, "CPU" }, |
| 68 | }; |
| 69 | |
Nobuhiro Iwamatsu | 4fb44e2 | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 70 | int print_cpuinfo(void) |
| 71 | { |
Nobuhiro Iwamatsu | 73ff680 | 2014-03-28 11:54:22 +0900 | [diff] [blame] | 72 | 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 Iwamatsu | 4fb44e2 | 2012-06-13 16:29:47 +0900 | [diff] [blame] | 82 | } |
| 83 | return 0; |
| 84 | } |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 85 | #endif /* CONFIG_DISPLAY_CPUINFO */ |