blob: 386130d7a1f6e7756835309eb08f67f6e397f3b0 [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
8#include <common.h>
9#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
47bool has_erratum_a006261(void)
48{
49 u32 svr = get_svr();
50 u32 soc = SVR_SOC_VER(svr);
51
52 switch (soc) {
53#ifdef CONFIG_PPC
54 case SVR_P1010:
55 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
56 case SVR_P2041:
57 case SVR_P2040:
58 return IS_SVR_REV(svr, 1, 0) ||
Sriram Dash5467da22016-08-17 11:47:54 +053059 IS_SVR_REV(svr, 1, 1) ||
60 IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1);
Sriram Dash9e8da5c2016-06-13 09:58:34 +053061 case SVR_P3041:
62 return IS_SVR_REV(svr, 1, 0) ||
63 IS_SVR_REV(svr, 1, 1) ||
64 IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1);
65 case SVR_P5010:
66 case SVR_P5020:
67 case SVR_P5021:
68 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
69 case SVR_T4240:
Sriram Dash9e8da5c2016-06-13 09:58:34 +053070 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
Sriram Dash9e8da5c2016-06-13 09:58:34 +053071 case SVR_P5040:
Sriram Dash5467da22016-08-17 11:47:54 +053072 return IS_SVR_REV(svr, 1, 0) ||
73 IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1);
Sriram Dash9e8da5c2016-06-13 09:58:34 +053074#endif
75 }
76
77 return false;
78}
79
80bool has_erratum_a007075(void)
81{
82 u32 svr = get_svr();
83 u32 soc = SVR_SOC_VER(svr);
84
85 switch (soc) {
86#ifdef CONFIG_PPC
87 case SVR_B4860:
88 case SVR_B4420:
89 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
90 case SVR_P1010:
91 return IS_SVR_REV(svr, 1, 0);
92 case SVR_P4080:
93 return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
94#endif
95 }
96 return false;
97}
98
99bool has_erratum_a007798(void)
100{
101#ifdef CONFIG_PPC
102 return SVR_SOC_VER(get_svr()) == SVR_T4240 &&
103 IS_SVR_REV(get_svr(), 2, 0);
104#endif
105 return false;
106}
107
108bool has_erratum_a007792(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_T4240:
116 case SVR_T4160:
117 case SVR_T4080:
118 return IS_SVR_REV(svr, 2, 0);
119 case SVR_T1024:
120 case SVR_T1023:
121 return IS_SVR_REV(svr, 1, 0);
122 case SVR_T1040:
123 case SVR_T1042:
124 case SVR_T1020:
125 case SVR_T1022:
126 case SVR_T2080:
127 case SVR_T2081:
128 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
129#endif
130 }
131 return false;
132}
133
134bool has_erratum_a005697(void)
135{
136 u32 svr = get_svr();
137 u32 soc = SVR_SOC_VER(svr);
138
139 switch (soc) {
140#ifdef CONFIG_PPC
141 case SVR_9131:
142 case SVR_9132:
143 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
144#endif
jerry.huang@nxp.comf3dece72016-12-01 11:44:25 +0800145#ifdef ONFIG_ARM64
146 case SVR_LS1012A:
147 return IS_SVR_REV(svr, 1, 0);
148#endif
Sriram Dash9e8da5c2016-06-13 09:58:34 +0530149 }
150 return false;
151}
152
153bool has_erratum_a004477(void)
154{
155 u32 svr = get_svr();
156 u32 soc = SVR_SOC_VER(svr);
157
158 switch (soc) {
159#ifdef CONFIG_PPC
160 case SVR_P1010:
161 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
162 case SVR_P1022:
163 case SVR_9131:
164 case SVR_9132:
165 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
166 case SVR_P2020:
167 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0) ||
168 IS_SVR_REV(svr, 2, 1);
169 case SVR_B4860:
170 case SVR_B4420:
171 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
172 case SVR_P4080:
173 return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
174#endif
175 }
176
177 return false;
178}
179
Sriram Dash01820952016-06-13 09:58:36 +0530180bool has_erratum_a008751(void)
181{
182 u32 svr = get_svr();
183 u32 soc = SVR_SOC_VER(svr);
184
185 switch (soc) {
186#ifdef CONFIG_ARM64
Prabhakar Kushwahaac7f2422016-06-24 13:48:13 +0530187 case SVR_LS2080A:
188 case SVR_LS2085A:
Sriram Dash01820952016-06-13 09:58:36 +0530189 return IS_SVR_REV(svr, 1, 0);
190#endif
191 }
192 return false;
193}
194
Sriram Dasha1f422e2016-09-23 12:57:52 +0530195bool has_erratum_a010151(void)
196{
197 u32 svr = get_svr();
198 u32 soc = SVR_SOC_VER(svr);
199
Wenbin song5d8a61c2017-12-04 12:18:28 +0800200#ifdef CONFIG_ARM64
201 if (IS_SVR_DEV(svr, SVR_DEV(SVR_LS1043A)))
202 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
203#endif
204
Sriram Dasha1f422e2016-09-23 12:57:52 +0530205 switch (soc) {
206#ifdef CONFIG_ARM64
207 case SVR_LS2080A:
208 case SVR_LS2085A:
Santan Kumar53c62262017-06-09 11:48:07 +0530209 /* fallthrough */
210 case SVR_LS2088A:
211 /* fallthrough */
212 case SVR_LS2081A:
Sriram Dasha1f422e2016-09-23 12:57:52 +0530213 case SVR_LS1046A:
214 case SVR_LS1012A:
215 return IS_SVR_REV(svr, 1, 0);
Sriram Dasha1f422e2016-09-23 12:57:52 +0530216#endif
York Sunc4f047c2017-03-27 11:41:03 -0700217#ifdef CONFIG_ARCH_LS1021A
Sriram Dasha1f422e2016-09-23 12:57:52 +0530218 case SOC_VER_LS1020:
219 case SOC_VER_LS1021:
220 case SOC_VER_LS1022:
221 case SOC_VER_SLS1020:
222 return IS_SVR_REV(svr, 2, 0);
223#endif
224 }
225 return false;
226}
227
Sriram Dash9e8da5c2016-06-13 09:58:34 +0530228#endif