Merge branch 'master' of git://git.denx.de/u-boot-samsung
[oweals/u-boot.git] / post / tests.c
1 /*
2  * (C) Copyright 2002
3  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4  *
5  * See file CREDITS for list of people who contributed to this
6  * project.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  * MA 02111-1307 USA
22  *
23  * Be sure to mark tests to be run before relocation as such with the
24  * CONFIG_SYS_POST_PREREL flag so that logging is done correctly if the
25  * logbuffer support is enabled.
26  */
27
28 #include <common.h>
29
30 #include <post.h>
31
32 extern int ocm_post_test (int flags);
33 extern int cache_post_test (int flags);
34 extern int watchdog_post_test (int flags);
35 extern int i2c_post_test (int flags);
36 extern int rtc_post_test (int flags);
37 extern int memory_post_test (int flags);
38 extern int cpu_post_test (int flags);
39 extern int fpu_post_test (int flags);
40 extern int uart_post_test (int flags);
41 extern int ether_post_test (int flags);
42 extern int spi_post_test (int flags);
43 extern int usb_post_test (int flags);
44 extern int spr_post_test (int flags);
45 extern int sysmon_post_test (int flags);
46 extern int dsp_post_test (int flags);
47 extern int codec_post_test (int flags);
48 extern int ecc_post_test (int flags);
49
50 extern int dspic_init_post_test (int flags);
51 extern int dspic_post_test (int flags);
52 extern int gdc_post_test (int flags);
53 extern int fpga_post_test (int flags);
54 extern int lwmon5_watchdog_post_test(int flags);
55 extern int sysmon1_post_test(int flags);
56 extern int coprocessor_post_test(int flags);
57
58 extern int sysmon_init_f (void);
59
60 extern void sysmon_reloc (void);
61
62
63 struct post_test post_list[] =
64 {
65 #if CONFIG_POST & CONFIG_SYS_POST_OCM
66     {
67         "OCM test",
68         "ocm",
69         "This test checks on chip memory (OCM).",
70         POST_ROM | POST_ALWAYS | POST_PREREL | POST_CRITICAL | POST_STOP,
71         &ocm_post_test,
72         NULL,
73         NULL,
74         CONFIG_SYS_POST_OCM
75     },
76 #endif
77 #if CONFIG_POST & CONFIG_SYS_POST_CACHE
78     {
79         "Cache test",
80         "cache",
81         "This test verifies the CPU cache operation.",
82         POST_RAM | POST_ALWAYS,
83         &cache_post_test,
84         NULL,
85         NULL,
86         CONFIG_SYS_POST_CACHE
87     },
88 #endif
89 #if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG
90 #if defined(CONFIG_POST_WATCHDOG)
91         CONFIG_POST_WATCHDOG,
92 #else
93     {
94         "Watchdog timer test",
95         "watchdog",
96         "This test checks the watchdog timer.",
97         POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT,
98         &watchdog_post_test,
99         NULL,
100         NULL,
101         CONFIG_SYS_POST_WATCHDOG
102     },
103 #endif
104 #endif
105 #if CONFIG_POST & CONFIG_SYS_POST_I2C
106     {
107         "I2C test",
108         "i2c",
109         "This test verifies the I2C operation.",
110         POST_RAM | POST_ALWAYS,
111         &i2c_post_test,
112         NULL,
113         NULL,
114         CONFIG_SYS_POST_I2C
115     },
116 #endif
117 #if CONFIG_POST & CONFIG_SYS_POST_RTC
118     {
119         "RTC test",
120         "rtc",
121         "This test verifies the RTC operation.",
122         POST_RAM | POST_SLOWTEST | POST_MANUAL,
123         &rtc_post_test,
124         NULL,
125         NULL,
126         CONFIG_SYS_POST_RTC
127     },
128 #endif
129 #if CONFIG_POST & CONFIG_SYS_POST_MEMORY
130     {
131         "Memory test",
132         "memory",
133         "This test checks RAM.",
134         POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL,
135         &memory_post_test,
136         NULL,
137         NULL,
138         CONFIG_SYS_POST_MEMORY
139     },
140 #endif
141 #if CONFIG_POST & CONFIG_SYS_POST_CPU
142     {
143         "CPU test",
144         "cpu",
145         "This test verifies the arithmetic logic unit of"
146         " CPU.",
147         POST_RAM | POST_ALWAYS,
148         &cpu_post_test,
149         NULL,
150         NULL,
151         CONFIG_SYS_POST_CPU
152     },
153 #endif
154 #if CONFIG_POST & CONFIG_SYS_POST_FPU
155     {
156         "FPU test",
157         "fpu",
158         "This test verifies the arithmetic logic unit of"
159         " FPU.",
160         POST_RAM | POST_ALWAYS,
161         &fpu_post_test,
162         NULL,
163         NULL,
164         CONFIG_SYS_POST_FPU
165     },
166 #endif
167 #if CONFIG_POST & CONFIG_SYS_POST_UART
168 #if defined(CONFIG_POST_UART)
169         CONFIG_POST_UART,
170 #else
171     {
172         "UART test",
173         "uart",
174         "This test verifies the UART operation.",
175         POST_RAM | POST_SLOWTEST | POST_MANUAL,
176         &uart_post_test,
177         NULL,
178         NULL,
179         CONFIG_SYS_POST_UART
180     },
181 #endif /* CONFIG_POST_UART */
182 #endif
183 #if CONFIG_POST & CONFIG_SYS_POST_ETHER
184     {
185         "ETHERNET test",
186         "ethernet",
187         "This test verifies the ETHERNET operation.",
188         POST_RAM | POST_ALWAYS | POST_MANUAL,
189         &ether_post_test,
190         NULL,
191         NULL,
192         CONFIG_SYS_POST_ETHER
193     },
194 #endif
195 #if CONFIG_POST & CONFIG_SYS_POST_SPI
196     {
197         "SPI test",
198         "spi",
199         "This test verifies the SPI operation.",
200         POST_RAM | POST_ALWAYS | POST_MANUAL,
201         &spi_post_test,
202         NULL,
203         NULL,
204         CONFIG_SYS_POST_SPI
205     },
206 #endif
207 #if CONFIG_POST & CONFIG_SYS_POST_USB
208     {
209         "USB test",
210         "usb",
211         "This test verifies the USB operation.",
212         POST_RAM | POST_ALWAYS | POST_MANUAL,
213         &usb_post_test,
214         NULL,
215         NULL,
216         CONFIG_SYS_POST_USB
217     },
218 #endif
219 #if CONFIG_POST & CONFIG_SYS_POST_SPR
220     {
221         "SPR test",
222         "spr",
223         "This test checks SPR contents.",
224         POST_RAM | POST_ALWAYS,
225         &spr_post_test,
226         NULL,
227         NULL,
228         CONFIG_SYS_POST_SPR
229     },
230 #endif
231 #if CONFIG_POST & CONFIG_SYS_POST_SYSMON
232     {
233         "SYSMON test",
234         "sysmon",
235         "This test monitors system hardware.",
236         POST_RAM | POST_ALWAYS,
237         &sysmon_post_test,
238         &sysmon_init_f,
239         &sysmon_reloc,
240         CONFIG_SYS_POST_SYSMON
241     },
242 #endif
243 #if CONFIG_POST & CONFIG_SYS_POST_DSP
244     {
245         "DSP test",
246         "dsp",
247         "This test checks any connected DSP(s).",
248         POST_RAM | POST_ALWAYS | POST_MANUAL,
249         &dsp_post_test,
250         NULL,
251         NULL,
252         CONFIG_SYS_POST_DSP
253     },
254 #endif
255 #if CONFIG_POST & CONFIG_SYS_POST_CODEC
256     {
257         "CODEC test",
258         "codec",
259         "This test checks any connected codec(s).",
260         POST_RAM | POST_MANUAL,
261         &codec_post_test,
262         NULL,
263         NULL,
264         CONFIG_SYS_POST_CODEC
265     },
266 #endif
267 #if CONFIG_POST & CONFIG_SYS_POST_ECC
268     {
269         "ECC test",
270         "ecc",
271         "This test checks the ECC facility of memory.",
272         POST_ROM | POST_ALWAYS | POST_PREREL,
273         &ecc_post_test,
274         NULL,
275         NULL,
276         CONFIG_SYS_POST_ECC
277     },
278 #endif
279 #if CONFIG_POST & CONFIG_SYS_POST_BSPEC1
280         CONFIG_POST_BSPEC1,
281 #endif
282 #if CONFIG_POST & CONFIG_SYS_POST_BSPEC2
283         CONFIG_POST_BSPEC2,
284 #endif
285 #if CONFIG_POST & CONFIG_SYS_POST_BSPEC3
286         CONFIG_POST_BSPEC3,
287 #endif
288 #if CONFIG_POST & CONFIG_SYS_POST_BSPEC4
289         CONFIG_POST_BSPEC4,
290 #endif
291 #if CONFIG_POST & CONFIG_SYS_POST_BSPEC5
292         CONFIG_POST_BSPEC5,
293 #endif
294 #if CONFIG_POST & CONFIG_SYS_POST_COPROC
295     {
296         "Coprocessors communication test",
297         "coproc_com",
298         "This test checks communication with coprocessors.",
299         POST_RAM | POST_ALWAYS | POST_CRITICAL,
300         &coprocessor_post_test,
301         NULL,
302         NULL,
303         CONFIG_SYS_POST_COPROC
304     }
305 #endif
306 };
307
308 unsigned int post_list_size = sizeof (post_list) / sizeof (struct post_test);