blob: fcb5f1c685a307f811146cf5dca34a688dc16d34 [file] [log] [blame]
Neha Malcom Francis507be122023-07-22 00:14:43 +05301.. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
2.. sectionauthor:: Neha Francis <n-francis@ti.com>
3
4AM65x Platforms
5===============
6
7Introduction:
8-------------
9The AM65x family of SoCs is the first device family from K3 Multicore
10SoC architecture, targeted for broad market and industrial control with
11aim to meet the complex processing needs of modern embedded products.
12
13The device is built over three domains, each containing specific processing
14cores, voltage domains and peripherals:
15
161. Wake-up (WKUP) domain:
17 * Device Management and Security Controller (DMSC)
18
192. Microcontroller (MCU) domain:
20 * Dual Core ARM Cortex-R5F processor
21
223. MAIN domain:
23 * Quad core 64-bit ARM Cortex-A53
24
25More info can be found in TRM: http://www.ti.com/lit/pdf/spruid7
26
27Boot Flow:
28----------
29On AM65x family devices, ROM supports boot only via MCU(R5). This means that
30bootloader has to run on R5 core. In order to meet this constraint, and for
31the following reasons the boot flow is designed as mentioned:
32
331. Need to move away from R5 asap, so that we want to start *any*
34firmware on the R5 cores for example autosar can be loaded to receive CAN
35response and other safety operations to be started. This operation is
36very time critical and is applicable for all automotive use cases.
37
382. U-Boot on A53 should start other remotecores for various
39applications. This should happen before running Linux.
40
413. In production boot flow, we might not like to use full U-Boot,
42instead use Falcon boot flow to reduce boot time.
43
Nishanth Menond683f502023-07-27 13:58:46 -050044.. image:: img/boot_diagram_am65.svg
Neha Malcom Francis507be122023-07-22 00:14:43 +053045
46- Here DMSC acts as master and provides all the critical services. R5/A53
47 requests DMSC to get these services done as shown in the above diagram.
48
49Sources:
50--------
Neha Malcom Francis507be122023-07-22 00:14:43 +053051
Nishanth Menonee91e482023-07-27 13:58:44 -050052.. include:: k3.rst
53 :start-after: .. k3_rst_include_start_boot_sources
54 :end-before: .. k3_rst_include_end_boot_sources
Neha Malcom Francis507be122023-07-22 00:14:43 +053055
56Build procedure:
57----------------
Nishanth Menonb7ee22f2023-07-27 13:58:48 -0500580. Setup the environment variables:
Neha Malcom Francis507be122023-07-22 00:14:43 +053059
Nishanth Menonb7ee22f2023-07-27 13:58:48 -050060.. include:: k3.rst
61 :start-after: .. k3_rst_include_start_common_env_vars_desc
62 :end-before: .. k3_rst_include_end_common_env_vars_desc
Neha Malcom Francis507be122023-07-22 00:14:43 +053063
Nishanth Menonb7ee22f2023-07-27 13:58:48 -050064.. include:: k3.rst
65 :start-after: .. k3_rst_include_start_board_env_vars_desc
66 :end-before: .. k3_rst_include_end_board_env_vars_desc
Neha Malcom Francis507be122023-07-22 00:14:43 +053067
Nishanth Menonb7ee22f2023-07-27 13:58:48 -050068Set the variables corresponding to this platform:
Neha Malcom Francis507be122023-07-22 00:14:43 +053069
Nishanth Menonb7ee22f2023-07-27 13:58:48 -050070.. include:: k3.rst
71 :start-after: .. k3_rst_include_start_common_env_vars_defn
72 :end-before: .. k3_rst_include_end_common_env_vars_defn
Neha Malcom Francis507be122023-07-22 00:14:43 +053073.. code-block:: bash
74
Nishanth Menonb7ee22f2023-07-27 13:58:48 -050075 $ export UBOOT_CFG_CORTEXR=am65x_evm_r5_defconfig
76 $ export UBOOT_CFG_CORTEXA=am65x_evm_a53_defconfig
77 $ export TFA_BOARD=generic
78 $ # we dont use any extra TFA parameters
79 $ unset TFA_EXTRA_ARGS
80 $ export OPTEE_PLATFORM=k3-am65x
81 $ # we dont use any extra OP-TEE parameters
82 $ unset OPTEE_EXTRA_ARGS
83
84.. am65x_evm_rst_include_start_build_steps
85
861. Trusted Firmware-A:
87
88.. include:: k3.rst
89 :start-after: .. k3_rst_include_start_build_steps_tfa
90 :end-before: .. k3_rst_include_end_build_steps_tfa
91
92
932. OP-TEE:
94
95.. include:: k3.rst
96 :start-after: .. k3_rst_include_start_build_steps_optee
97 :end-before: .. k3_rst_include_end_build_steps_optee
Neha Malcom Francis507be122023-07-22 00:14:43 +053098
993. U-Boot:
100
101* 4.1 R5:
102
Nishanth Menonb7ee22f2023-07-27 13:58:48 -0500103.. include:: k3.rst
104 :start-after: .. k3_rst_include_start_build_steps_spl_r5
105 :end-before: .. k3_rst_include_end_build_steps_spl_r5
Neha Malcom Francis507be122023-07-22 00:14:43 +0530106
107* 4.2 A53:
108
Nishanth Menonb7ee22f2023-07-27 13:58:48 -0500109.. include:: k3.rst
110 :start-after: .. k3_rst_include_start_build_steps_uboot
111 :end-before: .. k3_rst_include_end_build_steps_uboot
112.. am65x_evm_rst_include_end_build_steps
Neha Malcom Francis507be122023-07-22 00:14:43 +0530113
114Target Images
115--------------
Tom Rinifdf45032023-07-25 12:44:16 -0400116In order to boot we need tiboot3.bin, sysfw.itb, tispl.bin and u-boot.img.
117Each SoC variant (GP and HS) requires a different source for these files.
Neha Malcom Francis507be122023-07-22 00:14:43 +0530118
119- GP
120
121 * tiboot3-am65x_sr2-gp-evm.bin, sysfw-am65x_sr2-gp-evm.itb from step 4.1
122 * tispl.bin_unsigned, u-boot.img_unsigned from step 4.2
123
124- HS
125
126 * tiboot3-am65x_sr2-hs-evm.bin, sysfw-am65x_sr2-hs-evm.itb from step 4.1
127 * tispl.bin, u-boot.img from step 4.2
128
129Image formats:
130--------------
131
Nishanth Menon91834942023-07-27 13:58:51 -0500132- tiboot3.bin
Neha Malcom Francis507be122023-07-22 00:14:43 +0530133
Nishanth Menon91834942023-07-27 13:58:51 -0500134.. image:: img/no_multi_cert_tiboot3.bin.svg
Neha Malcom Francis507be122023-07-22 00:14:43 +0530135
136- tispl.bin
137
Nishanth Menon91834942023-07-27 13:58:51 -0500138.. image:: img/nodm_tispl.bin.svg
Neha Malcom Francis507be122023-07-22 00:14:43 +0530139
140- sysfw.itb
141
Nishanth Menon91834942023-07-27 13:58:51 -0500142.. image:: img/sysfw.itb.svg
Neha Malcom Francis507be122023-07-22 00:14:43 +0530143
144eMMC:
145-----
146ROM supports booting from eMMC from boot0 partition offset 0x0
147
148Flashing images to eMMC:
149
150The following commands can be used to download tiboot3.bin, tispl.bin,
151u-boot.img, and sysfw.itb from an SD card and write them to the eMMC boot0
152partition at respective addresses.
153
154.. code-block:: text
155
156 => mmc dev 0 1
157 => fatload mmc 1 ${loadaddr} tiboot3.bin
158 => mmc write ${loadaddr} 0x0 0x400
159 => fatload mmc 1 ${loadaddr} tispl.bin
160 => mmc write ${loadaddr} 0x400 0x1000
161 => fatload mmc 1 ${loadaddr} u-boot.img
162 => mmc write ${loadaddr} 0x1400 0x2000
163 => fatload mmc 1 ${loadaddr} sysfw.itb
164 => mmc write ${loadaddr} 0x3600 0x800
165
166To give the ROM access to the boot partition, the following commands must be
167used for the first time:
168
169.. code-block:: text
170
171 => mmc partconf 0 1 1 1
172 => mmc bootbus 0 1 0 0
173
174To create a software partition for the rootfs, the following command can be
175used:
176
177.. code-block:: text
178
179 => gpt write mmc 0 ${partitions}
180
181eMMC layout:
182
Nishanth Menonef930a72023-07-27 13:58:58 -0500183.. image:: img/emmc_am65x_evm_boot0.svg
Neha Malcom Francis507be122023-07-22 00:14:43 +0530184
185Kernel image and DT are expected to be present in the /boot folder of rootfs.
186To boot kernel from eMMC, use the following commands:
187
188.. code-block:: text
189
190 => setenv mmcdev 0
191 => setenv bootpart 0
192 => boot
193
194OSPI:
195-----
196ROM supports booting from OSPI from offset 0x0.
197
198Flashing images to OSPI:
199
200Below commands can be used to download tiboot3.bin, tispl.bin, u-boot.img,
201and sysfw.itb over tftp and then flash those to OSPI at their respective
202addresses.
203
204.. code-block:: text
205
206 => sf probe
207 => tftp ${loadaddr} tiboot3.bin
208 => sf update $loadaddr 0x0 $filesize
209 => tftp ${loadaddr} tispl.bin
210 => sf update $loadaddr 0x80000 $filesize
211 => tftp ${loadaddr} u-boot.img
212 => sf update $loadaddr 0x280000 $filesize
213 => tftp ${loadaddr} sysfw.itb
214 => sf update $loadaddr 0x6C0000 $filesize
215
216Flash layout for OSPI:
217
Nishanth Menon2bb20e42023-07-27 13:58:57 -0500218.. image:: img/ospi_sysfw.svg
Neha Malcom Francis507be122023-07-22 00:14:43 +0530219
220Kernel Image and DT are expected to be present in the /boot folder of UBIFS
221ospi.rootfs just like in SD card case. U-Boot looks for UBI volume named
222"rootfs" for rootfs.
223
224To boot kernel from OSPI, at the U-Boot prompt:
225
226.. code-block:: text
227
228 => setenv boot ubi
229 => boot
230
231UART:
232-----
233ROM supports booting from MCU_UART0 via X-Modem protocol. The entire UART-based
234boot process up to U-Boot (proper) prompt goes through different stages and uses
235different UART peripherals as follows:
236
Nishanth Menonf0206802023-07-27 13:58:56 -0500237.. list-table:: ROM UART Boot Responsibilities
238 :widths: 16 16 16 16
239 :header-rows: 1
240
241 * - Who
242 - Loading What
243 - Hardware Module
244 - Protocol
245
246 * - Boot ROM
247 - tiboot3.bin
248 - MCU_UART0
249 - X-Modem(*)
250
251 * - R5 SPL
252 - sysfw.itb
253 - MCU_UART0
254 - Y-Modem(*)
255
256 * - R5 SPL
257 - tispl.bin
258 - MAIN_UART0
259 - Y-Modem
Neha Malcom Francis507be122023-07-22 00:14:43 +0530260
Nishanth Menonf0206802023-07-27 13:58:56 -0500261 * - A53 SPL
262 - u-boot.img
263 - MAIN_UART0
264 - Y-Modem
Neha Malcom Francis507be122023-07-22 00:14:43 +0530265
266Note that in addition to X/Y-Modem related protocol timeouts the DMSC
267watchdog timeout of 3min (typ.) needs to be observed until System Firmware
268is fully loaded (from sysfw.itb) and started.
269
270Example bash script sequence for running on a Linux host PC feeding all boot
271artifacts needed to the device:
272
273.. code-block:: text
274
275 MCU_DEV=/dev/ttyUSB1
276 MAIN_DEV=/dev/ttyUSB0
277
278 stty -F $MCU_DEV 115200 cs8 -cstopb -parenb
279 stty -F $MAIN_DEV 115200 cs8 -cstopb -parenb
280
281 sb --xmodem tiboot3.bin > $MCU_DEV < $MCU_DEV
282 sb --ymodem sysfw.itb > $MCU_DEV < $MCU_DEV
283 sb --ymodem tispl.bin > $MAIN_DEV < $MAIN_DEV
284 sleep 1
285 sb --xmodem u-boot.img > $MAIN_DEV < $MAIN_DEV