ttyS1/uart1初始化但不能通过/dev/ttyS1访问。

时间:2021-08-13 08:45:22

Apologies if this is the wrong place for this question, I'm not currently sure which level the problem is at so I'm hedging my bets a tad.

如果这是一个错误的地方,我现在还不确定是哪个级别的问题,所以我在两面下注。

System is a LeopardBoard DM368 running TI's own SDK / LSP / BusyBox kernel.

系统是一种用于运行TI自己的SDK / LSP / BusyBox内核的LeopardBoard DM368。

By default the system has one UART enabled, UART0, mounted as /dev/ttyS0 which is also used/invoked via the bootargs console=ttyS0,115200n8 earlyprintk.

默认情况下,系统有一个UART, UART0,安装为/dev/ttyS0,也可以通过bootargs控制台=ttyS0,115200n8 earlyprintk使用/调用。

We want to enable UART1 as /dev/ttyS1, so have gone through the low-level board initialisation code which sets up the pinmux, clocks, etc.

我们希望将UART1作为/dev/ttyS1启用,因此已经通过了设置pinmux、时钟等的低级板初始化代码。

On booting, the low-level init reports (via printk's I added in) that it's enabled the UART1, and the driver code reports happiness too:

在引导时,底层的init报告(通过printk的I添加进来)使UART1得以启用,并且驱动程序代码也报告了幸福:

[    0.547812] serial8250.0: ttyS0 at MMIO 0x1c20000 (irq = 40) is a 16550A
[    0.569849] serial8250.0: ttyS1 at MMIO 0x1d06000 (irq = 41) is a 16550A

However, the port does not (reliably) appear in /dev/, and there are discrepancies with its status (flow control bits) which I suspect may be causing it to hang / never transmit:

然而,该端口不能(可靠地)出现在/dev/中,并且与它的状态(流控制位)存在差异,我怀疑它可能导致它挂/不发送:

cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:16550A mmio:0x01C20000 irq:40 tx:97998 rx:0 CTS|DSR
1: uart:16550A mmio:0x01D06000 irq:41 tx:0 rx:0 DSR

If I try to modify it from the command line I get an error:

如果我试图从命令行修改它,我得到一个错误:

>: stty -F /dev/ttyS1
stty: /dev/ttyS1: Inappropriate ioctl for device

Bizarrely, if I change the bootargs to console=ttyS1,115200n8 earlyprintk the port works perfectly, and ttyS0 is initialised correctly and works too:

奇怪的是,如果我将bootargs更改为控制台=ttyS1,115200n8 earlyprintk这个端口工作得很好,ttyS0也被正确地初始化,并且工作:

cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:16550A mmio:0x01C20000 irq:40 tx:0 rx:0 CTS|DSR
1: uart:16550A mmio:0x01D06000 irq:41 tx:11563 rx:0 RTS|DTR|DSR

Now, that would be fine, but our bootloader must use UART0 so it would be nice to keep all the console stuff on ttyS0 and have ttyS1 for our secondary comms.

现在,这很好,但是我们的引导程序必须使用UART0,所以在ttyS0上保留所有的控制台内容,并为我们的二级逗号保留ttyS1会很好。

Edit to add: I inserted a couple of printk's into serial_core.c and it seems like uart_open() is never being called for ttyS1, I'm assuming it's something in the Linux init/startup sequence that needs modifying?

编辑添加:我插入了几个printk到serial_core。看起来uart_open()从来没有被称为ttyS1,我假设它是需要修改的Linux init/启动序列中的某个东西?

I'll state now that I'm not a hardy Linux hacker so it's entirely possible I've missed some obvious/dumb thing in either the kernel code, initialisation sequence, etc.

我现在声明,我不是一个勇敢的Linux黑客,所以完全有可能在内核代码、初始化序列等方面遗漏了一些明显的/愚蠢的东西。

Any thoughts greatly appreciated!

任何思想大大赞赏!

1 个解决方案

#1


0  

Well a nice chap over on the Linux board solved it, I need to insert a mknod /dev/ttyS1 c 4 65 somewhere.

在Linux版上有个不错的家伙解决了这个问题,我需要在某个地方插入一个mknod /dev/ttyS1 c465。

Quite why this (apparently) happens for ttyS0 or whichever port is console I don't know, but right now all that matters is it works!

为什么这(显然)发生在ttyS0或者哪个端口是控制台,我不知道,但是现在所有的事情都是有效的!

Comments / further info on the reasons why would be welcome for my own knowledge / future generations.

关于为什么会欢迎我自己的知识/后代的原因的评论/进一步的信息。

#1


0  

Well a nice chap over on the Linux board solved it, I need to insert a mknod /dev/ttyS1 c 4 65 somewhere.

在Linux版上有个不错的家伙解决了这个问题,我需要在某个地方插入一个mknod /dev/ttyS1 c465。

Quite why this (apparently) happens for ttyS0 or whichever port is console I don't know, but right now all that matters is it works!

为什么这(显然)发生在ttyS0或者哪个端口是控制台,我不知道,但是现在所有的事情都是有效的!

Comments / further info on the reasons why would be welcome for my own knowledge / future generations.

关于为什么会欢迎我自己的知识/后代的原因的评论/进一步的信息。