blob: 29a92b91468701bdede9729151abf5c170f0cef1 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Marek Vasutba2ade92015-12-01 18:09:52 +01002/*
3 * Copyright (C) 2015 Marek Vasut <marex@denx.de>
Marek Vasutba2ade92015-12-01 18:09:52 +01004 */
5#ifndef __CONFIG_SAMTEC_VINING_FPGA_H__
6#define __CONFIG_SAMTEC_VINING_FPGA_H__
7
8#include <asm/arch/base_addr_ac5.h>
9
Marek Vasutba2ade92015-12-01 18:09:52 +010010/* Memory configurations */
11#define PHYS_SDRAM_1_SIZE 0x40000000 /* 1GiB on VINING_FPGA */
12
13/* Booting Linux */
Marek Vasutba2ade92015-12-01 18:09:52 +010014#define CONFIG_BOOTFILE "openwrt-socfpga-socfpga_cyclone5_vining_fpga-fit-uImage.itb"
Marek Vasutba2ade92015-12-01 18:09:52 +010015#define CONFIG_BOOTCOMMAND "run selboot"
16#define CONFIG_LOADADDR 0x01000000
17#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
18
Marek Vasutba2ade92015-12-01 18:09:52 +010019/* Ethernet on SoC (EMAC) */
20#if defined(CONFIG_CMD_NET)
21#define CONFIG_BOOTP_SEND_HOSTNAME
Marek Vasutba2ade92015-12-01 18:09:52 +010022#endif
23
24/* Extra Environment */
Mario Six790d8442018-03-28 14:38:20 +020025#define CONFIG_HOSTNAME "socfpga_vining_fpga"
Marek Vasutba2ade92015-12-01 18:09:52 +010026
27/*
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
31 *
32 * The logic:
33 * if button B is not pressed, boot normal Linux system immediatelly
34 * if button B is pressed, wait $bootdelay and boot recovery system
35 */
36#define CONFIG_PREBOOT \
37 "setenv hostname vining-${unit_serial} ; " \
38 "setenv PS1 \"${unit_ident} (${unit_serial}) => \" ; " \
39 "if gpio input 78 ; then " \
40 "setenv bootdelay 10 ; " \
41 "setenv boottype rcvr ; " \
42 "else " \
43 "setenv bootdelay 5 ; " \
44 "setenv boottype norm ; " \
45 "fi"
46
47#define CONFIG_EXTRA_ENV_SETTINGS \
48 "verify=n\0" \
49 "consdev=ttyS0\0" \
50 "baudrate=115200\0" \
51 "bootscript=boot.scr\0" \
52 "ubimtdnr=5\0" \
53 "ubimtd=rootfs\0" \
54 "ubipart=ubi0:rootfs\0" \
55 "ubisfcs=1\0" /* Default is flash at CS#1 */ \
56 "netdev=eth0\0" \
57 "hostname=vining_fpga\0" \
58 "kernel_addr_r=0x10000000\0" \
59 "mtdparts_0=ff705000.spi.0:" \
60 "1m(u-boot)," \
61 "64k(env1)," \
62 "64k(env2)," \
63 "256k(samtec1)," \
64 "256k(samtec2)," \
65 "-(rcvrfs)\0" /* Recovery */ \
66 "mtdparts_1=ff705000.spi.1:" \
67 "32m(rootfs)," \
68 "-(userfs)\0" \
69 "update_filename=u-boot-with-spl-dtb.sfp\0" \
70 "update_qspi_offset=0x0\0" \
71 "update_qspi=" /* Update the QSPI firmware */ \
72 "if sf probe ; then " \
73 "if tftp ${update_filename} ; then " \
74 "sf update ${loadaddr} ${update_qspi_offset} ${filesize} ; " \
75 "fi ; " \
76 "fi\0" \
77 "fpga_filename=output_file.rbf\0" \
78 "load_fpga=" /* Load FPGA bitstream */ \
79 "if tftp ${fpga_filename} ; then " \
80 "fpga load 0 $loadaddr $filesize ; " \
81 "bridge enable ; " \
82 "fi\0" \
83 "addcons=" \
84 "setenv bootargs ${bootargs} " \
85 "console=${consdev},${baudrate}\0" \
86 "addip=" \
87 "setenv bootargs ${bootargs} " \
88 "ip=${ipaddr}:${serverip}:${gatewayip}:" \
89 "${netmask}:${hostname}:${netdev}:off\0" \
90 "addmisc=" \
91 "setenv bootargs ${bootargs} ${miscargs}\0" \
92 "addmtd=" \
93 "setenv mtdparts \"${mtdparts_0};${mtdparts_1}\" ; " \
94 "setenv bootargs ${bootargs} mtdparts=${mtdparts}\0" \
95 "addargs=run addcons addmtd addmisc\0" \
96 "ubiload=" \
97 "ubi part ${ubimtd} ; ubifsmount ${ubipart} ; " \
98 "ubifsload ${kernel_addr_r} /boot/${bootfile}\0" \
99 "netload=" \
100 "tftp ${kernel_addr_r} ${hostname}/${bootfile}\0" \
101 "miscargs=nohlt panic=1\0" \
102 "ubiargs=" \
103 "setenv bootargs ubi.mtd=${ubimtdnr} " \
104 "root=${ubipart} rootfstype=ubifs\0" \
105 "nfsargs=" \
106 "setenv bootargs root=/dev/nfs rw " \
107 "nfsroot=${serverip}:${rootpath},v3,tcp\0" \
108 "ubi_sfsel=" \
109 "if test \"${boottype}\" = \"rcvr\" ; then " \
110 "setenv ubisfcs 0 ; " \
111 "setenv ubimtd rcvrfs ; " \
112 "setenv ubimtdnr 5 ; " \
113 "setenv mtdparts mtdparts=${mtdparts_0} ; " \
114 "setenv mtdids nor0=ff705000.spi.0 ; " \
115 "setenv ubipart ubi0:rootfs ; " \
116 "else " \
117 "setenv ubisfcs 1 ; " \
118 "setenv ubimtd rootfs ; " \
119 "setenv ubimtdnr 6 ; " \
120 "setenv mtdparts mtdparts=${mtdparts_1} ; " \
121 "setenv mtdids nor0=ff705000.spi.1 ; " \
122 "setenv ubipart ubi0:rootfs ; " \
123 "fi ; " \
124 "sf probe 0:${ubisfcs}\0" \
125 "ubi_ubi=" \
126 "run ubi_sfsel ubiload ubiargs addargs ; " \
127 "bootm ${kernel_addr_r}\0" \
128 "ubi_nfs=" \
129 "run ubiload nfsargs addip addargs ; " \
130 "bootm ${kernel_addr_r}\0" \
131 "net_ubi=" \
132 "run netload ubiargs addargs ; " \
133 "bootm ${kernel_addr_r}\0" \
134 "net_nfs=" \
135 "run netload nfsargs addip addargs ; " \
136 "bootm ${kernel_addr_r}\0" \
137 "selboot=" /* Select from where to boot. */ \
138 "if test \"${bootmode}\" = \"qspi\" ; then " \
139 "led all off ; " \
140 "if test \"${boottype}\" = \"rcvr\" ; then " \
141 "echo \"Booting recovery system\" ; " \
142 "led 3 on ; " /* Bottom RED */ \
143 "fi ; " \
144 "led 1 on ; " /* Top RED */ \
145 "run ubi_ubi ; " \
146 "else echo \"Unsupported boot mode: \"${bootmode} ; " \
147 "fi\0" \
148
Marek Vasutba2ade92015-12-01 18:09:52 +0100149#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
150#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
151#define CONFIG_ENV_SECT_SIZE (64 * 1024)
152#define CONFIG_ENV_OFFSET 0x100000
153#define CONFIG_ENV_OFFSET_REDUND \
154 (CONFIG_ENV_OFFSET + CONFIG_ENV_SECT_SIZE)
155
Marek Vasutba2ade92015-12-01 18:09:52 +0100156/* Support changing the prompt string */
157#define CONFIG_CMDLINE_PS_SUPPORT
158
159/* The rest of the configuration is shared */
160#include <configs/socfpga_common.h>
161
162#endif /* __CONFIG_SAMTEC_VINING_FPGA_H__ */