netstal-common.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. /*
  2. * (C) Copyright 2008
  3. * Niklaus Giger, Netstal Maschinen AG, niklaus.giger@netstal.com
  4. * adapted from amcc-common.h by
  5. * (C) Copyright 2008
  6. * * Stefan Roese, DENX Software Engineering, sr@denx.de.
  7. *
  8. * Common configuration options for all Netstal boards
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. */
  25. #ifndef __NETSTAL_COMMON_H
  26. #define __NETSTAL_COMMON_H
  27. #define CONFIG_SYS_SDRAM_BASE 0x00000000 /* _must_ be 0 */
  28. #define CONFIG_SYS_MONITOR_BASE TEXT_BASE /* Start of U-Boot */
  29. #define CONFIG_SYS_MONITOR_LEN (320 * 1024) /* Reserve 320 kB for Monitor */
  30. #define CONFIG_SYS_MALLOC_LEN (256 * 1024) /* Reserve 256 kB for malloc() */
  31. /*
  32. * UART
  33. */
  34. #define CONFIG_SERIAL_MULTI
  35. #define CONFIG_SYS_BAUDRATE_TABLE \
  36. {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
  37. /*
  38. * I2C
  39. */
  40. #define CONFIG_HARD_I2C 1 /* I2C with hardware support */
  41. #define CONFIG_SYS_I2C_SPEED 400000 /* I2C speed and slave address */
  42. #define CONFIG_SYS_I2C_SLAVE 0x7F
  43. /* This is the 7bit address of the device, not including P. */
  44. #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50
  45. #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
  46. /* The EEPROM can do 16byte ( 1 << 4 ) page writes. */
  47. #define CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW 0x07
  48. #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 4
  49. #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 10
  50. #define CONFIG_SYS_EEPROM_PAGE_WRITE_ENABLE
  51. /*
  52. * Ethernet/EMAC/PHY
  53. */
  54. #define CONFIG_MII /* MII PHY management */
  55. #define CONFIG_PHY_ADDR 1 /* PHY address */
  56. #if defined(CONFIG_440)
  57. #define CONFIG_NET_MULTI 1
  58. #define CONFIG_NETCONSOLE /* include NetConsole support */
  59. #define CONFIG_SYS_RX_ETH_BUFFER 32 /* number of eth rx buffers */
  60. #else
  61. #define CONFIG_SYS_RX_ETH_BUFFER 16 /* number of eth rx buffers */
  62. #endif
  63. #define CONFIG_HAS_ETH0
  64. /*
  65. * Commands
  66. */
  67. #include <config_cmd_default.h>
  68. #define CONFIG_CMD_ASKENV
  69. #if defined(CONFIG_440)
  70. #define CONFIG_CMD_CACHE
  71. #endif
  72. #define CONFIG_CMD_DHCP
  73. #define CONFIG_CMD_DIAG
  74. #define CONFIG_CMD_EEPROM
  75. #define CONFIG_CMD_ELF
  76. #define CONFIG_CMD_I2C
  77. #define CONFIG_CMD_IRQ
  78. #define CONFIG_CMD_MII
  79. #define CONFIG_CMD_NET
  80. #define CONFIG_CMD_NFS
  81. #define CONFIG_CMD_PING
  82. #define CONFIG_CMD_REGINFO
  83. #define CONFIG_BOOT_RETRY_TIME 30
  84. #define CONFIG_RESET_TO_RETRY
  85. /*
  86. * Miscellaneous configurable options
  87. */
  88. #define CONFIG_BOOTDELAY 1 /* autoboot after 1 second */
  89. #define CONFIG_SYS_LONGHELP /* undef to save memory */
  90. #define CONFIG_SYS_PROMPT "=> " /* Monitor Command Prompt */
  91. #if defined(CONFIG_CMD_KGDB)
  92. #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
  93. #else
  94. #define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */
  95. #endif
  96. #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
  97. #define CONFIG_SYS_MAXARGS 16 /* max number of command args */
  98. #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */
  99. #define CONFIG_SYS_MEMTEST_START 0x0400000 /* memtest works on */
  100. #define CONFIG_SYS_MEMTEST_END 0x0C00000 /* 4 ... 12 MB in DRAM */
  101. #define CONFIG_SYS_LOAD_ADDR 0x100000 /* default load address */
  102. #define CONFIG_SYS_EXTBDINFO /* To use extended board_into (bd_t) */
  103. #define CONFIG_SYS_HZ 1000 /* decrementer freq: 1 ms ticks */
  104. #define CONFIG_CMDLINE_EDITING /* add command line history */
  105. #define CONFIG_AUTO_COMPLETE /* add autocompletion support */
  106. #define CONFIG_LOOPW /* enable loopw command */
  107. #define CONFIG_MX_CYCLIC /* enable mdc/mwc commands */
  108. #define CONFIG_ZERO_BOOTDELAY_CHECK /* check for keypress on bootdelay==0 */
  109. #define CONFIG_VERSION_VARIABLE /* include version env variable */
  110. #define CONFIG_SYS_CONSOLE_INFO_QUIET /* don't print console @ startup*/
  111. #define CONFIG_SYS_HUSH_PARSER /* Use the HUSH parser */
  112. #ifdef CONFIG_SYS_HUSH_PARSER
  113. #define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
  114. #endif
  115. #define CONFIG_LOADS_ECHO /* echo on for serial download */
  116. #define CONFIG_SYS_LOADS_BAUD_CHANGE /* allow baudrate change */
  117. /*
  118. * BOOTP options
  119. */
  120. #define CONFIG_BOOTP_BOOTFILESIZE
  121. #define CONFIG_BOOTP_BOOTPATH
  122. #define CONFIG_BOOTP_GATEWAY
  123. #define CONFIG_BOOTP_HOSTNAME
  124. #define CONFIG_BOOTP_SUBNETMASK
  125. /*
  126. * For booting Linux, the board info and command line data
  127. * have to be in the first 8 MB of memory, since this is
  128. * the maximum mapped by the Linux kernel during initialization.
  129. */
  130. #define CONFIG_SYS_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */
  131. /*
  132. * Internal Definitions
  133. */
  134. #if defined(CONFIG_CMD_KGDB)
  135. #define CONFIG_KGDB_BAUDRATE 230400 /* speed to run kgdb serial port*/
  136. #define CONFIG_KGDB_SER_INDEX 2 /* which serial port to use */
  137. #endif
  138. /*
  139. * Pass open firmware flat tree
  140. */
  141. #define CONFIG_OF_LIBFDT
  142. #define CONFIG_OF_BOARD_SETUP
  143. /*
  144. * Booting and default environment
  145. */
  146. #define CONFIG_PREBOOT "echo;" \
  147. "echo Type \"run net_nfs\" to mount root filesystem over NFS;" \
  148. "echo"
  149. #define CONFIG_BOOTCOMMAND "run vx"
  150. /*
  151. * Only very few boards have default console not on ttyS0 (like Taishan)
  152. */
  153. #if !defined(CONFIG_USE_TTY)
  154. #define CONFIG_USE_TTY ttyS0
  155. #endif
  156. /*
  157. * Only some 4xx PPC's are equipped with an FPU
  158. */
  159. #if defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
  160. defined(CONFIG_460EX) || defined(CONFIG_460GT)
  161. #define CONFIG_NETSTAL_DEF_ENV_ROOTPATH "rootpath=/opt/eldk/ppc_4xxFP\0"
  162. #else
  163. #define CONFIG_NETSTAL_DEF_ENV_ROOTPATH "rootpath=/opt/eldk/ppc_4xx\0"
  164. #endif
  165. /*
  166. * Only some boards need to extend the bootargs by some additional
  167. * parameters (like Makalu)
  168. */
  169. #if !defined(CONFIG_ADDMISC)
  170. #define CONFIG_ADDMISC "addmisc=setenv bootargs ${bootargs}\0"
  171. #endif
  172. #define xstr(s) str(s)
  173. #define str(s) #s
  174. /* Setup some values for the default environment variables */
  175. #define CONFIG_SERVERIP 172.25.1.1
  176. #define CONFIG_ETHADDR 00:60:13:00:00:00 /* Netstal Machines AG MAC */
  177. #define CONFIG_OVERWRITE_ETHADDR_ONCE
  178. #define CONFIG_SYS_TFTP_LOADADDR 0x01000000
  179. /*
  180. * General common environment variables shared by all boards produced by Netstal Maschinen
  181. */
  182. #define CONFIG_NETSTAL_DEF_ENV \
  183. "netdev=eth0\0" \
  184. "nfsargs=setenv bootargs root=/dev/nfs rw " \
  185. "nfsroot=${serverip}:${rootpath}\0" \
  186. "ramargs=setenv bootargs root=/dev/ram rw\0" \
  187. "addip=setenv bootargs ${bootargs} " \
  188. "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
  189. ":${hostname}:${netdev}:off panic=1\0" \
  190. "addtty=setenv bootargs ${bootargs}" \
  191. " console=" xstr(CONFIG_USE_TTY) ",${baudrate}\0" \
  192. CONFIG_ADDMISC \
  193. "initrd_high=30000000\0" \
  194. "kernel_addr_r=400000\0" \
  195. "fdt_addr_r=800000\0" \
  196. "hostname=" xstr(CONFIG_HOSTNAME) "\0" \
  197. "bootfile=" xstr(CONFIG_HOSTNAME) "/uImage\0" \
  198. "load=tftp 200000 " xstr(CONFIG_HOSTNAME) "/u-boot.bin\0" \
  199. "update=protect off " xstr(CONFIG_SYS_MONITOR_BASE) " FFFFFFFF;" \
  200. "era " xstr(CONFIG_SYS_MONITOR_BASE) " FFFFFFFF;" \
  201. "cp.b ${fileaddr} " xstr(CONFIG_SYS_MONITOR_BASE) " ${filesize};" \
  202. "setenv filesize\0" \
  203. "upd=run load update\0" \
  204. "vx_rom=" xstr(CONFIG_HOSTNAME) "/" \
  205. xstr(CONFIG_HOSTNAME) "_vx_rom\0" \
  206. "vx=tftp " xstr(CONFIG_SYS_TFTP_LOADADDR) " ${vx_rom};run vxargs;" \
  207. "bootvx\0" \
  208. "vxargs=setenv bootargs emac(0,0)c:${vx_rom} e=${ipaddr}" \
  209. " h=${serverip} u=dpu pw=netstal8752 " \
  210. "tn=" xstr(CONFIG_HOSTNAME) " f=0x3008\0" \
  211. CONFIG_NETSTAL_DEF_ENV_ROOTPATH
  212. /*
  213. * Default environment for arch/powerpc booting
  214. * for boards that are ported to arch/powerpc
  215. */
  216. #define CONFIG_NETSTAL_DEF_ENV_POWERPC \
  217. "flash_self=run ramargs addip addtty addmisc;" \
  218. "bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0" \
  219. "flash_nfs=run nfsargs addip addtty addmisc;" \
  220. "bootm ${kernel_addr} - ${fdt_addr}\0" \
  221. "net_nfs=tftp ${kernel_addr_r} ${bootfile}; " \
  222. "tftp ${fdt_addr_r} ${fdt_file}; " \
  223. "run nfsargs addip addtty addmisc;" \
  224. "bootm ${kernel_addr_r} - ${fdt_addr_r}\0" \
  225. "fdt_file=" xstr(CONFIG_HOSTNAME) "/" xstr(CONFIG_HOSTNAME) ".dtb\0"
  226. #endif /* __NETSTAL_COMMON_H */