Re: [PATCH 0/7] serial: uartps: Revert dynamic port allocation

From: Maarten Brock
Date: Fri Apr 03 2020 - 12:19:20 EST


On 2020-04-03 11:51, Michal Simek wrote:

Thanks. I am definitely interested to hear more how this could be done
differently because that hardcoded limits are painful.
On FPGAs you can have a lot of uarts for whatever reason and users are
using DT aliases to have consistent naming.
Specifically on Xilinx devices we are using uartps which is ttyPS,
uartlite which is ttyUL, ns16500 which is ttyS and also pl011 which is
ttyAMA.
Only ttyAMA or ttyPS on one chip are possible.

And right now you can't have serial0 alias pointed ttyPS0 and another
serial0 pointed to ttyUL0 or ttyS0. That's why others are shifted and we
can reach that hardcoded NR_UART limit easily.
And this was the reason why I have done these patches in past to remove
any limit from these drivers and if user asks for serial100 alias you
simply get ttyPS100 node.

I would argue that the trouble originates from every uart driver using
its own naming scheme and thereby creating separate namespaces. If all
uarts would register as /dev/ttySnn then the serialN alias method would
work. These non-overlapping namespaces is something the linux kernel
driver community has allowed to happen.

If the namespaces are not abandoned and disallowed, then the serialN
alias method must no longer be used for any driver that does not create
/dev/ttySnn devices. Every namespace will require its own alias base.
Or forget about deriving the number from an alias and set the number in
a property in the device tree node itself. The latter has my preference.

Maarten