blob: e1f1b3c7c17bd5a391cf736f8e91ffccf2ee30e7 [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----------------
581. Trusted Firmware-A:
59
60.. code-block:: bash
61
62 $ make CROSS_COMPILE=aarch64-linux-gnu- ARCH=aarch64 PLAT=k3 \
63 TARGET_BOARD=generic SPD=opteed
64
652. OP-TEE:
66
67.. code-block:: bash
68
69 $ make PLATFORM=k3-am65x CFG_ARM64_core=y
70
713. U-Boot:
72
73* 4.1 R5:
74
75.. code-block:: bash
76
77 $ make am65x_evm_r5_defconfig
78 $ make CROSS_COMPILE=arm-linux-gnueabihf- \
79 BINMAN_INDIRS=<path/to/ti-linux-firmware>
80
81* 4.2 A53:
82
83.. code-block:: bash
84
85 $ make am65x_evm_a53_defconfig
86 $ make CROSS_COMPILE=aarch64-linux-gnu- \
87 BL31=<path/to/trusted-firmware-a/dir>/build/k3/generic/release/bl31.bin \
88 TEE=<path/to/optee_os/dir>/out/arm-plat-k3/core/tee-raw.bin \
89 BINMAN_INDIRS=<path/to/ti-linux-firmware>
90
91Target Images
92--------------
Tom Rinifdf45032023-07-25 12:44:16 -040093In order to boot we need tiboot3.bin, sysfw.itb, tispl.bin and u-boot.img.
94Each SoC variant (GP and HS) requires a different source for these files.
Neha Malcom Francis507be122023-07-22 00:14:43 +053095
96- GP
97
98 * tiboot3-am65x_sr2-gp-evm.bin, sysfw-am65x_sr2-gp-evm.itb from step 4.1
99 * tispl.bin_unsigned, u-boot.img_unsigned from step 4.2
100
101- HS
102
103 * tiboot3-am65x_sr2-hs-evm.bin, sysfw-am65x_sr2-hs-evm.itb from step 4.1
104 * tispl.bin, u-boot.img from step 4.2
105
106Image formats:
107--------------
108
109- tiboot3.bin:
110
111.. code-block:: text
112
113 +-----------------------+
114 | X.509 |
115 | Certificate |
116 | +-------------------+ |
117 | | | |
118 | | R5 | |
119 | | u-boot-spl.bin | |
120 | | | |
121 | +-------------------+ |
122 | | | |
123 | | FIT header | |
124 | | +---------------+ | |
125 | | | | | |
126 | | | DTB 1...N | | |
127 | | +---------------+ | |
128 | +-------------------+ |
129 +-----------------------+
130
131- tispl.bin
132
133.. code-block:: text
134
135 +-----------------------+
136 | |
137 | FIT HEADER |
138 | +-------------------+ |
139 | | | |
140 | | A53 ATF | |
141 | +-------------------+ |
142 | | | |
143 | | A53 OP-TEE | |
144 | +-------------------+ |
145 | | | |
146 | | A53 SPL | |
147 | +-------------------+ |
148 | | | |
149 | | SPL DTB 1...N | |
150 | +-------------------+ |
151 +-----------------------+
152
153- sysfw.itb
154
155.. code-block:: text
156
157 +-----------------------+
158 | |
159 | FIT HEADER |
160 | +-------------------+ |
161 | | | |
162 | | sysfw.bin | |
163 | +-------------------+ |
164 | | | |
165 | | board config | |
166 | +-------------------+ |
167 | | | |
168 | | PM config | |
169 | +-------------------+ |
170 | | | |
171 | | RM config | |
172 | +-------------------+ |
173 | | | |
174 | | Secure config | |
175 | +-------------------+ |
176 +-----------------------+
177
178eMMC:
179-----
180ROM supports booting from eMMC from boot0 partition offset 0x0
181
182Flashing images to eMMC:
183
184The following commands can be used to download tiboot3.bin, tispl.bin,
185u-boot.img, and sysfw.itb from an SD card and write them to the eMMC boot0
186partition at respective addresses.
187
188.. code-block:: text
189
190 => mmc dev 0 1
191 => fatload mmc 1 ${loadaddr} tiboot3.bin
192 => mmc write ${loadaddr} 0x0 0x400
193 => fatload mmc 1 ${loadaddr} tispl.bin
194 => mmc write ${loadaddr} 0x400 0x1000
195 => fatload mmc 1 ${loadaddr} u-boot.img
196 => mmc write ${loadaddr} 0x1400 0x2000
197 => fatload mmc 1 ${loadaddr} sysfw.itb
198 => mmc write ${loadaddr} 0x3600 0x800
199
200To give the ROM access to the boot partition, the following commands must be
201used for the first time:
202
203.. code-block:: text
204
205 => mmc partconf 0 1 1 1
206 => mmc bootbus 0 1 0 0
207
208To create a software partition for the rootfs, the following command can be
209used:
210
211.. code-block:: text
212
213 => gpt write mmc 0 ${partitions}
214
215eMMC layout:
216
217.. code-block:: text
218
219 boot0 partition (8 MB) user partition
220 0x0+----------------------------------+ 0x0+-------------------------+
221 | tiboot3.bin (512 KB) | | |
222 0x400+----------------------------------+ | |
223 | tispl.bin (2 MB) | | |
224 0x1400+----------------------------------+ | rootfs |
225 | u-boot.img (4 MB) | | |
226 0x3400+----------------------------------+ | |
227 | environment (128 KB) | | |
228 0x3500+----------------------------------+ | |
229 | backup environment (128 KB) | | |
230 0x3600+----------------------------------+ | |
231 | sysfw (1 MB) | | |
232 0x3E00+----------------------------------+ +-------------------------+
233
234Kernel image and DT are expected to be present in the /boot folder of rootfs.
235To boot kernel from eMMC, use the following commands:
236
237.. code-block:: text
238
239 => setenv mmcdev 0
240 => setenv bootpart 0
241 => boot
242
243OSPI:
244-----
245ROM supports booting from OSPI from offset 0x0.
246
247Flashing images to OSPI:
248
249Below commands can be used to download tiboot3.bin, tispl.bin, u-boot.img,
250and sysfw.itb over tftp and then flash those to OSPI at their respective
251addresses.
252
253.. code-block:: text
254
255 => sf probe
256 => tftp ${loadaddr} tiboot3.bin
257 => sf update $loadaddr 0x0 $filesize
258 => tftp ${loadaddr} tispl.bin
259 => sf update $loadaddr 0x80000 $filesize
260 => tftp ${loadaddr} u-boot.img
261 => sf update $loadaddr 0x280000 $filesize
262 => tftp ${loadaddr} sysfw.itb
263 => sf update $loadaddr 0x6C0000 $filesize
264
265Flash layout for OSPI:
266
267.. code-block:: text
268
269 0x0 +----------------------------+
270 | ospi.tiboot3(512K) |
271 | |
272 0x80000 +----------------------------+
273 | ospi.tispl(2M) |
274 | |
275 0x280000 +----------------------------+
276 | ospi.u-boot(4M) |
277 | |
278 0x680000 +----------------------------+
279 | ospi.env(128K) |
280 | |
281 0x6A0000 +----------------------------+
282 | ospi.env.backup (128K) |
283 | |
284 0x6C0000 +----------------------------+
285 | ospi.sysfw(1M) |
286 | |
287 0x7C0000 +----------------------------+
288 | padding (256k) |
289 0x800000 +----------------------------+
290 | ospi.rootfs(UBIFS) |
291 | |
292 +----------------------------+
293
294Kernel Image and DT are expected to be present in the /boot folder of UBIFS
295ospi.rootfs just like in SD card case. U-Boot looks for UBI volume named
296"rootfs" for rootfs.
297
298To boot kernel from OSPI, at the U-Boot prompt:
299
300.. code-block:: text
301
302 => setenv boot ubi
303 => boot
304
305UART:
306-----
307ROM supports booting from MCU_UART0 via X-Modem protocol. The entire UART-based
308boot process up to U-Boot (proper) prompt goes through different stages and uses
309different UART peripherals as follows:
310
311.. code-block:: text
312
313 +---------+---------------+-------------+------------+
314 | WHO | Loading WHAT | HW Module | Protocol |
315 +---------+---------------+-------------+------------+
316 |Boot ROM | tiboot3.bin | MCU_UART0 | X-Modem(*)|
317 |R5 SPL | sysfw.itb | MCU_UART0 | Y-Modem(*)|
318 |R5 SPL | tispl.bin | MAIN_UART0 | Y-Modem |
319 |A53 SPL | u-boot.img | MAIN_UART0 | Y-Modem |
320 +---------+---------------+-------------+------------+
321
322Note that in addition to X/Y-Modem related protocol timeouts the DMSC
323watchdog timeout of 3min (typ.) needs to be observed until System Firmware
324is fully loaded (from sysfw.itb) and started.
325
326Example bash script sequence for running on a Linux host PC feeding all boot
327artifacts needed to the device:
328
329.. code-block:: text
330
331 MCU_DEV=/dev/ttyUSB1
332 MAIN_DEV=/dev/ttyUSB0
333
334 stty -F $MCU_DEV 115200 cs8 -cstopb -parenb
335 stty -F $MAIN_DEV 115200 cs8 -cstopb -parenb
336
337 sb --xmodem tiboot3.bin > $MCU_DEV < $MCU_DEV
338 sb --ymodem sysfw.itb > $MCU_DEV < $MCU_DEV
339 sb --ymodem tispl.bin > $MAIN_DEV < $MAIN_DEV
340 sleep 1
341 sb --xmodem u-boot.img > $MAIN_DEV < $MAIN_DEV