blob: 8b97cd93a78ad00f64a0c9612f15b1f7da19f6e6 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Marek Vasut569a1912015-12-01 18:09:52 +01002/*
Marek Vasut94a16b82019-06-27 00:19:31 +02003 * Copyright (C) 2015-2019 Marek Vasut <marex@denx.de>
Marek Vasut569a1912015-12-01 18:09:52 +01004 */
Marek Vasut94a16b82019-06-27 00:19:31 +02005#ifndef __CONFIG_SOFTING_VINING_FPGA_H__
6#define __CONFIG_SOFTING_VINING_FPGA_H__
Marek Vasut569a1912015-12-01 18:09:52 +01007
8#include <asm/arch/base_addr_ac5.h>
9
Marek Vasut569a1912015-12-01 18:09:52 +010010/* Memory configurations */
11#define PHYS_SDRAM_1_SIZE 0x40000000 /* 1GiB on VINING_FPGA */
12
13/* Booting Linux */
Marek Vasut11086192019-06-27 00:19:34 +020014#define CONFIG_BOOTFILE "fitImage"
Marek Vasut569a1912015-12-01 18:09:52 +010015#define CONFIG_BOOTCOMMAND "run selboot"
Marek Vasut11086192019-06-27 00:19:34 +020016#define CONFIG_SYS_BOOTM_LEN 0x2000000 /* 32 MiB */
Marek Vasut569a1912015-12-01 18:09:52 +010017#define CONFIG_LOADADDR 0x01000000
18#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
19
Marek Vasut569a1912015-12-01 18:09:52 +010020/* Ethernet on SoC (EMAC) */
21#if defined(CONFIG_CMD_NET)
22#define CONFIG_BOOTP_SEND_HOSTNAME
Marek Vasut569a1912015-12-01 18:09:52 +010023#endif
24
25/* Extra Environment */
Mario Six5bc05432018-03-28 14:38:20 +020026#define CONFIG_HOSTNAME "socfpga_vining_fpga"
Marek Vasut569a1912015-12-01 18:09:52 +010027
28/*
29 * Active LOW GPIO buttons:
30 * A: GPIO 77 ... the button between USB B and ethernet
31 * B: GPIO 78 ... the button between USB A ports
32 *
33 * The logic:
Marek Vasut11086192019-06-27 00:19:34 +020034 * if button B is pressed, boot recovery system after 10 seconds
35 * if force_boottype is set, boot system depending on the value in the
36 * $force_boottype variable after 1 second
37 * if button B is not pressed and force_boottype is not set, boot normal
38 * Linux system after 5 seconds
Marek Vasut569a1912015-12-01 18:09:52 +010039 */
Marek Vasut569a1912015-12-01 18:09:52 +010040
41#define CONFIG_EXTRA_ENV_SETTINGS \
42 "verify=n\0" \
43 "consdev=ttyS0\0" \
44 "baudrate=115200\0" \
45 "bootscript=boot.scr\0" \
46 "ubimtdnr=5\0" \
47 "ubimtd=rootfs\0" \
Marek Vasut11086192019-06-27 00:19:34 +020048 "ubipart=ubi0:vining-fpga-rootfs\0" \
Marek Vasut569a1912015-12-01 18:09:52 +010049 "ubisfcs=1\0" /* Default is flash at CS#1 */ \
50 "netdev=eth0\0" \
Marek Vasut11086192019-06-27 00:19:34 +020051 "hostname=vining_fpga\0" \
Marek Vasut569a1912015-12-01 18:09:52 +010052 "kernel_addr_r=0x10000000\0" \
Marek Vasut11086192019-06-27 00:19:34 +020053 "fdt_addr_r=0x20000000\0" \
54 "fdt_high=0xffffffff\0" \
55 "initrd_high=0xffffffff\0" \
56 "dfu_alt_info=qspi0 sf 0:0;qspi1 sf 0:1\0" \
57 "mtdparts_0_16m=ff705000.spi.0:" /* 16MiB+128MiB SF config */ \
Marek Vasut569a1912015-12-01 18:09:52 +010058 "1m(u-boot)," \
59 "64k(env1)," \
60 "64k(env2)," \
Marek Vasut94a16b82019-06-27 00:19:31 +020061 "256k(softing1)," \
62 "256k(softing2)," \
Marek Vasut569a1912015-12-01 18:09:52 +010063 "-(rcvrfs)\0" /* Recovery */ \
Marek Vasut11086192019-06-27 00:19:34 +020064 "mtdparts_0_256m=ff705000.spi.0:" /* 256MiB(+256MiB) config */ \
65 "1m(u-boot)," \
66 "64k(env1)," \
67 "64k(env2)," \
68 "256k(softing1)," \
69 "256k(softing2)," \
70 "14720k(rcvrfs)," /* Recovery */ \
71 "64m(rootfs)," /* Root */ \
72 "-(userfs)\0" /* User */ \
73 "mtdparts_1_128m=ff705000.spi.1:" /* 16MiB+128MiB SF config */ \
74 "64m(rootfs)," \
Marek Vasut569a1912015-12-01 18:09:52 +010075 "-(userfs)\0" \
Marek Vasut11086192019-06-27 00:19:34 +020076 "mtdparts_1_256m=ff705000.spi.1:" /* 256MiB+256MiB SF config */ \
77 "-(userfs2)\0" \
Marek Vasut569a1912015-12-01 18:09:52 +010078 "update_filename=u-boot-with-spl-dtb.sfp\0" \
79 "update_qspi_offset=0x0\0" \
80 "update_qspi=" /* Update the QSPI firmware */ \
81 "if sf probe ; then " \
82 "if tftp ${update_filename} ; then " \
83 "sf update ${loadaddr} ${update_qspi_offset} ${filesize} ; " \
84 "fi ; " \
85 "fi\0" \
Marek Vasut11086192019-06-27 00:19:34 +020086 "sf_identify=" \
87 "setenv sf_size_0 ; setenv sf_size_1 ; " \
88 "sf probe 0:0 && setenv sf_size_0 ${sf_size} ; " \
89 "sf probe 0:1 && setenv sf_size_1 ${sf_size} ; " \
90 "if test -z \"${sf_size_1}\" ; then " \
91 /* 1x256MiB SF */ \
92 "setenv mtdparts_0 ${mtdparts_0_256m} ; " \
93 "setenv mtdparts_1 ; " \
94 "elif test \"${sf_size_0}\" = \"1000000\" ; then " \
95 /* 16MiB+128MiB SF */ \
96 "setenv mtdparts_0 ${mtdparts_0_16m} ; " \
97 "setenv mtdparts_1 ${mtdparts_1_128m} ; " \
98 "else " \
99 /* 256MiB+256MiB SF */ \
100 "setenv mtdparts_0 ${mtdparts_0_256m} ; " \
101 "setenv mtdparts_1 ${mtdparts_1_256m} ; " \
102 "fi\0" \
Marek Vasut569a1912015-12-01 18:09:52 +0100103 "fpga_filename=output_file.rbf\0" \
104 "load_fpga=" /* Load FPGA bitstream */ \
105 "if tftp ${fpga_filename} ; then " \
106 "fpga load 0 $loadaddr $filesize ; " \
107 "bridge enable ; " \
108 "fi\0" \
109 "addcons=" \
110 "setenv bootargs ${bootargs} " \
111 "console=${consdev},${baudrate}\0" \
112 "addip=" \
113 "setenv bootargs ${bootargs} " \
114 "ip=${ipaddr}:${serverip}:${gatewayip}:" \
115 "${netmask}:${hostname}:${netdev}:off\0" \
116 "addmisc=" \
117 "setenv bootargs ${bootargs} ${miscargs}\0" \
118 "addmtd=" \
Marek Vasut11086192019-06-27 00:19:34 +0200119 "if test -z \"${sf_size_1}\" ; then " \
120 "setenv mtdparts \"${mtdparts_0}\" ; " \
121 "else " \
122 "setenv mtdparts \"${mtdparts_0};${mtdparts_1}\" ; " \
123 "fi ; " \
Marek Vasut569a1912015-12-01 18:09:52 +0100124 "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 ; " \
Marek Vasut11086192019-06-27 00:19:34 +0200145 "setenv ubipart ubi0:vining-fpga-rootfs ; " \
Marek Vasut569a1912015-12-01 18:09:52 +0100146 "else " \
Marek Vasut11086192019-06-27 00:19:34 +0200147 "if test \"${sf_size_0}\" = \"1000000\" ; then "\
148 /* 16MiB+128MiB SF */ \
149 "setenv ubisfcs 1 ; " \
150 "setenv ubimtd rootfs ; " \
151 "setenv ubimtdnr 6 ; " \
152 "setenv mtdparts mtdparts=${mtdparts_1} ; " \
153 "setenv mtdids nor0=ff705000.spi.1 ; " \
154 "setenv ubipart ubi0:vining-fpga-rootfs ; " \
155 "else " \
156 /* 256MiB(+256MiB) SF */ \
157 "setenv ubisfcs 0 ; " \
158 "setenv ubimtd rootfs ; " \
159 "setenv ubimtdnr 6 ; " \
160 "setenv mtdparts mtdparts=${mtdparts_0} ; " \
161 "setenv mtdids nor0=ff705000.spi.0 ; " \
162 "setenv ubipart ubi0:vining-fpga-rootfs ; " \
163 "fi ; " \
Marek Vasut569a1912015-12-01 18:09:52 +0100164 "fi ; " \
165 "sf probe 0:${ubisfcs}\0" \
Marek Vasut11086192019-06-27 00:19:34 +0200166 "boot_kernel=" \
167 "if test -z \"${sf_size_1}\" ; then " /* 1x256MiB SF */ \
168 "imxtract ${kernel_addr_r} fdt@1 ${fdt_addr_r} && " \
169 "fdt addr ${fdt_addr_r} && " \
170 "fdt resize && " \
171 "fdt set /soc/spi@ff705000/n25q00@1 status disabled && " \
172 "bootm ${kernel_addr_r}:kernel@1 - ${fdt_addr_r} ; " \
173 "else " \
174 "bootm ${kernel_addr_r} ; " \
175 "fi\0" \
Marek Vasut569a1912015-12-01 18:09:52 +0100176 "ubi_ubi=" \
Marek Vasut11086192019-06-27 00:19:34 +0200177 "run ubi_sfsel ubiload ubiargs addargs boot_kernel\0" \
Marek Vasut569a1912015-12-01 18:09:52 +0100178 "ubi_nfs=" \
Marek Vasut11086192019-06-27 00:19:34 +0200179 "run ubiload nfsargs addip addargs boot_kernel\0" \
Marek Vasut569a1912015-12-01 18:09:52 +0100180 "net_ubi=" \
Marek Vasut11086192019-06-27 00:19:34 +0200181 "run netload ubiargs addargs boot_kernel\0" \
Marek Vasut569a1912015-12-01 18:09:52 +0100182 "net_nfs=" \
Marek Vasut11086192019-06-27 00:19:34 +0200183 "run netload nfsargs addip addargs boot_kernel\0" \
Marek Vasut569a1912015-12-01 18:09:52 +0100184 "selboot=" /* Select from where to boot. */ \
Marek Vasut11086192019-06-27 00:19:34 +0200185 "run sf_identify ; " \
Marek Vasut569a1912015-12-01 18:09:52 +0100186 "if test \"${bootmode}\" = \"qspi\" ; then " \
187 "led all off ; " \
188 "if test \"${boottype}\" = \"rcvr\" ; then " \
189 "echo \"Booting recovery system\" ; " \
190 "led 3 on ; " /* Bottom RED */ \
191 "fi ; " \
192 "led 1 on ; " /* Top RED */ \
193 "run ubi_ubi ; " \
194 "else echo \"Unsupported boot mode: \"${bootmode} ; " \
195 "fi\0" \
Simon Goldschmidtb94655a2019-07-10 22:09:14 +0200196 "socfpga_legacy_reset_compat=1\0"
Marek Vasut569a1912015-12-01 18:09:52 +0100197
Marek Vasut569a1912015-12-01 18:09:52 +0100198/* Support changing the prompt string */
199#define CONFIG_CMDLINE_PS_SUPPORT
200
201/* The rest of the configuration is shared */
202#include <configs/socfpga_common.h>
203
Marek Vasut94a16b82019-06-27 00:19:31 +0200204#endif /* __CONFIG_SOFTING_VINING_FPGA_H__ */