cpu_info.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. { RMOBILE_CPU_TYPE_SH73A0, "SH73A0" },
  47. { RMOBILE_CPU_TYPE_R8A7740, "R8A7740" },
  48. { RMOBILE_CPU_TYPE_R8A7790, "R8A7790" },
  49. { RMOBILE_CPU_TYPE_R8A7791, "R8A7791" },
  50. { RMOBILE_CPU_TYPE_R8A7792, "R8A7792" },
  51. { RMOBILE_CPU_TYPE_R8A7793, "R8A7793" },
  52. { RMOBILE_CPU_TYPE_R8A7794, "R8A7794" },
  53. { RMOBILE_CPU_TYPE_R8A7795, "R8A7795" },
  54. { RMOBILE_CPU_TYPE_R8A7796, "R8A7796" },
  55. { RMOBILE_CPU_TYPE_R8A77965, "R8A77965" },
  56. { RMOBILE_CPU_TYPE_R8A77970, "R8A77970" },
  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 */