xref: /openbmc/u-boot/include/environment/ti/boot.h (revision ae485b54)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Boot related environment variable definitions on TI boards.
4  *
5  * (C) Copyright 2017 Linaro Ltd.
6  * Sam Protsenko <semen.protsenko@linaro.org>
7  */
8 
9 #ifndef __TI_BOOT_H
10 #define __TI_BOOT_H
11 
12 #ifndef CONSOLEDEV
13 #define CONSOLEDEV "ttyO2"
14 #endif
15 
16 #define VBMETA_PART_SIZE		(64 * 1024)
17 
18 #if defined(CONFIG_LIBAVB)
19 #define VBMETA_PART \
20 	"name=vbmeta,size=" __stringify(VBMETA_PART_SIZE) \
21 	",uuid=${uuid_gpt_vbmeta};"
22 #else
23 #define VBMETA_PART			""
24 #endif
25 
26 #ifndef PARTS_DEFAULT
27 /* Define the default GPT table for eMMC */
28 #define PARTS_DEFAULT \
29 	/* Linux partitions */ \
30 	"uuid_disk=${uuid_gpt_disk};" \
31 	"name=bootloader,start=384K,size=1792K,uuid=${uuid_gpt_bootloader};" \
32 	"name=rootfs,start=2688K,size=-,uuid=${uuid_gpt_rootfs}\0" \
33 	/* Android partitions */ \
34 	"partitions_android=" \
35 	"uuid_disk=${uuid_gpt_disk};" \
36 	"name=xloader,start=128K,size=256K,uuid=${uuid_gpt_xloader};" \
37 	"name=bootloader,size=1792K,uuid=${uuid_gpt_bootloader};" \
38 	"name=environment,size=128K,uuid=${uuid_gpt_environment};" \
39 	"name=misc,size=128K,uuid=${uuid_gpt_misc};" \
40 	"name=reserved,size=256K,uuid=${uuid_gpt_reserved};" \
41 	"name=efs,size=16M,uuid=${uuid_gpt_efs};" \
42 	"name=crypto,size=16K,uuid=${uuid_gpt_crypto};" \
43 	"name=recovery,size=40M,uuid=${uuid_gpt_recovery};" \
44 	"name=boot,size=10M,uuid=${uuid_gpt_boot};" \
45 	"name=system,size=768M,uuid=${uuid_gpt_system};" \
46 	"name=vendor,size=256M,uuid=${uuid_gpt_vendor};" \
47 	"name=cache,size=256M,uuid=${uuid_gpt_cache};" \
48 	"name=ipu1,size=1M,uuid=${uuid_gpt_ipu1};" \
49 	"name=ipu2,size=1M,uuid=${uuid_gpt_ipu2};" \
50 	VBMETA_PART \
51 	"name=userdata,size=-,uuid=${uuid_gpt_userdata}"
52 #endif /* PARTS_DEFAULT */
53 
54 #if defined(CONFIG_CMD_AVB)
55 #define AVB_VERIFY_CHECK "if run avb_verify; then " \
56 				"echo AVB verification OK.;" \
57 				"set bootargs $bootargs $avb_bootargs;" \
58 			"else " \
59 				"echo AVB verification failed.;" \
60 			"exit; fi;"
61 #define AVB_VERIFY_CMD "avb_verify=avb init 1; avb verify;\0"
62 #else
63 #define AVB_VERIFY_CHECK ""
64 #define AVB_VERIFY_CMD ""
65 #endif
66 
67 #define DEFAULT_COMMON_BOOT_TI_ARGS \
68 	"console=" CONSOLEDEV ",115200n8\0" \
69 	"fdtfile=undefined\0" \
70 	"bootpart=0:2\0" \
71 	"bootdir=/boot\0" \
72 	"bootfile=zImage\0" \
73 	"usbtty=cdc_acm\0" \
74 	"vram=16M\0" \
75 	AVB_VERIFY_CMD \
76 	"partitions=" PARTS_DEFAULT "\0" \
77 	"optargs=\0" \
78 	"dofastboot=0\0" \
79 	"emmc_linux_boot=" \
80 		"echo Trying to boot Linux from eMMC ...; " \
81 		"setenv mmcdev 1; " \
82 		"setenv bootpart 1:2; " \
83 		"setenv mmcroot /dev/mmcblk0p2 rw; " \
84 		"run mmcboot;\0" \
85 	"emmc_android_boot=" \
86 		"echo Trying to boot Android from eMMC ...; " \
87 		"run update_to_fit; " \
88 		"setenv eval_bootargs setenv bootargs $bootargs; " \
89 		"run eval_bootargs; " \
90 		"setenv mmcdev 1; " \
91 		"setenv machid fe6; " \
92 		"mmc dev $mmcdev; " \
93 		"mmc rescan; " \
94 		AVB_VERIFY_CHECK \
95 		"part start mmc ${mmcdev} environment fdt_start; " \
96 		"part size mmc ${mmcdev} environment fdt_size; " \
97 		"part start mmc ${mmcdev} boot boot_start; " \
98 		"part size mmc ${mmcdev} boot boot_size; " \
99 		"mmc read ${fdtaddr} ${fdt_start} ${fdt_size}; " \
100 		"mmc read ${loadaddr} ${boot_start} ${boot_size}; " \
101 		"bootm ${loadaddr}#${fdtfile};\0 "
102 
103 #ifdef CONFIG_OMAP54XX
104 
105 #define DEFAULT_FDT_TI_ARGS \
106 	"findfdt="\
107 		"if test $board_name = omap5_uevm; then " \
108 			"setenv fdtfile omap5-uevm.dtb; fi; " \
109 		"if test $board_name = dra7xx; then " \
110 			"setenv fdtfile dra7-evm.dtb; fi;" \
111 		"if test $board_name = dra72x-revc; then " \
112 			"setenv fdtfile dra72-evm-revc.dtb; fi;" \
113 		"if test $board_name = dra72x; then " \
114 			"setenv fdtfile dra72-evm.dtb; fi;" \
115 		"if test $board_name = dra71x; then " \
116 			"setenv fdtfile dra71-evm.dtb; fi;" \
117 		"if test $board_name = dra76x_acd; then " \
118 			"setenv fdtfile dra76-evm.dtb; fi;" \
119 		"if test $board_name = beagle_x15; then " \
120 			"setenv fdtfile am57xx-beagle-x15.dtb; fi;" \
121 		"if test $board_name = beagle_x15_revb1; then " \
122 			"setenv fdtfile am57xx-beagle-x15-revb1.dtb; fi;" \
123 		"if test $board_name = beagle_x15_revc; then " \
124 			"setenv fdtfile am57xx-beagle-x15-revc.dtb; fi;" \
125 		"if test $board_name = am572x_idk; then " \
126 			"setenv fdtfile am572x-idk.dtb; fi;" \
127 		"if test $board_name = am574x_idk; then " \
128 			"setenv fdtfile am574x-idk.dtb; fi;" \
129 		"if test $board_name = am57xx_evm; then " \
130 			"setenv fdtfile am57xx-beagle-x15.dtb; fi;" \
131 		"if test $board_name = am57xx_evm_reva3; then " \
132 			"setenv fdtfile am57xx-beagle-x15.dtb; fi;" \
133 		"if test $board_name = am571x_idk; then " \
134 			"setenv fdtfile am571x-idk.dtb; fi;" \
135 		"if test $fdtfile = undefined; then " \
136 			"echo WARNING: Could not determine device tree to use; fi; \0"
137 
138 #define CONFIG_BOOTCOMMAND \
139 	"if test ${dofastboot} -eq 1; then " \
140 		"echo Boot fastboot requested, resetting dofastboot ...;" \
141 		"setenv dofastboot 0; saveenv;" \
142 		"echo Booting into fastboot ...; " \
143 		"fastboot " __stringify(CONFIG_FASTBOOT_USB_DEV) "; " \
144 	"fi;" \
145 	"if test ${boot_fit} -eq 1; then "	\
146 		"run update_to_fit;"	\
147 	"fi;"	\
148 	"run findfdt; " \
149 	"run envboot; " \
150 	"run mmcboot;" \
151 	"run emmc_linux_boot; " \
152 	"run emmc_android_boot; " \
153 	""
154 
155 #endif /* CONFIG_OMAP54XX */
156 
157 #endif /* __TI_BOOT_H */
158