keymile-common.h 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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_MEMTEST_START 0x00100000
  79. #define CONFIG_SYS_MEMTEST_END 0x00f00000 /* 1 ... 15 MB in DRAM */
  80. #define CONFIG_SYS_LOAD_ADDR 0x100000
  81. #define CONFIG_SYS_HZ 1000 /* decr. freq: 1 ms ticks */
  82. #define CONFIG_BAUDRATE 115200
  83. #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
  84. #define CONFIG_LOADS_ECHO
  85. #define CONFIG_SYS_LOADS_BAUD_CHANGE
  86. #define CONFIG_SYS_BOARD_DRAM_INIT /* Used board specific dram_init */
  87. /*
  88. * How to get access to the slot ID. Put this here to make it easy
  89. * to modify in a centralized location. This is used in the HDLC
  90. * driver to set the MAC.
  91. */
  92. #define CONFIG_CHECK_ETHERNET_PRESENT
  93. #define CONFIG_SYS_SLOT_ID_BASE CONFIG_SYS_PIGGY_BASE
  94. #define CONFIG_SYS_SLOT_ID_OFF (0x07) /* register offset */
  95. #define CONFIG_SYS_SLOT_ID_MASK (0x3f) /* mask for slot ID bits */
  96. #define CONFIG_I2C_MULTI_BUS
  97. #define CONFIG_SYS_MAX_I2C_BUS 1
  98. #define CONFIG_SYS_I2C_INIT_BOARD
  99. #define CONFIG_I2C_MUX
  100. /* EEprom support */
  101. #define CONFIG_SYS_I2C_MULTI_EEPROMS
  102. #define CONFIG_SYS_EEPROM_PAGE_WRITE_ENABLE
  103. #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
  104. #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 10
  105. /* Support the IVM EEprom */
  106. #define CONFIG_SYS_IVM_EEPROM_ADR 0x50
  107. #define CONFIG_SYS_IVM_EEPROM_MAX_LEN 0x400
  108. #define CONFIG_SYS_IVM_EEPROM_PAGE_LEN 0x100
  109. #define CONFIG_SYS_FLASH_PROTECTION
  110. /*
  111. * BOOTP options
  112. */
  113. #define CONFIG_BOOTP_BOOTFILESIZE
  114. #define CONFIG_BOOTP_BOOTPATH
  115. #define CONFIG_BOOTP_GATEWAY
  116. #define CONFIG_BOOTP_HOSTNAME
  117. #define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024)
  118. /* UBI Support for all Keymile boards */
  119. #define CONFIG_CMD_UBI
  120. #define CONFIG_RBTREE
  121. #define CONFIG_MTD_PARTITIONS
  122. #define CONFIG_FLASH_CFI_MTD
  123. #define CONFIG_MTD_DEVICE
  124. #define CONFIG_MTD_CONCAT
  125. /* define this to use the keymile's io muxing feature */
  126. /*#define CONFIG_IO_MUXING */
  127. #ifdef CONFIG_IO_MUXING
  128. #define CONFIG_KM_DEF_ENV_IOMUX \
  129. "nc=setenv ethact HDLC \0" \
  130. "nce=setenv ethact SCC \0" \
  131. "stderr=serial,nc \0" \
  132. "stdin=serial,nc \0" \
  133. "stdout=serial,nc \0" \
  134. "tftpsrcp=69 \0" \
  135. "tftpdstp=69 \0"
  136. #else
  137. #define CONFIG_KM_DEF_ENV_IOMUX \
  138. "stderr=serial \0" \
  139. "stdin=serial \0" \
  140. "stdout=serial \0"
  141. #endif
  142. #ifndef CONFIG_KM_DEF_ENV_PRIVATE
  143. #define CONFIG_KM_DEF_ENV_PRIVATE \
  144. "kmprivate=empty\0"
  145. #endif
  146. #define xstr(s) str(s)
  147. #define str(s) #s
  148. #ifndef CONFIG_KM_DEF_ENV
  149. #define CONFIG_KM_DEF_ENV \
  150. "netdev=eth0\0" \
  151. "u-boot_addr_r=100000\0" \
  152. "kernel_addr_r=200000\0" \
  153. "fdt_addr_r=600000\0" \
  154. "ram_ws=800000 \0" \
  155. "script_ws=780000 \0" \
  156. "fdt_file=" xstr(CONFIG_HOSTNAME) "/" \
  157. xstr(CONFIG_HOSTNAME) ".dtb\0" \
  158. "u-boot=" xstr(CONFIG_HOSTNAME) "/u-boot.bin \0" \
  159. "kernel_file=" xstr(CONFIG_HOSTNAME) "/uImage \0" \
  160. "load=tftp ${u-boot_addr_r} ${u-boot}\0" \
  161. "update=protect off " xstr(BOOTFLASH_START) " +${filesize};" \
  162. "erase " xstr(BOOTFLASH_START) " +${filesize};" \
  163. "cp.b ${u-boot_addr_r} " xstr(BOOTFLASH_START) \
  164. " ${filesize};" \
  165. "protect on " xstr(BOOTFLASH_START) " +${filesize}\0" \
  166. "load_fdt=tftp ${fdt_addr_r} ${fdt_file}; " \
  167. "setenv actual_fdt_addr ${fdt_addr_r} \0" \
  168. "load_kernel=tftp ${kernel_addr_r} ${kernel_file}; " \
  169. "setenv actual_kernel_addr ${kernel_addr_r} \0" \
  170. "ramargs=setenv bootargs root=/dev/ram rw\0" \
  171. "nfsargs=setenv bootargs root=/dev/nfs rw " \
  172. "nfsroot=${serverip}:${rootpath}\0" \
  173. "mtdargs=setenv bootargs root=${actual_rootfs} rw " \
  174. "rootfstype=jffs2 \0" \
  175. "altmtdargs=setenv bootargs root=${backup_rootfs} rw " \
  176. "rootfstype=jffs2 \0" \
  177. "addmtd=setenv bootargs ${bootargs} ${mtdparts}\0" \
  178. "addip=setenv bootargs ${bootargs} " \
  179. "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
  180. ":${hostname}:${netdev}:off panic=1\0" \
  181. "addboardid=setenv bootargs ${bootargs} " \
  182. "hwKey=${IVM_HWKey} boardId=0x${IVM_BoardId} \0" \
  183. "addpram=setenv bootargs ${bootargs} " \
  184. "mem=${mem} pram=${pram}\0" \
  185. "pram=" xstr(CONFIG_PRAM) "k\0" \
  186. "net_nfs=tftp ${kernel_addr_r} ${kernel_file}; " \
  187. "tftp ${fdt_addr_r} ${fdt_file}; " \
  188. "run nfsargs addip addcon addboardid addpram;" \
  189. "bootm ${kernel_addr_r} - ${fdt_addr_r}\0" \
  190. "net_self=tftp ${kernel_addr_r} ${kernel_file}; " \
  191. "tftp ${fdt_addr_r} ${fdt_file}; " \
  192. "tftp ${ramdisk_addr} ${ramdisk_file}; " \
  193. "run ramargs addip addboardid addpram; " \
  194. "bootm ${kernel_addr_r} ${ramdisk_addr} ${fdt_addr_r}\0"\
  195. "flash_nfs=run nfsargs addip addcon;" \
  196. "bootm ${kernel_addr} - ${fdt_addr}\0" \
  197. "flash_self=run ramargs addip addcon addboardid addpram;" \
  198. "bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0" \
  199. "bootcmd=run mtdargs addip addcon addboardid addpram; " \
  200. "bootm ${actual_kernel_addr} - ${actual_fdt_addr} \0" \
  201. "altbootcmd=run altmtdargs addip addcon addboardid addpram; " \
  202. "bootm ${backup_kernel_addr} - ${backup_fdt_addr} \0" \
  203. "actual0=setenv actual_bank 0; setenv actual_kernel_addr " \
  204. "${bank0_kernel_addr}; " \
  205. "setenv actual_fdt_addr ${bank0_fdt_addr}; " \
  206. "setenv actual_rootfs ${bank0_rootfs} \0" \
  207. "actual1=setenv actual_bank 1; setenv actual_kernel_addr " \
  208. "${bank1_kernel_addr}; " \
  209. "setenv actual_fdt_addr ${bank1_fdt_addr}; " \
  210. "setenv actual_rootfs ${bank1_rootfs} \0" \
  211. "backup0=setenv backup_bank 0; setenv backup_kernel_addr " \
  212. "${bank0_kernel_addr}; " \
  213. "setenv backup_fdt_addr ${bank0_fdt_addr}; " \
  214. "setenv backup_rootfs ${bank0_rootfs} \0" \
  215. "backup1=setenv backup_bank 1; setenv backup_kernel_addr " \
  216. "${bank1_kernel_addr}; " \
  217. "setenv backup_fdt_addr ${bank1_fdt_addr}; " \
  218. "setenv backup_rootfs ${bank1_rootfs} \0" \
  219. "setbank0=run actual0 backup1 \0" \
  220. "setbank1=run actual1 backup0 \0" \
  221. "release=setenv bootcmd " \
  222. "\'run mtdargs addip addcon addboardid addpram;" \
  223. "bootm ${actual_kernel_addr} - ${actual_fdt_addr} \'; " \
  224. "saveenv \0" \
  225. "develop=setenv bootcmd " \
  226. "\'run nfsargs addip addcon addboardid addpram;" \
  227. "bootm ${actual_kernel_addr} - ${actual_fdt_addr} \'; " \
  228. "saveenv \0" \
  229. "developall=setenv bootcmd " \
  230. "\'run load_fdt load_kernel nfsargs " \
  231. "addip addcon addboardid addpram; " \
  232. "bootm ${actual_kernel_addr} - ${actual_fdt_addr} \'; " \
  233. "saveenv \0" \
  234. "set_new_esw_script=setenv new_esw_script " \
  235. "new_esw_0x${IVM_BoardId}_0x${IVM_HWKey}.scr \0" \
  236. "new_esw=run set_new_esw_script; " \
  237. "tftp ${script_ws} ${new_esw_script}; " \
  238. "iminfo ${script_ws}; source ${script_ws} \0" \
  239. "bootlimit=0 \0" \
  240. CONFIG_KM_DEF_ENV_IOMUX \
  241. CONFIG_KM_DEF_ENV_PRIVATE \
  242. ""
  243. #endif /* CONFIG_KM_DEF_ENV */
  244. #define CONFIG_VERSION_VARIABLE /* include version env variable */
  245. #endif /* __CONFIG_KEYMILE_H */