cmd_errata.c 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. /*
  2. * Copyright 2010-2011 Freescale Semiconductor, Inc.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <command.h>
  8. #include <linux/compiler.h>
  9. #include <asm/processor.h>
  10. #include "fsl_corenet_serdes.h"
  11. #ifdef CONFIG_SYS_FSL_ERRATUM_A004849
  12. /*
  13. * This work-around is implemented in PBI, so just check to see if the
  14. * work-around was actually applied. To do this, we check for specific data
  15. * at specific addresses in DCSR.
  16. *
  17. * Array offsets[] contains a list of offsets within DCSR. According to the
  18. * erratum document, the value at each offset should be 2.
  19. */
  20. static void check_erratum_a4849(uint32_t svr)
  21. {
  22. void __iomem *dcsr = (void *)CONFIG_SYS_DCSRBAR + 0xb0000;
  23. unsigned int i;
  24. #if defined(CONFIG_PPC_P2041) || defined(CONFIG_PPC_P3041)
  25. static const uint8_t offsets[] = {
  26. 0x50, 0x54, 0x58, 0x90, 0x94, 0x98
  27. };
  28. #endif
  29. #ifdef CONFIG_PPC_P4080
  30. static const uint8_t offsets[] = {
  31. 0x60, 0x64, 0x68, 0x6c, 0xa0, 0xa4, 0xa8, 0xac
  32. };
  33. #endif
  34. uint32_t x108; /* The value that should be at offset 0x108 */
  35. for (i = 0; i < ARRAY_SIZE(offsets); i++) {
  36. if (in_be32(dcsr + offsets[i]) != 2) {
  37. printf("Work-around for Erratum A004849 is not enabled\n");
  38. return;
  39. }
  40. }
  41. #if defined(CONFIG_PPC_P2041) || defined(CONFIG_PPC_P3041)
  42. x108 = 0x12;
  43. #endif
  44. #ifdef CONFIG_PPC_P4080
  45. /*
  46. * For P4080, the erratum document says that the value at offset 0x108
  47. * should be 0x12 on rev2, or 0x1c on rev3.
  48. */
  49. if (SVR_MAJ(svr) == 2)
  50. x108 = 0x12;
  51. if (SVR_MAJ(svr) == 3)
  52. x108 = 0x1c;
  53. #endif
  54. if (in_be32(dcsr + 0x108) != x108) {
  55. printf("Work-around for Erratum A004849 is not enabled\n");
  56. return;
  57. }
  58. /* Everything matches, so the erratum work-around was applied */
  59. printf("Work-around for Erratum A004849 enabled\n");
  60. }
  61. #endif
  62. #ifdef CONFIG_SYS_FSL_ERRATUM_A004580
  63. /*
  64. * This work-around is implemented in PBI, so just check to see if the
  65. * work-around was actually applied. To do this, we check for specific data
  66. * at specific addresses in the SerDes register block.
  67. *
  68. * The work-around says that for each SerDes lane, write BnTTLCRy0 =
  69. * 0x1B00_0001, Register 2 = 0x0088_0000, and Register 3 = 0x4000_0000.
  70. */
  71. static void check_erratum_a4580(uint32_t svr)
  72. {
  73. const serdes_corenet_t __iomem *srds_regs =
  74. (void *)CONFIG_SYS_FSL_CORENET_SERDES_ADDR;
  75. unsigned int lane;
  76. for (lane = 0; lane < SRDS_MAX_LANES; lane++) {
  77. if (serdes_lane_enabled(lane)) {
  78. const struct serdes_lane __iomem *srds_lane =
  79. &srds_regs->lane[serdes_get_lane_idx(lane)];
  80. /*
  81. * Verify that the values we were supposed to write in
  82. * the PBI are actually there. Also, the lower 15
  83. * bits of res4[3] should be the same as the upper 15
  84. * bits of res4[1].
  85. */
  86. if ((in_be32(&srds_lane->ttlcr0) != 0x1b000001) ||
  87. (in_be32(&srds_lane->res4[1]) != 0x880000) ||
  88. (in_be32(&srds_lane->res4[3]) != 0x40000044)) {
  89. printf("Work-around for Erratum A004580 is "
  90. "not enabled\n");
  91. return;
  92. }
  93. }
  94. }
  95. /* Everything matches, so the erratum work-around was applied */
  96. printf("Work-around for Erratum A004580 enabled\n");
  97. }
  98. #endif
  99. static int do_errata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  100. {
  101. #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_CPU_A011
  102. extern int enable_cpu_a011_workaround;
  103. #endif
  104. __maybe_unused u32 svr = get_svr();
  105. #if defined(CONFIG_FSL_SATA_V2) && defined(CONFIG_FSL_SATA_ERRATUM_A001)
  106. if (IS_SVR_REV(svr, 1, 0)) {
  107. switch (SVR_SOC_VER(svr)) {
  108. case SVR_P1013:
  109. case SVR_P1022:
  110. puts("Work-around for Erratum SATA A001 enabled\n");
  111. }
  112. }
  113. #endif
  114. #if defined(CONFIG_SYS_P4080_ERRATUM_SERDES8)
  115. puts("Work-around for Erratum SERDES8 enabled\n");
  116. #endif
  117. #if defined(CONFIG_SYS_P4080_ERRATUM_SERDES9)
  118. puts("Work-around for Erratum SERDES9 enabled\n");
  119. #endif
  120. #if defined(CONFIG_SYS_P4080_ERRATUM_SERDES_A005)
  121. puts("Work-around for Erratum SERDES-A005 enabled\n");
  122. #endif
  123. #if defined(CONFIG_SYS_P4080_ERRATUM_CPU22)
  124. if (SVR_MAJ(svr) < 3)
  125. puts("Work-around for Erratum CPU22 enabled\n");
  126. #endif
  127. #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_CPU_A011
  128. /*
  129. * NMG_CPU_A011 applies to P4080 rev 1.0, 2.0, fixed in 3.0
  130. * also applies to P3041 rev 1.0, 1.1, P2041 rev 1.0, 1.1
  131. * The SVR has been checked by cpu_init_r().
  132. */
  133. if (enable_cpu_a011_workaround)
  134. puts("Work-around for Erratum CPU-A011 enabled\n");
  135. #endif
  136. #if defined(CONFIG_SYS_FSL_ERRATUM_CPU_A003999)
  137. puts("Work-around for Erratum CPU-A003999 enabled\n");
  138. #endif
  139. #if defined(CONFIG_SYS_FSL_ERRATUM_DDR_A003474)
  140. puts("Work-around for Erratum DDR-A003473 enabled\n");
  141. #endif
  142. #if defined(CONFIG_SYS_FSL_ERRATUM_DDR_MSYNC_IN)
  143. puts("Work-around for DDR MSYNC_IN Erratum enabled\n");
  144. #endif
  145. #if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC111)
  146. puts("Work-around for Erratum ESDHC111 enabled\n");
  147. #endif
  148. #ifdef CONFIG_SYS_FSL_ERRATUM_A004468
  149. puts("Work-around for Erratum A004468 enabled\n");
  150. #endif
  151. #if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC135)
  152. puts("Work-around for Erratum ESDHC135 enabled\n");
  153. #endif
  154. #if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC13)
  155. if (SVR_MAJ(svr) < 3)
  156. puts("Work-around for Erratum ESDHC13 enabled\n");
  157. #endif
  158. #if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC_A001)
  159. puts("Work-around for Erratum ESDHC-A001 enabled\n");
  160. #endif
  161. #ifdef CONFIG_SYS_FSL_ERRATUM_CPC_A002
  162. puts("Work-around for Erratum CPC-A002 enabled\n");
  163. #endif
  164. #ifdef CONFIG_SYS_FSL_ERRATUM_CPC_A003
  165. puts("Work-around for Erratum CPC-A003 enabled\n");
  166. #endif
  167. #ifdef CONFIG_SYS_FSL_ERRATUM_ELBC_A001
  168. puts("Work-around for Erratum ELBC-A001 enabled\n");
  169. #endif
  170. #ifdef CONFIG_SYS_FSL_ERRATUM_DDR_A003
  171. puts("Work-around for Erratum DDR-A003 enabled\n");
  172. #endif
  173. #ifdef CONFIG_SYS_FSL_ERRATUM_DDR_115
  174. puts("Work-around for Erratum DDR115 enabled\n");
  175. #endif
  176. #ifdef CONFIG_SYS_FSL_ERRATUM_DDR111_DDR134
  177. puts("Work-around for Erratum DDR111 enabled\n");
  178. puts("Work-around for Erratum DDR134 enabled\n");
  179. #endif
  180. #ifdef CONFIG_SYS_FSL_ERRATUM_IFC_A002769
  181. puts("Work-around for Erratum IFC-A002769 enabled\n");
  182. #endif
  183. #ifdef CONFIG_SYS_FSL_ERRATUM_P1010_A003549
  184. puts("Work-around for Erratum P1010-A003549 enabled\n");
  185. #endif
  186. #ifdef CONFIG_SYS_FSL_ERRATUM_IFC_A003399
  187. puts("Work-around for Erratum IFC A-003399 enabled\n");
  188. #endif
  189. #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_DDR120
  190. if ((SVR_MAJ(svr) == 1) || IS_SVR_REV(svr, 2, 0))
  191. puts("Work-around for Erratum NMG DDR120 enabled\n");
  192. #endif
  193. #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_LBC103
  194. puts("Work-around for Erratum NMG_LBC103 enabled\n");
  195. #endif
  196. #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_ETSEC129
  197. if ((SVR_MAJ(svr) == 1) || IS_SVR_REV(svr, 2, 0))
  198. puts("Work-around for Erratum NMG ETSEC129 enabled\n");
  199. #endif
  200. #ifdef CONFIG_SYS_FSL_ERRATUM_A004510
  201. puts("Work-around for Erratum A004510 enabled\n");
  202. #endif
  203. #ifdef CONFIG_SYS_FSL_ERRATUM_SRIO_A004034
  204. puts("Work-around for Erratum SRIO-A004034 enabled\n");
  205. #endif
  206. #ifdef CONFIG_SYS_FSL_ERRATUM_A_004934
  207. puts("Work-around for Erratum A004934 enabled\n");
  208. #endif
  209. #ifdef CONFIG_SYS_FSL_ERRATUM_A005871
  210. if (IS_SVR_REV(svr, 1, 0))
  211. puts("Work-around for Erratum A005871 enabled\n");
  212. #endif
  213. #ifdef CONFIG_SYS_FSL_ERRATUM_A004849
  214. /* This work-around is implemented in PBI, so just check for it */
  215. check_erratum_a4849(svr);
  216. #endif
  217. #ifdef CONFIG_SYS_FSL_ERRATUM_A004580
  218. /* This work-around is implemented in PBI, so just check for it */
  219. check_erratum_a4580(svr);
  220. #endif
  221. #ifdef CONFIG_SYS_P4080_ERRATUM_PCIE_A003
  222. puts("Work-around for Erratum PCIe-A003 enabled\n");
  223. #endif
  224. #ifdef CONFIG_SYS_FSL_ERRATUM_USB14
  225. puts("Work-around for Erratum USB14 enabled\n");
  226. #endif
  227. #ifdef CONFIG_SYS_FSL_ERRATUM_A006593
  228. puts("Work-around for Erratum A006593 enabled\n");
  229. #endif
  230. #ifdef CONFIG_SYS_FSL_ERRATUM_A005812
  231. puts("Work-around for Erratum A-005812 enabled\n");
  232. #endif
  233. return 0;
  234. }
  235. U_BOOT_CMD(
  236. errata, 1, 0, do_errata,
  237. "Report errata workarounds",
  238. ""
  239. );