cpu.c 885 B

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