1d26f375aSKever YangIntroduction 2d26f375aSKever Yang============ 3d26f375aSKever Yang 4d26f375aSKever YangRK3399 key features we might use in U-Boot: 5d26f375aSKever Yang* CPU: ARMv8 64bit Big-Little architecture, 6d26f375aSKever Yang* Big: dual-core Cortex-A72 7d26f375aSKever Yang* Little: quad-core Cortex-A53 8d26f375aSKever Yang* IRAM: 200KB 9d26f375aSKever Yang* DRAM: 4GB-128MB dual-channel 10d26f375aSKever Yang* eMMC: support eMMC 5.0/5.1, suport HS400, HS200, DDR50 11d26f375aSKever Yang* SD/MMC: support SD 3.0, MMC 4.51 12d26f375aSKever Yang* USB: USB3.0 typc-C port *2 with dwc3 controller 13d26f375aSKever Yang* USB2.0 EHCI host port *2 14d26f375aSKever Yang* Display: RGB/HDMI/DP/MIPI/EDP 15d26f375aSKever Yang 16d26f375aSKever Yangevb key features: 17d26f375aSKever Yang* regulator: pwm regulator for CPU B/L 18d26f375aSKever Yang* PMIC: rk808 19d26f375aSKever Yang* debug console: UART2 20d26f375aSKever Yang 21157c74b6SKever YangIn order to support Arm Trust Firmware(ATF), we can use either SPL or 22157c74b6SKever Yangminiloader from rockchip to do: 23d26f375aSKever Yang* do DRAM init 24d26f375aSKever Yang* load and verify ATF image 25d26f375aSKever Yang* load and verify U-Boot image 26d26f375aSKever Yang 27d26f375aSKever YangHere is the step-by-step to boot to U-Boot on rk3399. 28d26f375aSKever Yang 29d26f375aSKever YangGet the Source and prebuild binary 30d26f375aSKever Yang================================== 31d26f375aSKever Yang 32d26f375aSKever Yang > mkdir ~/evb_rk3399 33d26f375aSKever Yang > cd ~/evb_rk3399 34d26f375aSKever Yang > git clone https://github.com/ARM-software/arm-trusted-firmware.git 35157c74b6SKever Yang > git clone https://github.com/rockchip-linux/rkbin.git 36157c74b6SKever Yang > git clone https://github.com/rockchip-linux/rkdeveloptool.git 37d26f375aSKever Yang 38d26f375aSKever YangCompile the ATF 39d26f375aSKever Yang=============== 40d26f375aSKever Yang 41d26f375aSKever Yang > cd arm-trusted-firmware 42d26f375aSKever Yang > make realclean 43d26f375aSKever Yang > make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399 bl31 44d26f375aSKever Yang 45157c74b6SKever Yang Or you can get the bl31.elf directly from Rockchip: 46157c74b6SKever Yang cp rkbin/rk33/rk3399_bl31_v1.00.elf ../u-boot/bl31.elf 47157c74b6SKever Yang 48157c74b6SKever Yang Get bl31.elf in this step, copy it to U-Boot root dir: 49157c74b6SKever Yang > cp bl31.elf ../u-boot/ 50157c74b6SKever Yang 51d26f375aSKever YangCompile the U-Boot 52d26f375aSKever Yang================== 53d26f375aSKever Yang 54d26f375aSKever Yang > cd ../u-boot 55157c74b6SKever Yang > export ARCH=arm64 56157c74b6SKever Yang > export CROSS_COMPILE=aarch64-linux-gnu- 57157c74b6SKever Yang > make evb-rk3399_defconfig 58157c74b6SKever Yang for firefly-rk3399, use below instead: 59157c74b6SKever Yang > make firefly-rk3399_defconfig 60d26f375aSKever Yang > make 61157c74b6SKever Yang > make u-boot.itb 62d26f375aSKever Yang 63157c74b6SKever Yang Get spl/u-boot-spl.bin and u-boot.itb in this step. 64157c74b6SKever Yang 65157c74b6SKever YangCompile the rkdeveloptool 66157c74b6SKever Yang======================= 67157c74b6SKever Yang Follow instructions in latest README 68*19ee1faeSHeinrich Schuchardt > cd ../rkdeveloptool 69157c74b6SKever Yang > autoreconf -i 70157c74b6SKever Yang > ./configure 71157c74b6SKever Yang > make 72157c74b6SKever Yang > sudo make install 73157c74b6SKever Yang 74157c74b6SKever Yang Get rkdeveloptool in you Host in this step. 75157c74b6SKever Yang 76157c74b6SKever YangBoth origin binaries and Tool are ready now, choose either option 1 or 77157c74b6SKever Yangoption 2 to deploy U-Boot. 78157c74b6SKever Yang 79157c74b6SKever YangPackage the image 80157c74b6SKever Yang================= 81157c74b6SKever Yang 82157c74b6SKever YangPackage the image for U-Boot SPL(option 1) 83157c74b6SKever Yang-------------------------------- 84d26f375aSKever Yang > cd .. 85157c74b6SKever Yang > tools/mkimage -n rk3399 -T rksd -d spl/u-boot-spl.bin idbspl.img 86157c74b6SKever Yang 87157c74b6SKever Yang Get idbspl.img in this step. 88157c74b6SKever Yang 89157c74b6SKever YangPackage the image for Rockchip miniloader(option 2) 90157c74b6SKever Yang------------------------------------------ 91157c74b6SKever Yang > cd .. 92157c74b6SKever Yang > cp arm-trusted-firmware/build/rk3399/release/bl31.elf rkbin/rk33 93d26f375aSKever Yang > ./rkbin/tools/trust_merger rkbin/tools/RK3399TRUST.ini 94d26f375aSKever Yang > ./rkbin/tools/loaderimage --pack --uboot u-boot/u-boot-dtb.bin uboot.img 95d26f375aSKever Yang 96157c74b6SKever Yang Get trust.img and uboot.img in this step. 97157c74b6SKever Yang 98157c74b6SKever YangFlash the image to eMMC 99157c74b6SKever Yang======================= 100157c74b6SKever Yang 101157c74b6SKever YangFlash the image with U-Boot SPL(option 1) 102157c74b6SKever Yang------------------------------- 103d26f375aSKever YangPower on(or reset with RESET KEY) with MASKROM KEY preesed, and then: 104157c74b6SKever Yang > rkdeveloptool db rkbin/rk33/rk3399_loader_v1.08.106.bin 105157c74b6SKever Yang > rkdeveloptool wl 64 u-boot/idbspl.img 106157c74b6SKever Yang > rkdeveloptool wl 0x4000 u-boot/u-boot.itb 107157c74b6SKever Yang > rkdeveloptool rd 108d26f375aSKever Yang 109157c74b6SKever YangFlash the image with Rockchip miniloader(option 2) 110157c74b6SKever Yang---------------------------------------- 111157c74b6SKever YangPower on(or reset with RESET KEY) with MASKROM KEY preesed, and then: 112157c74b6SKever Yang > rkdeveloptool db rkbin/rk33/rk3399_loader_v1.08.106.bin 113157c74b6SKever Yang > rkdeveloptool ul rkbin/rk33/rk3399_loader_v1.08.106.bin 114157c74b6SKever Yang > rkdeveloptool wl 0x4000 u-boot/uboot.img 115157c74b6SKever Yang > rkdeveloptool wl 0x6000 u-boot/trust.img 116157c74b6SKever Yang > rkdeveloptool rd 117d26f375aSKever Yang 118157c74b6SKever YangYou should be able to get U-Boot log in console/UART2(baurdrate 1500000) 119157c74b6SKever YangFor more detail, please reference to: 120157c74b6SKever Yanghttp://opensource.rock-chips.com/wiki_Boot_option 121