cpu_info.c 1.9 KB

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