1a13110a9SKlaus GogerIntroduction 2a13110a9SKlaus Goger============ 3a13110a9SKlaus Goger 4a13110a9SKlaus GogerThe RK3399-Q7 (Puma) is a system-on-module featuring the Rockchip 5a13110a9SKlaus GogerRK3399 in a Qseven-compatible form-factor. 6a13110a9SKlaus Goger 7a13110a9SKlaus GogerRK3399-Q7 features: 8a13110a9SKlaus Goger * CPU: ARMv8 64bit Big-Little architecture, 9a13110a9SKlaus Goger * Big: dual-core Cortex-A72 10a13110a9SKlaus Goger * Little: quad-core Cortex-A53 11a13110a9SKlaus Goger * IRAM: 200KB 12a13110a9SKlaus Goger * DRAM: 4GB-128MB dual-channel 13a13110a9SKlaus Goger * eMMC: onboard eMMC 14a13110a9SKlaus Goger * SD/MMC 15a13110a9SKlaus Goger * GbE (onboard Micrel KSZ9031) Gigabit ethernet PHY 16a13110a9SKlaus Goger * USB: 17a13110a9SKlaus Goger * USB3.0 dual role port 18a13110a9SKlaus Goger * 2x USB3.0 host, 1x USB2.0 host via onboard USB3.0 hub 19a13110a9SKlaus Goger * Display: HDMI/eDP/MIPI 20a13110a9SKlaus Goger * Camera: 2x CSI (one on the edge connector, one on the Q7 specified CSI ZIF) 21a13110a9SKlaus Goger * NOR Flash: onboard SPI NOR 22a13110a9SKlaus Goger * Companion Controller: onboard additional Cortex-M0 microcontroller 23a13110a9SKlaus Goger * RTC 24a13110a9SKlaus Goger * fan controller 25a13110a9SKlaus Goger * CAN 26a13110a9SKlaus Goger 27a13110a9SKlaus GogerHere is the step-by-step to boot to U-Boot on rk3399. 28a13110a9SKlaus Goger 29a13110a9SKlaus GogerGet the Source and build ATF/Cortex-M0 binaries 30a13110a9SKlaus Goger=============================================== 31a13110a9SKlaus Goger 32a13110a9SKlaus Goger > git clone git://git.theobroma-systems.com/arm-trusted-firmware.git 33a13110a9SKlaus Goger > git clone git://git.theobroma-systems.com/rk3399-cortex-m0.git 34a13110a9SKlaus Goger 35a13110a9SKlaus GogerCompile the ATF 36a13110a9SKlaus Goger=============== 37a13110a9SKlaus Goger 38a13110a9SKlaus Goger > cd arm-trusted-firmware 39a13110a9SKlaus Goger > make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399 bl31 404ce8b4d6SKlaus Goger > cp build/rk3399/release/bl31.bin ../u-boot/bl31-rk3399.bin 41a13110a9SKlaus Goger 42a13110a9SKlaus GogerCompile the M0 firmware 43a13110a9SKlaus Goger======================= 44a13110a9SKlaus Goger 45a13110a9SKlaus Goger > cd ../rk3399-cortex-m0 46a13110a9SKlaus Goger > make CROSS_COMPILE=arm-cortex_m0-eabi- 47a13110a9SKlaus Goger > cp rk3399m0.bin ../u-boot 48a13110a9SKlaus Goger 49a13110a9SKlaus GogerCompile the U-Boot 50a13110a9SKlaus Goger================== 51a13110a9SKlaus Goger 52a13110a9SKlaus Goger > cd ../u-boot 53a13110a9SKlaus Goger > make CROSS_COMPILE=aarch64-linux-gnu- puma-rk3399_defconfig all 54a13110a9SKlaus Goger 55a13110a9SKlaus GogerPackage the image 56a13110a9SKlaus Goger================= 57a13110a9SKlaus Goger 58*5d3f9f0bSKlaus GogerCreating a SPL image for SD-Card/eMMC 59*5d3f9f0bSKlaus Goger > tools/mkimage -n rk3399 -T rksd -d spl/u-boot-spl.bin spl_mmc.img 60*5d3f9f0bSKlaus GogerCreating a SPL image for SPI-NOR 61*5d3f9f0bSKlaus Goger > tools/mkimage -n rk3399 -T rkspi -d spl/u-boot-spl.bin spl_nor.img 62*5d3f9f0bSKlaus GogerCreate the FIT image containing U-Boot proper, ATF, M0 Firmware, devicetree 63f8e3b083SPhilipp Tomsich > make CROSS_COMPILE=aarch64-linux-gnu- u-boot.itb 64a13110a9SKlaus Goger 65a13110a9SKlaus GogerFlash the image 66a13110a9SKlaus Goger=============== 67a13110a9SKlaus Goger 68*5d3f9f0bSKlaus GogerCopy the SPL to offset 32k for SD/eMMC, offset 0 for NOR-Flash and the FIT 69*5d3f9f0bSKlaus Gogerimage to offset 256k card. 70a13110a9SKlaus Goger 71*5d3f9f0bSKlaus GogerSD-Card 72*5d3f9f0bSKlaus Goger------- 73*5d3f9f0bSKlaus Goger 74*5d3f9f0bSKlaus Goger > dd if=spl_mmc.img of=/dev/sdb seek=64 75f8e3b083SPhilipp Tomsich > dd if=u-boot.itb of=/dev/sdb seek=512 76a13110a9SKlaus Goger 77*5d3f9f0bSKlaus GogereMMC 78*5d3f9f0bSKlaus Goger---- 79*5d3f9f0bSKlaus Goger 80*5d3f9f0bSKlaus Gogerrkdeveloptool allows to flash the on-board eMMC via the USB OTG interface with 81*5d3f9f0bSKlaus Gogerhelp of the Rockchip loader binary. 82*5d3f9f0bSKlaus Goger 83*5d3f9f0bSKlaus Goger > git clone https://github.com/rockchip-linux/rkdeveloptool 84*5d3f9f0bSKlaus Goger > cd rkdeveloptool 85*5d3f9f0bSKlaus Goger > autoreconf -i && ./configure && make 86*5d3f9f0bSKlaus Goger > git clone https://github.com/rockchip-linux/rkbin.git 87*5d3f9f0bSKlaus Goger > ./rkdeveloptool db rkbin/rk33/rk3399_loader_v1.08.106.bin 88*5d3f9f0bSKlaus Goger > ./rkdeveloptool wl 64 ../spl_mmc.img 89*5d3f9f0bSKlaus Goger > ./rkdeveloptool wl 512 ../u-boot.itb 90*5d3f9f0bSKlaus Goger 91*5d3f9f0bSKlaus GogerNOR-Flash 92*5d3f9f0bSKlaus Goger--------- 93*5d3f9f0bSKlaus Goger 94*5d3f9f0bSKlaus GogerWriting the SPI NOR Flash requires a running U-Boot. For the sake of simplicity 95*5d3f9f0bSKlaus Gogerwe assume you have a SD-Card with a partition containing the required files 96*5d3f9f0bSKlaus Gogerready. 97*5d3f9f0bSKlaus Goger 98*5d3f9f0bSKlaus Goger > load mmc 1:1 ${kernel_addr_r} spl_nor.img 99*5d3f9f0bSKlaus Goger > sf probe 100*5d3f9f0bSKlaus Goger > sf erase 0 +$filesize 101*5d3f9f0bSKlaus Goger > sf write $kernel_addr_r 0 ${filesize} 102*5d3f9f0bSKlaus Goger > load mmc 1:1 ${kernel_addr_r} u-boot.itb 103*5d3f9f0bSKlaus Goger > sf erase 0x40000 +$filesize 104*5d3f9f0bSKlaus Goger > sf write $kernel_addr_r 0x40000 ${filesize} 105*5d3f9f0bSKlaus Goger 106*5d3f9f0bSKlaus Goger 107*5d3f9f0bSKlaus GogerReboot the system and you should see a U-Boot console on UART0 (115200n8). 108