fsl-errata.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Freescale USB Controller
  4. *
  5. * Copyright 2013 Freescale Semiconductor, Inc.
  6. */
  7. #include <common.h>
  8. #include <fsl_errata.h>
  9. #include<fsl_usb.h>
  10. #if defined(CONFIG_FSL_LSCH2) || defined(CONFIG_FSL_LSCH3) || \
  11. defined(CONFIG_ARM)
  12. #include <asm/arch/clock.h>
  13. #endif
  14. /* USB Erratum Checking code */
  15. #if defined(CONFIG_PPC) || defined(CONFIG_ARM)
  16. bool has_dual_phy(void)
  17. {
  18. u32 svr = get_svr();
  19. u32 soc = SVR_SOC_VER(svr);
  20. switch (soc) {
  21. #ifdef CONFIG_PPC
  22. case SVR_T1023:
  23. case SVR_T1024:
  24. case SVR_T1013:
  25. case SVR_T1014:
  26. return IS_SVR_REV(svr, 1, 0);
  27. case SVR_T1040:
  28. case SVR_T1042:
  29. case SVR_T1020:
  30. case SVR_T1022:
  31. case SVR_T2080:
  32. case SVR_T2081:
  33. return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
  34. case SVR_T4240:
  35. case SVR_T4160:
  36. case SVR_T4080:
  37. return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
  38. #endif
  39. }
  40. return false;
  41. }
  42. bool has_erratum_a006261(void)
  43. {
  44. u32 svr = get_svr();
  45. u32 soc = SVR_SOC_VER(svr);
  46. switch (soc) {
  47. #ifdef CONFIG_PPC
  48. case SVR_P1010:
  49. return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
  50. case SVR_P2041:
  51. case SVR_P2040:
  52. return IS_SVR_REV(svr, 1, 0) ||
  53. IS_SVR_REV(svr, 1, 1) ||
  54. IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1);
  55. case SVR_P3041:
  56. return IS_SVR_REV(svr, 1, 0) ||
  57. IS_SVR_REV(svr, 1, 1) ||
  58. IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1);
  59. case SVR_P5010:
  60. case SVR_P5020:
  61. case SVR_P5021:
  62. return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
  63. case SVR_T4240:
  64. return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
  65. case SVR_P5040:
  66. return IS_SVR_REV(svr, 1, 0) ||
  67. IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1);
  68. #endif
  69. }
  70. return false;
  71. }
  72. bool has_erratum_a007075(void)
  73. {
  74. u32 svr = get_svr();
  75. u32 soc = SVR_SOC_VER(svr);
  76. switch (soc) {
  77. #ifdef CONFIG_PPC
  78. case SVR_B4860:
  79. case SVR_B4420:
  80. return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
  81. case SVR_P1010:
  82. return IS_SVR_REV(svr, 1, 0);
  83. case SVR_P4080:
  84. return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
  85. #endif
  86. }
  87. return false;
  88. }
  89. bool has_erratum_a007798(void)
  90. {
  91. #ifdef CONFIG_PPC
  92. return SVR_SOC_VER(get_svr()) == SVR_T4240 &&
  93. IS_SVR_REV(get_svr(), 2, 0);
  94. #endif
  95. return false;
  96. }
  97. bool has_erratum_a007792(void)
  98. {
  99. u32 svr = get_svr();
  100. u32 soc = SVR_SOC_VER(svr);
  101. switch (soc) {
  102. #ifdef CONFIG_PPC
  103. case SVR_T4240:
  104. case SVR_T4160:
  105. case SVR_T4080:
  106. return IS_SVR_REV(svr, 2, 0);
  107. case SVR_T1024:
  108. case SVR_T1023:
  109. return IS_SVR_REV(svr, 1, 0);
  110. case SVR_T1040:
  111. case SVR_T1042:
  112. case SVR_T1020:
  113. case SVR_T1022:
  114. case SVR_T2080:
  115. case SVR_T2081:
  116. return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
  117. #endif
  118. }
  119. return false;
  120. }
  121. bool has_erratum_a005697(void)
  122. {
  123. u32 svr = get_svr();
  124. u32 soc = SVR_SOC_VER(svr);
  125. switch (soc) {
  126. #ifdef CONFIG_PPC
  127. case SVR_9131:
  128. case SVR_9132:
  129. return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
  130. #endif
  131. #ifdef ONFIG_ARM64
  132. case SVR_LS1012A:
  133. return IS_SVR_REV(svr, 1, 0);
  134. #endif
  135. }
  136. return false;
  137. }
  138. bool has_erratum_a004477(void)
  139. {
  140. u32 svr = get_svr();
  141. u32 soc = SVR_SOC_VER(svr);
  142. switch (soc) {
  143. #ifdef CONFIG_PPC
  144. case SVR_P1010:
  145. return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
  146. case SVR_P1022:
  147. case SVR_9131:
  148. case SVR_9132:
  149. return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
  150. case SVR_P2020:
  151. return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0) ||
  152. IS_SVR_REV(svr, 2, 1);
  153. case SVR_B4860:
  154. case SVR_B4420:
  155. return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
  156. case SVR_P4080:
  157. return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
  158. #endif
  159. }
  160. return false;
  161. }
  162. bool has_erratum_a008751(void)
  163. {
  164. u32 svr = get_svr();
  165. u32 soc = SVR_SOC_VER(svr);
  166. switch (soc) {
  167. #ifdef CONFIG_ARM64
  168. case SVR_LS2080A:
  169. case SVR_LS2085A:
  170. return IS_SVR_REV(svr, 1, 0);
  171. #endif
  172. }
  173. return false;
  174. }
  175. bool has_erratum_a010151(void)
  176. {
  177. u32 svr = get_svr();
  178. u32 soc = SVR_SOC_VER(svr);
  179. #ifdef CONFIG_ARM64
  180. if (IS_SVR_DEV(svr, SVR_DEV(SVR_LS1043A)))
  181. return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
  182. #endif
  183. switch (soc) {
  184. #ifdef CONFIG_ARM64
  185. case SVR_LS2080A:
  186. case SVR_LS2085A:
  187. /* fallthrough */
  188. case SVR_LS2088A:
  189. /* fallthrough */
  190. case SVR_LS2081A:
  191. case SVR_LS1046A:
  192. case SVR_LS1012A:
  193. return IS_SVR_REV(svr, 1, 0);
  194. #endif
  195. #ifdef CONFIG_ARCH_LS1021A
  196. case SOC_VER_LS1020:
  197. case SOC_VER_LS1021:
  198. case SOC_VER_LS1022:
  199. case SOC_VER_SLS1020:
  200. return IS_SVR_REV(svr, 2, 0);
  201. #endif
  202. }
  203. return false;
  204. }
  205. #endif