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