1. 程式人生 > >How to call UART0 “ttyPS0” and UART1 “ttyPS1”?

How to call UART0 “ttyPS0” and UART1 “ttyPS1”?

https://forums.xilinx.com/t5/Embedded-Linux/How-to-call-UART0-quot-ttyPS0-quot-and-UART1-quot-ttyPS1-quot/td-p/518435
How to call UART0 “ttyPS0” and UART1 “ttyPS1”?
Jump to solution
I wanted to use both UARTs and ran into serious weirdness.

UART0 is the serial console. So far it also used to be called “ttyPS0” by the system.

I enabled the second UART, routed through EMIO, and suddenly lost my kernel console.

After a few frustrating hours, I found the cause:

When UART0 is the only UART, it is “ttyPS0”.

When UART0 and UART1 are both present, UART0 will suddenly be called “ttyPS1” and UART1 takes over the “ttyPS0” name.

Since this is rather silly, and because the use of UART1 is optional and I don’t want to use different bootargs just because someone decided that 1 is 0 or so, I’d like my UART0 to remain “ttyPS0”.

How can I get the kernel to call UART0 “ttyPS0” and UART1 “ttyPS1” like mere mortals would expect?

Re: How to call UART0 “ttyPS0” and UART1 “ttyPS1”?
I think I found it, I needed to specify BOTH serial aliasses. In the DT root, adding these references fixes it so that UART0 is ttyS0. When setting just one, it will see UART1 first and assign it #0, after which it probes UART0 and cannot assign it to #0.

Something like this:

aliases {

serial0 = &uart0;

serial1 = &uart1;

};

Now it works as expected, ttyPS0 is the console and ttyPS1 can be used for funky things in logic.