keymile-common.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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_DEFAULTENV_VARS
  36. #define CONFIG_CMD_ECHO
  37. #define CONFIG_CMD_IMMAP
  38. #define CONFIG_CMD_MII
  39. #define CONFIG_CMD_PING
  40. #define CONFIG_CMD_EEPROM
  41. #define CONFIG_CMD_I2C
  42. #define CONFIG_CMD_JFFS2
  43. #define CONFIG_CMD_MTDPARTS
  44. #define CONFIG_CMD_SETEXPR
  45. #undef CONFIG_WATCHDOG /* disable platform specific watchdog */
  46. #define CONFIG_BOOTDELAY 2 /* autoboot after 2 seconds */
  47. #undef CONFIG_BOOTARGS /* the boot command will set bootargs */
  48. /*
  49. * Miscellaneous configurable options
  50. */
  51. #define CONFIG_SYS_HUSH_PARSER
  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_I2C_MULTI_BUS
  72. #define CONFIG_SYS_MAX_I2C_BUS 1
  73. #define CONFIG_SYS_I2C_INIT_BOARD
  74. #define CONFIG_I2C_MUX
  75. /* Support the IVM EEprom */
  76. #define CONFIG_SYS_IVM_EEPROM_ADR 0x50
  77. #define CONFIG_SYS_IVM_EEPROM_MAX_LEN 0x400
  78. #define CONFIG_SYS_IVM_EEPROM_PAGE_LEN 0x100
  79. #define CONFIG_SYS_FLASH_PROTECTION
  80. /*
  81. * BOOTP options
  82. */
  83. #define CONFIG_BOOTP_BOOTFILESIZE
  84. #define CONFIG_BOOTP_BOOTPATH
  85. #define CONFIG_BOOTP_GATEWAY
  86. #define CONFIG_BOOTP_HOSTNAME
  87. #define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024)
  88. /* UBI Support for all Keymile boards */
  89. #define CONFIG_CMD_UBI
  90. #define CONFIG_RBTREE
  91. #define CONFIG_MTD_PARTITIONS
  92. #define CONFIG_MTD_DEVICE
  93. #define CONFIG_MTD_CONCAT
  94. #define CONFIG_CMD_CRAMFS
  95. #define CONFIG_CRAMFS_CMDLINE
  96. #ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
  97. #define CONFIG_KM_DEF_ENV_BOOTPARAMS \
  98. "actual_bank=0\0"
  99. #endif
  100. #ifndef CONFIG_KM_DEF_NETDEV
  101. #define CONFIG_KM_DEF_NETDEV \
  102. "netdev=eth0\0"
  103. #endif
  104. #ifndef CONFIG_KM_UBI_PARTITION_NAME_BOOT
  105. #define CONFIG_KM_UBI_PARTITION_NAME_BOOT "ubi0"
  106. #endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */
  107. #ifndef CONFIG_KM_UBI_PARTITION_NAME_APP
  108. /* one flash chip only called boot */
  109. /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
  110. # define CONFIG_KM_UBI_LINUX_MTD \
  111. "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT
  112. # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
  113. "ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0"
  114. #else /* CONFIG_KM_UBI_PARTITION_NAME_APP */
  115. /* two flash chips called boot and app */
  116. /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
  117. /* app: CONFIG_KM_UBI_PARTITION_NAME_APP */
  118. # define CONFIG_KM_UBI_LINUX_MTD \
  119. "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT " " \
  120. "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP
  121. # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
  122. "ubiattach=if test ${boot_bank} -eq 0; then; " \
  123. "ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "; else; " \
  124. "ubi part " CONFIG_KM_UBI_PARTITION_NAME_APP "; fi\0"
  125. #endif /* CONFIG_KM_UBI_PARTITION_NAME_APP */
  126. #ifdef CONFIG_NAND_ECC_BCH
  127. #define CONFIG_KM_UIMAGE_NAME "ecc_bch_uImage\0"
  128. #define CONFIG_KM_ECC_MODE " eccmode=bch"
  129. #else
  130. #define CONFIG_KM_UIMAGE_NAME "uImage\0"
  131. #define CONFIG_KM_ECC_MODE
  132. #endif
  133. /*
  134. * boottargets
  135. * - set 'subbootcmds'
  136. * - set 'bootcmd' and 'altbootcmd'
  137. * available targets:
  138. * - 'release': for a standalone system kernel/rootfs from flash
  139. */
  140. #define CONFIG_KM_DEF_ENV_BOOTTARGETS \
  141. "subbootcmds=ubiattach ubicopy cramfsloadfdt cramfsloadkernel " \
  142. "flashargs add_default addpanic boot\0" \
  143. "develop=" \
  144. "tftp 200000 scripts/develop-${arch}.txt && " \
  145. "env import -t 200000 ${filesize} && " \
  146. "run setup_debug_env\0" \
  147. "ramfs=" \
  148. "tftp 200000 scripts/ramfs-${arch}.txt && " \
  149. "env import -t 200000 ${filesize} && " \
  150. "run setup_debug_env\0" \
  151. ""
  152. /*
  153. * bootargs
  154. * - modify 'bootargs'
  155. *
  156. * - 'add_default': default bootargs common for all arm/ppc boards
  157. * - 'addpanic': add kernel panic options
  158. * - 'flashargs': defaults arguments for flash base boot
  159. *
  160. */
  161. #define CONFIG_KM_DEF_ENV_BOOTARGS \
  162. "add_default=" \
  163. "setenv bootargs ${bootargs} " \
  164. "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
  165. ":${hostname}:${netdev}:off3" \
  166. " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}" \
  167. " mem=${kernelmem} init=${init}" \
  168. CONFIG_KM_ECC_MODE \
  169. " phram.phram=phvar,${varaddr}," __stringify(CONFIG_KM_PHRAM)\
  170. " " CONFIG_KM_UBI_LINUX_MTD " " \
  171. CONFIG_KM_DEF_BOOT_ARGS_CPU \
  172. "\0" \
  173. "addpanic=" \
  174. "setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0" \
  175. "flashargs=" \
  176. "setenv bootargs " \
  177. "root=mtdblock:rootfs${boot_bank} " \
  178. "rootfstype=squashfs ro\0" \
  179. ""
  180. /*
  181. * flash_boot
  182. * - commands for booting from flash
  183. *
  184. * - 'cramfsloadkernel': copy kernel from a cramfs to ram
  185. * - 'ubiattach': attach ubi partition
  186. * - 'ubicopy': copy ubi volume to ram
  187. * - volume names: bootfs0, bootfs1, bootfs2, ...
  188. *
  189. * processor specific settings
  190. * - 'cramfsloadfdt': copy fdt from a cramfs to ram
  191. */
  192. #define CONFIG_KM_DEF_ENV_FLASH_BOOT \
  193. "cramfsaddr=" __stringify(CONFIG_KM_CRAMFS_ADDR) "\0" \
  194. "cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}\0" \
  195. "ubicopy=ubi read "__stringify(CONFIG_KM_CRAMFS_ADDR) \
  196. " bootfs${boot_bank}\0" \
  197. "uimage=" CONFIG_KM_UIMAGE_NAME \
  198. CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI
  199. /*
  200. * constants
  201. * - KM specific constants and commands
  202. *
  203. * - 'default': setup default environment
  204. */
  205. #define CONFIG_KM_DEF_ENV_CONSTANTS \
  206. "backup_bank=0\0" \
  207. "release=run newenv; reset\0" \
  208. "pnvramsize=" __stringify(CONFIG_KM_PNVRAM) "\0" \
  209. "testbootcmd=setenv boot_bank ${test_bank}; " \
  210. "run ${subbootcmds}; reset\0" \
  211. ""
  212. #ifndef CONFIG_KM_DEF_ENV
  213. #define CONFIG_KM_DEF_ENV \
  214. CONFIG_KM_DEF_ENV_BOOTPARAMS \
  215. CONFIG_KM_DEF_NETDEV \
  216. CONFIG_KM_DEF_ENV_CPU \
  217. CONFIG_KM_DEF_ENV_BOOTTARGETS \
  218. CONFIG_KM_DEF_ENV_BOOTARGS \
  219. CONFIG_KM_DEF_ENV_FLASH_BOOT \
  220. CONFIG_KM_DEF_ENV_CONSTANTS \
  221. "altbootcmd=run bootcmd\0" \
  222. "bootcmd=km_checkbidhwk && " \
  223. "setenv bootcmd \'if km_checktestboot; then; " \
  224. "setenv boot_bank ${test_bank}; else; " \
  225. "setenv boot_bank ${actual_bank}; fi;" \
  226. "run ${subbootcmds}; reset\' && " \
  227. "setenv altbootcmd \'setenv boot_bank ${backup_bank}; " \
  228. "run ${subbootcmds}; reset\' && " \
  229. "saveenv && saveenv && boot\0" \
  230. "bootlimit=3\0" \
  231. "init=/sbin/init-overlay.sh\0" \
  232. "load_addr_r="__stringify(CONFIG_KM_KERNEL_ADDR) "\0" \
  233. "load=tftpboot ${load_addr_r} ${u-boot}\0" \
  234. "mtdids=" MTDIDS_DEFAULT "\0" \
  235. "mtdparts=" MTDPARTS_DEFAULT "\0" \
  236. ""
  237. #endif /* CONFIG_KM_DEF_ENV */
  238. #define CONFIG_VERSION_VARIABLE /* include version env variable */
  239. #endif /* __CONFIG_KEYMILE_H */