keymile-common.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. /*
  2. * (C) Copyright 2008-2011
  3. * Heiko Schocher, DENX Software Engineering, hs@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. #ifndef __CONFIG_KEYMILE_H
  24. #define __CONFIG_KEYMILE_H
  25. /* Do boardspecific init for all boards */
  26. #define CONFIG_BOARD_EARLY_INIT_R
  27. #define CONFIG_LAST_STAGE_INIT
  28. #define CONFIG_BOOTCOUNT_LIMIT
  29. /*
  30. * Command line configuration.
  31. */
  32. #include <config_cmd_default.h>
  33. #define CONFIG_CMD_ASKENV
  34. #define CONFIG_CMD_DHCP
  35. #define CONFIG_CMD_ECHO
  36. #define CONFIG_CMD_IMMAP
  37. #define CONFIG_CMD_MII
  38. #define CONFIG_CMD_PING
  39. #define CONFIG_CMD_EEPROM
  40. #define CONFIG_CMD_I2C
  41. #define CONFIG_CMD_JFFS2
  42. #define CONFIG_CMD_MTDPARTS
  43. #define CONFIG_CMD_SETEXPR
  44. #undef CONFIG_WATCHDOG /* disable platform specific watchdog */
  45. #define CONFIG_BOOTDELAY 2 /* autoboot after 2 seconds */
  46. #undef CONFIG_BOOTARGS /* the boot command will set bootargs */
  47. /*
  48. * Miscellaneous configurable options
  49. */
  50. #define CONFIG_SYS_HUSH_PARSER
  51. #define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
  52. #define CONFIG_SYS_LONGHELP /* undef to save memory */
  53. #define CONFIG_SYS_PROMPT "=> " /* Monitor Command Prompt */
  54. #if defined(CONFIG_CMD_KGDB)
  55. #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
  56. #else
  57. #define CONFIG_SYS_CBSIZE 512 /* Console I/O Buffer Size */
  58. #endif
  59. #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
  60. #define CONFIG_SYS_MAXARGS 32 /* max number of command args */
  61. #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
  62. #define CONFIG_CMDLINE_EDITING
  63. #define CONFIG_AUTO_COMPLETE
  64. #define CONFIG_HUSH_INIT_VAR
  65. #define CONFIG_SYS_ALT_MEMTEST /* memory test, takes time */
  66. #define CONFIG_SYS_HZ 1000 /* decr. freq: 1 ms ticks */
  67. #define CONFIG_BAUDRATE 115200
  68. #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
  69. #define CONFIG_LOADS_ECHO
  70. #define CONFIG_SYS_LOADS_BAUD_CHANGE
  71. #define CONFIG_SYS_BOARD_DRAM_INIT /* Used board specific dram_init */
  72. /*
  73. * How to get access to the slot ID. Put this here to make it easy
  74. * to modify in a centralized location. This is used in the HDLC
  75. * driver to set the MAC.
  76. */
  77. #define CONFIG_CHECK_ETHERNET_PRESENT
  78. #define CONFIG_SYS_SLOT_ID_BASE CONFIG_SYS_KMBEC_FPGA_BASE
  79. #define CONFIG_SYS_SLOT_ID_OFF (0x07) /* register offset */
  80. #define CONFIG_SYS_SLOT_ID_MASK (0x3f) /* mask for slot ID bits */
  81. #define CONFIG_I2C_MULTI_BUS
  82. #define CONFIG_SYS_MAX_I2C_BUS 1
  83. #define CONFIG_SYS_I2C_INIT_BOARD
  84. #define CONFIG_I2C_MUX
  85. /* EEprom support */
  86. #define CONFIG_SYS_I2C_MULTI_EEPROMS
  87. #define CONFIG_SYS_EEPROM_PAGE_WRITE_ENABLE
  88. #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
  89. #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 10
  90. /* Support the IVM EEprom */
  91. #define CONFIG_SYS_IVM_EEPROM_ADR 0x50
  92. #define CONFIG_SYS_IVM_EEPROM_MAX_LEN 0x400
  93. #define CONFIG_SYS_IVM_EEPROM_PAGE_LEN 0x100
  94. #define CONFIG_SYS_FLASH_PROTECTION
  95. /*
  96. * BOOTP options
  97. */
  98. #define CONFIG_BOOTP_BOOTFILESIZE
  99. #define CONFIG_BOOTP_BOOTPATH
  100. #define CONFIG_BOOTP_GATEWAY
  101. #define CONFIG_BOOTP_HOSTNAME
  102. #define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024)
  103. /* UBI Support for all Keymile boards */
  104. #define CONFIG_CMD_UBI
  105. #define CONFIG_RBTREE
  106. #define CONFIG_MTD_PARTITIONS
  107. #define CONFIG_MTD_DEVICE
  108. #define CONFIG_MTD_CONCAT
  109. /* common powerpc specific env settings */
  110. #ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
  111. #define CONFIG_KM_DEF_ENV_BOOTPARAMS \
  112. "bootparams=empty\0" \
  113. "initial_boot_bank=0\0"
  114. #endif
  115. #ifndef CONFIG_KM_DEF_NETDEV
  116. #define CONFIG_KM_DEF_NETDEV \
  117. "netdev=eth0\0"
  118. #endif
  119. #ifndef CONFIG_KM_UBI_PARTITION_NAME
  120. #define CONFIG_KM_UBI_PARTITION_NAME "ubi0"
  121. #endif
  122. #ifndef CONFIG_KM_UBI_LINUX_MTD_NAME
  123. #define CONFIG_KM_UBI_LINUX_MTD_NAME "ubi0"
  124. #endif
  125. #define xstr(s) str(s)
  126. #define str(s) #s
  127. /*
  128. * bootrunner
  129. * - run all commands in 'subbootcmds'
  130. * - on error, stop running the remaing commands
  131. */
  132. #define CONFIG_KM_DEF_ENV_BOOTRUNNER \
  133. "bootrunner=" \
  134. "break=0; " \
  135. "for subbootcmd in ${subbootcmds}; do " \
  136. "if test ${break} -eq 0; then; " \
  137. "print ${subbootcmd}; " \
  138. "run ${subbootcmd} || break=1; " \
  139. "fi; " \
  140. "done\0" \
  141. ""
  142. /*
  143. * boottargets
  144. * - set 'subbootcmds' for the bootrunner
  145. * - set 'bootcmd' and 'altbootcmd'
  146. * available targets:
  147. * - 'release': for a standalone system kernel/rootfs from flash
  148. *
  149. * - 'commonargs': bootargs common to all targets
  150. */
  151. #define CONFIG_KM_DEF_ENV_BOOTTARGETS \
  152. "commonargs=" \
  153. "addip " \
  154. "addtty " \
  155. "addmem " \
  156. "addinit " \
  157. "addvar " \
  158. "addmtdparts " \
  159. "addbootcount " \
  160. "\0" \
  161. "release=" \
  162. "setenv actual_bank ${initial_boot_bank} && " \
  163. "setenv subbootcmds \"" \
  164. "checkboardid " \
  165. "ubiattach ubicopy " \
  166. "cramfsloadfdt cramfsloadkernel " \
  167. "flashargs ${commonargs} " \
  168. "addpanic boot " \
  169. "\" && " \
  170. "setenv bootcmd \'" \
  171. "run actual bootrunner; reset" \
  172. "\' && " \
  173. "setenv altbootcmd \'" \
  174. "run backup bootrunner; reset" \
  175. "\' && " \
  176. "saveenv && saveenv && " \
  177. "reset\0" \
  178. "debug_env=" \
  179. "tftp 200000 " CONFIG_KM_ARCH_DBG_FILE " && " \
  180. "env import -t 200000 ${filesize} && " \
  181. "run debug_env_common\0" \
  182. ""
  183. /*
  184. * bootargs
  185. * - modify 'bootargs'
  186. *
  187. * - 'addip': add ip configuration
  188. * - 'addmem': limit kernel memory mem=
  189. * - 'addpanic': add kernel panic options
  190. * - 'addtty': add console=...
  191. * - 'addvar': add phram device for /var
  192. * - 'flashargs': defaults arguments for flash base boot
  193. *
  194. * processor specific settings
  195. * - 'addbootcount': add boot counter
  196. * - 'addmtdparts': add mtd partition information
  197. */
  198. #define CONFIG_KM_DEF_ENV_BOOTARGS \
  199. "addinit=" \
  200. "setenv bootargs ${bootargs} init=${init}\0" \
  201. "addip=" \
  202. "setenv bootargs ${bootargs} " \
  203. "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
  204. ":${hostname}:${netdev}:off\0" \
  205. "addmem=" \
  206. "setenv bootargs ${bootargs} mem=${pnvramaddr}\0" \
  207. "addpanic=" \
  208. "setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0" \
  209. "addtty=" \
  210. "setenv bootargs ${bootargs}" \
  211. " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}\0" \
  212. "addvar=" \
  213. "setenv bootargs ${bootargs} phram.phram=phvar," \
  214. "${varaddr}," xstr(CONFIG_KM_PHRAM) "\0" \
  215. "flashargs=" \
  216. "setenv bootargs " \
  217. "ubi.mtd=" CONFIG_KM_UBI_LINUX_MTD_NAME " " \
  218. "root=mtdblock:rootfs${boot_bank} " \
  219. "rootfstype=squashfs ro\0" \
  220. ""
  221. /*
  222. * flash_boot
  223. * - commands for booting from flash
  224. *
  225. * - 'cramfsloadkernel': copy kernel from a cramfs to ram
  226. * - 'ubiattach': attach ubi partition
  227. * - 'ubicopy': copy ubi volume to ram
  228. * - volume names: bootfs0, bootfs1, bootfs2, ...
  229. *
  230. * processor specific settings
  231. * - 'cramfsloadfdt': copy fdt from a cramfs to ram
  232. */
  233. #define CONFIG_KM_DEF_ENV_FLASH_BOOT \
  234. "cramfsaddr=" xstr(CONFIG_KM_CRAMFS_ADDR) "\0" \
  235. "cramfsloadkernel=" \
  236. "cramfsload ${kernel_addr_r} uImage && " \
  237. "setenv actual_kernel_addr ${kernel_addr_r}\0" \
  238. "ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME "\0" \
  239. "ubicopy=ubi read "xstr(CONFIG_KM_CRAMFS_ADDR) \
  240. " bootfs${boot_bank}\0" \
  241. ""
  242. /*
  243. * constants
  244. * - KM specific constants and commands
  245. *
  246. * - 'default': setup default environment
  247. */
  248. #define CONFIG_KM_DEF_ENV_CONSTANTS \
  249. "actual=setenv boot_bank ${actual_bank}\0" \
  250. "backup=setenv boot_bank ${backup_bank}\0" \
  251. "actual_bank=${initial_boot_bank}\0" \
  252. "backup_bank=0\0" \
  253. "default=" \
  254. "setenv default 'run newenv; reset' && " \
  255. "run release && saveenv; reset\0" \
  256. "checkboardid=km_checkbidhwk\0" \
  257. "pnvramsize=" xstr(CONFIG_KM_PNVRAM) "\0" \
  258. ""
  259. #ifndef CONFIG_KM_DEF_ENV
  260. #define CONFIG_KM_DEF_ENV \
  261. CONFIG_KM_DEF_ENV_BOOTPARAMS \
  262. CONFIG_KM_DEF_NETDEV \
  263. CONFIG_KM_DEF_ENV_CPU \
  264. CONFIG_KM_DEF_ENV_BOOTRUNNER \
  265. CONFIG_KM_DEF_ENV_BOOTTARGETS \
  266. CONFIG_KM_DEF_ENV_BOOTARGS \
  267. CONFIG_KM_DEF_ENV_FLASH_BOOT \
  268. CONFIG_KM_DEF_ENV_CONSTANTS \
  269. "altbootcmd=run bootcmd\0" \
  270. "bootcmd=run default\0" \
  271. "bootlimit=2\0" \
  272. "init=/sbin/init-overlay.sh\0" \
  273. "kernel_addr_r="xstr(CONFIG_KM_KERNEL_ADDR) "\0" \
  274. "load=tftpboot ${u-boot_addr_r} ${u-boot}\0" \
  275. "mtdids=" MTDIDS_DEFAULT "\0" \
  276. "mtdparts=" MTDPARTS_DEFAULT "\0" \
  277. "stderr=serial\0" \
  278. "stdin=serial\0" \
  279. "stdout=serial\0" \
  280. "u-boot="xstr(CONFIG_HOSTNAME) "/u-boot.bin\0" \
  281. "u-boot_addr_r="xstr(CONFIG_KM_KERNEL_ADDR) "\0" \
  282. ""
  283. #endif /* CONFIG_KM_DEF_ENV */
  284. #define CONFIG_VERSION_VARIABLE /* include version env variable */
  285. #endif /* __CONFIG_KEYMILE_H */