blob: c49c177390b3df84dede0d8e8b738f6d9cecb6cf [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Lokesh Vutla3e716e22013-02-17 23:34:35 +00002/*
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 Rinib3277f52013-08-09 11:22:18 -040012 * For more details, please see the technical documents listed at
13 * http://www.ti.com/product/omap5432
Lokesh Vutla3e716e22013-02-17 23:34:35 +000014 */
15
Enric Balletbò i Serra2785bb72013-12-06 21:30:19 +010016#ifndef __CONFIG_TI_OMAP5_COMMON_H
17#define __CONFIG_TI_OMAP5_COMMON_H
Lokesh Vutla3e716e22013-02-17 23:34:35 +000018
Tom Rinib3277f52013-08-09 11:22:18 -040019/* Use General purpose timer 1 */
20#define CONFIG_SYS_TIMERBASE GPT2_BASE
Lokesh Vutla3e716e22013-02-17 23:34:35 +000021
Tom Rini8decd962021-07-01 09:26:11 -040022#include <linux/stringify.h>
23
Tom Rinib3277f52013-08-09 11:22:18 -040024#include <asm/arch/cpu.h>
25#include <asm/arch/omap.h>
26
Nishanth Menonad63dd72015-07-22 18:05:41 -050027#include <configs/ti_armv7_omap.h>
Lokesh Vutla3e716e22013-02-17 23:34:35 +000028
29/*
Tom Rinib3277f52013-08-09 11:22:18 -040030 * Hardware drivers
Lokesh Vutla3e716e22013-02-17 23:34:35 +000031 */
Tom Rinidf6a2152022-11-16 13:10:28 -050032#define CFG_SYS_NS16550_CLK 48000000
Lokesh Vutla3e716e22013-02-17 23:34:35 +000033
Lokesh Vutla3e716e22013-02-17 23:34:35 +000034/*
35 * Environment setup
36 */
Tom Rini546c6c12013-04-05 06:21:45 +000037
Kishon Vijay Abraham I24080762015-02-23 18:40:20 +053038#ifndef DFUARGS
39#define DFUARGS
40#endif
41
Sekhar Nori0ea56fe2017-04-06 14:52:56 +053042#include <environment/ti/mmc.h>
Faiz Abbas1c2f44d2019-02-27 13:29:38 +053043#include <environment/ti/nand.h>
Sekhar Nori0ea56fe2017-04-06 14:52:56 +053044
Tom Rini8decd962021-07-01 09:26:11 -040045#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 Rini8decd962021-07-01 09:26:11 -0400156#define DEFAULT_COMMON_BOOT_TI_ARGS \
157 "console=" CONSOLEDEV ",115200n8\0" \
158 "fdtfile=undefined\0" \
Tom Rinie0504572021-07-01 09:26:12 -0400159 "finduuid=part uuid mmc 0:2 uuid\0" \
Tom Rini8decd962021-07-01 09:26:11 -0400160 "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 Rini8decd962021-07-01 09:26:11 -0400166 "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 Rini5ddf1722021-11-10 09:11:40 -0500177 "fastboot 1; " \
Tom Rini8decd962021-07-01 09:26:11 -0400178 "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 Rinie0504572021-07-01 09:26:12 -0400242#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 Rini8decd962021-07-01 09:26:11 -0400249
Lokesh Vutla3e716e22013-02-17 23:34:35 +0000250#define CONFIG_EXTRA_ENV_SETTINGS \
Tom Rini96886f22014-03-28 15:03:29 -0400251 DEFAULT_LINUX_BOOT_ENV \
Lokesh Vutlab207c472015-08-28 13:35:07 +0530252 DEFAULT_MMC_TI_ARGS \
Lokesh Vutlac2913ac2016-11-29 11:58:00 +0530253 DEFAULT_FIT_TI_ARGS \
Semen Protsenko334f5bb2017-06-14 21:34:23 +0300254 DEFAULT_COMMON_BOOT_TI_ARGS \
255 DEFAULT_FDT_TI_ARGS \
Kishon Vijay Abraham I24080762015-02-23 18:40:20 +0530256 DFUARGS \
Cooper Jr., Franklin07610ab2015-04-21 07:51:04 -0500257 NETARGS \
Faiz Abbas1c2f44d2019-02-27 13:29:38 +0530258 NANDARGS \
Tom Rinie0504572021-07-01 09:26:12 -0400259 BOOTENV
Lokesh Vutla3e716e22013-02-17 23:34:35 +0000260
Tom Rini21089602013-08-20 08:53:52 -0400261/*
262 * SPL related defines. The Public RAM memory map the ROM defines the
Daniel Allred36d08242016-05-19 19:10:50 -0500263 * 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 Rini21089602013-08-20 08:53:52 -0400266 * print some information.
267 */
Daniel Allred36d08242016-05-19 19:10:50 -0500268#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 Allred420ffad2016-09-02 00:40:23 -0500276/* 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)
282#define CONFIG_PRAM (CONFIG_TI_SECURE_EMIF_TOTAL_REGION_SIZE) >> 10
283#endif
Daniel Allred36d08242016-05-19 19:10:50 -0500284#else
285/*
286 * For all booting on GP parts, the flash loader image is
287 * downloaded into internal RAM at address 0x40300000.
288 */
Daniel Allred36d08242016-05-19 19:10:50 -0500289#endif
290
Enric Balletbò i Serra2785bb72013-12-06 21:30:19 +0100291#endif /* __CONFIG_TI_OMAP5_COMMON_H */