keymile-common.h 6.1 KB

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