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 #include <config.h>
30 
31 #include <post.h>
32 #define CONFIG_SYS_POST_FLASH  0x00004000
33 #define CONFIG_SYS_POST_LED    0x00008000
34 #define CONFIG_SYS_POST_BUTTON 0x00010000
35 
36 extern int cache_post_test(int flags);
37 extern int watchdog_post_test(int flags);
38 extern int i2c_post_test(int flags);
39 extern int rtc_post_test(int flags);
40 extern int memory_post_test(int flags);
41 extern int cpu_post_test(int flags);
42 extern int uart_post_test(int flags);
43 extern int ether_post_test(int flags);
44 extern int spi_post_test(int flags);
45 extern int usb_post_test(int flags);
46 extern int spr_post_test(int flags);
47 extern int sysmon_post_test(int flags);
48 extern int dsp_post_test(int flags);
49 extern int codec_post_test(int flags);
50 
51 extern int sysmon_init_f(void);
52 
53 extern void sysmon_reloc(void);
54 
55 extern int flash_post_test(int flags);
56 extern int led_post_test(int flags);
57 extern int button_post_test(int flags);
58 
59 struct post_test post_list[] = {
60 #if CONFIG_POST & CONFIG_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 	 CONFIG_SYS_POST_CACHE},
70 #endif
71 #if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG
72 	{
73 	 "Watchdog timer test",
74 	 "watchdog",
75 	 "This test checks the watchdog timer.",
76 	 POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT,
77 	 &watchdog_post_test,
78 	 NULL,
79 	 NULL,
80 	 CONFIG_SYS_POST_WATCHDOG},
81 #endif
82 #if CONFIG_POST & CONFIG_SYS_POST_I2C
83 	{
84 	 "I2C test",
85 	 "i2c",
86 	 "This test verifies the I2C operation.",
87 	 POST_RAM | POST_ALWAYS,
88 	 &i2c_post_test,
89 	 NULL,
90 	 NULL,
91 	 CONFIG_SYS_POST_I2C},
92 #endif
93 #if CONFIG_POST & CONFIG_SYS_POST_RTC
94 	{
95 	 "RTC test",
96 	 "rtc",
97 	 "This test verifies the RTC operation.",
98 	 POST_RAM | POST_SLOWTEST | POST_MANUAL,
99 	 &rtc_post_test,
100 	 NULL,
101 	 NULL,
102 	 CONFIG_SYS_POST_RTC},
103 #endif
104 #if CONFIG_POST & CONFIG_SYS_POST_MEMORY
105 	{
106 	 "Memory test",
107 	 "memory",
108 	 "This test checks RAM.",
109 	 POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL,
110 	 &memory_post_test,
111 	 NULL,
112 	 NULL,
113 	 CONFIG_SYS_POST_MEMORY},
114 #endif
115 #if CONFIG_POST & CONFIG_SYS_POST_CPU
116 	{
117 	 "CPU test",
118 	 "cpu",
119 	 "This test verifies the arithmetic logic unit of" " CPU.",
120 	 POST_RAM | POST_ALWAYS,
121 	 &cpu_post_test,
122 	 NULL,
123 	 NULL,
124 	 CONFIG_SYS_POST_CPU},
125 #endif
126 #if CONFIG_POST & CONFIG_SYS_POST_UART
127 	{
128 	 "UART test",
129 	 "uart",
130 	 "This test verifies the UART operation.",
131 	 POST_RAM | POST_SLOWTEST | POST_MANUAL,
132 	 &uart_post_test,
133 	 NULL,
134 	 NULL,
135 	 CONFIG_SYS_POST_UART},
136 #endif
137 #if CONFIG_POST & CONFIG_SYS_POST_ETHER
138 	{
139 	 "ETHERNET test",
140 	 "ethernet",
141 	 "This test verifies the ETHERNET operation.",
142 	 POST_RAM | POST_ALWAYS | POST_MANUAL,
143 	 &ether_post_test,
144 	 NULL,
145 	 NULL,
146 	 CONFIG_SYS_POST_ETHER},
147 #endif
148 #if CONFIG_POST & CONFIG_SYS_POST_SPI
149 	{
150 	 "SPI test",
151 	 "spi",
152 	 "This test verifies the SPI operation.",
153 	 POST_RAM | POST_ALWAYS | POST_MANUAL,
154 	 &spi_post_test,
155 	 NULL,
156 	 NULL,
157 	 CONFIG_SYS_POST_SPI},
158 #endif
159 #if CONFIG_POST & CONFIG_SYS_POST_USB
160 	{
161 	 "USB test",
162 	 "usb",
163 	 "This test verifies the USB operation.",
164 	 POST_RAM | POST_ALWAYS | POST_MANUAL,
165 	 &usb_post_test,
166 	 NULL,
167 	 NULL,
168 	 CONFIG_SYS_POST_USB},
169 #endif
170 #if CONFIG_POST & CONFIG_SYS_POST_SPR
171 	{
172 	 "SPR test",
173 	 "spr",
174 	 "This test checks SPR contents.",
175 	 POST_ROM | POST_ALWAYS | POST_PREREL,
176 	 &spr_post_test,
177 	 NULL,
178 	 NULL,
179 	 CONFIG_SYS_POST_SPR},
180 #endif
181 #if CONFIG_POST & CONFIG_SYS_POST_SYSMON
182 	{
183 	 "SYSMON test",
184 	 "sysmon",
185 	 "This test monitors system hardware.",
186 	 POST_RAM | POST_ALWAYS,
187 	 &sysmon_post_test,
188 	 &sysmon_init_f,
189 	 &sysmon_reloc,
190 	 CONFIG_SYS_POST_SYSMON},
191 #endif
192 #if CONFIG_POST & CONFIG_SYS_POST_DSP
193 	{
194 	 "DSP test",
195 	 "dsp",
196 	 "This test checks any connected DSP(s).",
197 	 POST_RAM | POST_MANUAL,
198 	 &dsp_post_test,
199 	 NULL,
200 	 NULL,
201 	 CONFIG_SYS_POST_DSP},
202 #endif
203 #if CONFIG_POST & CONFIG_SYS_POST_CODEC
204 	{
205 	 "CODEC test",
206 	 "codec",
207 	 "This test checks any connected codec(s).",
208 	 POST_RAM | POST_MANUAL,
209 	 &codec_post_test,
210 	 NULL,
211 	 NULL,
212 	 CONFIG_SYS_POST_CODEC},
213 #endif
214 #if CONFIG_POST & CONFIG_SYS_POST_FLASH
215 	{
216 	 "FLASH test",
217 	 "flash",
218 	 "This test checks flash.",
219 	 POST_RAM | POST_ALWAYS | POST_MANUAL,
220 	 &flash_post_test,
221 	 NULL,
222 	 NULL,
223 	 CONFIG_SYS_POST_FLASH},
224 #endif
225 #if CONFIG_POST & CONFIG_SYS_POST_LED
226 	{
227 	 "LED test",
228 	 "LED",
229 	 "This test checks LED ",
230 	 POST_RAM | POST_ALWAYS | POST_MANUAL,
231 	 &led_post_test,
232 	 NULL,
233 	 NULL,
234 	 CONFIG_SYS_POST_LED},
235 #endif
236 #if CONFIG_POST & CONFIG_SYS_POST_BUTTON
237 	{
238 	 "Button test",
239 	 "button",
240 	 "This test checks Button ",
241 	 POST_RAM | POST_ALWAYS | POST_MANUAL,
242 	 &button_post_test,
243 	 NULL,
244 	 NULL,
245 	 CONFIG_SYS_POST_BUTTON},
246 #endif
247 
248 };
249 
250 unsigned int post_list_size = sizeof(post_list) / sizeof(struct post_test);
251