cpu_info.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (C) 2013-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <linux/io.h>
  8. #include "sg-regs.h"
  9. int print_cpuinfo(void)
  10. {
  11. u32 revision, type, model, rev, required_model = 1, required_rev = 1;
  12. revision = readl(SG_REVISION);
  13. type = (revision & SG_REVISION_TYPE_MASK) >> SG_REVISION_TYPE_SHIFT;
  14. model = (revision & SG_REVISION_MODEL_MASK) >> SG_REVISION_MODEL_SHIFT;
  15. rev = (revision & SG_REVISION_REV_MASK) >> SG_REVISION_REV_SHIFT;
  16. puts("CPU: ");
  17. switch (type) {
  18. case 0x25:
  19. puts("PH1-sLD3 (MN2WS0220)");
  20. required_model = 2;
  21. break;
  22. case 0x26:
  23. puts("PH1-LD4 (MN2WS0250)");
  24. required_rev = 2;
  25. break;
  26. case 0x28:
  27. puts("PH1-Pro4 (MN2WS0230)");
  28. break;
  29. case 0x29:
  30. puts("PH1-sLD8 (MN2WS0270)");
  31. break;
  32. case 0x2A:
  33. puts("PH1-Pro5 (MN2WS0300)");
  34. break;
  35. case 0x2E:
  36. puts("ProXstream2 (MN2WS0310)");
  37. break;
  38. case 0x2F:
  39. puts("PH1-LD6b (MN2WS0320)");
  40. break;
  41. case 0x31:
  42. puts("PH1-LD11 (SC1405AP1)");
  43. break;
  44. case 0x32:
  45. puts("PH1-LD20 (SC1401AJ1)");
  46. break;
  47. default:
  48. printf("Unknown Processor ID (0x%x)\n", revision);
  49. return -1;
  50. }
  51. printf(" model %d", model);
  52. printf(" (rev. %d)\n", rev);
  53. if (model < required_model) {
  54. printf("Sorry, this model is not supported.\n");
  55. printf("Required model is %d.", required_model);
  56. return -1;
  57. } else if (rev < required_rev) {
  58. printf("Sorry, this revision is not supported.\n");
  59. printf("Required revision is %d.", required_rev);
  60. return -1;
  61. }
  62. return 0;
  63. }