fsl-errata.c 4.8 KB

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