[PATCH 0/3] serial: max310x: honour per-port DT RS485 properties
From: Tapio Reijonen
Date: Mon May 25 2026 - 05:44:11 EST
The MAX310x DT binding pulls in /schemas/serial/rs485.yaml via its allOf
list, but the driver has never actually called uart_get_rs485_mode(), so
none of the advertised rs485-* properties take effect at runtime.
This series wires per-port RS485 DT configuration end to end:
Patch 1 reorders the probe so the gpio_chip is registered before
uart_add_one_port(). A port can then reference one of the chip's own
GPIOs (e.g. rs485-term-gpios = <&max310x ...>) without -EPROBE_DEFER
from its own provider - prerequisite for patch 3.
Patch 2 extends the binding with a "port@N" subnode pattern (N = 0..3)
carrying per-port RS485 properties. All ports share the same parent
SPI/I2C device, so per-port differentiation requires distinct DT
subnodes. Top-level RS485 properties remain accepted for compatibility
with single-port chips (max3107, max3108).
Patch 3 reads each port's RS485 properties from its own subnode by
temporarily retargeting dev->fwnode while uart_get_rs485_mode() runs.
For single-port variants, falls back to the chip's own fwnode when no
port@0 subnode is present.
Note for maintainers: patch 3 mutates the parent SPI/I2C device's
fwnode around the uart_get_rs485_mode() call so the underlying
property/GPIO lookups resolve against the per-port DT subnode. Probe
is serialised, so the swap is locally safe, but I'd appreciate
feedback on whether this idiom is acceptable. If a cleaner shape is
preferred (a serial_core helper that takes a fwnode directly, or
one struct device per port), I'll respin accordingly.
Tested on max14830 (SPI, 4 ports): each ttyMAXn port comes up with the
rs485 flags and delays configured in its port@N subnode, and the
termination GPIO sourced from the MAX310x's own gpio_chip is resolved
without probe deferral.
Signed-off-by: Tapio Reijonen <tapio.reijonen@xxxxxxxxxxx>
---
Tapio Reijonen (3):
serial: max310x: register GPIO controller before adding UART ports
dt-bindings: serial: maxim,max310x: allow per-port subnodes for rs485
serial: max310x: honour rs485 properties from per-port DT subnode
.../devicetree/bindings/serial/maxim,max310x.yaml | 60 ++++++++++++++
drivers/tty/serial/max310x.c | 91 +++++++++++++++++-----
2 files changed, 130 insertions(+), 21 deletions(-)
---
base-commit: 79bd2dded182b1d458b18e62684b7f82ffc682e5
change-id: 20260525-b4-max310x-rs485-dt-ebff12af9976
Best regards,
--
Tapio Reijonen <tapio.reijonen@xxxxxxxxxxx>