cpu_info.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. { 0x4A, "R8A7792" },
  51. { 0x4B, "R8A7793" },
  52. { 0x4C, "R8A7794" },
  53. { 0x0, "CPU" },
  54. };
  55. int print_cpuinfo(void)
  56. {
  57. int i = 0;
  58. u32 cpu_type = rmobile_get_cpu_type();
  59. for (; i < ARRAY_SIZE(rmobile_cpuinfo); i++) {
  60. if (rmobile_cpuinfo[i].cpu_type == cpu_type) {
  61. printf("CPU: Renesas Electronics %s rev %d.%d\n",
  62. rmobile_cpuinfo[i].cpu_name,
  63. rmobile_get_cpu_rev_integer(),
  64. rmobile_get_cpu_rev_fraction());
  65. break;
  66. }
  67. }
  68. return 0;
  69. }
  70. #endif /* CONFIG_DISPLAY_CPUINFO */