blob: 1d8aed90ce32aa8f324c5137c7d8cc740974c83d [file] [log] [blame]
Marek Vasutba2ade92015-12-01 18:09:52 +01001/*
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
Marek Vasutba2ade92015-12-01 18:09:52 +010011/* Memory configurations */
12#define PHYS_SDRAM_1_SIZE 0x40000000 /* 1GiB on VINING_FPGA */
13
14/* Booting Linux */
Marek Vasutba2ade92015-12-01 18:09:52 +010015#define CONFIG_BOOTFILE "openwrt-socfpga-socfpga_cyclone5_vining_fpga-fit-uImage.itb"
Marek Vasutba2ade92015-12-01 18:09:52 +010016#define CONFIG_BOOTCOMMAND "run selboot"
17#define CONFIG_LOADADDR 0x01000000
18#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
19
20/* I2C EEPROM */
21#ifdef CONFIG_CMD_EEPROM
22#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50
23#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
24#define CONFIG_SYS_I2C_EEPROM_BUS 0
25#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
26#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 70
27#endif
28
29/*
30 * Status LEDs:
31 * 0 ... Top Green
32 * 1 ... Top Red
33 * 2 ... Bottom Green
34 * 3 ... Bottom Red
35 */
Marek Vasutba2ade92015-12-01 18:09:52 +010036
37/* Ethernet on SoC (EMAC) */
38#if defined(CONFIG_CMD_NET)
39#define CONFIG_BOOTP_SEND_HOSTNAME
40/* PHY */
Marek Vasutba2ade92015-12-01 18:09:52 +010041#endif
42
43/* Extra Environment */
Mario Six790d8442018-03-28 14:38:20 +020044#define CONFIG_HOSTNAME "socfpga_vining_fpga"
Marek Vasutba2ade92015-12-01 18:09:52 +010045
46/*
47 * Active LOW GPIO buttons:
48 * A: GPIO 77 ... the button between USB B and ethernet
49 * B: GPIO 78 ... the button between USB A ports
50 *
51 * The logic:
52 * if button B is not pressed, boot normal Linux system immediatelly
53 * if button B is pressed, wait $bootdelay and boot recovery system
54 */
55#define CONFIG_PREBOOT \
56 "setenv hostname vining-${unit_serial} ; " \
57 "setenv PS1 \"${unit_ident} (${unit_serial}) => \" ; " \
58 "if gpio input 78 ; then " \
59 "setenv bootdelay 10 ; " \
60 "setenv boottype rcvr ; " \
61 "else " \
62 "setenv bootdelay 5 ; " \
63 "setenv boottype norm ; " \
64 "fi"
65
66#define CONFIG_EXTRA_ENV_SETTINGS \
67 "verify=n\0" \
68 "consdev=ttyS0\0" \
69 "baudrate=115200\0" \
70 "bootscript=boot.scr\0" \
71 "ubimtdnr=5\0" \
72 "ubimtd=rootfs\0" \
73 "ubipart=ubi0:rootfs\0" \
74 "ubisfcs=1\0" /* Default is flash at CS#1 */ \
75 "netdev=eth0\0" \
76 "hostname=vining_fpga\0" \
77 "kernel_addr_r=0x10000000\0" \
78 "mtdparts_0=ff705000.spi.0:" \
79 "1m(u-boot)," \
80 "64k(env1)," \
81 "64k(env2)," \
82 "256k(samtec1)," \
83 "256k(samtec2)," \
84 "-(rcvrfs)\0" /* Recovery */ \
85 "mtdparts_1=ff705000.spi.1:" \
86 "32m(rootfs)," \
87 "-(userfs)\0" \
88 "update_filename=u-boot-with-spl-dtb.sfp\0" \
89 "update_qspi_offset=0x0\0" \
90 "update_qspi=" /* Update the QSPI firmware */ \
91 "if sf probe ; then " \
92 "if tftp ${update_filename} ; then " \
93 "sf update ${loadaddr} ${update_qspi_offset} ${filesize} ; " \
94 "fi ; " \
95 "fi\0" \
96 "fpga_filename=output_file.rbf\0" \
97 "load_fpga=" /* Load FPGA bitstream */ \
98 "if tftp ${fpga_filename} ; then " \
99 "fpga load 0 $loadaddr $filesize ; " \
100 "bridge enable ; " \
101 "fi\0" \
102 "addcons=" \
103 "setenv bootargs ${bootargs} " \
104 "console=${consdev},${baudrate}\0" \
105 "addip=" \
106 "setenv bootargs ${bootargs} " \
107 "ip=${ipaddr}:${serverip}:${gatewayip}:" \
108 "${netmask}:${hostname}:${netdev}:off\0" \
109 "addmisc=" \
110 "setenv bootargs ${bootargs} ${miscargs}\0" \
111 "addmtd=" \
112 "setenv mtdparts \"${mtdparts_0};${mtdparts_1}\" ; " \
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:rootfs ; " \
135 "else " \
136 "setenv ubisfcs 1 ; " \
137 "setenv ubimtd rootfs ; " \
138 "setenv ubimtdnr 6 ; " \
139 "setenv mtdparts mtdparts=${mtdparts_1} ; " \
140 "setenv mtdids nor0=ff705000.spi.1 ; " \
141 "setenv ubipart ubi0:rootfs ; " \
142 "fi ; " \
143 "sf probe 0:${ubisfcs}\0" \
144 "ubi_ubi=" \
145 "run ubi_sfsel ubiload ubiargs addargs ; " \
146 "bootm ${kernel_addr_r}\0" \
147 "ubi_nfs=" \
148 "run ubiload nfsargs addip addargs ; " \
149 "bootm ${kernel_addr_r}\0" \
150 "net_ubi=" \
151 "run netload ubiargs addargs ; " \
152 "bootm ${kernel_addr_r}\0" \
153 "net_nfs=" \
154 "run netload nfsargs addip addargs ; " \
155 "bootm ${kernel_addr_r}\0" \
156 "selboot=" /* Select from where to boot. */ \
157 "if test \"${bootmode}\" = \"qspi\" ; then " \
158 "led all off ; " \
159 "if test \"${boottype}\" = \"rcvr\" ; then " \
160 "echo \"Booting recovery system\" ; " \
161 "led 3 on ; " /* Bottom RED */ \
162 "fi ; " \
163 "led 1 on ; " /* Top RED */ \
164 "run ubi_ubi ; " \
165 "else echo \"Unsupported boot mode: \"${bootmode} ; " \
166 "fi\0" \
167
Marek Vasutba2ade92015-12-01 18:09:52 +0100168#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
169#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
170#define CONFIG_ENV_SECT_SIZE (64 * 1024)
171#define CONFIG_ENV_OFFSET 0x100000
172#define CONFIG_ENV_OFFSET_REDUND \
173 (CONFIG_ENV_OFFSET + CONFIG_ENV_SECT_SIZE)
174
175#define CONFIG_MISC_INIT_R
Marek Vasutba2ade92015-12-01 18:09:52 +0100176
Marek Vasutba2ade92015-12-01 18:09:52 +0100177/* Support changing the prompt string */
178#define CONFIG_CMDLINE_PS_SUPPORT
179
180/* The rest of the configuration is shared */
181#include <configs/socfpga_common.h>
182
183#endif /* __CONFIG_SAMTEC_VINING_FPGA_H__ */