xref: /openbmc/u-boot/include/environment/ti/mmc.h (revision 0645c23a)
1 /*
2  * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com
3  *
4  * Environment variable definitions for MMC/SD on TI boards.
5  *
6  * SPDX-License-Identifier:	GPL-2.0+
7  */
8 
9 #define DEFAULT_MMC_TI_ARGS \
10 	"mmcdev=0\0" \
11 	"mmcrootfstype=ext4 rootwait\0" \
12 	"finduuid=part uuid mmc ${bootpart} uuid\0" \
13 	"args_mmc=run finduuid;setenv bootargs console=${console} " \
14 		"${optargs} " \
15 		"root=PARTUUID=${uuid} rw " \
16 		"rootfstype=${mmcrootfstype}\0" \
17 	"loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr\0" \
18 	"bootscript=echo Running bootscript from mmc${mmcdev} ...; " \
19 		"source ${loadaddr}\0" \
20 	"bootenvfile=uEnv.txt\0" \
21 	"importbootenv=echo Importing environment from mmc${mmcdev} ...; " \
22 		"env import -t ${loadaddr} ${filesize}\0" \
23 	"loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}\0" \
24 	"loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
25 	"loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
26 	"envboot=mmc dev ${mmcdev}; " \
27 		"if mmc rescan; then " \
28 			"echo SD/MMC found on device ${mmcdev};" \
29 			"if run loadbootscript; then " \
30 				"run bootscript;" \
31 			"else " \
32 				"if run loadbootenv; then " \
33 					"echo Loaded env from ${bootenvfile};" \
34 					"run importbootenv;" \
35 				"fi;" \
36 				"if test -n $uenvcmd; then " \
37 					"echo Running uenvcmd ...;" \
38 					"run uenvcmd;" \
39 				"fi;" \
40 			"fi;" \
41 		"fi;\0" \
42 	"mmcloados=run args_mmc; " \
43 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
44 			"if run loadfdt; then " \
45 				"bootz ${loadaddr} - ${fdtaddr}; " \
46 			"else " \
47 				"if test ${boot_fdt} = try; then " \
48 					"bootz; " \
49 				"else " \
50 					"echo WARN: Cannot load the DT; " \
51 				"fi; " \
52 			"fi; " \
53 		"else " \
54 			"bootz; " \
55 		"fi;\0" \
56 	"mmcboot=mmc dev ${mmcdev}; " \
57 		"setenv devnum ${mmcdev}; " \
58 		"setenv devtype mmc; " \
59 		"if mmc rescan; then " \
60 			"echo SD/MMC found on device ${mmcdev};" \
61 			"if run loadimage; then " \
62 				"if test ${boot_fit} -eq 1; then " \
63 					"run loadfit; " \
64 				"else " \
65 					"run mmcloados;" \
66 				"fi;" \
67 			"fi;" \
68 		"fi;\0"
69