blob: c2319ecb7b88e64b70928051cc4df0836596ce1d [file] [log] [blame]
Aubrey.Li3f0606a2007-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-VILLARD6d0f6bc2008-10-16 15:01:15 +020024 * CONFIG_SYS_POST_PREREL flag so that logging is done correctly if the
Aubrey.Li3f0606a2007-03-09 13:38:44 +080025 * logbuffer support is enabled.
26 */
27
28#include <common.h>
29#include <config.h>
30#ifdef CONFIG_POST
31
32#include <post.h>
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020033#define CONFIG_SYS_POST_FLASH 0x00004000
34#define CONFIG_SYS_POST_LED 0x00008000
35#define CONFIG_SYS_POST_BUTTON 0x00010000
Aubrey.Li3f0606a2007-03-09 13:38:44 +080036
37extern int cache_post_test(int flags);
38extern int watchdog_post_test(int flags);
39extern int i2c_post_test(int flags);
40extern int rtc_post_test(int flags);
41extern int memory_post_test(int flags);
42extern int cpu_post_test(int flags);
43extern int uart_post_test(int flags);
44extern int ether_post_test(int flags);
45extern int spi_post_test(int flags);
46extern int usb_post_test(int flags);
47extern int spr_post_test(int flags);
48extern int sysmon_post_test(int flags);
49extern int dsp_post_test(int flags);
50extern int codec_post_test(int flags);
51
52extern int sysmon_init_f(void);
53
54extern void sysmon_reloc(void);
55
56extern int flash_post_test(int flags);
57extern int led_post_test(int flags);
58extern int button_post_test(int flags);
59
60struct post_test post_list[] = {
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020061#if CONFIG_POST & CONFIG_SYS_POST_CACHE
Aubrey.Li3f0606a2007-03-09 13:38:44 +080062 {
63 "Cache test",
64 "cache",
65 "This test verifies the CPU cache operation.",
66 POST_RAM | POST_ALWAYS,
67 &cache_post_test,
68 NULL,
69 NULL,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020070 CONFIG_SYS_POST_CACHE},
Aubrey.Li3f0606a2007-03-09 13:38:44 +080071#endif
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020072#if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG
Aubrey.Li3f0606a2007-03-09 13:38:44 +080073 {
74 "Watchdog timer test",
75 "watchdog",
76 "This test checks the watchdog timer.",
77 POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT,
78 &watchdog_post_test,
79 NULL,
80 NULL,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020081 CONFIG_SYS_POST_WATCHDOG},
Aubrey.Li3f0606a2007-03-09 13:38:44 +080082#endif
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020083#if CONFIG_POST & CONFIG_SYS_POST_I2C
Aubrey.Li3f0606a2007-03-09 13:38:44 +080084 {
85 "I2C test",
86 "i2c",
87 "This test verifies the I2C operation.",
88 POST_RAM | POST_ALWAYS,
89 &i2c_post_test,
90 NULL,
91 NULL,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020092 CONFIG_SYS_POST_I2C},
Aubrey.Li3f0606a2007-03-09 13:38:44 +080093#endif
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020094#if CONFIG_POST & CONFIG_SYS_POST_RTC
Aubrey.Li3f0606a2007-03-09 13:38:44 +080095 {
96 "RTC test",
97 "rtc",
98 "This test verifies the RTC operation.",
99 POST_RAM | POST_SLOWTEST | POST_MANUAL,
100 &rtc_post_test,
101 NULL,
102 NULL,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200103 CONFIG_SYS_POST_RTC},
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800104#endif
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200105#if CONFIG_POST & CONFIG_SYS_POST_MEMORY
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800106 {
107 "Memory test",
108 "memory",
109 "This test checks RAM.",
110 POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL,
111 &memory_post_test,
112 NULL,
113 NULL,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200114 CONFIG_SYS_POST_MEMORY},
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800115#endif
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200116#if CONFIG_POST & CONFIG_SYS_POST_CPU
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800117 {
118 "CPU test",
119 "cpu",
120 "This test verifies the arithmetic logic unit of" " CPU.",
121 POST_RAM | POST_ALWAYS,
122 &cpu_post_test,
123 NULL,
124 NULL,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200125 CONFIG_SYS_POST_CPU},
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800126#endif
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200127#if CONFIG_POST & CONFIG_SYS_POST_UART
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800128 {
129 "UART test",
130 "uart",
131 "This test verifies the UART operation.",
132 POST_RAM | POST_SLOWTEST | POST_MANUAL,
133 &uart_post_test,
134 NULL,
135 NULL,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200136 CONFIG_SYS_POST_UART},
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800137#endif
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200138#if CONFIG_POST & CONFIG_SYS_POST_ETHER
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800139 {
140 "ETHERNET test",
141 "ethernet",
142 "This test verifies the ETHERNET operation.",
143 POST_RAM | POST_ALWAYS | POST_MANUAL,
144 &ether_post_test,
145 NULL,
146 NULL,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200147 CONFIG_SYS_POST_ETHER},
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800148#endif
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200149#if CONFIG_POST & CONFIG_SYS_POST_SPI
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800150 {
151 "SPI test",
152 "spi",
153 "This test verifies the SPI operation.",
154 POST_RAM | POST_ALWAYS | POST_MANUAL,
155 &spi_post_test,
156 NULL,
157 NULL,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200158 CONFIG_SYS_POST_SPI},
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800159#endif
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200160#if CONFIG_POST & CONFIG_SYS_POST_USB
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800161 {
162 "USB test",
163 "usb",
164 "This test verifies the USB operation.",
165 POST_RAM | POST_ALWAYS | POST_MANUAL,
166 &usb_post_test,
167 NULL,
168 NULL,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200169 CONFIG_SYS_POST_USB},
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800170#endif
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200171#if CONFIG_POST & CONFIG_SYS_POST_SPR
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800172 {
173 "SPR test",
174 "spr",
175 "This test checks SPR contents.",
176 POST_ROM | POST_ALWAYS | POST_PREREL,
177 &spr_post_test,
178 NULL,
179 NULL,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200180 CONFIG_SYS_POST_SPR},
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800181#endif
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200182#if CONFIG_POST & CONFIG_SYS_POST_SYSMON
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800183 {
184 "SYSMON test",
185 "sysmon",
186 "This test monitors system hardware.",
187 POST_RAM | POST_ALWAYS,
188 &sysmon_post_test,
189 &sysmon_init_f,
190 &sysmon_reloc,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200191 CONFIG_SYS_POST_SYSMON},
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800192#endif
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200193#if CONFIG_POST & CONFIG_SYS_POST_DSP
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800194 {
195 "DSP test",
196 "dsp",
197 "This test checks any connected DSP(s).",
198 POST_RAM | POST_MANUAL,
199 &dsp_post_test,
200 NULL,
201 NULL,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200202 CONFIG_SYS_POST_DSP},
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800203#endif
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200204#if CONFIG_POST & CONFIG_SYS_POST_CODEC
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800205 {
206 "CODEC test",
207 "codec",
208 "This test checks any connected codec(s).",
209 POST_RAM | POST_MANUAL,
210 &codec_post_test,
211 NULL,
212 NULL,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200213 CONFIG_SYS_POST_CODEC},
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800214#endif
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200215#if CONFIG_POST & CONFIG_SYS_POST_FLASH
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800216 {
217 "FLASH test",
218 "flash",
219 "This test checks flash.",
220 POST_RAM | POST_ALWAYS | POST_MANUAL,
221 &flash_post_test,
222 NULL,
223 NULL,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200224 CONFIG_SYS_POST_FLASH},
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800225#endif
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200226#if CONFIG_POST & CONFIG_SYS_POST_LED
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800227 {
228 "LED test",
229 "LED",
230 "This test checks LED ",
231 POST_RAM | POST_ALWAYS | POST_MANUAL,
232 &led_post_test,
233 NULL,
234 NULL,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200235 CONFIG_SYS_POST_LED},
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800236#endif
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200237#if CONFIG_POST & CONFIG_SYS_POST_BUTTON
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800238 {
239 "Button test",
240 "button",
241 "This test checks Button ",
242 POST_RAM | POST_ALWAYS | POST_MANUAL,
243 &button_post_test,
244 NULL,
245 NULL,
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200246 CONFIG_SYS_POST_BUTTON},
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800247#endif
248
249};
250
251unsigned int post_list_size = sizeof(post_list) / sizeof(struct post_test);
252
253#endif /* CONFIG_POST */