cpu_info.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. /* R-Car Gen3 caches are enabled in memmap-gen3.c */
  9. #ifndef CONFIG_RCAR_GEN3
  10. #ifdef CONFIG_ARCH_CPU_INIT
  11. int arch_cpu_init(void)
  12. {
  13. icache_enable();
  14. return 0;
  15. }
  16. #endif
  17. #ifndef CONFIG_SYS_DCACHE_OFF
  18. void enable_caches(void)
  19. {
  20. dcache_enable();
  21. }
  22. #endif
  23. #endif
  24. #ifdef CONFIG_DISPLAY_CPUINFO
  25. static u32 __rmobile_get_cpu_type(void)
  26. {
  27. return 0x0;
  28. }
  29. u32 rmobile_get_cpu_type(void)
  30. __attribute__((weak, alias("__rmobile_get_cpu_type")));
  31. static u32 __rmobile_get_cpu_rev_integer(void)
  32. {
  33. return 0;
  34. }
  35. u32 rmobile_get_cpu_rev_integer(void)
  36. __attribute__((weak, alias("__rmobile_get_cpu_rev_integer")));
  37. static u32 __rmobile_get_cpu_rev_fraction(void)
  38. {
  39. return 0;
  40. }
  41. u32 rmobile_get_cpu_rev_fraction(void)
  42. __attribute__((weak, alias("__rmobile_get_cpu_rev_fraction")));
  43. /* CPU infomation table */
  44. static const struct {
  45. u16 cpu_type;
  46. u8 cpu_name[10];
  47. } rmobile_cpuinfo[] = {
  48. { RMOBILE_CPU_TYPE_SH73A0, "SH73A0" },
  49. { RMOBILE_CPU_TYPE_R8A7740, "R8A7740" },
  50. { RMOBILE_CPU_TYPE_R8A7790, "R8A7790" },
  51. { RMOBILE_CPU_TYPE_R8A7791, "R8A7791" },
  52. { RMOBILE_CPU_TYPE_R8A7792, "R8A7792" },
  53. { RMOBILE_CPU_TYPE_R8A7793, "R8A7793" },
  54. { RMOBILE_CPU_TYPE_R8A7794, "R8A7794" },
  55. { RMOBILE_CPU_TYPE_R8A7795, "R8A7795" },
  56. { RMOBILE_CPU_TYPE_R8A7796, "R8A7796" },
  57. { RMOBILE_CPU_TYPE_R8A77965, "R8A77965" },
  58. { RMOBILE_CPU_TYPE_R8A77970, "R8A77970" },
  59. { RMOBILE_CPU_TYPE_R8A77990, "R8A77990" },
  60. { RMOBILE_CPU_TYPE_R8A77995, "R8A77995" },
  61. { 0x0, "CPU" },
  62. };
  63. int print_cpuinfo(void)
  64. {
  65. int i = 0;
  66. u32 cpu_type = rmobile_get_cpu_type();
  67. for (; i < ARRAY_SIZE(rmobile_cpuinfo); i++) {
  68. if (rmobile_cpuinfo[i].cpu_type == cpu_type) {
  69. printf("CPU: Renesas Electronics %s rev %d.%d\n",
  70. rmobile_cpuinfo[i].cpu_name,
  71. rmobile_get_cpu_rev_integer(),
  72. rmobile_get_cpu_rev_fraction());
  73. break;
  74. }
  75. }
  76. return 0;
  77. }
  78. #endif /* CONFIG_DISPLAY_CPUINFO */