如何在 ARMv71 上的 Debian Jessie 下使用 PCI Express 串行卡?

如何在 ARMv71 上的 Debian Jessie 下使用 PCI Express 串行卡?

我在我的 Hummingboard(一款基于 iMX6 的 ARM SBC)上运行 Debian Jessie。

root@torpedo:~# uname -a
Linux torpedo 4.11.4-cubox #2 SMP Tue Jun 13 14:51:52 CEST 2017 armv7l GNU/Linux

它有一个 mini PCI Express 插槽,我打算用它来插 4 端口 UART 卡。我有一个Diamond 系统出品的卡,采用 EXAR XR17V354 UART 芯片

作为一个乐观主义者,我插入卡并启动,希望获得最好的结果。

看起来该卡已被识别:

root@torpedo:~# lspci -v
00:00.0 PCI bridge: Synopsys, Inc. Device abcd (rev 01) (prog-if 00 [Normal deco             de])
        Flags: bus master, fast devsel, latency 0
        Memory at 01000000 (32-bit, non-prefetchable) [size=1M]
        Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
        Memory behind bridge: 01100000-011fffff
        [virtual] Expansion ROM at 01200000 [disabled] [size=64K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable+ 64bit+
        Capabilities: [70] Express Root Port (Slot-), MSI 00
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [140] Virtual Channel
        Kernel driver in use: pcieport

01:00.0 Serial controller: Exar Corp. Device 0354 (rev 03) (prog-if 02 [16550])
        Flags: fast devsel, IRQ 334
        Memory at 01100000 (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

然而,消息没有提及在启动时创建的 tty,除了与 Hummingboard 相关的 GPIO 之外,它们一直都存在。

供应商 (Diamond) 提供了一个自定义驱动程序,我下载并从源代码构建了该驱动程序。当我加载.ko消息说:

[  640.564446] DSMPESER4MDriver: loading out-of-tree module taints kernel.
[  640.565123] The init fun get called
[  640.565199] pci 0000:01:00.0: enabling device (0140 -> 0142)
[  640.565359] DS-MPE-SER4M driver loaded

/var/log/消息说:

root@torpedo:~# tail -f /var/log/messages
...
Apr 17 15:48:50 torpedo kernel: DSMPESER4MDriver: loading out-of-tree module taints kernel.
Apr 17 15:48:50 torpedo kernel: The init fun get called
Apr 17 15:48:50 torpedo kernel: pci 0000:01:00.0: enabling device (0140 -> 0142)
Apr 17 15:48:50 torpedo kernel: DS-MPE-SER4M driver loaded

几个问题:

  1. 我该如何修复“加载树外模块污染内核”?(不是技术问题 - 请参阅评论)
  2. 如何使用姆诺德创造/dev/tty该驱动程序的文件?
  3. 如何配置模块在启动时加载?

答案1

EXAR 文档是正确的。这个委员会受现代 Linux 内核支持。对我来说,这个问题是我的内核配置为总共仅支持 4 个串行端口。

在 Hummingboard 上,片上 UART 占用了前 4 个 UART。我重新配置了内核,使其最多支持 16 个串行端口。按照以下方法重建内核Debian 特定方法。已重启。

root@torpedo:~# uname -a
Linux torpedo 4.16.2whoi-armhf #1 SMP Wed Apr 18 16:56:21 GMT 2018 armv7l GNU/Linux

新内核已安装并运行...检查 PCI 总线:

root@torpedo:~# lspci -vv
...
01:00.0 Serial controller: Exar Corp. Device 0354 (rev 03) (prog-if 02 [16550])
        Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR+ FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0, Cache Line Size: 64 bytes
        Interrupt: pin A routed to IRQ 334
        Region 0: Memory at 01100000 (32-bit, non-prefetchable) [size=16K]
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
                Address: 0000000000000000  Data: 0000
        Capabilities: [78] Power Management version 3
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold-)
                Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
        Capabilities: [80] Express (v2) Endpoint, MSI 01
                DevCap: MaxPayload 256 bytes, PhantFunc 0, Latency L0s <64ns, L1 <1us
                        ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
                DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
                        RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop+
                        MaxPayload 128 bytes, MaxReadReq 512 bytes
                DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
                LnkCap: Port #1, Speed 2.5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s <64ns, L1 <1us
                        ClockPM- Surprise- LLActRep- BwNot-
                LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk-
                        ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
                LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk- DLActive- BWMgmt- ABWMgmt-
                DevCap2: Completion Timeout: Not Supported, TimeoutDis-, LTR-, OBFF Not Supported
                DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled
                LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
                         Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
                         Compliance De-emphasis: -6dB
                LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1-
                         EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
        Capabilities: [100 v1] Virtual Channel
                Caps:   LPEVC=0 RefClk=100ns PATEntryBits=1
                Arb:    Fixed- WRR32- WRR64- WRR128-
                Ctrl:   ArbSelect=Fixed
                Status: InProgress-
                VC0:    Caps:   PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
                        Arb:    Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
                        Ctrl:   Enable+ ID=0 ArbSelect=Fixed TC/VC=ff
                        Status: NegoPending- InProgress-
        Kernel driver in use: exar_serial

看来我没有破坏 PCI 总线。

内核是否找到了 UART?

root@torpedo:~# dmesg|grep tty
[    0.000000] Kernel command line: root=/dev/mmcblk0p1 rootfstype=ext4 rootwait console=tty1 consoleblank=0 video=mxcfb0:dev=hdmi,1920x1080m60,if=RGB24,bpp=32 rd.dm=0 rd.luks=0 rd.lvm=0 raid=noautodetect pci=nomsi vt.global_cursor_default=0 loglevel=1
[    0.001375] console [tty1] enabled
[    1.220660] 0000:01:00.0: ttyS0 at MMIO 0x1100000 (irq = 334, base_baud = 7812500) is a XR17V35X
[    1.221093] 0000:01:00.0: ttyS1 at MMIO 0x1100400 (irq = 334, base_baud = 7812500) is a XR17V35X
[    1.221498] 0000:01:00.0: ttyS2 at MMIO 0x1100800 (irq = 334, base_baud = 7812500) is a XR17V35X
[    1.221896] 0000:01:00.0: ttyS3 at MMIO 0x1100c00 (irq = 334, base_baud = 7812500) is a XR17V35X
[    1.222587] 2020000.serial: ttymxc0 at MMIO 0x2020000 (irq = 26, base_baud = 5000000) is a IMX
[    1.223350] 21ec000.serial: ttymxc2 at MMIO 0x21ec000 (irq = 70, base_baud = 5000000) is a IMX
[    1.224122] 21f0000.serial: ttymxc3 at MMIO 0x21f0000 (irq = 71, base_baud = 5000000) is a IMX

很酷。有用。

相关内容