tests.c 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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. * CONFIG_SYS_POST_PREREL flag so that logging is done correctly if the
  25. * logbuffer support is enabled.
  26. */
  27. #include <common.h>
  28. #include <post.h>
  29. extern int ocm_post_test (int flags);
  30. extern int cache_post_test (int flags);
  31. extern int watchdog_post_test (int flags);
  32. extern int i2c_post_test (int flags);
  33. extern int rtc_post_test (int flags);
  34. extern int memory_post_test (int flags);
  35. extern int cpu_post_test (int flags);
  36. extern int fpu_post_test (int flags);
  37. extern int uart_post_test (int flags);
  38. extern int ether_post_test (int flags);
  39. extern int spi_post_test (int flags);
  40. extern int usb_post_test (int flags);
  41. extern int spr_post_test (int flags);
  42. extern int sysmon_post_test (int flags);
  43. extern int dsp_post_test (int flags);
  44. extern int codec_post_test (int flags);
  45. extern int ecc_post_test (int flags);
  46. extern int flash_post_test(int flags);
  47. extern int dspic_init_post_test (int flags);
  48. extern int dspic_post_test (int flags);
  49. extern int gdc_post_test (int flags);
  50. extern int fpga_post_test (int flags);
  51. extern int lwmon5_watchdog_post_test(int flags);
  52. extern int sysmon1_post_test(int flags);
  53. extern int coprocessor_post_test(int flags);
  54. extern int led_post_test(int flags);
  55. extern int button_post_test(int flags);
  56. extern int sysmon_init_f (void);
  57. extern void sysmon_reloc (void);
  58. struct post_test post_list[] =
  59. {
  60. #if CONFIG_POST & CONFIG_SYS_POST_OCM
  61. {
  62. "OCM test",
  63. "ocm",
  64. "This test checks on chip memory (OCM).",
  65. POST_ROM | POST_ALWAYS | POST_PREREL | POST_CRITICAL | POST_STOP,
  66. &ocm_post_test,
  67. NULL,
  68. NULL,
  69. CONFIG_SYS_POST_OCM
  70. },
  71. #endif
  72. #if CONFIG_POST & CONFIG_SYS_POST_CACHE
  73. {
  74. "Cache test",
  75. "cache",
  76. "This test verifies the CPU cache operation.",
  77. POST_RAM | POST_ALWAYS,
  78. &cache_post_test,
  79. NULL,
  80. NULL,
  81. CONFIG_SYS_POST_CACHE
  82. },
  83. #endif
  84. #if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG
  85. #if defined(CONFIG_POST_WATCHDOG)
  86. CONFIG_POST_WATCHDOG,
  87. #else
  88. {
  89. "Watchdog timer test",
  90. "watchdog",
  91. "This test checks the watchdog timer.",
  92. POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT,
  93. &watchdog_post_test,
  94. NULL,
  95. NULL,
  96. CONFIG_SYS_POST_WATCHDOG
  97. },
  98. #endif
  99. #endif
  100. #if CONFIG_POST & CONFIG_SYS_POST_I2C
  101. {
  102. "I2C test",
  103. "i2c",
  104. "This test verifies the I2C operation.",
  105. POST_RAM | POST_ALWAYS,
  106. &i2c_post_test,
  107. NULL,
  108. NULL,
  109. CONFIG_SYS_POST_I2C
  110. },
  111. #endif
  112. #if CONFIG_POST & CONFIG_SYS_POST_RTC
  113. {
  114. "RTC test",
  115. "rtc",
  116. "This test verifies the RTC operation.",
  117. POST_RAM | POST_SLOWTEST | POST_MANUAL,
  118. &rtc_post_test,
  119. NULL,
  120. NULL,
  121. CONFIG_SYS_POST_RTC
  122. },
  123. #endif
  124. #if CONFIG_POST & CONFIG_SYS_POST_MEMORY
  125. {
  126. "Memory test",
  127. "memory",
  128. "This test checks RAM.",
  129. POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL,
  130. &memory_post_test,
  131. NULL,
  132. NULL,
  133. CONFIG_SYS_POST_MEMORY
  134. },
  135. #endif
  136. #if CONFIG_POST & CONFIG_SYS_POST_CPU
  137. {
  138. "CPU test",
  139. "cpu",
  140. "This test verifies the arithmetic logic unit of"
  141. " CPU.",
  142. POST_RAM | POST_ALWAYS,
  143. &cpu_post_test,
  144. NULL,
  145. NULL,
  146. CONFIG_SYS_POST_CPU
  147. },
  148. #endif
  149. #if CONFIG_POST & CONFIG_SYS_POST_FPU
  150. {
  151. "FPU test",
  152. "fpu",
  153. "This test verifies the arithmetic logic unit of"
  154. " FPU.",
  155. POST_RAM | POST_ALWAYS,
  156. &fpu_post_test,
  157. NULL,
  158. NULL,
  159. CONFIG_SYS_POST_FPU
  160. },
  161. #endif
  162. #if CONFIG_POST & CONFIG_SYS_POST_UART
  163. #if defined(CONFIG_POST_UART)
  164. CONFIG_POST_UART,
  165. #else
  166. {
  167. "UART test",
  168. "uart",
  169. "This test verifies the UART operation.",
  170. POST_RAM | POST_SLOWTEST | POST_MANUAL,
  171. &uart_post_test,
  172. NULL,
  173. NULL,
  174. CONFIG_SYS_POST_UART
  175. },
  176. #endif /* CONFIG_POST_UART */
  177. #endif
  178. #if CONFIG_POST & CONFIG_SYS_POST_ETHER
  179. {
  180. "ETHERNET test",
  181. "ethernet",
  182. "This test verifies the ETHERNET operation.",
  183. POST_RAM | POST_ALWAYS | POST_MANUAL,
  184. &ether_post_test,
  185. NULL,
  186. NULL,
  187. CONFIG_SYS_POST_ETHER
  188. },
  189. #endif
  190. #if CONFIG_POST & CONFIG_SYS_POST_SPI
  191. {
  192. "SPI test",
  193. "spi",
  194. "This test verifies the SPI operation.",
  195. POST_RAM | POST_ALWAYS | POST_MANUAL,
  196. &spi_post_test,
  197. NULL,
  198. NULL,
  199. CONFIG_SYS_POST_SPI
  200. },
  201. #endif
  202. #if CONFIG_POST & CONFIG_SYS_POST_USB
  203. {
  204. "USB test",
  205. "usb",
  206. "This test verifies the USB operation.",
  207. POST_RAM | POST_ALWAYS | POST_MANUAL,
  208. &usb_post_test,
  209. NULL,
  210. NULL,
  211. CONFIG_SYS_POST_USB
  212. },
  213. #endif
  214. #if CONFIG_POST & CONFIG_SYS_POST_SPR
  215. {
  216. "SPR test",
  217. "spr",
  218. "This test checks SPR contents.",
  219. POST_RAM | POST_ALWAYS,
  220. &spr_post_test,
  221. NULL,
  222. NULL,
  223. CONFIG_SYS_POST_SPR
  224. },
  225. #endif
  226. #if CONFIG_POST & CONFIG_SYS_POST_SYSMON
  227. {
  228. "SYSMON test",
  229. "sysmon",
  230. "This test monitors system hardware.",
  231. POST_RAM | POST_ALWAYS,
  232. &sysmon_post_test,
  233. &sysmon_init_f,
  234. &sysmon_reloc,
  235. CONFIG_SYS_POST_SYSMON
  236. },
  237. #endif
  238. #if CONFIG_POST & CONFIG_SYS_POST_DSP
  239. {
  240. "DSP test",
  241. "dsp",
  242. "This test checks any connected DSP(s).",
  243. POST_RAM | POST_ALWAYS | POST_MANUAL,
  244. &dsp_post_test,
  245. NULL,
  246. NULL,
  247. CONFIG_SYS_POST_DSP
  248. },
  249. #endif
  250. #if CONFIG_POST & CONFIG_SYS_POST_CODEC
  251. {
  252. "CODEC test",
  253. "codec",
  254. "This test checks any connected codec(s).",
  255. POST_RAM | POST_MANUAL,
  256. &codec_post_test,
  257. NULL,
  258. NULL,
  259. CONFIG_SYS_POST_CODEC
  260. },
  261. #endif
  262. #if CONFIG_POST & CONFIG_SYS_POST_ECC
  263. {
  264. "ECC test",
  265. "ecc",
  266. "This test checks the ECC facility of memory.",
  267. POST_ROM | POST_ALWAYS | POST_PREREL,
  268. &ecc_post_test,
  269. NULL,
  270. NULL,
  271. CONFIG_SYS_POST_ECC
  272. },
  273. #endif
  274. #if CONFIG_POST & CONFIG_SYS_POST_BSPEC1
  275. CONFIG_POST_BSPEC1,
  276. #endif
  277. #if CONFIG_POST & CONFIG_SYS_POST_BSPEC2
  278. CONFIG_POST_BSPEC2,
  279. #endif
  280. #if CONFIG_POST & CONFIG_SYS_POST_BSPEC3
  281. CONFIG_POST_BSPEC3,
  282. #endif
  283. #if CONFIG_POST & CONFIG_SYS_POST_BSPEC4
  284. CONFIG_POST_BSPEC4,
  285. #endif
  286. #if CONFIG_POST & CONFIG_SYS_POST_BSPEC5
  287. CONFIG_POST_BSPEC5,
  288. #endif
  289. #if CONFIG_POST & CONFIG_SYS_POST_COPROC
  290. {
  291. "Coprocessors communication test",
  292. "coproc_com",
  293. "This test checks communication with coprocessors.",
  294. POST_RAM | POST_ALWAYS | POST_CRITICAL,
  295. &coprocessor_post_test,
  296. NULL,
  297. NULL,
  298. CONFIG_SYS_POST_COPROC
  299. },
  300. #endif
  301. #if CONFIG_POST & CONFIG_SYS_POST_FLASH
  302. {
  303. "Parallel NOR flash test",
  304. "flash",
  305. "This test verifies parallel flash operations.",
  306. POST_RAM | POST_SLOWTEST | POST_MANUAL,
  307. &flash_post_test,
  308. NULL,
  309. NULL,
  310. CONFIG_SYS_POST_FLASH
  311. },
  312. #endif
  313. };
  314. unsigned int post_list_size = ARRAY_SIZE(post_list);