[Banana Pi BPi-R2] updated OpenWrt image

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 ]---

Thats the annoying msi warning daniel wrote about.

See this on how to fix:

https://github.com/frank-w/BPI-R2-4.14/commits/5.10-pci

I have a smaller patchset (2 patches) but this make errors on other platforms. Maybe on openwrt this is not a problem if it is only applied for target mediatek (afair aarch64 is also not affected):

Patch 2+3 from here(have replaced with full patchset in other trees): https://github.com/frank-w/BPI-R2-4.14/commits/5.10-ir

1 Like

Thanks I will have a look if I can use it in OpenWrt. :slight_smile:

Open the commit in github,add .patch to addressline,save it in the target/mediatek/patches-5.10 folder Should work if there are no conflicting patches applied first

Just compiling and then runtest again:

There is still the hdmi issue:

[    1.452848] mediatek-dpi 14014000.dpi: Found bridge node: /hdmi@14015000
[    1.459788] mediatek-dpi 14014000.dpi: Failed to add component: -517

Imho this is the connwctor/bridge bug that was already fixed in mainline…i wonder why you have this in 5.10. Seems openwrt have backports from 5.12

Breaking commit:

drm/mediatek: mtk_dpi: Create connector for bridges

Fix:

drm/mediatek: Don't support hdmi connector creation

Reference: BPI-R2: HDMI 4k-TV fail

Btw. Spi fix has reached stable (5.10.54).

1 Like

Yep. Now also in Openwrt. :slight_smile: I have to send my BPI-R2 back to reichelt :’( Will need some time until I get a new one. :confused:

Nice I will backport it and runtest again before I will wait for my new R2. :wink:

if openwrt has recent hdmi backports you may need these 2 too:

backports from 5.13 (not yet merged to mainline): https://patchwork.kernel.org/project/linux-mediatek/patch/[email protected]/

from 5.14: https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/commit/?h=mediatek-drm-fixes&id=e062233c0ed0a76b6dd4ec785550419a323f9380

i will test the cursor plane patch next as i noticed a similar problem some time ago with a touchscreen (cursor was placed on last not current position)

https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/commit/?h=mediatek-drm-fixes&id=1a64a7aff8da352c9419de3d5c34343682916411

1 Like

In terms of HDMI OpenWrt really just uses v5.10.54 vanilla as-is. We don’t care much about video support as most people run OpenWrt on headless devices.

Forward-porting v5.10 to the level of v5.14 are 100+ patches touching drivers/soc/mediatek and drivers/gpu/drm/mediatek, so that’s not an option.

I also tried reverting a couple of top commits touching drivers/drm/mediatek and also tried disabling CMDQ. All with no success, situation unchanged. I still suspect we just miss something in DTS or a kernel config symbol which needs to be enabled…

1 Like

I guessed that there is no drm/hdmi backports by default as openwrt is router os for headless use.

Mhm,5.10 should work without additional patches as dts and mt7623 related patches were merged in 5.10. Maybe any config-option is missing?

Mali is not needed for hdmi itself and needs additional mesa libs to work properly

@dangowrt Why does the banana pi r64 labels port numbers differently?

Thanks for your work. I just cloned the actual repository, could build a new kernel, but didn´t find the needed images in the build folder. My own recipe [1] to create an usable sd-card is obsolete ATM Because I´m want to add some packages and settings to the build, the download of the finished image ist not the solution for me. How to setup the menuconfig correctly to get the full image file?

[1] Howto build 19.07.3 openwrt image for bpi r2

First of all this only works on the most recent OpenWrt, ie. 21.02 and 19.07 still come with the old images. If you want to build from source, pretty much like you describe:

git clone https://git.openwrt.org/openwrt/openwrt.git
cd openwrt
rm .config
make menuconfig

now select Mediatek ARM -> MT7623 -> BananaPi BPi-R2

If you want to preserve your existing .config, make sure you select also the bootloader and build squashfs as wll as initramfs images for the sdcard.img.gz to be created. This happens automatically if you start off an empty .config and then select the target.

If you are not modifying any source code but just want to select the packages which are installed, it’s better to use the OpenWrt ImageBuilder which can compose images from existing binaries in a much more reliable and reproducible way than building from source.