I finished my first round of testing the new kerned on my BPI-R3 board.

I have had problems trying to get a v6.8 kernel build working from
Dederik's Salsa fork (
https://salsa.debian.org/diederik/linux/-/tree/bananapi-r3-support/debian).
This likely due to my unfamiliarity with building the Debian kernel. It
would be nice if Salsa automatically built the arm64 .deb files but it
seems that is restricted to only certain people because it needs a (rare?)
arm64 CI runner.

So instead after constructing a working testing/sid root filesystem on an
SD card via debootstrap I have installed and tested a v6.10 kernel build
that Dederik supplies me with. The kernel version string for this is:
Linux version 6.10-rc3+unreleased-arm64 (debian-ker...@lists.debian.org)
(aarch64-linux-gnu-gcc-13 (Debian 13.2.0-25) 13.2.0, GNU ld (GNU Binutils
for Debian) 2.42) #1 SMP Debian 6.10~rc3-1~cknow (2024-04-24)

I booted the kernel via EFI and the next branch of U-boot. I haven't yet
got distro-boot working. The device tree is a modified version of the
upstream linux device tree file "mediatek/mt7986a-bananapi-bpi-r3.dtb"
which fixes a few bugs I have found with the M.2 slot. I also repeated
testing with the unmodified upstream version to verify any problems I found
were not caused by those changes.

The device tree requires applying various overlay files
("mt7986a-bananapi-bpi-r3-nor.dtbo", "mt7986a-bananapi-bpi-r3-nand.dtbo",
"mediatek/mt7986a-bananapi-bpi-r3-sd.dtbo",
"mediatek/mt7986a-bananapi-bpi-r3-emmc.dtbo") to select the correct
configuration for the attached storage chips. These chips are
enabled/disabled by the boot selection DIP switch labelled "SW1" on the
board. You can choose between the NOR or NAND chip, as well as the SD card
slot or eMMC chip. So the combinations are: NOR + SD, NOR + eMMC, NAND +
SD, NAND + eMMC. Since I was booting from an SD card I have not yet tested
the eMMC chip.

So far I have tested all the various onboard connectors/devices except: the
CON1 pins (includes extra UARTs, I2C, SPI, PWM, audio codec pins), the USB2
header pins, mini PCIe slot (USB + SIM only), M.2 slot, eMMC flash chip. I
will work through the remaining connectors once I get what I need to test
them (NVMe SSD, breakout boards, etc).

The kernel boots successfully and I make it all the way to the login screen
via serial as well as the SSH server working. All tested devices work
except for:

SoC Hardware Accelerated Cryptography
Device Tree name: "crypto: crypto@10320000"
DT compatible: "inside-secure,safexcel-eip97"
Issue:
In the kernel dmesg boot log there are a variety of errors like:
> [    8.910388] alg: ahash: safexcel-sha384 test failed (wrong result) on
test vector 1, cfg="init+update+final aligned buffer"
> [    8.921577] alg: self-tests for sha384 using safexcel-sha384 failed
(rc=-22)

These errors are repeated for: "safexcel-sha384" "safexcel-sha512"
"safexcel-hmac-sha384" "safexcel-hmac-sha512"
"safexcel-authenc-hmac-sha512-cbc-aes"
"safexcel-authenc-hmac-sha512-cbc-des3_ede"
"safexcel-authenc-hmac-sha384-cbc-des3_ede"
"safexcel-authenc-hmac-sha512-cbc-des"
"safexcel-authenc-hmac-sha384-cbc-des".
I did not see this error in the Ubuntu v6.8 kernel, so I will be interested
to test the Debian v6.8 kernel once I get it building to see if this is a
regression in the v6.10 kernel.

SoC SNFI Serial Flash Bus
Device Tree name: "snand: snfi@11005000"
DT compatible: "mediatek,mt7986-snand"
Issue:
On my board the U14 solder pads for a SNFI chip are unpoplated so this
should remain disabled in the device tree, however the list of build
available kernel modules is missing the driver for this SoC interface. So
if I populated this chip then the device would not work anyway.
The fix here is to build the "spi-mtk-snfi" module from the MTD drivers.

SPIM NAND Chip
Device Tree name: "spi0: spi@1100a000" -> "flash@0"
DT compatible: "spi-nand"
Issue:
When using the NAND DT overlay, the flash device is not loaded due to a
missing module.
The fix here is to build the "spi-nand" module from the MTD drivers.

SFP RJ45 2.5 GbE Modules
Device Tree name: "sfp1: sfp-1" "sfp2: sfp-2"
DT compatible: "sff,sfp"
Issue:
Banana Pi sell some SFP to RJ45 2.5GBASE-T modules on their site advertised
for use with the BPI-R3 board. After plugging them into the board the
kernel finds them in the boot log:
> [    2.744506] sfp sfp-1: Host maximum power 3.0W
> [    2.768976] sfp sfp-2: Host maximum power 3.0W
> [    3.105275] sfp sfp-2: module OEM              SFP-2.5G-T-R-RM  rev
1.0  sn 2405070133       dc 240507
> [    3.135654] sfp sfp-1: module OEM              SFP-2.5G-T-R-RM  rev
1.0  sn 2405070134       dc 240507

But the resulting eth0/eth1 devices do not work. Searching on the Banana Pi
forum, and then the kernel net mailing list it appears that patches to
support these devices have not yet been accepted upstream.
So I will need to get a different SFP module that is supported by the
kernel to finish testing. Hopefully kernel support is added in the future
for these generic "OEM" modules.

2.4 GHz & 5 GHz WiFi
Device Tree name: "wifi: wifi@18000000"
DT compatible: "mediatek,mt7986-wmac"
Issue:
Initially the kernel boot log was saying the required firmware files could
not be found:
> [   12.223999] mt798x-wmac 18000000.wifi: HW/SW Version: 0x8a108a10,
Build Time: 20221012174743a
> [   12.421392] mt798x-wmac 18000000.wifi: WM Firmware Version:
____000000, Build Time: 20221012174805
> [   12.502713] mt798x-wmac 18000000.wifi: WA Firmware Version:
DEV_000000, Build Time: 20221012174937
> [   13.353937] mt7530-mdio mdio-bus:1f eth2: Link is Up - 1Gbps/Full -
flow control rx/tx
> [   33.762672] mt798x-wmac 18000000.wifi: Message 00000002 (seq 9) timeout
> [   33.769356] mt798x-wmac 18000000.wifi: Failed to start WA firmware
> [   33.775740] mt798x-wmac 18000000.wifi: probe with driver mt798x-wmac
failed with error -110

I then installed the "linux-firmware" package from testing/sid APT
repository, but the error message persisted. Additionally I saw this
message from update-initramfs:
> update-initramfs: Generating /boot/initrd.img-6.10-rc3+unreleased-arm64
> W: Possible missing firmware /lib/firmware/mediatek/mt7988_wo_1.bin for
module mtk_eth
> W: Possible missing firmware /lib/firmware/mediatek/mt7988_wo_0.bin for
module mtk_eth
> W: Possible missing firmware /lib/firmware/mediatek/mt7986_wo_1.bin for
module mtk_eth
> W: Possible missing firmware /lib/firmware/mediatek/mt7986_wo_0.bin for
module mtk_eth
> W: Possible missing firmware /lib/firmware/mediatek/mt7981_wo.bin for
module mtk_eth

After inspecting the /lib/firmware directory, it seems the APT package
"firmware-misc-nonfree" has firmware for older MediaTek chips, but is
missing files for ant MT79xx including MT7981 and MT7986.
So I cloned the upstream "linux-firmware" git repository, ran "make deb" to
generate a "linux-firmware-upstream_20240610-26-gcea56a5d_all.deb" file.
After installing this deb package the required firmware files were
installed in /lib/firmware/updates.
However I kept getting the error. I ended up searching in Google and found
some notes in OpenWrt bug tickets and on Banana Pi forum that certain
USB-to-serial devices plugged into the UART0 header on the board can cause
this problem. The reason is that one of the UART0 pins is used as a
bootstrap pin for the SoC to configure the WiFi chips, and if the serial
device is pulling the pin the wrong way the WiFi chip will be configured
incorrectly at power on. I needed UART0 to get though U-boot so I tried a
different FTDI USB cable I have that is reported to work with the WiFi.
After powering off/on the board with the FTDI cable plugged in the WiFi
started working.
The driver now loads in the boot log:
[   13.464015] mt798x-wmac 18000000.wifi: HW/SW Version: 0x8a108a10, Build
Time: 20221012174743a
[   13.630128] mt798x-wmac 18000000.wifi: WM Firmware Version: ____000000,
Build Time: 20221012174805
[   13.698079] mt798x-wmac 18000000.wifi: WA Firmware Version: DEV_000000,
Build Time: 20221012174937
[   13.840792] mt798x-wmac 18000000.wifi: eeprom load fail, use default bin
[   13.845097] mt798x-wmac 18000000.wifi: registering led 'mt76-phy0'
[   13.851770] mt798x-wmac 18000000.wifi: registering led 'mt76-phy1'

There is a wlan0/wlan1 device created and iwconfig finds them. I did not
try connecting to a WiFi network as I don't have the antenna cables yet to
plug into the board.

So in summary:
- need to enable building of the "spi-mtk-snfi" and "spi-nand" kernel
modules to support all the flash chips you can use with MT7986
- need to update the Debian "firmware-misc-nonfree" to add the missing
MT79xx firmware files
- possible regression from kernel v6.8 to v6.10 that breaks support for the
"inside-secure,safexcel-eip97" crypto device - I need to get a working
Debian v6.8 kernel build to confirm
- don't plug in a non-FTDI chip based USB-to-serial cable into the UART0
port otherwise WiFi will not work

Reply via email to