Aubrey.Li | 9da597f | 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 |
| 24 | * CFG_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 | #ifdef CONFIG_POST |
| 31 | |
| 32 | #include <post.h> |
| 33 | #define CFG_POST_FLASH 0x00004000 |
| 34 | #define CFG_POST_LED 0x00008000 |
| 35 | #define CFG_POST_BUTTON 0x00010000 |
| 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[] = { |
| 61 | #if CONFIG_POST & CFG_POST_CACHE |
| 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, |
| 70 | CFG_POST_CACHE}, |
| 71 | #endif |
| 72 | #if CONFIG_POST & CFG_POST_WATCHDOG |
| 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, |
| 81 | CFG_POST_WATCHDOG}, |
| 82 | #endif |
| 83 | #if CONFIG_POST & CFG_POST_I2C |
| 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, |
| 92 | CFG_POST_I2C}, |
| 93 | #endif |
| 94 | #if CONFIG_POST & CFG_POST_RTC |
| 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, |
| 103 | CFG_POST_RTC}, |
| 104 | #endif |
| 105 | #if CONFIG_POST & CFG_POST_MEMORY |
| 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, |
| 114 | CFG_POST_MEMORY}, |
| 115 | #endif |
| 116 | #if CONFIG_POST & CFG_POST_CPU |
| 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, |
| 125 | CFG_POST_CPU}, |
| 126 | #endif |
| 127 | #if CONFIG_POST & CFG_POST_UART |
| 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, |
| 136 | CFG_POST_UART}, |
| 137 | #endif |
| 138 | #if CONFIG_POST & CFG_POST_ETHER |
| 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, |
| 147 | CFG_POST_ETHER}, |
| 148 | #endif |
| 149 | #if CONFIG_POST & CFG_POST_SPI |
| 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, |
| 158 | CFG_POST_SPI}, |
| 159 | #endif |
| 160 | #if CONFIG_POST & CFG_POST_USB |
| 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, |
| 169 | CFG_POST_USB}, |
| 170 | #endif |
| 171 | #if CONFIG_POST & CFG_POST_SPR |
| 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, |
| 180 | CFG_POST_SPR}, |
| 181 | #endif |
| 182 | #if CONFIG_POST & CFG_POST_SYSMON |
| 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, |
| 191 | CFG_POST_SYSMON}, |
| 192 | #endif |
| 193 | #if CONFIG_POST & CFG_POST_DSP |
| 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, |
| 202 | CFG_POST_DSP}, |
| 203 | #endif |
| 204 | #if CONFIG_POST & CFG_POST_CODEC |
| 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, |
| 213 | CFG_POST_CODEC}, |
| 214 | #endif |
| 215 | #if CONFIG_POST & CFG_POST_FLASH |
| 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, |
| 224 | CFG_POST_FLASH}, |
| 225 | #endif |
| 226 | #if CONFIG_POST & CFG_POST_LED |
| 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, |
| 235 | CFG_POST_LED}, |
| 236 | #endif |
| 237 | #if CONFIG_POST & CFG_POST_BUTTON |
| 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, |
| 246 | CFG_POST_BUTTON}, |
| 247 | #endif |
| 248 | |
| 249 | }; |
| 250 | |
| 251 | unsigned int post_list_size = sizeof(post_list) / sizeof(struct post_test); |
| 252 | |
| 253 | #endif /* CONFIG_POST */ |