User Tools

Site Tools



en:bpi-r2pro:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:bpi-r2pro:start [2022/04/08 07:48] – [Linux] franken:bpi-r2pro:start [2024/02/17 13:49] (current) frank
Line 1: Line 1:
 +====== BananaPi R2 Pro ======
 +
 +https://forum.banana-pi.org/t/banana-pi-bpi-r2-pro-smart-router-board-with-rockchip-rk3568-chip/12522
 +
 +http://wiki.banana-pi.org/Banana_Pi_BPI-R2_Pro
 +
 +Official uboot/kernel: https://github.com/BPI-SINOVOIP/BPI-R2PRO-BSP
 +
 +Informations about boot-chain:
 +http://opensource.rock-chips.com/wiki_Boot_option
 +===== hardware =====
 +v0.0:
 +{{:en:bpi-r2pro:r2pro_00_top.jpg?direct&400 |}}{{ :en:bpi-r2pro:r2pro_00_bottom.jpg?direct&400|}}
 +
 +----
 +
 +v1.0:
 +{{:en:bpi-r2pro:r2pro_top.jpg?direct&400 |}}{{ :en:bpi-r2pro:r2pro_bottom.jpg?direct&400|}}
 +
 +==== specification ====
 +
 +
 +  * Rockchip RK3568 Quad-core ARM Cortex-A55 CPU [[https://wiki.radxa.com/Rock3/hardware|TRM (Technical Reference Manual) ]]
 +  * Rockchip RK809 PMIC
 +  * switch:
 +    * v00:RTL8367RB-VB-CG Switch chip ([[https://drive.google.com/drive/folders/1EruavDemzSxQUi7GbHw8AMbC8nplEjKF|datasheet]])
 +      * gmac1/eth0 - only for lan-ports (wan-port directly connected to gmac0/eth1 via RTL8211 PHY)
 +    * 1.0: MT7531BE chip ([[https://drive.google.com/file/d/1aVdQz3rbKWjkvdga8-LQ-VFXjmHR8yf9/view?usp=sharing|datasheet]])
 +      * vendor provides phy driver,dsa driver mainline but will need some changes
 +      * gmacs now swapped (gmac1 for wan,gmac0 with switch for lan)
 +  * debug-uart is fixed to 1.5 mbaud,which is not supported by common usb2serial adapters (like my cp2102). More info [[https://wiki.t-firefly.com/en/ROC-RK3328-PC/debug.html#choosing-a-usb-serial-adapter|here]]
 +    * working adapters: ch340g, ft232rl, cp2104
 +    * minicom -D /dev/ttyUSB1 -b 1500000
 +    * on v1.0 micro-usb can be used as debug-uart too
 +  * ethernet/switch (rtl8367 phy+dsa driver,mt7531 only phy driver)/poweroff/reset/usb3/sata working in my repo, pcie (on v00 sometimes) working, leds (green + blue) working (green is ON-indicator)
 +  * upper usb-Port (usbdrd3_0: usb@fcc00000,bus 2-1) has phy configured in rk3568.dtsi (combphy0 does not exist on rk3566), lower port (usbdrd3_1: usb@fd000000,bus 4-1) is configured in rk356x.dtsi (combphy1)
 +  * combphy2 is used for sata2 (sata@fc800000)
 +  * [[GPIO]]
 +  * if emmc is bootable, it will be booted first, sdcard boot is only possible when pressing sw1 while poweron (till bl2 is shown)
 +===== Software =====
 +
 +my board had a broken bootchain on emmc which prevents bootup from sdcard. Board can be booted up when pressing switch labeled "MASKROOM" while poweron. This shortcuts emmc and so skip this. Mostly emmc is not available from uboot, so i needed to boot linux kernel (which does emmc init again). There it was possible to erase beginning of emmc user-partition (mmcblk1).
 +
 +  dd if=/dev/zero of=/dev/mmcblk1 bs=1M count=10
 +
 +erasing the first 2M was not enough (should delete the idbloader at block 64)...
 +==== ATF ====
 +
 +Currently only binaries, no source
 +
 +https://github.com/rockchip-linux/rkbin/tree/master/bin/rk35
 +
 +https://github.com/JeffyCN/rockchip_mirrors/tree/rkbin/bin/rk35
 +
 +There is a merge-request for basic support (bl31 without scmi and no ddr init):
 +
 +https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/16952/8
 +
 +I have merged v11 to my repo here (only compilation tested yet):
 +
 +https://github.com/frank-w/u-boot/tree/rk-atf
 +==== Uboot ====
 +https://github.com/rockchip-linux/u-boot/blob/next-dev/configs/rk3568_defconfig
 +
 +https://forum.pine64.org/showthread.php?tid=14507
 +
 +My own work:
 +
 +https://github.com/frank-w/u-boot
 +
 +:!: R2pro is supported only till 2022-04 as 2022-07 contains Patches that break atf inclusion
 +
 +2023-04 got patches to support r2ro again: https://github.com/frank-w/u-boot/tree/2023-04-bpi
 +
 +default boot way is via BPI-BOOT/extlinux/extlinux.conf
 +
 +<code>
 +menu title Select the boot mode
 +#timeout 1/10s
 +TIMEOUT 50
 +DEFAULT linux
 +
 +LABEL linux
 +    #KERNEL bpi-r2pro.itb
 +    linux Image_5.17.gz
 +    fdt rk3568-bpi-r2-pro.dtb
 +    initrd /rootfs.cpio.lz4
 +    #APPEND root=/dev/mmcblk1p3 rootwait rw earlyprintk
 +    append earlycon=uart8250,mmio32,0xfe660000 console=ttyS2,1500000n8
 +
 +LABEL linux-5.18-hdmi
 +    #KERNEL bpi-r2pro.itb
 +    linux Image_5.18_hdmi.gz
 +    fdt rk3568-bpi-r2-pro-hdmi.dtb
 +    initrd /rootfs.cpio.lz4
 +    #APPEND root=/dev/mmcblk1p3 rootwait rw earlyprintk
 +    append earlycon=uart8250,mmio32,0xfe660000 console=tty1 fbcon=map:0 console=ttyS2,1500000n8
 +</code>
 +
 +This is about to be changed with this u-boot patch series: https://patchwork.ozlabs.org/project/uboot/patch/20230409084454.v9.8.I4cf7708a1ba953b9abd81375d93af34665c7b251@changeid/
 +
 +So i'm adding fit booting and builtin env like for r64 and r3 for 2023.07+
 +
 +  BPI-R2PRO> ls $device $partition
 +  BPI-R2PRO> setenv fit bpi-r2pro-netnext.itb
 +  BPI-R2PRO> run buildargs
 +  BPI-R2PRO> fatload $device $partition $loadaddr $fit
 +  10845897 bytes read in 937 ms (11 MiB/s)
 +  BPI-R2PRO> bootm $loadaddr
 +
 +R2pro will be supprted as own board in uboot 2024.01.
 +
 +Pcie is usable too,but needs manual enabling regulators
 +
 +https://www.mail-archive.com/u-boot@lists.denx.de/msg488399.html
 +
 +
 +=== tftp ===
 +
 +  run buildargs
 +  tftp $loadaddr 192.168.0.10:6.6-main-bpi-r2pro.itb
 +  bootm $loadaddr
 +==== barebox ====
 +alternative to uboot as bootloader, supports ethernet/tftp-boot (wan-port only due to missing switch driver)
 +
 +[[barebox]]
 +==== Images ====
 +
 +Debian/Ubuntu (using kernel from my repo):
 +https://forum.banana-pi.org/t/r2pro-debian-bullseye-ubuntu-22-04/13395
 +
 +Armbian:
 +
 +Source/Patches: https://github.com/150balbes/build/tree/armbian-tv/patch/kernel/archive/media-5.19
 +
 +Download:
 +https://users.armbian.com/balbes150/bpir2pro/
 +
 +==== Image creation ====
 +
 +Current way is spl-uboot in idblock.bin loading full uboot (fip,uboot.img) on separate partition (p1).
 +
 +partition-layout from peter geis:
 +
 +https://gitlab.com/pgwipeout/quartz64_ci/-/blob/main/.gitlab-ci.yml#L103
 +
 +i use [[https://gitlab.manjaro.org/manjaro-arm/applications/manjaro-arm-tools/-/blob/master/lib/functions.sh#L774|version from manjaro]] [[https://github.com/frank-w/u-boot/blob/2022-01-bpi-r2-pro/build.sh#L217|in my build.sh]]
 +
 +This way works with downstream (2017.x) and upstream (2021.10+) uboot. [[Barebox]] does not need uboot partition,but for compatibility reasons partition should be there.
 +==== Linux ====
 +
 +https://github.com/JeffyCN/mirrors/tree/kernel-5.10
 +
 +https://gitlab.com/pgwipeout/linux-next/-/commits/quartz64-v5.16/
 +
 +precompiled kernel/uboot/bootheaders
 +
 +https://gitlab.com/pgwipeout/quartz64_ci/-/jobs/2305059735/artifacts/browse/artifacts/
 +
 +Started my own work here: https://github.com/frank-w/BPI-R2-4.14/tree/5.16-next2
 +
 +=== thermal ===
 +
 +  root@bpi-r2pro:~# cat /sys/class/thermal/thermal_zone0/temp                                                                               
 +  37222                                                                                                                                     
 +  root@bpi-r2pro:~# cat /sys/class/thermal/thermal_zone1/temp                                                                               
 +  35000 
 +
 +=== Network ===
 +
 +  * wan-port directly connected
 +  * lan-ports over switch
 +    * v00: 3 switch drivers available, selectable in dts (in next2 tree all drivers are builtin):
 +      - vendor phy driver (drivers/net/phy/rtk, CONFIG_RTL8367RB_GSW)
 +      - my reduced phy driver (drivers/net/phy/rtl8367s_mdio.c, CONFIG_NET_REALTEK_MDIO)
 +      - dsa driver (drivers/net/dsa/realtek/, CONFIG_NET_DSA_REALTEK)
 +    * v1.0:
 +      * phy driver working in 5.17 
 +      * dsa driver detects switch/ports after disabling resets,but no traffic yet
 +
 +Further trees (like 5.17-r2pro*) will not contain the full phy driver,only my reduced version and dsa.
 +
 +=== display stuff ===
 +
 +vop2 driver (needed for HDMI)
 +
 +V5 seems to work good for 720p, 1080p and 4k
 +
 +https://github.com/frank-w/BPI-R2-4.14/commits/5.17-r2pro-hdmi
 +
 +[[https://patchwork.kernel.org/project/linux-rockchip/list/?series=585751|Hdmi audio]] and [[https://patchwork.kernel.org/project/linux-rockchip/list/?series=586441|gpu support]]
 +
 +Have hdmi output, hdmi audio, gpu works with peters defconfig.
 +
 +needs actual userspace (e.g. ubuntu 21.10) and ppa:
 +https://launchpad.net/~kisak/+archive/ubuntu/kisak-mesa
 +
 +in wayland/weston (have installed gnome too)
 +
 +  apt install gnome weston gl2mark
 +  
 +weston-info shows resolution
 +
 +=== debugging ===
 +
 +  # mount -t debugfs none /sys/kernel/debug/
 +  # cat /sys/kernel/debug/gpio
 +  # cat /sys/kernel/debug/pinctrl/pinctrl-handles
 +  # cat /sys/kernel/debug/regulator/regulator_summary
 +  # cat /sys/kernel/debug/clk/clk_summary
 +
 +=== other ===
 +
 +[[https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git/|Rockchip DTS git]]
 +
 +Sound / [[Alsa]]