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