Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Lokesh Vutla | 3e716e2 | 2013-02-17 23:34:35 +0000 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2013 |
| 4 | * Texas Instruments Incorporated. |
| 5 | * Sricharan R <r.sricharan@ti.com> |
| 6 | * |
| 7 | * Derived from OMAP4 done by: |
| 8 | * Aneesh V <aneesh@ti.com> |
| 9 | * |
| 10 | * TI OMAP5 AND DRA7XX common configuration settings |
| 11 | * |
Tom Rini | b3277f5 | 2013-08-09 11:22:18 -0400 | [diff] [blame] | 12 | * For more details, please see the technical documents listed at |
| 13 | * http://www.ti.com/product/omap5432 |
Lokesh Vutla | 3e716e2 | 2013-02-17 23:34:35 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
Enric Balletbò i Serra | 2785bb7 | 2013-12-06 21:30:19 +0100 | [diff] [blame] | 16 | #ifndef __CONFIG_TI_OMAP5_COMMON_H |
| 17 | #define __CONFIG_TI_OMAP5_COMMON_H |
Lokesh Vutla | 3e716e2 | 2013-02-17 23:34:35 +0000 | [diff] [blame] | 18 | |
Tom Rini | b3277f5 | 2013-08-09 11:22:18 -0400 | [diff] [blame] | 19 | /* Use General purpose timer 1 */ |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 20 | #define CFG_SYS_TIMERBASE GPT2_BASE |
Lokesh Vutla | 3e716e2 | 2013-02-17 23:34:35 +0000 | [diff] [blame] | 21 | |
Tom Rini | 8decd96 | 2021-07-01 09:26:11 -0400 | [diff] [blame] | 22 | #include <linux/stringify.h> |
| 23 | |
Tom Rini | b3277f5 | 2013-08-09 11:22:18 -0400 | [diff] [blame] | 24 | #include <asm/arch/cpu.h> |
| 25 | #include <asm/arch/omap.h> |
| 26 | |
Nishanth Menon | ad63dd7 | 2015-07-22 18:05:41 -0500 | [diff] [blame] | 27 | #include <configs/ti_armv7_omap.h> |
Lokesh Vutla | 3e716e2 | 2013-02-17 23:34:35 +0000 | [diff] [blame] | 28 | |
| 29 | /* |
Tom Rini | b3277f5 | 2013-08-09 11:22:18 -0400 | [diff] [blame] | 30 | * Hardware drivers |
Lokesh Vutla | 3e716e2 | 2013-02-17 23:34:35 +0000 | [diff] [blame] | 31 | */ |
Tom Rini | df6a215 | 2022-11-16 13:10:28 -0500 | [diff] [blame] | 32 | #define CFG_SYS_NS16550_CLK 48000000 |
Lokesh Vutla | 3e716e2 | 2013-02-17 23:34:35 +0000 | [diff] [blame] | 33 | |
Lokesh Vutla | 3e716e2 | 2013-02-17 23:34:35 +0000 | [diff] [blame] | 34 | /* |
| 35 | * Environment setup |
| 36 | */ |
Tom Rini | 546c6c1 | 2013-04-05 06:21:45 +0000 | [diff] [blame] | 37 | |
Kishon Vijay Abraham I | 2408076 | 2015-02-23 18:40:20 +0530 | [diff] [blame] | 38 | #ifndef DFUARGS |
| 39 | #define DFUARGS |
| 40 | #endif |
| 41 | |
Sekhar Nori | 0ea56fe | 2017-04-06 14:52:56 +0530 | [diff] [blame] | 42 | #include <environment/ti/mmc.h> |
Faiz Abbas | 1c2f44d | 2019-02-27 13:29:38 +0530 | [diff] [blame] | 43 | #include <environment/ti/nand.h> |
Sekhar Nori | 0ea56fe | 2017-04-06 14:52:56 +0530 | [diff] [blame] | 44 | |
Tom Rini | 8decd96 | 2021-07-01 09:26:11 -0400 | [diff] [blame] | 45 | #ifndef CONSOLEDEV |
| 46 | #define CONSOLEDEV "ttyS2" |
| 47 | #endif |
| 48 | |
| 49 | #ifndef PARTS_DEFAULT |
| 50 | /* |
| 51 | * Default GPT tables for eMMC (Linux and Android). Notes: |
| 52 | * 1. Keep partitions aligned to erase group size (512 KiB) when possible |
| 53 | * 2. Keep partitions in sync with DFU_ALT_INFO_EMMC (see dfu.h) |
| 54 | * 3. Keep 'bootloader' partition (U-Boot proper) start address in sync with |
| 55 | * CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR (see common/spl/Kconfig) |
| 56 | */ |
| 57 | #define PARTS_DEFAULT \ |
| 58 | /* Linux partitions */ \ |
| 59 | "uuid_disk=${uuid_gpt_disk};" \ |
| 60 | "name=bootloader,start=384K,size=1792K,uuid=${uuid_gpt_bootloader};" \ |
| 61 | "name=rootfs,start=2688K,size=-,uuid=${uuid_gpt_rootfs}\0" \ |
| 62 | /* Android partitions */ \ |
| 63 | "partitions_android=" \ |
| 64 | "uuid_disk=${uuid_gpt_disk};" \ |
| 65 | "name=xloader,start=128K,size=256K,uuid=${uuid_gpt_xloader};" \ |
| 66 | "name=bootloader,size=2048K,uuid=${uuid_gpt_bootloader};" \ |
| 67 | "name=uboot-env,start=2432K,size=256K,uuid=${uuid_gpt_reserved};" \ |
| 68 | "name=misc,size=128K,uuid=${uuid_gpt_misc};" \ |
| 69 | "name=boot_a,size=20M,uuid=${uuid_gpt_boot_a};" \ |
| 70 | "name=boot_b,size=20M,uuid=${uuid_gpt_boot_b};" \ |
| 71 | "name=dtbo_a,size=8M,uuid=${uuid_gpt_dtbo_a};" \ |
| 72 | "name=dtbo_b,size=8M,uuid=${uuid_gpt_dtbo_b};" \ |
| 73 | "name=vbmeta_a,size=64K,uuid=${uuid_gpt_vbmeta_a};" \ |
| 74 | "name=vbmeta_b,size=64K,uuid=${uuid_gpt_vbmeta_b};" \ |
| 75 | "name=recovery,size=64M,uuid=${uuid_gpt_recovery};" \ |
| 76 | "name=super,size=2560M,uuid=${uuid_gpt_super};" \ |
| 77 | "name=metadata,size=16M,uuid=${uuid_gpt_metadata};" \ |
| 78 | "name=userdata,size=-,uuid=${uuid_gpt_userdata}" |
| 79 | #endif /* PARTS_DEFAULT */ |
| 80 | |
| 81 | #if defined(CONFIG_CMD_AVB) |
| 82 | #define AVB_VERIFY_CHECK "if run avb_verify; then " \ |
| 83 | "echo AVB verification OK.;" \ |
| 84 | "set bootargs $bootargs $avb_bootargs;" \ |
| 85 | "else " \ |
| 86 | "echo AVB verification failed.;" \ |
| 87 | "exit; fi;" |
| 88 | #define AVB_VERIFY_CMD "avb_verify=avb init 1; avb verify $slot_suffix;\0" |
| 89 | #else |
| 90 | #define AVB_VERIFY_CHECK "" |
| 91 | #define AVB_VERIFY_CMD "" |
| 92 | #endif |
| 93 | |
| 94 | #define CONTROL_PARTITION "misc" |
| 95 | |
| 96 | #if defined(CONFIG_CMD_AB_SELECT) |
| 97 | #define AB_SELECT_SLOT \ |
| 98 | "if part number mmc 1 " CONTROL_PARTITION " control_part_number; " \ |
| 99 | "then " \ |
| 100 | "echo " CONTROL_PARTITION \ |
| 101 | " partition number:${control_part_number};" \ |
| 102 | "ab_select slot_name mmc ${mmcdev}:${control_part_number};" \ |
| 103 | "else " \ |
| 104 | "echo " CONTROL_PARTITION " partition not found;" \ |
| 105 | "exit;" \ |
| 106 | "fi;" \ |
| 107 | "setenv slot_suffix _${slot_name};" |
| 108 | #define AB_SELECT_ARGS \ |
| 109 | "setenv bootargs_ab androidboot.slot_suffix=${slot_suffix}; " \ |
| 110 | "echo A/B cmdline addition: ${bootargs_ab};" \ |
| 111 | "setenv bootargs ${bootargs} ${bootargs_ab};" |
| 112 | #else |
| 113 | #define AB_SELECT_SLOT "" |
| 114 | #define AB_SELECT_ARGS "" |
| 115 | #endif |
| 116 | |
| 117 | /* |
| 118 | * Prepares complete device tree blob for current board (for Android boot). |
| 119 | * |
| 120 | * Boot image or recovery image should be loaded into $loadaddr prior to running |
| 121 | * these commands. The logic of these commnads is next: |
| 122 | * |
| 123 | * 1. Read correct DTB for current SoC/board from boot image in $loadaddr |
| 124 | * to $fdtaddr |
| 125 | * 2. Merge all needed DTBO for current board from 'dtbo' partition into read |
| 126 | * DTB |
| 127 | * 3. User should provide $fdtaddr as 3rd argument to 'bootm' |
| 128 | */ |
| 129 | #define PREPARE_FDT \ |
| 130 | "echo Preparing FDT...; " \ |
| 131 | "if test $board_name = am57xx_evm_reva3; then " \ |
| 132 | "echo \" Reading DTBO partition...\"; " \ |
| 133 | "part start mmc ${mmcdev} dtbo${slot_suffix} p_dtbo_start; " \ |
| 134 | "part size mmc ${mmcdev} dtbo${slot_suffix} p_dtbo_size; " \ |
| 135 | "mmc read ${dtboaddr} ${p_dtbo_start} ${p_dtbo_size}; " \ |
| 136 | "echo \" Reading DTB for AM57x EVM RevA3...\"; " \ |
| 137 | "abootimg get dtb --index=0 dtb_start dtb_size; " \ |
| 138 | "cp.b $dtb_start $fdtaddr $dtb_size; " \ |
| 139 | "fdt addr $fdtaddr 0x80000; " \ |
| 140 | "echo \" Applying DTBOs for AM57x EVM RevA3...\"; " \ |
| 141 | "adtimg addr $dtboaddr; " \ |
| 142 | "adtimg get dt --index=0 dtbo0_addr dtbo0_size; " \ |
| 143 | "fdt apply $dtbo0_addr; " \ |
| 144 | "adtimg get dt --index=1 dtbo1_addr dtbo1_size; " \ |
| 145 | "fdt apply $dtbo1_addr; " \ |
| 146 | "elif test $board_name = beagle_x15_revc; then " \ |
| 147 | "echo \" Reading DTB for Beagle X15 RevC...\"; " \ |
| 148 | "abootimg get dtb --index=0 dtb_start dtb_size; " \ |
| 149 | "cp.b $dtb_start $fdtaddr $dtb_size; " \ |
| 150 | "fdt addr $fdtaddr 0x80000; " \ |
| 151 | "else " \ |
| 152 | "echo Error: Android boot is not supported for $board_name; " \ |
| 153 | "exit; " \ |
| 154 | "fi; " \ |
| 155 | |
Tom Rini | 8decd96 | 2021-07-01 09:26:11 -0400 | [diff] [blame] | 156 | #define DEFAULT_COMMON_BOOT_TI_ARGS \ |
| 157 | "console=" CONSOLEDEV ",115200n8\0" \ |
| 158 | "fdtfile=undefined\0" \ |
Tom Rini | e050457 | 2021-07-01 09:26:12 -0400 | [diff] [blame] | 159 | "finduuid=part uuid mmc 0:2 uuid\0" \ |
Tom Rini | 8decd96 | 2021-07-01 09:26:11 -0400 | [diff] [blame] | 160 | "usbtty=cdc_acm\0" \ |
| 161 | "vram=16M\0" \ |
| 162 | AVB_VERIFY_CMD \ |
| 163 | "partitions=" PARTS_DEFAULT "\0" \ |
| 164 | "optargs=\0" \ |
| 165 | "dofastboot=0\0" \ |
Tom Rini | 8decd96 | 2021-07-01 09:26:11 -0400 | [diff] [blame] | 166 | "emmc_android_boot=" \ |
| 167 | "setenv mmcdev 1; " \ |
| 168 | "mmc dev $mmcdev; " \ |
| 169 | "mmc rescan; " \ |
| 170 | AB_SELECT_SLOT \ |
| 171 | "if bcb load " __stringify(CONFIG_FASTBOOT_FLASH_MMC_DEV) " " \ |
| 172 | CONTROL_PARTITION "; then " \ |
| 173 | "setenv ardaddr -; " \ |
| 174 | "if bcb test command = bootonce-bootloader; then " \ |
| 175 | "echo Android: Bootloader boot...; " \ |
| 176 | "bcb clear command; bcb store; " \ |
Tom Rini | 5ddf172 | 2021-11-10 09:11:40 -0500 | [diff] [blame] | 177 | "fastboot 1; " \ |
Tom Rini | 8decd96 | 2021-07-01 09:26:11 -0400 | [diff] [blame] | 178 | "exit; " \ |
| 179 | "elif bcb test command = boot-recovery; then " \ |
| 180 | "echo Android: Recovery boot...; " \ |
| 181 | "setenv ardaddr $loadaddr;" \ |
| 182 | "setenv apart recovery; " \ |
| 183 | "else " \ |
| 184 | "echo Android: Normal boot...; " \ |
| 185 | "setenv ardaddr $loadaddr; " \ |
| 186 | "setenv apart boot${slot_suffix}; " \ |
| 187 | "fi; " \ |
| 188 | "else " \ |
| 189 | "echo Warning: BCB is corrupted or does not exist; " \ |
| 190 | "echo Android: Normal boot...; " \ |
| 191 | "fi; " \ |
| 192 | "setenv eval_bootargs setenv bootargs $bootargs; " \ |
| 193 | "run eval_bootargs; " \ |
| 194 | "setenv machid fe6; " \ |
| 195 | AVB_VERIFY_CHECK \ |
| 196 | AB_SELECT_ARGS \ |
| 197 | "if part start mmc $mmcdev $apart boot_start; then " \ |
| 198 | "part size mmc $mmcdev $apart boot_size; " \ |
| 199 | "mmc read $loadaddr $boot_start $boot_size; " \ |
| 200 | PREPARE_FDT \ |
| 201 | "bootm $loadaddr $ardaddr $fdtaddr; " \ |
| 202 | "else " \ |
| 203 | "echo $apart partition not found; " \ |
| 204 | "exit; " \ |
| 205 | "fi;\0" |
| 206 | |
| 207 | #define DEFAULT_FDT_TI_ARGS \ |
| 208 | "findfdt="\ |
| 209 | "if test $board_name = omap5_uevm; then " \ |
| 210 | "setenv fdtfile omap5-uevm.dtb; fi; " \ |
| 211 | "if test $board_name = dra7xx; then " \ |
| 212 | "setenv fdtfile dra7-evm.dtb; fi;" \ |
| 213 | "if test $board_name = dra72x-revc; then " \ |
| 214 | "setenv fdtfile dra72-evm-revc.dtb; fi;" \ |
| 215 | "if test $board_name = dra72x; then " \ |
| 216 | "setenv fdtfile dra72-evm.dtb; fi;" \ |
| 217 | "if test $board_name = dra71x; then " \ |
| 218 | "setenv fdtfile dra71-evm.dtb; fi;" \ |
| 219 | "if test $board_name = dra76x_acd; then " \ |
| 220 | "setenv fdtfile dra76-evm.dtb; fi;" \ |
| 221 | "if test $board_name = beagle_x15; then " \ |
| 222 | "setenv fdtfile am57xx-beagle-x15.dtb; fi;" \ |
| 223 | "if test $board_name = beagle_x15_revb1; then " \ |
| 224 | "setenv fdtfile am57xx-beagle-x15-revb1.dtb; fi;" \ |
| 225 | "if test $board_name = beagle_x15_revc; then " \ |
| 226 | "setenv fdtfile am57xx-beagle-x15-revc.dtb; fi;" \ |
| 227 | "if test $board_name = am5729_beagleboneai; then " \ |
| 228 | "setenv fdtfile am5729-beagleboneai.dtb; fi;" \ |
| 229 | "if test $board_name = am572x_idk; then " \ |
| 230 | "setenv fdtfile am572x-idk.dtb; fi;" \ |
| 231 | "if test $board_name = am574x_idk; then " \ |
| 232 | "setenv fdtfile am574x-idk.dtb; fi;" \ |
| 233 | "if test $board_name = am57xx_evm; then " \ |
| 234 | "setenv fdtfile am57xx-beagle-x15.dtb; fi;" \ |
| 235 | "if test $board_name = am57xx_evm_reva3; then " \ |
| 236 | "setenv fdtfile am57xx-beagle-x15.dtb; fi;" \ |
| 237 | "if test $board_name = am571x_idk; then " \ |
| 238 | "setenv fdtfile am571x-idk.dtb; fi;" \ |
| 239 | "if test $fdtfile = undefined; then " \ |
| 240 | "echo WARNING: Could not determine device tree to use; fi; \0" |
| 241 | |
Tom Rini | e050457 | 2021-07-01 09:26:12 -0400 | [diff] [blame] | 242 | #define BOOT_TARGET_DEVICES(func) \ |
| 243 | func(MMC, mmc, 0) \ |
| 244 | func(MMC, mmc, 1) \ |
| 245 | func(PXE, pxe, na) \ |
| 246 | func(DHCP, dhcp, na) |
| 247 | |
| 248 | #include <config_distro_bootcmd.h> |
Tom Rini | 8decd96 | 2021-07-01 09:26:11 -0400 | [diff] [blame] | 249 | |
Tom Rini | c9edebe | 2022-12-04 10:03:50 -0500 | [diff] [blame] | 250 | #define CFG_EXTRA_ENV_SETTINGS \ |
Tom Rini | 96886f2 | 2014-03-28 15:03:29 -0400 | [diff] [blame] | 251 | DEFAULT_LINUX_BOOT_ENV \ |
Lokesh Vutla | b207c47 | 2015-08-28 13:35:07 +0530 | [diff] [blame] | 252 | DEFAULT_MMC_TI_ARGS \ |
Lokesh Vutla | c2913ac | 2016-11-29 11:58:00 +0530 | [diff] [blame] | 253 | DEFAULT_FIT_TI_ARGS \ |
Semen Protsenko | 334f5bb | 2017-06-14 21:34:23 +0300 | [diff] [blame] | 254 | DEFAULT_COMMON_BOOT_TI_ARGS \ |
| 255 | DEFAULT_FDT_TI_ARGS \ |
Kishon Vijay Abraham I | 2408076 | 2015-02-23 18:40:20 +0530 | [diff] [blame] | 256 | DFUARGS \ |
Cooper Jr., Franklin | 07610ab | 2015-04-21 07:51:04 -0500 | [diff] [blame] | 257 | NETARGS \ |
Faiz Abbas | 1c2f44d | 2019-02-27 13:29:38 +0530 | [diff] [blame] | 258 | NANDARGS \ |
Tom Rini | e050457 | 2021-07-01 09:26:12 -0400 | [diff] [blame] | 259 | BOOTENV |
Lokesh Vutla | 3e716e2 | 2013-02-17 23:34:35 +0000 | [diff] [blame] | 260 | |
Tom Rini | 2108960 | 2013-08-20 08:53:52 -0400 | [diff] [blame] | 261 | /* |
| 262 | * SPL related defines. The Public RAM memory map the ROM defines the |
Daniel Allred | 36d0824 | 2016-05-19 19:10:50 -0500 | [diff] [blame] | 263 | * area between 0x40300000 and 0x4031E000 as a download area for OMAP5. |
| 264 | * On DRA7xx/AM57XX the download area is between 0x40300000 and 0x4037E000. |
| 265 | * We set CONFIG_SPL_DISPLAY_PRINT to have omap_rev_string() called and |
Tom Rini | 2108960 | 2013-08-20 08:53:52 -0400 | [diff] [blame] | 266 | * print some information. |
| 267 | */ |
Daniel Allred | 36d0824 | 2016-05-19 19:10:50 -0500 | [diff] [blame] | 268 | #ifdef CONFIG_TI_SECURE_DEVICE |
| 269 | /* |
| 270 | * For memory booting on HS parts, the first 4KB of the internal RAM is |
| 271 | * reserved for secure world use and the flash loader image is |
| 272 | * preceded by a secure certificate. The SPL will therefore run in internal |
| 273 | * RAM from address 0x40301350 (0x40300000+0x1000(reserved)+0x350(cert)). |
| 274 | */ |
| 275 | #define TI_OMAP5_SECURE_BOOT_RESV_SRAM_SZ 0x1000 |
Daniel Allred | 420ffad | 2016-09-02 00:40:23 -0500 | [diff] [blame] | 276 | /* If no specific start address is specified then the secure EMIF |
| 277 | * region will be placed at the end of the DDR space. In order to prevent |
| 278 | * the main u-boot relocation from clobbering that memory and causing a |
| 279 | * firewall violation, we tell u-boot that memory is protected RAM (PRAM) |
| 280 | */ |
| 281 | #if (CONFIG_TI_SECURE_EMIF_REGION_START == 0) |
Tom Rini | 0bb9b09 | 2022-12-04 10:13:37 -0500 | [diff] [blame] | 282 | #define CFG_PRAM (CONFIG_TI_SECURE_EMIF_TOTAL_REGION_SIZE) >> 10 |
Daniel Allred | 420ffad | 2016-09-02 00:40:23 -0500 | [diff] [blame] | 283 | #endif |
Daniel Allred | 36d0824 | 2016-05-19 19:10:50 -0500 | [diff] [blame] | 284 | #else |
| 285 | /* |
| 286 | * For all booting on GP parts, the flash loader image is |
| 287 | * downloaded into internal RAM at address 0x40300000. |
| 288 | */ |
Daniel Allred | 36d0824 | 2016-05-19 19:10:50 -0500 | [diff] [blame] | 289 | #endif |
| 290 | |
Enric Balletbò i Serra | 2785bb7 | 2013-12-06 21:30:19 +0100 | [diff] [blame] | 291 | #endif /* __CONFIG_TI_OMAP5_COMMON_H */ |