keymile-common.h 9.4 KB

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