__uart_read_properties(9)
π __uart_read_properties(9) π
okay so this is a page from the Kernel API Manual, and bestie, it's literally about reading the firmware properties of a UART port. let's get into it π
β¨ NAME β¨
__uart_read_properties β read firmware properties of the given UART port π¦
πΈ SYNOPSIS πΈ
int __uart_read_properties (struct uart_port *port , bool use_defaults
);
π ARGUMENTS π
portβ the corresponding port πuse_defaultsβ apply defaults (whentrue) or validate the values (whenfalse) π«Ά
π DESCRIPTION π
so these are the device properties that are supported, no cap:
clock-frequency(optional)fifo-size(optional)no-loopback-test(optional)reg-shift(defaults may apply)reg-offset(value may be validated)reg-io-width(defaults may apply or value may be validated)interrupts(OF only)serial [alias ID](OF only)
so if the port->dev is of struct platform_device type, the interrupt line gets retrieved via the platform_get_irq call against that device. otherwise it gets assigned by the fwnode_irq_get call. either way, index 0 of the resource is the one used fr fr. β
the caller is responsible for initializing the following fields of the port->dev (must be valid): ->flags, ->iobase, ->mapbase, ->mapsize, ->regshift (if use_defaults is false) before calling this function. alternatively those same fields may be zeroed, and in that case the only ones that have associated properties found will be set to the respective values. π
if no error happened, then ->irq, ->mapbase, ->mapsize will be altered. the ->iotype is always altered. periodt. π₯
okay so whenuse_defaultsistrueand the respective property is not found, the following values will be applied:->regshift = 0. In this case IRQ must be provided, otherwise an error will be returned. π
and when use_defaults is false and the respective property is found, the following values will be validated:
reg-io-width(->iotype)reg-offset(->mapsizeagainst->mapbase)
π RETURN π
0 on success, or negative errno on failure π
π¦ SEE ALSO π¦
Kernel file ./drivers/tty/serial/serial_port.c β go read it, iykyk π
aaaand that's the whole thing bestie, slay π
β¨ this page is from the ./drivers/tty/serial corner of the kernel, dated October 2026 β mwah, iconic, no notes ππ§π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms