socfpga_vining_fpga.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2015-2019 Marek Vasut <marex@denx.de>
  4. */
  5. #ifndef __CONFIG_SOFTING_VINING_FPGA_H__
  6. #define __CONFIG_SOFTING_VINING_FPGA_H__
  7. #include <asm/arch/base_addr_ac5.h>
  8. /* Memory configurations */
  9. #define PHYS_SDRAM_1_SIZE 0x40000000 /* 1GiB on VINING_FPGA */
  10. /* Booting Linux */
  11. #define CONFIG_BOOTFILE "fitImage"
  12. #define CONFIG_BOOTCOMMAND "run selboot"
  13. #define CONFIG_SYS_BOOTM_LEN 0x2000000 /* 32 MiB */
  14. #define CONFIG_LOADADDR 0x01000000
  15. #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
  16. /* Extra Environment */
  17. #define CONFIG_HOSTNAME "socfpga_vining_fpga"
  18. /*
  19. * Active LOW GPIO buttons:
  20. * A: GPIO 77 ... the button between USB B and ethernet
  21. * B: GPIO 78 ... the button between USB A ports
  22. *
  23. * The logic:
  24. * if button B is pressed, boot recovery system after 10 seconds
  25. * if force_boottype is set, boot system depending on the value in the
  26. * $force_boottype variable after 1 second
  27. * if button B is not pressed and force_boottype is not set, boot normal
  28. * Linux system after 5 seconds
  29. */
  30. #define CONFIG_EXTRA_ENV_SETTINGS \
  31. "verify=n\0" \
  32. "consdev=ttyS0\0" \
  33. "baudrate=115200\0" \
  34. "bootscript=boot.scr\0" \
  35. "ubimtdnr=5\0" \
  36. "ubimtd=rootfs\0" \
  37. "ubipart=ubi0:vining-fpga-rootfs\0" \
  38. "ubisfcs=1\0" /* Default is flash at CS#1 */ \
  39. "netdev=eth0\0" \
  40. "hostname=vining_fpga\0" \
  41. "kernel_addr_r=0x10000000\0" \
  42. "fdt_addr_r=0x20000000\0" \
  43. "fdt_high=0xffffffff\0" \
  44. "initrd_high=0xffffffff\0" \
  45. "dfu_alt_info=qspi0 sf 0:0;qspi1 sf 0:1\0" \
  46. "mtdparts_0_16m=ff705000.spi.0:" /* 16MiB+128MiB SF config */ \
  47. "1m(u-boot)," \
  48. "64k(env1)," \
  49. "64k(env2)," \
  50. "256k(softing1)," \
  51. "256k(softing2)," \
  52. "-(rcvrfs)\0" /* Recovery */ \
  53. "mtdparts_0_256m=ff705000.spi.0:" /* 256MiB(+256MiB) config */ \
  54. "1m(u-boot)," \
  55. "64k(env1)," \
  56. "64k(env2)," \
  57. "256k(softing1)," \
  58. "256k(softing2)," \
  59. "14720k(rcvrfs)," /* Recovery */ \
  60. "64m(rootfs)," /* Root */ \
  61. "-(userfs)\0" /* User */ \
  62. "mtdparts_1_128m=ff705000.spi.1:" /* 16MiB+128MiB SF config */ \
  63. "64m(rootfs)," \
  64. "-(userfs)\0" \
  65. "mtdparts_1_256m=ff705000.spi.1:" /* 256MiB+256MiB SF config */ \
  66. "-(userfs2)\0" \
  67. "update_filename=u-boot-with-spl-dtb.sfp\0" \
  68. "update_qspi_offset=0x0\0" \
  69. "update_qspi=" /* Update the QSPI firmware */ \
  70. "if sf probe ; then " \
  71. "if tftp ${update_filename} ; then " \
  72. "sf update ${loadaddr} ${update_qspi_offset} ${filesize} ; " \
  73. "fi ; " \
  74. "fi\0" \
  75. "sf_identify=" \
  76. "setenv sf_size_0 ; setenv sf_size_1 ; " \
  77. "sf probe 0:0 && setenv sf_size_0 ${sf_size} ; " \
  78. "sf probe 0:1 && setenv sf_size_1 ${sf_size} ; " \
  79. "if test -z \"${sf_size_1}\" ; then " \
  80. /* 1x256MiB SF */ \
  81. "setenv mtdparts_0 ${mtdparts_0_256m} ; " \
  82. "setenv mtdparts_1 ; " \
  83. "elif test \"${sf_size_0}\" = \"1000000\" ; then " \
  84. /* 16MiB+128MiB SF */ \
  85. "setenv mtdparts_0 ${mtdparts_0_16m} ; " \
  86. "setenv mtdparts_1 ${mtdparts_1_128m} ; " \
  87. "else " \
  88. /* 256MiB+256MiB SF */ \
  89. "setenv mtdparts_0 ${mtdparts_0_256m} ; " \
  90. "setenv mtdparts_1 ${mtdparts_1_256m} ; " \
  91. "fi\0" \
  92. "fpga_filename=output_file.rbf\0" \
  93. "load_fpga=" /* Load FPGA bitstream */ \
  94. "if tftp ${fpga_filename} ; then " \
  95. "fpga load 0 $loadaddr $filesize ; " \
  96. "bridge enable ; " \
  97. "fi\0" \
  98. "addcons=" \
  99. "setenv bootargs ${bootargs} " \
  100. "console=${consdev},${baudrate}\0" \
  101. "addip=" \
  102. "setenv bootargs ${bootargs} " \
  103. "ip=${ipaddr}:${serverip}:${gatewayip}:" \
  104. "${netmask}:${hostname}:${netdev}:off\0" \
  105. "addmisc=" \
  106. "setenv bootargs ${bootargs} ${miscargs}\0" \
  107. "addmtd=" \
  108. "if test -z \"${sf_size_1}\" ; then " \
  109. "setenv mtdparts \"${mtdparts_0}\" ; " \
  110. "else " \
  111. "setenv mtdparts \"${mtdparts_0};${mtdparts_1}\" ; " \
  112. "fi ; " \
  113. "setenv bootargs ${bootargs} mtdparts=${mtdparts}\0" \
  114. "addargs=run addcons addmtd addmisc\0" \
  115. "ubiload=" \
  116. "ubi part ${ubimtd} ; ubifsmount ${ubipart} ; " \
  117. "ubifsload ${kernel_addr_r} /boot/${bootfile}\0" \
  118. "netload=" \
  119. "tftp ${kernel_addr_r} ${hostname}/${bootfile}\0" \
  120. "miscargs=nohlt panic=1\0" \
  121. "ubiargs=" \
  122. "setenv bootargs ubi.mtd=${ubimtdnr} " \
  123. "root=${ubipart} rootfstype=ubifs\0" \
  124. "nfsargs=" \
  125. "setenv bootargs root=/dev/nfs rw " \
  126. "nfsroot=${serverip}:${rootpath},v3,tcp\0" \
  127. "ubi_sfsel=" \
  128. "if test \"${boottype}\" = \"rcvr\" ; then " \
  129. "setenv ubisfcs 0 ; " \
  130. "setenv ubimtd rcvrfs ; " \
  131. "setenv ubimtdnr 5 ; " \
  132. "setenv mtdparts mtdparts=${mtdparts_0} ; " \
  133. "setenv mtdids nor0=ff705000.spi.0 ; " \
  134. "setenv ubipart ubi0:vining-fpga-rootfs ; " \
  135. "else " \
  136. "if test \"${sf_size_0}\" = \"1000000\" ; then "\
  137. /* 16MiB+128MiB SF */ \
  138. "setenv ubisfcs 1 ; " \
  139. "setenv ubimtd rootfs ; " \
  140. "setenv ubimtdnr 6 ; " \
  141. "setenv mtdparts mtdparts=${mtdparts_1} ; " \
  142. "setenv mtdids nor0=ff705000.spi.1 ; " \
  143. "setenv ubipart ubi0:vining-fpga-rootfs ; " \
  144. "else " \
  145. /* 256MiB(+256MiB) SF */ \
  146. "setenv ubisfcs 0 ; " \
  147. "setenv ubimtd rootfs ; " \
  148. "setenv ubimtdnr 6 ; " \
  149. "setenv mtdparts mtdparts=${mtdparts_0} ; " \
  150. "setenv mtdids nor0=ff705000.spi.0 ; " \
  151. "setenv ubipart ubi0:vining-fpga-rootfs ; " \
  152. "fi ; " \
  153. "fi ; " \
  154. "sf probe 0:${ubisfcs}\0" \
  155. "boot_kernel=" \
  156. "if test -z \"${sf_size_1}\" ; then " /* 1x256MiB SF */ \
  157. "imxtract ${kernel_addr_r} fdt@1 ${fdt_addr_r} && " \
  158. "fdt addr ${fdt_addr_r} && " \
  159. "fdt resize && " \
  160. "fdt set /soc/spi@ff705000/n25q00@1 status disabled && " \
  161. "bootm ${kernel_addr_r}:kernel@1 - ${fdt_addr_r} ; " \
  162. "else " \
  163. "bootm ${kernel_addr_r} ; " \
  164. "fi\0" \
  165. "ubi_ubi=" \
  166. "run ubi_sfsel ubiload ubiargs addargs boot_kernel\0" \
  167. "ubi_nfs=" \
  168. "run ubiload nfsargs addip addargs boot_kernel\0" \
  169. "net_ubi=" \
  170. "run netload ubiargs addargs boot_kernel\0" \
  171. "net_nfs=" \
  172. "run netload nfsargs addip addargs boot_kernel\0" \
  173. "selboot=" /* Select from where to boot. */ \
  174. "run sf_identify ; " \
  175. "if test \"${bootmode}\" = \"qspi\" ; then " \
  176. "led all off ; " \
  177. "if test \"${boottype}\" = \"rcvr\" ; then " \
  178. "echo \"Booting recovery system\" ; " \
  179. "led 3 on ; " /* Bottom RED */ \
  180. "fi ; " \
  181. "led 1 on ; " /* Top RED */ \
  182. "run ubi_ubi ; " \
  183. "else echo \"Unsupported boot mode: \"${bootmode} ; " \
  184. "fi\0" \
  185. "socfpga_legacy_reset_compat=1\0"
  186. /* Support changing the prompt string */
  187. #define CONFIG_CMDLINE_PS_SUPPORT
  188. /* The rest of the configuration is shared */
  189. #include <configs/socfpga_common.h>
  190. #endif /* __CONFIG_SOFTING_VINING_FPGA_H__ */