blob: 4bb15cf46293272f24dc0af711cc169fb5eaae2f [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 Vasut569a1912015-12-01 18:09:52 +010014
Marek Vasut569a1912015-12-01 18:09:52 +010015/* Extra Environment */
Marek Vasut569a1912015-12-01 18:09:52 +010016
17/*
18 * Active LOW GPIO buttons:
19 * A: GPIO 77 ... the button between USB B and ethernet
20 * B: GPIO 78 ... the button between USB A ports
21 *
22 * The logic:
Marek Vasut11086192019-06-27 00:19:34 +020023 * if button B is pressed, boot recovery system after 10 seconds
24 * if force_boottype is set, boot system depending on the value in the
25 * $force_boottype variable after 1 second
26 * if button B is not pressed and force_boottype is not set, boot normal
27 * Linux system after 5 seconds
Marek Vasut569a1912015-12-01 18:09:52 +010028 */
Marek Vasut569a1912015-12-01 18:09:52 +010029
Tom Rini0613c362022-12-04 10:03:50 -050030#define CFG_EXTRA_ENV_SETTINGS \
Marek Vasut569a1912015-12-01 18:09:52 +010031 "verify=n\0" \
32 "consdev=ttyS0\0" \
33 "baudrate=115200\0" \
34 "bootscript=boot.scr\0" \
35 "ubimtdnr=5\0" \
36 "ubimtd=rootfs\0" \
Marek Vasut11086192019-06-27 00:19:34 +020037 "ubipart=ubi0:vining-fpga-rootfs\0" \
Marek Vasut569a1912015-12-01 18:09:52 +010038 "ubisfcs=1\0" /* Default is flash at CS#1 */ \
39 "netdev=eth0\0" \
Marek Vasut11086192019-06-27 00:19:34 +020040 "hostname=vining_fpga\0" \
Marek Vasut569a1912015-12-01 18:09:52 +010041 "kernel_addr_r=0x10000000\0" \
Marek Vasut11086192019-06-27 00:19:34 +020042 "fdt_addr_r=0x20000000\0" \
43 "fdt_high=0xffffffff\0" \
44 "initrd_high=0xffffffff\0" \
45 "dfu_alt_info=qspi0 sf 0:0;qspi1 sf 0:1\0" \
46 "mtdparts_0_16m=ff705000.spi.0:" /* 16MiB+128MiB SF config */ \
Marek Vasut569a1912015-12-01 18:09:52 +010047 "1m(u-boot)," \
48 "64k(env1)," \
49 "64k(env2)," \
Marek Vasut94a16b82019-06-27 00:19:31 +020050 "256k(softing1)," \
51 "256k(softing2)," \
Marek Vasut569a1912015-12-01 18:09:52 +010052 "-(rcvrfs)\0" /* Recovery */ \
Marek Vasut11086192019-06-27 00:19:34 +020053 "mtdparts_0_256m=ff705000.spi.0:" /* 256MiB(+256MiB) config */ \
54 "1m(u-boot)," \
55 "64k(env1)," \
56 "64k(env2)," \
57 "256k(softing1)," \
58 "256k(softing2)," \
59 "14720k(rcvrfs)," /* Recovery */ \
Marek Vasut25cff0c2022-02-21 06:16:12 +010060 "192m(rootfs)," /* Root */ \
Marek Vasut11086192019-06-27 00:19:34 +020061 "-(userfs)\0" /* User */ \
62 "mtdparts_1_128m=ff705000.spi.1:" /* 16MiB+128MiB SF config */ \
63 "64m(rootfs)," \
Marek Vasut569a1912015-12-01 18:09:52 +010064 "-(userfs)\0" \
Marek Vasut11086192019-06-27 00:19:34 +020065 "mtdparts_1_256m=ff705000.spi.1:" /* 256MiB+256MiB SF config */ \
66 "-(userfs2)\0" \
Marek Vasut569a1912015-12-01 18:09:52 +010067 "update_filename=u-boot-with-spl-dtb.sfp\0" \
68 "update_qspi_offset=0x0\0" \
69 "update_qspi=" /* Update the QSPI firmware */ \
70 "if sf probe ; then " \
71 "if tftp ${update_filename} ; then " \
72 "sf update ${loadaddr} ${update_qspi_offset} ${filesize} ; " \
73 "fi ; " \
74 "fi\0" \
Marek Vasut11086192019-06-27 00:19:34 +020075 "sf_identify=" \
76 "setenv sf_size_0 ; setenv sf_size_1 ; " \
77 "sf probe 0:0 && setenv sf_size_0 ${sf_size} ; " \
78 "sf probe 0:1 && setenv sf_size_1 ${sf_size} ; " \
79 "if test -z \"${sf_size_1}\" ; then " \
80 /* 1x256MiB SF */ \
81 "setenv mtdparts_0 ${mtdparts_0_256m} ; " \
82 "setenv mtdparts_1 ; " \
83 "elif test \"${sf_size_0}\" = \"1000000\" ; then " \
84 /* 16MiB+128MiB SF */ \
85 "setenv mtdparts_0 ${mtdparts_0_16m} ; " \
86 "setenv mtdparts_1 ${mtdparts_1_128m} ; " \
87 "else " \
88 /* 256MiB+256MiB SF */ \
89 "setenv mtdparts_0 ${mtdparts_0_256m} ; " \
90 "setenv mtdparts_1 ${mtdparts_1_256m} ; " \
91 "fi\0" \
Marek Vasut569a1912015-12-01 18:09:52 +010092 "fpga_filename=output_file.rbf\0" \
93 "load_fpga=" /* Load FPGA bitstream */ \
94 "if tftp ${fpga_filename} ; then " \
95 "fpga load 0 $loadaddr $filesize ; " \
96 "bridge enable ; " \
97 "fi\0" \
98 "addcons=" \
99 "setenv bootargs ${bootargs} " \
100 "console=${consdev},${baudrate}\0" \
101 "addip=" \
102 "setenv bootargs ${bootargs} " \
103 "ip=${ipaddr}:${serverip}:${gatewayip}:" \
104 "${netmask}:${hostname}:${netdev}:off\0" \
105 "addmisc=" \
106 "setenv bootargs ${bootargs} ${miscargs}\0" \
107 "addmtd=" \
Marek Vasut11086192019-06-27 00:19:34 +0200108 "if test -z \"${sf_size_1}\" ; then " \
109 "setenv mtdparts \"${mtdparts_0}\" ; " \
110 "else " \
111 "setenv mtdparts \"${mtdparts_0};${mtdparts_1}\" ; " \
112 "fi ; " \
Marek Vasut569a1912015-12-01 18:09:52 +0100113 "setenv bootargs ${bootargs} mtdparts=${mtdparts}\0" \
114 "addargs=run addcons addmtd addmisc\0" \
115 "ubiload=" \
116 "ubi part ${ubimtd} ; ubifsmount ${ubipart} ; " \
Marek Vasut163863d2021-12-20 22:57:57 +0100117 "ubifsload ${kernel_addr_r} /boot/${bootfile} ; " \
118 "ubifsumount ; ubi detach\0" \
Marek Vasut569a1912015-12-01 18:09:52 +0100119 "netload=" \
120 "tftp ${kernel_addr_r} ${hostname}/${bootfile}\0" \
121 "miscargs=nohlt panic=1\0" \
122 "ubiargs=" \
123 "setenv bootargs ubi.mtd=${ubimtdnr} " \
124 "root=${ubipart} rootfstype=ubifs\0" \
125 "nfsargs=" \
126 "setenv bootargs root=/dev/nfs rw " \
127 "nfsroot=${serverip}:${rootpath},v3,tcp\0" \
128 "ubi_sfsel=" \
129 "if test \"${boottype}\" = \"rcvr\" ; then " \
130 "setenv ubisfcs 0 ; " \
131 "setenv ubimtd rcvrfs ; " \
132 "setenv ubimtdnr 5 ; " \
133 "setenv mtdparts mtdparts=${mtdparts_0} ; " \
134 "setenv mtdids nor0=ff705000.spi.0 ; " \
Marek Vasut11086192019-06-27 00:19:34 +0200135 "setenv ubipart ubi0:vining-fpga-rootfs ; " \
Marek Vasut569a1912015-12-01 18:09:52 +0100136 "else " \
Marek Vasut11086192019-06-27 00:19:34 +0200137 "if test \"${sf_size_0}\" = \"1000000\" ; then "\
138 /* 16MiB+128MiB SF */ \
139 "setenv ubisfcs 1 ; " \
140 "setenv ubimtd rootfs ; " \
141 "setenv ubimtdnr 6 ; " \
142 "setenv mtdparts mtdparts=${mtdparts_1} ; " \
143 "setenv mtdids nor0=ff705000.spi.1 ; " \
144 "setenv ubipart ubi0:vining-fpga-rootfs ; " \
145 "else " \
146 /* 256MiB(+256MiB) SF */ \
147 "setenv ubisfcs 0 ; " \
148 "setenv ubimtd rootfs ; " \
149 "setenv ubimtdnr 6 ; " \
150 "setenv mtdparts mtdparts=${mtdparts_0} ; " \
151 "setenv mtdids nor0=ff705000.spi.0 ; " \
152 "setenv ubipart ubi0:vining-fpga-rootfs ; " \
153 "fi ; " \
Marek Vasut569a1912015-12-01 18:09:52 +0100154 "fi ; " \
155 "sf probe 0:${ubisfcs}\0" \
Marek Vasut11086192019-06-27 00:19:34 +0200156 "boot_kernel=" \
157 "if test -z \"${sf_size_1}\" ; then " /* 1x256MiB SF */ \
158 "imxtract ${kernel_addr_r} fdt@1 ${fdt_addr_r} && " \
159 "fdt addr ${fdt_addr_r} && " \
160 "fdt resize && " \
161 "fdt set /soc/spi@ff705000/n25q00@1 status disabled && " \
162 "bootm ${kernel_addr_r}:kernel@1 - ${fdt_addr_r} ; " \
163 "else " \
164 "bootm ${kernel_addr_r} ; " \
165 "fi\0" \
Marek Vasut569a1912015-12-01 18:09:52 +0100166 "ubi_ubi=" \
Marek Vasut11086192019-06-27 00:19:34 +0200167 "run ubi_sfsel ubiload ubiargs addargs boot_kernel\0" \
Marek Vasut569a1912015-12-01 18:09:52 +0100168 "ubi_nfs=" \
Marek Vasut11086192019-06-27 00:19:34 +0200169 "run ubiload nfsargs addip addargs boot_kernel\0" \
Marek Vasut569a1912015-12-01 18:09:52 +0100170 "net_ubi=" \
Marek Vasut11086192019-06-27 00:19:34 +0200171 "run netload ubiargs addargs boot_kernel\0" \
Marek Vasut569a1912015-12-01 18:09:52 +0100172 "net_nfs=" \
Marek Vasut11086192019-06-27 00:19:34 +0200173 "run netload nfsargs addip addargs boot_kernel\0" \
Marek Vasut569a1912015-12-01 18:09:52 +0100174 "selboot=" /* Select from where to boot. */ \
Marek Vasut11086192019-06-27 00:19:34 +0200175 "run sf_identify ; " \
Marek Vasut569a1912015-12-01 18:09:52 +0100176 "if test \"${bootmode}\" = \"qspi\" ; then " \
177 "led all off ; " \
178 "if test \"${boottype}\" = \"rcvr\" ; then " \
179 "echo \"Booting recovery system\" ; " \
180 "led 3 on ; " /* Bottom RED */ \
181 "fi ; " \
182 "led 1 on ; " /* Top RED */ \
183 "run ubi_ubi ; " \
184 "else echo \"Unsupported boot mode: \"${bootmode} ; " \
185 "fi\0" \
Simon Goldschmidtb94655a2019-07-10 22:09:14 +0200186 "socfpga_legacy_reset_compat=1\0"
Marek Vasut569a1912015-12-01 18:09:52 +0100187
Marek Vasut569a1912015-12-01 18:09:52 +0100188/* The rest of the configuration is shared */
189#include <configs/socfpga_common.h>
190
Marek Vasut94a16b82019-06-27 00:19:31 +0200191#endif /* __CONFIG_SOFTING_VINING_FPGA_H__ */