Alexey Brodkin | 2f16ac9 | 2014-02-04 12:56:14 +0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <asm/arcregs.h> |
| 9 | #include <asm/cache.h> |
| 10 | |
| 11 | DECLARE_GLOBAL_DATA_PTR; |
| 12 | |
| 13 | int arch_cpu_init(void) |
| 14 | { |
| 15 | #ifdef CONFIG_SYS_ICACHE_OFF |
| 16 | icache_disable(); |
| 17 | #else |
| 18 | icache_enable(); |
| 19 | invalidate_icache_all(); |
| 20 | #endif |
| 21 | |
| 22 | flush_dcache_all(); |
| 23 | #ifdef CONFIG_SYS_DCACHE_OFF |
| 24 | dcache_disable(); |
| 25 | #else |
| 26 | dcache_enable(); |
| 27 | #endif |
| 28 | timer_init(); |
| 29 | |
| 30 | /* In simulation (ISS) "CHIPID" and "ARCNUM" are all "ff" */ |
| 31 | if ((read_aux_reg(ARC_AUX_IDENTITY) & 0xffffff00) == 0xffffff00) |
| 32 | gd->arch.running_on_hw = 0; |
| 33 | else |
| 34 | gd->arch.running_on_hw = 1; |
| 35 | |
| 36 | gd->cpu_clk = CONFIG_SYS_CLK_FREQ; |
| 37 | gd->ram_size = CONFIG_SYS_SDRAM_SIZE; |
| 38 | |
| 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | int arch_early_init_r(void) |
| 43 | { |
| 44 | gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; |
| 45 | gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; |
| 46 | return 0; |
| 47 | } |