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