10911d952SLokesh VutlaIntroduction: 20911d952SLokesh Vutla------------- 30911d952SLokesh VutlaThe AM65x family of SoCs is the first device family from K3 Multicore 40911d952SLokesh VutlaSoC architecture, targeted for broad market and industrial control with 50911d952SLokesh Vutlaaim to meet the complex processing needs of modern embedded products. 60911d952SLokesh Vutla 70911d952SLokesh VutlaThe device is built over three domains, each containing specific processing 80911d952SLokesh Vutlacores, voltage domains and peripherals: 90911d952SLokesh Vutla1. Wake-up (WKUP) domain: 100911d952SLokesh Vutla - Device Management and Security Controller (DMSC) 110911d952SLokesh Vutla2. Microcontroller (MCU) domain: 120911d952SLokesh Vutla - Dual Core ARM Cortex-R5F processor 130911d952SLokesh Vutla3. MAIN domain: 140911d952SLokesh Vutla - Quad core 64-bit ARM Cortex-A53 150911d952SLokesh Vutla 160911d952SLokesh VutlaMore info can be found in TRM: http://www.ti.com/lit/pdf/spruid7 170911d952SLokesh Vutla 180911d952SLokesh VutlaBoot Flow: 190911d952SLokesh Vutla---------- 200911d952SLokesh VutlaOn AM65x family devices, ROM supports boot only via MCU(R5). This means that 210911d952SLokesh Vutlabootloader has to run on R5 core. In order to meet this constraint, and for 220911d952SLokesh Vutlathe following reasons the boot flow is designed as mentioned: 230911d952SLokesh Vutla1. Need to move away from R5 asap, so that we want to start *any* 240911d952SLokesh Vutlafirmware on the r5 cores like.... autosar can be loaded to receive CAN 250911d952SLokesh Vutlaresponse and other safety operations to be started. This operation is 260911d952SLokesh Vutlavery time critical and is applicable for all automotive use cases. 270911d952SLokesh Vutla2. U-Boot on A53 should start other remotecores for various 280911d952SLokesh Vutlaapplications. This should happen before running Linux. 290911d952SLokesh Vutla3. In production boot flow, we might not like to use full u-boot, 300911d952SLokesh Vutlainstead use Flacon boot flow to reduce boot time. 310911d952SLokesh Vutla 320911d952SLokesh Vutla+------------------------------------------------------------------------+ 330911d952SLokesh Vutla| DMSC | R5 | A53 | 340911d952SLokesh Vutla+------------------------------------------------------------------------+ 350911d952SLokesh Vutla| +--------+ | | | 360911d952SLokesh Vutla| | Reset | | | | 370911d952SLokesh Vutla| +--------+ | | | 380911d952SLokesh Vutla| : | | | 390911d952SLokesh Vutla| +--------+ | +-----------+ | | 40*64180003SLokesh Vutla| | *ROM* |----------|-->| Reset rls | | | 410911d952SLokesh Vutla| +--------+ | +-----------+ | | 420911d952SLokesh Vutla| | | | : | | 43*64180003SLokesh Vutla| | ROM | | : | | 440911d952SLokesh Vutla| |services| | : | | 450911d952SLokesh Vutla| | | | +-------------+ | | 46*64180003SLokesh Vutla| | | | | *R5 ROM* | | | 470911d952SLokesh Vutla| | | | +-------------+ | | 480911d952SLokesh Vutla| | |<---------|---|Load and auth| | | 490911d952SLokesh Vutla| | | | | tiboot3.bin | | | 500911d952SLokesh Vutla| | | | +-------------+ | | 510911d952SLokesh Vutla| | | | : | | 520911d952SLokesh Vutla| | | | : | | 530911d952SLokesh Vutla| | | | : | | 540911d952SLokesh Vutla| | | | +-------------+ | | 55*64180003SLokesh Vutla| | | | | *R5 SPL* | | | 560911d952SLokesh Vutla| | | | +-------------+ | | 57*64180003SLokesh Vutla| | | | | Load | | | 58*64180003SLokesh Vutla| | | | | sysfw.itb | | | 59*64180003SLokesh Vutla| | Start | | +-------------+ | | 60*64180003SLokesh Vutla| | System |<---------|---| Start | | | 61*64180003SLokesh Vutla| |Firmware| | | SYSFW | | | 62*64180003SLokesh Vutla| +--------+ | +-------------+ | | 63*64180003SLokesh Vutla| : | | | | | 64*64180003SLokesh Vutla| +---------+ | | Load | | | 65*64180003SLokesh Vutla| | *SYSFW* | | | system | | | 66*64180003SLokesh Vutla| +---------+ | | Config data | | | 67*64180003SLokesh Vutla| | |<--------|---| | | | 68*64180003SLokesh Vutla| | | | +-------------+ | | 69*64180003SLokesh Vutla| | | | | | | | 70*64180003SLokesh Vutla| | | | | DDR | | | 71*64180003SLokesh Vutla| | | | | config | | | 72*64180003SLokesh Vutla| | | | +-------------+ | | 73*64180003SLokesh Vutla| | | | | | | | 740911d952SLokesh Vutla| | |<--------|---| Start A53 | | | 750911d952SLokesh Vutla| | | | | and Reset | | | 760911d952SLokesh Vutla| | | | +-------------+ | | 770911d952SLokesh Vutla| | | | | +-----------+ | 780911d952SLokesh Vutla| | |---------|-----------------------|---->| Reset rls | | 790911d952SLokesh Vutla| | | | | +-----------+ | 800911d952SLokesh Vutla| | DMSC | | | : | 810911d952SLokesh Vutla| |Services | | | +-----------+ | 820911d952SLokesh Vutla| | |<--------|-----------------------|---->|*ATF/OPTEE*| | 830911d952SLokesh Vutla| | | | | +-----------+ | 840911d952SLokesh Vutla| | | | | : | 850911d952SLokesh Vutla| | | | | +-----------+ | 860911d952SLokesh Vutla| | |<--------|-----------------------|---->| *A53 SPL* | | 870911d952SLokesh Vutla| | | | | +-----------+ | 880911d952SLokesh Vutla| | | | | | Load | | 890911d952SLokesh Vutla| | | | | | u-boot.img| | 900911d952SLokesh Vutla| | | | | +-----------+ | 910911d952SLokesh Vutla| | | | | : | 920911d952SLokesh Vutla| | | | | +-----------+ | 93*64180003SLokesh Vutla| | |<--------|-----------------------|---->| *U-Boot* | | 940911d952SLokesh Vutla| | | | | +-----------+ | 950911d952SLokesh Vutla| | | | | | prompt | | 960911d952SLokesh Vutla| | | | | +-----------+ | 970911d952SLokesh Vutla| +---------+ | | | 980911d952SLokesh Vutla| | | | 990911d952SLokesh Vutla+------------------------------------------------------------------------+ 1000911d952SLokesh Vutla 1010911d952SLokesh Vutla- Here DMSC acts as master and provides all the critical services. R5/A53 1020911d952SLokesh Vutlarequests DMSC to get these services done as shown in the above diagram. 1030911d952SLokesh Vutla 1040911d952SLokesh VutlaSources: 1050911d952SLokesh Vutla-------- 1060911d952SLokesh Vutla1. SYSFW: 107*64180003SLokesh Vutla Tree: git://git.ti.com/processor-firmware/system-firmware-image-gen.git 108*64180003SLokesh Vutla Branch: master 1090911d952SLokesh Vutla 1100911d952SLokesh Vutla2. ATF: 1110911d952SLokesh Vutla Tree: https://github.com/ARM-software/arm-trusted-firmware.git 1120911d952SLokesh Vutla Branch: master 1130911d952SLokesh Vutla 1140911d952SLokesh Vutla3. OPTEE: 1150911d952SLokesh Vutla Tree: https://github.com/OP-TEE/optee_os.git 1160911d952SLokesh Vutla Branch: master 1170911d952SLokesh Vutla 1180911d952SLokesh Vutla4. U-Boot: 1190911d952SLokesh Vutla Tree: http://git.denx.de/u-boot.git 1200911d952SLokesh Vutla Branch: master 1210911d952SLokesh Vutla 1220911d952SLokesh VutlaBuild procedure: 1230911d952SLokesh Vutla---------------- 1240911d952SLokesh Vutla1. SYSFW: 125*64180003SLokesh Vutla$ make CROSS_COMPILE=arm-linux-gnueabihf- 1260911d952SLokesh Vutla 1270911d952SLokesh Vutla2. ATF: 1280911d952SLokesh Vutla$ make CROSS_COMPILE=aarch64-linux-gnu- ARCH=aarch64 PLAT=k3 TARGET_BOARD=generic SPD=opteed 1290911d952SLokesh Vutla 1300911d952SLokesh Vutla3. OPTEE: 1310911d952SLokesh Vutla$ make PLATFORM=k3-am65x CFG_ARM64_core=y 1320911d952SLokesh Vutla 1330911d952SLokesh Vutla4. U-Boot: 1340911d952SLokesh Vutla 1350911d952SLokesh Vutla4.1. R5: 136*64180003SLokesh Vutla$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am65x_evm_r5_defconfig O=/tmp/r5 137*64180003SLokesh Vutla$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- O=/tmp/r5 1380911d952SLokesh Vutla 1390911d952SLokesh Vutla4.2. A53: 1400911d952SLokesh Vutla$ make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- am65x_evm_a53_defconfig O=/tmp/a53 1410911d952SLokesh Vutla$ make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- ATF=<path to ATF dir>/build/k3/generic/release/bl31.bin TEE=<path to OPTEE OS dir>/out/arm-plat-k3/core/tee-pager.bin O=/tmp/a53 1420911d952SLokesh Vutla 1430911d952SLokesh VutlaTarget Images 1440911d952SLokesh Vutla-------------- 1450911d952SLokesh VutlaCopy the below images to an SD card and boot: 146*64180003SLokesh Vutla- sysfw.itb from step 1 1470911d952SLokesh Vutla- tiboot3.bin from step 4.1 1480911d952SLokesh Vutla- tispl.bin, u-boot.img from 4.2 149*64180003SLokesh Vutla 150*64180003SLokesh VutlaImage formats: 151*64180003SLokesh Vutla-------------- 152*64180003SLokesh Vutla 153*64180003SLokesh Vutla- tiboot3.bin: 154*64180003SLokesh Vutla +-----------------------+ 155*64180003SLokesh Vutla | X.509 | 156*64180003SLokesh Vutla | Certificate | 157*64180003SLokesh Vutla | +-------------------+ | 158*64180003SLokesh Vutla | | | | 159*64180003SLokesh Vutla | | R5 | | 160*64180003SLokesh Vutla | | u-boot-spl.bin | | 161*64180003SLokesh Vutla | | | | 162*64180003SLokesh Vutla | +-------------------+ | 163*64180003SLokesh Vutla | | | | 164*64180003SLokesh Vutla | | FIT header | | 165*64180003SLokesh Vutla | | +---------------+ | | 166*64180003SLokesh Vutla | | | | | | 167*64180003SLokesh Vutla | | | DTB 1...N | | | 168*64180003SLokesh Vutla | | +---------------+ | | 169*64180003SLokesh Vutla | +-------------------+ | 170*64180003SLokesh Vutla +-----------------------+ 171*64180003SLokesh Vutla 172*64180003SLokesh Vutla- tispl.bin 173*64180003SLokesh Vutla +-----------------------+ 174*64180003SLokesh Vutla | | 175*64180003SLokesh Vutla | FIT HEADER | 176*64180003SLokesh Vutla | +-------------------+ | 177*64180003SLokesh Vutla | | | | 178*64180003SLokesh Vutla | | A53 ATF | | 179*64180003SLokesh Vutla | +-------------------+ | 180*64180003SLokesh Vutla | | | | 181*64180003SLokesh Vutla | | A53 OPTEE | | 182*64180003SLokesh Vutla | +-------------------+ | 183*64180003SLokesh Vutla | | | | 184*64180003SLokesh Vutla | | A53 SPL | | 185*64180003SLokesh Vutla | +-------------------+ | 186*64180003SLokesh Vutla | | | | 187*64180003SLokesh Vutla | | SPL DTB 1...N | | 188*64180003SLokesh Vutla | +-------------------+ | 189*64180003SLokesh Vutla +-----------------------+ 190*64180003SLokesh Vutla 191*64180003SLokesh Vutla- sysfw.itb 192*64180003SLokesh Vutla +-----------------------+ 193*64180003SLokesh Vutla | | 194*64180003SLokesh Vutla | FIT HEADER | 195*64180003SLokesh Vutla | +-------------------+ | 196*64180003SLokesh Vutla | | | | 197*64180003SLokesh Vutla | | sysfw.bin | | 198*64180003SLokesh Vutla | +-------------------+ | 199*64180003SLokesh Vutla | | | | 200*64180003SLokesh Vutla | | board config | | 201*64180003SLokesh Vutla | +-------------------+ | 202*64180003SLokesh Vutla | | | | 203*64180003SLokesh Vutla | | PM config | | 204*64180003SLokesh Vutla | +-------------------+ | 205*64180003SLokesh Vutla | | | | 206*64180003SLokesh Vutla | | RM config | | 207*64180003SLokesh Vutla | +-------------------+ | 208*64180003SLokesh Vutla | | | | 209*64180003SLokesh Vutla | | Secure config | | 210*64180003SLokesh Vutla | +-------------------+ | 211*64180003SLokesh Vutla +-----------------------+ 212