Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 2 | /* |
| 3 | * Boot related environment variable definitions on TI boards. |
| 4 | * |
| 5 | * (C) Copyright 2017 Linaro Ltd. |
| 6 | * Sam Protsenko <semen.protsenko@linaro.org> |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #ifndef __TI_BOOT_H |
| 10 | #define __TI_BOOT_H |
| 11 | |
| 12 | #ifndef CONSOLEDEV |
| 13 | #define CONSOLEDEV "ttyO2" |
| 14 | #endif |
| 15 | |
| 16 | #ifndef PARTS_DEFAULT |
Sam Protsenko | 9351605 | 2018-04-19 23:57:30 +0300 | [diff] [blame] | 17 | /* Define the default GPT table for eMMC */ |
| 18 | #define PARTS_DEFAULT \ |
| 19 | /* Linux partitions */ \ |
| 20 | "uuid_disk=${uuid_gpt_disk};" \ |
| 21 | "name=bootloader,start=384K,size=1792K,uuid=${uuid_gpt_bootloader};" \ |
| 22 | "name=rootfs,start=2688K,size=-,uuid=${uuid_gpt_rootfs}\0" \ |
| 23 | /* Android partitions */ \ |
| 24 | "partitions_android=" \ |
| 25 | "uuid_disk=${uuid_gpt_disk};" \ |
| 26 | "name=xloader,start=128K,size=256K,uuid=${uuid_gpt_xloader};" \ |
| 27 | "name=bootloader,size=1792K,uuid=${uuid_gpt_bootloader};" \ |
| 28 | "name=environment,size=128K,uuid=${uuid_gpt_environment};" \ |
| 29 | "name=misc,size=128K,uuid=${uuid_gpt_misc};" \ |
| 30 | "name=reserved,size=256K,uuid=${uuid_gpt_reserved};" \ |
| 31 | "name=efs,size=16M,uuid=${uuid_gpt_efs};" \ |
| 32 | "name=crypto,size=16K,uuid=${uuid_gpt_crypto};" \ |
| 33 | "name=recovery,size=40M,uuid=${uuid_gpt_recovery};" \ |
| 34 | "name=boot,size=10M,uuid=${uuid_gpt_boot};" \ |
| 35 | "name=system,size=768M,uuid=${uuid_gpt_system};" \ |
| 36 | "name=vendor,size=256M,uuid=${uuid_gpt_vendor};" \ |
| 37 | "name=cache,size=256M,uuid=${uuid_gpt_cache};" \ |
| 38 | "name=ipu1,size=1M,uuid=${uuid_gpt_ipu1};" \ |
| 39 | "name=ipu2,size=1M,uuid=${uuid_gpt_ipu2};" \ |
| 40 | "name=userdata,size=-,uuid=${uuid_gpt_userdata}" |
| 41 | #endif /* PARTS_DEFAULT */ |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 42 | |
| 43 | #define DEFAULT_COMMON_BOOT_TI_ARGS \ |
| 44 | "console=" CONSOLEDEV ",115200n8\0" \ |
| 45 | "fdtfile=undefined\0" \ |
| 46 | "bootpart=0:2\0" \ |
| 47 | "bootdir=/boot\0" \ |
| 48 | "bootfile=zImage\0" \ |
| 49 | "usbtty=cdc_acm\0" \ |
| 50 | "vram=16M\0" \ |
| 51 | "partitions=" PARTS_DEFAULT "\0" \ |
| 52 | "optargs=\0" \ |
Semen Protsenko | 9300317 | 2017-08-16 15:55:48 +0300 | [diff] [blame] | 53 | "dofastboot=0\0" \ |
Sam Protsenko | 7e43edc | 2017-09-21 22:37:58 +0300 | [diff] [blame] | 54 | "emmc_linux_boot=" \ |
Sam Protsenko | bfd9f7c | 2017-09-21 22:37:59 +0300 | [diff] [blame] | 55 | "echo Trying to boot Linux from eMMC ...; " \ |
Sam Protsenko | 7e43edc | 2017-09-21 22:37:58 +0300 | [diff] [blame] | 56 | "setenv mmcdev 1; " \ |
| 57 | "setenv bootpart 1:2; " \ |
| 58 | "setenv mmcroot /dev/mmcblk0p2 rw; " \ |
| 59 | "run mmcboot;\0" \ |
Semen Protsenko | 9300317 | 2017-08-16 15:55:48 +0300 | [diff] [blame] | 60 | "emmc_android_boot=" \ |
Sam Protsenko | bfd9f7c | 2017-09-21 22:37:59 +0300 | [diff] [blame] | 61 | "echo Trying to boot Android from eMMC ...; " \ |
Praneeth Bajjuri | d89516b | 2018-04-25 16:03:24 -0500 | [diff] [blame] | 62 | "run update_to_fit; " \ |
Semen Protsenko | 9300317 | 2017-08-16 15:55:48 +0300 | [diff] [blame] | 63 | "setenv eval_bootargs setenv bootargs $bootargs; " \ |
| 64 | "run eval_bootargs; " \ |
| 65 | "setenv mmcdev 1; " \ |
Semen Protsenko | 9300317 | 2017-08-16 15:55:48 +0300 | [diff] [blame] | 66 | "setenv machid fe6; " \ |
| 67 | "mmc dev $mmcdev; " \ |
| 68 | "mmc rescan; " \ |
Sam Protsenko | 8883265 | 2018-02-26 23:18:01 +0200 | [diff] [blame] | 69 | "part start mmc ${mmcdev} environment fdt_start; " \ |
| 70 | "part size mmc ${mmcdev} environment fdt_size; " \ |
| 71 | "part start mmc ${mmcdev} boot boot_start; " \ |
| 72 | "part size mmc ${mmcdev} boot boot_size; " \ |
Semen Protsenko | 9300317 | 2017-08-16 15:55:48 +0300 | [diff] [blame] | 73 | "mmc read ${fdtaddr} ${fdt_start} ${fdt_size}; " \ |
| 74 | "mmc read ${loadaddr} ${boot_start} ${boot_size}; " \ |
Praneeth Bajjuri | d89516b | 2018-04-25 16:03:24 -0500 | [diff] [blame] | 75 | "bootm ${loadaddr}#${fdtfile};\0 " |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 76 | |
| 77 | #ifdef CONFIG_OMAP54XX |
| 78 | |
| 79 | #define DEFAULT_FDT_TI_ARGS \ |
| 80 | "findfdt="\ |
| 81 | "if test $board_name = omap5_uevm; then " \ |
| 82 | "setenv fdtfile omap5-uevm.dtb; fi; " \ |
| 83 | "if test $board_name = dra7xx; then " \ |
| 84 | "setenv fdtfile dra7-evm.dtb; fi;" \ |
| 85 | "if test $board_name = dra72x-revc; then " \ |
| 86 | "setenv fdtfile dra72-evm-revc.dtb; fi;" \ |
| 87 | "if test $board_name = dra72x; then " \ |
| 88 | "setenv fdtfile dra72-evm.dtb; fi;" \ |
| 89 | "if test $board_name = dra71x; then " \ |
| 90 | "setenv fdtfile dra71-evm.dtb; fi;" \ |
Lokesh Vutla | 7b8b6f7 | 2017-12-29 11:47:58 +0530 | [diff] [blame] | 91 | "if test $board_name = dra76x_acd; then " \ |
Lokesh Vutla | 066f578 | 2017-08-21 12:50:58 +0530 | [diff] [blame] | 92 | "setenv fdtfile dra76-evm.dtb; fi;" \ |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 93 | "if test $board_name = beagle_x15; then " \ |
| 94 | "setenv fdtfile am57xx-beagle-x15.dtb; fi;" \ |
| 95 | "if test $board_name = beagle_x15_revb1; then " \ |
| 96 | "setenv fdtfile am57xx-beagle-x15-revb1.dtb; fi;" \ |
Lokesh Vutla | 473d816 | 2017-08-23 11:39:07 +0530 | [diff] [blame] | 97 | "if test $board_name = beagle_x15_revc; then " \ |
| 98 | "setenv fdtfile am57xx-beagle-x15-revc.dtb; fi;" \ |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 99 | "if test $board_name = am572x_idk; then " \ |
| 100 | "setenv fdtfile am572x-idk.dtb; fi;" \ |
Lokesh Vutla | 7b8b6f7 | 2017-12-29 11:47:58 +0530 | [diff] [blame] | 101 | "if test $board_name = am574x_idk; then " \ |
| 102 | "setenv fdtfile am574x-idk.dtb; fi;" \ |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 103 | "if test $board_name = am57xx_evm; then " \ |
| 104 | "setenv fdtfile am57xx-beagle-x15.dtb; fi;" \ |
| 105 | "if test $board_name = am57xx_evm_reva3; then " \ |
| 106 | "setenv fdtfile am57xx-beagle-x15.dtb; fi;" \ |
| 107 | "if test $board_name = am571x_idk; then " \ |
| 108 | "setenv fdtfile am571x-idk.dtb; fi;" \ |
| 109 | "if test $fdtfile = undefined; then " \ |
| 110 | "echo WARNING: Could not determine device tree to use; fi; \0" |
| 111 | |
| 112 | #define CONFIG_BOOTCOMMAND \ |
| 113 | "if test ${dofastboot} -eq 1; then " \ |
| 114 | "echo Boot fastboot requested, resetting dofastboot ...;" \ |
| 115 | "setenv dofastboot 0; saveenv;" \ |
| 116 | "echo Booting into fastboot ...; " \ |
| 117 | "fastboot " __stringify(CONFIG_FASTBOOT_USB_DEV) "; " \ |
| 118 | "fi;" \ |
| 119 | "if test ${boot_fit} -eq 1; then " \ |
| 120 | "run update_to_fit;" \ |
| 121 | "fi;" \ |
| 122 | "run findfdt; " \ |
| 123 | "run envboot; " \ |
| 124 | "run mmcboot;" \ |
Sam Protsenko | 7e43edc | 2017-09-21 22:37:58 +0300 | [diff] [blame] | 125 | "run emmc_linux_boot; " \ |
Semen Protsenko | 9300317 | 2017-08-16 15:55:48 +0300 | [diff] [blame] | 126 | "run emmc_android_boot; " \ |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 127 | "" |
| 128 | |
| 129 | #endif /* CONFIG_OMAP54XX */ |
| 130 | |
| 131 | #endif /* __TI_BOOT_H */ |