1

I'm running Raspberry Pi OS with desktop(Release date: January 11th 2021) in my raspberry pi compute module 4.

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.10.16-v7l #1 SMP Tue Feb 23 19:01:18 CST 2021 armv7l GNU/Linux

It's got a mini PCI express slot, which I plan to use for a 4 port UART card. I've got a card from Diamond systems which uses the EXAR XR17V354 UART chip.

Being an optimist, I plugged in the card and booted, hoping for the best.

Looks like the card is recognized:

pi@raspberrypi:~ $ sudo lspci -v
00:00.0 PCI bridge: Broadcom Limited Device 2711 (rev 20) (prog-if 00 [Normal decode])
    Flags: bus master, fast devsel, latency 0, IRQ 62
    Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
    I/O behind bridge: 00000000-00000fff
    Memory behind bridge: c0000000-c00fffff
    Capabilities: [48] Power Management version 3
    Capabilities: [ac] Express Root Port (Slot-), MSI 00
    Capabilities: [100] Advanced Error Reporting
    Capabilities: [180] Vendor Specific Information: ID=0000 Rev=0 Len=028 <?>
    Capabilities: [240] L1 PM Substates
    Kernel driver in use: pcieport

01:00.0 Serial controller: Exar Corp. Device 0354 (rev 03) (prog-if 02 [16550])
    Flags: bus master, fast devsel, latency 0, IRQ 62
    Memory at 600000000 (32-bit, non-prefetchable) [size=16K]
    Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
    Capabilities: [78] Power Management version 3
    Capabilities: [80] Express Endpoint, MSI 01
    Capabilities: [100] Virtual Channel
    Kernel driver in use: exar_serial

However, dmesg contains no mention of ttys created at boot time. dmesg says:(Couldn't register serial port 0, irq 62, type 2, error -28)

[    1.158476] gpio-507 (ant1): hogged as output/high
[    1.159913] gpio-511 (ant2): hogged as output/low
[    1.161483] brcm-pcie fd500000.pcie: host bridge /scb/pcie@7d500000 ranges:
[    1.161515] brcm-pcie fd500000.pcie:   No bus range found for /scb/pcie@7d500000, using [bus 00-ff]
[    1.161596] brcm-pcie fd500000.pcie:      MEM 0x0600000000..0x063fffffff -> 0x00c0000000
[    1.161686] brcm-pcie fd500000.pcie:   IB MEM 0x0000000000..0x00ffffffff -> 0x0400000000
[    1.215595] brcm-pcie fd500000.pcie: link up, 2.5 GT/s PCIe x1 (SSC)
[    1.215784] brcm-pcie fd500000.pcie: PCI host bridge to bus 0000:00
[    1.215806] pci_bus 0000:00: root bus resource [bus 00-ff]
[    1.215827] pci_bus 0000:00: root bus resource [mem 0x600000000-0x63fffffff] (bus address [0xc0000000-0xffffffff])
[    1.215917] pci 0000:00:00.0: [14e4:2711] type 01 class 0x060400
[    1.216164] pci 0000:00:00.0: PME# supported from D0 D3hot
[    1.219565] PCI: bus0: Fast back to back transfers disabled
[    1.219590] pci 0000:00:00.0: bridge configuration invalid ([bus ff-ff]), reconfiguring
[    1.219850] pci 0000:01:00.0: [13a8:0354] type 00 class 0x070002
[    1.219912] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x00003fff]
[    1.220231] pci 0000:01:00.0: PME# supported from D0 D3hot
[    1.223525] PCI: bus1: Fast back to back transfers disabled
[    1.223547] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    1.223591] pci 0000:00:00.0: BAR 8: assigned [mem 0x600000000-0x6000fffff]
[    1.223614] pci 0000:01:00.0: BAR 0: assigned [mem 0x600000000-0x600003fff]
[    1.223641] pci 0000:00:00.0: PCI bridge to [bus 01]
[    1.223667] pci 0000:00:00.0:   bridge window [mem 0x600000000-0x6000fffff]
[    1.224070] pcieport 0000:00:00.0: enabling device (0140 -> 0142)
[    1.224303] pcieport 0000:00:00.0: PME: Signaling with IRQ 62
[    1.230787] exar_serial 0000:01:00.0: enabling device (0140 -> 0142)
[    1.231081] exar_serial 0000:01:00.0: Couldn't register serial port 0, irq 62, type 2, error -28
[    1.233559] iproc-rng200 fe104000.rng: hwrng registered
[    1.233875] vc-mem: phys_addr:0x00000000 mem_base=0x3ec00000 mem_size:0x40000000(1024 MiB)
[    1.234792] gpiomem-bcm2835 fe200000.gpiomem: Initialised: Registers at 0xfe200000

Then i try to use the xr17v354 official driver.

  • Unbind the native serial driver
root@raspberrypi:/home/pi# lspci -vd 13a8:*
01:00.0 Serial controller: Exar Corp. Device 0354 (rev 03) (prog-if 02 [16550])
    Flags: bus master, fast devsel, latency 0, IRQ 62
    Memory at 600000000 (32-bit, non-prefetchable) [size=16K]
    Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
    Capabilities: [78] Power Management version 3
    Capabilities: [80] Express Endpoint, MSI 01
    Capabilities: [100] Virtual Channel
    Kernel driver in use: exar_serial

root@raspberrypi:/home/pi# ls /sys/bus/pci/drivers/exar_serial/
0000:01:00.0  bind  new_id  remove_id  uevent  unbind
root@raspberrypi:/home/pi# echo -n "0000:01:00.0" >  /sys/bus/pci/drivers/exar_serial/unbind
root@raspberrypi:/home/pi# lspci -vd 13a8:*
01:00.0 Serial controller: Exar Corp. Device 0354 (rev 03) (prog-if 02 [16550])
    Flags: fast devsel, IRQ 62
    Memory at 600000000 (32-bit, non-prefetchable) [size=16K]
    Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
    Capabilities: [78] Power Management version 3
    Capabilities: [80] Express Endpoint, MSI 01
    Capabilities: [100] Virtual Channel

  • Make and install the custom (MaxLinear) Linux driver
root@raspberrypi:/home/pi/Desktop/xr17-lnx2.6.32-and-newer-pak_ver2.6# make
make  -C  /home/pi/Desktop/linux-rpi-5.10.y M=/home/pi/Desktop/xr17-lnx2.6.32-and-newer-pak_ver2.6 modules ARCH=arm 
make[1]: Entering directory '/home/pi/Desktop/linux-rpi-5.10.y'
  CC [M]  /home/pi/Desktop/xr17-lnx2.6.32-and-newer-pak_ver2.6/xr17v35x.o
  MODPOST /home/pi/Desktop/xr17-lnx2.6.32-and-newer-pak_ver2.6/Module.symvers
  CC [M]  /home/pi/Desktop/xr17-lnx2.6.32-and-newer-pak_ver2.6/xr17v35x.mod.o
  LD [M]  /home/pi/Desktop/xr17-lnx2.6.32-and-newer-pak_ver2.6/xr17v35x.ko
make[1]: Leaving directory '/home/pi/Desktop/linux-rpi-5.10.y'
root@raspberrypi:/home/pi/Desktop/xr17-lnx2.6.32-and-newer-pak_ver2.6# insmod xr17v35x.ko 

It also cannot create the tty device. dmesg says:

[ 2377.605398] xr17v35x: loading out-of-tree module taints kernel.
[ 2377.606875] Exar PCIe (XR17V35x) serial driver Revision: 2.6
[ 2377.607409] ------------[ cut here ]------------
[ 2377.607454] WARNING: CPU: 0 PID: 1155 at arch/arm/mm/ioremap.c:287 __arm_ioremap_pfn_caller+0x1f4/0x218
[ 2377.607470] Modules linked in: xr17v35x(O+) fuse sha256_generic cfg80211 rfkill 8021q garp stp llc vc4 cec drm_kms_helper v3d gpu_sched raspberrypi_hwmon bcm2835_isp(C) bcm2835_codec(C) bcm2835_v4l2(C) v4l2_mem2mem bcm2835_mmal_vchiq(C) drm videobuf2_dma_contig videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev mc vc_sm_cma(C) snd_bcm2835(C) rpivid_mem drm_panel_orientation_quirks snd_soc_core snd_compress snd_pcm_dmaengine snd_pcm snd_timer snd syscopyarea sysfillrect sysimgblt fb_sys_fops backlight uio_pdrv_genirq uio i2c_dev ip_tables x_tables ipv6
[ 2377.608186] CPU: 0 PID: 1155 Comm: insmod Tainted: G         C O      5.10.16-v7l #1
[ 2377.608196] Hardware name: BCM2711
[ 2377.608208] Backtrace: 
[ 2377.608243] [<c0b63178>] (dump_backtrace) from [<c0b63508>] (show_stack+0x20/0x24)
[ 2377.608259]  r7:ffffffff r6:00000000 r5:60000013 r4:c12e69fc
[ 2377.608280] [<c0b634e8>] (show_stack) from [<c0b678a0>] (dump_stack+0xcc/0xf8)
[ 2377.608300] [<c0b677d4>] (dump_stack) from [<c0220b8c>] (__warn+0xfc/0x114)
[ 2377.608316]  r10:c0eb1098 r9:00000009 r8:c0217a2c r7:0000011f r6:00000009 r5:c0217a2c
[ 2377.608327]  r4:c0e1b020 r3:c1205094
[ 2377.608345] [<c0220a90>] (__warn) from [<c0b63c78>] (warn_slowpath_fmt+0x70/0xd8)
[ 2377.608358]  r7:0000011f r6:c0e1b020 r5:c1205048 r4:00000000
[ 2377.608378] [<c0b63c0c>] (warn_slowpath_fmt) from [<c0217a2c>] (__arm_ioremap_pfn_caller+0x1f4/0x218)
[ 2377.608393]  r9:00000000 r8:00000000 r7:00000000 r6:00000001 r5:00000000 r4:00004000
[ 2377.608412] [<c0217838>] (__arm_ioremap_pfn_caller) from [<c0217abc>] (__arm_ioremap_caller+0x6c/0x74)
[ 2377.608428]  r10:03b9aca0 r9:00000006 r8:c42ba000 r7:00000000 r6:00003fff r5:00000000
[ 2377.608438]  r4:00000000
[ 2377.608454] [<c0217a50>] (__arm_ioremap_caller) from [<c0217b1c>] (ioremap+0x30/0x38)
[ 2377.608467]  r7:00000000 r6:00000000 r5:00000000 r4:c0217a50
[ 2377.608502] [<c0217aec>] (ioremap) from [<bf46910c>] (pci_default_setup+0xf8/0x114 [xr17v35x])
[ 2377.608512]  r4:c4b2bab8
[ 2377.608546] [<bf469014>] (pci_default_setup [xr17v35x]) from [<bf46a8cc>] (init_one_xrpciserialcard+0x1a4/0x300 [xr17v35x])
[ 2377.608561]  r9:00000000 r8:c42ba000 r7:00000000 r6:c1205048 r5:c1816000 r4:bf46c0d4
[ 2377.608588] [<bf46a728>] (init_one_xrpciserialcard [xr17v35x]) from [<c07a6b64>] (pci_device_probe+0xb0/0x138)
[ 2377.608604]  r10:00000000 r9:bf46c400 r8:bf46c38c r7:00000000 r6:bf46c35c r5:c1816000
[ 2377.608615]  r4:c1816070
[ 2377.608634] [<c07a6ab4>] (pci_device_probe) from [<c08441a8>] (really_probe+0x100/0x3c8)
[ 2377.608650]  r9:00000018 r8:bf46c38c r7:00000000 r6:c14001d8 r5:c14001d0 r4:c1816070
[ 2377.608665] [<c08440a8>] (really_probe) from [<c084465c>] (driver_probe_device+0x6c/0xc4)
[ 2377.608680]  r10:c1205048 r9:bf46c5c0 r8:c37fe3c0 r7:c08448ac r6:bf46c38c r5:bf46c38c
[ 2377.608690]  r4:c1816070 r3:00000000
[ 2377.608706] [<c08445f0>] (driver_probe_device) from [<c08448a4>] (device_driver_attach+0x68/0x70)
[ 2377.608716]  r5:00000000 r4:c1816070
[ 2377.608731] [<c084483c>] (device_driver_attach) from [<c0844914>] (__driver_attach+0x68/0xdc)
[ 2377.608744]  r7:c08448ac r6:c1816070 r5:bf46c38c r4:00000000
[ 2377.608763] [<c08448ac>] (__driver_attach) from [<c0842210>] (bus_for_each_dev+0x84/0xc4)
[ 2377.608776]  r7:c08448ac r6:bf46c38c r5:c1205048 r4:c208f734
[ 2377.608793] [<c084218c>] (bus_for_each_dev) from [<c0843b24>] (driver_attach+0x2c/0x30)
[ 2377.608806]  r7:00000000 r6:c4914700 r5:c12e7ca4 r4:bf46c38c
[ 2377.608821] [<c0843af8>] (driver_attach) from [<c0843474>] (bus_add_driver+0x1c8/0x1e8)
[ 2377.608836] [<c08432ac>] (bus_add_driver) from [<c0844fe0>] (driver_register+0x84/0x118)
[ 2377.608849]  r7:00000000 r6:00000002 r5:bf46b61c r4:bf46c38c
[ 2377.608867] [<c0844f5c>] (driver_register) from [<c07a5de4>] (__pci_register_driver+0x58/0x5c)
[ 2377.608878]  r5:bf46b61c r4:00000000
[ 2377.608904] [<c07a5d8c>] (__pci_register_driver) from [<bf08e048>] (serialxr_init+0x48/0x1000 [xr17v35x])
[ 2377.608915]  r5:bf08e000 r4:00000000
[ 2377.608942] [<bf08e000>] (serialxr_init [xr17v35x]) from [<c02022a8>] (do_one_initcall+0x50/0x274)
[ 2377.608953]  r5:bf08e000 r4:c1205048
[ 2377.608972] [<c0202258>] (do_one_initcall) from [<c02cb710>] (do_init_module+0x70/0x274)
[ 2377.608985]  r8:c37fe3c0 r7:c37fe380 r6:00000002 r5:c484bf40 r4:bf46c5c0
[ 2377.609000] [<c02cb6a0>] (do_init_module) from [<c02cdee0>] (load_module+0x244c/0x277c)
[ 2377.609012]  r6:00000002 r5:00000002 r4:c4b2bf30
[ 2377.609029] [<c02cba94>] (load_module) from [<c02ce498>] (sys_finit_module+0xc8/0xfc)
[ 2377.609043]  r10:0000017b r9:c4b2a000 r8:c0200204 r7:00000003 r6:0002d064 r5:00000000
[ 2377.609053]  r4:c1205048
[ 2377.609069] [<c02ce3d0>] (sys_finit_module) from [<c0200040>] (ret_fast_syscall+0x0/0x28)
[ 2377.609082] Exception stack(0xc4b2bfa8 to 0xc4b2bff0)
[ 2377.609096] bfa0:                   9bb9fa00 befcd354 00000003 0002d064 00000000 00000005
[ 2377.609111] bfc0: 9bb9fa00 befcd354 0003fce8 0000017b 0115a2b0 00000000 00000002 00000000
[ 2377.609123] bfe0: befcd188 befcd178 00022cb8 b6beaaf0
[ 2377.609137]  r7:0000017b r6:0003fce8 r5:befcd354 r4:9bb9fa00
[ 2377.609151] ---[ end trace 414fa36f217afcbd ]---

A few questions:

  1. How do i fix "Couldn't register serial port 0, irq 62, type 2, error -28"?
  2. How do i use the the xr17v354 official driver?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.