Follow up: this indeed does the trick. Here's the correct patch for current master branch (kernel version 6.6.56):
--- a/drivers/bus/mhi/host/pci_generic.c
+++ b/drivers/bus/mhi/host/pci_generic.c
@@ -621,6 +621,9 @@
.driver_data = (kernel_ulong_t) &mhi_telit_fn980_hw_v1_info },
{ PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0306),
.driver_data = (kernel_ulong_t) &mhi_qcom_sdx55_info },
+ /* RM520N-GL variant with Qualcomm vendor and subvendor ID */
+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x0308, PCI_VENDOR_ID_QCOM, 0x5201),
+ .driver_data = (kernel_ulong_t) &mhi_quectel_rm5xx_info },
/* Telit FN990 */
{ PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x0308, 0x1c5d, 0x2010),
.driver_data = (kernel_ulong_t) &mhi_telit_fn990_info },
--- a/drivers/net/wwan/mhi_wwan_mbim.c
+++ b/drivers/net/wwan/mhi_wwan_mbim.c
@@ -209,7 +209,7 @@
if (mbim->rx_seq + 1 != le16_to_cpu(nth16->wSequence) &&
(mbim->rx_seq || le16_to_cpu(nth16->wSequence)) &&
!(mbim->rx_seq == 0xffff && !le16_to_cpu(nth16->wSequence))) {
- net_err_ratelimited("sequence number glitch prev=%d curr=%d\n",
+ net_dbg_ratelimited("sequence number glitch prev=%d curr=%d\n",
mbim->rx_seq, le16_to_cpu(nth16->wSequence));
}
mbim->rx_seq = le16_to_cpu(nth16->wSequence);
Now I get a wwan0
netdev interface and wwan0mbim0
device. Time to figure out how to actually establish a cellular connection now. Modem manager doesn't show any devices.
Does anyone know whether I'm supposed to get a ttyUSB2
and /dev/cdc-wdm0
device? I see neither of these two right now. @ChrisW maybe you know? Sorry for pestering you 
EDIT:
I am now successfully running Vanilla OpenWRT with Linux Mainline drivers. I previously attempted to change the kernel build to just compile in the WWAN drivers, which resulted in ModemManager not recognizing the modem as PCIe device, only as PPP (serial) modem. After changing this to kernel modules (through kmod) in the OpenWRT build config, I'm now successfully running MBIM PCIe mode.
Here's the relevant parts (+USB support) from my .config
in OpenWRT:
CONFIG_PACKAGE_kmod-mhi-net=y
CONFIG_PACKAGE_kmod-mhi-wwan-ctrl=y
CONFIG_PACKAGE_kmod-mhi-wwan-mbim=y
CONFIG_PACKAGE_kmod-wwan=y
CONFIG_PACKAGE_kmod-usb-net-qmi-wwan=y
CONFIG_PACKAGE_kmod-usb-net=y
CONFIG_PACKAGE_kmod-usb-serial=y
CONFIG_PACKAGE_kmod-usb3=y
CONFIG_PACKAGE_kmod-usb-serial-wwan=y
CONFIG_PACKAGE_kmod-usb-serial-option=y
Interestingly, the USB controller on this device is XHCI, but the speed seems way below that. Benchmarks show that USB mode limits at ~300 Mbps download, while PCIe mode is pretty boring the SOC at even 1.2 Gbps.
Overall, have to say, I'm really happy with this OpenWRT setup now. I bought the device for its hardware and not the GL.Inet stock firmware and it feels great to run a minimal installation. Maybe on of these days, I will go a step further and get rid of OpenWRT too.
TL,DR: You don't need the Quectel drivers anymore with a bit of hackery. Once the driver fixes are in mainline, it should just work right away if you build the image with the right kmod packages.