keymile-common.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. /*
  2. * (C) Copyright 2008-2011
  3. * Heiko Schocher, DENX Software Engineering, hs@denx.de.
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #ifndef __CONFIG_KEYMILE_H
  8. #define __CONFIG_KEYMILE_H
  9. #define CONFIG_BOOTCOUNT_LIMIT
  10. /*
  11. * Command line configuration.
  12. */
  13. #define CONFIG_CMD_DEFAULTENV_VARS
  14. #define CONFIG_CMD_IMMAP
  15. #define CONFIG_CMD_EEPROM
  16. #define CONFIG_CMD_JFFS2
  17. #define CONFIG_CMD_MTDPARTS
  18. #undef CONFIG_WATCHDOG /* disable platform specific watchdog */
  19. #undef CONFIG_BOOTARGS /* the boot command will set bootargs */
  20. /*
  21. * Miscellaneous configurable options
  22. */
  23. #define CONFIG_SYS_LONGHELP /* undef to save memory */
  24. #if defined(CONFIG_CMD_KGDB)
  25. #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
  26. #else
  27. #define CONFIG_SYS_CBSIZE 512 /* Console I/O Buffer Size */
  28. #endif
  29. #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
  30. #define CONFIG_SYS_MAXARGS 32 /* max number of command args */
  31. #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
  32. #define CONFIG_CMDLINE_EDITING
  33. #define CONFIG_AUTO_COMPLETE
  34. #define CONFIG_HUSH_INIT_VAR
  35. #define CONFIG_SYS_ALT_MEMTEST /* memory test, takes time */
  36. #define CONFIG_BAUDRATE 115200
  37. #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
  38. #define CONFIG_LOADS_ECHO
  39. #define CONFIG_SYS_LOADS_BAUD_CHANGE
  40. /* Support the IVM EEprom */
  41. #define CONFIG_SYS_IVM_EEPROM_ADR 0x50
  42. #define CONFIG_SYS_IVM_EEPROM_MAX_LEN 0x400
  43. #define CONFIG_SYS_IVM_EEPROM_PAGE_LEN 0x100
  44. #define CONFIG_SYS_FLASH_PROTECTION
  45. /*
  46. * BOOTP options
  47. */
  48. #define CONFIG_BOOTP_BOOTFILESIZE
  49. #define CONFIG_BOOTP_BOOTPATH
  50. #define CONFIG_BOOTP_GATEWAY
  51. #define CONFIG_BOOTP_HOSTNAME
  52. /* UBI Support for all Keymile boards */
  53. #define CONFIG_RBTREE
  54. #define CONFIG_MTD_PARTITIONS
  55. #define CONFIG_MTD_DEVICE
  56. #define CONFIG_MTD_CONCAT
  57. #define CONFIG_CMD_CRAMFS
  58. #ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
  59. #define CONFIG_KM_DEF_ENV_BOOTPARAMS \
  60. "actual_bank=0\0"
  61. #endif
  62. #ifndef CONFIG_KM_DEF_NETDEV
  63. #define CONFIG_KM_DEF_NETDEV \
  64. "netdev=eth0\0"
  65. #endif
  66. #ifndef CONFIG_KM_UBI_PARTITION_NAME_BOOT
  67. #define CONFIG_KM_UBI_PARTITION_NAME_BOOT "ubi0"
  68. #endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */
  69. #ifndef CONFIG_KM_UBI_PART_BOOT_OPTS
  70. #define CONFIG_KM_UBI_PART_BOOT_OPTS ""
  71. #endif /* CONFIG_KM_UBI_PART_BOOT_OPTS */
  72. #ifndef CONFIG_KM_UBI_PARTITION_NAME_APP
  73. /* one flash chip only called boot */
  74. /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
  75. # define CONFIG_KM_UBI_LINUX_MTD \
  76. "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \
  77. CONFIG_KM_UBI_PART_BOOT_OPTS
  78. # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
  79. "ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0"
  80. #else /* CONFIG_KM_UBI_PARTITION_NAME_APP */
  81. /* two flash chips called boot and app */
  82. /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
  83. /* app: CONFIG_KM_UBI_PARTITION_NAME_APP */
  84. # define CONFIG_KM_UBI_LINUX_MTD \
  85. "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT \
  86. CONFIG_KM_UBI_PART_BOOT_OPTS " " \
  87. "ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP
  88. # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI \
  89. "ubiattach=if test ${boot_bank} -eq 0; then; " \
  90. "ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "; else; " \
  91. "ubi part " CONFIG_KM_UBI_PARTITION_NAME_APP "; fi\0"
  92. #endif /* CONFIG_KM_UBI_PARTITION_NAME_APP */
  93. #ifdef CONFIG_NAND_ECC_BCH
  94. #define CONFIG_KM_UIMAGE_NAME "ecc_bch_uImage\0"
  95. #define CONFIG_KM_ECC_MODE " eccmode=bch"
  96. #else
  97. #define CONFIG_KM_UIMAGE_NAME "uImage\0"
  98. #define CONFIG_KM_ECC_MODE
  99. #endif
  100. /*
  101. * boottargets
  102. * - set 'subbootcmds'
  103. * - set 'bootcmd' and 'altbootcmd'
  104. * available targets:
  105. * - 'release': for a standalone system kernel/rootfs from flash
  106. */
  107. #define CONFIG_KM_DEF_ENV_BOOTTARGETS \
  108. "subbootcmds=ubiattach ubicopy checkfdt cramfsloadfdt " \
  109. "set_fdthigh cramfsloadkernel flashargs add_default " \
  110. "addpanic boot\0" \
  111. "develop=" \
  112. "tftp 200000 scripts/develop-${arch}.txt && " \
  113. "env import -t 200000 ${filesize} && " \
  114. "run setup_debug_env\0" \
  115. "ramfs=" \
  116. "tftp 200000 scripts/ramfs-${arch}.txt && " \
  117. "env import -t 200000 ${filesize} && " \
  118. "run setup_debug_env\0" \
  119. ""
  120. /*
  121. * bootargs
  122. * - modify 'bootargs'
  123. *
  124. * - 'add_default': default bootargs common for all arm/ppc boards
  125. * - 'addpanic': add kernel panic options
  126. * - 'flashargs': defaults arguments for flash base boot
  127. *
  128. */
  129. #define CONFIG_KM_DEF_ENV_BOOTARGS \
  130. "add_default=" \
  131. "setenv bootargs ${bootargs} " \
  132. "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
  133. ":${hostname}:${netdev}:off:" \
  134. " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}" \
  135. " mem=${kernelmem} init=${init}" \
  136. CONFIG_KM_ECC_MODE \
  137. " phram.phram=phvar,${varaddr}," __stringify(CONFIG_KM_PHRAM)\
  138. " " CONFIG_KM_UBI_LINUX_MTD " " \
  139. CONFIG_KM_DEF_BOOT_ARGS_CPU \
  140. "\0" \
  141. "addpanic=" \
  142. "setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0" \
  143. "flashargs=" \
  144. "setenv bootargs " \
  145. "root=mtdblock:rootfs${boot_bank} " \
  146. "rootfstype=squashfs ro\0" \
  147. ""
  148. /*
  149. * flash_boot
  150. * - commands for booting from flash
  151. *
  152. * - 'cramfsloadkernel': copy kernel from a cramfs to ram
  153. * - 'ubiattach': attach ubi partition
  154. * - 'ubicopy': copy ubi volume to ram
  155. * - volume names: bootfs0, bootfs1, bootfs2, ...
  156. *
  157. * processor specific settings
  158. * - 'cramfsloadfdt': copy fdt from a cramfs to ram
  159. */
  160. #define CONFIG_KM_DEF_ENV_FLASH_BOOT \
  161. "cramfsaddr=" __stringify(CONFIG_KM_CRAMFS_ADDR) "\0" \
  162. "cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}\0" \
  163. "ubicopy=ubi read "__stringify(CONFIG_KM_CRAMFS_ADDR) \
  164. " bootfs${boot_bank}\0" \
  165. "uimage=" CONFIG_KM_UIMAGE_NAME \
  166. CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI
  167. /*
  168. * constants
  169. * - KM specific constants and commands
  170. *
  171. * - 'default': setup default environment
  172. */
  173. #define CONFIG_KM_DEF_ENV_CONSTANTS \
  174. "backup_bank=0\0" \
  175. "release=run newenv; reset\0" \
  176. "pnvramsize=" __stringify(CONFIG_KM_PNVRAM) "\0" \
  177. "testbootcmd=setenv boot_bank ${test_bank}; " \
  178. "run ${subbootcmds}; reset\0" \
  179. ""
  180. #ifndef CONFIG_KM_DEF_ENV
  181. #define CONFIG_KM_DEF_ENV \
  182. CONFIG_KM_DEF_ENV_BOOTPARAMS \
  183. CONFIG_KM_DEF_NETDEV \
  184. CONFIG_KM_DEF_ENV_CPU \
  185. CONFIG_KM_DEF_ENV_BOOTTARGETS \
  186. CONFIG_KM_DEF_ENV_BOOTARGS \
  187. CONFIG_KM_DEF_ENV_FLASH_BOOT \
  188. CONFIG_KM_DEF_ENV_CONSTANTS \
  189. "altbootcmd=run bootcmd\0" \
  190. "boot=bootm ${load_addr_r} - ${fdt_addr_r}\0" \
  191. "bootcmd=km_checkbidhwk && " \
  192. "setenv bootcmd \'if km_checktestboot; then; " \
  193. "setenv boot_bank ${test_bank}; else; " \
  194. "setenv boot_bank ${actual_bank}; fi;" \
  195. "run ${subbootcmds}; reset\' && " \
  196. "setenv altbootcmd \'setenv boot_bank ${backup_bank}; " \
  197. "run ${subbootcmds}; reset\' && " \
  198. "saveenv && saveenv && boot\0" \
  199. "bootlimit=3\0" \
  200. "cramfsloadfdt=" \
  201. "cramfsload ${fdt_addr_r} " \
  202. "fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb\0" \
  203. "fdt_addr_r="__stringify(CONFIG_KM_FDT_ADDR) "\0" \
  204. "init=/sbin/init-overlay.sh\0" \
  205. "load_addr_r="__stringify(CONFIG_KM_KERNEL_ADDR) "\0" \
  206. "load=tftpboot ${load_addr_r} ${u-boot}\0" \
  207. "mtdids=" MTDIDS_DEFAULT "\0" \
  208. "mtdparts=" MTDPARTS_DEFAULT "\0" \
  209. ""
  210. #endif /* CONFIG_KM_DEF_ENV */
  211. #endif /* __CONFIG_KEYMILE_H */