blob: 4ca7b00b1fb553298e124b354e90dcccdfb1b965 [file] [log] [blame]
Jagan Teki338b86c2020-01-10 00:16:22 +05301.. SPDX-License-Identifier: GPL-2.0+
2.. Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
3
4ROCKCHIP
5========
6
7About this
8----------
9
10This document describes the information about Rockchip supported boards
11and it's usage steps.
12
13Rockchip boards
14---------------
15
Johan Jonkered33f8c2022-04-16 17:09:50 +020016Rockchip is a SoC solutions provider for tablets & PCs, streaming media
Jagan Teki338b86c2020-01-10 00:16:22 +053017TV boxes, AI audio & vision, IoT hardware.
18
Johan Jonker3ad88ec2021-08-20 19:27:59 +020019A wide range of Rockchip SoCs with associated boards are supported in
Jagan Teki338b86c2020-01-10 00:16:22 +053020mainline U-Boot.
21
Johan Jonker3ad88ec2021-08-20 19:27:59 +020022List of mainline supported Rockchip boards:
Jagan Teki338b86c2020-01-10 00:16:22 +053023
Johan Jonker0c99c6e2022-04-16 17:09:51 +020024* px30
25 - Rockchip Evb-PX30 (evb-px30)
26 - Engicam PX30.Core C.TOUCH 2.0 (px30-core-ctouch2-px30)
27 - Engicam PX30.Core C.TOUCH 2.0 10.1 (px30-core-ctouch2-of10-px30)
28 - Engicam PX30.Core EDIMM2.2 Starter Kit (px30-core-edimm2.2-px30)
29 - Firefly Core-PX30-JD4 (firefly-px30)
Walter Lozanocbd75f62020-05-22 11:14:56 -030030* rk3036
31 - Rockchip Evb-RK3036 (evb-rk3036)
32 - Kylin (kylin_rk3036)
Johan Jonkerc57677b2022-04-16 17:09:52 +020033* rk3066
34 - Rikomagic MK808 (mk808)
Walter Lozanocbd75f62020-05-22 11:14:56 -030035* rk3128
36 - Rockchip Evb-RK3128 (evb-rk3128)
Johan Jonker734dcdc2021-08-20 19:27:58 +020037* rk3188
38 - Radxa Rock (rock)
Walter Lozanocbd75f62020-05-22 11:14:56 -030039* rk3229
40 - Rockchip Evb-RK3229 (evb-rk3229)
Jagan Teki338b86c2020-01-10 00:16:22 +053041* rk3288
Walter Lozano22186f32020-05-22 11:14:55 -030042 - Rockchip Evb-RK3288 (evb-rk3288)
43 - Firefly-RK3288 (firefly-rk3288)
44 - MQmaker MiQi (miqi-rk3288)
45 - Phytec RK3288 PCM-947 (phycore-rk3288)
46 - PopMetal-RK3288 (popmetal-rk3288)
47 - Radxa Rock 2 Square (rock2)
48 - Tinker-RK3288 (tinker-rk3288)
49 - Google Jerry (chromebook_jerry)
50 - Google Mickey (chromebook_mickey)
51 - Google Minnie (chromebook_minnie)
52 - Google Speedy (chromebook_speedy)
53 - Amarula Vyasa-RK3288 (vyasa-rk3288)
Walter Lozanocbd75f62020-05-22 11:14:56 -030054* rk3308
55 - Rockchip Evb-RK3308 (evb-rk3308)
56 - Roc-cc-RK3308 (roc-cc-rk3308)
Johan Jonker0c99c6e2022-04-16 17:09:51 +020057* rk3326
58 - ODROID-GO Advance (odroid-go2)
Jagan Teki338b86c2020-01-10 00:16:22 +053059* rk3328
Walter Lozano22186f32020-05-22 11:14:55 -030060 - Rockchip Evb-RK3328 (evb-rk3328)
61 - Pine64 Rock64 (rock64-rk3328)
Walter Lozanocbd75f62020-05-22 11:14:56 -030062 - Firefly-RK3328 (roc-cc-rk3328)
b.l.huangd9c34172020-06-01 00:02:11 +080063 - Radxa Rockpi E (rock-pi-e-rk3328)
Jagan Teki338b86c2020-01-10 00:16:22 +053064* rk3368
Walter Lozano22186f32020-05-22 11:14:55 -030065 - GeekBox (geekbox)
66 - PX5 EVB (evb-px5)
67 - Rockchip Sheep (sheep-rk3368)
68 - Theobroma Systems RK3368-uQ7 SoM - Lion (lion-rk3368)
Jagan Teki338b86c2020-01-10 00:16:22 +053069* rk3399
Walter Lozano22186f32020-05-22 11:14:55 -030070 - 96boards RK3399 Ficus (ficus-rk3399)
71 - 96boards Rock960 (rock960-rk3399)
72 - Firefly-RK3399 (firefly_rk3399)
73 - Firefly ROC-RK3399-PC
74 - FriendlyElec NanoPC-T4 (nanopc-t4-rk3399)
75 - FriendlyElec NanoPi M4 (nanopi-m4-rk3399)
Alexandre Vicenzia99d70c2021-03-26 13:37:10 +010076 - FriendlyElec NanoPi M4B (nanopi-m4b-rk3399)
Walter Lozano22186f32020-05-22 11:14:55 -030077 - FriendlyARM NanoPi NEO4 (nanopi-neo4-rk3399)
78 - Google Bob (chromebook_bob)
Marty E. Plummer6d36e922021-12-24 16:43:46 +030079 - Google Kevin (chromebook_kevin)
Walter Lozano22186f32020-05-22 11:14:55 -030080 - Khadas Edge (khadas-edge-rk3399)
81 - Khadas Edge-Captain (khadas-edge-captain-rk3399)
82 - Khadas Edge-V (hadas-edge-v-rk3399)
83 - Orange Pi RK3399 (orangepi-rk3399)
84 - Pine64 RockPro64 (rockpro64-rk3399)
85 - Radxa ROCK Pi 4 (rock-pi-4-rk3399)
86 - Rockchip Evb-RK3399 (evb_rk3399)
87 - Theobroma Systems RK3399-Q7 SoM - Puma (puma_rk3399)
Walter Lozanocbd75f62020-05-22 11:14:56 -030088* rv1108
89 - Rockchip Evb-rv1108 (evb-rv1108)
90 - Elgin-R1 (elgin-rv1108)
Jagan Teki338b86c2020-01-10 00:16:22 +053091
92Building
93--------
94
95TF-A
96^^^^
97
Johan Jonkered33f8c2022-04-16 17:09:50 +020098TF-A is required when building ARM64 Rockchip SoCs images.
Jagan Teki338b86c2020-01-10 00:16:22 +053099
Johan Jonkered33f8c2022-04-16 17:09:50 +0200100To build TF-A:
Jagan Teki338b86c2020-01-10 00:16:22 +0530101
Johan Jonkered33f8c2022-04-16 17:09:50 +0200102.. code-block:: bash
103
104 git clone --depth 1 https://github.com/ARM-software/arm-trusted-firmware.git
Jagan Teki338b86c2020-01-10 00:16:22 +0530105 cd arm-trusted-firmware
106 make realclean
107 make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399
Johan Jonkered33f8c2022-04-16 17:09:50 +0200108 cd ..
Jagan Teki338b86c2020-01-10 00:16:22 +0530109
Johan Jonker3ad88ec2021-08-20 19:27:59 +0200110Specify the PLAT= with desired Rockchip platform to build TF-A for.
Jagan Teki338b86c2020-01-10 00:16:22 +0530111
112U-Boot
113^^^^^^
114
Johan Jonkered33f8c2022-04-16 17:09:50 +0200115.. code-block:: bash
Jagan Teki338b86c2020-01-10 00:16:22 +0530116
Johan Jonkered33f8c2022-04-16 17:09:50 +0200117 git clone --depth 1 https://source.denx.de/u-boot/u-boot.git
118 cd u-boot
Jagan Teki338b86c2020-01-10 00:16:22 +0530119
Johan Jonker0c99c6e2022-04-16 17:09:51 +0200120To build px30 boards:
121
122.. code-block:: bash
123
124 export BL31=../arm-trusted-firmware/build/px30/release/bl31/bl31.elf
125 make evb-px30_defconfig
126 make CROSS_COMPILE=aarch64-linux-gnu-
127
Johan Jonkerc57677b2022-04-16 17:09:52 +0200128To build rk3066 boards:
129
130.. code-block:: bash
131
132 make mk808_defconfig
133 make CROSS_COMPILE=arm-linux-gnueabihf-
134
Johan Jonkered33f8c2022-04-16 17:09:50 +0200135To build rk3288 boards:
136
137.. code-block:: bash
Jagan Teki338b86c2020-01-10 00:16:22 +0530138
139 make evb-rk3288_defconfig
Johan Jonkered33f8c2022-04-16 17:09:50 +0200140 make CROSS_COMPILE=arm-linux-gnueabihf-
Jagan Teki338b86c2020-01-10 00:16:22 +0530141
Johan Jonkered33f8c2022-04-16 17:09:50 +0200142To build rk3328 boards:
Jagan Teki338b86c2020-01-10 00:16:22 +0530143
Johan Jonkered33f8c2022-04-16 17:09:50 +0200144.. code-block:: bash
145
146 export BL31=../arm-trusted-firmware/build/rk3328/release/bl31/bl31.elf
147 make evb-rk3328_defconfig
148 make CROSS_COMPILE=aarch64-linux-gnu-
149
150To build rk3368 boards:
151
152.. code-block:: bash
153
154 export BL31=../arm-trusted-firmware/build/rk3368/release/bl31/bl31.elf
Jagan Teki338b86c2020-01-10 00:16:22 +0530155 make evb-px5_defconfig
Johan Jonkered33f8c2022-04-16 17:09:50 +0200156 make CROSS_COMPILE=aarch64-linux-gnu-
Jagan Teki338b86c2020-01-10 00:16:22 +0530157
Johan Jonkered33f8c2022-04-16 17:09:50 +0200158To build rk3399 boards:
Jagan Teki338b86c2020-01-10 00:16:22 +0530159
Johan Jonkered33f8c2022-04-16 17:09:50 +0200160.. code-block:: bash
161
162 export BL31=../arm-trusted-firmware/build/rk3399/release/bl31/bl31.elf
Jagan Teki338b86c2020-01-10 00:16:22 +0530163 make evb-rk3399_defconfig
Johan Jonkered33f8c2022-04-16 17:09:50 +0200164 make CROSS_COMPILE=aarch64-linux-gnu-
Jagan Teki338b86c2020-01-10 00:16:22 +0530165
166Flashing
167--------
168
Jagan Teki43ed7a02020-10-28 19:03:48 +05301691. Package the image with U-Boot TPL/SPL
170-----------------------------------------
171
Jagan Teki338b86c2020-01-10 00:16:22 +0530172SD Card
173^^^^^^^
174
Johan Jonkered33f8c2022-04-16 17:09:50 +0200175All Rockchip platforms (except rk3128 which doesn't use SPL) are now
176supporting a single boot image using binman and pad_cat.
Jagan Teki338b86c2020-01-10 00:16:22 +0530177
Johan Jonkered33f8c2022-04-16 17:09:50 +0200178To write an image that boots from a SD card (assumed to be /dev/sda):
179
180.. code-block:: bash
Jagan Teki338b86c2020-01-10 00:16:22 +0530181
182 sudo dd if=u-boot-rockchip.bin of=/dev/sda seek=64
183 sync
184
Jagan Teki7e013632020-05-24 23:02:13 +0530185eMMC
186^^^^
187
Johan Jonker3ad88ec2021-08-20 19:27:59 +0200188eMMC flash would probe on mmc0 in most of the Rockchip platforms.
Jagan Teki7e013632020-05-24 23:02:13 +0530189
Johan Jonkered33f8c2022-04-16 17:09:50 +0200190Create GPT partition layout as defined in $partitions:
191
192.. code-block:: bash
Jagan Teki7e013632020-05-24 23:02:13 +0530193
194 mmc dev 0
195 gpt write mmc 0 $partitions
196
Johan Jonkered33f8c2022-04-16 17:09:50 +0200197Connect the USB-OTG cable between the host and a target device.
Jagan Teki7e013632020-05-24 23:02:13 +0530198
Johan Jonkered33f8c2022-04-16 17:09:50 +0200199Launch fastboot on the target with:
200
201.. code-block:: bash
Jagan Teki7e013632020-05-24 23:02:13 +0530202
203 fastboot 0
204
Johan Jonkered33f8c2022-04-16 17:09:50 +0200205Upon a successful gadget connection the host shows the USB device with:
206
207.. code-block:: bash
Jagan Teki7e013632020-05-24 23:02:13 +0530208
209 lsusb
Johan Jonkered33f8c2022-04-16 17:09:50 +0200210 # Bus 001 Device 020: ID 2207:330c Fuzhou Rockchip Electronics Company RK3399 in Mask ROM mode
Jagan Teki7e013632020-05-24 23:02:13 +0530211
Johan Jonkered33f8c2022-04-16 17:09:50 +0200212Program the flash with:
213
214.. code-block:: bash
Jagan Teki7e013632020-05-24 23:02:13 +0530215
216 sudo fastboot -i 0x2207 flash loader1 idbloader.img
217 sudo fastboot -i 0x2207 flash loader2 u-boot.itb
218
Johan Jonkered33f8c2022-04-16 17:09:50 +0200219Note:
220
221For Rockchip 32-bit platforms the U-Boot proper image
Jagan Teki7e013632020-05-24 23:02:13 +0530222is u-boot-dtb.img
223
Jagan Tekidd397602020-06-04 20:21:41 +0530224SPI
225^^^
226
Johan Jonkered33f8c2022-04-16 17:09:50 +0200227The SPI boot method requires the generation of idbloader.img with help of the mkimage tool.
Jagan Tekidd397602020-06-04 20:21:41 +0530228
Johan Jonkered33f8c2022-04-16 17:09:50 +0200229SPL-alone SPI boot image:
230
231.. code-block:: bash
Jagan Tekidd397602020-06-04 20:21:41 +0530232
233 ./tools/mkimage -n rk3399 -T rkspi -d spl/u-boot-spl.bin idbloader.img
234
Johan Jonkered33f8c2022-04-16 17:09:50 +0200235TPL+SPL SPI boot image:
236
237.. code-block:: bash
Jagan Tekidd397602020-06-04 20:21:41 +0530238
239 ./tools/mkimage -n rk3399 -T rkspi -d tpl/u-boot-tpl.bin:spl/u-boot-spl.bin idbloader.img
240
Johan Jonkered33f8c2022-04-16 17:09:50 +0200241Copy SPI boot images into SD card and boot from SD:
242
243.. code-block:: bash
Jagan Tekidd397602020-06-04 20:21:41 +0530244
245 sf probe
246 load mmc 1:1 $kernel_addr_r idbloader.img
247 sf erase 0 +$filesize
248 sf write $kernel_addr_r 0 ${filesize}
249 load mmc 1:1 ${kernel_addr_r} u-boot.itb
250 sf erase 0x60000 +$filesize
251 sf write $kernel_addr_r 0x60000 ${filesize}
252
Jagan Teki43ed7a02020-10-28 19:03:48 +05302532. Package the image with Rockchip miniloader
254---------------------------------------------
255
Johan Jonkered33f8c2022-04-16 17:09:50 +0200256Image package with Rockchip miniloader requires rkbin [1].
Jagan Teki43ed7a02020-10-28 19:03:48 +0530257
Johan Jonkered33f8c2022-04-16 17:09:50 +0200258.. code-block:: bash
Jagan Teki43ed7a02020-10-28 19:03:48 +0530259
Johan Jonkered33f8c2022-04-16 17:09:50 +0200260 cd ..
261 git clone --depth 1 https://github.com/rockchip-linux/rkbin
Jagan Teki43ed7a02020-10-28 19:03:48 +0530262
Johan Jonkered33f8c2022-04-16 17:09:50 +0200263Create idbloader.img:
Jagan Teki43ed7a02020-10-28 19:03:48 +0530264
Johan Jonkered33f8c2022-04-16 17:09:50 +0200265.. code-block:: bash
Jagan Teki43ed7a02020-10-28 19:03:48 +0530266
Johan Jonkered33f8c2022-04-16 17:09:50 +0200267 cd u-boot
268 ./tools/mkimage -n px30 -T rksd -d ../rkbin/bin/rk33/px30_ddr_333MHz_v1.16.bin idbloader.img
269 cat ../rkbin/bin/rk33/px30_miniloader_v1.31.bin >> idbloader.img
270 sudo dd if=idbloader.img of=/dev/sda seek=64
Jagan Teki43ed7a02020-10-28 19:03:48 +0530271
Johan Jonkered33f8c2022-04-16 17:09:50 +0200272Create trust.img:
Jagan Teki43ed7a02020-10-28 19:03:48 +0530273
Johan Jonkered33f8c2022-04-16 17:09:50 +0200274.. code-block:: bash
Jagan Teki43ed7a02020-10-28 19:03:48 +0530275
Johan Jonkered33f8c2022-04-16 17:09:50 +0200276 cd ../rkbin
277 ./tools/trust_merger RKTRUST/PX30TRUST.ini
278 sudo dd if=trust.img of=/dev/sda seek=24576
Jagan Teki43ed7a02020-10-28 19:03:48 +0530279
Johan Jonkered33f8c2022-04-16 17:09:50 +0200280Create uboot.img [2]:
281
282.. code-block:: bash
283
284 cd ../u-boot
285 ../rkbin/tools/loaderimage --pack --uboot u-boot-dtb.bin uboot.img 0x200000
286 sudo dd if=uboot.img of=/dev/sda seek=16384
Jagan Teki43ed7a02020-10-28 19:03:48 +0530287
288Note:
Johan Jonkered33f8c2022-04-16 17:09:50 +0200289
2901. rkbin binaries are regularly updated, so it would be recommended to use the latest version.
2912. 0x200000 is a load address and is an option for some platforms.
Jagan Teki43ed7a02020-10-28 19:03:48 +0530292
Johan Jonkerc57677b2022-04-16 17:09:52 +02002933. Package the RK3066 image with U-Boot TPL/SPL on NAND
294-------------------------------------------------------
295
296Unlike later SoC models the rk3066 BootROM doesn't have SDMMC support.
297If all other boot options fail then it enters into a BootROM mode on the USB OTG port.
298This method loads TPL/SPL on NAND with U-boot and kernel on SD card.
299
300SD Card
301^^^^^^^
302
303U-boot expects a GPT partition map and a boot directory structure with files on the SD card.
304
305.. code-block:: none
306
307 Partition Map for MMC device 0 -- Partition Type: EFI
308 Part Start LBA End LBA Name
309 1 0x00000040 0x00001f7f "loader1"
310 2 0x00004000 0x00005fff "loader2"
311 3 0x00006000 0x00007fff "trust"
312 4 0x00008000 0x0003ffff "boot"
313 5 0x00040000 0x00ed7fde "rootfs"
314
315Make sure boot and esp flag are set for the boot partition.
316Loader1 partition is not used by RK3066.
317
318Boot partition:
319
320.. code-block:: none
321
322 extlinux
323 extlinux.conf
324
325 zImage
326 rk3066a-mk808.dtb
327
328To write a U-boot image to the SD card (assumed to be /dev/sda):
329
330.. code-block:: bash
331
332 sudo dd if=u-boot-dtb.img of=/dev/sda seek=16384
333 sync
334
335NAND
336^^^^
337
338Bring device in BootROM mode:
339
340If bricked and no BootROM mode shows up then connect pin 8 and 9 of the NAND flash
341with a needle while reconnecting to the USB OTG port to a PC.
342
343Show connected devices with:
344
345.. code-block:: bash
346
347 lsusb
348 # Bus 001 Device 004: ID 2207:300a Fuzhou Rockchip Electronics Company RK3066 in Mask ROM mode
349
350
351Create NAND image:
352
353Size of SPL and TPL must be aligned to 2kb.
354
355Program with commands in a bash script ./flash.sh:
356
357.. code-block:: bash
358
359 #!/bin/sh
360
361 printf "RK30" > tplspl.bin
362 dd if=u-boot-tpl.bin >> tplspl.bin
363 truncate -s %2048 tplspl.bin
364 truncate -s %2048 u-boot-spl.bin
365 ../tools/boot_merger --verbose config-flash.ini
366 ../tools/upgrade_tool ul ./RK30xxLoader_uboot.bin
367
368config-flash.ini:
369
370.. code-block:: none
371
372 [CHIP_NAME]
373 NAME=RK30
374 [VERSION]
375 MAJOR=2
376 MINOR=21
377 [CODE471_OPTION]
378 NUM=1
379 Path1=30_LPDDR2_300MHz_DD.bin
380 [CODE472_OPTION]
381 NUM=1
382 Path1=rk30usbplug.bin
383 [LOADER_OPTION]
384 NUM=2
385 LOADER1=FlashData
386 LOADER2=FlashBoot
387 FlashData=tplspl.bin
388 FlashBoot=u-boot-spl.bin
389 [OUTPUT]
390 PATH=RK30xxLoader_uboot.bin
391
Jagan Teki338b86c2020-01-10 00:16:22 +0530392TODO
393----
394
Johan Jonker3ad88ec2021-08-20 19:27:59 +0200395- Add Rockchip idbloader image building
396- Add Rockchip TPL image building
Jagan Teki338b86c2020-01-10 00:16:22 +0530397- Document SPI flash boot
Jagan Teki338b86c2020-01-10 00:16:22 +0530398- Add missing SoC's with it boards list
399
400.. Jagan Teki <jagan@amarulasolutions.com>
Jagan Teki43ed7a02020-10-28 19:03:48 +0530401.. Wednesday 28 October 2020 06:47:26 PM IST