1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2020 Compass Electronics Group, LLC
4  */
5 
6 #ifndef __BEACON_RZG2M_H
7 #define __BEACON_RZG2M_H
8 
9 #include "rcar-gen3-common.h"
10 
11 /* Ethernet RAVB */
12 #define CONFIG_BITBANGMII_MULTI
13 
14 #undef CONFIG_EXTRA_ENV_SETTINGS
15 
16 #define CONFIG_EXTRA_ENV_SETTINGS		\
17 	"usb_pgood_delay=2000\0"	\
18 	"script=boot.scr\0" \
19 	"image=Image\0" \
20 	"console=ttySC0,115200\0" \
21 	"fdt_addr=0x48000000\0" \
22 	"loadaddr=0x48080000\0" \
23 	"boot_fdt=try\0" \
24 	"fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
25 	"initrd_addr=0x43800000\0"		\
26 	"mmcdev=0\0" \
27 	"mmcpart=1\0" \
28 	"mmcrootpart=2\0" \
29 	"finduuid=part uuid mmc ${mmcdev}:${mmcrootpart} uuid\0" \
30 	"mmcautodetect=yes\0" \
31 	"mmcargs=setenv bootargs console=${console} " \
32 	" root=PARTUUID=${uuid} rootwait rw ${optargs}\0" \
33 	"loadbootscript=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
34 	"bootscript=echo Running bootscript from mmc ...; " \
35 		"source\0" \
36 	"loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
37 	"loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
38 	"mmcboot=echo Booting from mmc ...; " \
39 		"run finduuid; run mmcargs; " \
40 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
41 			"if run loadfdt; then " \
42 				"booti ${loadaddr} - ${fdt_addr}; " \
43 			"else " \
44 				"echo WARN: Cannot load the DT; " \
45 			"fi; " \
46 		"else " \
47 			"echo wait for boot; " \
48 		"fi;\0" \
49 	"netargs=setenv bootargs ${jh_clk} console=${console} " \
50 		"root=/dev/nfs " \
51 		"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
52 	"netboot=echo Booting from net ...; " \
53 		"run netargs;  " \
54 		"if test ${ip_dyn} = yes; then " \
55 			"setenv get_cmd dhcp; " \
56 		"else " \
57 			"setenv get_cmd tftp; " \
58 		"fi; " \
59 		"${get_cmd} ${loadaddr} ${image}; " \
60 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
61 			"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
62 				"booti ${loadaddr} - ${fdt_addr}; " \
63 			"else " \
64 				"echo WARN: Cannot load the DT; " \
65 			"fi; " \
66 		"else " \
67 			"booti; " \
68 		"fi;\0"
69 
70 #undef CONFIG_BOOTCOMMAND
71 
72 #define CONFIG_BOOTCOMMAND \
73 	"mmc dev ${mmcdev}; if mmc rescan; then " \
74 	   "if run loadbootscript; then " \
75 		   "run bootscript; " \
76 	   "else " \
77 		   "if run loadimage; then " \
78 			   "run mmcboot; " \
79 		   "else run netboot; " \
80 		   "fi; " \
81 	   "fi; " \
82 	"else booti ${loadaddr} - ${fdt_addr}; fi"
83 
84 #endif /* __BEACON_RZG2M_H */
85