2 * Copyright 2010-2011 Freescale Semiconductor, Inc.
4 * SPDX-License-Identifier: GPL-2.0+
9 #include <linux/compiler.h>
10 #include <asm/fsl_errata.h>
11 #include <asm/processor.h>
12 #include "fsl_corenet_serdes.h"
14 #ifdef CONFIG_SYS_FSL_ERRATUM_A004849
16 * This work-around is implemented in PBI, so just check to see if the
17 * work-around was actually applied. To do this, we check for specific data
18 * at specific addresses in DCSR.
20 * Array offsets[] contains a list of offsets within DCSR. According to the
21 * erratum document, the value at each offset should be 2.
23 static void check_erratum_a4849(uint32_t svr)
25 void __iomem *dcsr = (void *)CONFIG_SYS_DCSRBAR + 0xb0000;
28 #if defined(CONFIG_PPC_P2041) || defined(CONFIG_PPC_P3041)
29 static const uint8_t offsets[] = {
30 0x50, 0x54, 0x58, 0x90, 0x94, 0x98
33 #ifdef CONFIG_PPC_P4080
34 static const uint8_t offsets[] = {
35 0x60, 0x64, 0x68, 0x6c, 0xa0, 0xa4, 0xa8, 0xac
38 uint32_t x108; /* The value that should be at offset 0x108 */
40 for (i = 0; i < ARRAY_SIZE(offsets); i++) {
41 if (in_be32(dcsr + offsets[i]) != 2) {
42 printf("Work-around for Erratum A004849 is not enabled\n");
47 #if defined(CONFIG_PPC_P2041) || defined(CONFIG_PPC_P3041)
51 #ifdef CONFIG_PPC_P4080
53 * For P4080, the erratum document says that the value at offset 0x108
54 * should be 0x12 on rev2, or 0x1c on rev3.
56 if (SVR_MAJ(svr) == 2)
58 if (SVR_MAJ(svr) == 3)
62 if (in_be32(dcsr + 0x108) != x108) {
63 printf("Work-around for Erratum A004849 is not enabled\n");
67 /* Everything matches, so the erratum work-around was applied */
69 printf("Work-around for Erratum A004849 enabled\n");
73 #ifdef CONFIG_SYS_FSL_ERRATUM_A004580
75 * This work-around is implemented in PBI, so just check to see if the
76 * work-around was actually applied. To do this, we check for specific data
77 * at specific addresses in the SerDes register block.
79 * The work-around says that for each SerDes lane, write BnTTLCRy0 =
80 * 0x1B00_0001, Register 2 = 0x0088_0000, and Register 3 = 0x4000_0000.
83 static void check_erratum_a4580(uint32_t svr)
85 const serdes_corenet_t __iomem *srds_regs =
86 (void *)CONFIG_SYS_FSL_CORENET_SERDES_ADDR;
89 for (lane = 0; lane < SRDS_MAX_LANES; lane++) {
90 if (serdes_lane_enabled(lane)) {
91 const struct serdes_lane __iomem *srds_lane =
92 &srds_regs->lane[serdes_get_lane_idx(lane)];
95 * Verify that the values we were supposed to write in
96 * the PBI are actually there. Also, the lower 15
97 * bits of res4[3] should be the same as the upper 15
100 if ((in_be32(&srds_lane->ttlcr0) != 0x1b000001) ||
101 (in_be32(&srds_lane->res4[1]) != 0x880000) ||
102 (in_be32(&srds_lane->res4[3]) != 0x40000044)) {
103 printf("Work-around for Erratum A004580 is "
110 /* Everything matches, so the erratum work-around was applied */
112 printf("Work-around for Erratum A004580 enabled\n");
116 #ifdef CONFIG_SYS_FSL_ERRATUM_A007212
118 * This workaround can be implemented in PBI, or by u-boot.
120 static void check_erratum_a007212(void)
122 u32 __iomem *plldgdcr = (void *)(CONFIG_SYS_DCSRBAR + 0x21c20);
124 if (in_be32(plldgdcr) & 0x1fe) {
125 /* check if PLL ratio is set by workaround */
126 puts("Work-around for Erratum A007212 enabled\n");
131 static int do_errata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
133 #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_CPU_A011
134 extern int enable_cpu_a011_workaround;
136 __maybe_unused u32 svr = get_svr();
138 #if defined(CONFIG_FSL_SATA_V2) && defined(CONFIG_FSL_SATA_ERRATUM_A001)
139 if (IS_SVR_REV(svr, 1, 0)) {
140 switch (SVR_SOC_VER(svr)) {
143 puts("Work-around for Erratum SATA A001 enabled\n");
148 #if defined(CONFIG_SYS_P4080_ERRATUM_SERDES8)
149 puts("Work-around for Erratum SERDES8 enabled\n");
151 #if defined(CONFIG_SYS_P4080_ERRATUM_SERDES9)
152 puts("Work-around for Erratum SERDES9 enabled\n");
154 #if defined(CONFIG_SYS_P4080_ERRATUM_SERDES_A005)
155 puts("Work-around for Erratum SERDES-A005 enabled\n");
157 #if defined(CONFIG_SYS_P4080_ERRATUM_CPU22)
158 if (SVR_MAJ(svr) < 3)
159 puts("Work-around for Erratum CPU22 enabled\n");
161 #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_CPU_A011
163 * NMG_CPU_A011 applies to P4080 rev 1.0, 2.0, fixed in 3.0
164 * also applies to P3041 rev 1.0, 1.1, P2041 rev 1.0, 1.1
165 * The SVR has been checked by cpu_init_r().
167 if (enable_cpu_a011_workaround)
168 puts("Work-around for Erratum CPU-A011 enabled\n");
170 #if defined(CONFIG_SYS_FSL_ERRATUM_CPU_A003999)
171 puts("Work-around for Erratum CPU-A003999 enabled\n");
173 #if defined(CONFIG_SYS_FSL_ERRATUM_DDR_A003474)
174 puts("Work-around for Erratum DDR-A003474 enabled\n");
176 #if defined(CONFIG_SYS_FSL_ERRATUM_DDR_MSYNC_IN)
177 puts("Work-around for DDR MSYNC_IN Erratum enabled\n");
179 #if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC111)
180 puts("Work-around for Erratum ESDHC111 enabled\n");
182 #ifdef CONFIG_SYS_FSL_ERRATUM_A004468
183 puts("Work-around for Erratum A004468 enabled\n");
185 #if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC135)
186 puts("Work-around for Erratum ESDHC135 enabled\n");
188 #if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC13)
189 if (SVR_MAJ(svr) < 3)
190 puts("Work-around for Erratum ESDHC13 enabled\n");
192 #if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC_A001)
193 puts("Work-around for Erratum ESDHC-A001 enabled\n");
195 #ifdef CONFIG_SYS_FSL_ERRATUM_CPC_A002
196 puts("Work-around for Erratum CPC-A002 enabled\n");
198 #ifdef CONFIG_SYS_FSL_ERRATUM_CPC_A003
199 puts("Work-around for Erratum CPC-A003 enabled\n");
201 #ifdef CONFIG_SYS_FSL_ERRATUM_ELBC_A001
202 puts("Work-around for Erratum ELBC-A001 enabled\n");
204 #ifdef CONFIG_SYS_FSL_ERRATUM_DDR_A003
205 puts("Work-around for Erratum DDR-A003 enabled\n");
207 #ifdef CONFIG_SYS_FSL_ERRATUM_DDR_115
208 puts("Work-around for Erratum DDR115 enabled\n");
210 #ifdef CONFIG_SYS_FSL_ERRATUM_DDR111_DDR134
211 puts("Work-around for Erratum DDR111 enabled\n");
212 puts("Work-around for Erratum DDR134 enabled\n");
214 #ifdef CONFIG_SYS_FSL_ERRATUM_IFC_A002769
215 puts("Work-around for Erratum IFC-A002769 enabled\n");
217 #ifdef CONFIG_SYS_FSL_ERRATUM_P1010_A003549
218 puts("Work-around for Erratum P1010-A003549 enabled\n");
220 #ifdef CONFIG_SYS_FSL_ERRATUM_IFC_A003399
221 puts("Work-around for Erratum IFC A-003399 enabled\n");
223 #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_DDR120
224 if ((SVR_MAJ(svr) == 1) || IS_SVR_REV(svr, 2, 0))
225 puts("Work-around for Erratum NMG DDR120 enabled\n");
227 #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_LBC103
228 puts("Work-around for Erratum NMG_LBC103 enabled\n");
230 #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_ETSEC129
231 if ((SVR_MAJ(svr) == 1) || IS_SVR_REV(svr, 2, 0))
232 puts("Work-around for Erratum NMG ETSEC129 enabled\n");
234 #ifdef CONFIG_SYS_FSL_ERRATUM_A004510
235 puts("Work-around for Erratum A004510 enabled\n");
237 #ifdef CONFIG_SYS_FSL_ERRATUM_SRIO_A004034
238 puts("Work-around for Erratum SRIO-A004034 enabled\n");
240 #ifdef CONFIG_SYS_FSL_ERRATUM_A_004934
241 puts("Work-around for Erratum A004934 enabled\n");
243 #ifdef CONFIG_SYS_FSL_ERRATUM_A005871
244 if (IS_SVR_REV(svr, 1, 0))
245 puts("Work-around for Erratum A005871 enabled\n");
247 #ifdef CONFIG_SYS_FSL_ERRATUM_A006475
248 if (SVR_MAJ(get_svr()) == 1)
249 puts("Work-around for Erratum A006475 enabled\n");
251 #ifdef CONFIG_SYS_FSL_ERRATUM_A006384
252 if (SVR_MAJ(get_svr()) == 1)
253 puts("Work-around for Erratum A006384 enabled\n");
255 #ifdef CONFIG_SYS_FSL_ERRATUM_A004849
256 /* This work-around is implemented in PBI, so just check for it */
257 check_erratum_a4849(svr);
259 #ifdef CONFIG_SYS_FSL_ERRATUM_A004580
260 /* This work-around is implemented in PBI, so just check for it */
261 check_erratum_a4580(svr);
263 #ifdef CONFIG_SYS_P4080_ERRATUM_PCIE_A003
264 puts("Work-around for Erratum PCIe-A003 enabled\n");
266 #ifdef CONFIG_SYS_FSL_ERRATUM_USB14
267 puts("Work-around for Erratum USB14 enabled\n");
269 #ifdef CONFIG_SYS_FSL_ERRATUM_A006593
270 puts("Work-around for Erratum A006593 enabled\n");
272 #ifdef CONFIG_SYS_FSL_ERRATUM_A006379
273 if (has_erratum_a006379())
274 puts("Work-around for Erratum A006379 enabled\n");
276 #ifdef CONFIG_SYS_FSL_ERRATUM_SEC_A003571
277 if (IS_SVR_REV(svr, 1, 0))
278 puts("Work-around for Erratum A003571 enabled\n");
280 #ifdef CONFIG_SYS_FSL_ERRATUM_A005812
281 puts("Work-around for Erratum A-005812 enabled\n");
283 #ifdef CONFIG_SYS_FSL_ERRATUM_A005125
284 puts("Work-around for Erratum A005125 enabled\n");
286 #ifdef CONFIG_SYS_FSL_ERRATUM_A007075
287 if (has_erratum_a007075())
288 puts("Work-around for Erratum A007075 enabled\n");
290 #ifdef CONFIG_SYS_FSL_ERRATUM_I2C_A004447
291 if ((SVR_SOC_VER(svr) == SVR_8548 && IS_SVR_REV(svr, 3, 1)) ||
292 (SVR_REV(svr) <= CONFIG_SYS_FSL_A004447_SVR_REV))
293 puts("Work-around for Erratum I2C-A004447 enabled\n");
295 #ifdef CONFIG_SYS_FSL_ERRATUM_A006261
296 if (has_erratum_a006261())
297 puts("Work-around for Erratum A006261 enabled\n");
299 #ifdef CONFIG_SYS_FSL_ERRATUM_A007212
300 check_erratum_a007212();
307 errata, 1, 0, do_errata,
308 "Report errata workarounds",