Banana Pi BPI-R64 open source router with MTK MT7622 64 bit chip design

(Frank W.) #41

@Jackzeng can you explain ATF-binary

ATF seems to stand for ARM trusted firmware…

partitoninfo seems not actual because your image uses this partitiontable:

Disk /dev/sdb: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x674a82c6

Device     Boot  Start      End  Sectors  Size Id Type
/dev/sdb1       204800   729087   524288  256M  c W95 FAT32 (LBA)
/dev/sdb2       729088 14940159 14211072  6.8G 83 Linux

your script above says

# partition1 /dev/sdc1 vfat 204800~327679
# partition2 /dev/sdc2 ext4 327680~end

where can be the uboot-environment be saved (1MB on R2 in “user data area”)

how is the difference between emmc and SD (atf needed to)? same as on r2 (preloader to boot0, uboot to user-partition on same location without HEAD0/1)

how can we check from which device r64 has booted? (like we did in uboot for r2)

with bpi-r2 i can do

U-Boot> md.l 0x81DFFFF0 1                                                       
81dffff0: 434d4d65                               eMMC

to see booted device…here emmc…if booted from sd-card i see this

BPI-R2> md.l 0x81DFFFF0 1
81dffff0: ffffffff                               ....

currently i don’t see emmc in uboot, but in linux i see mmc1blk1boot0 :wink: so i can try to get emmc boot working

have now flashed mt-pack/mtk/bpi-r64/bin/preloader_bpi-r64_forsdcard-2k.img to mmcblk1boot0 and removed sd-card

F0: 102B 0000                                                                   
F6: 3800 00A0                                                                   
F3: 4000 0036                                                                   
F5: 480A 0031                                                                   
F5: 480A 0031                                                                   
00: 1005 0000                                                                   
F6: 3800 00A0                                                                   
F3: 4000 0036                                                                   
F5: 480A 0031                                                                   
F5: 480A 0031                                                                   
01: 102A 0001                                                                   
02: 1005 0000                                                                   
BP: 0000 00C0 [0001]                                                            
T0: 0000 0364 [000F]                                                            
System halt!

from sdcard this block looks like this:

F0: 102B 0000                                                             
F6: 3800 00A0                                                             
F3: 4000 0036                                                             
F5: 0000 0000                                                             
V0: 0000 0000 [0001]                                                      
00: 0000 0000                                                             
BP: 0000 0041 [0000]                                                      
G0: 0190 0000                                                             
T0: 0000 0448 [000F]                                                      
Jump to BL    

is that right? i have not flashed uboot yet (need to compile it in ubuntu 4.14)…

flashed now also atf and uboot…

root@bpi-r64:~# mount /dev/mmcblk0p1 /boot                                      
root@bpi-r64:~# ls /boot/                                                       
bananapi                            preloader_evb7622_64_forsdcard-2k.img       
BPI-R2-HEAD1-512b.img               System Volume Information                   
BPI-R2-HEAD440-0k.img               u-boot-r64.bin                              
BPI-R64-atf.img                     u-boot-r64-fwu.bin                          
root@bpi-r64:~# dd of=/dev/mmcblk1 if=/boot/BPI-R64-atf.img bs=1k seek=512      
256+0 records in                                                                
256+0 records out                                                               
262144 bytes (262 kB) copied, 0.0378364 s, 6.9 MB/s                             
root@bpi-r64:~# dd of=/dev/mmcblk1 if=/boot/u-boot-r64.bin bs=1k seek=768       
391+1 records in                                                                
391+1 records out                                                               
400664 bytes (401 kB) copied, 0.0474521 s, 8.4 MB/s    

but still “system halt”, does this mean that preloader is wrong or other bootstage? i also tried to change position of switch next to reset-button to 1…same result looking in log of sd-boot seems that preloader is not started…

T0: 0000 0454 [000F]                                                            
Jump to BL                                                                      
UNIVPLL_CON0 = 0xFE000000!!!                                                    
mt_pll_init: Set pll frequency for 25M crystal                                  
[PMIC_WRAP]wrap_init pass,the return value=0.                                   
[pmic_init] Preloader Start..................          

other preloader-file does also not work…or is preloader needed also on mmcblk1?

after compiling mmcutils for r64 and read Partitionconfig i see this:

root@bpi-r64:~# ./mmc extcsd read /dev/mmcblk1 | grep 'PARTITION_CONFIG'                                                                                       
Boot configuration bytes [PARTITION_CONFIG: 0x00]

so i tried to set it:

root@bpi-r64:~# ./mmc bootpart enable 1 1 /dev/mmcblk1                                                                                                         
root@bpi-r64:~# ./mmc extcsd read /dev/mmcblk1 | grep 'PARTITION_CONFIG'                                                                                       
Boot configuration bytes [PARTITION_CONFIG: 0x48]                                                                                                              

but boot is still not possible (also tried with bootswitch and reflashed preloader-bpi-r64-2k.img)…does preloader init emmc??

for sdcard i have it running except uboot…seems to need mtk-headers…with the u-boot-mtk.bin it works

can you explain what this do (what is LK)?

btw. i’ve managed to boot up a sd-card created from scratch (flash headers above, my modified uboot and boostrapped debian stretch) and also get netboot running on r64

uploaded image here:

(dorabmon) #42

繼續 Banana Pi BPI-R64 open source router with MTK MT7622 64 bit chip design 的討論:

There is a pending patch not in mainline kernel,

could you help to apply the patch manually to your tree and see if it get betters?

if there is no the patch, the serial path won’t work properly.

(dorabmon) #43

please keep updates from

all firmware for mediatek device would be kept at

that is a separate tree apart from linux mainline kernel for firmware maintenance.

(Frank W.) #44

Had applied the patch allready applied

Used firmware from Banana Pi BPI-R64 open source router with MTK MT7622 64 bit chip design but it is not applied because of error above (same error with ryders/your patch

(dorabmon) #45

it looks like you also enabled spi0 if you use the default dts, try to disable spi0 at

spi0 already occupy the same pin 65 you want to software program in shell

(dorabmon) #46

try to change the line from

usleep_range(12000, 12100);



that is just a experiment to test whether power domain is not ready when bluetooth wants to be active

if issue is still, you can try below several times to see if it is always issue or seldom issue.

hciconfig hci0 down
hciconfig hci0 up
hciconfig hci0 down
hciconfig hci0 up

BPI-R64 Kernel-Development
(Frank W.) #47

How do you get spi0-relationship?

I try gpio56=pin3 spi0 is pin 31,32,36 according to shematic (= gpios 82,64,65)

(dorabmon) #48

pin 56 might be occupied by i2c1 if you used the default dts from upstream

you should disable the node before you want to software program that pin

BPI-R64 Kernel-Development
(Frank W.) #49

gpio-issue solved so far…gpio was blocked by activated i2c1…so if the special-function is enabled in dts, the direct gpio-access is blocked

root@bpi-r64:~# GPIO_NO=$((409+56))                                             
root@bpi-r64:~# echo $GPIO_NO                                                   
root@bpi-r64:~# echo $GPIO_NO > /sys/class/gpio/export                          
root@bpi-r64:~# echo out > /sys/class/gpio/gpio${GPIO_NO}/direction             
root@bpi-r64:~# echo 1 > /sys/class/gpio/gpio${GPIO_NO}/value                   
root@bpi-r64:~# echo 0 > /sys/class/gpio/gpio${GPIO_NO}/value

my led goes on and off :slight_smile:

root@bpi-r64:~# apt-get install bluez
root@bpi-r64:~# uname -a                                                                                                                 
Linux bpi-r64 4.19.0-r64-main #70 SMP PREEMPT Sat Feb 9 09:53:04 CET 2019 aarch64 GNU/Linux                                              
root@bpi-r64:~# dmesg | grep hci0                                                                                                        

root@bpi-r64:~# bluetoothctl                                                                                                             
[NEW] Controller 00:00:46:76:22:01 bpi-r64 [default]                                                                                     
[bluetooth]# power on                                                                                                                    
Changing power on succeeded                                                                                                              
[bluetooth]# scan on                                                                                                                     
Discovery started                                                                                                                        
[CHG] Controller 00:00:46:76:22:01 Discovering: yes                                                                                      
[bluetooth]# [  134.372291] Bluetooth: hci0: last event is not cmd complete (0x0f)
[CHG] Device B4:9D:0B:5F:2A:B9 Name: Aquaris X5 Plus
[CHG] Device B4:9D:0B:5F:2A:B9 ServicesResolved: yes                                                                                     
[CHG] Device B4:9D:0B:5F:2A:B9 Paired: yes                                                                                               
Pairing successful                                                                                                                       
[CHG] Device B4:9D:0B:5F:2A:B9 ServicesResolved: no                                                                                      
[CHG] Device B4:9D:0B:5F:2A:B9 Connected: no                                                                                             
[bluetooth]# [  207.332516] Bluetooth: hci0: last event is not cmd complete (0x0f)                                                       
[bluetooth]# exit                                                                                                                        
[DEL] Controller 00:00:46:76:22:01 bpi-r64 [default]                                                                                     

except of the event-info/warning all is good now

Bluetooth: hci0: last event is not cmd complete (0x0f)

the change seems to create problems detecting mmc-rootfs

sometimes i get this message and boot-prcess hangs

Waiting for root device /dev/mmcblk0p2...

@linkerosa have you an idea regarding preloader and emmc?


Hello, I want to attach an SSD and need SATA 3 speed (ie. 6 Gbps). Which of the boards has all these features: Gigabit Ethernet, USB 3, SATA 3 ? Thx

Update: in the following thread someone wrote “The BPI-R2 has two SATA 3.0 Ports / 6 Gbps and not SATA II” ( SATA Performance + Max Disk Size ). But in many product descriptions only SATA 2 is mentioned, also in the Hardware spec wiki ( ) it says “Two SATA 2.0 Port”

What is correct?

(Frank W.) #51

Regardless if it is sata 3,you will not reach the speed of 6gbit/s. Why does it matter for you?

Btw. This thread is for r64


Hi, I’m just a newbie, don’t know yet the features of the different boards, I wongly assumed the R64 is the successor to R2; it seems it is rather the W2.

I just wanted evaluate the possibilities of building a backup-box to be used in LAN with multiple client-machines to backup, so the LAN and the storing to the SSD should be as fast as possible as this shall be a “realtime” backup solution, ie. always on, though incremental, and it should serve as many clients as possible. So I assumed getting full SATA III speed, but later learned that it’s not a full SATA III like you remarked too. I need to find a cheap HW for this project. Today I found another one (Rock Pi 4 for $39), it looks promising, but it lacks SATA; has only USB3, and not clear yet if one can use Debian on it. It’s not easy to find the right HW for the project as I’m more a SW guy…

(Frank W.) #53

imho most SOCs don’t have native SATA-support…i don’t know how it realized on R2/R64, imho as pcie-sata-bridge, where mini-pcie has limitation to 500Mbit/s, so it is not possible to reach sata2/3-throughput…but please make a new thread if needed

(Frank W.) #54

for GPIO, how to disable pwm-mapping?

i get this error for pin7 (gpio101):

root@bpi-r64:~# GPIO_NO=$((409+101)) 
root@bpi-r64:~# echo $GPIO_NO > /sys/class/gpio/export
[  365.604377] mtk-pinctrl 10211000.pinctrl: pin PWM7 already requested by 11006000.pwm; cannot claim for pinctrl_mt7622:510
[  365.615703] mtk-pinctrl 10211000.pinctrl: pin-101 (pinctrl_mt7622:510) status -22
-bash: echo: write error: Invalid argument

but nice that here is a message for blocked access

can i disable it from userspace or only in dts?

it seems it is this section in dts:

only pwm7 seems to be defined, why not the others? maybe we can define pwm1-7 (except 3, i’ve did not found on header)

can i use generic pwm-node and define subnodes for pwm1-7?

something like this (of course i have to define the pwmx_pins):

&pwm {
	pinctrl-names = "default";
	status = "okay";
		pinctrl-0 = <&pwm1_pins>;
		pinctrl-0 = <&pwm2_pins>;
		pinctrl-0 = <&pwm4_pins>;


maybe we can define pwm1-7 (except 3, i’ve did not found on header)

Sure! you could add it if you want to do that.

can i use generic pwm-node and define subnodes for pwm1-7? something like this (of course i have to define the pwmx_pins):

You can take a look at i2c/spi nodes to understand how to add “generic pin configuration” (via function/group) in dts