doc: rockchip: restyle rockchip.rst
[platform/kernel/u-boot.git] / doc / board / rockchip / rockchip.rst
index 7b72fab..1a4de7f 100644 (file)
@@ -13,19 +13,21 @@ and it's usage steps.
 Rockchip boards
 ---------------
 
-Rockchip is SoC solutions provider for tablets & PCs, streaming media
+Rockchip is SoC solutions provider for tablets & PCs, streaming media
 TV boxes, AI audio & vision, IoT hardware.
 
-A wide range of Rockchip SoCs with associated boardsare supported in
+A wide range of Rockchip SoCs with associated boards are supported in
 mainline U-Boot.
 
-List of mainline supported rockchip boards:
+List of mainline supported Rockchip boards:
 
 * rk3036
      - Rockchip Evb-RK3036 (evb-rk3036)
      - Kylin (kylin_rk3036)
 * rk3128
      - Rockchip Evb-RK3128 (evb-rk3128)
+* rk3188
+     - Radxa Rock (rock)
 * rk3229
      - Rockchip Evb-RK3229 (evb-rk3229)
 * rk3288
@@ -48,6 +50,7 @@ List of mainline supported rockchip boards:
      - Rockchip Evb-RK3328 (evb-rk3328)
      - Pine64 Rock64 (rock64-rk3328)
      - Firefly-RK3328 (roc-cc-rk3328)
+     - Radxa Rockpi E (rock-pi-e-rk3328)
 * rk3368
      - GeekBox (geekbox)
      - PX5 EVB (evb-px5)
@@ -60,8 +63,10 @@ List of mainline supported rockchip boards:
      - Firefly ROC-RK3399-PC
      - FriendlyElec NanoPC-T4 (nanopc-t4-rk3399)
      - FriendlyElec NanoPi M4 (nanopi-m4-rk3399)
+     - FriendlyElec NanoPi M4B (nanopi-m4b-rk3399)
      - FriendlyARM NanoPi NEO4 (nanopi-neo4-rk3399)
      - Google Bob (chromebook_bob)
+     - Google Kevin (chromebook_kevin)
      - Khadas Edge (khadas-edge-rk3399)
      - Khadas Edge-Captain (khadas-edge-captain-rk3399)
      - Khadas Edge-V (hadas-edge-v-rk3399)
@@ -73,8 +78,6 @@ List of mainline supported rockchip boards:
 * rv1108
      - Rockchip Evb-rv1108 (evb-rv1108)
      - Elgin-R1 (elgin-rv1108)
-* rv3188
-     - Radxa Rock (rock)
 
 Building
 --------
@@ -82,53 +85,74 @@ Building
 TF-A
 ^^^^
 
-TF-A would require to build for ARM64 Rockchip SoCs platforms.
+TF-A is required when building ARM64 Rockchip SoCs images.
+
+To build TF-A:
 
-To build TF-A::
+.. code-block:: bash
 
-        git clone https://github.com/ARM-software/arm-trusted-firmware.git
+        git clone --depth 1 https://github.com/ARM-software/arm-trusted-firmware.git
         cd arm-trusted-firmware
         make realclean
         make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399
+        cd ..
 
-Specify the PLAT= with desired rockchip platform to build TF-A for.
+Specify the PLAT= with desired Rockchip platform to build TF-A for.
 
 U-Boot
 ^^^^^^
 
-To build rk3328 boards::
+.. code-block:: bash
 
-        export BL31=/path/to/arm-trusted-firmware/to/bl31.elf
-        make evb-rk3328_defconfig
-        make
+        git clone --depth 1 https://source.denx.de/u-boot/u-boot.git
+        cd u-boot
+
+To build rk3288 boards:
 
-To build rk3288 boards::
+.. code-block:: bash
 
         make evb-rk3288_defconfig
-        make
+        make CROSS_COMPILE=arm-linux-gnueabihf-
+
+To build rk3328 boards:
 
-To build rk3368 boards::
+.. code-block:: bash
 
-        export BL31=/path/to/arm-trusted-firmware/to/bl31.elf
+        export BL31=../arm-trusted-firmware/build/rk3328/release/bl31/bl31.elf
+        make evb-rk3328_defconfig
+        make CROSS_COMPILE=aarch64-linux-gnu-
+
+To build rk3368 boards:
+
+.. code-block:: bash
+
+        export BL31=../arm-trusted-firmware/build/rk3368/release/bl31/bl31.elf
         make evb-px5_defconfig
-        make
+        make CROSS_COMPILE=aarch64-linux-gnu-
+
+To build rk3399 boards:
 
-To build rk3399 boards::
+.. code-block:: bash
 
-        export BL31=/path/to/arm-trusted-firmware/to/bl31.elf
+        export BL31=../arm-trusted-firmware/build/rk3399/release/bl31/bl31.elf
         make evb-rk3399_defconfig
-        make
+        make CROSS_COMPILE=aarch64-linux-gnu-
 
 Flashing
 --------
 
+1. Package the image with U-Boot TPL/SPL
+-----------------------------------------
+
 SD Card
 ^^^^^^^
 
-All rockchip platforms, except rk3128 (which doesn't use SPL) are now
-supporting single boot image using binman and pad_cat.
+All Rockchip platforms (except rk3128 which doesn't use SPL) are now
+supporting a single boot image using binman and pad_cat.
+
+To write an image that boots from a SD card (assumed to be /dev/sda):
 
-To write an image that boots from an SD card (assumed to be /dev/sda)::
+.. code-block:: bash
 
         sudo dd if=u-boot-rockchip.bin of=/dev/sda seek=64
         sync
@@ -136,39 +160,118 @@ To write an image that boots from an SD card (assumed to be /dev/sda)::
 eMMC
 ^^^^
 
-eMMC flash would probe on mmc0 in most of the rockchip platforms.
+eMMC flash would probe on mmc0 in most of the Rockchip platforms.
+
+Create GPT partition layout as defined in $partitions:
 
-Create GPT partition layout as defined in configurations::
+.. code-block:: bash
 
         mmc dev 0
         gpt write mmc 0 $partitions
 
-Connect the USB-OTG cable between host and target device.
+Connect the USB-OTG cable between the host and a target device.
 
-Launch fastboot at target::
+Launch fastboot on the target with:
+
+.. code-block:: bash
 
         fastboot 0
 
-Upon successful gadget connection,host show the USB device like::
+Upon a successful gadget connection the host shows the USB device with:
+
+.. code-block:: bash
 
         lsusb
-        Bus 001 Device 020: ID 2207:330c Fuzhou Rockchip Electronics Company RK3399 in Mask ROM mode
+        # Bus 001 Device 020: ID 2207:330c Fuzhou Rockchip Electronics Company RK3399 in Mask ROM mode
+
+Program the flash with:
 
-Program the flash::
+.. code-block:: bash
 
         sudo fastboot -i 0x2207 flash loader1 idbloader.img
         sudo fastboot -i 0x2207 flash loader2 u-boot.itb
 
-Note: for rockchip 32-bit platforms the U-Boot proper image
+Note:
+
+For Rockchip 32-bit platforms the U-Boot proper image
 is u-boot-dtb.img
 
+SPI
+^^^
+
+The SPI boot method requires the generation of idbloader.img with help of the mkimage tool.
+
+SPL-alone SPI boot image:
+
+.. code-block:: bash
+
+        ./tools/mkimage -n rk3399 -T rkspi -d spl/u-boot-spl.bin idbloader.img
+
+TPL+SPL SPI boot image:
+
+.. code-block:: bash
+
+        ./tools/mkimage -n rk3399 -T rkspi -d tpl/u-boot-tpl.bin:spl/u-boot-spl.bin idbloader.img
+
+Copy SPI boot images into SD card and boot from SD:
+
+.. code-block:: bash
+
+        sf probe
+        load mmc 1:1 $kernel_addr_r idbloader.img
+        sf erase 0 +$filesize
+        sf write $kernel_addr_r 0 ${filesize}
+        load mmc 1:1 ${kernel_addr_r} u-boot.itb
+        sf erase 0x60000 +$filesize
+        sf write $kernel_addr_r 0x60000 ${filesize}
+
+2. Package the image with Rockchip miniloader
+---------------------------------------------
+
+Image package with Rockchip miniloader requires rkbin [1].
+
+.. code-block:: bash
+
+        cd ..
+        git clone --depth 1 https://github.com/rockchip-linux/rkbin
+
+Create idbloader.img:
+
+.. code-block:: bash
+
+        cd u-boot
+        ./tools/mkimage -n px30 -T rksd -d ../rkbin/bin/rk33/px30_ddr_333MHz_v1.16.bin idbloader.img
+        cat ../rkbin/bin/rk33/px30_miniloader_v1.31.bin >> idbloader.img
+        sudo dd if=idbloader.img of=/dev/sda seek=64
+
+Create trust.img:
+
+.. code-block:: bash
+
+        cd ../rkbin
+        ./tools/trust_merger RKTRUST/PX30TRUST.ini
+        sudo dd if=trust.img of=/dev/sda seek=24576
+
+Create uboot.img [2]:
+
+.. code-block:: bash
+
+        cd ../u-boot
+        ../rkbin/tools/loaderimage --pack --uboot u-boot-dtb.bin uboot.img 0x200000
+        sudo dd if=uboot.img of=/dev/sda seek=16384
+
+Note:
+
+1. rkbin binaries are regularly updated, so it would be recommended to use the latest version.
+2. 0x200000 is a load address and is an option for some platforms.
+
 TODO
 ----
 
-- Add rockchip idbloader image building
-- Add rockchip TPL image building
+- Add Rockchip idbloader image building
+- Add Rockchip TPL image building
 - Document SPI flash boot
 - Add missing SoC's with it boards list
 
 .. Jagan Teki <jagan@amarulasolutions.com>
-.. Sunday 24 May 2020 10:08:41 PM IST
+.. Wednesday 28 October 2020 06:47:26 PM IST