blob: 89ae73f2ba482ada9e215665a6e882f88529227c [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Sriram Dash9e8da5c2016-06-13 09:58:34 +05302/*
3 * Freescale USB Controller
4 *
5 * Copyright 2013 Freescale Semiconductor, Inc.
Sriram Dash9e8da5c2016-06-13 09:58:34 +05306 */
7
Chris Packham434f0582018-10-04 20:03:53 +13008#include <hwconfig.h>
Sriram Dash9e8da5c2016-06-13 09:58:34 +05309#include <fsl_errata.h>
10#include<fsl_usb.h>
Simon Glass89e0a3a2017-05-17 08:23:10 -060011#if defined(CONFIG_FSL_LSCH2) || defined(CONFIG_FSL_LSCH3) || \
12 defined(CONFIG_ARM)
Simon Glass243182c2017-05-17 08:23:06 -060013#include <asm/arch/clock.h>
14#endif
Sriram Dash9e8da5c2016-06-13 09:58:34 +053015
16/* USB Erratum Checking code */
17#if defined(CONFIG_PPC) || defined(CONFIG_ARM)
18bool has_dual_phy(void)
19{
20 u32 svr = get_svr();
21 u32 soc = SVR_SOC_VER(svr);
22
23 switch (soc) {
24#ifdef CONFIG_PPC
25 case SVR_T1023:
26 case SVR_T1024:
27 case SVR_T1013:
28 case SVR_T1014:
29 return IS_SVR_REV(svr, 1, 0);
30 case SVR_T1040:
31 case SVR_T1042:
32 case SVR_T1020:
33 case SVR_T1022:
34 case SVR_T2080:
35 case SVR_T2081:
36 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
37 case SVR_T4240:
38 case SVR_T4160:
39 case SVR_T4080:
40 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
41#endif
42 }
43
44 return false;
45}
46
Chris Packham434f0582018-10-04 20:03:53 +130047bool has_erratum_a005275(void)
48{
49 u32 svr = get_svr();
50 u32 soc = SVR_SOC_VER(svr);
51
52 if (hwconfig("no_erratum_a005275"))
53 return false;
54
55 switch (soc) {
56#ifdef CONFIG_PPC
57 case SVR_P3041:
58 case SVR_P2041:
59 case SVR_P2040:
60 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 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_P5040:
66 case SVR_P1010:
67 return IS_SVR_REV(svr, 1, 0);
68#endif
69 }
70
71 return false;
72}
73
Sriram Dash9e8da5c2016-06-13 09:58:34 +053074bool has_erratum_a006261(void)
75{
76 u32 svr = get_svr();
77 u32 soc = SVR_SOC_VER(svr);
78
79 switch (soc) {
80#ifdef CONFIG_PPC
81 case SVR_P1010:
82 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
83 case SVR_P2041:
84 case SVR_P2040:
85 return IS_SVR_REV(svr, 1, 0) ||
Sriram Dash5467da22016-08-17 11:47:54 +053086 IS_SVR_REV(svr, 1, 1) ||
87 IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1);
Sriram Dash9e8da5c2016-06-13 09:58:34 +053088 case SVR_P3041:
89 return IS_SVR_REV(svr, 1, 0) ||
90 IS_SVR_REV(svr, 1, 1) ||
91 IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1);
92 case SVR_P5010:
93 case SVR_P5020:
94 case SVR_P5021:
95 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
96 case SVR_T4240:
Sriram Dash9e8da5c2016-06-13 09:58:34 +053097 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
Sriram Dash9e8da5c2016-06-13 09:58:34 +053098 case SVR_P5040:
Sriram Dash5467da22016-08-17 11:47:54 +053099 return IS_SVR_REV(svr, 1, 0) ||
100 IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1);
Sriram Dash9e8da5c2016-06-13 09:58:34 +0530101#endif
102 }
103
104 return false;
105}
106
107bool has_erratum_a007075(void)
108{
109 u32 svr = get_svr();
110 u32 soc = SVR_SOC_VER(svr);
111
112 switch (soc) {
113#ifdef CONFIG_PPC
114 case SVR_B4860:
115 case SVR_B4420:
116 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
117 case SVR_P1010:
118 return IS_SVR_REV(svr, 1, 0);
119 case SVR_P4080:
120 return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
121#endif
122 }
123 return false;
124}
125
126bool has_erratum_a007798(void)
127{
128#ifdef CONFIG_PPC
129 return SVR_SOC_VER(get_svr()) == SVR_T4240 &&
130 IS_SVR_REV(get_svr(), 2, 0);
131#endif
132 return false;
133}
134
135bool has_erratum_a007792(void)
136{
137 u32 svr = get_svr();
138 u32 soc = SVR_SOC_VER(svr);
139
140 switch (soc) {
141#ifdef CONFIG_PPC
142 case SVR_T4240:
143 case SVR_T4160:
144 case SVR_T4080:
145 return IS_SVR_REV(svr, 2, 0);
146 case SVR_T1024:
147 case SVR_T1023:
148 return IS_SVR_REV(svr, 1, 0);
149 case SVR_T1040:
150 case SVR_T1042:
151 case SVR_T1020:
152 case SVR_T1022:
153 case SVR_T2080:
154 case SVR_T2081:
155 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
156#endif
157 }
158 return false;
159}
160
161bool has_erratum_a005697(void)
162{
163 u32 svr = get_svr();
164 u32 soc = SVR_SOC_VER(svr);
165
166 switch (soc) {
167#ifdef CONFIG_PPC
168 case SVR_9131:
169 case SVR_9132:
170 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
171#endif
jerry.huang@nxp.comf3dece72016-12-01 11:44:25 +0800172#ifdef ONFIG_ARM64
173 case SVR_LS1012A:
174 return IS_SVR_REV(svr, 1, 0);
175#endif
Sriram Dash9e8da5c2016-06-13 09:58:34 +0530176 }
177 return false;
178}
179
180bool has_erratum_a004477(void)
181{
182 u32 svr = get_svr();
183 u32 soc = SVR_SOC_VER(svr);
184
185 switch (soc) {
186#ifdef CONFIG_PPC
187 case SVR_P1010:
188 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
189 case SVR_P1022:
190 case SVR_9131:
191 case SVR_9132:
192 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
193 case SVR_P2020:
194 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0) ||
195 IS_SVR_REV(svr, 2, 1);
196 case SVR_B4860:
197 case SVR_B4420:
198 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
199 case SVR_P4080:
200 return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
201#endif
202 }
203
204 return false;
205}
206
Sriram Dash01820952016-06-13 09:58:36 +0530207bool has_erratum_a008751(void)
208{
209 u32 svr = get_svr();
210 u32 soc = SVR_SOC_VER(svr);
211
212 switch (soc) {
213#ifdef CONFIG_ARM64
Prabhakar Kushwahaac7f2422016-06-24 13:48:13 +0530214 case SVR_LS2080A:
215 case SVR_LS2085A:
Sriram Dash01820952016-06-13 09:58:36 +0530216 return IS_SVR_REV(svr, 1, 0);
217#endif
218 }
219 return false;
220}
221
Sriram Dasha1f422e2016-09-23 12:57:52 +0530222bool has_erratum_a010151(void)
223{
224 u32 svr = get_svr();
225 u32 soc = SVR_SOC_VER(svr);
226
Wenbin song5d8a61c2017-12-04 12:18:28 +0800227#ifdef CONFIG_ARM64
228 if (IS_SVR_DEV(svr, SVR_DEV(SVR_LS1043A)))
229 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
230#endif
231
Sriram Dasha1f422e2016-09-23 12:57:52 +0530232 switch (soc) {
233#ifdef CONFIG_ARM64
234 case SVR_LS2080A:
235 case SVR_LS2085A:
Santan Kumar53c62262017-06-09 11:48:07 +0530236 /* fallthrough */
237 case SVR_LS2088A:
238 /* fallthrough */
239 case SVR_LS2081A:
Sriram Dasha1f422e2016-09-23 12:57:52 +0530240 case SVR_LS1046A:
241 case SVR_LS1012A:
242 return IS_SVR_REV(svr, 1, 0);
Sriram Dasha1f422e2016-09-23 12:57:52 +0530243#endif
York Sunc4f047c2017-03-27 11:41:03 -0700244#ifdef CONFIG_ARCH_LS1021A
Sriram Dasha1f422e2016-09-23 12:57:52 +0530245 case SOC_VER_LS1020:
246 case SOC_VER_LS1021:
247 case SOC_VER_LS1022:
248 case SOC_VER_SLS1020:
249 return IS_SVR_REV(svr, 2, 0);
250#endif
251 }
252 return false;
253}
254
Sriram Dash9e8da5c2016-06-13 09:58:34 +0530255#endif