prom.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*
  2. * This program is free software; you can redistribute it and/or modify it
  3. * under the terms of the GNU General Public License version 2 as published
  4. * by the Free Software Foundation.
  5. *
  6. * Copyright (C) 2010 John Crispin <john@phrozen.org>
  7. * Copyright (C) 2013-2015 Lantiq Beteiligungs-GmbH & Co.KG
  8. */
  9. #include <linux/export.h>
  10. #include <linux/clk.h>
  11. #include <asm/bootinfo.h>
  12. #include <asm/time.h>
  13. #include <lantiq_soc.h>
  14. #include "../prom.h"
  15. #define SOC_DANUBE "Danube"
  16. #define SOC_TWINPASS "Twinpass"
  17. #define SOC_AMAZON_SE "Amazon_SE"
  18. #define SOC_AR9 "AR9"
  19. #define SOC_GR9 "GRX200"
  20. #define SOC_VR9 "xRX200"
  21. #define SOC_VRX220 "xRX220"
  22. #define SOC_AR10 "xRX300"
  23. #define SOC_GRX390 "xRX330"
  24. #define COMP_DANUBE "lantiq,danube"
  25. #define COMP_TWINPASS "lantiq,twinpass"
  26. #define COMP_AMAZON_SE "lantiq,ase"
  27. #define COMP_AR9 "lantiq,ar9"
  28. #define COMP_GR9 "lantiq,gr9"
  29. #define COMP_VR9 "lantiq,vr9"
  30. #define COMP_AR10 "lantiq,ar10"
  31. #define COMP_GRX390 "lantiq,grx390"
  32. #define PART_SHIFT 12
  33. #define PART_MASK 0x0FFFFFFF
  34. #define REV_SHIFT 28
  35. #define REV_MASK 0xF0000000
  36. void __init ltq_soc_detect(struct ltq_soc_info *i)
  37. {
  38. i->partnum = (ltq_r32(LTQ_MPS_CHIPID) & PART_MASK) >> PART_SHIFT;
  39. i->rev = (ltq_r32(LTQ_MPS_CHIPID) & REV_MASK) >> REV_SHIFT;
  40. sprintf(i->rev_type, "1.%d", i->rev);
  41. switch (i->partnum) {
  42. case SOC_ID_DANUBE1:
  43. case SOC_ID_DANUBE2:
  44. i->name = SOC_DANUBE;
  45. i->type = SOC_TYPE_DANUBE;
  46. i->compatible = COMP_DANUBE;
  47. break;
  48. case SOC_ID_TWINPASS:
  49. i->name = SOC_TWINPASS;
  50. i->type = SOC_TYPE_DANUBE;
  51. i->compatible = COMP_TWINPASS;
  52. break;
  53. case SOC_ID_ARX188:
  54. case SOC_ID_ARX168_1:
  55. case SOC_ID_ARX168_2:
  56. case SOC_ID_ARX182:
  57. i->name = SOC_AR9;
  58. i->type = SOC_TYPE_AR9;
  59. i->compatible = COMP_AR9;
  60. break;
  61. case SOC_ID_GRX188:
  62. case SOC_ID_GRX168:
  63. i->name = SOC_GR9;
  64. i->type = SOC_TYPE_AR9;
  65. i->compatible = COMP_GR9;
  66. break;
  67. case SOC_ID_AMAZON_SE_1:
  68. case SOC_ID_AMAZON_SE_2:
  69. #ifdef CONFIG_PCI
  70. panic("ase is only supported for non pci kernels");
  71. #endif
  72. i->name = SOC_AMAZON_SE;
  73. i->type = SOC_TYPE_AMAZON_SE;
  74. i->compatible = COMP_AMAZON_SE;
  75. break;
  76. case SOC_ID_VRX282:
  77. case SOC_ID_VRX268:
  78. case SOC_ID_VRX288:
  79. i->name = SOC_VR9;
  80. i->type = SOC_TYPE_VR9;
  81. i->compatible = COMP_VR9;
  82. break;
  83. case SOC_ID_GRX268:
  84. case SOC_ID_GRX288:
  85. i->name = SOC_GR9;
  86. i->type = SOC_TYPE_VR9;
  87. i->compatible = COMP_GR9;
  88. break;
  89. case SOC_ID_VRX268_2:
  90. case SOC_ID_VRX288_2:
  91. i->name = SOC_VR9;
  92. i->type = SOC_TYPE_VR9_2;
  93. i->compatible = COMP_VR9;
  94. break;
  95. case SOC_ID_VRX220:
  96. i->name = SOC_VRX220;
  97. i->type = SOC_TYPE_VRX220;
  98. i->compatible = COMP_VR9;
  99. break;
  100. case SOC_ID_GRX282_2:
  101. case SOC_ID_GRX288_2:
  102. i->name = SOC_GR9;
  103. i->type = SOC_TYPE_VR9_2;
  104. i->compatible = COMP_GR9;
  105. break;
  106. case SOC_ID_ARX362:
  107. case SOC_ID_ARX368:
  108. case SOC_ID_ARX382:
  109. case SOC_ID_ARX388:
  110. case SOC_ID_URX388:
  111. i->name = SOC_AR10;
  112. i->type = SOC_TYPE_AR10;
  113. i->compatible = COMP_AR10;
  114. break;
  115. case SOC_ID_GRX383:
  116. case SOC_ID_GRX369:
  117. case SOC_ID_GRX387:
  118. case SOC_ID_GRX389:
  119. i->name = SOC_GRX390;
  120. i->type = SOC_TYPE_GRX390;
  121. i->compatible = COMP_GRX390;
  122. break;
  123. default:
  124. unreachable();
  125. break;
  126. }
  127. }