[BPI-R64] PCIe issues

Hi I have tried to enable the network using these commands. but there is no network still.

I recollected that while working with 5.4-main source we had a similar issue. It was resolved by copying mt7622-bananapi-bpi-r64-mt7531.dts in arch/arm64/boot/dts/mediatek/ and updated the Makefile in this folder to include the .dtb while generating the image.

I have applied the same fix to 5.7-main. but I am still unable to get the network. Is this approach correct?

mt7622-bananapi-bpi-r64-mt7531.dts (9.5 KB)

Mt7622-bananapi-r64.dts is for mt7531 (dsa driver)ā€¦you see dsa-ports in ip a,so driver itself worksā€¦ifconfig shows only up ports.

The mt7531 dts file was imho for old driver.

What does not work if you run commands above? They add ip to lan0 only which is second port on r64 (first is wan) so you need to use this port connected to your network

Hi

I am getting an ip address on lan0 and can ping on local network but not google or 8.8.8.8

Then your default route / dns-setting is missing.

ip route add default via 192.168.0.1

Then 8.8.8.8 should work,but dns is os-dependedā€¦i donā€™t know how to do it in openwrtā€¦debian/ubuntu uses resolv.conf

Maybe you can set port up and run dhclient

ip link set lan1 up
dhclient lan1

Hi,

I have got the network working.

You have mentioned in previous post that the 5.7-main source has the google coral driver included. Does that mean I do not have to follow the steps as per this link?

I am not able to see gasket and apex drivers when I do a lsmod command.

Alternatively I am following the process described in link to load the coral drivers.

I am getting the following output when I try the sudo apt install gasket-dkms command

root@bpi-iot-ros-ai:~# sudo apt install gasket-dkms 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  gasket-dkms
0 upgraded, 1 newly installed, 0 to remove and 172 not upgraded.
Need to get 44.7 kB of archives.
After this operation, 240 kB of additional disk space will be used.
Get:1 https://packages.cloud.google.com/apt coral-edgetpu-stable/main arm64 gasket-dkms all 1.0-10 [44.7 kB]
Fetched 44.7 kB in 8s (5,124 B/s)    
Selecting previously unselected package gasket-dkms.
(Reading database ... 55965 files and directories currently installed.)
Preparing to unpack .../gasket-dkms_1.0-10_all.deb ...
Unpacking gasket-dkms (1.0-10) ...
Setting up gasket-dkms (1.0-10) ...
Loading new gasket-1.0 DKMS files...
First Installation: checking all kernels...
It is likely that 5.7.0-bpi-r64 belongs to a chroot's host
Building initial module for 5.7.0-bpi-r64
Error! Bad return status for module build on kernel: 5.7.0-bpi-r64 (aarch64)
Consult /var/lib/dkms/gasket/1.0/build/make.log for more information.
root@bpi-iot-ros-ai:~# cat /var/lib/dkms/gasket/1.0/build/make.log
DKMS make.log for gasket-1.0 for kernel 5.7.0-bpi-r64 (aarch64)
Wed Jun 24 19:48:52 CST 2020
make: Entering directory '/usr/src/linux-headers-5.7.0-bpi-r64'
  AR      /var/lib/dkms/gasket/1.0/build/built-in.a
  CC [M]  /var/lib/dkms/gasket/1.0/build/gasket_core.o
/var/lib/dkms/gasket/1.0/build/gasket_core.c: In function ļæ½ļæ½ā€˜gasket_map_pci_barļæ½ļæ½ā€™:
/var/lib/dkms/gasket/1.0/build/gasket_core.c:319:3: error: implicit declaration of function ļæ½ļæ½ā€˜ioremap_nocacheļæ½ļæ½ā€™ [-Werror=implicit-function-declaration]
   ioremap_nocache(gasket_dev->bar_data[bar_num].phys_base,
   ^
/var/lib/dkms/gasket/1.0/build/gasket_core.c:318:42: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
  gasket_dev->bar_data[bar_num].virt_base =
                                          ^
cc1: some warnings being treated as errors
scripts/Makefile.build:266: recipe for target '/var/lib/dkms/gasket/1.0/build/gasket_core.o' failed
make[1]: *** [/var/lib/dkms/gasket/1.0/build/gasket_core.o] Error 1
Makefile:1729: recipe for target '/var/lib/dkms/gasket/1.0/build' failed
make: *** [/var/lib/dkms/gasket/1.0/build] Error 2
make: Leaving directory '/usr/src/linux-headers-5.7.0-bpi-r64'

I have not said,that coral drivers are includedā€¦only latest pcie drivers for r64 to have a better chance to get it working.

I guess you have not copied your source (content of my 5.7-main) to /usr/src/linux-headers-5.7.0-bpi-r64'

I have copied the source as well in /usr/src/linux-headers-5.7.0-bpi-r64

In fact i am trying to compile the source of gasket driver in bananapi. I get the following issue

root@bpi-iot-ros-ai:/var/lib/dkms/gasket/1.0/source# sudo make
make -C /lib/modules/5.7.0-bpi-r64/build M= modules
make[1]: Entering directory '/usr/src/linux-headers-5.7.0-bpi-r64'
scripts/kconfig/conf  --syncconfig Kconfig
scripts/kconfig/conf: 1: scripts/kconfig/conf: Syntax error: "(" unexpected
scripts/kconfig/Makefile:71: recipe for target 'syncconfig' failed
make[3]: *** [syncconfig] Error 2
Makefile:588: recipe for target 'syncconfig' failed
make[2]: *** [syncconfig] Error 2
Makefile:699: recipe for target 'include/config/auto.conf.cmd' failed
make[1]: *** [include/config/auto.conf.cmd] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.7.0-bpi-r64'
Makefile:13: recipe for target 'all' failed
make: *** [all] Error 2

I guess you need to start compiling on r64 to get necessary files.

I got the errors by compiling on r64 only.

I mean compiling kernel in /usr/src/linux before starting gasket

I am getting the same error when I am compiling the kernel on R64

root@bpi-iot-ros-ai:/usr/src/linux-headers-5.7.0-bpi-r64# ./build.sh 
do not run as root!
root@bpi-iot-ros-ai:/usr/src/linux-headers-5.7.0-bpi-r64# sudo make
scripts/kconfig/conf  --syncconfig Kconfig
scripts/kconfig/conf: 1: scripts/kconfig/conf: Syntax error: "(" unexpected
scripts/kconfig/Makefile:71: recipe for target 'syncconfig' failed
make[2]: *** [syncconfig] Error 2
Makefile:588: recipe for target 'syncconfig' failed
make[1]: *** [syncconfig] Error 2
Makefile:699: recipe for target 'include/config/auto.conf.cmd' failed
make: *** [include/config/auto.conf.cmd] Error 2

Right,my build.sh blocks run by root by defaultā€¦but you can disable this by adding a # at beginning of the exit line after the message

Alternatively you can run this directly on r64

make mt7622_bpi-r64_defconfig
make

Hi Frank, I received some help from Google coral team for using on BPI-R64.

I have received the following feedback The Coral driver requires pcie bus master support and that is not working with the mt7622.

Can we get some support from mt7622 in this area?

Got response from mtk. Root cause should be class == PCI_CLASS_NOT_DEFINED

Can you try 5.8-rc with the pci-class-patch?

Youā€™ve wrote here that on 5.4 with pci-class-patch you got ressource collision error. On 5.8 i have official patchset. Maybe your problem results in power-limitation (there is a thread about mt7615 tx power)

got another answer:

Bpi-r64 pcie slot has hw issue, so we use MTK reference board to test it before and coral card was returned to BPI already so we cannot test it again.

About r64 HW issue, we just have solution to make it stable. Maybe you can ask him to rework the board.

1.Add two 100uf capacitance

2.short pin (red circle) or change to 3K resistance to remove pcie current limit <- itā€™ll cause system unstable when pcie device needs more power from system

i hope these issues are fixed with next r64 version, @sinovoip any info here?

Hi,

I have complied 5.8-rc kernel and loaded on R64. When loading the Gasket driver using sudo apt install I got the following error

root@bpi-iot-ros-ai:/var/lib/dkms/gasket/1.0/build# cat make.log 
DKMS make.log for gasket-1.0 for kernel 5.8.0-rc6-bpi-r64 (aarch64)
Mon Jul 27 19:01:49 CST 2020
make: Entering directory '/usr/src/linux-headers-5.8.0-rc6-bpi-r64'
  AR      /var/lib/dkms/gasket/1.0/build/built-in.a
  CC [M]  /var/lib/dkms/gasket/1.0/build/gasket_core.o
/var/lib/dkms/gasket/1.0/build/gasket_core.c: In function ā€˜gasket_map_pci_barā€™:
/var/lib/dkms/gasket/1.0/build/gasket_core.c:319:3: error: implicit declaration of function ā€˜ioremap_nocacheā€™ [-Werror=implicit-function-declaration]
   ioremap_nocache(gasket_dev->bar_data[bar_num].phys_base,
   ^
/var/lib/dkms/gasket/1.0/build/gasket_core.c:318:42: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
  gasket_dev->bar_data[bar_num].virt_base =
                                          ^
cc1: some warnings being treated as errors
scripts/Makefile.build:280: recipe for target '/var/lib/dkms/gasket/1.0/build/gasket_core.o' failed
make[1]: *** [/var/lib/dkms/gasket/1.0/build/gasket_core.o] Error 1
Makefile:1756: recipe for target '/var/lib/dkms/gasket/1.0/build' failed
make: *** [/var/lib/dkms/gasket/1.0/build] Error 2
make: Leaving directory '/usr/src/linux-headers-5.8.0-rc6-bpi-r64'

Is this function not available in 5.8-rc kernel? What do I need to fix this?

this was dropped in 5.6ā€¦in wifi-driver i changed to ioremap()

i have downloaded the commit d1aed33 and using the same where i am getting this error.

look at the commit iā€™ve posted itselfā€¦it is a way to fix gasket-code (i have done it to r2 wifi-driver and it links to upstream-commit which removes the ioremap_nocache for further information). you have to change gasket-code

have you modified your r64 like iā€™ve posted above (adding capacitor/removing resistor)