Linux Serial subsystem development
 help / color / mirror / Atom feed
* [PATCH 0/7] serial: core: Power the line transceiver with the port
@ 2026-11-11 12:27 Tapio Reijonen
  2026-11-11 12:28 ` [PATCH 1/7] serial: max310x: Look up all channels before adding any port Tapio Reijonen
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Tapio Reijonen @ 2026-11-11 12:27 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Markus Probst
  Cc: linux-serial, devicetree, linux-kernel, Lukas Wunner,
	Christoph Niedermaier, Ilpo Järvinen, Lino Sanfilippo,
	Hugo Villeneuve, Tapio Reijonen, stable

A UART's line transceiver (RS-232, RS-485, isolated or multiprotocol)
has no driver of its own, so it stays powered for as long as the system
is up, whether or not the port is open. On many boards it is the
largest consumer behind the port and can be switched off, through a
shutdown input of the part or a switch in its supply.

Patch 1 is a max310x fix that stands on its own: a GPIO lookup that
defers for a later channel came after the earlier channels' ports were
added, and the probe then looped for as long as the GPIO provider was
missing. It carries Fixes and Cc stable and applies without the rest.

Patch 2 describes that switch in serial.yaml as
transceiver-enable-gpios, with transceiver-startup-delay-us for parts
that need time to come up. Patch 3 rejects the properties on the
dual-channel SC16IS7xx parts, whose two ports share one node. Patch 4
lets serial core request the GPIO when a port is added and switch it in
uart_change_pm(): on before the driver powers the port up, off after the
driver has powered it down, so the transceiver is never switched off
under a running port. That covers open and close, suspend and resume,
registration and the /proc/tty/driver read. A console port stays
powered, as it does today. Without the property nothing changes.

Patches 5 to 7 are for max310x: the transceiver is requested per channel
from the channel's subnode, and a new per-channel flag,
maxim,tristate-when-closed, three-states TX and RTS while the port is
closed, so that the pins do not back-feed an unpowered part behind them.

The series applies on top of the rs485-select series [1]: at
registration, serial core sets the rs485-select-gpios line before it
powers the transceiver up, so that a multiprotocol part comes up in the
configured mode.

Tested on an i.MX6SX UART with an LTC2873 behind its shutdown input and
on a MAX14830 with one LTC2873 and three ADM2484E isolated transceivers
behind switched supplies. On the bus and on the isolated supply: no
drive and no back-feed at open, close, registration, /proc read, hangup
and unbind of an open port; the last character of a write followed by
a close reaches the bus; data in both directions between the two UARTs;
a closed port's unpowered transceiver does not load a live bus. Suspend
and resume were not tested on hardware; they use the same
uart_change_pm() order as close and open.

Tool use: Claude Code (Anthropic) was used throughout. It drafted the
code and the commit messages, reviewed the series against serial core,
wrote the hardware test plans and analysed the logic-analyser captures.
I decided the design, in particular powering the transceiver in
uart_change_pm() and the max310x three-state, reviewed every change
against the code, and ran the hardware tests. The code and the messages
are mine to defend.

[1] https://lore.kernel.org/r/20261105-serial-rs485-mode-gpio-v2-0-027e5348892f@vaisala.com

Signed-off-by: Tapio Reijonen <tapio.reijonen@vaisala.com>
---
Tapio Reijonen (7):
      serial: max310x: Look up all channels before adding any port
      dt-bindings: serial: Add the line transceiver enable GPIO
      dt-bindings: serial: sc16is7xx: Disallow transceiver GPIO on dual parts
      serial: core: Power the line transceiver with the port
      serial: max310x: Request the line transceiver per port
      dt-bindings: serial: max310x: Add maxim,tristate-when-closed
      serial: max310x: Three-state TX and RTS while the port is closed

 .../devicetree/bindings/serial/maxim,max310x.yaml  | 16 ++++
 .../devicetree/bindings/serial/nxp,sc16is7xx.yaml  | 11 +++
 .../devicetree/bindings/serial/serial.yaml         | 14 +++
 drivers/tty/serial/max310x.c                       | 62 +++++++++++---
 drivers/tty/serial/serial_core.c                   | 99 +++++++++++++++++++++-
 include/linux/serial_core.h                        |  3 +
 6 files changed, 189 insertions(+), 16 deletions(-)
---
base-commit: bc71431221f5ba8bb33918399552636e059c2c45
change-id: 20261022-serial-transceiver-supply-9e5b76fbf153
prerequisite-change-id: 20261019-serial-rs485-mode-gpio-e76bb72b6f21:v2
prerequisite-patch-id: cbd0696a89bd2d2c80a6a1767d30e1521a1365eb
prerequisite-patch-id: 7e8ceb778d3d7189c06b6a4730cb3ae30039c174
prerequisite-patch-id: f3cacd874a4d95dd58b19ebd5ce19db6489be5e2

Best regards,
-- 
Tapio Reijonen <tapio.reijonen@vaisala.com>


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-11-11 13:54 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-11 12:27 [PATCH 0/7] serial: core: Power the line transceiver with the port Tapio Reijonen
2026-11-11 12:28 ` [PATCH 1/7] serial: max310x: Look up all channels before adding any port Tapio Reijonen
2026-11-11 12:52   ` sashiko-bot
2026-11-11 12:28 ` [PATCH 2/7] dt-bindings: serial: Add the line transceiver enable GPIO Tapio Reijonen
2026-11-11 12:53   ` sashiko-bot
2026-11-11 12:28 ` [PATCH 3/7] dt-bindings: serial: sc16is7xx: Disallow transceiver GPIO on dual parts Tapio Reijonen
2026-11-11 12:55   ` sashiko-bot
2026-11-11 12:28 ` [PATCH 4/7] serial: core: Power the line transceiver with the port Tapio Reijonen
2026-11-11 13:16   ` sashiko-bot
2026-11-11 12:28 ` [PATCH 5/7] serial: max310x: Request the line transceiver per port Tapio Reijonen
2026-11-11 13:30   ` sashiko-bot
2026-11-11 12:28 ` [PATCH 6/7] dt-bindings: serial: max310x: Add maxim,tristate-when-closed Tapio Reijonen
2026-11-11 13:41   ` sashiko-bot
2026-11-11 12:28 ` [PATCH 7/7] serial: max310x: Three-state TX and RTS while the port is closed Tapio Reijonen
2026-11-11 13:54   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox