socfpga_vining_fpga.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. /*
  2. * Copyright (C) 2015 Marek Vasut <marex@denx.de>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #ifndef __CONFIG_SAMTEC_VINING_FPGA_H__
  7. #define __CONFIG_SAMTEC_VINING_FPGA_H__
  8. #include <asm/arch/base_addr_ac5.h>
  9. /* U-Boot Commands */
  10. #define CONFIG_SYS_NO_FLASH
  11. #define CONFIG_DOS_PARTITION
  12. #define CONFIG_FAT_WRITE
  13. #define CONFIG_HW_WATCHDOG
  14. #define CONFIG_CMD_EEPROM
  15. #define CONFIG_CMD_LED
  16. /* Memory configurations */
  17. #define PHYS_SDRAM_1_SIZE 0x40000000 /* 1GiB on VINING_FPGA */
  18. /* Booting Linux */
  19. #define CONFIG_BOOTFILE "openwrt-socfpga-socfpga_cyclone5_vining_fpga-fit-uImage.itb"
  20. #define CONFIG_BOOTARGS "console=ttyS0," __stringify(CONFIG_BAUDRATE)
  21. #define CONFIG_BOOTCOMMAND "run selboot"
  22. #define CONFIG_LOADADDR 0x01000000
  23. #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
  24. /* I2C EEPROM */
  25. #ifdef CONFIG_CMD_EEPROM
  26. #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50
  27. #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
  28. #define CONFIG_SYS_I2C_EEPROM_BUS 0
  29. #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
  30. #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 70
  31. #endif
  32. /*
  33. * Status LEDs:
  34. * 0 ... Top Green
  35. * 1 ... Top Red
  36. * 2 ... Bottom Green
  37. * 3 ... Bottom Red
  38. */
  39. #define CONFIG_STATUS_LED
  40. #define CONFIG_GPIO_LED
  41. #define CONFIG_BOARD_SPECIFIC_LED
  42. #define STATUS_LED_BIT 48
  43. #define STATUS_LED_STATE STATUS_LED_OFF
  44. #define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 2)
  45. #define STATUS_LED_BIT1 53
  46. #define STATUS_LED_STATE1 STATUS_LED_OFF
  47. #define STATUS_LED_PERIOD1 (CONFIG_SYS_HZ / 2)
  48. #define STATUS_LED_BIT2 54
  49. #define STATUS_LED_STATE2 STATUS_LED_OFF
  50. #define STATUS_LED_PERIOD2 (CONFIG_SYS_HZ / 2)
  51. #define STATUS_LED_BIT3 65
  52. #define STATUS_LED_STATE3 STATUS_LED_OFF
  53. #define STATUS_LED_PERIOD3 (CONFIG_SYS_HZ / 2)
  54. /* Ethernet on SoC (EMAC) */
  55. #if defined(CONFIG_CMD_NET)
  56. #define CONFIG_BOOTP_SEND_HOSTNAME
  57. /* PHY */
  58. #define CONFIG_PHY_MICREL
  59. #define CONFIG_PHY_MICREL_KSZ9021
  60. #endif
  61. /* Extra Environment */
  62. #define CONFIG_HOSTNAME socfpga_vining_fpga
  63. /*
  64. * Active LOW GPIO buttons:
  65. * A: GPIO 77 ... the button between USB B and ethernet
  66. * B: GPIO 78 ... the button between USB A ports
  67. *
  68. * The logic:
  69. * if button B is not pressed, boot normal Linux system immediatelly
  70. * if button B is pressed, wait $bootdelay and boot recovery system
  71. */
  72. #define CONFIG_PREBOOT \
  73. "setenv hostname vining-${unit_serial} ; " \
  74. "setenv PS1 \"${unit_ident} (${unit_serial}) => \" ; " \
  75. "if gpio input 78 ; then " \
  76. "setenv bootdelay 10 ; " \
  77. "setenv boottype rcvr ; " \
  78. "else " \
  79. "setenv bootdelay 5 ; " \
  80. "setenv boottype norm ; " \
  81. "fi"
  82. #define CONFIG_EXTRA_ENV_SETTINGS \
  83. "verify=n\0" \
  84. "consdev=ttyS0\0" \
  85. "baudrate=115200\0" \
  86. "bootscript=boot.scr\0" \
  87. "ubimtdnr=5\0" \
  88. "ubimtd=rootfs\0" \
  89. "ubipart=ubi0:rootfs\0" \
  90. "ubisfcs=1\0" /* Default is flash at CS#1 */ \
  91. "netdev=eth0\0" \
  92. "hostname=vining_fpga\0" \
  93. "kernel_addr_r=0x10000000\0" \
  94. "mtdparts_0=ff705000.spi.0:" \
  95. "1m(u-boot)," \
  96. "64k(env1)," \
  97. "64k(env2)," \
  98. "256k(samtec1)," \
  99. "256k(samtec2)," \
  100. "-(rcvrfs)\0" /* Recovery */ \
  101. "mtdparts_1=ff705000.spi.1:" \
  102. "32m(rootfs)," \
  103. "-(userfs)\0" \
  104. "update_filename=u-boot-with-spl-dtb.sfp\0" \
  105. "update_qspi_offset=0x0\0" \
  106. "update_qspi=" /* Update the QSPI firmware */ \
  107. "if sf probe ; then " \
  108. "if tftp ${update_filename} ; then " \
  109. "sf update ${loadaddr} ${update_qspi_offset} ${filesize} ; " \
  110. "fi ; " \
  111. "fi\0" \
  112. "fpga_filename=output_file.rbf\0" \
  113. "load_fpga=" /* Load FPGA bitstream */ \
  114. "if tftp ${fpga_filename} ; then " \
  115. "fpga load 0 $loadaddr $filesize ; " \
  116. "bridge enable ; " \
  117. "fi\0" \
  118. "addcons=" \
  119. "setenv bootargs ${bootargs} " \
  120. "console=${consdev},${baudrate}\0" \
  121. "addip=" \
  122. "setenv bootargs ${bootargs} " \
  123. "ip=${ipaddr}:${serverip}:${gatewayip}:" \
  124. "${netmask}:${hostname}:${netdev}:off\0" \
  125. "addmisc=" \
  126. "setenv bootargs ${bootargs} ${miscargs}\0" \
  127. "addmtd=" \
  128. "setenv mtdparts \"${mtdparts_0};${mtdparts_1}\" ; " \
  129. "setenv bootargs ${bootargs} mtdparts=${mtdparts}\0" \
  130. "addargs=run addcons addmtd addmisc\0" \
  131. "ubiload=" \
  132. "ubi part ${ubimtd} ; ubifsmount ${ubipart} ; " \
  133. "ubifsload ${kernel_addr_r} /boot/${bootfile}\0" \
  134. "netload=" \
  135. "tftp ${kernel_addr_r} ${hostname}/${bootfile}\0" \
  136. "miscargs=nohlt panic=1\0" \
  137. "ubiargs=" \
  138. "setenv bootargs ubi.mtd=${ubimtdnr} " \
  139. "root=${ubipart} rootfstype=ubifs\0" \
  140. "nfsargs=" \
  141. "setenv bootargs root=/dev/nfs rw " \
  142. "nfsroot=${serverip}:${rootpath},v3,tcp\0" \
  143. "ubi_sfsel=" \
  144. "if test \"${boottype}\" = \"rcvr\" ; then " \
  145. "setenv ubisfcs 0 ; " \
  146. "setenv ubimtd rcvrfs ; " \
  147. "setenv ubimtdnr 5 ; " \
  148. "setenv mtdparts mtdparts=${mtdparts_0} ; " \
  149. "setenv mtdids nor0=ff705000.spi.0 ; " \
  150. "setenv ubipart ubi0:rootfs ; " \
  151. "else " \
  152. "setenv ubisfcs 1 ; " \
  153. "setenv ubimtd rootfs ; " \
  154. "setenv ubimtdnr 6 ; " \
  155. "setenv mtdparts mtdparts=${mtdparts_1} ; " \
  156. "setenv mtdids nor0=ff705000.spi.1 ; " \
  157. "setenv ubipart ubi0:rootfs ; " \
  158. "fi ; " \
  159. "sf probe 0:${ubisfcs}\0" \
  160. "ubi_ubi=" \
  161. "run ubi_sfsel ubiload ubiargs addargs ; " \
  162. "bootm ${kernel_addr_r}\0" \
  163. "ubi_nfs=" \
  164. "run ubiload nfsargs addip addargs ; " \
  165. "bootm ${kernel_addr_r}\0" \
  166. "net_ubi=" \
  167. "run netload ubiargs addargs ; " \
  168. "bootm ${kernel_addr_r}\0" \
  169. "net_nfs=" \
  170. "run netload nfsargs addip addargs ; " \
  171. "bootm ${kernel_addr_r}\0" \
  172. "selboot=" /* Select from where to boot. */ \
  173. "if test \"${bootmode}\" = \"qspi\" ; then " \
  174. "led all off ; " \
  175. "if test \"${boottype}\" = \"rcvr\" ; then " \
  176. "echo \"Booting recovery system\" ; " \
  177. "led 3 on ; " /* Bottom RED */ \
  178. "fi ; " \
  179. "led 1 on ; " /* Top RED */ \
  180. "run ubi_ubi ; " \
  181. "else echo \"Unsupported boot mode: \"${bootmode} ; " \
  182. "fi\0" \
  183. #define CONFIG_CMD_UBIFS
  184. #define CONFIG_RBTREE
  185. #define CONFIG_LZO
  186. #define MTDPARTS_DEFAULT \
  187. "mtdparts=ff705000.spi.0:" \
  188. "1m(u-boot)," \
  189. "64k(env1)," \
  190. "64k(env2)," \
  191. "256k(samtec1)," \
  192. "256k(samtec2)," \
  193. "-(rcvrfs);" /* Recovery */ \
  194. #define CONFIG_ENV_IS_IN_SPI_FLASH
  195. #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
  196. #define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
  197. #define CONFIG_ENV_SECT_SIZE (64 * 1024)
  198. #define CONFIG_ENV_OFFSET 0x100000
  199. #define CONFIG_ENV_OFFSET_REDUND \
  200. (CONFIG_ENV_OFFSET + CONFIG_ENV_SECT_SIZE)
  201. #define CONFIG_MISC_INIT_R
  202. #define CONFIG_BOARD_LATE_INIT
  203. /* Support changing the prompt string */
  204. #define CONFIG_CMDLINE_PS_SUPPORT
  205. /* The rest of the configuration is shared */
  206. #include <configs/socfpga_common.h>
  207. #endif /* __CONFIG_SAMTEC_VINING_FPGA_H__ */