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