1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (C) 2015 Marek Vasut <marex@denx.de>
5 #ifndef __CONFIG_SAMTEC_VINING_FPGA_H__
6 #define __CONFIG_SAMTEC_VINING_FPGA_H__
8 #include <asm/arch/base_addr_ac5.h>
10 /* Memory configurations */
11 #define PHYS_SDRAM_1_SIZE 0x40000000 /* 1GiB on VINING_FPGA */
14 #define CONFIG_BOOTFILE "openwrt-socfpga-socfpga_cyclone5_vining_fpga-fit-uImage.itb"
15 #define CONFIG_BOOTCOMMAND "run selboot"
16 #define CONFIG_LOADADDR 0x01000000
17 #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
19 /* Ethernet on SoC (EMAC) */
20 #if defined(CONFIG_CMD_NET)
21 #define CONFIG_BOOTP_SEND_HOSTNAME
24 /* Extra Environment */
25 #define CONFIG_HOSTNAME "socfpga_vining_fpga"
28 * Active LOW GPIO buttons:
29 * A: GPIO 77 ... the button between USB B and ethernet
30 * B: GPIO 78 ... the button between USB A ports
33 * if button B is not pressed, boot normal Linux system immediatelly
34 * if button B is pressed, wait $bootdelay and boot recovery system
36 #define CONFIG_USE_PREBOOT
37 #define CONFIG_PREBOOT \
38 "setenv hostname vining-${unit_serial} ; " \
39 "setenv PS1 \"${unit_ident} (${unit_serial}) => \" ; " \
40 "if gpio input 78 ; then " \
41 "setenv bootdelay 10 ; " \
42 "setenv boottype rcvr ; " \
44 "setenv bootdelay 5 ; " \
45 "setenv boottype norm ; " \
48 #define CONFIG_EXTRA_ENV_SETTINGS \
52 "bootscript=boot.scr\0" \
55 "ubipart=ubi0:rootfs\0" \
56 "ubisfcs=1\0" /* Default is flash at CS#1 */ \
58 "hostname=vining_fpga\0" \
59 "kernel_addr_r=0x10000000\0" \
60 "mtdparts_0=ff705000.spi.0:" \
66 "-(rcvrfs)\0" /* Recovery */ \
67 "mtdparts_1=ff705000.spi.1:" \
70 "update_filename=u-boot-with-spl-dtb.sfp\0" \
71 "update_qspi_offset=0x0\0" \
72 "update_qspi=" /* Update the QSPI firmware */ \
73 "if sf probe ; then " \
74 "if tftp ${update_filename} ; then " \
75 "sf update ${loadaddr} ${update_qspi_offset} ${filesize} ; " \
78 "fpga_filename=output_file.rbf\0" \
79 "load_fpga=" /* Load FPGA bitstream */ \
80 "if tftp ${fpga_filename} ; then " \
81 "fpga load 0 $loadaddr $filesize ; " \
85 "setenv bootargs ${bootargs} " \
86 "console=${consdev},${baudrate}\0" \
88 "setenv bootargs ${bootargs} " \
89 "ip=${ipaddr}:${serverip}:${gatewayip}:" \
90 "${netmask}:${hostname}:${netdev}:off\0" \
92 "setenv bootargs ${bootargs} ${miscargs}\0" \
94 "setenv mtdparts \"${mtdparts_0};${mtdparts_1}\" ; " \
95 "setenv bootargs ${bootargs} mtdparts=${mtdparts}\0" \
96 "addargs=run addcons addmtd addmisc\0" \
98 "ubi part ${ubimtd} ; ubifsmount ${ubipart} ; " \
99 "ubifsload ${kernel_addr_r} /boot/${bootfile}\0" \
101 "tftp ${kernel_addr_r} ${hostname}/${bootfile}\0" \
102 "miscargs=nohlt panic=1\0" \
104 "setenv bootargs ubi.mtd=${ubimtdnr} " \
105 "root=${ubipart} rootfstype=ubifs\0" \
107 "setenv bootargs root=/dev/nfs rw " \
108 "nfsroot=${serverip}:${rootpath},v3,tcp\0" \
110 "if test \"${boottype}\" = \"rcvr\" ; then " \
111 "setenv ubisfcs 0 ; " \
112 "setenv ubimtd rcvrfs ; " \
113 "setenv ubimtdnr 5 ; " \
114 "setenv mtdparts mtdparts=${mtdparts_0} ; " \
115 "setenv mtdids nor0=ff705000.spi.0 ; " \
116 "setenv ubipart ubi0:rootfs ; " \
118 "setenv ubisfcs 1 ; " \
119 "setenv ubimtd rootfs ; " \
120 "setenv ubimtdnr 6 ; " \
121 "setenv mtdparts mtdparts=${mtdparts_1} ; " \
122 "setenv mtdids nor0=ff705000.spi.1 ; " \
123 "setenv ubipart ubi0:rootfs ; " \
125 "sf probe 0:${ubisfcs}\0" \
127 "run ubi_sfsel ubiload ubiargs addargs ; " \
128 "bootm ${kernel_addr_r}\0" \
130 "run ubiload nfsargs addip addargs ; " \
131 "bootm ${kernel_addr_r}\0" \
133 "run netload ubiargs addargs ; " \
134 "bootm ${kernel_addr_r}\0" \
136 "run netload nfsargs addip addargs ; " \
137 "bootm ${kernel_addr_r}\0" \
138 "selboot=" /* Select from where to boot. */ \
139 "if test \"${bootmode}\" = \"qspi\" ; then " \
141 "if test \"${boottype}\" = \"rcvr\" ; then " \
142 "echo \"Booting recovery system\" ; " \
143 "led 3 on ; " /* Bottom RED */ \
145 "led 1 on ; " /* Top RED */ \
147 "else echo \"Unsupported boot mode: \"${bootmode} ; " \
149 "socfpga_legacy_reset_compat=1\0"
151 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
152 #define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
153 #define CONFIG_ENV_SECT_SIZE (64 * 1024)
154 #define CONFIG_ENV_OFFSET 0x100000
155 #define CONFIG_ENV_OFFSET_REDUND \
156 (CONFIG_ENV_OFFSET + CONFIG_ENV_SECT_SIZE)
158 /* Support changing the prompt string */
159 #define CONFIG_CMDLINE_PS_SUPPORT
161 /* The rest of the configuration is shared */
162 #include <configs/socfpga_common.h>
164 #endif /* __CONFIG_SAMTEC_VINING_FPGA_H__ */