[Banana Pi BPi-R2] updated OpenWrt image

I spent my weekend (and some evenings) updating the OpenWrt build for the BPi-R2.

What I did:

  • bumped Linux to 5.10.51
  • updated U-Boot to 2021.04, many new features enabled
  • colorful bootmenu and recovery vs. production dual-boot, just like on the R64 (but no PSTORE yet, not sure if that’s even possible with the old preloader)
  • no more external scripts and helpers involved in build, all the magic happens in target/linux/mediatek/image/mt7623.mk now.
  • no more bootfs FAT partition – now that we have support for parsing uImage.FIT in Linux, there is no need to imitate this anti-pattern originating from the IBM PC and MSDOS…
  • just like on the R64, bootdevice is auto-detected when accessing U-Boot environment from inside OpenWrt (fw_printenv now installed by default) and also sysupgrade works on both, eMMC and SD card, depending on what was used for booting.

What is not working yet:

  • HDMI and multimedia features (@frank-w is working on that with upstream afaik)
  • 2nd CPU port connected to MT7530 switch (making use of dsa-tag-protocol could help)
  • on-board IEEE802.11bgn 1T1R WiFi (no driver)
  • Bluetooth (?)
  • some LEDs are not mapped correctly (volunteers?)
  • AHCI driver triggers some MSI related warnings, SATA seems to work nice anyway

You can download from https://downloads.openwrt.org/snapshots/targets/mediatek/mt7623/openwrt-mediatek-mt7623-bananapi_bpi-r2-sdcard.img.gz or build from source yourself if you want to give it a try.

4 Likes

Hi Daniel,

thanks for your work

Afair it is working in mainline since 5.10. Broken in 5.13 due to mmsys patch (change to array,patch open),

https://patchwork.kernel.org/project/linux-mediatek/patch/[email protected]/

again in 5.14 due to atomic patches (patch tested,maybe merged soon)

https://patchwork.kernel.org/project/linux-mediatek/patch/[email protected]/

and currently about to be broken again in 5.15 by larb cleanup (fix wip by author,should be in v7)

https://patchwork.kernel.org/project/linux-mediatek/list/?series=515129

These 2 need the large mt6625l driver you can find on my repo (drivers/misc/mediatek and some changes outside).

Which do you mean?

Yes there is an easy (but not portable) patch i use afair in 5.10.later versions using patch series that should be merged finally in 5.12/13.

Hello,

I did send this patch to openwrt regarding SATA access for the R2:

http://patchwork.ozlabs.org/project/openwrt/list/?series=249025

I see this patch is not yet approved to be merged, but well, it fixed accessing SATA disks in my case using branch 21.02. Can you try it as well and see if it works ? I could imagine this module gets loaded from another one in your configurations.

Hi, why does openwrt use different drivers for r2 and r64? Afair in mainstream it is same driver

The R64 uses the in-SoC SATA of MT7622. The R2 uses an additional PCIe-connected AHCI chip to provide SATA. Hence different drivers.

@pleira I only see your patch now, should have scanned patchwork before getting started. Anyway, it’s part of the changes I did, because I also noticed that we are dealing with “normal” PCIe AHCI here.

Maybe I’m lacking some things in DTS? I’m using the device-tree which got shipped with Linux, this is what the revelant part of the bootlog looks like:

...
[    0.466476] mediatek-hdmi-phy 10209100.phy: Using default TX DRV impedance: 4.2k/36
...
[    1.056720] mediatek-disp-ovl 14007000.ovl: error -2 can't parse gce-client-reg property (0)
[    1.058591] random: crng init done
[    1.067773] mediatek-disp-rdma 14008000.rdma: error -2 can't parse gce-client-reg property (0)
[    1.079393] mediatek-disp-rdma 14012000.rdma: error -2 can't parse gce-client-reg property (0)
[    1.090035] mediatek-drm mediatek-drm.1.auto: Adding component match for /ovl@14007000
[    1.098004] mediatek-drm mediatek-drm.1.auto: Adding component match for /rdma@14008000
[    1.106080] mediatek-drm mediatek-drm.1.auto: Adding component match for /color@1400b000
[    1.114238] mediatek-drm mediatek-drm.1.auto: Adding component match for /rdma@14012000
[    1.122259] mediatek-drm mediatek-drm.1.auto: Adding component match for /dpi@14014000
[    1.130983] mediatek-mipi-tx 10010000.mipi-dphy: can't get nvmem_cell_get, ignore it
[    1.141437] [drm] hdmi-audio-codec driver bound to HDMI
...
[    2.119677] mediatek-dpi 14014000.dpi: Found bridge node: /hdmi@14015000
[    2.126594] mediatek-dpi 14014000.dpi: Failed to add component: -517
...
[    2.226750] mediatek-dpi 14014000.dpi: Found bridge node: /hdmi@14015000
[    2.233641] mediatek-dpi 14014000.dpi: Failed to add component: -517
[    2.240918] mediatek-dpi 14014000.dpi: Found bridge node: /hdmi@14015000
[    2.247823] mediatek-dpi 14014000.dpi: Failed to add component: -517
...

That looks a bit like the good-old Ralink driver and will most likely also require a modified version of hostapd for anything else than Android-like use… Does AP-mode actually work with this driver in OpenWrt?

At least in U-Boot, the green and blue LEDs are swapped and polarity is inverted. The red LED cannot be controlled at all atm. I didn’t find the time to investigate this further…

Can you share a link to the (portable) variant of that patch which got merged in 5.12/5.13?

Hdmi: parse gce-client-reg property is new to me…hdmi should work without modifications at least till 5.12. If you have the dtsnodes i’ve added to mainline (in new mt7623n.dtsi) then my series is working for hdmi (not tested mipi). Errors don’t look like compatibility problem (screen mode)

https://patchwork.kernel.org/project/linux-mediatek/patch/[email protected]/

Ok,did not tested leds in uboot,but fixed them in linux some time ago.afair blue and green were swapped and active_low instead of high (ah you’ve wrote it).just make same changes i did in linux :slight_smile:

https://patchwork.kernel.org/project/linux-mediatek/patch/trinity-28694d63-092a-48be-aade-ba680b5c4e70-1529921159405@3c-app-gmx-bs16/

For wifi…default hostapd works,but driver needs wmt-tools to create interfaces/apply Firmware.

For pci/msi this should be last version: https://patchwork.kernel.org/project/linux-mediatek/list/?series=458163

2 Likes

Does adhoc/mesh point work?

Imho not with internal wifi…better use external card for this

Do you want to add mt6625l driver to openwrt? I’m sure it will not go upstream,so only in a users repo

1 Like

Gce-client-reg seems to be for mt8183 merged to 5.12

https://www.mail-archive.com/[email protected]/msg2523481.html

Which kernel do you use,are there any backports for hdmi? I wonder why this seems required in openwrt for r2. I do not need it in 5.14…but some fixes like described above

Try disable mtk_cmdq

https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/mediatek/mtk_disp_ovl.c#L403

Actually I want to have a PCIE WiFI Card with which I can play around. However, I wanted to let the some university buy the stuff and then you have the issue that you can not order from asia-rf…I need a europe shop. :confused:

Are the emmc installation steps still up-to-date?

No. This now works exactly like on the new OpenWrt image of the R64 (ie. much easier, no need to build from source, you can just install from SD card to eMMC):

2 Likes

I saw your recent openwrt commits, that’s why I asked! :slight_smile: Great work!

Is there a way to make onboard USB OTG slot work on unielec mt7623a board? I’ve got as far as this:

Bus 003 Device 001: ID 1d6b:0002 Linux 5.10.51 musb-hcd MUSB HDRC host driver

I made some tests with otg on bpi-r2 (see x-otg branches in my repo including otg nodes). Got it so far that i can mount usb storage (with debugfs) but driver is unstable on poweroff (traceback),so i have not merged it.

Yep, I saw your work, but in my case quectel modem is not detected at all – while it’s working fine if connected to normal usb using external enclosure.

To initialize otg afair i need to enter some commands in debugfs. Seems like roleswitch does not work properly and the traceback on regulator on poweroff

This should be last state:

These are my notes about otg: https://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:otg

Wrote a bit with author,but got no response on latest questions :frowning:

On Startup I get following error:

------------[ cut here ]------------
WARNING: CPU: 2 PID: 112 at include/linux/msi.h:219 pci_msi_setup_msi_irqs.constprop.8+0x64/0x6c
Modules linked in: ahci(+) libahci libata sd_mod scsi_mod gpio_button_hotplug
CPU: 2 PID: 112 Comm: kmodloader Not tainted 5.10.52 #0
Hardware name: Mediatek Cortex-A7 (Device Tree)
[<c010da54>] (unwind_backtrace) from [<c010a018>] (show_stack+0x10/0x14)
[<c010a018>] (show_stack) from [<c04ad738>] (dump_stack+0x8c/0xa0)
[<c04ad738>] (dump_stack) from [<c011be7c>] (__warn+0xc0/0xd8)
[<c011be7c>] (__warn) from [<c011bee4>] (warn_slowpath_fmt+0x50/0x94)
[<c011bee4>] (warn_slowpath_fmt) from [<c04fca00>] (pci_msi_setup_msi_irqs.constprop.8+0x64/0x6c)
[<c04fca00>] (pci_msi_setup_msi_irqs.constprop.8) from [<c04fd128>] (__pci_enable_msi_range+0x20c/0x3c8)
[<c04fd128>] (__pci_enable_msi_range) from [<c04fdb50>] (pci_alloc_irq_vectors_affinity+0xd4/0x114)
[<c04fdb50>] (pci_alloc_irq_vectors_affinity) from [<bf07bafc>] (ahci_init_one+0x660/0x908 [ahci])
[<bf07bafc>] (ahci_init_one [ahci]) from [<c04ec450>] (pci_device_probe+0xa4/0x138)
[<c04ec450>] (pci_device_probe) from [<c05bcf40>] (really_probe+0xfc/0x3d4)
[<c05bcf40>] (really_probe) from [<c05bd390>] (driver_probe_device+0x5c/0xb4)
[<c05bd390>] (driver_probe_device) from [<c05bd588>] (device_driver_attach+0x58/0x60)
[<c05bd588>] (device_driver_attach) from [<c05bd5e8>] (__driver_attach+0x58/0xcc)
[<c05bd5e8>] (__driver_attach) from [<c05bb414>] (bus_for_each_dev+0x68/0x8c)
[<c05bb414>] (bus_for_each_dev) from [<c05bc38c>] (bus_add_driver+0x1c8/0x1d8)
[<c05bc38c>] (bus_add_driver) from [<c05bddbc>] (driver_register+0x74/0x108)
[<c05bddbc>] (driver_register) from [<c01018c4>] (do_one_initcall+0x84/0x1d8)
[<c01018c4>] (do_one_initcall) from [<c01a3a60>] (do_init_module+0x5c/0x238)
[<c01a3a60>] (do_init_module) from [<c01a5e64>] (load_module+0x2124/0x23e8)
[<c01a5e64>] (load_module) from [<c01a6270>] (sys_init_module+0x148/0x168)
[<c01a6270>] (sys_init_module) from [<c0100060>] (ret_fast_syscall+0x0/0x54)
Exception stack(0xc2267fa8 to 0xc2267ff0)
7fa0:                   00000000 00000000 00bb8010 00005b88 000129d9 00010300
7fc0: 00000000 00000000 00000005 00000080 00005b88 00000000 b6f12ac0 00000000
7fe0: bea06d14 bea06cf8 00011e1c b6ec5ce8
---[ end trace a7031d006cbb3751 ]---
------------[ cut here ]------------
WARNING: CPU: 2 PID: 112 at include/linux/msi.h:225 free_msi_irqs+0x1ac/0x1b0
Modules linked in: ahci(+) libahci libata sd_mod scsi_mod gpio_button_hotplug
CPU: 2 PID: 112 Comm: kmodloader Tainted: G        W         5.10.52 #0
Hardware name: Mediatek Cortex-A7 (Device Tree)
[<c010da54>] (unwind_backtrace) from [<c010a018>] (show_stack+0x10/0x14)
[<c010a018>] (show_stack) from [<c04ad738>] (dump_stack+0x8c/0xa0)
[<c04ad738>] (dump_stack) from [<c011be7c>] (__warn+0xc0/0xd8)
[<c011be7c>] (__warn) from [<c011bee4>] (warn_slowpath_fmt+0x50/0x94)
[<c011bee4>] (warn_slowpath_fmt) from [<c04fcbb4>] (free_msi_irqs+0x1ac/0x1b0)
[<c04fcbb4>] (free_msi_irqs) from [<c04fd1d8>] (__pci_enable_msi_range+0x2bc/0x3c8)
[<c04fd1d8>] (__pci_enable_msi_range) from [<c04fdb50>] (pci_alloc_irq_vectors_affinity+0xd4/0x114)
[<c04fdb50>] (pci_alloc_irq_vectors_affinity) from [<bf07bafc>] (ahci_init_one+0x660/0x908 [ahci])
[<bf07bafc>] (ahci_init_one [ahci]) from [<c04ec450>] (pci_device_probe+0xa4/0x138)
[<c04ec450>] (pci_device_probe) from [<c05bcf40>] (really_probe+0xfc/0x3d4)
[<c05bcf40>] (really_probe) from [<c05bd390>] (driver_probe_device+0x5c/0xb4)
[<c05bd390>] (driver_probe_device) from [<c05bd588>] (device_driver_attach+0x58/0x60)
[<c05bd588>] (device_driver_attach) from [<c05bd5e8>] (__driver_attach+0x58/0xcc)
[<c05bd5e8>] (__driver_attach) from [<c05bb414>] (bus_for_each_dev+0x68/0x8c)
[<c05bb414>] (bus_for_each_dev) from [<c05bc38c>] (bus_add_driver+0x1c8/0x1d8)
[<c05bc38c>] (bus_add_driver) from [<c05bddbc>] (driver_register+0x74/0x108)
[<c05bddbc>] (driver_register) from [<c01018c4>] (do_one_initcall+0x84/0x1d8)
[<c01018c4>] (do_one_initcall) from [<c01a3a60>] (do_init_module+0x5c/0x238)
[<c01a3a60>] (do_init_module) from [<c01a5e64>] (load_module+0x2124/0x23e8)
[<c01a5e64>] (load_module) from [<c01a6270>] (sys_init_module+0x148/0x168)
[<c01a6270>] (sys_init_module) from [<c0100060>] (ret_fast_syscall+0x0/0x54)
Exception stack(0xc2267fa8 to 0xc2267ff0)
7fa0:                   00000000 00000000 00bb8010 00005b88 000129d9 00010300
7fc0: 00000000 00000000 00000005 00000080 00005b88 00000000 b6f12ac0 00000000
7fe0: bea06d14 bea06cf8 00011e1c b6ec5ce8
---[ end trace a7031d006cbb3752 ]---