Udit Kumar | ed92ede | 2023-05-11 14:47:48 +0530 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause |
| 2 | .. sectionauthor:: Udit Kumar <u-kumar1@ti.com> |
| 3 | |
| 4 | J7200 Platforms |
| 5 | =============== |
| 6 | |
| 7 | Introduction: |
| 8 | ------------- |
| 9 | The J7200 family of SoCs are part of K3 Multicore SoC architecture platform |
| 10 | targeting automotive applications. They are designed as a low power, high |
| 11 | performance and highly integrated device architecture, adding significant |
| 12 | enhancement on processing power, graphics capability, video and imaging |
| 13 | processing, virtualization and coherent memory support. |
| 14 | |
| 15 | The device is partitioned into three functional domains, each containing |
| 16 | specific processing cores and peripherals: |
| 17 | |
| 18 | 1. Wake-up (WKUP) domain: |
| 19 | * Device Management and Security Controller (DMSC) |
| 20 | |
| 21 | 2. Microcontroller (MCU) domain: |
| 22 | * Dual Core ARM Cortex-R5F processor |
| 23 | |
| 24 | 3. MAIN domain: |
| 25 | * Dual core 64-bit ARM Cortex-A72 |
| 26 | |
| 27 | More info can be found in TRM: https://www.ti.com/lit/pdf/spruiu1 |
| 28 | |
| 29 | Boot Flow: |
| 30 | ---------- |
| 31 | Below is the pictorial representation of boot flow: |
| 32 | |
| 33 | .. code-block:: text |
| 34 | |
| 35 | +------------------------------------------------------------------------+-----------------------+ |
| 36 | | DMSC | MCU R5 | A72 | MAIN R5/C7x | |
| 37 | +------------------------------------------------------------------------+-----------------------+ |
| 38 | | +--------+ | | | | |
| 39 | | | Reset | | | | | |
| 40 | | +--------+ | | | | |
| 41 | | : | | | | |
| 42 | | +--------+ | +-----------+ | | | |
| 43 | | | *ROM* |----------|-->| Reset rls | | | | |
| 44 | | +--------+ | +-----------+ | | | |
| 45 | | | | | : | | | |
| 46 | | | ROM | | : | | | |
| 47 | | |services| | : | | | |
| 48 | | | | | +-------------+ | | | |
| 49 | | | | | | *R5 ROM* | | | | |
| 50 | | | | | +-------------+ | | | |
| 51 | | | |<---------|---|Load and auth| | | | |
| 52 | | | | | | tiboot3.bin | | | | |
| 53 | | | Start | | +-------------+ | | | |
| 54 | | | TIFS |<---------|---| Start | | | | |
| 55 | | | | | | TIFS | | | | |
| 56 | | +--------+ | +-------------+ | | | |
| 57 | | : | | | | | | |
| 58 | | +---------+ | | Load | | | | |
| 59 | | | *TIFS* | | | system | | | | |
| 60 | | +---------+ | | Config data | | | | |
| 61 | | | |<--------|---| | | | | |
| 62 | | | | | +-------------+ | | | |
| 63 | | | | | : | | | |
| 64 | | | | | : | | | |
| 65 | | | | | : | | | |
| 66 | | | | | +-------------+ | | | |
| 67 | | | | | | *R5 SPL* | | | | |
| 68 | | | | | +-------------+ | | | |
| 69 | | | | | | DDR | | | | |
| 70 | | | | | | config | | | | |
| 71 | | | | | +-------------+ | | | |
| 72 | | | | | | Load | | | | |
| 73 | | | | | | tispl.bin | | | | |
| 74 | | | | | +-------------+ | | | |
| 75 | | | | | | Load R5 | | | | |
| 76 | | | | | | firmware | | | | |
| 77 | | | | | +-------------+ | | | |
| 78 | | | |<--------|---| Start A72 | | | | |
| 79 | | | | | | and jump to | | | | |
| 80 | | | | | | DM fw image | | | | |
| 81 | | | | | +-------------+ | | | |
| 82 | | | | | | +-----------+ | | |
| 83 | | | |---------|-----------------------|---->| Reset rls | | | |
| 84 | | | | | | +-----------+ | | |
| 85 | | | TIFS | | | : | | |
| 86 | | |Services | | | +-----------+ | | |
| 87 | | | |<--------|-----------------------|---->|*ATF/OPTEE*| | | |
| 88 | | | | | | +-----------+ | | |
| 89 | | | | | | : | | |
| 90 | | | | | | +-----------+ | | |
| 91 | | | |<--------|-----------------------|---->| *A72 SPL* | | | |
| 92 | | | | | | +-----------+ | | |
| 93 | | | | | | | Load | | | |
| 94 | | | | | | | u-boot.img| | | |
| 95 | | | | | | +-----------+ | | |
| 96 | | | | | | : | | |
| 97 | | | | | | +-----------+ | | |
| 98 | | | |<--------|-----------------------|---->| *U-Boot* | | | |
| 99 | | | | | | +-----------+ | | |
| 100 | | | | | | | prompt | | | |
| 101 | | | | | | +-----------+ | | |
| 102 | | | | | | | Load R5 | | | |
| 103 | | | | | | | Firmware | | | |
| 104 | | | | | | +-----------+ | | |
| 105 | | | |<--------|-----------------------|-----| Start R5 | | +-----------+ | |
| 106 | | | |---------|-----------------------|-----+-----------+-----|----->| R5 starts | | |
| 107 | | | | | | | Load C7 | | +-----------+ | |
| 108 | | | | | | | Firmware | | | |
| 109 | | | | | | +-----------+ | | |
| 110 | | | |<--------|-----------------------|-----| Start C7 | | +-----------+ | |
| 111 | | | |---------|-----------------------|-----+-----------+-----|----->| C7 starts | | |
| 112 | | | | | | | +-----------+ | |
| 113 | | | | | | | | |
| 114 | | +---------+ | | | | |
| 115 | | | | | | |
| 116 | +------------------------------------------------------------------------+-----------------------+ |
| 117 | |
| 118 | - Here DMSC acts as master and provides all the critical services. R5/A72 |
| 119 | requests DMSC to get these services done as shown in the above diagram. |
| 120 | |
| 121 | Sources: |
| 122 | -------- |
| 123 | 1. SYSFW: |
| 124 | Tree: git://git.ti.com/k3-image-gen/k3-image-gen.git |
| 125 | Branch: master |
| 126 | |
| 127 | 2. ATF: |
| 128 | Tree: https://github.com/ARM-software/arm-trusted-firmware.git |
| 129 | Branch: master |
| 130 | |
| 131 | 3. OPTEE: |
| 132 | Tree: https://github.com/OP-TEE/optee_os.git |
| 133 | Branch: master |
| 134 | |
| 135 | 4. DM Firmware: |
| 136 | Tree: git://git.ti.com/processor-firmware/ti-linux-firmware.git |
| 137 | Branch: ti-linux-firmware |
| 138 | |
| 139 | 5. U-Boot: |
| 140 | Tree: https://source.denx.de/u-boot/u-boot |
| 141 | Branch: master |
| 142 | |
| 143 | Build procedure: |
| 144 | ---------------- |
| 145 | 1. SYSFW: |
| 146 | |
| 147 | .. code-block:: bash |
| 148 | |
| 149 | make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- SOC=j7200 SBL=u-boot-spl.bin SYSFW_PATH=<path to sysfw>/ti-fs-firmware-j7200-gp.bin |
| 150 | u-boot-spl.bin is generated at step 4. |
| 151 | |
| 152 | 2. ATF: |
| 153 | |
| 154 | .. code-block:: bash |
| 155 | |
| 156 | make CROSS_COMPILE=aarch64-linux-gnu- ARCH=aarch64 PLAT=k3 TARGET_BOARD=generic SPD=opteed |
| 157 | |
| 158 | 3. OPTEE: |
| 159 | |
| 160 | .. code-block:: bash |
| 161 | |
| 162 | make PLATFORM=k3-j7200 CFG_ARM64_core=y |
| 163 | |
| 164 | 4. U-Boot: |
| 165 | |
| 166 | * 4.1 R5: |
| 167 | |
| 168 | .. code-block:: bash |
| 169 | |
| 170 | make CROSS_COMPILE=arm-linux-gnueabihf- j7200_evm_r5_defconfig O=build/r5 |
| 171 | make CROSS_COMPILE=arm-linux-gnueabihf- O=build/r5 |
| 172 | |
| 173 | * 4.2 A72: |
| 174 | |
| 175 | .. code-block:: bash |
| 176 | |
| 177 | make CROSS_COMPILE=aarch64-linux-gnu- j7200_evm_a72_defconfig O=build/a72 |
| 178 | make CROSS_COMPILE=aarch64-linux-gnu- ATF=<ATF dir>/build/k3/generic/release/bl31.bin TEE=<OPTEE OS dir>/out/arm-plat-k3/core/tee-pager_v2.bin DM=<DM firmware>/ti-dm/j7200/ipc_echo_testb_mcu1_0_release_strip.xer5f O=build/a72 |
| 179 | |
| 180 | Target Images |
| 181 | -------------- |
| 182 | Copy the below images to an SD card and boot: |
| 183 | - tiboot3.bin from step 1 |
| 184 | - tispl.bin, u-boot.img from 4.2 |
| 185 | |
| 186 | Image formats: |
| 187 | -------------- |
| 188 | |
| 189 | - tiboot3.bin: |
| 190 | |
| 191 | .. code-block:: console |
| 192 | |
| 193 | +-----------------------+ |
| 194 | | X.509 | |
| 195 | | Certificate | |
| 196 | | +-------------------+ | |
| 197 | | | | | |
| 198 | | | R5 | | |
| 199 | | | u-boot-spl.bin | | |
| 200 | | | | | |
| 201 | | +-------------------+ | |
| 202 | | | | | |
| 203 | | | FIT header | | |
| 204 | | | +---------------+ | | |
| 205 | | | | | | | |
| 206 | | | | DTB 1...N | | | |
| 207 | | | +---------------+ | | |
| 208 | | +-------------------+ | |
| 209 | | | | | |
| 210 | | | FIT HEADER | | |
| 211 | | | +---------------+ | | |
| 212 | | | | | | | |
| 213 | | | | sysfw.bin | | | |
| 214 | | | +---------------+ | | |
| 215 | | | | | | | |
| 216 | | | | board config | | | |
| 217 | | | +---------------+ | | |
| 218 | | | | | | | |
| 219 | | | | PM config | | | |
| 220 | | | +---------------+ | | |
| 221 | | | | | | | |
| 222 | | | | RM config | | | |
| 223 | | | +---------------+ | | |
| 224 | | | | | | | |
| 225 | | | | Secure config | | | |
| 226 | | | +---------------+ | | |
| 227 | | +-------------------+ | |
| 228 | +-----------------------+ |
| 229 | |
| 230 | - tispl.bin |
| 231 | |
| 232 | .. code-block:: console |
| 233 | |
| 234 | +-----------------------+ |
| 235 | | | |
| 236 | | FIT HEADER | |
| 237 | | +-------------------+ | |
| 238 | | | | | |
| 239 | | | A72 ATF | | |
| 240 | | +-------------------+ | |
| 241 | | | | | |
| 242 | | | A72 OPTEE | | |
| 243 | | +-------------------+ | |
| 244 | | | | | |
| 245 | | | R5 DM FW | | |
| 246 | | +-------------------+ | |
| 247 | | | | | |
| 248 | | | A72 SPL | | |
| 249 | | +-------------------+ | |
| 250 | | | | | |
| 251 | | | SPL DTB 1...N | | |
| 252 | | +-------------------+ | |
| 253 | +-----------------------+ |
| 254 | |
| 255 | |
| 256 | Switch Setting for Boot Mode |
| 257 | ---------------------------- |
| 258 | |
| 259 | Boot Mode pins provide means to select the boot mode and options before the |
| 260 | device is powered up. After every POR, they are the main source to populate |
| 261 | the Boot Parameter Tables. |
| 262 | |
| 263 | The following table shows some common boot modes used on J7200 platform. More |
| 264 | details can be found in the Technical Reference Manual: |
| 265 | https://www.ti.com/lit/pdf/spruiu1 under the `Boot Mode Pins` section. |
| 266 | |
| 267 | |
| 268 | *Boot Modes* |
| 269 | |
| 270 | ============ ============= ============= |
| 271 | Switch Label SW9: 12345678 SW8: 12345678 |
| 272 | ============ ============= ============= |
| 273 | SD 00000000 10000010 |
| 274 | EMMC 01000000 10000000 |
| 275 | OSPI 01000000 00000110 |
| 276 | UART 01110000 00000000 |
| 277 | USB DFU 00100000 10000000 |
| 278 | ============ ============= ============= |
| 279 | |
| 280 | For SW8 and SW9, the switch state in the "ON" position = 1. |
| 281 | |
| 282 | eMMC: |
| 283 | ----- |
| 284 | ROM supports booting from eMMC raw read or UDA FS mode. |
| 285 | |
| 286 | Below is memory layout in case of booting from |
| 287 | boot 0/1 partition in raw mode. |
| 288 | |
| 289 | Current allocated size for tiboot3 size is 1MB, tispl is 2MB. |
| 290 | |
| 291 | Size of u-boot.img is taken 4MB for refernece, |
| 292 | But this is subject to change depending upon atf, optee size |
| 293 | |
| 294 | .. code-block:: console |
| 295 | |
| 296 | boot0/1 partition (8 MB) user partition |
| 297 | 0x0+----------------------------------+ 0x0+------------------------+ |
| 298 | | tiboot3.bin (1 MB) | | | |
| 299 | 0x800+----------------------------------+ | | |
| 300 | | tispl.bin (2 MB) | | | |
| 301 | 0x1800+----------------------------------+ | | |
| 302 | | u-boot.img (4MB) | | | |
| 303 | 0x3800+----------------------------------+ | | |
| 304 | | | | | |
| 305 | 0x3900+ environment | | | |
| 306 | | | | | |
| 307 | 0x3A00+----------------------------------+ +-------------------------+ |
| 308 | |
| 309 | In case of UDA FS mode booting, following is layout. |
| 310 | |
| 311 | All boot images tiboot3.bin, tispl and u-boot should be written to |
| 312 | fat formatted UDA FS as file. |
| 313 | |
| 314 | .. code-block:: console |
| 315 | |
| 316 | boot0/1 partition (8 MB) user partition |
| 317 | 0x0+---------------------------------+ 0x0+-------------------------+ |
| 318 | | | | tiboot3.bin* | |
| 319 | 0x800+----------------------------------+ | | |
| 320 | | | | tispl.bin | |
| 321 | 0x1800+----------------------------------+ | | |
| 322 | | | | u-boot.img | |
| 323 | 0x3800+----------------------------------+ | | |
| 324 | | | | | |
| 325 | 0x3900+ | | environment | |
| 326 | | | | | |
| 327 | 0x3A00+----------------------------------+ +-------------------------+ |
| 328 | |
| 329 | |
| 330 | |
| 331 | In case of booting from eMMC, write above images into raw or UDA FS. |
| 332 | and set mmc partconf accordingly. |