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> |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 30 | |
| 31 | #include <post.h> |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 32 | #define CONFIG_SYS_POST_FLASH 0x00004000 |
| 33 | #define CONFIG_SYS_POST_LED 0x00008000 |
| 34 | #define CONFIG_SYS_POST_BUTTON 0x00010000 |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 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[] = { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 60 | #if CONFIG_POST & CONFIG_SYS_POST_CACHE |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 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, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 69 | CONFIG_SYS_POST_CACHE}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 70 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 71 | #if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 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, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 80 | CONFIG_SYS_POST_WATCHDOG}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 81 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 82 | #if CONFIG_POST & CONFIG_SYS_POST_I2C |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 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, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 91 | CONFIG_SYS_POST_I2C}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 92 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 93 | #if CONFIG_POST & CONFIG_SYS_POST_RTC |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 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, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 102 | CONFIG_SYS_POST_RTC}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 103 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 104 | #if CONFIG_POST & CONFIG_SYS_POST_MEMORY |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 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, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 113 | CONFIG_SYS_POST_MEMORY}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 114 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 115 | #if CONFIG_POST & CONFIG_SYS_POST_CPU |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 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, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 124 | CONFIG_SYS_POST_CPU}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 125 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 126 | #if CONFIG_POST & CONFIG_SYS_POST_UART |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 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, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 135 | CONFIG_SYS_POST_UART}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 136 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 137 | #if CONFIG_POST & CONFIG_SYS_POST_ETHER |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 138 | { |
| 139 | "ETHERNET test", |
| 140 | "ethernet", |
| 141 | "This test verifies the ETHERNET operation.", |
| 142 | POST_RAM | POST_ALWAYS | POST_MANUAL, |
| 143 | ðer_post_test, |
| 144 | NULL, |
| 145 | NULL, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 146 | CONFIG_SYS_POST_ETHER}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 147 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 148 | #if CONFIG_POST & CONFIG_SYS_POST_SPI |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 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, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 157 | CONFIG_SYS_POST_SPI}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 158 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 159 | #if CONFIG_POST & CONFIG_SYS_POST_USB |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 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, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 168 | CONFIG_SYS_POST_USB}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 169 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 170 | #if CONFIG_POST & CONFIG_SYS_POST_SPR |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 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, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 179 | CONFIG_SYS_POST_SPR}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 180 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 181 | #if CONFIG_POST & CONFIG_SYS_POST_SYSMON |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 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, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 190 | CONFIG_SYS_POST_SYSMON}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 191 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 192 | #if CONFIG_POST & CONFIG_SYS_POST_DSP |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 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, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 201 | CONFIG_SYS_POST_DSP}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 202 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 203 | #if CONFIG_POST & CONFIG_SYS_POST_CODEC |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 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, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 212 | CONFIG_SYS_POST_CODEC}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 213 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 214 | #if CONFIG_POST & CONFIG_SYS_POST_FLASH |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 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, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 223 | CONFIG_SYS_POST_FLASH}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 224 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 225 | #if CONFIG_POST & CONFIG_SYS_POST_LED |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 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, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 234 | CONFIG_SYS_POST_LED}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 235 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 236 | #if CONFIG_POST & CONFIG_SYS_POST_BUTTON |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 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, |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 245 | CONFIG_SYS_POST_BUTTON}, |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 246 | #endif |
| 247 | |
| 248 | }; |
| 249 | |
| 250 | unsigned int post_list_size = sizeof(post_list) / sizeof(struct post_test); |