1/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Copyright (C) 2018 Marek Vasut <marex@denx.de>
4 */
5#ifndef __CONFIG_DEVBOARDS_DBM_SOC1_H__
6#define __CONFIG_DEVBOARDS_DBM_SOC1_H__
7
8#include <asm/arch/base_addr_ac5.h>
9
10/* Memory configurations */
11#define PHYS_SDRAM_1_SIZE		0x40000000	/* 1GiB */
12
13/* Environment is in MMC */
14
15/* Extra Environment */
16#define CFG_EXTRA_ENV_SETTINGS					\
17	"consdev=ttyS0\0"						\
18	"baudrate=115200\0"						\
19	"bootscript=boot.scr\0"						\
20	"bootdev=/dev/mmcblk0p2\0"					\
21	"rootdev=/dev/mmcblk0p3\0"					\
22	"netdev=eth0\0"							\
23	"hostname=dbm_soc1\0"						\
24	"kernel_addr_r=0x10000000\0"					\
25	"dfu_alt_info=mmc raw 0 3867148288\0"				\
26	"update_filename=u-boot-with-spl.sfp\0"				\
27	"update_sd_offset=0x800\0"					\
28	"update_sd="		/* Update the SD firmware partition */	\
29		"if mmc rescan ; then "					\
30		"if tftp ${update_filename} ; then "			\
31		"setexpr fw_sz ${filesize} / 0x200 ; "	/* SD block size */ \
32		"setexpr fw_sz ${fw_sz} + 1 ; "				\
33		"mmc write ${loadaddr} ${update_sd_offset} ${fw_sz} ; "	\
34		"fi ; "							\
35		"fi\0"							\
36	"fpga_filename=output_file.rbf\0"				\
37	"load_fpga="		/* Load FPGA bitstream */		\
38		"if tftp ${fpga_filename} ; then "			\
39		"fpga load 0 $loadaddr $filesize ; "			\
40		"bridge enable ; "					\
41		"fi\0"							\
42	"addcons="							\
43		"setenv bootargs ${bootargs} "				\
44		"console=${consdev},${baudrate}\0"			\
45	"addip="							\
46		"setenv bootargs ${bootargs} "				\
47		"ip=${ipaddr}:${serverip}:${gatewayip}:"		\
48			"${netmask}:${hostname}:${netdev}:off\0"	\
49	"addmisc="							\
50		"setenv bootargs ${bootargs} ${miscargs}\0"		\
51	"addargs=run addcons addmisc\0"					\
52	"mmcload="							\
53		"mmc rescan ; "						\
54		"load mmc 0:2 ${kernel_addr_r} ${bootfile}\0"		\
55	"netload="							\
56		"tftp ${kernel_addr_r} ${hostname}/${bootfile}\0"	\
57	"miscargs=nohlt panic=1\0"					\
58	"mmcargs=setenv bootargs root=${rootdev} rw rootwait\0"		\
59	"nfsargs="							\
60		"setenv bootargs root=/dev/nfs rw "			\
61			"nfsroot=${serverip}:${rootpath},v3,tcp\0"	\
62	"mmc_mmc="							\
63		"run mmcload mmcargs addargs ; "			\
64		"bootm ${kernel_addr_r}\0"				\
65	"mmc_nfs="							\
66		"run mmcload nfsargs addip addargs ; "			\
67		"bootm ${kernel_addr_r}\0"				\
68	"net_mmc="							\
69		"run netload mmcargs addargs ; "			\
70		"bootm ${kernel_addr_r}\0"				\
71	"net_nfs="							\
72		"run netload nfsargs addip addargs ; "			\
73		"bootm ${kernel_addr_r}\0"				\
74	"try_bootscript="						\
75		"mmc rescan;"						\
76		"if test -e mmc 0:2 ${bootscript} ; then "		\
77		"if load mmc 0:2 ${kernel_addr_r} ${bootscript};"	\
78		"then ; "						\
79			"echo Running bootscript... ; "			\
80			"source ${kernel_addr_r} ; "			\
81		"fi ; "							\
82		"fi\0"							\
83	"socfpga_legacy_reset_compat=1\0"
84
85/* The rest of the configuration is shared */
86#include <configs/socfpga_common.h>
87
88#endif	/* __CONFIG_DEVBOARDS_DBM_SOC1_H__ */
89