cpu_info.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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_R8A77995, "R8A77995" },
  57. { 0x0, "CPU" },
  58. };
  59. int print_cpuinfo(void)
  60. {
  61. int i = 0;
  62. u32 cpu_type = rmobile_get_cpu_type();
  63. for (; i < ARRAY_SIZE(rmobile_cpuinfo); i++) {
  64. if (rmobile_cpuinfo[i].cpu_type == cpu_type) {
  65. printf("CPU: Renesas Electronics %s rev %d.%d\n",
  66. rmobile_cpuinfo[i].cpu_name,
  67. rmobile_get_cpu_rev_integer(),
  68. rmobile_get_cpu_rev_fraction());
  69. break;
  70. }
  71. }
  72. return 0;
  73. }
  74. #endif /* CONFIG_DISPLAY_CPUINFO */