Banana Pi BPI-R4 Wifi 7 Module design

no, i have to add another firmware and load it…this is the firmware-loading code which must be upported to mainline (i tried, but it seems something is missing)

There is a standard firmware loading method in the kernel. One puts the firmware in /lib/firmware and there is a kernel api to load it temporarily into ram. You then use your driver specific method to get it into the device. Are you using a different method to try to load the firmware?

Example code:

static bool _rtl92e_fw_prepare(struct net_device *dev, struct rt_fw_blob *blob,
                               const char *name, u8 padding)
{
        const struct firmware *fw;
        int rc, i;
        bool ret = true;

        rc = request_firmware(&fw, name, &dev->dev);
        if (rc < 0)
                return false;

        if (round_up(fw->size, 4) > MAX_FW_SIZE - padding) {
                netdev_err(dev, "Firmware image %s too big for the device.\n",
                           name);
                ret = false;
                goto out;
        }

        if (padding)
                memset(blob->data, 0, padding);
        if (fw->size % 4)
                memset(blob->data + padding + fw->size, 0, 4);
        memcpy(blob->data + padding, fw->data, fw->size);

        blob->size = round_up(fw->size, 4) + padding;

        /* Swap endian - firmware is packaged in invalid endiannes*/
        for (i = padding; i < blob->size; i += 4) {
                u32 *data = (u32 *)(blob->data + i);
                *data = swab32p(data);
        }
out:
        release_firmware(fw);
        return ret;
}

see mtk:wifi commits in 6.8-dango tree

before loading firmware it must be detected which chip is used and some additional fields are needed to be read from firmware or set inside driver

These are patches i tried upporting from bpi repo

When up-porting patches, it is sometimes easier to look at the old kernel, with all the patches applied, and then just follow through in the code how it identifies the chip and loads the firmware, and then modify your code to do something similar. If patches are small patches, you can sometimes just cherry pick them, but for more complex ones, I find just looking at the old kernel, with all the patches applied, is easier to follow and get right.

mt76 codebase above cannot be compiled due to missing Makefile or code error (/scripts/basic/Makefile is an absolute path which is imho wrong)

already reported here from @graphine: Banana Pi BPI-R4 Wifi 7 router board with MediaTek MT7988A (Filogic 880),4G RAM and 8G eMMC - #198 by graphine

make[5]: Entering directory 'BPI-R4-MT76-OPENWRT-V21.02/build_dir/target-aarch64_cortex-a53_musl/linux-mediatek_mt7988/linux-5.4.260
scripts/Makefile.build:42: /scripts/basic/Makefile: No such file or directory

the Makefile.build looks like this:

 39 # The filename Kbuild has precedence over Makefile
 40 kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
 41 kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
 42 include $(kbuild-file)

not sure where the “basic” path comes from…ubuntu 18 is outdated :stuck_out_tongue:

using ubuntu 22.04 and gcc 11…but openwrt builds its own gcc (musl), so this should be not the cause

i see it is already reported BPI-R4 | Compilation error. Please help me! seems there is more than this error and i have not found a hint how to fix this one

I posted a solution for that here Banana Pi BPI-R4 Wifi 7 router board with MediaTek MT7988A (Filogic 880),4G RAM and 8G eMMC - #226 by graphine

It builds fine, just cannot make any changes or build crashes. Making the correct build environment was harder than building the image. I can let you use my build environment, or I can just give you the built image.

which environment do you use?

using image does not help much as i need to add debugs afterwards to compare with upported code

Ubuntu 20.04. Kernel 5.4. Do not update kernel. Switch to gcc 10 and c++ 10. Built fine after that.

No matter what I changed it would cause build to fail. Couldn’t add any drivers or anything. Atleast any changes I tried to make.

And what about a board? Q1 2024 is gone, but no news

Last state i have is this from 2 weeks ago: Banana Pi BPI-R4 BPI-BE14 Wi-Fi7 NIC module - #33 by simon

But having the module is not enough,you want driver support and this is only in downstream openwrt…no mainline support yet (no mainline compatible firmware yet)

Thanks for an answer

Little bit OT:

Which Wifi6 module works with the R4 and OpenWrt? For the time being I want to install a Wifi6 board if the 7 board is not widely available …

look in the mt76 supported boards…e.g. mt7915/mt7916 if they match your requirements, this driver is mapped into openwrt and some of them i have tested on r4 too

thanks, will look into that.

If I get mt7916 WIFI what image can I put on the device which will have the needed drivers and UI for easy router setup?

Please open new thread for this as this is for r4 wifi7 card

There was news today on X about the WIFI7 NIC: https://twitter.com/sinovoip/status/1790331961963401630

Banana Pi BPI-R4 WIFI7 NIC 6 antenna finish all test, and will public sale soon

2 Likes

awesome news. i am wondering if there is a “list” that is recommended to buy, e.g. what antennas exactly (quality etc.), and if there are any things to consider when using a case (layout of the antennas and their connection to the card)