keymile-common.h 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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. * CONFIG_SYS_TEXT_BASE can be defined in board specific header file, if needed
  39. */
  40. #ifndef CONFIG_SYS_TEXT_BASE
  41. #define CONFIG_SYS_TEXT_BASE 0x00400000
  42. #endif /* CONFIG_SYS_TEXT_BASE */
  43. /*
  44. * Command line configuration.
  45. */
  46. #include <config_cmd_default.h>
  47. #define CONFIG_CMD_ASKENV
  48. #define CONFIG_CMD_DHCP
  49. #define CONFIG_CMD_ECHO
  50. #define CONFIG_CMD_IMMAP
  51. #define CONFIG_CMD_MII
  52. #define CONFIG_CMD_PING
  53. #define CONFIG_CMD_EEPROM
  54. #define CONFIG_CMD_I2C
  55. #define CONFIG_CMD_JFFS2
  56. #define CONFIG_CMD_MTDPARTS
  57. #define CONFIG_CMD_SETEXPR
  58. #undef CONFIG_WATCHDOG /* disable platform specific watchdog */
  59. #define CONFIG_BOOTDELAY 2 /* autoboot after 2 seconds */
  60. #undef CONFIG_BOOTARGS /* the boot command will set bootargs */
  61. /*
  62. * Miscellaneous configurable options
  63. */
  64. #define CONFIG_SYS_HUSH_PARSER
  65. #define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
  66. #define CONFIG_SYS_LONGHELP /* undef to save memory */
  67. #define CONFIG_SYS_PROMPT "=> " /* Monitor Command Prompt */
  68. #if defined(CONFIG_CMD_KGDB)
  69. #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
  70. #else
  71. #define CONFIG_SYS_CBSIZE 512 /* Console I/O Buffer Size */
  72. #endif
  73. #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
  74. #define CONFIG_SYS_MAXARGS 32 /* max number of command args */
  75. #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
  76. #define CONFIG_CMDLINE_EDITING
  77. #define CONFIG_AUTO_COMPLETE
  78. #define CONFIG_HUSH_INIT_VAR
  79. #define CONFIG_SYS_ALT_MEMTEST /* memory test, takes time */
  80. #define CONFIG_SYS_HZ 1000 /* decr. freq: 1 ms ticks */
  81. #define CONFIG_BAUDRATE 115200
  82. #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
  83. #define CONFIG_LOADS_ECHO
  84. #define CONFIG_SYS_LOADS_BAUD_CHANGE
  85. #define CONFIG_SYS_BOARD_DRAM_INIT /* Used board specific dram_init */
  86. /*
  87. * How to get access to the slot ID. Put this here to make it easy
  88. * to modify in a centralized location. This is used in the HDLC
  89. * driver to set the MAC.
  90. */
  91. #define CONFIG_CHECK_ETHERNET_PRESENT
  92. #define CONFIG_SYS_SLOT_ID_BASE CONFIG_SYS_KMBEC_FPGA_BASE
  93. #define CONFIG_SYS_SLOT_ID_OFF (0x07) /* register offset */
  94. #define CONFIG_SYS_SLOT_ID_MASK (0x3f) /* mask for slot ID bits */
  95. #define CONFIG_I2C_MULTI_BUS
  96. #define CONFIG_SYS_MAX_I2C_BUS 1
  97. #define CONFIG_SYS_I2C_INIT_BOARD
  98. #define CONFIG_I2C_MUX
  99. /* EEprom support */
  100. #define CONFIG_SYS_I2C_MULTI_EEPROMS
  101. #define CONFIG_SYS_EEPROM_PAGE_WRITE_ENABLE
  102. #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
  103. #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 10
  104. /* Support the IVM EEprom */
  105. #define CONFIG_SYS_IVM_EEPROM_ADR 0x50
  106. #define CONFIG_SYS_IVM_EEPROM_MAX_LEN 0x400
  107. #define CONFIG_SYS_IVM_EEPROM_PAGE_LEN 0x100
  108. #define CONFIG_SYS_FLASH_PROTECTION
  109. /*
  110. * BOOTP options
  111. */
  112. #define CONFIG_BOOTP_BOOTFILESIZE
  113. #define CONFIG_BOOTP_BOOTPATH
  114. #define CONFIG_BOOTP_GATEWAY
  115. #define CONFIG_BOOTP_HOSTNAME
  116. #define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024)
  117. /* UBI Support for all Keymile boards */
  118. #define CONFIG_CMD_UBI
  119. #define CONFIG_RBTREE
  120. #define CONFIG_MTD_PARTITIONS
  121. #define CONFIG_MTD_DEVICE
  122. #define CONFIG_MTD_CONCAT
  123. /* define this to use the keymile's io muxing feature */
  124. /*#define CONFIG_IO_MUXING */
  125. #ifdef CONFIG_IO_MUXING
  126. #define CONFIG_KM_DEF_ENV_IOMUX \
  127. "nc=setenv ethact HDLC \0" \
  128. "nce=setenv ethact SCC \0" \
  129. "stderr=serial,nc \0" \
  130. "stdin=serial,nc \0" \
  131. "stdout=serial,nc \0" \
  132. "tftpsrcp=69 \0" \
  133. "tftpdstp=69 \0"
  134. #else
  135. #define CONFIG_KM_DEF_ENV_IOMUX \
  136. "stderr=serial \0" \
  137. "stdin=serial \0" \
  138. "stdout=serial \0"
  139. #endif
  140. #ifndef CONFIG_KM_DEF_ENV_PRIVATE
  141. #define CONFIG_KM_DEF_ENV_PRIVATE \
  142. "kmprivate=empty\0"
  143. #endif
  144. #ifndef CONFIG_KM_DEF_NETDEV
  145. #define CONFIG_KM_DEF_NETDEV \
  146. "netdev=eth0\0"
  147. #endif
  148. #ifndef CONFIG_KM_UBI_PARTITION_NAME
  149. #define CONFIG_KM_UBI_PARTITION_NAME "ubi0"
  150. #endif
  151. #ifndef CONFIG_KM_UBI_LINUX_MTD_NAME
  152. #define CONFIG_KM_UBI_LINUX_MTD_NAME "ubi0"
  153. #endif
  154. #define xstr(s) str(s)
  155. #define str(s) #s
  156. /*
  157. * bootargs
  158. * - modify 'bootargs'
  159. *
  160. * - 'addip': add ip configuration
  161. * - 'addpanic': add kernel panic options
  162. * - 'addramfs': add phram device for the rootfilesysten in ram
  163. * - 'addtty': add console=...
  164. * - 'nfsargs': default arguments for nfs boot
  165. * - 'flashargs': defaults arguments for flash base boot
  166. *
  167. * processor specific settings
  168. * - 'addmtdparts': add mtd partition information
  169. */
  170. #define CONFIG_KM_DEF_ENV_BOOTARGS \
  171. "addinit=" \
  172. "setenv bootargs ${bootargs} init=${init}\0" \
  173. "addip=" \
  174. "setenv bootargs ${bootargs} " \
  175. "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
  176. ":${hostname}:${netdev}:off\0" \
  177. "addpanic=" \
  178. "setenv bootargs ${bootargs} " \
  179. "panic=1 panic_on_oops=1\0" \
  180. "addramfs=" \
  181. "setenv bootargs \"" \
  182. "${bootargs} phram.phram=" \
  183. "rootfs${actual_bank},${rootfsaddr},${rootfssize}\"\0" \
  184. "addtty=" \
  185. "setenv bootargs ${bootargs}" \
  186. " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}\0" \
  187. "nfsargs=" \
  188. "setenv bootargs " \
  189. "ubi.mtd=" CONFIG_KM_UBI_LINUX_MTD_NAME " " \
  190. "root=/dev/nfs rw " \
  191. "nfsroot=${serverip}:${rootpath}\0" \
  192. "flashargs=" \
  193. "setenv bootargs " \
  194. "ubi.mtd=" CONFIG_KM_UBI_LINUX_MTD_NAME " " \
  195. "root=mtdblock:rootfs${actual_bank} " \
  196. "rootfstype=squashfs ro\0" \
  197. ""
  198. #define CONFIG_KM_DEF_ENV_COMPUTE_ADDR \
  199. "setboardid=" \
  200. "if test \"x${boardId}\" = \"x\"; then; " \
  201. "setenv boardId ${IVM_BoardId} && " \
  202. "setenv hwKey ${IVM_HWKey}; " \
  203. "else; " \
  204. "echo \\\\c; " \
  205. "fi\0"
  206. /*
  207. * flash_boot
  208. * - commands for booting from flash
  209. *
  210. * - 'cramfsaddr': address to the cramfs (in ram)
  211. * - 'cramfsloadkernel': copy kernel from a cramfs to ram
  212. * - 'ubiattach': attach ubi partition
  213. * - 'ubicopy': copy ubi volume to ram
  214. * - volume names: bootfs0, bootfs1, bootfs2, ...
  215. * - 'ubiparition': mtd parition name for ubi
  216. *
  217. * processor specific settings
  218. * - 'cramfsloadfdt': copy fdt from a cramfs to ram
  219. */
  220. #define CONFIG_KM_DEF_ENV_FLASH_BOOT \
  221. "cramfsaddr="xstr(CONFIG_KM_CRAMFS_ADDR) "\0" \
  222. "cramfsloadkernel=" \
  223. "cramfsload ${kernel_addr_r} uImage && " \
  224. "setenv actual_kernel_addr ${kernel_addr_r}\0" \
  225. "ubiattach=ubi part ${ubipartition}\0" \
  226. "ubicopy=ubi read ${cramfsaddr} bootfs${actual_bank}\0" \
  227. "ubipartition=" CONFIG_KM_UBI_PARTITION_NAME "\0" \
  228. ""
  229. /*
  230. * net_boot
  231. * - commands for booting over the network
  232. *
  233. * - 'tftpkernel': load a kernel with tftp into ram
  234. *
  235. * processor specific settings
  236. * - 'tftpfdt': load fdt with tftp into ram
  237. */
  238. #define CONFIG_KM_DEF_ENV_NET_BOOT \
  239. "tftpkernel=" \
  240. "tftpboot ${kernel_addr_r} ${kernel_file} && " \
  241. "setenv actual_kernel_addr ${kernel_addr_r} \0"
  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 actual_bank ${initial_boot_bank}\0" \
  250. "actual0=setenv actual_bank 0\0" \
  251. "actual_bank=${initial_boot_bank}\0" \
  252. "default=" \
  253. "setenv default 'run newenv; reset' && " \
  254. "run release && saveenv; reset\0" \
  255. "checkboardid=" \
  256. "test \"x${boardId}\" = \"x${IVM_BoardId}\"\0" \
  257. "printbootargs=print bootargs\0" \
  258. "rootfsfile="xstr(CONFIG_HOSTNAME) "/rootfsImage\0" \
  259. ""
  260. #ifndef CONFIG_KM_DEF_ENV
  261. #define CONFIG_KM_DEF_ENV \
  262. CONFIG_KM_DEF_ENV_IOMUX \
  263. CONFIG_KM_DEF_ENV_PRIVATE \
  264. CONFIG_KM_DEF_NETDEV \
  265. CONFIG_KM_DEF_ENV_CPU \
  266. CONFIG_KM_DEF_ENV_BOOTARGS \
  267. CONFIG_KM_DEF_ENV_COMPUTE_ADDR \
  268. CONFIG_KM_DEF_ENV_FLASH_BOOT \
  269. CONFIG_KM_DEF_ENV_NET_BOOT \
  270. "altbootcmd=run bootcmd\0" \
  271. "bootcmd=run default\0" \
  272. "bootlimit=2\0" \
  273. "init=/sbin/init-overlay.sh\0" \
  274. "kernel_addr_r="xstr(CONFIG_KM_KERNEL_ADDR) "\0" \
  275. "kernel_file="xstr(CONFIG_HOSTNAME) "/uImage\0" \
  276. "kernel_name=uImage\0" \
  277. "load=tftpboot ${u-boot_addr_r} ${u-boot}\0" \
  278. "mtdids=" MTDIDS_DEFAULT "\0" \
  279. "mtdparts=" MTDPARTS_DEFAULT "\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 */