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 /* Booting Linux */
14 #define CONFIG_BOOTFILE		"fitImage"
15 #define CONFIG_BOOTCOMMAND	"run mmc_mmc"
16 #define CONFIG_LOADADDR		0x01000000
17 #define CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
18 
19 /* Environment is in MMC */
20 
21 /* Extra Environment */
22 #define CONFIG_EXTRA_ENV_SETTINGS					\
23 	"consdev=ttyS0\0"						\
24 	"baudrate=115200\0"						\
25 	"bootscript=boot.scr\0"						\
26 	"bootdev=/dev/mmcblk0p2\0"					\
27 	"rootdev=/dev/mmcblk0p3\0"					\
28 	"netdev=eth0\0"							\
29 	"hostname=dbm_soc1\0"						\
30 	"kernel_addr_r=0x10000000\0"					\
31 	"dfu_alt_info=mmc raw 0 3867148288\0"				\
32 	"update_filename=u-boot-with-spl.sfp\0"				\
33 	"update_sd_offset=0x800\0"					\
34 	"update_sd="		/* Update the SD firmware partition */	\
35 		"if mmc rescan ; then "					\
36 		"if tftp ${update_filename} ; then "			\
37 		"setexpr fw_sz ${filesize} / 0x200 ; "	/* SD block size */ \
38 		"setexpr fw_sz ${fw_sz} + 1 ; "				\
39 		"mmc write ${loadaddr} ${update_sd_offset} ${fw_sz} ; "	\
40 		"fi ; "							\
41 		"fi\0"							\
42 	"fpga_filename=output_file.rbf\0"				\
43 	"load_fpga="		/* Load FPGA bitstream */		\
44 		"if tftp ${fpga_filename} ; then "			\
45 		"fpga load 0 $loadaddr $filesize ; "			\
46 		"bridge enable ; "					\
47 		"fi\0"							\
48 	"addcons="							\
49 		"setenv bootargs ${bootargs} "				\
50 		"console=${consdev},${baudrate}\0"			\
51 	"addip="							\
52 		"setenv bootargs ${bootargs} "				\
53 		"ip=${ipaddr}:${serverip}:${gatewayip}:"		\
54 			"${netmask}:${hostname}:${netdev}:off\0"	\
55 	"addmisc="							\
56 		"setenv bootargs ${bootargs} ${miscargs}\0"		\
57 	"addargs=run addcons addmisc\0"					\
58 	"mmcload="							\
59 		"mmc rescan ; "						\
60 		"load mmc 0:2 ${kernel_addr_r} ${bootfile}\0"		\
61 	"netload="							\
62 		"tftp ${kernel_addr_r} ${hostname}/${bootfile}\0"	\
63 	"miscargs=nohlt panic=1\0"					\
64 	"mmcargs=setenv bootargs root=${rootdev} rw rootwait\0"		\
65 	"nfsargs="							\
66 		"setenv bootargs root=/dev/nfs rw "			\
67 			"nfsroot=${serverip}:${rootpath},v3,tcp\0"	\
68 	"mmc_mmc="							\
69 		"run mmcload mmcargs addargs ; "			\
70 		"bootm ${kernel_addr_r}\0"				\
71 	"mmc_nfs="							\
72 		"run mmcload nfsargs addip addargs ; "			\
73 		"bootm ${kernel_addr_r}\0"				\
74 	"net_mmc="							\
75 		"run netload mmcargs addargs ; "			\
76 		"bootm ${kernel_addr_r}\0"				\
77 	"net_nfs="							\
78 		"run netload nfsargs addip addargs ; "			\
79 		"bootm ${kernel_addr_r}\0"				\
80 	"try_bootscript="						\
81 		"mmc rescan;"						\
82 		"if test -e mmc 0:2 ${bootscript} ; then "		\
83 		"if load mmc 0:2 ${kernel_addr_r} ${bootscript};"	\
84 		"then ; "						\
85 			"echo Running bootscript... ; "			\
86 			"source ${kernel_addr_r} ; "			\
87 		"fi ; "							\
88 		"fi\0"							\
89 	"socfpga_legacy_reset_compat=1\0"
90 
91 /* The rest of the configuration is shared */
92 #include <configs/socfpga_common.h>
93 
94 #endif	/* __CONFIG_DEVBOARDS_DBM_SOC1_H__ */
95