keymile-common.h 6.0 KB

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