Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Alexey Brodkin | 3a59d91 | 2014-02-04 12:56:14 +0400 | [diff] [blame] | 2 | /* |
Alexey Brodkin | 9ab3696 | 2018-10-02 11:42:23 +0300 | [diff] [blame] | 3 | * Copyright (C) 2013-2014, 2018 Synopsys, Inc. All rights reserved. |
Alexey Brodkin | 3a59d91 | 2014-02-04 12:56:14 +0400 | [diff] [blame] | 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 | { |
Alexey Brodkin | 3a59d91 | 2014-02-04 12:56:14 +0400 | [diff] [blame] | 14 | timer_init(); |
| 15 | |
Alexey Brodkin | 3a59d91 | 2014-02-04 12:56:14 +0400 | [diff] [blame] | 16 | gd->cpu_clk = CONFIG_SYS_CLK_FREQ; |
| 17 | gd->ram_size = CONFIG_SYS_SDRAM_SIZE; |
| 18 | |
Alexey Brodkin | 9f916ee | 2015-05-18 16:56:26 +0300 | [diff] [blame] | 19 | cache_init(); |
| 20 | |
Alexey Brodkin | 3a59d91 | 2014-02-04 12:56:14 +0400 | [diff] [blame] | 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 | } |
Simon Glass | d35f338 | 2017-04-06 12:47:05 -0600 | [diff] [blame] | 30 | |
| 31 | /* This is a dummy function on arc */ |
| 32 | int dram_init(void) |
| 33 | { |
| 34 | return 0; |
| 35 | } |
Alexey Brodkin | 9ab3696 | 2018-10-02 11:42:23 +0300 | [diff] [blame] | 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 | int print_cpuinfo(void) |
| 64 | { |
| 65 | printf("CPU: %s\n", decode_identity()); |
| 66 | return 0; |
| 67 | } |
| 68 | #endif /* CONFIG_DISPLAY_CPUINFO */ |