]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
4fb44e22 NI |
2 | /* |
3 | * (C) Copyright 2012 Nobuhiro Iwamatsu <[email protected]> | |
4 | * (C) Copyright 2012 Renesas Solutions Corp. | |
4fb44e22 NI |
5 | */ |
6 | #include <common.h> | |
9edefc27 | 7 | #include <cpu_func.h> |
90526e9f | 8 | #include <asm/cache.h> |
4fb44e22 | 9 | #include <asm/io.h> |
9fb625ce | 10 | #include <env.h> |
00e4b57e | 11 | #include <linux/ctype.h> |
4fb44e22 NI |
12 | |
13 | #ifdef CONFIG_ARCH_CPU_INIT | |
14 | int arch_cpu_init(void) | |
15 | { | |
16 | icache_enable(); | |
17 | return 0; | |
18 | } | |
19 | #endif | |
20 | ||
5055a4e9 TK |
21 | /* R-Car Gen3 D-cache is enabled in memmap-gen3.c */ |
22 | #ifndef CONFIG_RCAR_GEN3 | |
10015025 | 23 | #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) |
4fb44e22 NI |
24 | void enable_caches(void) |
25 | { | |
26 | dcache_enable(); | |
27 | } | |
28 | #endif | |
e5cb6bd9 | 29 | #endif |
4fb44e22 NI |
30 | |
31 | #ifdef CONFIG_DISPLAY_CPUINFO | |
35295964 | 32 | #ifndef CONFIG_RZA1 |
1cdf2482 | 33 | static u32 __rmobile_get_cpu_type(void) |
4fb44e22 | 34 | { |
1cdf2482 | 35 | return 0x0; |
4fb44e22 | 36 | } |
1cdf2482 NI |
37 | u32 rmobile_get_cpu_type(void) |
38 | __attribute__((weak, alias("__rmobile_get_cpu_type"))); | |
4fb44e22 | 39 | |
4f007b83 | 40 | static u32 __rmobile_get_cpu_rev_integer(void) |
4fb44e22 | 41 | { |
1cdf2482 | 42 | return 0; |
4fb44e22 | 43 | } |
4f007b83 TK |
44 | u32 rmobile_get_cpu_rev_integer(void) |
45 | __attribute__((weak, alias("__rmobile_get_cpu_rev_integer"))); | |
46 | ||
47 | static u32 __rmobile_get_cpu_rev_fraction(void) | |
48 | { | |
49 | return 0; | |
50 | } | |
51 | u32 rmobile_get_cpu_rev_fraction(void) | |
52 | __attribute__((weak, alias("__rmobile_get_cpu_rev_fraction"))); | |
4fb44e22 | 53 | |
73ff6801 NI |
54 | /* CPU infomation table */ |
55 | static const struct { | |
56 | u16 cpu_type; | |
57 | u8 cpu_name[10]; | |
58 | } rmobile_cpuinfo[] = { | |
262e9156 MV |
59 | { RMOBILE_CPU_TYPE_SH73A0, "SH73A0" }, |
60 | { RMOBILE_CPU_TYPE_R8A7740, "R8A7740" }, | |
61 | { RMOBILE_CPU_TYPE_R8A7790, "R8A7790" }, | |
62 | { RMOBILE_CPU_TYPE_R8A7791, "R8A7791" }, | |
63 | { RMOBILE_CPU_TYPE_R8A7792, "R8A7792" }, | |
64 | { RMOBILE_CPU_TYPE_R8A7793, "R8A7793" }, | |
65 | { RMOBILE_CPU_TYPE_R8A7794, "R8A7794" }, | |
66 | { RMOBILE_CPU_TYPE_R8A7795, "R8A7795" }, | |
67 | { RMOBILE_CPU_TYPE_R8A7796, "R8A7796" }, | |
f295a569 | 68 | { RMOBILE_CPU_TYPE_R8A77965, "R8A77965" }, |
5cb19e7a | 69 | { RMOBILE_CPU_TYPE_R8A77970, "R8A77970" }, |
57ede1a3 | 70 | { RMOBILE_CPU_TYPE_R8A77980, "R8A77980" }, |
a0410a6f | 71 | { RMOBILE_CPU_TYPE_R8A77990, "R8A77990" }, |
1154541a | 72 | { RMOBILE_CPU_TYPE_R8A77995, "R8A77995" }, |
73ff6801 NI |
73 | { 0x0, "CPU" }, |
74 | }; | |
75 | ||
00e4b57e | 76 | static int rmobile_cpuinfo_idx(void) |
4fb44e22 | 77 | { |
73ff6801 NI |
78 | int i = 0; |
79 | u32 cpu_type = rmobile_get_cpu_type(); | |
00e4b57e MV |
80 | |
81 | for (; i < ARRAY_SIZE(rmobile_cpuinfo); i++) | |
82 | if (rmobile_cpuinfo[i].cpu_type == cpu_type) | |
73ff6801 | 83 | break; |
00e4b57e MV |
84 | |
85 | return i; | |
86 | } | |
87 | ||
88 | #ifdef CONFIG_ARCH_MISC_INIT | |
89 | int arch_misc_init(void) | |
90 | { | |
91 | int i, idx = rmobile_cpuinfo_idx(); | |
92 | char cpu[10] = { 0 }; | |
93 | ||
94 | for (i = 0; i < sizeof(cpu); i++) | |
95 | cpu[i] = tolower(rmobile_cpuinfo[idx].cpu_name[i]); | |
96 | ||
97 | env_set("platform", cpu); | |
98 | ||
99 | return 0; | |
100 | } | |
101 | #endif | |
102 | ||
103 | int print_cpuinfo(void) | |
104 | { | |
105 | int i = rmobile_cpuinfo_idx(); | |
106 | ||
107 | printf("CPU: Renesas Electronics %s rev %d.%d\n", | |
108 | rmobile_cpuinfo[i].cpu_name, rmobile_get_cpu_rev_integer(), | |
109 | rmobile_get_cpu_rev_fraction()); | |
110 | ||
4fb44e22 NI |
111 | return 0; |
112 | } | |
35295964 CB |
113 | #else |
114 | int print_cpuinfo(void) | |
115 | { | |
116 | printf("CPU: Renesas Electronics RZ/A1\n"); | |
117 | return 0; | |
118 | } | |
119 | #endif | |
1cdf2482 | 120 | #endif /* CONFIG_DISPLAY_CPUINFO */ |