cpu_info.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * (C) Copyright 2012 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
  3. * (C) Copyright 2012 Renesas Solutions Corp.
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. #include <asm/io.h>
  9. #ifdef CONFIG_ARCH_CPU_INIT
  10. int arch_cpu_init(void)
  11. {
  12. icache_enable();
  13. return 0;
  14. }
  15. #endif
  16. #ifndef CONFIG_SYS_DCACHE_OFF
  17. void enable_caches(void)
  18. {
  19. dcache_enable();
  20. }
  21. #endif
  22. #ifdef CONFIG_DISPLAY_CPUINFO
  23. static u32 __rmobile_get_cpu_type(void)
  24. {
  25. return 0x0;
  26. }
  27. u32 rmobile_get_cpu_type(void)
  28. __attribute__((weak, alias("__rmobile_get_cpu_type")));
  29. static u32 __rmobile_get_cpu_rev_integer(void)
  30. {
  31. return 0;
  32. }
  33. u32 rmobile_get_cpu_rev_integer(void)
  34. __attribute__((weak, alias("__rmobile_get_cpu_rev_integer")));
  35. static u32 __rmobile_get_cpu_rev_fraction(void)
  36. {
  37. return 0;
  38. }
  39. u32 rmobile_get_cpu_rev_fraction(void)
  40. __attribute__((weak, alias("__rmobile_get_cpu_rev_fraction")));
  41. /* CPU infomation table */
  42. static const struct {
  43. u16 cpu_type;
  44. u8 cpu_name[10];
  45. } rmobile_cpuinfo[] = {
  46. { 0x37, "SH73A0" },
  47. { 0x40, "R8A7740" },
  48. { 0x45, "R8A7790" },
  49. { 0x47, "R8A7791" },
  50. { 0x4B, "R8A7793" },
  51. { 0x4C, "R8A7794" },
  52. { 0x0, "CPU" },
  53. };
  54. int print_cpuinfo(void)
  55. {
  56. int i = 0;
  57. u32 cpu_type = rmobile_get_cpu_type();
  58. for (; i < ARRAY_SIZE(rmobile_cpuinfo); i++) {
  59. if (rmobile_cpuinfo[i].cpu_type == cpu_type) {
  60. printf("CPU: Renesas Electronics %s rev %d.%d\n",
  61. rmobile_cpuinfo[i].cpu_name,
  62. rmobile_get_cpu_rev_integer(),
  63. rmobile_get_cpu_rev_fraction());
  64. break;
  65. }
  66. }
  67. return 0;
  68. }
  69. #endif /* CONFIG_DISPLAY_CPUINFO */