xref: /arm-trusted-firmware/docs/plat/rcar-gen3.rst (revision 91f16700b400a8c0651d24a598fc48ee2997a0d7)
1*91f16700SchasingluluRenesas R-Car
2*91f16700Schasinglulu=============
3*91f16700Schasinglulu
4*91f16700Schasinglulu"R-Car" is the nickname for Renesas' system-on-chip (SoC) family for
5*91f16700Schasinglulucar information systems designed for the next-generation of automotive
6*91f16700Schasinglulucomputing for the age of autonomous vehicles.
7*91f16700Schasinglulu
8*91f16700SchasingluluThe scalable R-Car hardware platform and flexible software platform
9*91f16700Schasinglulucover the full product range, from the premium class to the entry
10*91f16700Schasinglululevel. Plug-ins are available for multiple open-source software tools.
11*91f16700Schasinglulu
12*91f16700Schasinglulu
13*91f16700SchasingluluRenesas R-Car Gen3 evaluation boards:
14*91f16700Schasinglulu-------------------------------------
15*91f16700Schasinglulu
16*91f16700Schasinglulu+------------+-----------------+-----------------------------+
17*91f16700Schasinglulu|            |     Standard    |   Low Cost Boards (LCB)     |
18*91f16700Schasinglulu+============+=================+=============================+
19*91f16700Schasinglulu| R-Car H3   | - Salvator-X    | - R-Car Starter Kit Premier |
20*91f16700Schasinglulu|            | - Salvator-XS   |                             |
21*91f16700Schasinglulu+------------+-----------------+-----------------------------+
22*91f16700Schasinglulu| R-Car M3-W | - Salvator-X    |                             |
23*91f16700Schasinglulu|            | - Salvator-XS   | - R-Car Starter Kit Pro     |
24*91f16700Schasinglulu+------------+-----------------+-----------------------------+
25*91f16700Schasinglulu| R-Car M3-N | - Salvator-X    |                             |
26*91f16700Schasinglulu|            | - Salvator-XS   |                             |
27*91f16700Schasinglulu+------------+-----------------+-----------------------------+
28*91f16700Schasinglulu| R-Car V3M  | - Eagle         | - Starter Kit               |
29*91f16700Schasinglulu+------------+-----------------+-----------------------------+
30*91f16700Schasinglulu| R-Car V3H  | - Condor        | - Starter Kit               |
31*91f16700Schasinglulu+------------+-----------------+-----------------------------+
32*91f16700Schasinglulu| R-Car D3   | - Draak         |                             |
33*91f16700Schasinglulu+------------+-----------------+-----------------------------+
34*91f16700Schasinglulu
35*91f16700Schasinglulu`boards info <https://elinux.org/R-Car>`__
36*91f16700Schasinglulu
37*91f16700SchasingluluThe current TF-A port has been tested on the R-Car H3 Salvator-X
38*91f16700SchasingluluSoc_id r8a7795 revision ES1.1 (uses a Secure Payload Dispatcher)
39*91f16700Schasinglulu
40*91f16700Schasinglulu
41*91f16700Schasinglulu::
42*91f16700Schasinglulu
43*91f16700Schasinglulu    ARM CA57 (ARMv8) 1.5 GHz quad core, with NEON/VFPv4, L1$ I/D
44*91f16700Schasinglulu    48K/32K, L2$ 2MB
45*91f16700Schasinglulu    ARM CA53 (ARMv8) 1.2 GHz quad core, with NEON/VFPv4, L1$ I/D 32K/32K,
46*91f16700Schasinglulu    L2$ 512K
47*91f16700Schasinglulu    Memory controller for LPDDR4-3200 4GB in 2 channels, each 64-bit wide
48*91f16700Schasinglulu    Two- and three-dimensional graphics engines,
49*91f16700Schasinglulu    Video processing units,
50*91f16700Schasinglulu    3 channels Display Output,
51*91f16700Schasinglulu    6 channels Video Input,
52*91f16700Schasinglulu    SD card host interface,
53*91f16700Schasinglulu    USB3.0 and USB2.0 interfaces,
54*91f16700Schasinglulu    CAN interfaces
55*91f16700Schasinglulu    Ethernet AVB
56*91f16700Schasinglulu    PCI Express Interfaces
57*91f16700Schasinglulu    Memories
58*91f16700Schasinglulu        INTERNAL 384KB SYSTEM RAM
59*91f16700Schasinglulu        DDR 4 GB LPDDR4
60*91f16700Schasinglulu        HYPERFLASH 64 MB HYPER FLASH (512 MBITS, 160 MHZ, 320 MBYTES/S)
61*91f16700Schasinglulu        QSPI FLASH 16MB QSPI (128 MBITS,80 MHZ,80 MBYTES/S)1 HEADER QSPI
62*91f16700Schasinglulu        MODULE
63*91f16700Schasinglulu        EMMC 32 GB EMMC (HS400 240 MBYTES/S)
64*91f16700Schasinglulu        MICROSD-CARD SLOT (SDR104 100 MBYTES/S)
65*91f16700Schasinglulu
66*91f16700Schasinglulu
67*91f16700SchasingluluOverview
68*91f16700Schasinglulu--------
69*91f16700SchasingluluOn the rcar-gen3 the BOOTROM starts the cpu at EL3; for this port BL2
70*91f16700Schasingluluwill therefore be entered at this exception level (the Renesas' ATF
71*91f16700Schasinglulureference tree [1] resets into EL1 before entering BL2 - see its
72*91f16700Schasinglulubl2.ld.S)
73*91f16700Schasinglulu
74*91f16700SchasingluluBL2 initializes DDR (and on some platforms i2c to interface to the
75*91f16700SchasingluluPMIC) before determining the boot reason (cold or warm).
76*91f16700Schasinglulu
77*91f16700SchasingluluDuring suspend all CPUs are switched off and the DDR is put in backup
78*91f16700Schasinglulumode (some kind of self-refresh mode). This means that BL2 is always
79*91f16700Schasingluluentered in a cold boot scenario.
80*91f16700Schasinglulu
81*91f16700SchasingluluOnce BL2 boots, it determines the boot reason, writes it to shared
82*91f16700Schasinglulumemory (BOOT_KIND_BASE) together with the BL31 parameters
83*91f16700Schasinglulu(PARAMS_BASE) and jumps to BL31.
84*91f16700Schasinglulu
85*91f16700SchasingluluTo all effects, BL31 is as if it is being entered in reset mode since
86*91f16700Schasingluluit still needs to initialize the rest of the cores; this is the reason
87*91f16700Schasinglulubehind using direct shared memory access to  BOOT_KIND_BASE _and_
88*91f16700SchasingluluPARAMS_BASE instead of using registers to get to those locations (see
89*91f16700Schasingluluel3_common_macros.S and bl31_entrypoint.S for the RESET_TO_BL31 use
90*91f16700Schasinglulucase).
91*91f16700Schasinglulu
92*91f16700SchasingluluDepending on the boot reason BL31 initializes the rest of the cores:
93*91f16700Schasingluluin case of suspend, it uses a MBOX memory region to recover the
94*91f16700Schasingluluprogram counters.
95*91f16700Schasinglulu
96*91f16700Schasinglulu[1] https://github.com/renesas-rcar/arm-trusted-firmware
97*91f16700Schasinglulu
98*91f16700Schasinglulu
99*91f16700SchasingluluHow to build
100*91f16700Schasinglulu------------
101*91f16700Schasinglulu
102*91f16700SchasingluluThe TF-A build options depend on the target board so you will have to
103*91f16700Schasinglulurefer to those specific instructions. What follows is customized to
104*91f16700Schasingluluthe H3 SiP Salvator-X development system used in this port.
105*91f16700Schasinglulu
106*91f16700SchasingluluBuild Tested:
107*91f16700Schasinglulu~~~~~~~~~~~~~
108*91f16700SchasingluluRCAR_OPT="LSI=H3 RCAR_DRAM_SPLIT=1 RCAR_LOSSY_ENABLE=1"
109*91f16700SchasingluluMBEDTLS_DIR=$mbedtls_src
110*91f16700Schasinglulu
111*91f16700Schasinglulu$ MBEDTLS_DIR=$mbedtls_src_tree make clean bl2 bl31 rcar_layout_tool \
112*91f16700SchasingluluPLAT=rcar ${RCAR_OPT} SPD=opteed
113*91f16700Schasinglulu
114*91f16700SchasingluluSystem Tested:
115*91f16700Schasinglulu~~~~~~~~~~~~~~
116*91f16700Schasinglulu* mbed_tls:
117*91f16700Schasinglulu  git@github.com:ARMmbed/mbedtls.git [devel]
118*91f16700Schasinglulu
119*91f16700Schasinglulu  commit 552754a6ee82bab25d1bdf28c8261a4518e65e4d
120*91f16700Schasinglulu  Merge: 68dbc94 f34a4c1
121*91f16700Schasinglulu  Author: Simon Butcher <simon.butcher@arm.com>
122*91f16700Schasinglulu  Date:   Thu Aug 30 00:57:28 2018 +0100
123*91f16700Schasinglulu
124*91f16700Schasinglulu* optee_os:
125*91f16700Schasinglulu  https://github.com/BayLibre/optee_os
126*91f16700Schasinglulu
127*91f16700Schasinglulu  Until it gets merged into OP-TEE, the port requires Renesas'
128*91f16700Schasinglulu  Trusted   Environment with a modification to support power
129*91f16700Schasinglulu  management.
130*91f16700Schasinglulu  commit 80105192cba9e704ebe8df7ab84095edc2922f84
131*91f16700Schasinglulu
132*91f16700Schasinglulu  Author: Jorge Ramirez-Ortiz <jramirez@baylibre.com>
133*91f16700Schasinglulu  Date:   Thu Aug 30 16:49:49 2018 +0200
134*91f16700Schasinglulu  plat-rcar: cpu-suspend: handle the power level
135*91f16700Schasinglulu  Signed-off-by: Jorge Ramirez-Ortiz <jramirez@baylibre.com>
136*91f16700Schasinglulu
137*91f16700Schasinglulu* u-boot:
138*91f16700Schasinglulu  The port has beent tested using mainline uboot.
139*91f16700Schasinglulu
140*91f16700Schasinglulu  commit 4cdeda511f8037015b568396e6dcc3d8fb41e8c0
141*91f16700Schasinglulu  Author: Fabio Estevam <festevam@gmail.com>
142*91f16700Schasinglulu  Date:   Tue Sep 4 10:23:12 2018 -0300
143*91f16700Schasinglulu
144*91f16700Schasinglulu* linux:
145*91f16700Schasinglulu  The port has beent tested using mainline kernel.
146*91f16700Schasinglulu
147*91f16700Schasinglulu  commit 7876320f88802b22d4e2daf7eb027dd14175a0f8
148*91f16700Schasinglulu  Author: Linus Torvalds <torvalds@linux-foundation.org>
149*91f16700Schasinglulu  Date:   Sun Sep 16 11:52:37 2018 -0700
150*91f16700Schasinglulu  Linux 4.19-rc4
151*91f16700Schasinglulu
152*91f16700SchasingluluTF-A Build Procedure
153*91f16700Schasinglulu~~~~~~~~~~~~~~~~~~~~
154*91f16700Schasinglulu
155*91f16700Schasinglulu-  Fetch all the above 4 repositories.
156*91f16700Schasinglulu
157*91f16700Schasinglulu-  Prepare the AARCH64 toolchain.
158*91f16700Schasinglulu
159*91f16700Schasinglulu-  Build u-boot using r8a7795_salvator-x_defconfig.
160*91f16700Schasinglulu   Result: u-boot-elf.srec
161*91f16700Schasinglulu
162*91f16700Schasinglulu.. code:: bash
163*91f16700Schasinglulu
164*91f16700Schasinglulu       make CROSS_COMPILE=aarch64-linux-gnu-
165*91f16700Schasinglulu	  r8a7795_salvator-x_defconfig
166*91f16700Schasinglulu
167*91f16700Schasinglulu       make CROSS_COMPILE=aarch64-linux-gnu-
168*91f16700Schasinglulu
169*91f16700Schasinglulu-  Build atf
170*91f16700Schasinglulu   Result: bootparam_sa0.srec, cert_header_sa6.srec, bl2.srec, bl31.srec
171*91f16700Schasinglulu
172*91f16700Schasinglulu.. code:: bash
173*91f16700Schasinglulu
174*91f16700Schasinglulu       RCAR_OPT="LSI=H3 RCAR_DRAM_SPLIT=1 RCAR_LOSSY_ENABLE=1"
175*91f16700Schasinglulu
176*91f16700Schasinglulu       MBEDTLS_DIR=$mbedtls_src_tree make clean bl2 bl31 rcar \
177*91f16700Schasinglulu       PLAT=rcar ${RCAR_OPT} SPD=opteed
178*91f16700Schasinglulu
179*91f16700Schasinglulu-  Build optee-os
180*91f16700Schasinglulu   Result: tee.srec
181*91f16700Schasinglulu
182*91f16700Schasinglulu.. code:: bash
183*91f16700Schasinglulu
184*91f16700Schasinglulu       make -j8 PLATFORM="rcar" CFG_ARM64_core=y
185*91f16700Schasinglulu
186*91f16700SchasingluluInstall Procedure
187*91f16700Schasinglulu~~~~~~~~~~~~~~~~~
188*91f16700Schasinglulu
189*91f16700Schasinglulu- Boot the board in Mini-monitor mode and enable access to the
190*91f16700Schasinglulu  Hyperflash.
191*91f16700Schasinglulu
192*91f16700Schasinglulu
193*91f16700Schasinglulu- Use the XSL2 Mini-monitor utility to accept all the SREC ascii
194*91f16700Schasinglulu  transfers over serial.
195*91f16700Schasinglulu
196*91f16700Schasinglulu
197*91f16700SchasingluluBoot trace
198*91f16700Schasinglulu----------
199*91f16700Schasinglulu
200*91f16700SchasingluluNotice that BL31 traces are not accessible via the console and that in
201*91f16700Schasingluluorder to verbose the BL2 output you will have to compile TF-A with
202*91f16700SchasingluluLOG_LEVEL=50 and DEBUG=1
203*91f16700Schasinglulu
204*91f16700Schasinglulu::
205*91f16700Schasinglulu
206*91f16700Schasinglulu   Initial Program Loader(CA57) Rev.1.0.22
207*91f16700Schasinglulu   NOTICE:  BL2: PRR is R-Car H3 Ver.1.1
208*91f16700Schasinglulu   NOTICE:  BL2: Board is Salvator-X Rev.1.0
209*91f16700Schasinglulu   NOTICE:  BL2: Boot device is HyperFlash(80MHz)
210*91f16700Schasinglulu   NOTICE:  BL2: LCM state is CM
211*91f16700Schasinglulu   NOTICE:  AVS setting succeeded. DVFS_SetVID=0x53
212*91f16700Schasinglulu   NOTICE:  BL2: DDR1600(rev.0.33)NOTICE:  [COLD_BOOT]NOTICE:  ..0
213*91f16700Schasinglulu   NOTICE:  BL2: DRAM Split is 4ch
214*91f16700Schasinglulu   NOTICE:  BL2: QoS is default setting(rev.0.37)
215*91f16700Schasinglulu   NOTICE:  BL2: Lossy Decomp areas
216*91f16700Schasinglulu   NOTICE:       Entry 0: DCMPAREACRAx:0x80000540 DCMPAREACRBx:0x570
217*91f16700Schasinglulu   NOTICE:       Entry 1: DCMPAREACRAx:0x40000000 DCMPAREACRBx:0x0
218*91f16700Schasinglulu   NOTICE:       Entry 2: DCMPAREACRAx:0x20000000 DCMPAREACRBx:0x0
219*91f16700Schasinglulu   NOTICE:  BL2: v2.0(release):v2.0-rc0-32-gbcda69a
220*91f16700Schasinglulu   NOTICE:  BL2: Built : 16:41:23, Oct  2 2018
221*91f16700Schasinglulu   NOTICE:  BL2: Normal boot
222*91f16700Schasinglulu   INFO:    BL2: Doing platform setup
223*91f16700Schasinglulu   INFO:    BL2: Loading image id 3
224*91f16700Schasinglulu   NOTICE:  BL2: dst=0xe6322000 src=0x8180000 len=512(0x200)
225*91f16700Schasinglulu   NOTICE:  BL2: dst=0x43f00000 src=0x8180400 len=6144(0x1800)
226*91f16700Schasinglulu   WARNING: r-car ignoring the BL31 size from certificate,using
227*91f16700Schasinglulu   RCAR_TRUSTED_SRAM_SIZE instead
228*91f16700Schasinglulu   INFO:    Loading image id=3 at address 0x44000000
229*91f16700Schasinglulu   NOTICE:  rcar_file_len: len: 0x0003e000
230*91f16700Schasinglulu   NOTICE:  BL2: dst=0x44000000 src=0x81c0000 len=253952(0x3e000)
231*91f16700Schasinglulu   INFO:    Image id=3 loaded: 0x44000000 - 0x4403e000
232*91f16700Schasinglulu   INFO:    BL2: Loading image id 4
233*91f16700Schasinglulu   INFO:    Loading image id=4 at address 0x44100000
234*91f16700Schasinglulu   NOTICE:  rcar_file_len: len: 0x00100000
235*91f16700Schasinglulu   NOTICE:  BL2: dst=0x44100000 src=0x8200000 len=1048576(0x100000)
236*91f16700Schasinglulu   INFO:    Image id=4 loaded: 0x44100000 - 0x44200000
237*91f16700Schasinglulu   INFO:    BL2: Loading image id 5
238*91f16700Schasinglulu   INFO:    Loading image id=5 at address 0x50000000
239*91f16700Schasinglulu   NOTICE:  rcar_file_len: len: 0x00100000
240*91f16700Schasinglulu   NOTICE:  BL2: dst=0x50000000 src=0x8640000 len=1048576(0x100000)
241*91f16700Schasinglulu   INFO:    Image id=5 loaded: 0x50000000 - 0x50100000
242*91f16700Schasinglulu   NOTICE:  BL2: Booting BL31
243*91f16700Schasinglulu   INFO:    Entry point address = 0x44000000
244*91f16700Schasinglulu   INFO:    SPSR = 0x3cd
245*91f16700Schasinglulu   VERBOSE: Argument #0 = 0xe6325578
246*91f16700Schasinglulu   VERBOSE: Argument #1 = 0x0
247*91f16700Schasinglulu   VERBOSE: Argument #2 = 0x0
248*91f16700Schasinglulu   VERBOSE: Argument #3 = 0x0
249*91f16700Schasinglulu   VERBOSE: Argument #4 = 0x0
250*91f16700Schasinglulu   VERBOSE: Argument #5 = 0x0
251*91f16700Schasinglulu   VERBOSE: Argument #6 = 0x0
252*91f16700Schasinglulu   VERBOSE: Argument #7 = 0x0
253*91f16700Schasinglulu
254*91f16700Schasinglulu
255*91f16700Schasinglulu   U-Boot 2018.09-rc3-00028-g3711616 (Sep 27 2018 - 18:50:24 +0200)
256*91f16700Schasinglulu
257*91f16700Schasinglulu   CPU: Renesas Electronics R8A7795 rev 1.1
258*91f16700Schasinglulu   Model: Renesas Salvator-X board based on r8a7795 ES2.0+
259*91f16700Schasinglulu   DRAM:  3.5 GiB
260*91f16700Schasinglulu   Flash: 64 MiB
261*91f16700Schasinglulu   MMC:   sd@ee100000: 0, sd@ee140000: 1, sd@ee160000: 2
262*91f16700Schasinglulu   Loading Environment from MMC... OK
263*91f16700Schasinglulu   In:    serial@e6e88000
264*91f16700Schasinglulu   Out:   serial@e6e88000
265*91f16700Schasinglulu   Err:   serial@e6e88000
266*91f16700Schasinglulu   Net:   eth0: ethernet@e6800000
267*91f16700Schasinglulu   Hit any key to stop autoboot:  0
268*91f16700Schasinglulu   =>
269