2 * Copyright (C) 2015 Marek Vasut <marex@denx.de>
4 * SPDX-License-Identifier: GPL-2.0+
6 #ifndef __CONFIG_SAMTEC_VINING_FPGA_H__
7 #define __CONFIG_SAMTEC_VINING_FPGA_H__
9 #include <asm/arch/base_addr_ac5.h>
11 #define CONFIG_HW_WATCHDOG
13 /* Memory configurations */
14 #define PHYS_SDRAM_1_SIZE 0x40000000 /* 1GiB on VINING_FPGA */
17 #define CONFIG_BOOTFILE "openwrt-socfpga-socfpga_cyclone5_vining_fpga-fit-uImage.itb"
18 #define CONFIG_BOOTARGS "console=ttyS0," __stringify(CONFIG_BAUDRATE)
19 #define CONFIG_BOOTCOMMAND "run selboot"
20 #define CONFIG_LOADADDR 0x01000000
21 #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
24 #ifdef CONFIG_CMD_EEPROM
25 #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50
26 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
27 #define CONFIG_SYS_I2C_EEPROM_BUS 0
28 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
29 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 70
40 /* Ethernet on SoC (EMAC) */
41 #if defined(CONFIG_CMD_NET)
42 #define CONFIG_BOOTP_SEND_HOSTNAME
44 #define CONFIG_PHY_MICREL
45 #define CONFIG_PHY_MICREL_KSZ90X1
48 /* Extra Environment */
49 #define CONFIG_HOSTNAME socfpga_vining_fpga
52 * Active LOW GPIO buttons:
53 * A: GPIO 77 ... the button between USB B and ethernet
54 * B: GPIO 78 ... the button between USB A ports
57 * if button B is not pressed, boot normal Linux system immediatelly
58 * if button B is pressed, wait $bootdelay and boot recovery system
60 #define CONFIG_PREBOOT \
61 "setenv hostname vining-${unit_serial} ; " \
62 "setenv PS1 \"${unit_ident} (${unit_serial}) => \" ; " \
63 "if gpio input 78 ; then " \
64 "setenv bootdelay 10 ; " \
65 "setenv boottype rcvr ; " \
67 "setenv bootdelay 5 ; " \
68 "setenv boottype norm ; " \
71 #define CONFIG_EXTRA_ENV_SETTINGS \
75 "bootscript=boot.scr\0" \
78 "ubipart=ubi0:rootfs\0" \
79 "ubisfcs=1\0" /* Default is flash at CS#1 */ \
81 "hostname=vining_fpga\0" \
82 "kernel_addr_r=0x10000000\0" \
83 "mtdparts_0=ff705000.spi.0:" \
89 "-(rcvrfs)\0" /* Recovery */ \
90 "mtdparts_1=ff705000.spi.1:" \
93 "update_filename=u-boot-with-spl-dtb.sfp\0" \
94 "update_qspi_offset=0x0\0" \
95 "update_qspi=" /* Update the QSPI firmware */ \
96 "if sf probe ; then " \
97 "if tftp ${update_filename} ; then " \
98 "sf update ${loadaddr} ${update_qspi_offset} ${filesize} ; " \
101 "fpga_filename=output_file.rbf\0" \
102 "load_fpga=" /* Load FPGA bitstream */ \
103 "if tftp ${fpga_filename} ; then " \
104 "fpga load 0 $loadaddr $filesize ; " \
108 "setenv bootargs ${bootargs} " \
109 "console=${consdev},${baudrate}\0" \
111 "setenv bootargs ${bootargs} " \
112 "ip=${ipaddr}:${serverip}:${gatewayip}:" \
113 "${netmask}:${hostname}:${netdev}:off\0" \
115 "setenv bootargs ${bootargs} ${miscargs}\0" \
117 "setenv mtdparts \"${mtdparts_0};${mtdparts_1}\" ; " \
118 "setenv bootargs ${bootargs} mtdparts=${mtdparts}\0" \
119 "addargs=run addcons addmtd addmisc\0" \
121 "ubi part ${ubimtd} ; ubifsmount ${ubipart} ; " \
122 "ubifsload ${kernel_addr_r} /boot/${bootfile}\0" \
124 "tftp ${kernel_addr_r} ${hostname}/${bootfile}\0" \
125 "miscargs=nohlt panic=1\0" \
127 "setenv bootargs ubi.mtd=${ubimtdnr} " \
128 "root=${ubipart} rootfstype=ubifs\0" \
130 "setenv bootargs root=/dev/nfs rw " \
131 "nfsroot=${serverip}:${rootpath},v3,tcp\0" \
133 "if test \"${boottype}\" = \"rcvr\" ; then " \
134 "setenv ubisfcs 0 ; " \
135 "setenv ubimtd rcvrfs ; " \
136 "setenv ubimtdnr 5 ; " \
137 "setenv mtdparts mtdparts=${mtdparts_0} ; " \
138 "setenv mtdids nor0=ff705000.spi.0 ; " \
139 "setenv ubipart ubi0:rootfs ; " \
141 "setenv ubisfcs 1 ; " \
142 "setenv ubimtd rootfs ; " \
143 "setenv ubimtdnr 6 ; " \
144 "setenv mtdparts mtdparts=${mtdparts_1} ; " \
145 "setenv mtdids nor0=ff705000.spi.1 ; " \
146 "setenv ubipart ubi0:rootfs ; " \
148 "sf probe 0:${ubisfcs}\0" \
150 "run ubi_sfsel ubiload ubiargs addargs ; " \
151 "bootm ${kernel_addr_r}\0" \
153 "run ubiload nfsargs addip addargs ; " \
154 "bootm ${kernel_addr_r}\0" \
156 "run netload ubiargs addargs ; " \
157 "bootm ${kernel_addr_r}\0" \
159 "run netload nfsargs addip addargs ; " \
160 "bootm ${kernel_addr_r}\0" \
161 "selboot=" /* Select from where to boot. */ \
162 "if test \"${bootmode}\" = \"qspi\" ; then " \
164 "if test \"${boottype}\" = \"rcvr\" ; then " \
165 "echo \"Booting recovery system\" ; " \
166 "led 3 on ; " /* Bottom RED */ \
168 "led 1 on ; " /* Top RED */ \
170 "else echo \"Unsupported boot mode: \"${bootmode} ; " \
173 #define MTDPARTS_DEFAULT \
174 "mtdparts=ff705000.spi.0:" \
180 "-(rcvrfs);" /* Recovery */ \
182 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
183 #define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
184 #define CONFIG_ENV_SECT_SIZE (64 * 1024)
185 #define CONFIG_ENV_OFFSET 0x100000
186 #define CONFIG_ENV_OFFSET_REDUND \
187 (CONFIG_ENV_OFFSET + CONFIG_ENV_SECT_SIZE)
189 #define CONFIG_MISC_INIT_R
191 /* Support changing the prompt string */
192 #define CONFIG_CMDLINE_PS_SUPPORT
194 /* The rest of the configuration is shared */
195 #include <configs/socfpga_common.h>
197 #endif /* __CONFIG_SAMTEC_VINING_FPGA_H__ */