blob: 9eb1d23067253ea1c489fc08a05396b0883004c9 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Sriram Dash92623672016-06-13 09:58:34 +05302/*
3 * Freescale USB Controller
4 *
5 * Copyright 2013 Freescale Semiconductor, Inc.
Sriram Dash92623672016-06-13 09:58:34 +05306 */
7
8#include <common.h>
Chris Packham4eaf7f52018-10-04 20:03:53 +13009#include <hwconfig.h>
Sriram Dash92623672016-06-13 09:58:34 +053010#include <fsl_errata.h>
11#include<fsl_usb.h>
Simon Glass457e51c2017-05-17 08:23:10 -060012#if defined(CONFIG_FSL_LSCH2) || defined(CONFIG_FSL_LSCH3) || \
13 defined(CONFIG_ARM)
Simon Glass6e2941d2017-05-17 08:23:06 -060014#include <asm/arch/clock.h>
15#endif
Sriram Dash92623672016-06-13 09:58:34 +053016
17/* USB Erratum Checking code */
18#if defined(CONFIG_PPC) || defined(CONFIG_ARM)
19bool has_dual_phy(void)
20{
21 u32 svr = get_svr();
22 u32 soc = SVR_SOC_VER(svr);
23
24 switch (soc) {
25#ifdef CONFIG_PPC
26 case SVR_T1023:
27 case SVR_T1024:
28 case SVR_T1013:
29 case SVR_T1014:
30 return IS_SVR_REV(svr, 1, 0);
31 case SVR_T1040:
32 case SVR_T1042:
33 case SVR_T1020:
34 case SVR_T1022:
35 case SVR_T2080:
36 case SVR_T2081:
37 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
38 case SVR_T4240:
39 case SVR_T4160:
40 case SVR_T4080:
41 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
42#endif
43 }
44
45 return false;
46}
47
Chris Packham4eaf7f52018-10-04 20:03:53 +130048bool has_erratum_a005275(void)
49{
50 u32 svr = get_svr();
51 u32 soc = SVR_SOC_VER(svr);
52
53 if (hwconfig("no_erratum_a005275"))
54 return false;
55
56 switch (soc) {
57#ifdef CONFIG_PPC
58 case SVR_P3041:
59 case SVR_P2041:
60 case SVR_P2040:
61 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
62 case SVR_P5010:
63 case SVR_P5020:
64 case SVR_P5021:
65 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
66 case SVR_P5040:
67 case SVR_P1010:
68 return IS_SVR_REV(svr, 1, 0);
69#endif
70 }
71
72 return false;
73}
74
Sriram Dash92623672016-06-13 09:58:34 +053075bool has_erratum_a006261(void)
76{
77 u32 svr = get_svr();
78 u32 soc = SVR_SOC_VER(svr);
79
80 switch (soc) {
81#ifdef CONFIG_PPC
82 case SVR_P1010:
83 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
84 case SVR_P2041:
85 case SVR_P2040:
86 return IS_SVR_REV(svr, 1, 0) ||
Sriram Dashf413d1c2016-08-17 11:47:54 +053087 IS_SVR_REV(svr, 1, 1) ||
88 IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1);
Sriram Dash92623672016-06-13 09:58:34 +053089 case SVR_P3041:
90 return IS_SVR_REV(svr, 1, 0) ||
91 IS_SVR_REV(svr, 1, 1) ||
92 IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1);
93 case SVR_P5010:
94 case SVR_P5020:
95 case SVR_P5021:
96 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
97 case SVR_T4240:
Sriram Dash92623672016-06-13 09:58:34 +053098 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
Sriram Dash92623672016-06-13 09:58:34 +053099 case SVR_P5040:
Sriram Dashf413d1c2016-08-17 11:47:54 +0530100 return IS_SVR_REV(svr, 1, 0) ||
101 IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1);
Sriram Dash92623672016-06-13 09:58:34 +0530102#endif
103 }
104
105 return false;
106}
107
108bool has_erratum_a007075(void)
109{
110 u32 svr = get_svr();
111 u32 soc = SVR_SOC_VER(svr);
112
113 switch (soc) {
114#ifdef CONFIG_PPC
115 case SVR_B4860:
116 case SVR_B4420:
117 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
118 case SVR_P1010:
119 return IS_SVR_REV(svr, 1, 0);
120 case SVR_P4080:
121 return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
122#endif
123 }
124 return false;
125}
126
127bool has_erratum_a007798(void)
128{
129#ifdef CONFIG_PPC
130 return SVR_SOC_VER(get_svr()) == SVR_T4240 &&
131 IS_SVR_REV(get_svr(), 2, 0);
132#endif
133 return false;
134}
135
136bool has_erratum_a007792(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_T4240:
144 case SVR_T4160:
145 case SVR_T4080:
146 return IS_SVR_REV(svr, 2, 0);
147 case SVR_T1024:
148 case SVR_T1023:
149 return IS_SVR_REV(svr, 1, 0);
150 case SVR_T1040:
151 case SVR_T1042:
152 case SVR_T1020:
153 case SVR_T1022:
154 case SVR_T2080:
155 case SVR_T2081:
156 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
157#endif
158 }
159 return false;
160}
161
162bool has_erratum_a005697(void)
163{
164 u32 svr = get_svr();
165 u32 soc = SVR_SOC_VER(svr);
166
167 switch (soc) {
168#ifdef CONFIG_PPC
169 case SVR_9131:
170 case SVR_9132:
171 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
172#endif
jerry.huang@nxp.com8545c542016-12-01 11:44:25 +0800173#ifdef ONFIG_ARM64
174 case SVR_LS1012A:
175 return IS_SVR_REV(svr, 1, 0);
176#endif
Sriram Dash92623672016-06-13 09:58:34 +0530177 }
178 return false;
179}
180
181bool has_erratum_a004477(void)
182{
183 u32 svr = get_svr();
184 u32 soc = SVR_SOC_VER(svr);
185
186 switch (soc) {
187#ifdef CONFIG_PPC
188 case SVR_P1010:
189 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
190 case SVR_P1022:
191 case SVR_9131:
192 case SVR_9132:
193 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
194 case SVR_P2020:
195 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0) ||
196 IS_SVR_REV(svr, 2, 1);
197 case SVR_B4860:
198 case SVR_B4420:
199 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
200 case SVR_P4080:
201 return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
202#endif
203 }
204
205 return false;
206}
207
Sriram Dashef53b8c2016-06-13 09:58:36 +0530208bool has_erratum_a008751(void)
209{
210 u32 svr = get_svr();
211 u32 soc = SVR_SOC_VER(svr);
212
213 switch (soc) {
214#ifdef CONFIG_ARM64
Prabhakar Kushwaha49cdce12016-06-24 13:48:13 +0530215 case SVR_LS2080A:
216 case SVR_LS2085A:
Sriram Dashef53b8c2016-06-13 09:58:36 +0530217 return IS_SVR_REV(svr, 1, 0);
218#endif
219 }
220 return false;
221}
222
Sriram Dash4c043712016-09-23 12:57:52 +0530223bool has_erratum_a010151(void)
224{
225 u32 svr = get_svr();
226 u32 soc = SVR_SOC_VER(svr);
227
Wenbin songa8f33032017-12-04 12:18:28 +0800228#ifdef CONFIG_ARM64
229 if (IS_SVR_DEV(svr, SVR_DEV(SVR_LS1043A)))
230 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
231#endif
232
Sriram Dash4c043712016-09-23 12:57:52 +0530233 switch (soc) {
234#ifdef CONFIG_ARM64
235 case SVR_LS2080A:
236 case SVR_LS2085A:
Santan Kumare4783072017-06-09 11:48:07 +0530237 /* fallthrough */
238 case SVR_LS2088A:
239 /* fallthrough */
240 case SVR_LS2081A:
Sriram Dash4c043712016-09-23 12:57:52 +0530241 case SVR_LS1046A:
242 case SVR_LS1012A:
243 return IS_SVR_REV(svr, 1, 0);
Sriram Dash4c043712016-09-23 12:57:52 +0530244#endif
York Sun73fb5832017-03-27 11:41:03 -0700245#ifdef CONFIG_ARCH_LS1021A
Sriram Dash4c043712016-09-23 12:57:52 +0530246 case SOC_VER_LS1020:
247 case SOC_VER_LS1021:
248 case SOC_VER_LS1022:
249 case SOC_VER_SLS1020:
250 return IS_SVR_REV(svr, 2, 0);
251#endif
252 }
253 return false;
254}
255
Sriram Dash92623672016-06-13 09:58:34 +0530256#endif