fsl/usb: enable errata-a010151 for ls2088a and ls2081a
[oweals/u-boot.git] / drivers / usb / common / fsl-errata.c
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 #if defined(CONFIG_FSL_LSCH2) || defined(CONFIG_FSL_LSCH3) || \
13         defined(CONFIG_ARM)
14 #include <asm/arch/clock.h>
15 #endif
16
17 /* USB Erratum Checking code */
18 #if defined(CONFIG_PPC) || defined(CONFIG_ARM)
19 bool 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
48 bool has_erratum_a006261(void)
49 {
50         u32 svr = get_svr();
51         u32 soc = SVR_SOC_VER(svr);
52
53         switch (soc) {
54 #ifdef CONFIG_PPC
55         case SVR_P1010:
56                 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
57         case SVR_P2041:
58         case SVR_P2040:
59                 return IS_SVR_REV(svr, 1, 0) ||
60                         IS_SVR_REV(svr, 1, 1) ||
61                         IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1);
62         case SVR_P3041:
63                 return IS_SVR_REV(svr, 1, 0) ||
64                         IS_SVR_REV(svr, 1, 1) ||
65                         IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1);
66         case SVR_P5010:
67         case SVR_P5020:
68         case SVR_P5021:
69                 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
70         case SVR_T4240:
71                 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
72         case SVR_P5040:
73                 return IS_SVR_REV(svr, 1, 0) ||
74                         IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1);
75 #endif
76         }
77
78         return false;
79 }
80
81 bool has_erratum_a007075(void)
82 {
83         u32 svr = get_svr();
84         u32 soc = SVR_SOC_VER(svr);
85
86         switch (soc) {
87 #ifdef CONFIG_PPC
88         case SVR_B4860:
89         case SVR_B4420:
90                 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
91         case SVR_P1010:
92                 return IS_SVR_REV(svr, 1, 0);
93         case SVR_P4080:
94                 return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
95 #endif
96         }
97         return false;
98 }
99
100 bool has_erratum_a007798(void)
101 {
102 #ifdef CONFIG_PPC
103         return SVR_SOC_VER(get_svr()) == SVR_T4240 &&
104                 IS_SVR_REV(get_svr(), 2, 0);
105 #endif
106         return false;
107 }
108
109 bool has_erratum_a007792(void)
110 {
111         u32 svr = get_svr();
112         u32 soc = SVR_SOC_VER(svr);
113
114         switch (soc) {
115 #ifdef CONFIG_PPC
116         case SVR_T4240:
117         case SVR_T4160:
118         case SVR_T4080:
119                 return IS_SVR_REV(svr, 2, 0);
120         case SVR_T1024:
121         case SVR_T1023:
122                 return IS_SVR_REV(svr, 1, 0);
123         case SVR_T1040:
124         case SVR_T1042:
125         case SVR_T1020:
126         case SVR_T1022:
127         case SVR_T2080:
128         case SVR_T2081:
129                 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
130 #endif
131         }
132         return false;
133 }
134
135 bool has_erratum_a005697(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_9131:
143         case SVR_9132:
144                 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
145 #endif
146 #ifdef ONFIG_ARM64
147         case SVR_LS1012A:
148                 return IS_SVR_REV(svr, 1, 0);
149 #endif
150         }
151         return false;
152 }
153
154 bool has_erratum_a004477(void)
155 {
156         u32 svr = get_svr();
157         u32 soc = SVR_SOC_VER(svr);
158
159         switch (soc) {
160 #ifdef CONFIG_PPC
161         case SVR_P1010:
162                 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
163         case SVR_P1022:
164         case SVR_9131:
165         case SVR_9132:
166                 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
167         case SVR_P2020:
168                 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0) ||
169                         IS_SVR_REV(svr, 2, 1);
170         case SVR_B4860:
171         case SVR_B4420:
172                 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
173         case SVR_P4080:
174                 return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0);
175 #endif
176         }
177
178         return false;
179 }
180
181 bool has_erratum_a008751(void)
182 {
183         u32 svr = get_svr();
184         u32 soc = SVR_SOC_VER(svr);
185
186         switch (soc) {
187 #ifdef CONFIG_ARM64
188         case SVR_LS2080A:
189         case SVR_LS2085A:
190                 return IS_SVR_REV(svr, 1, 0);
191 #endif
192         }
193         return false;
194 }
195
196 bool has_erratum_a010151(void)
197 {
198         u32 svr = get_svr();
199         u32 soc = SVR_SOC_VER(svr);
200
201         switch (soc) {
202 #ifdef CONFIG_ARM64
203         case SVR_LS2080A:
204         case SVR_LS2085A:
205                         /* fallthrough */
206         case SVR_LS2088A:
207                         /* fallthrough */
208         case SVR_LS2081A:
209         case SVR_LS1046A:
210         case SVR_LS1012A:
211                 return IS_SVR_REV(svr, 1, 0);
212         case SVR_LS1043A:
213                 return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
214 #endif
215 #ifdef CONFIG_ARCH_LS1021A
216         case SOC_VER_LS1020:
217         case SOC_VER_LS1021:
218         case SOC_VER_LS1022:
219         case SOC_VER_SLS1020:
220                 return IS_SVR_REV(svr, 2, 0);
221 #endif
222         }
223         return false;
224 }
225
226 #endif