xref: /openbmc/u-boot/arch/arc/lib/cpu.c (revision 61b4dbb0)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2013-2014, 2018 Synopsys, Inc. All rights reserved.
4  */
5 
6 #include <common.h>
7 #include <asm/arcregs.h>
8 #include <asm/cache.h>
9 
10 DECLARE_GLOBAL_DATA_PTR;
11 
12 int arch_cpu_init(void)
13 {
14 	timer_init();
15 
16 	gd->cpu_clk = CONFIG_SYS_CLK_FREQ;
17 	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
18 
19 	cache_init();
20 
21 	return 0;
22 }
23 
24 int arch_early_init_r(void)
25 {
26 	gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
27 	gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
28 	return 0;
29 }
30 
31 /* This is a dummy function on arc */
32 int dram_init(void)
33 {
34 	return 0;
35 }
36 
37 #ifdef CONFIG_DISPLAY_CPUINFO
38 const char *decode_identity(void)
39 {
40 	int arcver = read_aux_reg(ARC_AUX_IDENTITY) & 0xff;
41 
42 	switch (arcver) {
43 	/* ARCompact cores */
44 	case 0x32: return "ARC 700 v4.4-4.5";
45 	case 0x33: return "ARC 700 v4.6-v4.9";
46 	case 0x34: return "ARC 700 v4.10";
47 	case 0x35: return "ARC 700 v4.11";
48 
49 	/* ARCv2 cores */
50 	case 0x41: return "ARC EM v1.1a";
51 	case 0x42: return "ARC EM v3.0";
52 	case 0x43: return "ARC EM v4.0";
53 	case 0x50: return "ARC HS v1.0";
54 	case 0x51: return "ARC EM v2.0";
55 	case 0x52: return "ARC EM v2.1";
56 	case 0x53: return "ARC HS v3.0";
57 	case 0x54: return "ARC HS v4.0";
58 
59 	default: return "Unknown ARC core";
60 	}
61 }
62 
63 __weak int print_cpuinfo(void)
64 {
65 	printf("CPU:   %s\n", decode_identity());
66 	return 0;
67 }
68 #endif /* CONFIG_DISPLAY_CPUINFO */
69