Commit 92623672f9d3f1b4ea12ae1e2bcc0ad9fde5d2cb
fsl: usb: make errata function common for PPC and ARM
This patch does the following things: 1. Makes the errata checking code common for PPC and ARM 2. Moves all these static inline functions into a dedicated C file Signed-off-by: Sriram Dash <sriram.dash@nxp.com> Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Showing 4 changed files with 189 additions and 185 deletions Side-by-side Diff
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 | +#endif |
... | ... | @@ -86,189 +86,14 @@ |
86 | 86 | #endif |
87 | 87 | |
88 | 88 | /* USB Erratum Checking code */ |
89 | -#ifdef CONFIG_PPC | |
90 | -static inline bool has_dual_phy(void) | |
91 | -{ | |
92 | - u32 svr = get_svr(); | |
93 | - u32 soc = SVR_SOC_VER(svr); | |
94 | - | |
95 | - switch (soc) { | |
96 | - case SVR_T1023: | |
97 | - case SVR_T1024: | |
98 | - case SVR_T1013: | |
99 | - case SVR_T1014: | |
100 | - return IS_SVR_REV(svr, 1, 0); | |
101 | - case SVR_T1040: | |
102 | - case SVR_T1042: | |
103 | - case SVR_T1020: | |
104 | - case SVR_T1022: | |
105 | - case SVR_T2080: | |
106 | - case SVR_T2081: | |
107 | - return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1); | |
108 | - case SVR_T4240: | |
109 | - case SVR_T4160: | |
110 | - case SVR_T4080: | |
111 | - return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0); | |
112 | - } | |
113 | - | |
114 | - return false; | |
115 | -} | |
116 | - | |
117 | -static inline bool has_erratum_a006261(void) | |
118 | -{ | |
119 | - u32 svr = get_svr(); | |
120 | - u32 soc = SVR_SOC_VER(svr); | |
121 | - | |
122 | - switch (soc) { | |
123 | - case SVR_P1010: | |
124 | - return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0); | |
125 | - case SVR_P2041: | |
126 | - case SVR_P2040: | |
127 | - return IS_SVR_REV(svr, 1, 0) || | |
128 | - IS_SVR_REV(svr, 1, 1) || IS_SVR_REV(svr, 2, 1); | |
129 | - case SVR_P3041: | |
130 | - return IS_SVR_REV(svr, 1, 0) || | |
131 | - IS_SVR_REV(svr, 1, 1) || | |
132 | - IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 2, 1); | |
133 | - case SVR_P5010: | |
134 | - case SVR_P5020: | |
135 | - case SVR_P5021: | |
136 | - return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0); | |
137 | - case SVR_T4240: | |
138 | - case SVR_T4160: | |
139 | - case SVR_T4080: | |
140 | - return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0); | |
141 | - case SVR_T1040: | |
142 | - return IS_SVR_REV(svr, 1, 0); | |
143 | - case SVR_T2080: | |
144 | - case SVR_T2081: | |
145 | - return IS_SVR_REV(svr, 1, 0); | |
146 | - case SVR_P5040: | |
147 | - return IS_SVR_REV(svr, 1, 0); | |
148 | - } | |
149 | - | |
150 | - return false; | |
151 | -} | |
152 | - | |
153 | -static inline bool has_erratum_a007075(void) | |
154 | -{ | |
155 | - u32 svr = get_svr(); | |
156 | - u32 soc = SVR_SOC_VER(svr); | |
157 | - | |
158 | - switch (soc) { | |
159 | - case SVR_B4860: | |
160 | - case SVR_B4420: | |
161 | - return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0); | |
162 | - case SVR_P1010: | |
163 | - return IS_SVR_REV(svr, 1, 0); | |
164 | - case SVR_P4080: | |
165 | - return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0); | |
166 | - } | |
167 | - return false; | |
168 | -} | |
169 | - | |
170 | -static inline bool has_erratum_a007798(void) | |
171 | -{ | |
172 | - return SVR_SOC_VER(get_svr()) == SVR_T4240 && | |
173 | - IS_SVR_REV(get_svr(), 2, 0); | |
174 | -} | |
175 | - | |
176 | -static inline bool has_erratum_a007792(void) | |
177 | -{ | |
178 | - u32 svr = get_svr(); | |
179 | - u32 soc = SVR_SOC_VER(svr); | |
180 | - | |
181 | - switch (soc) { | |
182 | - case SVR_T4240: | |
183 | - case SVR_T4160: | |
184 | - case SVR_T4080: | |
185 | - return IS_SVR_REV(svr, 2, 0); | |
186 | - case SVR_T1024: | |
187 | - case SVR_T1023: | |
188 | - return IS_SVR_REV(svr, 1, 0); | |
189 | - case SVR_T1040: | |
190 | - case SVR_T1042: | |
191 | - case SVR_T1020: | |
192 | - case SVR_T1022: | |
193 | - case SVR_T2080: | |
194 | - case SVR_T2081: | |
195 | - return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1); | |
196 | - } | |
197 | - return false; | |
198 | -} | |
199 | - | |
200 | -static inline bool has_erratum_a005697(void) | |
201 | -{ | |
202 | - u32 svr = get_svr(); | |
203 | - u32 soc = SVR_SOC_VER(svr); | |
204 | - | |
205 | - switch (soc) { | |
206 | - case SVR_9131: | |
207 | - case SVR_9132: | |
208 | - return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1); | |
209 | - } | |
210 | - return false; | |
211 | -} | |
212 | - | |
213 | -static inline bool has_erratum_a004477(void) | |
214 | -{ | |
215 | - u32 svr = get_svr(); | |
216 | - u32 soc = SVR_SOC_VER(svr); | |
217 | - | |
218 | - switch (soc) { | |
219 | - case SVR_P1010: | |
220 | - return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0); | |
221 | - case SVR_P1022: | |
222 | - case SVR_9131: | |
223 | - case SVR_9132: | |
224 | - return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1); | |
225 | - case SVR_P2020: | |
226 | - return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0) || | |
227 | - IS_SVR_REV(svr, 2, 1); | |
228 | - case SVR_B4860: | |
229 | - case SVR_B4420: | |
230 | - return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0); | |
231 | - case SVR_P4080: | |
232 | - return IS_SVR_REV(svr, 2, 0) || IS_SVR_REV(svr, 3, 0); | |
233 | - } | |
234 | - | |
235 | - return false; | |
236 | -} | |
237 | -#else | |
238 | -static inline bool has_dual_phy(void) | |
239 | -{ | |
240 | - return false; | |
241 | -} | |
242 | - | |
243 | -static inline bool has_erratum_a006261(void) | |
244 | -{ | |
245 | - return false; | |
246 | -} | |
247 | - | |
248 | -static inline bool has_erratum_a007075(void) | |
249 | -{ | |
250 | - return false; | |
251 | -} | |
252 | - | |
253 | -static inline bool has_erratum_a007798(void) | |
254 | -{ | |
255 | - return false; | |
256 | -} | |
257 | - | |
258 | -static inline bool has_erratum_a007792(void) | |
259 | -{ | |
260 | - return false; | |
261 | -} | |
262 | - | |
263 | -static inline bool has_erratum_a005697(void) | |
264 | -{ | |
265 | - return false; | |
266 | -} | |
267 | - | |
268 | -static inline bool has_erratum_a004477(void) | |
269 | -{ | |
270 | - return false; | |
271 | -} | |
89 | +#if defined(CONFIG_PPC) || defined(CONFIG_ARM) | |
90 | +bool has_dual_phy(void); | |
91 | +bool has_erratum_a006261(void); | |
92 | +bool has_erratum_a007075(void); | |
93 | +bool has_erratum_a007798(void); | |
94 | +bool has_erratum_a007792(void); | |
95 | +bool has_erratum_a005697(void); | |
96 | +bool has_erratum_a004477(void); | |
272 | 97 | #endif |
273 | 98 | #endif /*_ASM_FSL_USB_H_ */ |
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c
-
mentioned in commit 12c67d
-
mentioned in commit eb364c
-
mentioned in commit eb364c