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