Sekhar Nori | 0ea56fe | 2017-04-06 14:52:56 +0530 | [diff] [blame] | 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 | |
Semen Protsenko | 9a5a5b5 | 2017-06-13 18:15:58 +0300 | [diff] [blame] | 9 | #ifndef __TI_MMC_H |
| 10 | #define __TI_MMC_H |
| 11 | |
Sekhar Nori | 0ea56fe | 2017-04-06 14:52:56 +0530 | [diff] [blame] | 12 | #define DEFAULT_MMC_TI_ARGS \ |
| 13 | "mmcdev=0\0" \ |
| 14 | "mmcrootfstype=ext4 rootwait\0" \ |
| 15 | "finduuid=part uuid mmc ${bootpart} uuid\0" \ |
| 16 | "args_mmc=run finduuid;setenv bootargs console=${console} " \ |
| 17 | "${optargs} " \ |
| 18 | "root=PARTUUID=${uuid} rw " \ |
| 19 | "rootfstype=${mmcrootfstype}\0" \ |
| 20 | "loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr\0" \ |
| 21 | "bootscript=echo Running bootscript from mmc${mmcdev} ...; " \ |
| 22 | "source ${loadaddr}\0" \ |
| 23 | "bootenvfile=uEnv.txt\0" \ |
| 24 | "importbootenv=echo Importing environment from mmc${mmcdev} ...; " \ |
| 25 | "env import -t ${loadaddr} ${filesize}\0" \ |
| 26 | "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}\0" \ |
| 27 | "loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \ |
| 28 | "loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \ |
| 29 | "envboot=mmc dev ${mmcdev}; " \ |
| 30 | "if mmc rescan; then " \ |
| 31 | "echo SD/MMC found on device ${mmcdev};" \ |
| 32 | "if run loadbootscript; then " \ |
| 33 | "run bootscript;" \ |
| 34 | "else " \ |
| 35 | "if run loadbootenv; then " \ |
| 36 | "echo Loaded env from ${bootenvfile};" \ |
| 37 | "run importbootenv;" \ |
| 38 | "fi;" \ |
| 39 | "if test -n $uenvcmd; then " \ |
| 40 | "echo Running uenvcmd ...;" \ |
| 41 | "run uenvcmd;" \ |
| 42 | "fi;" \ |
| 43 | "fi;" \ |
| 44 | "fi;\0" \ |
| 45 | "mmcloados=run args_mmc; " \ |
| 46 | "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ |
| 47 | "if run loadfdt; then " \ |
| 48 | "bootz ${loadaddr} - ${fdtaddr}; " \ |
| 49 | "else " \ |
| 50 | "if test ${boot_fdt} = try; then " \ |
| 51 | "bootz; " \ |
| 52 | "else " \ |
| 53 | "echo WARN: Cannot load the DT; " \ |
| 54 | "fi; " \ |
| 55 | "fi; " \ |
| 56 | "else " \ |
| 57 | "bootz; " \ |
| 58 | "fi;\0" \ |
| 59 | "mmcboot=mmc dev ${mmcdev}; " \ |
| 60 | "setenv devnum ${mmcdev}; " \ |
| 61 | "setenv devtype mmc; " \ |
| 62 | "if mmc rescan; then " \ |
| 63 | "echo SD/MMC found on device ${mmcdev};" \ |
| 64 | "if run loadimage; then " \ |
| 65 | "if test ${boot_fit} -eq 1; then " \ |
| 66 | "run loadfit; " \ |
| 67 | "else " \ |
| 68 | "run mmcloados;" \ |
| 69 | "fi;" \ |
| 70 | "fi;" \ |
| 71 | "fi;\0" |
Semen Protsenko | 9a5a5b5 | 2017-06-13 18:15:58 +0300 | [diff] [blame] | 72 | |
| 73 | #endif /* __TI_MMC_H */ |