xref: /rk3399_rockchip-uboot/arch/xtensa/cpu/cpu.c (revision f1683aa73c31db0a025e0254e6ce1ee7e56aad3e)
1c978b524SChris Zankel /*
2c978b524SChris Zankel  * (C) Copyright 2008 - 2013 Tensilica Inc.
3c978b524SChris Zankel  * (C) Copyright 2014 - 2016 Cadence Design Systems Inc.
4c978b524SChris Zankel  *
5c978b524SChris Zankel  * SPDX-License-Identifier:	GPL-2.0+
6c978b524SChris Zankel  */
7c978b524SChris Zankel 
8c978b524SChris Zankel /*
9c978b524SChris Zankel  * CPU specific code
10c978b524SChris Zankel  */
11c978b524SChris Zankel 
12c978b524SChris Zankel #include <common.h>
13c978b524SChris Zankel #include <command.h>
14c978b524SChris Zankel #include <linux/stringify.h>
15c978b524SChris Zankel #include <asm/global_data.h>
16c978b524SChris Zankel #include <asm/cache.h>
17c978b524SChris Zankel #include <asm/string.h>
18c978b524SChris Zankel #include <asm/misc.h>
19c978b524SChris Zankel 
20c978b524SChris Zankel DECLARE_GLOBAL_DATA_PTR;
21c978b524SChris Zankel 
22c978b524SChris Zankel gd_t *gd __attribute__((section(".data")));
23c978b524SChris Zankel 
24c978b524SChris Zankel #if defined(CONFIG_DISPLAY_CPUINFO)
25c978b524SChris Zankel /*
26c978b524SChris Zankel  * Print information about the CPU.
27c978b524SChris Zankel  */
28c978b524SChris Zankel 
print_cpuinfo(void)29c978b524SChris Zankel int print_cpuinfo(void)
30c978b524SChris Zankel {
31c978b524SChris Zankel 	char buf[120], mhz[8];
32c978b524SChris Zankel 	uint32_t id0, id1;
33c978b524SChris Zankel 
34c978b524SChris Zankel 	asm volatile ("rsr %0, 176\n"
35c978b524SChris Zankel 		      "rsr %1, 208\n"
36c978b524SChris Zankel 		      : "=r"(id0), "=r"(id1));
37c978b524SChris Zankel 
38c978b524SChris Zankel 	sprintf(buf, "CPU:   Xtensa %s (id: %08x:%08x) at %s MHz\n",
39c978b524SChris Zankel 		XCHAL_CORE_ID, id0, id1, strmhz(mhz, gd->cpu_clk));
40c978b524SChris Zankel 	puts(buf);
41c978b524SChris Zankel 	return 0;
42c978b524SChris Zankel }
43c978b524SChris Zankel #endif
44c978b524SChris Zankel 
arch_cpu_init(void)45c978b524SChris Zankel int arch_cpu_init(void)
46c978b524SChris Zankel {
47c978b524SChris Zankel 	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
48c978b524SChris Zankel 	return 0;
49c978b524SChris Zankel }
50*f1683aa7SSimon Glass 
dram_init(void)51*f1683aa7SSimon Glass int dram_init(void)
52*f1683aa7SSimon Glass {
53*f1683aa7SSimon Glass 	return 0;
54*f1683aa7SSimon Glass }
55