Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 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 |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 24 | * CONFIG_SYS_POST_PREREL flag so that logging is done correctly if the |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 25 | * 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-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 33 | #define CONFIG_SYS_POST_FLASH 0x00004000 |
| 34 | #define CONFIG_SYS_POST_LED 0x00008000 |
| 35 | #define CONFIG_SYS_POST_BUTTON 0x00010000 |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 36 | |
| 37 | extern int cache_post_test(int flags); |
| 38 | extern int watchdog_post_test(int flags); |
| 39 | extern int i2c_post_test(int flags); |
| 40 | extern int rtc_post_test(int flags); |
| 41 | extern int memory_post_test(int flags); |
| 42 | extern int cpu_post_test(int flags); |
| 43 | extern int uart_post_test(int flags); |
| 44 | extern int ether_post_test(int flags); |
| 45 | extern int spi_post_test(int flags); |
| 46 | extern int usb_post_test(int flags); |
| 47 | extern int spr_post_test(int flags); |
| 48 | extern int sysmon_post_test(int flags); |
| 49 | extern int dsp_post_test(int flags); |
| 50 | extern int codec_post_test(int flags); |
| 51 | |
| 52 | extern int sysmon_init_f(void); |
| 53 | |
| 54 | extern void sysmon_reloc(void); |
| 55 | |
| 56 | extern int flash_post_test(int flags); |
| 57 | extern int led_post_test(int flags); |
| 58 | extern int button_post_test(int flags); |
| 59 | |
| 60 | struct post_test post_list[] = { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 61 | #if CONFIG_POST & CONFIG_SYS_POST_CACHE |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 62 | { |
| 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-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 70 | CONFIG_SYS_POST_CACHE}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 71 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 72 | #if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 73 | { |
| 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-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 81 | CONFIG_SYS_POST_WATCHDOG}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 82 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 83 | #if CONFIG_POST & CONFIG_SYS_POST_I2C |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 84 | { |
| 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-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 92 | CONFIG_SYS_POST_I2C}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 93 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 94 | #if CONFIG_POST & CONFIG_SYS_POST_RTC |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 95 | { |
| 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-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 103 | CONFIG_SYS_POST_RTC}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 104 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 105 | #if CONFIG_POST & CONFIG_SYS_POST_MEMORY |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 106 | { |
| 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-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 114 | CONFIG_SYS_POST_MEMORY}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 115 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 116 | #if CONFIG_POST & CONFIG_SYS_POST_CPU |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 117 | { |
| 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-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 125 | CONFIG_SYS_POST_CPU}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 126 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 127 | #if CONFIG_POST & CONFIG_SYS_POST_UART |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 128 | { |
| 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-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 136 | CONFIG_SYS_POST_UART}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 137 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 138 | #if CONFIG_POST & CONFIG_SYS_POST_ETHER |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 139 | { |
| 140 | "ETHERNET test", |
| 141 | "ethernet", |
| 142 | "This test verifies the ETHERNET operation.", |
| 143 | POST_RAM | POST_ALWAYS | POST_MANUAL, |
| 144 | ðer_post_test, |
| 145 | NULL, |
| 146 | NULL, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 147 | CONFIG_SYS_POST_ETHER}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 148 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 149 | #if CONFIG_POST & CONFIG_SYS_POST_SPI |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 150 | { |
| 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-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 158 | CONFIG_SYS_POST_SPI}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 159 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 160 | #if CONFIG_POST & CONFIG_SYS_POST_USB |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 161 | { |
| 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-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 169 | CONFIG_SYS_POST_USB}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 170 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 171 | #if CONFIG_POST & CONFIG_SYS_POST_SPR |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 172 | { |
| 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-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 180 | CONFIG_SYS_POST_SPR}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 181 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 182 | #if CONFIG_POST & CONFIG_SYS_POST_SYSMON |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 183 | { |
| 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-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 191 | CONFIG_SYS_POST_SYSMON}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 192 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 193 | #if CONFIG_POST & CONFIG_SYS_POST_DSP |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 194 | { |
| 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-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 202 | CONFIG_SYS_POST_DSP}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 203 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 204 | #if CONFIG_POST & CONFIG_SYS_POST_CODEC |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 205 | { |
| 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-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 213 | CONFIG_SYS_POST_CODEC}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 214 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 215 | #if CONFIG_POST & CONFIG_SYS_POST_FLASH |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 216 | { |
| 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-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 224 | CONFIG_SYS_POST_FLASH}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 225 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 226 | #if CONFIG_POST & CONFIG_SYS_POST_LED |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 227 | { |
| 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-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 235 | CONFIG_SYS_POST_LED}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 236 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 237 | #if CONFIG_POST & CONFIG_SYS_POST_BUTTON |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 238 | { |
| 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-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 246 | CONFIG_SYS_POST_BUTTON}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 247 | #endif |
| 248 | |
| 249 | }; |
| 250 | |
| 251 | unsigned int post_list_size = sizeof(post_list) / sizeof(struct post_test); |
| 252 | |
| 253 | #endif /* CONFIG_POST */ |