xref: /rk3399_rockchip-uboot/post/tests.c (revision a3d991bd0da8b9fb9dbf2c7481091c3d082b9b13)
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  * CFG_POST_PREREL flag so that logging is done correctly if the
25  * logbuffer support is enabled.
26  */
27 
28 #include <common.h>
29 
30 #ifdef CONFIG_POST
31 
32 #include <post.h>
33 
34 extern int cache_post_test (int flags);
35 extern int watchdog_post_test (int flags);
36 extern int i2c_post_test (int flags);
37 extern int rtc_post_test (int flags);
38 extern int memory_post_test (int flags);
39 extern int cpu_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 
48 extern int sysmon_init_f (void);
49 
50 extern void sysmon_reloc (void);
51 
52 
53 struct post_test post_list[] =
54 {
55 #if CONFIG_POST & CFG_POST_CACHE
56     {
57 	"Cache test",
58 	"cache",
59 	"This test verifies the CPU cache operation.",
60 	POST_RAM | POST_ALWAYS,
61 	&cache_post_test,
62 	NULL,
63 	NULL,
64 	CFG_POST_CACHE
65     },
66 #endif
67 #if CONFIG_POST & CFG_POST_WATCHDOG
68     {
69 	"Watchdog timer test",
70 	"watchdog",
71 	"This test checks the watchdog timer.",
72 	POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT,
73 	&watchdog_post_test,
74 	NULL,
75 	NULL,
76 	CFG_POST_WATCHDOG
77     },
78 #endif
79 #if CONFIG_POST & CFG_POST_I2C
80     {
81 	"I2C test",
82 	"i2c",
83 	"This test verifies the I2C operation.",
84 	POST_RAM | POST_ALWAYS,
85 	&i2c_post_test,
86 	NULL,
87 	NULL,
88 	CFG_POST_I2C
89     },
90 #endif
91 #if CONFIG_POST & CFG_POST_RTC
92     {
93 	"RTC test",
94 	"rtc",
95 	"This test verifies the RTC operation.",
96 	POST_RAM | POST_SLOWTEST | POST_MANUAL,
97 	&rtc_post_test,
98 	NULL,
99 	NULL,
100 	CFG_POST_RTC
101     },
102 #endif
103 #if CONFIG_POST & CFG_POST_MEMORY
104     {
105 	"Memory test",
106 	"memory",
107 	"This test checks RAM.",
108 	POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL,
109 	&memory_post_test,
110 	NULL,
111 	NULL,
112 	CFG_POST_MEMORY
113     },
114 #endif
115 #if CONFIG_POST & CFG_POST_CPU
116     {
117 	"CPU test",
118 	"cpu",
119 	"This test verifies the arithmetic logic unit of"
120 	" CPU.",
121 	POST_RAM | POST_ALWAYS,
122 	&cpu_post_test,
123 	NULL,
124 	NULL,
125 	CFG_POST_CPU
126     },
127 #endif
128 #if CONFIG_POST & CFG_POST_UART
129     {
130 	"UART test",
131 	"uart",
132 	"This test verifies the UART operation.",
133 	POST_RAM | POST_SLOWTEST | POST_MANUAL,
134 	&uart_post_test,
135 	NULL,
136 	NULL,
137 	CFG_POST_UART
138     },
139 #endif
140 #if CONFIG_POST & CFG_POST_ETHER
141     {
142 	"ETHERNET test",
143 	"ethernet",
144 	"This test verifies the ETHERNET operation.",
145 	POST_RAM | POST_ALWAYS | POST_MANUAL,
146 	&ether_post_test,
147 	NULL,
148 	NULL,
149 	CFG_POST_ETHER
150     },
151 #endif
152 #if CONFIG_POST & CFG_POST_SPI
153     {
154 	"SPI test",
155 	"spi",
156 	"This test verifies the SPI operation.",
157 	POST_RAM | POST_ALWAYS | POST_MANUAL,
158 	&spi_post_test,
159 	NULL,
160 	NULL,
161 	CFG_POST_SPI
162     },
163 #endif
164 #if CONFIG_POST & CFG_POST_USB
165     {
166 	"USB test",
167 	"usb",
168 	"This test verifies the USB operation.",
169 	POST_RAM | POST_ALWAYS | POST_MANUAL,
170 	&usb_post_test,
171 	NULL,
172 	NULL,
173 	CFG_POST_USB
174     },
175 #endif
176 #if CONFIG_POST & CFG_POST_SPR
177     {
178 	"SPR test",
179 	"spr",
180 	"This test checks SPR contents.",
181 	POST_ROM | POST_ALWAYS | POST_PREREL,
182 	&spr_post_test,
183 	NULL,
184 	NULL,
185 	CFG_POST_SPR
186     },
187 #endif
188 #if CONFIG_POST & CFG_POST_SYSMON
189     {
190 	"SYSMON test",
191 	"sysmon",
192 	"This test monitors system hardware.",
193 	POST_RAM | POST_ALWAYS,
194 	&sysmon_post_test,
195 	&sysmon_init_f,
196 	&sysmon_reloc,
197 	CFG_POST_SYSMON
198     },
199 #endif
200 #if CONFIG_POST & CFG_POST_DSP
201     {
202 	"DSP test",
203 	"dsp",
204 	"This test checks any connected DSP(s).",
205 	POST_RAM | POST_MANUAL,
206 	&dsp_post_test,
207 	NULL,
208 	NULL,
209 	CFG_POST_DSP
210     },
211 #endif
212 };
213 
214 unsigned int post_list_size = sizeof (post_list) / sizeof (struct post_test);
215 
216 #endif /* CONFIG_POST */
217