blob: bf7fba00c1188882edaee768b394ae2a6eb973e8 [file] [log] [blame]
Aubrey.Li9da597f2007-03-09 13:38:44 +08001/*
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
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020024 * CONFIG_SYS_POST_PREREL flag so that logging is done correctly if the
Aubrey.Li9da597f2007-03-09 13:38:44 +080025 * logbuffer support is enabled.
26 */
27
28#include <common.h>
29#include <config.h>
Aubrey.Li9da597f2007-03-09 13:38:44 +080030
31#include <post.h>
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020032#define CONFIG_SYS_POST_FLASH 0x00004000
33#define CONFIG_SYS_POST_LED 0x00008000
34#define CONFIG_SYS_POST_BUTTON 0x00010000
Aubrey.Li9da597f2007-03-09 13:38:44 +080035
36extern int cache_post_test(int flags);
37extern int watchdog_post_test(int flags);
38extern int i2c_post_test(int flags);
39extern int rtc_post_test(int flags);
40extern int memory_post_test(int flags);
41extern int cpu_post_test(int flags);
42extern int uart_post_test(int flags);
43extern int ether_post_test(int flags);
44extern int spi_post_test(int flags);
45extern int usb_post_test(int flags);
46extern int spr_post_test(int flags);
47extern int sysmon_post_test(int flags);
48extern int dsp_post_test(int flags);
49extern int codec_post_test(int flags);
50
51extern int sysmon_init_f(void);
52
53extern void sysmon_reloc(void);
54
55extern int flash_post_test(int flags);
56extern int led_post_test(int flags);
57extern int button_post_test(int flags);
58
59struct post_test post_list[] = {
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020060#if CONFIG_POST & CONFIG_SYS_POST_CACHE
Aubrey.Li9da597f2007-03-09 13:38:44 +080061 {
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,
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020069 CONFIG_SYS_POST_CACHE},
Aubrey.Li9da597f2007-03-09 13:38:44 +080070#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020071#if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG
Aubrey.Li9da597f2007-03-09 13:38:44 +080072 {
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,
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020080 CONFIG_SYS_POST_WATCHDOG},
Aubrey.Li9da597f2007-03-09 13:38:44 +080081#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020082#if CONFIG_POST & CONFIG_SYS_POST_I2C
Aubrey.Li9da597f2007-03-09 13:38:44 +080083 {
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,
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020091 CONFIG_SYS_POST_I2C},
Aubrey.Li9da597f2007-03-09 13:38:44 +080092#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020093#if CONFIG_POST & CONFIG_SYS_POST_RTC
Aubrey.Li9da597f2007-03-09 13:38:44 +080094 {
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,
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200102 CONFIG_SYS_POST_RTC},
Aubrey.Li9da597f2007-03-09 13:38:44 +0800103#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200104#if CONFIG_POST & CONFIG_SYS_POST_MEMORY
Aubrey.Li9da597f2007-03-09 13:38:44 +0800105 {
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,
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200113 CONFIG_SYS_POST_MEMORY},
Aubrey.Li9da597f2007-03-09 13:38:44 +0800114#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200115#if CONFIG_POST & CONFIG_SYS_POST_CPU
Aubrey.Li9da597f2007-03-09 13:38:44 +0800116 {
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,
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200124 CONFIG_SYS_POST_CPU},
Aubrey.Li9da597f2007-03-09 13:38:44 +0800125#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200126#if CONFIG_POST & CONFIG_SYS_POST_UART
Aubrey.Li9da597f2007-03-09 13:38:44 +0800127 {
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,
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200135 CONFIG_SYS_POST_UART},
Aubrey.Li9da597f2007-03-09 13:38:44 +0800136#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200137#if CONFIG_POST & CONFIG_SYS_POST_ETHER
Aubrey.Li9da597f2007-03-09 13:38:44 +0800138 {
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,
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200146 CONFIG_SYS_POST_ETHER},
Aubrey.Li9da597f2007-03-09 13:38:44 +0800147#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200148#if CONFIG_POST & CONFIG_SYS_POST_SPI
Aubrey.Li9da597f2007-03-09 13:38:44 +0800149 {
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,
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200157 CONFIG_SYS_POST_SPI},
Aubrey.Li9da597f2007-03-09 13:38:44 +0800158#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200159#if CONFIG_POST & CONFIG_SYS_POST_USB
Aubrey.Li9da597f2007-03-09 13:38:44 +0800160 {
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,
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200168 CONFIG_SYS_POST_USB},
Aubrey.Li9da597f2007-03-09 13:38:44 +0800169#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200170#if CONFIG_POST & CONFIG_SYS_POST_SPR
Aubrey.Li9da597f2007-03-09 13:38:44 +0800171 {
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,
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200179 CONFIG_SYS_POST_SPR},
Aubrey.Li9da597f2007-03-09 13:38:44 +0800180#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200181#if CONFIG_POST & CONFIG_SYS_POST_SYSMON
Aubrey.Li9da597f2007-03-09 13:38:44 +0800182 {
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,
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200190 CONFIG_SYS_POST_SYSMON},
Aubrey.Li9da597f2007-03-09 13:38:44 +0800191#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200192#if CONFIG_POST & CONFIG_SYS_POST_DSP
Aubrey.Li9da597f2007-03-09 13:38:44 +0800193 {
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,
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200201 CONFIG_SYS_POST_DSP},
Aubrey.Li9da597f2007-03-09 13:38:44 +0800202#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200203#if CONFIG_POST & CONFIG_SYS_POST_CODEC
Aubrey.Li9da597f2007-03-09 13:38:44 +0800204 {
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,
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200212 CONFIG_SYS_POST_CODEC},
Aubrey.Li9da597f2007-03-09 13:38:44 +0800213#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200214#if CONFIG_POST & CONFIG_SYS_POST_FLASH
Aubrey.Li9da597f2007-03-09 13:38:44 +0800215 {
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,
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200223 CONFIG_SYS_POST_FLASH},
Aubrey.Li9da597f2007-03-09 13:38:44 +0800224#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200225#if CONFIG_POST & CONFIG_SYS_POST_LED
Aubrey.Li9da597f2007-03-09 13:38:44 +0800226 {
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,
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200234 CONFIG_SYS_POST_LED},
Aubrey.Li9da597f2007-03-09 13:38:44 +0800235#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200236#if CONFIG_POST & CONFIG_SYS_POST_BUTTON
Aubrey.Li9da597f2007-03-09 13:38:44 +0800237 {
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,
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200245 CONFIG_SYS_POST_BUTTON},
Aubrey.Li9da597f2007-03-09 13:38:44 +0800246#endif
247
248};
249
250unsigned int post_list_size = sizeof(post_list) / sizeof(struct post_test);