1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2002
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 */
6
7#include <common.h>
8
9#include <post.h>
10
11extern int ocm_post_test (int flags);
12extern int cache_post_test (int flags);
13extern int watchdog_post_test (int flags);
14extern int i2c_post_test (int flags);
15extern int rtc_post_test (int flags);
16extern int memory_post_test (int flags);
17extern int cpu_post_test (int flags);
18extern int fpu_post_test (int flags);
19extern int uart_post_test (int flags);
20extern int ether_post_test (int flags);
21extern int spi_post_test (int flags);
22extern int usb_post_test (int flags);
23extern int spr_post_test (int flags);
24extern int sysmon_post_test (int flags);
25extern int dsp_post_test (int flags);
26extern int codec_post_test (int flags);
27extern int ecc_post_test (int flags);
28extern int flash_post_test(int flags);
29
30extern int dspic_init_post_test (int flags);
31extern int dspic_post_test (int flags);
32extern int gdc_post_test (int flags);
33extern int fpga_post_test (int flags);
34extern int lwmon5_watchdog_post_test(int flags);
35extern int sysmon1_post_test(int flags);
36extern int coprocessor_post_test(int flags);
37extern int led_post_test(int flags);
38extern int button_post_test(int flags);
39extern int memory_regions_post_test(int flags);
40
41extern int sysmon_init_f (void);
42
43extern void sysmon_reloc (void);
44
45
46struct post_test post_list[] =
47{
48#if CFG_POST & CFG_SYS_POST_OCM
49    {
50	"OCM test",
51	"ocm",
52	"This test checks on chip memory (OCM).",
53	POST_ROM | POST_ALWAYS | POST_PREREL | POST_CRITICAL | POST_STOP,
54	&ocm_post_test,
55	NULL,
56	NULL,
57	CFG_SYS_POST_OCM
58    },
59#endif
60#if CFG_POST & CFG_SYS_POST_CACHE
61    {
62	"Cache test",
63	"cache",
64	"This test verifies the CPU cache operation.",
65	POST_RAM | POST_ALWAYS,
66	&cache_post_test,
67	NULL,
68	NULL,
69	CFG_SYS_POST_CACHE
70    },
71#endif
72#if CFG_POST & CFG_SYS_POST_WATCHDOG
73#if defined(CFG_POST_WATCHDOG)
74	CFG_POST_WATCHDOG,
75#else
76    {
77	"Watchdog timer test",
78	"watchdog",
79	"This test checks the watchdog timer.",
80	POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT,
81	&watchdog_post_test,
82	NULL,
83	NULL,
84	CFG_SYS_POST_WATCHDOG
85    },
86#endif
87#endif
88#if CFG_POST & CFG_SYS_POST_I2C
89    {
90	"I2C test",
91	"i2c",
92	"This test verifies the I2C operation.",
93	POST_RAM | POST_ALWAYS,
94	&i2c_post_test,
95	NULL,
96	NULL,
97	CFG_SYS_POST_I2C
98    },
99#endif
100#if CFG_POST & CFG_SYS_POST_RTC
101    {
102	"RTC test",
103	"rtc",
104	"This test verifies the RTC operation.",
105	POST_RAM | POST_SLOWTEST | POST_MANUAL,
106	&rtc_post_test,
107	NULL,
108	NULL,
109	CFG_SYS_POST_RTC
110    },
111#endif
112#if CFG_POST & CFG_SYS_POST_MEMORY
113    {
114	"Memory test",
115	"memory",
116	"This test checks RAM.",
117	POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL,
118	&memory_post_test,
119	NULL,
120	NULL,
121	CFG_SYS_POST_MEMORY
122    },
123#endif
124#if CFG_POST & CFG_SYS_POST_CPU
125    {
126	"CPU test",
127	"cpu",
128	"This test verifies the arithmetic logic unit of"
129	" CPU.",
130	POST_RAM | POST_ALWAYS,
131	&cpu_post_test,
132	NULL,
133	NULL,
134	CFG_SYS_POST_CPU
135    },
136#endif
137#if CFG_POST & CFG_SYS_POST_FPU
138    {
139	"FPU test",
140	"fpu",
141	"This test verifies the arithmetic logic unit of"
142	" FPU.",
143	POST_RAM | POST_ALWAYS,
144	&fpu_post_test,
145	NULL,
146	NULL,
147	CFG_SYS_POST_FPU
148    },
149#endif
150#if CFG_POST & CFG_SYS_POST_UART
151#if defined(CFG_POST_UART)
152	CFG_POST_UART,
153#else
154    {
155	"UART test",
156	"uart",
157	"This test verifies the UART operation.",
158	POST_RAM | POST_SLOWTEST | POST_MANUAL,
159	&uart_post_test,
160	NULL,
161	NULL,
162	CFG_SYS_POST_UART
163    },
164#endif /* CFG_POST_UART */
165#endif
166#if CFG_POST & CFG_SYS_POST_ETHER
167    {
168	"ETHERNET test",
169	"ethernet",
170	"This test verifies the ETHERNET operation.",
171	POST_RAM | POST_ALWAYS,
172	&ether_post_test,
173	NULL,
174	NULL,
175	CFG_SYS_POST_ETHER
176    },
177#endif
178#if CFG_POST & CFG_SYS_POST_USB
179    {
180	"USB test",
181	"usb",
182	"This test verifies the USB operation.",
183	POST_RAM | POST_ALWAYS,
184	&usb_post_test,
185	NULL,
186	NULL,
187	CFG_SYS_POST_USB
188    },
189#endif
190#if CFG_POST & CFG_SYS_POST_SPR
191    {
192	"SPR test",
193	"spr",
194	"This test checks SPR contents.",
195	POST_RAM | POST_ALWAYS,
196	&spr_post_test,
197	NULL,
198	NULL,
199	CFG_SYS_POST_SPR
200    },
201#endif
202#if CFG_POST & CFG_SYS_POST_SYSMON
203    {
204	"SYSMON test",
205	"sysmon",
206	"This test monitors system hardware.",
207	POST_RAM | POST_ALWAYS,
208	&sysmon_post_test,
209	&sysmon_init_f,
210	&sysmon_reloc,
211	CFG_SYS_POST_SYSMON
212    },
213#endif
214#if CFG_POST & CFG_SYS_POST_DSP
215    {
216	"DSP test",
217	"dsp",
218	"This test checks any connected DSP(s).",
219	POST_RAM | POST_ALWAYS,
220	&dsp_post_test,
221	NULL,
222	NULL,
223	CFG_SYS_POST_DSP
224    },
225#endif
226#if CFG_POST & CFG_SYS_POST_CODEC
227    {
228	"CODEC test",
229	"codec",
230	"This test checks any connected codec(s).",
231	POST_RAM | POST_MANUAL,
232	&codec_post_test,
233	NULL,
234	NULL,
235	CFG_SYS_POST_CODEC
236    },
237#endif
238#if CFG_POST & CFG_SYS_POST_ECC
239    {
240	"ECC test",
241	"ecc",
242	"This test checks the ECC facility of memory.",
243	POST_ROM | POST_ALWAYS | POST_PREREL,
244	&ecc_post_test,
245	NULL,
246	NULL,
247	CFG_SYS_POST_ECC
248    },
249#endif
250#if CFG_POST & CFG_SYS_POST_BSPEC1
251	CFG_POST_BSPEC1,
252#endif
253#if CFG_POST & CFG_SYS_POST_BSPEC2
254	CFG_POST_BSPEC2,
255#endif
256#if CFG_POST & CFG_SYS_POST_BSPEC3
257	CFG_POST_BSPEC3,
258#endif
259#if CFG_POST & CFG_SYS_POST_BSPEC4
260	CFG_POST_BSPEC4,
261#endif
262#if CFG_POST & CFG_SYS_POST_BSPEC5
263	CFG_POST_BSPEC5,
264#endif
265#if CFG_POST & CFG_SYS_POST_COPROC
266    {
267	"Coprocessors communication test",
268	"coproc_com",
269	"This test checks communication with coprocessors.",
270	POST_RAM | POST_ALWAYS | POST_CRITICAL,
271	&coprocessor_post_test,
272	NULL,
273	NULL,
274	CFG_SYS_POST_COPROC
275    },
276#endif
277#if CFG_POST & CFG_SYS_POST_FLASH
278    {
279	"Parallel NOR flash test",
280	"flash",
281	"This test verifies parallel flash operations.",
282	POST_RAM | POST_SLOWTEST | POST_MANUAL,
283	&flash_post_test,
284	NULL,
285	NULL,
286	CFG_SYS_POST_FLASH
287    },
288#endif
289#if CFG_POST & CFG_SYS_POST_MEM_REGIONS
290    {
291	"Memory regions test",
292	"mem_regions",
293	"This test checks regularly placed regions of the RAM.",
294	POST_ROM | POST_SLOWTEST | POST_PREREL,
295	&memory_regions_post_test,
296	NULL,
297	NULL,
298	CFG_SYS_POST_MEM_REGIONS
299    },
300#endif
301};
302
303unsigned int post_list_size = ARRAY_SIZE(post_list);
304