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

MT7615 not on board now ,just use it with module. so this module can use on BPI-R2 and BPI-R64

is no bad decision,because there is no opensource-driver for it yet. For r2 i think it cannot be used (at least in rev 1.1) because module is too wide (bend over coils/voltage-regulators next to 40pin-header)

coils on r2: regulators_

which cards have you mounted on? these are normal-width-cards (full size=length)ā€¦afair mt7615 is 2times wider (nearly square)

but there are still wifi-antenna-connector at bottom of your pictureā€¦

1 Like

maybe we can use some extender like that:

i have tried this one:

but did not getting it working

@sinovoip have you a storage-overview like this for r64? is also preloader needed (if yes which one is the right)?

currently i try gpioā€¦

after adding CONFIG_GPIO_SYSFS to my Kernel i see /sys/class/gpio, but i cannot export it (i try gpio56=pin3)

root@bpi-iot-ros-ai:~# cat /sys/kernel/debug/pinctrl/10211000.pinctrl-pinctrl_mt7622/gpio-ranges
GPIO ranges handled:
0: pinctrl_mt7622 GPIOS [409 - 511] PINS [0 - 102]
root@bpi-iot-ros-ai:~# GPIO_NO=$((409+56))
root@bpi-iot-ros-ai:~# echo $GPIO_NO
465
root@bpi-iot-ros-ai:~# echo $GPIO_NO > /sys/class/gpio/export
-bash: echo: write error: Invalid argument

any idea?

have included BT (from https://github.com/objelf/linux/commit/f5384792c20356d5d49af29aaf0a1c4bc763537e), but it seems i need a firmwarefile

[    5.081560] bluetooth hci0: Direct firmware load for mediatek/mt7622pr2h.bin failed with error -2                                     
[    5.090811] Bluetooth: hci0: Failed to load firmware file (-2)

you can get BT firmware from here :slight_smile:

https://github.com/wkennington/linux-firmware/tree/master/mediatek

thanks, i put the file to /lib/firmware, but still get the error

dmesg | grep hci0
[    4.888999] bluetooth hci0: Direct firmware load for mediatek/mt7622pr2h.bin failed with error -2
[    4.898991] Bluetooth: hci0: Failed to load firmware file (-2)
[    5.058857] bluetooth hci0: Direct firmware load for mediatek/mt7622pr2h.bin failed with error -2
[    5.068074] Bluetooth: hci0: Failed to load firmware file (-2)
root@bpi-iot-ros-ai:~# ls /lib/firmware/
ap6210  ap6212  brcm  mt7622pr2h.bin
root@bpi-iot-ros-ai:~# bluetoothctl
[bluetooth]# power on
No default controller available

where does the driver look for the firmware? i have used kernel-documentation: https://www.kernel.org/doc/html/latest/driver-api/firmware/fw_search_path.html

oh i see that a subfolder mediatek is usedā€¦so i put it thereā€¦and after reboot i got this:

root@bpi-iot-ros-ai:~# ls /lib/firmware/mediatek
mt7622pr2h.bin
root@bpi-iot-ros-ai:~# dmesg | grep hci0
[   14.819610] Bluetooth: hci0: Execution of wmt command timed out   
[   14.819672] Bluetooth: hci0: Failed to send wmt patch dwnld (-110)

first message seem to come from here: https://github.com/frank-w/BPI-R2-4.14/blob/4.19-r64-main/drivers/bluetooth/btmtkuart.c#L122 second from here: https://github.com/frank-w/BPI-R2-4.14/blob/4.19-r64-main/drivers/bluetooth/btmtkuart.c#L168

so mtk_setup_fw calls

mtk_hci_wmt_sync(hdev, MTK_WMT_PATCH_DWNLD, flag, dlen, fw_ptr);

and this calls

wait_on_bit_timeout(&bdev->tx_state, BTMTKUART_TX_WAIT_VND_EVT, TASK_INTERRUPTIBLE, HCI_INIT_TIMEOUT);

which failed with timeout, did i miss anything (btif should be enabled cause of removed disabled-line)

btif: serial@1100c000 {

so i looked here:

root@bpi-iot-ros-ai:~# cat /sys/firmware/devicetree/base/serial@1100c000/status                                      
okay
root@bpi-iot-ros-ai:~# cat /sys/firmware/devicetree/base/serial@1100c000/bluetooth/status
okay

any idea about gpio? official site makes same calculation but with gpio22 which does not exist on 40pin-header (depending on shematic above)

@Jackzeng can you explain ATF-binary

ATF seems to stand for ARM trusted firmwareā€¦https://chromium.googlesource.com/external/github.com/ARM-software/arm-trusted-firmware/+/v0.4-rc2/docs/firmware-design.md

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                          
preloader_bpi-r64_forsdcard-2k.img                                              
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

https://github.com/frank-w/BPI-R64-bsp/blob/33f0f03618ae5b381e6af65bd923b830dd5e26b2/u-boot-mt/Makefile#L831

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:

https://drive.google.com/open?id=1rQCiUaR915BCqYG220DUm75bZQwt5N8i

ē¹¼ēŗŒ Banana Pi BPI-R64 open source router with MTK MT7622 64 bit chip design ēš„čØŽč«–:

There is a pending patch not in mainline kernel,

https://lkml.org/lkml/2018/12/13/29

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.

please keep updates from https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/

all firmware for mediatek device would be kept at https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/mediatek

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

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

https://elixir.bootlin.com/linux/v5.0-rc5/source/Documentation/devicetree/bindings/pinctrl/pinctrl-mt7622.txt#L292

https://elixir.bootlin.com/linux/v5.0-rc5/source/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts#L427

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

https://elixir.bootlin.com/linux/v5.0-rc5/source/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts#L497

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

https://elixir.bootlin.com/linux/v5.0-rc5/source/drivers/soc/mediatek/mtk-scpsys.c#L248

try to change the line from

usleep_range(12000, 12100);

to

msleep(50);

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

ā€¦

1 Like

How do you get spi0-relationship?

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

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

https://elixir.bootlin.com/linux/v5.0-rc5/source/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts#L139

https://elixir.bootlin.com/linux/v5.0-rc5/source/Documentation/devicetree/bindings/pinctrl/pinctrl-mt7622.txt#L224

1 Like

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                                                   
465                                                                             
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:~# 

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]                                                                                     
root@bpi-r64:~# 

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 ( http://wiki.banana-pi.org/Banana_Pi_BPI-R2#Documents ) it says ā€œTwo SATA 2.0 Portā€

What is correct?

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ā€¦

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