khadas-vim3l.rst 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. .. SPDX-License-Identifier: GPL-2.0+
  2. U-Boot for Khadas VIM3L
  3. =======================
  4. Khadas VIM3L is a single board computer manufactured by Shenzhen Wesion
  5. Technology Co., Ltd. with the following specifications:
  6. - Amlogic S905D3 Arm Cortex-A55 quad-core SoC
  7. - 2GB LPDDR4 SDRAM
  8. - Gigabit Ethernet
  9. - HDMI 2.1 display
  10. - 40-pin GPIO header
  11. - 1 x USB 3.0 Host, 1 x USB 2.0 Host
  12. - eMMC, microSD
  13. - M.2
  14. - Infrared receiver
  15. Schematics are available on the manufacturer website.
  16. PCIe Setup
  17. ----------
  18. The VIM3 on-board MCU can mux the PCIe/USB3.0 shared differential
  19. lines using a FUSB340TMX USB 3.1 SuperSpeed Data Switch between
  20. an USB3.0 Type A connector and a M.2 Key M slot.
  21. The PHY driving these differential lines is shared between
  22. the USB3.0 controller and the PCIe Controller, thus only
  23. a single controller can use it.
  24. To setup for PCIe, run the following commands from U-Boot:
  25. .. code-block:: none
  26. i2c dev i2c@5000
  27. i2c mw 0x18 0x33 1
  28. Then power-cycle the board.
  29. To set back to USB3.0, run the following commands from U-Boot:
  30. .. code-block:: none
  31. i2c dev i2c@5000
  32. i2c mw 0x18 0x33 0
  33. Then power-cycle the board.
  34. U-Boot compilation
  35. ------------------
  36. $ export CROSS_COMPILE=aarch64-none-elf-
  37. $ make khadas-vim3l_defconfig
  38. $ make
  39. Image creation
  40. --------------
  41. Amlogic doesn't provide sources for the firmware and for tools needed
  42. to create the bootloader image, so it is necessary to obtain them from
  43. the git tree published by the board vendor:
  44. .. code-block:: bash
  45. $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
  46. $ wget https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
  47. $ tar xvfJ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz
  48. $ tar xvfJ gcc-linaro-arm-none-eabi-4.8-2013.11_linux.tar.xz
  49. $ export PATH=$PWD/gcc-linaro-aarch64-none-elf-4.8-2013.11_linux/bin:$PWD/gcc-linaro-arm-none-eabi-4.8-2013.11_linux/bin:$PATH
  50. $ DIR=vim3l-u-boot
  51. $ git clone --depth 1 \
  52. https://github.com/khadas/u-boot.git -b khadas-vims-v2015.01 \
  53. $DIR
  54. $ cd vim3l-u-boot
  55. $ make kvim3l_defconfig
  56. $ make
  57. $ export UBOOTDIR=$PWD
  58. Go back to mainline U-Boot source tree then :
  59. .. code-block:: bash
  60. $ mkdir fip
  61. $ cp $UBOOTDIR/build/scp_task/bl301.bin fip/
  62. $ cp $UBOOTDIR/build/board/khadas/kvim3l/firmware/acs.bin fip/
  63. $ cp $UBOOTDIR/fip/g12a/bl2.bin fip/
  64. $ cp $UBOOTDIR/fip/g12a/bl30.bin fip/
  65. $ cp $UBOOTDIR/fip/g12a/bl31.img fip/
  66. $ cp $UBOOTDIR/fip/g12a/ddr3_1d.fw fip/
  67. $ cp $UBOOTDIR/fip/g12a/ddr4_1d.fw fip/
  68. $ cp $UBOOTDIR/fip/g12a/ddr4_2d.fw fip/
  69. $ cp $UBOOTDIR/fip/g12a/diag_lpddr4.fw fip/
  70. $ cp $UBOOTDIR/fip/g12a/lpddr3_1d.fw fip/
  71. $ cp $UBOOTDIR/fip/g12a/lpddr4_1d.fw fip/
  72. $ cp $UBOOTDIR/fip/g12a/lpddr4_2d.fw fip/
  73. $ cp $UBOOTDIR/fip/g12a/piei.fw fip/
  74. $ cp $UBOOTDIR/fip/g12a/aml_ddr.fw fip/
  75. $ cp u-boot.bin fip/bl33.bin
  76. $ sh fip/blx_fix.sh \
  77. fip/bl30.bin \
  78. fip/zero_tmp \
  79. fip/bl30_zero.bin \
  80. fip/bl301.bin \
  81. fip/bl301_zero.bin \
  82. fip/bl30_new.bin \
  83. bl30
  84. $ sh fip/blx_fix.sh \
  85. fip/bl2.bin \
  86. fip/zero_tmp \
  87. fip/bl2_zero.bin \
  88. fip/acs.bin \
  89. fip/bl21_zero.bin \
  90. fip/bl2_new.bin \
  91. bl2
  92. $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl30sig --input fip/bl30_new.bin \
  93. --output fip/bl30_new.bin.g12a.enc \
  94. --level v3
  95. $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl30_new.bin.g12a.enc \
  96. --output fip/bl30_new.bin.enc \
  97. --level v3 --type bl30
  98. $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl31.img \
  99. --output fip/bl31.img.enc \
  100. --level v3 --type bl31
  101. $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl3sig --input fip/bl33.bin --compress lz4 \
  102. --output fip/bl33.bin.enc \
  103. --level v3 --type bl33 --compress lz4
  104. $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bl2sig --input fip/bl2_new.bin \
  105. --output fip/bl2.n.bin.sig
  106. $ $UBOOTDIR/fip/g12a/aml_encrypt_g12a --bootmk \
  107. --output fip/u-boot.bin \
  108. --bl2 fip/bl2.n.bin.sig \
  109. --bl30 fip/bl30_new.bin.enc \
  110. --bl31 fip/bl31.img.enc \
  111. --bl33 fip/bl33.bin.enc \
  112. --ddrfw1 fip/ddr4_1d.fw \
  113. --ddrfw2 fip/ddr4_2d.fw \
  114. --ddrfw3 fip/ddr3_1d.fw \
  115. --ddrfw4 fip/piei.fw \
  116. --ddrfw5 fip/lpddr4_1d.fw \
  117. --ddrfw6 fip/lpddr4_2d.fw \
  118. --ddrfw7 fip/diag_lpddr4.fw \
  119. --ddrfw8 fip/aml_ddr.fw \
  120. --ddrfw9 fip/lpddr3_1d.fw \
  121. --level v3
  122. and then write the image to SD with:
  123. .. code-block:: bash
  124. $ DEV=/dev/your_sd_device
  125. $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
  126. $ dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444