keymile-common.h 9.3 KB

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