Skip to content

lopper:assists:petalinuxconfig: predict Linux tty device names for se… - #791

Merged
zeddii merged 1 commit into
devicetree-org:masterfrom
Rajukumar45:master
Jul 24, 2026
Merged

lopper:assists:petalinuxconfig: predict Linux tty device names for se…#791
zeddii merged 1 commit into
devicetree-org:masterfrom
Rajukumar45:master

Conversation

@Rajukumar45

Copy link
Copy Markdown
Contributor

…rial nodes

Emit a tty_device field (ttyPS0, ttyUL0, ...) for each serial slave in sys_hw_data.yaml, reproducing how the kernel serial drivers allocate their tty line numbers so downstream tooling can map a UART to its Linux console.

The tty prefix is taken from the input schema (sdt_ipinfo.yaml) console_prefix field, matched via the node's compatible string. The line number is allocated per the actual driver behavior:

  • Alias-honoring drivers (ttyPS/xilinx_uartps, ttyAMA/amba-pl011) call of_alias_get_id("serial"), so a node's serialN alias id becomes the tty line directly (gaps allowed).
  • Dynamic drivers (ttyUL/uartlite, ttyS/8250) ignore the serial alias and use an explicit port-number property, otherwise the next free line in probe order.

Fixed lines (alias id / port-number) are reserved first, then the remaining nodes fall back to the lowest free line per prefix, avoiding collisions.

Also drop the redundant serial_port field (the info is already carried by aliases) and precompute a compatible->console_prefix lookup so prefix resolution is O(1) per node instead of rescanning the schema each time.

…rial nodes

Emit a `tty_device` field (ttyPS0, ttyUL0, ...) for each serial slave in
sys_hw_data.yaml, reproducing how the kernel serial drivers allocate their
tty line numbers so downstream tooling can map a UART to its Linux console.

The tty prefix is taken from the input schema (sdt_ipinfo.yaml)
`console_prefix` field, matched via the node's compatible string. The line
number is allocated per the actual driver behavior:

  - Alias-honoring drivers (ttyPS/xilinx_uartps, ttyAMA/amba-pl011) call
    of_alias_get_id("serial"), so a node's serialN alias id becomes the tty
    line directly (gaps allowed).
  - Dynamic drivers (ttyUL/uartlite, ttyS/8250) ignore the serial alias and
    use an explicit `port-number` property, otherwise the next free line in
    probe order.

Fixed lines (alias id / port-number) are reserved first, then the remaining
nodes fall back to the lowest free line per prefix, avoiding collisions.

Also drop the redundant `serial_port` field (the info is already carried by
`aliases`) and precompute a compatible->console_prefix lookup so prefix
resolution is O(1) per node instead of rescanning the schema each time.

Signed-off-by: Raju Kumar Pothuraju <rajukumar.pothuraju@amd.com>
@zeddii
zeddii merged commit f65ee96 into devicetree-org:master Jul 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants