xref: /openbmc/u-boot/drivers/usb/common/fsl-errata.c (revision ce2f2d2a)
1 /*
2  * Freescale USB Controller
3  *
4  * Copyright 2013 Freescale Semiconductor, Inc.
5  *
6  * SPDX-License-Identifier:	GPL-2.0+
7  */
8 
9 #include <common.h>
10 #include <fsl_errata.h>
11 #include<fsl_usb.h>
12 
13 /* USB Erratum Checking code */
14 #if defined(CONFIG_PPC) || defined(CONFIG_ARM)
15 bool has_dual_phy(void)
16 {
17 	u32 svr = get_svr();
18 	u32 soc = SVR_SOC_VER(svr);
19 
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 
41 	return false;
42 }
43 
44 bool has_erratum_a006261(void)
45 {
46 	u32 svr = get_svr();
47 	u32 soc = SVR_SOC_VER(svr);
48 
49 	switch (soc) {
50 #ifdef CONFIG_PPC
51 	case SVR_P1010:
52 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
53 	case SVR_P2041:
54 	case SVR_P2040:
55 		return IS_SVR_REV(svr, 1, 0) ||
56 			IS_SVR_REV(svr, 1, 1) || IS_SVR_REV(svr, 2, 1);
57 	case SVR_P3041:
58 		return IS_SVR_REV(svr, 1, 0) ||
59 			IS_SVR_REV(svr, 1, 1) ||
60 			IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1);
61 	case SVR_P5010:
62 	case SVR_P5020:
63 	case SVR_P5021:
64 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
65 	case SVR_T4240:
66 	case SVR_T4160:
67 	case SVR_T4080:
68 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
69 	case SVR_T1040:
70 		return IS_SVR_REV(svr, 1, 0);
71 	case SVR_T2080:
72 	case SVR_T2081:
73 		return IS_SVR_REV(svr, 1, 0);
74 	case SVR_P5040:
75 		return IS_SVR_REV(svr, 1, 0);
76 #endif
77 	}
78 
79 	return false;
80 }
81 
82 bool has_erratum_a007075(void)
83 {
84 	u32 svr = get_svr();
85 	u32 soc = SVR_SOC_VER(svr);
86 
87 	switch (soc) {
88 #ifdef CONFIG_PPC
89 	case SVR_B4860:
90 	case SVR_B4420:
91 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
92 	case SVR_P1010:
93 		return IS_SVR_REV(svr, 1, 0);
94 	case SVR_P4080:
95 		return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
96 #endif
97 	}
98 	return false;
99 }
100 
101 bool has_erratum_a007798(void)
102 {
103 #ifdef CONFIG_PPC
104 	return SVR_SOC_VER(get_svr()) == SVR_T4240 &&
105 		IS_SVR_REV(get_svr(), 2, 0);
106 #endif
107 	return false;
108 }
109 
110 bool has_erratum_a007792(void)
111 {
112 	u32 svr = get_svr();
113 	u32 soc = SVR_SOC_VER(svr);
114 
115 	switch (soc) {
116 #ifdef CONFIG_PPC
117 	case SVR_T4240:
118 	case SVR_T4160:
119 	case SVR_T4080:
120 		return IS_SVR_REV(svr, 2, 0);
121 	case SVR_T1024:
122 	case SVR_T1023:
123 		return IS_SVR_REV(svr, 1, 0);
124 	case SVR_T1040:
125 	case SVR_T1042:
126 	case SVR_T1020:
127 	case SVR_T1022:
128 	case SVR_T2080:
129 	case SVR_T2081:
130 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
131 #endif
132 	}
133 	return false;
134 }
135 
136 bool has_erratum_a005697(void)
137 {
138 	u32 svr = get_svr();
139 	u32 soc = SVR_SOC_VER(svr);
140 
141 	switch (soc) {
142 #ifdef CONFIG_PPC
143 	case SVR_9131:
144 	case SVR_9132:
145 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
146 #endif
147 	}
148 	return false;
149 }
150 
151 bool has_erratum_a004477(void)
152 {
153 	u32 svr = get_svr();
154 	u32 soc = SVR_SOC_VER(svr);
155 
156 	switch (soc) {
157 #ifdef CONFIG_PPC
158 	case SVR_P1010:
159 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
160 	case SVR_P1022:
161 	case SVR_9131:
162 	case SVR_9132:
163 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
164 	case SVR_P2020:
165 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0) ||
166 			IS_SVR_REV(svr, 2, 1);
167 	case SVR_B4860:
168 	case SVR_B4420:
169 		return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
170 	case SVR_P4080:
171 		return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
172 #endif
173 	}
174 
175 	return false;
176 }
177 
178 bool has_erratum_a008751(void)
179 {
180 	u32 svr = get_svr();
181 	u32 soc = SVR_SOC_VER(svr);
182 
183 	switch (soc) {
184 #ifdef CONFIG_ARM64
185 	case SVR_LS2080A:
186 	case SVR_LS2085A:
187 		return IS_SVR_REV(svr, 1, 0);
188 #endif
189 	}
190 	return false;
191 }
192 
193 #endif
194