ADNPESC1.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. /*
  2. * (C) Copyright 2004, Li-Pro.Net <www.li-pro.net>
  3. * Stephan Linz <linz@li-pro.net>
  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. #ifndef __CONFIG_H
  24. #define __CONFIG_H
  25. /***********************************************************************
  26. * Include the whole NIOS CPU configuration.
  27. *
  28. * !!! HAVE TO BE HERE !!! DON'T MOVE THIS PART !!!
  29. *
  30. ***********************************************************************/
  31. #if defined(CONFIG_NIOS_BASE_32)
  32. #include <configs/ADNPESC1_base_32.h>
  33. #else
  34. #error *** CONFIG_SYS_ERROR: you have to setup right NIOS CPU configuration
  35. #endif
  36. /*------------------------------------------------------------------------
  37. * BOARD/CPU -- TOP-LEVEL
  38. *----------------------------------------------------------------------*/
  39. #define CONFIG_NIOS 1 /* NIOS-32 core */
  40. #define CONFIG_ADNPESC1 1 /* SSV ADNP/ESC1 board */
  41. #define CONFIG_SYS_CLK_FREQ CONFIG_SYS_NIOS_CPU_CLK/* 50 MHz core clock */
  42. #define CONFIG_SYS_HZ 1000 /* 1 msec time tick */
  43. #define CONFIG_BOARD_EARLY_INIT_F 1 /* enable early board-spec. init*/
  44. /*------------------------------------------------------------------------
  45. * BASE ADDRESSES / SIZE (Flash, SRAM, SDRAM)
  46. *----------------------------------------------------------------------*/
  47. #if (CONFIG_SYS_NIOS_CPU_SDRAM_SIZE != 0)
  48. #define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_NIOS_CPU_SDRAM_BASE
  49. #define CONFIG_SYS_SDRAM_SIZE CONFIG_SYS_NIOS_CPU_SDRAM_SIZE
  50. #else
  51. #error *** CONFIG_SYS_ERROR: you have to setup any SDRAM in NIOS CPU config
  52. #endif
  53. #if defined(CONFIG_SYS_NIOS_CPU_SRAM_BASE) && defined(CONFIG_SYS_NIOS_CPU_SRAM_SIZE)
  54. #define CONFIG_SYS_SRAM_BASE CONFIG_SYS_NIOS_CPU_SRAM_BASE
  55. #define CONFIG_SYS_SRAM_SIZE CONFIG_SYS_NIOS_CPU_SRAM_SIZE
  56. #else
  57. #undef CONFIG_SYS_SRAM_BASE
  58. #undef CONFIG_SYS_SRAM_SIZE
  59. #endif
  60. #define CONFIG_SYS_VECT_BASE CONFIG_SYS_NIOS_CPU_VEC_BASE
  61. /*------------------------------------------------------------------------
  62. * MEMORY ORGANIZATION - For the most part, you can put things pretty
  63. * much anywhere. This is pretty flexible for Nios. So here we make some
  64. * arbitrary choices & assume that the monitor is placed at the end of
  65. * a memory resource (so you must make sure TEXT_BASE is chosen
  66. * appropriately -- this is very important if you plan to move your
  67. * memory to another place as configured at this time !!!).
  68. *
  69. * -The heap is placed below the monitor.
  70. * -Global data is placed below the heap.
  71. * -The stack is placed below global data (&grows down).
  72. *----------------------------------------------------------------------*/
  73. #define CONFIG_SYS_MONITOR_LEN (256 * 1024) /* Reserve 256k */
  74. #define CONFIG_SYS_GBL_DATA_SIZE 128 /* Global data size rsvd*/
  75. #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128*1024)
  76. #define CONFIG_SYS_MONITOR_BASE TEXT_BASE
  77. #define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE - CONFIG_SYS_MALLOC_LEN)
  78. #define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_MALLOC_BASE - CONFIG_SYS_GBL_DATA_SIZE)
  79. #define CONFIG_SYS_INIT_SP CONFIG_SYS_GBL_DATA_OFFSET
  80. /*------------------------------------------------------------------------
  81. * FLASH (AM29LV065D)
  82. *----------------------------------------------------------------------*/
  83. #if (CONFIG_SYS_NIOS_CPU_FLASH_SIZE != 0)
  84. #define CONFIG_SYS_FLASH_BASE CONFIG_SYS_NIOS_CPU_FLASH_BASE
  85. #define CONFIG_SYS_FLASH_SIZE CONFIG_SYS_NIOS_CPU_FLASH_SIZE
  86. #define CONFIG_SYS_MAX_FLASH_SECT 128 /* Max # sects per bank */
  87. #define CONFIG_SYS_MAX_FLASH_BANKS 1 /* Max # of flash banks */
  88. #define CONFIG_SYS_FLASH_ERASE_TOUT 8000 /* Erase timeout (msec) */
  89. #define CONFIG_SYS_FLASH_WRITE_TOUT 100 /* Write timeout (msec) */
  90. #define CONFIG_SYS_FLASH_WORD_SIZE unsigned short /* flash word size */
  91. #else
  92. #error *** CONFIG_SYS_ERROR: you have to setup any Flash memory in NIOS CPU config
  93. #endif
  94. /*------------------------------------------------------------------------
  95. * ENVIRONMENT
  96. *----------------------------------------------------------------------*/
  97. #if (CONFIG_SYS_NIOS_CPU_FLASH_SIZE != 0)
  98. #define CONFIG_ENV_IS_IN_FLASH 1 /* Environment in flash */
  99. /* Mem addr of environment */
  100. #if defined(CONFIG_NIOS_BASE_32)
  101. #define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + CONFIG_SYS_MONITOR_LEN)
  102. #else
  103. #error *** CONFIG_SYS_ERROR: you have to setup the environment base address CONFIG_ENV_ADDR
  104. #endif
  105. #define CONFIG_ENV_SIZE (64 * 1024) /* 64 KByte (1 sector) */
  106. #define CONFIG_ENV_OVERWRITE /* Serial/eth change Ok */
  107. #else
  108. #define CONFIG_ENV_IS_NOWHERE 1 /* NO Environment */
  109. #endif
  110. /*------------------------------------------------------------------------
  111. * NIOS APPLICATION CODE BASE AREA
  112. *----------------------------------------------------------------------*/
  113. #if ((CONFIG_ENV_ADDR + CONFIG_ENV_SIZE) == 0x1050000)
  114. #define CONFIG_SYS_ADNPESC1_UPDATE_LOAD_ADDR "0x2000100"
  115. #define CONFIG_SYS_ADNPESC1_NIOS_APPL_ENTRY "0x1050000"
  116. #define CONFIG_SYS_ADNPESC1_NIOS_APPL_IDENT "0x105000c"
  117. #define CONFIG_SYS_ADNPESC1_NIOS_APPL_END "0x11fffff"
  118. #define CONFIG_SYS_ADNPESC1_FILESYSTEM_BASE "0x1200000"
  119. #define CONFIG_SYS_ADNPESC1_FILESYSTEM_END "0x17fffff"
  120. #else
  121. #error *** CONFIG_SYS_ERROR: missing right appl.code base configuration, expand your config.h
  122. #endif
  123. #define CONFIG_SYS_ADNPESC1_NIOS_IDENTIFIER "Nios"
  124. /*------------------------------------------------------------------------
  125. * BOOT ENVIRONMENT
  126. *----------------------------------------------------------------------*/
  127. #ifdef CONFIG_DNPEVA2 /* DNP/EVA2 base board */
  128. #define CONFIG_SYS_ADNPESC1_SLED_BOOT_OFF "sled boot off; "
  129. #define CONFIG_SYS_ADNPESC1_SLED_RED_BLINK "sled red blink; "
  130. #else
  131. #define CONFIG_SYS_ADNPESC1_SLED_BOOT_OFF
  132. #define CONFIG_SYS_ADNPESC1_SLED_RED_BLINK
  133. #endif
  134. #define CONFIG_BOOTDELAY 5
  135. #define CONFIG_BOOTCOMMAND \
  136. "if itest.s *$appl_ident_addr == \"$appl_ident_str\"; " \
  137. "then " \
  138. "wd off; " \
  139. CONFIG_SYS_ADNPESC1_SLED_BOOT_OFF \
  140. "go $appl_entry_addr; " \
  141. "else " \
  142. CONFIG_SYS_ADNPESC1_SLED_RED_BLINK \
  143. "echo *** missing \"$appl_ident_str\" at $appl_ident_addr; "\
  144. "echo *** invalid application at $appl_entry_addr; " \
  145. "echo *** stop bootup...; " \
  146. "fi"
  147. /*------------------------------------------------------------------------
  148. * EXTRA ENVIRONMENT
  149. *----------------------------------------------------------------------*/
  150. #ifdef CONFIG_DNPEVA2 /* DNP/EVA2 base board */
  151. #define CONFIG_SYS_ADNPESC1_SLED_YELLO_ON "sled yellow on; "
  152. #define CONFIG_SYS_ADNPESC1_SLED_YELLO_OFF "sled yellow off; "
  153. #else
  154. #define CONFIG_SYS_ADNPESC1_SLED_YELLO_ON
  155. #define CONFIG_SYS_ADNPESC1_SLED_YELLO_OFF
  156. #endif
  157. #define CONFIG_EXTRA_ENV_SETTINGS \
  158. "update_allowed=0\0" \
  159. "update_load_addr=" CONFIG_SYS_ADNPESC1_UPDATE_LOAD_ADDR "\0" \
  160. "appl_entry_addr=" CONFIG_SYS_ADNPESC1_NIOS_APPL_ENTRY "\0" \
  161. "appl_end_addr=" CONFIG_SYS_ADNPESC1_NIOS_APPL_END "\0" \
  162. "appl_ident_addr=" CONFIG_SYS_ADNPESC1_NIOS_APPL_IDENT "\0" \
  163. "appl_ident_str=" CONFIG_SYS_ADNPESC1_NIOS_IDENTIFIER "\0" \
  164. "appl_name=ADNPESC1/base32/linux.bin\0" \
  165. "appl_update=" \
  166. "if itest.b $update_allowed != 0; " \
  167. "then " \
  168. CONFIG_SYS_ADNPESC1_SLED_YELLO_ON \
  169. "tftp $update_load_addr $appl_name; " \
  170. "protect off $appl_entry_addr $appl_end_addr; " \
  171. "era $appl_entry_addr $appl_end_addr; " \
  172. "cp.b $update_load_addr $appl_entry_addr $filesize; "\
  173. CONFIG_SYS_ADNPESC1_SLED_YELLO_OFF \
  174. "else " \
  175. "echo *** update not allowed (update_allowed=$update_allowed); "\
  176. "fi\0" \
  177. "fs_base_addr=" CONFIG_SYS_ADNPESC1_FILESYSTEM_BASE "\0" \
  178. "fs_end_addr=" CONFIG_SYS_ADNPESC1_FILESYSTEM_END "\0" \
  179. "fs_name=ADNPESC1/base32/romfs.img\0" \
  180. "fs_update=" \
  181. "if itest.b $update_allowed != 0; " \
  182. "then " \
  183. CONFIG_SYS_ADNPESC1_SLED_YELLO_ON \
  184. "tftp $update_load_addr $fs_name; " \
  185. "protect off $fs_base_addr $fs_end_addr; " \
  186. "era $fs_base_addr $fs_end_addr; " \
  187. "cp.b $update_load_addr $fs_base_addr $filesize; "\
  188. CONFIG_SYS_ADNPESC1_SLED_YELLO_OFF \
  189. "else " \
  190. "echo *** update not allowed (update_allowed=$update_allowed); "\
  191. "fi\0" \
  192. "uboot_name=ADNPESC1/base32/u-boot.bin\0" \
  193. "uboot_loadnrun=" \
  194. "if ping $serverip; " \
  195. "then " \
  196. CONFIG_SYS_ADNPESC1_SLED_YELLO_ON \
  197. "tftp $update_load_addr $uboot_name; " \
  198. "wd off; " \
  199. "go $update_load_addr; " \
  200. "else " \
  201. "echo *** missing connection to $serverip; " \
  202. "echo *** check your network and try again...; "\
  203. "fi\0"
  204. /*------------------------------------------------------------------------
  205. * CONSOLE
  206. *----------------------------------------------------------------------*/
  207. #if (CONFIG_SYS_NIOS_CPU_UART_NUMS != 0)
  208. #define CONFIG_SYS_NIOS_CONSOLE CONFIG_SYS_NIOS_CPU_UART0 /* 1st UART is Cons. */
  209. #if (CONFIG_SYS_NIOS_CPU_UART0_BR != 0)
  210. #define CONFIG_SYS_NIOS_FIXEDBAUD 1 /* Baudrate is fixed */
  211. #define CONFIG_BAUDRATE CONFIG_SYS_NIOS_CPU_UART0_BR
  212. #else
  213. #undef CONFIG_SYS_NIOS_FIXEDBAUD
  214. #define CONFIG_BAUDRATE 115200
  215. #endif
  216. #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
  217. #else
  218. #error *** CONFIG_SYS_ERROR: you have to setup at least one UART in NIOS CPU config
  219. #endif
  220. /*------------------------------------------------------------------------
  221. * TIMER FOR TIMEBASE -- Nios doesn't have the equivalent of ppc PIT,
  222. * so an avalon bus timer is required.
  223. *----------------------------------------------------------------------*/
  224. #if (CONFIG_SYS_NIOS_CPU_TIMER_NUMS != 0) && defined(CONFIG_SYS_NIOS_CPU_TICK_TIMER)
  225. #if (CONFIG_SYS_NIOS_CPU_TICK_TIMER == 0)
  226. #define CONFIG_SYS_NIOS_TMRBASE CONFIG_SYS_NIOS_CPU_TIMER0 /* TIMER0 as tick */
  227. #define CONFIG_SYS_NIOS_TMRIRQ CONFIG_SYS_NIOS_CPU_TIMER0_IRQ
  228. #if (CONFIG_SYS_NIOS_CPU_TIMER0_FP == 1) /* fixed period */
  229. #if (CONFIG_SYS_NIOS_CPU_TIMER0_PER >= CONFIG_SYS_HZ)
  230. #define CONFIG_SYS_NIOS_TMRMS (CONFIG_SYS_NIOS_CPU_TIMER0_PER / CONFIG_SYS_HZ)
  231. #else
  232. #error *** CONFIG_SYS_ERROR: you have to use a timer periode greater than CONFIG_SYS_HZ
  233. #endif
  234. #undef CONFIG_SYS_NIOS_TMRCNT /* no preloadable counter value */
  235. #elif (CONFIG_SYS_NIOS_CPU_TIMER0_FP == 0) /* variable period */
  236. #if (CONFIG_SYS_HZ <= 1000)
  237. #define CONFIG_SYS_NIOS_TMRMS (1000 / CONFIG_SYS_HZ)
  238. #else
  239. #error *** CONFIG_SYS_ERROR: sorry, CONFIG_SYS_HZ have to be less than 1000
  240. #endif
  241. #define CONFIG_SYS_NIOS_TMRCNT (CONFIG_SYS_CLK_FREQ / CONFIG_SYS_HZ)
  242. #else
  243. #error *** CONFIG_SYS_ERROR: you have to define CONFIG_SYS_NIOS_CPU_TIMER0_FP correct
  244. #endif
  245. #elif (CONFIG_SYS_NIOS_CPU_TICK_TIMER == 1)
  246. #define CONFIG_SYS_NIOS_TMRBASE CONFIG_SYS_NIOS_CPU_TIMER1 /* TIMER1 as tick */
  247. #define CONFIG_SYS_NIOS_TMRIRQ CONFIG_SYS_NIOS_CPU_TIMER1_IRQ
  248. #if (CONFIG_SYS_NIOS_CPU_TIMER1_FP == 1) /* fixed period */
  249. #if (CONFIG_SYS_NIOS_CPU_TIMER1_PER >= CONFIG_SYS_HZ)
  250. #define CONFIG_SYS_NIOS_TMRMS (CONFIG_SYS_NIOS_CPU_TIMER1_PER / CONFIG_SYS_HZ)
  251. #else
  252. #error *** CONFIG_SYS_ERROR: you have to use a timer periode greater than CONFIG_SYS_HZ
  253. #endif
  254. #undef CONFIG_SYS_NIOS_TMRCNT /* no preloadable counter value */
  255. #elif (CONFIG_SYS_NIOS_CPU_TIMER1_FP == 0) /* variable period */
  256. #if (CONFIG_SYS_HZ <= 1000)
  257. #define CONFIG_SYS_NIOS_TMRMS (1000 / CONFIG_SYS_HZ)
  258. #else
  259. #error *** CONFIG_SYS_ERROR: sorry, CONFIG_SYS_HZ have to be less than 1000
  260. #endif
  261. #define CONFIG_SYS_NIOS_TMRCNT (CONFIG_SYS_CLK_FREQ / CONFIG_SYS_HZ)
  262. #else
  263. #error *** CONFIG_SYS_ERROR: you have to define CONFIG_SYS_NIOS_CPU_TIMER1_FP correct
  264. #endif
  265. #endif /* CONFIG_SYS_NIOS_CPU_TICK_TIMER */
  266. #else
  267. #error *** CONFIG_SYS_ERROR: you have to setup at least one TIMER in NIOS CPU config
  268. #endif
  269. /*------------------------------------------------------------------------
  270. * WATCHDOG (or better MAX823 supervisory circuite access)
  271. *----------------------------------------------------------------------*/
  272. #define CONFIG_HW_WATCHDOG 1 /* board specific WD */
  273. #ifdef CONFIG_HW_WATCHDOG
  274. /* MAX823 supervisor -- watchdog enable port at: */
  275. #if (CONFIG_SYS_NIOS_CPU_WDENA_PIO == 0)
  276. #define CONFIG_HW_WDENA_BASE CONFIG_SYS_NIOS_CPU_PIO0 /* PIO0 */
  277. #elif (CONFIG_SYS_NIOS_CPU_WDENA_PIO == 1)
  278. #define CONFIG_HW_WDENA_BASE CONFIG_SYS_NIOS_CPU_PIO1 /* PIO1 */
  279. #elif (CONFIG_SYS_NIOS_CPU_WDENA_PIO == 2)
  280. #define CONFIG_HW_WDENA_BASE CONFIG_SYS_NIOS_CPU_PIO2 /* PIO2 */
  281. #elif (CONFIG_SYS_NIOS_CPU_WDENA_PIO == 3)
  282. #define CONFIG_HW_WDENA_BASE CONFIG_SYS_NIOS_CPU_PIO3 /* PIO3 */
  283. #elif (CONFIG_SYS_NIOS_CPU_WDENA_PIO == 4)
  284. #define CONFIG_HW_WDENA_BASE CONFIG_SYS_NIOS_CPU_PIO4 /* PIO4 */
  285. #elif (CONFIG_SYS_NIOS_CPU_WDENA_PIO == 5)
  286. #define CONFIG_HW_WDENA_BASE CONFIG_SYS_NIOS_CPU_PIO5 /* PIO5 */
  287. #elif (CONFIG_SYS_NIOS_CPU_WDENA_PIO == 6)
  288. #define CONFIG_HW_WDENA_BASE CONFIG_SYS_NIOS_CPU_PIO6 /* PIO6 */
  289. #elif (CONFIG_SYS_NIOS_CPU_WDENA_PIO == 7)
  290. #define CONFIG_HW_WDENA_BASE CONFIG_SYS_NIOS_CPU_PIO7 /* PIO7 */
  291. #elif (CONFIG_SYS_NIOS_CPU_WDENA_PIO == 8)
  292. #define CONFIG_HW_WDENA_BASE CONFIG_SYS_NIOS_CPU_PIO8 /* PIO8 */
  293. #elif (CONFIG_SYS_NIOS_CPU_WDENA_PIO == 9)
  294. #define CONFIG_HW_WDENA_BASE CONFIG_SYS_NIOS_CPU_PIO9 /* PIO9 */
  295. #else
  296. #error *** CONFIG_SYS_ERROR: you have to setup at least one WDENA_PIO in NIOS CPU config
  297. #endif
  298. /* MAX823 supervisor -- watchdog trigger port at: */
  299. #if (CONFIG_SYS_NIOS_CPU_WDTOG_PIO == 0)
  300. #define CONFIG_HW_WDTOG_BASE CONFIG_SYS_NIOS_CPU_PIO0 /* PIO0 */
  301. #elif (CONFIG_SYS_NIOS_CPU_WDTOG_PIO == 1)
  302. #define CONFIG_HW_WDTOG_BASE CONFIG_SYS_NIOS_CPU_PIO1 /* PIO1 */
  303. #elif (CONFIG_SYS_NIOS_CPU_WDTOG_PIO == 2)
  304. #define CONFIG_HW_WDTOG_BASE CONFIG_SYS_NIOS_CPU_PIO2 /* PIO2 */
  305. #elif (CONFIG_SYS_NIOS_CPU_WDTOG_PIO == 3)
  306. #define CONFIG_HW_WDTOG_BASE CONFIG_SYS_NIOS_CPU_PIO3 /* PIO3 */
  307. #elif (CONFIG_SYS_NIOS_CPU_WDTOG_PIO == 4)
  308. #define CONFIG_HW_WDTOG_BASE CONFIG_SYS_NIOS_CPU_PIO4 /* PIO4 */
  309. #elif (CONFIG_SYS_NIOS_CPU_WDTOG_PIO == 5)
  310. #define CONFIG_HW_WDTOG_BASE CONFIG_SYS_NIOS_CPU_PIO5 /* PIO5 */
  311. #elif (CONFIG_SYS_NIOS_CPU_WDTOG_PIO == 6)
  312. #define CONFIG_HW_WDTOG_BASE CONFIG_SYS_NIOS_CPU_PIO6 /* PIO6 */
  313. #elif (CONFIG_SYS_NIOS_CPU_WDTOG_PIO == 7)
  314. #define CONFIG_HW_WDTOG_BASE CONFIG_SYS_NIOS_CPU_PIO7 /* PIO7 */
  315. #elif (CONFIG_SYS_NIOS_CPU_WDTOG_PIO == 8)
  316. #define CONFIG_HW_WDTOG_BASE CONFIG_SYS_NIOS_CPU_PIO8 /* PIO8 */
  317. #elif (CONFIG_SYS_NIOS_CPU_WDTOG_PIO == 9)
  318. #define CONFIG_HW_WDTOG_BASE CONFIG_SYS_NIOS_CPU_PIO9 /* PIO9 */
  319. #else
  320. #error *** CONFIG_SYS_ERROR: you have to setup at least one WDTOG_PIO in NIOS CPU config
  321. #endif
  322. #if defined(CONFIG_NIOS_BASE_32) /* NIOS CPU specifics */
  323. #define CONFIG_HW_WDENA_BIT 0 /* WD enable @ Bit 0 */
  324. #define CONFIG_HW_WDTOG_BIT 0 /* WD trigger @ Bit 0 */
  325. #define CONFIG_HW_WDPORT_WRONLY 1 /* each WD port wr/only*/
  326. #else
  327. #error *** CONFIG_SYS_ERROR: missing watchdog bit configuration, expand your config.h
  328. #endif
  329. #endif /* CONFIG_HW_WATCHDOG */
  330. /*------------------------------------------------------------------------
  331. * SERIAL PERIPHAREL INTERFACE
  332. *----------------------------------------------------------------------*/
  333. #if (CONFIG_SYS_NIOS_CPU_SPI_NUMS == 1)
  334. #define CONFIG_NIOS_SPI 1 /* SPI support active */
  335. #define CONFIG_SYS_NIOS_SPIBASE CONFIG_SYS_NIOS_CPU_SPI0
  336. #define CONFIG_SYS_NIOS_SPIBITS CONFIG_SYS_NIOS_CPU_SPI0_BITS
  337. #define CONFIG_RTC_DS1306 1 /* Dallas 1306 real time clock */
  338. #define CONFIG_SYS_SPI_RTC_DEVID 0 /* as 1st SPI device */
  339. #else
  340. #undef CONFIG_NIOS_SPI /* NO SPI support */
  341. #endif
  342. /*------------------------------------------------------------------------
  343. * Ethernet -- needs work!
  344. *----------------------------------------------------------------------*/
  345. #if (CONFIG_SYS_NIOS_CPU_LAN_NUMS == 1)
  346. #if (CONFIG_SYS_NIOS_CPU_LAN0_TYPE == 0) /* LAN91C111 */
  347. #define CONFIG_DRIVER_SMC91111 /* Using SMC91c111 */
  348. #undef CONFIG_SMC91111_EXT_PHY /* Internal PHY */
  349. #define CONFIG_SMC91111_BASE (CONFIG_SYS_NIOS_CPU_LAN0_BASE + CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
  350. #if (CONFIG_SYS_NIOS_CPU_LAN0_BUSW == 32)
  351. #define CONFIG_SMC_USE_32_BIT 1
  352. #else /* no */
  353. #undef CONFIG_SMC_USE_32_BIT
  354. #endif
  355. #elif (CONFIG_SYS_NIOS_CPU_LAN0_TYPE == 1) /* CS8900A */
  356. /********************************************/
  357. /* !!! CS8900 is __not__ tested on NIOS !!! */
  358. /********************************************/
  359. #define CONFIG_DRIVER_CS8900 /* Using CS8900 */
  360. #define CS8900_BASE (CONFIG_SYS_NIOS_CPU_LAN0_BASE + CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
  361. #if (CONFIG_SYS_NIOS_CPU_LAN0_BUSW == 32)
  362. #undef CS8900_BUS16
  363. #define CS8900_BUS32 1
  364. #else /* no */
  365. #define CS8900_BUS16 1
  366. #undef CS8900_BUS32
  367. #endif
  368. #else
  369. #error *** CONFIG_SYS_ERROR: invalid LAN0 chip type, check your NIOS CPU config
  370. #endif
  371. #define CONFIG_ETHADDR 02:80:ae:20:60:6f
  372. #define CONFIG_NETMASK 255.255.255.248
  373. #define CONFIG_IPADDR 192.168.161.84
  374. #define CONFIG_SERVERIP 192.168.161.85
  375. #else
  376. #error *** CONFIG_SYS_ERROR: you have to setup just one LAN only or expand your config.h
  377. #endif
  378. /*------------------------------------------------------------------------
  379. * STATUS LEDs
  380. *----------------------------------------------------------------------*/
  381. #if (CONFIG_SYS_NIOS_CPU_PIO_NUMS != 0) && defined(CONFIG_SYS_NIOS_CPU_LED_PIO)
  382. #if (CONFIG_SYS_NIOS_CPU_LED_PIO == 0)
  383. #define STATUS_LED_BASE CONFIG_SYS_NIOS_CPU_PIO0
  384. #define STATUS_LED_BITS CONFIG_SYS_NIOS_CPU_PIO0_BITS
  385. #define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */
  386. #if (CONFIG_SYS_NIOS_CPU_PIO0_TYPE == 1)
  387. #define STATUS_LED_WRONLY 1
  388. #else
  389. #undef STATUS_LED_WRONLY
  390. #endif
  391. #elif (CONFIG_SYS_NIOS_CPU_LED_PIO == 1)
  392. #define STATUS_LED_BASE CONFIG_SYS_NIOS_CPU_PIO1
  393. #define STATUS_LED_BITS CONFIG_SYS_NIOS_CPU_PIO1_BITS
  394. #define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */
  395. #if (CONFIG_SYS_NIOS_CPU_PIO1_TYPE == 1)
  396. #define STATUS_LED_WRONLY 1
  397. #else
  398. #undef STATUS_LED_WRONLY
  399. #endif
  400. #elif (CONFIG_SYS_NIOS_CPU_LED_PIO == 2)
  401. #define STATUS_LED_BASE CONFIG_SYS_NIOS_CPU_PIO2
  402. #define STATUS_LED_BITS CONFIG_SYS_NIOS_CPU_PIO2_BITS
  403. #define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */
  404. #if (CONFIG_SYS_NIOS_CPU_PIO2_TYPE == 1)
  405. #define STATUS_LED_WRONLY 1
  406. #else
  407. #undef STATUS_LED_WRONLY
  408. #endif
  409. #elif (CONFIG_SYS_NIOS_CPU_LED_PIO == 3)
  410. #error *** CONFIG_SYS_ERROR: status LEDs at PIO3 not supported, expand your config.h
  411. #elif (CONFIG_SYS_NIOS_CPU_LED_PIO == 4)
  412. #error *** CONFIG_SYS_ERROR: status LEDs at PIO4 not supported, expand your config.h
  413. #elif (CONFIG_SYS_NIOS_CPU_LED_PIO == 5)
  414. #error *** CONFIG_SYS_ERROR: status LEDs at PIO5 not supported, expand your config.h
  415. #elif (CONFIG_SYS_NIOS_CPU_LED_PIO == 6)
  416. #error *** CONFIG_SYS_ERROR: status LEDs at PIO6 not supported, expand your config.h
  417. #elif (CONFIG_SYS_NIOS_CPU_LED_PIO == 7)
  418. #error *** CONFIG_SYS_ERROR: status LEDs at PIO7 not supported, expand your config.h
  419. #elif (CONFIG_SYS_NIOS_CPU_LED_PIO == 8)
  420. #error *** CONFIG_SYS_ERROR: status LEDs at PIO8 not supported, expand your config.h
  421. #elif (CONFIG_SYS_NIOS_CPU_LED_PIO == 9)
  422. #error *** CONFIG_SYS_ERROR: status LEDs at PIO9 not supported, expand your config.h
  423. #else
  424. #error *** CONFIG_SYS_ERROR: you have to set CONFIG_SYS_NIOS_CPU_LED_PIO in right case
  425. #endif
  426. #define CONFIG_STATUS_LED 1 /* enable status led driver */
  427. #define STATUS_LED_BIT (1 << 0) /* LED[0] */
  428. #define STATUS_LED_STATE STATUS_LED_BLINKING
  429. #define STATUS_LED_BOOT_STATE STATUS_LED_OFF
  430. #define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 2) /* ca. 1 Hz */
  431. #define STATUS_LED_BOOT 0 /* boot LED */
  432. #if (STATUS_LED_BITS > 1)
  433. #define STATUS_LED_BIT1 (1 << 1) /* LED[1] */
  434. #define STATUS_LED_STATE1 STATUS_LED_OFF
  435. #define STATUS_LED_PERIOD1 (CONFIG_SYS_HZ / 10) /* ca. 5 Hz */
  436. #define STATUS_LED_RED 1 /* fail LED */
  437. #endif
  438. #if (STATUS_LED_BITS > 2)
  439. #define STATUS_LED_BIT2 (1 << 2) /* LED[2] */
  440. #define STATUS_LED_STATE2 STATUS_LED_OFF
  441. #define STATUS_LED_PERIOD2 (CONFIG_SYS_HZ / 2) /* ca. 1 Hz */
  442. #define STATUS_LED_YELLOW 2 /* info LED */
  443. #endif
  444. #if (STATUS_LED_BITS > 3)
  445. #define STATUS_LED_BIT3 (1 << 3) /* LED[3] */
  446. #define STATUS_LED_STATE3 STATUS_LED_OFF
  447. #define STATUS_LED_PERIOD3 (CONFIG_SYS_HZ / 2) /* ca. 1 Hz */
  448. #define STATUS_LED_GREEN 3 /* info LED */
  449. #endif
  450. #define STATUS_LED_PAR 1 /* makes status_led.h happy */
  451. #endif /* CONFIG_SYS_NIOS_CPU_PIO_NUMS */
  452. /*------------------------------------------------------------------------
  453. * Diagnostics / Power On Self Tests
  454. *----------------------------------------------------------------------*/
  455. #define CONFIG_POST CONFIG_SYS_POST_RTC
  456. #define CONFIG_SYS_NIOS_POST_WORD_ADDR (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
  457. /*
  458. * BOOTP options
  459. */
  460. #define CONFIG_BOOTP_BOOTFILESIZE
  461. #define CONFIG_BOOTP_BOOTPATH
  462. #define CONFIG_BOOTP_GATEWAY
  463. #define CONFIG_BOOTP_HOSTNAME
  464. /*
  465. * Command line configuration.
  466. */
  467. #include <config_cmd_default.h>
  468. #define CONFIG_CMD_BSP
  469. #define CONFIG_CMD_CDP
  470. #define CONFIG_CMD_DHCP
  471. #define CONFIG_CMD_DIAG
  472. #define CONFIG_CMD_DISPLAY
  473. #define CONFIG_CMD_EXT2
  474. #define CONFIG_CMD_IMMAP
  475. #define CONFIG_CMD_IRQ
  476. #define CONFIG_CMD_PING
  477. #define CONFIG_CMD_PORTIO
  478. #define CONFIG_CMD_REGINFO
  479. #define CONFIG_CMD_REISER
  480. #define CONFIG_CMD_SAVES
  481. #define CONFIG_CMD_SDRAM
  482. #define CONFIG_CMD_SNTP
  483. #undef CONFIG_CMD_NFS
  484. #undef CONFIG_CMD_XIMG
  485. #if (CONFIG_SYS_NIOS_CPU_SPI_NUMS == 1)
  486. #define CONFIG_CMD_DATE
  487. #define CONFIG_CMD_SPI
  488. #endif
  489. /*------------------------------------------------------------------------
  490. * KGDB
  491. *----------------------------------------------------------------------*/
  492. #if defined(CONFIG_CMD_KGDB)
  493. #define CONFIG_KGDB_BAUDRATE 9600
  494. #endif
  495. /*------------------------------------------------------------------------
  496. * MISC
  497. *----------------------------------------------------------------------*/
  498. #define CONFIG_SYS_LONGHELP /* undef to save memory */
  499. #define CONFIG_SYS_HUSH_PARSER 1 /* use "hush" command parser
  500. undef to save memory */
  501. #define CONFIG_SYS_PROMPT "ADNPESC1 > " /* Monitor Command Prompt */
  502. #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
  503. #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) /* Print Buffer Size */
  504. #define CONFIG_SYS_MAXARGS 64 /* max number of command args*/
  505. #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */
  506. #ifdef CONFIG_SYS_HUSH_PARSER
  507. #define CONFIG_SYS_PROMPT_HUSH_PS2 "[]> "
  508. #endif
  509. /* Default load address */
  510. #if (CONFIG_SYS_SRAM_SIZE != 0)
  511. /* default in SRAM */
  512. #define CONFIG_SYS_LOAD_ADDR CONFIG_SYS_SRAM_BASE
  513. #elif (CONFIG_SYS_SDRAM_SIZE != 0)
  514. /* default in SDRAM */
  515. #if (CONFIG_SYS_SDRAM_BASE == CONFIG_SYS_NIOS_CPU_VEC_BASE)
  516. #if 1
  517. #define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_NIOS_CPU_VEC_SIZE)
  518. #else
  519. #define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + 0x400000)
  520. #endif
  521. #else
  522. #define CONFIG_SYS_LOAD_ADDR CONFIG_SYS_SDRAM_BASE
  523. #endif
  524. #else
  525. #undef CONFIG_SYS_LOAD_ADDR /* force error break */
  526. #endif
  527. /* MEM test area */
  528. #if (CONFIG_SYS_SDRAM_SIZE != 0)
  529. /* SDRAM begin to stack area (1MB stack) */
  530. #if (CONFIG_SYS_SDRAM_BASE == CONFIG_SYS_NIOS_CPU_VEC_BASE)
  531. #if 0
  532. #define CONFIG_SYS_MEMTEST_START (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_NIOS_CPU_VEC_SIZE)
  533. #else
  534. #define CONFIG_SYS_MEMTEST_START (CONFIG_SYS_SDRAM_BASE + 0x400000)
  535. #endif
  536. #else
  537. #define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE
  538. #endif
  539. #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_INIT_SP - (1024 * 1024))
  540. #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_INIT_SP - (1024 * 1024))
  541. #else
  542. #undef CONFIG_SYS_MEMTEST_START /* force error break */
  543. #undef CONFIG_SYS_MEMTEST_END
  544. #endif
  545. /*
  546. * JFFS2 partitions
  547. *
  548. */
  549. /* No command line, one static partition */
  550. #undef CONFIG_CMD_MTDPARTS
  551. #define CONFIG_JFFS2_DEV "nor"
  552. #define CONFIG_JFFS2_PART_SIZE 0xFFFFFFFF
  553. #define CONFIG_JFFS2_PART_OFFSET 0x00000000
  554. /* mtdparts command line support */
  555. /*
  556. #define CONFIG_CMD_MTDPARTS
  557. #define MTDIDS_DEFAULT ""
  558. #define MTDPARTS_DEFAULT ""
  559. */
  560. #endif /* __CONFIG_H */