cmd_errata.c 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*
  2. * Copyright 2010-2011 Freescale Semiconductor, Inc.
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #include <common.h>
  23. #include <command.h>
  24. #include <linux/compiler.h>
  25. #include <asm/processor.h>
  26. #ifdef CONFIG_SYS_FSL_ERRATUM_A004849
  27. /*
  28. * This work-around is implemented in PBI, so just check to see if the
  29. * work-around was actually applied. To do this, we check for specific data
  30. * at specific addresses in DCSR.
  31. *
  32. * Array offsets[] contains a list of offsets within DCSR. According to the
  33. * erratum document, the value at each offset should be 2.
  34. */
  35. static void check_erratum_a4849(uint32_t svr)
  36. {
  37. void __iomem *dcsr = (void *)CONFIG_SYS_DCSRBAR + 0xb0000;
  38. unsigned int i;
  39. #if defined(CONFIG_PPC_P2041) || defined(CONFIG_PPC_P3041)
  40. static const uint8_t offsets[] = {
  41. 0x50, 0x54, 0x58, 0x90, 0x94, 0x98
  42. };
  43. #endif
  44. #ifdef CONFIG_PPC_P4080
  45. static const uint8_t offsets[] = {
  46. 0x60, 0x64, 0x68, 0x6c, 0xa0, 0xa4, 0xa8, 0xac
  47. };
  48. #endif
  49. uint32_t x108; /* The value that should be at offset 0x108 */
  50. for (i = 0; i < ARRAY_SIZE(offsets); i++) {
  51. if (in_be32(dcsr + offsets[i]) != 2) {
  52. printf("Work-around for Erratum A004849 is not enabled\n");
  53. return;
  54. }
  55. }
  56. #if defined(CONFIG_PPC_P2041) || defined(CONFIG_PPC_P3041)
  57. x108 = 0x12;
  58. #endif
  59. #ifdef CONFIG_PPC_P4080
  60. /*
  61. * For P4080, the erratum document says that the value at offset 0x108
  62. * should be 0x12 on rev2, or 0x1c on rev3.
  63. */
  64. if (SVR_MAJ(svr) == 2)
  65. x108 = 0x12;
  66. if (SVR_MAJ(svr) == 3)
  67. x108 = 0x1c;
  68. #endif
  69. if (in_be32(dcsr + 0x108) != x108) {
  70. printf("Work-around for Erratum A004849 is not enabled\n");
  71. return;
  72. }
  73. /* Everything matches, so the erratum work-around was applied */
  74. printf("Work-around for Erratum A004849 enabled\n");
  75. }
  76. #endif
  77. static int do_errata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  78. {
  79. #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_CPU_A011
  80. extern int enable_cpu_a011_workaround;
  81. #endif
  82. __maybe_unused u32 svr = get_svr();
  83. #if defined(CONFIG_FSL_SATA_V2) && defined(CONFIG_FSL_SATA_ERRATUM_A001)
  84. if (IS_SVR_REV(svr, 1, 0)) {
  85. switch (SVR_SOC_VER(svr)) {
  86. case SVR_P1013:
  87. case SVR_P1022:
  88. puts("Work-around for Erratum SATA A001 enabled\n");
  89. }
  90. }
  91. #endif
  92. #if defined(CONFIG_SYS_P4080_ERRATUM_SERDES8)
  93. puts("Work-around for Erratum SERDES8 enabled\n");
  94. #endif
  95. #if defined(CONFIG_SYS_P4080_ERRATUM_SERDES9)
  96. puts("Work-around for Erratum SERDES9 enabled\n");
  97. #endif
  98. #if defined(CONFIG_SYS_P4080_ERRATUM_SERDES_A005)
  99. puts("Work-around for Erratum SERDES-A005 enabled\n");
  100. #endif
  101. #if defined(CONFIG_SYS_P4080_ERRATUM_CPU22)
  102. if (SVR_MAJ(svr) < 3)
  103. puts("Work-around for Erratum CPU22 enabled\n");
  104. #endif
  105. #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_CPU_A011
  106. /*
  107. * NMG_CPU_A011 applies to P4080 rev 1.0, 2.0, fixed in 3.0
  108. * also applies to P3041 rev 1.0, 1.1, P2041 rev 1.0, 1.1
  109. * The SVR has been checked by cpu_init_r().
  110. */
  111. if (enable_cpu_a011_workaround)
  112. puts("Work-around for Erratum CPU-A011 enabled\n");
  113. #endif
  114. #if defined(CONFIG_SYS_FSL_ERRATUM_CPU_A003999)
  115. puts("Work-around for Erratum CPU-A003999 enabled\n");
  116. #endif
  117. #if defined(CONFIG_SYS_FSL_ERRATUM_DDR_A003474)
  118. puts("Work-around for Erratum DDR-A003473 enabled\n");
  119. #endif
  120. #if defined(CONFIG_SYS_FSL_ERRATUM_DDR_MSYNC_IN)
  121. puts("Work-around for DDR MSYNC_IN Erratum enabled\n");
  122. #endif
  123. #if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC111)
  124. puts("Work-around for Erratum ESDHC111 enabled\n");
  125. #endif
  126. #ifdef CONFIG_SYS_FSL_ERRATUM_A004468
  127. puts("Work-around for Erratum A004468 enabled\n");
  128. #endif
  129. #if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC135)
  130. puts("Work-around for Erratum ESDHC135 enabled\n");
  131. #endif
  132. #if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC13)
  133. if (SVR_MAJ(svr) < 3)
  134. puts("Work-around for Erratum ESDHC13 enabled\n");
  135. #endif
  136. #if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC_A001)
  137. puts("Work-around for Erratum ESDHC-A001 enabled\n");
  138. #endif
  139. #ifdef CONFIG_SYS_FSL_ERRATUM_CPC_A002
  140. puts("Work-around for Erratum CPC-A002 enabled\n");
  141. #endif
  142. #ifdef CONFIG_SYS_FSL_ERRATUM_CPC_A003
  143. puts("Work-around for Erratum CPC-A003 enabled\n");
  144. #endif
  145. #ifdef CONFIG_SYS_FSL_ERRATUM_ELBC_A001
  146. puts("Work-around for Erratum ELBC-A001 enabled\n");
  147. #endif
  148. #ifdef CONFIG_SYS_FSL_ERRATUM_DDR_A003
  149. puts("Work-around for Erratum DDR-A003 enabled\n");
  150. #endif
  151. #ifdef CONFIG_SYS_FSL_ERRATUM_DDR_115
  152. puts("Work-around for Erratum DDR115 enabled\n");
  153. #endif
  154. #ifdef CONFIG_SYS_FSL_ERRATUM_DDR111_DDR134
  155. puts("Work-around for Erratum DDR111 enabled\n");
  156. puts("Work-around for Erratum DDR134 enabled\n");
  157. #endif
  158. #ifdef CONFIG_SYS_FSL_ERRATUM_IFC_A002769
  159. puts("Work-around for Erratum IFC-A002769 enabled\n");
  160. #endif
  161. #ifdef CONFIG_SYS_FSL_ERRATUM_P1010_A003549
  162. puts("Work-around for Erratum P1010-A003549 enabled\n");
  163. #endif
  164. #ifdef CONFIG_SYS_FSL_ERRATUM_IFC_A003399
  165. puts("Work-around for Erratum IFC A-003399 enabled\n");
  166. #endif
  167. #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_DDR120
  168. if ((SVR_MAJ(svr) == 1) || IS_SVR_REV(svr, 2, 0))
  169. puts("Work-around for Erratum NMG DDR120 enabled\n");
  170. #endif
  171. #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_LBC103
  172. puts("Work-around for Erratum NMG_LBC103 enabled\n");
  173. #endif
  174. #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_ETSEC129
  175. if ((SVR_MAJ(svr) == 1) || IS_SVR_REV(svr, 2, 0))
  176. puts("Work-around for Erratum NMG ETSEC129 enabled\n");
  177. #endif
  178. #ifdef CONFIG_SYS_FSL_ERRATUM_A004510
  179. puts("Work-around for Erratum A004510 enabled\n");
  180. #endif
  181. #ifdef CONFIG_SYS_FSL_ERRATUM_SRIO_A004034
  182. puts("Work-around for Erratum SRIO-A004034 enabled\n");
  183. #endif
  184. #ifdef CONFIG_SYS_FSL_ERRATUM_A_004934
  185. puts("Work-around for Erratum A004934 enabled\n");
  186. #endif
  187. #ifdef CONFIG_SYS_FSL_ERRATUM_A004849
  188. /* This work-around is implemented in PBI, so just check for it */
  189. check_erratum_a4849(svr);
  190. #endif
  191. return 0;
  192. }
  193. U_BOOT_CMD(
  194. errata, 1, 0, do_errata,
  195. "Report errata workarounds",
  196. ""
  197. );